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