2 # Copyright 2012 Xamarin Inc
5 [http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
7 AC_CONFIG_SRCDIR([README])
8 AC_CONFIG_MACRO_DIR([m4])
12 AM_INIT_AUTOMAKE([1.9 dist-bzip2 tar-ustar no-dist-gzip foreign])
13 AM_CONFIG_HEADER([config.h])
16 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
20 # Use dolt (http://dolt.freedesktop.org/) instead of libtool for building.
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__))'
29 i*86|x86_64) BREAKPOINT="G_STMT_START { __asm__ (\"int \$03\"); } G_STMT_END" ;;
34 AC_SUBST(GNUC_NORETURN)
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])
55 *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
70 AC_DEFINE(PLATFORM_ANDROID,1,[Targeting the Android platform])
86 CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
92 CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
98 CFLAGS="$CFLAGS -pthread"
99 LDFLAGS="$LDFLAGS -pthread"
109 AM_CONDITIONAL(HOST_WIN32, test x$OS = xWIN32)
110 AM_CONDITIONAL(TARGET_WIN32, test x$OS = xWIN32)
111 AM_CONDITIONAL(PLATFORM_DARWIN, test x$platform_darwin = xyes)
112 AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
115 AC_CHECK_SIZEOF(void *)
116 AC_CHECK_SIZEOF(long)
117 AC_CHECK_SIZEOF(long long)
118 AC_CHECK_FUNCS(strndup strlcpy stpcpy getpwuid_r strtok_r rewinddir vasprintf)
119 AM_CONDITIONAL(NEED_VASPRINTF, test x$have_vasprintf = x )
121 AC_SEARCH_LIBS(sqrtf, m)
123 # nanosleep may not be part of libc, also search it in other libraries
124 AC_SEARCH_LIBS(nanosleep, rt)
126 AC_SEARCH_LIBS(dlopen, dl)
127 old_ldflags="${LDFLAGS}"
128 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
129 AC_TRY_LINK(, [int i;], found_export_dynamic=yes, found_export_dynamic=no)
130 if test $found_export_dynamic = no; then
131 LDFLAGS="${old_ldflags}"
134 AC_MSG_CHECKING(for varargs macros)
136 int foo (int i, int j);
137 #define bar(...) foo (1, __VA_ARGS__)
141 ],have_iso_varargs=yes,have_iso_varargs=no)
142 AC_MSG_RESULT($have_iso_varargs)
144 if test "x$have_iso_varargs" = "xyes"; then
147 AC_SUBST(G_HAVE_ISO_VARARGS)
149 AC_CHECK_HEADERS(getopt.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h)
150 AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
151 AC_SUBST(HAVE_ALLOCA_H)
153 if test $ac_cv_sizeof_void_p = $ac_cv_sizeof_int; then
154 GPOINTER_TO_INT="((gint) (ptr))"
155 GPOINTER_TO_UINT="((guint) (ptr))"
156 GINT_TO_POINTER="((gpointer) (v))"
157 GUINT_TO_POINTER="((gpointer) (v))"
160 G_GUINT64_FORMAT='"llu"'
161 G_GINT64_FORMAT='"lld"'
162 G_GUINT32_FORMAT='"lu"'
163 G_GINT32_FORMAT='"ld"'
164 elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long; then
165 GPOINTER_TO_INT="((gint)(long) (ptr))"
166 GPOINTER_TO_UINT="((guint)(long) (ptr))"
167 GINT_TO_POINTER="((gpointer)(glong) (v))"
168 GUINT_TO_POINTER="((gpointer)(gulong) (v))"
171 G_GUINT64_FORMAT='"lu"'
172 G_GINT64_FORMAT='"ld"'
173 G_GUINT32_FORMAT='"u"'
174 G_GINT32_FORMAT='"d"'
175 elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long_long; then
176 GPOINTER_TO_INT="((gint)(long long) (ptr))"
177 GPOINTER_TO_UINT="((guint)(unsigned long long) (ptr))"
178 GINT_TO_POINTER="((gpointer)(long long) (v))"
179 GUINT_TO_POINTER="((gpointer)(unsigned long long) (v))"
181 GSIZE_FORMAT='"I64u"'
182 G_GUINT64_FORMAT='"I64u"'
183 G_GINT64_FORMAT='"I64i"'
184 G_GUINT32_FORMAT='"I32u"'
185 G_GINT32_FORMAT='"I32i"'
187 AC_MSG_ERROR([unsupported pointer size])
190 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
193 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir Change pkg-config dir to custom dir],
194 if test x$with_crosspkgdir = "x"; then
195 if test -s $PKG_CONFIG_PATH; then
196 pkg_config_path=$PKG_CONFIG_PATH
199 pkg_config_path=$with_crosspkgdir
200 PKG_CONFIG_PATH=$pkg_config_path
201 export PKG_CONFIG_PATH
206 dnl No, you can not replace the call below with a pkg.m4 macro
209 if test "x$PKG_CONFIG" != "xno"; then
210 if $PKG_CONFIG --atleast-version=$GLIB_REQUIRED_VERSION glib-2.0; then
216 AM_CONDITIONAL(HAVE_GLIB, $have_glib)
218 AC_SUBST(GPOINTER_TO_INT)
219 AC_SUBST(GPOINTER_TO_UINT)
220 AC_SUBST(GINT_TO_POINTER)
221 AC_SUBST(GUINT_TO_POINTER)
223 AC_SUBST(GSIZE_FORMAT)
224 AC_SUBST(G_GUINT64_FORMAT)
225 AC_SUBST(G_GINT64_FORMAT)
226 AC_SUBST(G_GUINT32_FORMAT)
227 AC_SUBST(G_GINT32_FORMAT)