[mobile_static] Fixed test that needed test .dlls explicitly named
[mono-project.git] / eglib / configure.ac
blob2197c6f9c96605404f19ee9bc6b0b038f94986fb
2 # Copyright 2012 Xamarin Inc
4 AC_INIT(eglib, [0.3],
5         [http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
7 AC_CONFIG_SRCDIR([README])
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CANONICAL_SYSTEM
10 AC_CANONICAL_HOST
12 AM_INIT_AUTOMAKE([1.9 dist-bzip2 tar-ustar no-dist-gzip foreign])
13 AC_CONFIG_HEADERS([config.h])
14 AM_MAINTAINER_MODE
16 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
18 AC_PROG_CC
19 AM_PROG_LIBTOOL
20 # Use dolt (http://dolt.freedesktop.org/) instead of libtool for building.
21 DOLT
22 GNUC_PRETTY=
23 GNUC_UNUSED=
24 BREAKPOINT="G_STMT_START { raise (SIGTRAP); } G_STMT_END"
25 if test x$GCC = xyes; then
26    GNUC_UNUSED='__attribute__((__unused__))'
27    GNUC_NORETURN='__attribute__((__noreturn__))'
28    case $host_cpu in
29      i*86|x86_64) BREAKPOINT="G_STMT_START { __asm__ (\"int \$03\"); } G_STMT_END" ;;
30    esac
32 AC_SUBST(GNUC_PRETTY)
33 AC_SUBST(GNUC_UNUSED)
34 AC_SUBST(GNUC_NORETURN)
35 AC_SUBST(BREAKPOINT)
37 # We use a separate variable to pass down CPPFLAGS and CFLAGS from the main mono 
38 # configure, because of autoconf brokeness
39 if test "x$CPPFLAGS_FOR_EGLIB" != "x"; then
40    CPPFLAGS=$CPPFLAGS_FOR_EGLIB
42 if test "x$CFLAGS_FOR_EGLIB" != "x"; then
43    CFLAGS=$CFLAGS_FOR_EGLIB
46 CFLAGS="$CFLAGS -g -D_GNU_SOURCE"
48 AM_CONDITIONAL(CROSS_COMPILING, [test x$cross_compiling = xyes])
49 AC_C_BIGENDIAN([ORDER=G_BIG_ENDIAN],[ORDER=G_LITTLE_ENDIAN])
51 platform_darwin=no
52 platform_android=no
54 case $host in
55 *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
56     PATHSEP='\\'
57     SEARCHSEP=';'
58     OS="WIN32"
59     PIDTYPE='void *'
60     ;;
61 *-*darwin*)
62     platform_darwin=yes
63     PATHSEP='/'
64     SEARCHSEP=':'
65     OS="UNIX"
66     PIDTYPE='int'
67     ;;
68 *-*-linux-android*)
69     platform_android=yes
70         AC_DEFINE(PLATFORM_ANDROID,1,[Targeting the Android platform])
71     PATHSEP='/'
72     SEARCHSEP=':'
73     OS="UNIX"
74     PIDTYPE='int'
75     ;;
77     PATHSEP='/'
78     SEARCHSEP=':'
79     OS="UNIX"
80     PIDTYPE='int'
81     ;;
82 esac
84 case $host in
85         *-*-solaris*)
86         CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
87         ;;
88 esac
90 case $target in
91 arm*-darwin*|aarch64*-*)
92     CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
93     ;;
94 i*86-*-darwin*)
95     ORDER=G_LITTLE_ENDIAN
96     ;;
97 *-*-openbsd*)
98     CFLAGS="$CFLAGS -pthread"
99     LDFLAGS="$LDFLAGS -pthread"
100     ;;
101 esac
103 target_osx=no
104 target_ios=no
106 if test "x$platform_darwin" = "xyes"; then
107         AC_TRY_COMPILE([#include "TargetConditionals.h"],[
108         #if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1
109         #error fail this for ios
110         #endif
111         return 0;
112         ], [
113                 AC_DEFINE(TARGET_OSX,1,[The JIT/AOT targets OSX])
114                 target_osx=yes
115         ], [
116                 AC_DEFINE(TARGET_IOS,1,[The JIT/AOT targets iOS])
117                 target_ios=yes
118         ])
119    AC_DEFINE(TARGET_MACH,1,[The JIT/AOT targets Apple platforms])
122 AC_SUBST(ORDER)
123 AC_SUBST(CFLAGS)
124 AC_SUBST(PATHSEP)
125 AC_SUBST(SEARCHSEP)
126 AC_SUBST(OS)
127 AC_SUBST(PIDTYPE)
128 AM_CONDITIONAL(HOST_WIN32, test x$OS = xWIN32)
129 AM_CONDITIONAL(TARGET_WIN32, test x$OS = xWIN32)
130 AM_CONDITIONAL(PLATFORM_DARWIN, test x$platform_darwin = xyes)
131 AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
133 AC_CHECK_SIZEOF(int)
134 AC_CHECK_SIZEOF(void *)
135 AC_CHECK_SIZEOF(long)
136 AC_CHECK_SIZEOF(long long)
137 AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf)
138 AC_CHECK_FUNCS(getrlimit)
139 AC_CHECK_FUNCS(fork execv execve)
142 # Mono currently supports 10.6, but strndup is not available prior to 10.7; avoiding
143 # the detection of strndup on OS X so Mono built on 10.7+ still runs on 10.6. This can be
144 # removed once support for 10.6 is dropped.
146 # iOS detection of strndup and getpwuid_r is faulty for some reason so let's simply avoid it
148 if test x$target_osx = xyes; then
149 AC_CHECK_FUNCS(getpwuid_r)
150 elif test x$target_ios = xno; then
151 AC_CHECK_FUNCS(strndup getpwuid_r)
154 AM_CONDITIONAL(NEED_VASPRINTF, test x$ac_cv_func_vasprintf = xno )
155 AM_ICONV()
156 AC_SEARCH_LIBS(sqrtf, m)
158 # nanosleep may not be part of libc, also search it in other libraries
159 AC_SEARCH_LIBS(nanosleep, rt)
161 AC_SEARCH_LIBS(dlopen, dl)
162 old_ldflags="${LDFLAGS}"
163 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
164 AC_TRY_LINK(, [int i;], found_export_dynamic=yes, found_export_dynamic=no)
165 if test $found_export_dynamic = no; then
166         LDFLAGS="${old_ldflags}"
169 AC_MSG_CHECKING(for varargs macros)
170 AC_TRY_COMPILE([],[
171 int foo (int i, int j);
172 #define bar(...) foo (1, __VA_ARGS__)
173 void main () {
174          bar (2);
176 ],have_iso_varargs=yes,have_iso_varargs=no)
177 AC_MSG_RESULT($have_iso_varargs)
178 G_HAVE_ISO_VARARGS=0
179 if test "x$have_iso_varargs" = "xyes"; then
180    G_HAVE_ISO_VARARGS=1
182 AC_SUBST(G_HAVE_ISO_VARARGS)
184 AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h sys/resource.h)
185 AC_CHECK_LIB([iconv], [locale_charset],[],[AC_CHECK_LIB([charset], [locale_charset],[LIBS+="-liconv -lcharset"])])
186 AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
187 AC_SUBST(HAVE_ALLOCA_H)
189 if test $ac_cv_sizeof_void_p = $ac_cv_sizeof_int; then
190    GPOINTER_TO_INT="((gint) (ptr))"
191    GPOINTER_TO_UINT="((guint) (ptr))"
192    GINT_TO_POINTER="((gpointer) (v))"
193    GUINT_TO_POINTER="((gpointer) (v))"
194    GSIZE="int"
195    GSIZE_FORMAT='"u"'
196    G_GUINT64_FORMAT='"llu"'
197    G_GINT64_FORMAT='"lld"'
198    G_GUINT32_FORMAT='"lu"'
199    G_GINT32_FORMAT='"ld"'
200 elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long; then
201    GPOINTER_TO_INT="((gint)(long) (ptr))"
202    GPOINTER_TO_UINT="((guint)(long) (ptr))"
203    GINT_TO_POINTER="((gpointer)(glong) (v))"
204    GUINT_TO_POINTER="((gpointer)(gulong) (v))"
205    GSIZE="long"
206    GSIZE_FORMAT='"lu"'
207    G_GUINT64_FORMAT='"lu"'
208    G_GINT64_FORMAT='"ld"'
209    G_GUINT32_FORMAT='"u"'
210    G_GINT32_FORMAT='"d"'
211 elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long_long; then
212    GPOINTER_TO_INT="((gint)(long long) (ptr))"
213    GPOINTER_TO_UINT="((guint)(unsigned long long) (ptr))"
214    GINT_TO_POINTER="((gpointer)(long long) (v))"
215    GUINT_TO_POINTER="((gpointer)(unsigned long long) (v))"
216    GSIZE="long long"
217    GSIZE_FORMAT='"I64u"'
218    G_GUINT64_FORMAT='"I64u"'
219    G_GINT64_FORMAT='"I64i"'
220    G_GUINT32_FORMAT='"I32u"'
221    G_GINT32_FORMAT='"I32i"'
222 else
223    AC_MSG_ERROR([unsupported pointer size])
226 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
228 pkg_config_path=
229 AC_ARG_WITH(crosspkgdir, [  --with-crosspkgdir=/path/to/pkg-config/dir      Change pkg-config dir to custom dir],
230         if test x$with_crosspkgdir = "x"; then
231                 if test -s $PKG_CONFIG_PATH; then
232                         pkg_config_path=$PKG_CONFIG_PATH
233                 fi
234         else
235                 pkg_config_path=$with_crosspkgdir
236                 PKG_CONFIG_PATH=$pkg_config_path
237                 export PKG_CONFIG_PATH
238         fi
241 AC_ARG_ENABLE(werror, [  --enable-werror Pass -Werror to the C compiler], werror_flag=$enableval, werror_flag=no)
242 if test x$werror_flag = xyes; then
243         WERROR_CFLAGS="-Werror"
245 AC_SUBST([WERROR_CFLAGS])
247 AC_SUBST(GPOINTER_TO_INT)
248 AC_SUBST(GPOINTER_TO_UINT)
249 AC_SUBST(GINT_TO_POINTER)
250 AC_SUBST(GUINT_TO_POINTER)
251 AC_SUBST(GSIZE)
252 AC_SUBST(GSIZE_FORMAT)
253 AC_SUBST(G_GUINT64_FORMAT)
254 AC_SUBST(G_GINT64_FORMAT)
255 AC_SUBST(G_GUINT32_FORMAT)
256 AC_SUBST(G_GINT32_FORMAT)
258 AC_OUTPUT([
259 Makefile
260 m4/Makefile
261 src/Makefile
262 src/eglib-config.h
263 test/Makefile