Clear discarded frags using mono_sgen_clear_range.
[mono-project.git] / eglib / configure.ac
blobaf12bc51e1194dff75584449adc5cbb157c48d3a
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 AM_CONFIG_HEADER([config.h])
14 AM_MAINTAINER_MODE
16 AC_PROG_CC
17 AM_PROG_LIBTOOL
18 # Use dolt (http://dolt.freedesktop.org/) instead of libtool for building.
19 DOLT
20 GNUC_PRETTY=
21 GNUC_UNUSED=
22 BREAKPOINT="G_STMT_START { raise (SIGTRAP); } G_STMT_END"
23 if test x$GCC = xyes; then
24    GNUC_UNUSED='__attribute__((__unused__))'
25    GNUC_NORETURN='__attribute__((__noreturn__))'
26    case $host_cpu in
27      i*86|x86_64) BREAKPOINT="G_STMT_START { __asm__ (\"int \$03\"); } G_STMT_END" ;;
28    esac
30 AC_SUBST(GNUC_PRETTY)
31 AC_SUBST(GNUC_UNUSED)
32 AC_SUBST(GNUC_NORETURN)
33 AC_SUBST(BREAKPOINT)
35 # We use a separate variable to pass down CPPFLAGS and CFLAGS from the main mono 
36 # configure, because of autoconf brokeness
37 if test "x$CPPFLAGS_FOR_EGLIB" != "x"; then
38    CPPFLAGS=$CPPFLAGS_FOR_EGLIB
40 if test "x$CFLAGS_FOR_EGLIB" != "x"; then
41    CFLAGS=$CFLAGS_FOR_EGLIB
44 CFLAGS="$CFLAGS -g -D_GNU_SOURCE"
46 AM_CONDITIONAL(CROSS_COMPILING, [test x$cross_compiling = xyes])
47 AC_C_BIGENDIAN([ORDER=G_BIG_ENDIAN],[ORDER=G_LITTLE_ENDIAN])
49 platform_darwin=no
50 platform_android=no
52 case $host in
53 *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
54     PATHSEP='\\'
55     SEARCHSEP=';'
56     OS="WIN32"
57     PIDTYPE='void *'
58     ;;
59 *-*darwin*)
60     platform_darwin=yes
61     PATHSEP='/'
62     SEARCHSEP=':'
63     OS="UNIX"
64     PIDTYPE='int'
65     ;;
66 *-*-linux-android*)
67     platform_android=yes
68         AC_DEFINE(PLATFORM_ANDROID,1,[Targeting the Android platform])
69     PATHSEP='/'
70     SEARCHSEP=':'
71     OS="UNIX"
72     PIDTYPE='int'
73     ;;
75     PATHSEP='/'
76     SEARCHSEP=':'
77     OS="UNIX"
78     PIDTYPE='int'
79     ;;
80 esac
82 case $host in
83         *-*-solaris*)
84         CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
85         ;;
86 esac
88 case $target in
89 arm*-darwin*)
90     CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
91     ;;
92 i*86-*-darwin*)
93     ORDER=G_LITTLE_ENDIAN
94     ;;
95 *-*-openbsd*)
96     CFLAGS="$CFLAGS -pthread"
97     LDFLAGS="$LDFLAGS -pthread"
98     ;;
99 esac
101 AC_SUBST(ORDER)
102 AC_SUBST(CFLAGS)
103 AC_SUBST(PATHSEP)
104 AC_SUBST(SEARCHSEP)
105 AC_SUBST(OS)
106 AC_SUBST(PIDTYPE)
107 AM_CONDITIONAL(HOST_WIN32, test x$OS = xWIN32)
108 AM_CONDITIONAL(TARGET_WIN32, test x$OS = xWIN32)
109 AM_CONDITIONAL(PLATFORM_DARWIN, test x$platform_darwin = xyes)
110 AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
112 AC_CHECK_SIZEOF(int)
113 AC_CHECK_SIZEOF(void *)
114 AC_CHECK_SIZEOF(long)
115 AC_CHECK_SIZEOF(long long)
116 AC_CHECK_FUNCS(strndup strlcpy stpcpy getpwuid_r strtok_r rewinddir vasprintf)
117 AM_CONDITIONAL(NEED_VASPRINTF, test x$have_vasprintf = x )
118 AM_ICONV()
119 AC_SEARCH_LIBS(sqrtf, m)
121 # nanosleep may not be part of libc, also search it in other libraries
122 AC_SEARCH_LIBS(nanosleep, rt)
124 AC_SEARCH_LIBS(dlopen, dl)
125 old_ldflags="${LDFLAGS}"
126 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
127 AC_TRY_LINK(, [int i;], found_export_dynamic=yes, found_export_dynamic=no)
128 if test $found_export_dynamic = no; then
129         LDFLAGS="${old_ldflags}"
132 AC_MSG_CHECKING(for varargs macros)
133 AC_TRY_COMPILE([],[
134 int foo (int i, int j);
135 #define bar(...) foo (1, __VA_ARGS__)
136 void main () {
137          bar (2);
139 ],have_iso_varargs=yes,have_iso_varargs=no)
140 AC_MSG_RESULT($have_iso_varargs)
141 G_HAVE_ISO_VARARGS=0
142 if test "x$have_iso_varargs" = "xyes"; then
143    G_HAVE_ISO_VARARGS=1
145 AC_SUBST(G_HAVE_ISO_VARARGS)
147 AC_CHECK_HEADERS(getopt.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h)
148 AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
149 AC_SUBST(HAVE_ALLOCA_H)
151 if test $ac_cv_sizeof_void_p = $ac_cv_sizeof_int; then
152    GPOINTER_TO_INT="((gint) (ptr))"
153    GPOINTER_TO_UINT="((guint) (ptr))"
154    GINT_TO_POINTER="((gpointer) (v))"
155    GUINT_TO_POINTER="((gpointer) (v))"
156    GSIZE="int"
157    GSIZE_FORMAT='"u"'
158    G_GUINT64_FORMAT='"llu"'
159    G_GINT64_FORMAT='"lld"'
160    G_GUINT32_FORMAT='"lu"'
161    G_GINT32_FORMAT='"ld"'
162 elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long; then
163    GPOINTER_TO_INT="((gint)(long) (ptr))"
164    GPOINTER_TO_UINT="((guint)(long) (ptr))"
165    GINT_TO_POINTER="((gpointer)(glong) (v))"
166    GUINT_TO_POINTER="((gpointer)(gulong) (v))"
167    GSIZE="long"
168    GSIZE_FORMAT='"lu"'
169    G_GUINT64_FORMAT='"lu"'
170    G_GINT64_FORMAT='"ld"'
171    G_GUINT32_FORMAT='"u"'
172    G_GINT32_FORMAT='"d"'
173 elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long_long; then
174    GPOINTER_TO_INT="((gint)(long long) (ptr))"
175    GPOINTER_TO_UINT="((guint)(unsigned long long) (ptr))"
176    GINT_TO_POINTER="((gpointer)(long long) (v))"
177    GUINT_TO_POINTER="((gpointer)(unsigned long long) (v))"
178    GSIZE="long long"
179    GSIZE_FORMAT='"I64u"'
180    G_GUINT64_FORMAT='"I64u"'
181    G_GINT64_FORMAT='"I64i"'
182    G_GUINT32_FORMAT='"I32u"'
183    G_GINT32_FORMAT='"I32i"'
184 else
185    AC_MSG_ERROR([unsupported pointer size])
188 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
190 pkg_config_path=
191 AC_ARG_WITH(crosspkgdir, [  --with-crosspkgdir=/path/to/pkg-config/dir      Change pkg-config dir to custom dir],
192         if test x$with_crosspkgdir = "x"; then
193                 if test -s $PKG_CONFIG_PATH; then
194                         pkg_config_path=$PKG_CONFIG_PATH
195                 fi
196         else
197                 pkg_config_path=$with_crosspkgdir
198                 PKG_CONFIG_PATH=$pkg_config_path
199                 export PKG_CONFIG_PATH
200         fi
204 dnl No, you can not replace the call below with a pkg.m4 macro
206 have_glib=false
207 if test "x$PKG_CONFIG" != "xno"; then
208     if $PKG_CONFIG --atleast-version=$GLIB_REQUIRED_VERSION glib-2.0; then
209         have_glib=true;
210     else
211         have_glib=false;
212     fi
214 AM_CONDITIONAL(HAVE_GLIB, $have_glib)
216 AC_ARG_ENABLE(quiet-build, [  --enable-quiet-build  Enable quiet runtime build (on by default)], enable_quiet_build=$enableval, enable_quiet_build=yes)
217 AC_SUBST(GPOINTER_TO_INT)
218 AC_SUBST(GPOINTER_TO_UINT)
219 AC_SUBST(GINT_TO_POINTER)
220 AC_SUBST(GUINT_TO_POINTER)
221 AC_SUBST(GSIZE)
222 AC_SUBST(GSIZE_FORMAT)
223 AC_SUBST(G_GUINT64_FORMAT)
224 AC_SUBST(G_GINT64_FORMAT)
225 AC_SUBST(G_GUINT32_FORMAT)
226 AC_SUBST(G_GINT32_FORMAT)
228 if test x$enable_quiet_build = xyes; then
229    AC_CONFIG_COMMANDS([quiet],
230 [  for i in `find mono src test -name Makefile`; do
231            if [ grep -q 'generated by automake' $i ]; then
232                   $srcdir/../scripts/patch-quiet.sh $i;
233            fi;
234    done
235 ], [shell=$SHELL])
236    AC_CONFIG_COMMANDS([quiet-libtool], [sed -e 's/$echo "copying selected/$show "copying selected/g' < libtool > libtool.tmp && mv libtool.tmp libtool && chmod a+x libtool; sed -e 's/$ECHO "copying selected/# "copying selected/g' < libtool > libtool.tmp && mv libtool.tmp libtool && chmod a+x libtool])
239 AC_OUTPUT([
240 Makefile
241 m4/Makefile
242 src/Makefile
243 src/eglib-config.h
244 test/Makefile