4 AM_CONFIG_HEADER(config.h)
5 AM_INIT_AUTOMAKE(eglib,0.3)
10 # Use dolt (http://dolt.freedesktop.org/) instead of libtool for building.
15 BREAKPOINT="G_STMT_START { raise (SIGTRAP); } G_STMT_END"
16 if test x$GCC = xyes; then
17 GNUC_UNUSED='__attribute__((__unused__))'
18 GNUC_NORETURN='__attribute__((__noreturn__))'
20 i*86|x86_64) BREAKPOINT="G_STMT_START { __asm__ (\"int \$03\"); } G_STMT_END" ;;
25 AC_SUBST(GNUC_NORETURN)
28 # We use a separate variable to pass down CPPFLAGS and CFLAGS from the main mono
29 # configure, because of autoconf brokeness
30 if test "x$CPPFLAGS_FOR_EGLIB" != "x"; then
31 CPPFLAGS=$CPPFLAGS_FOR_EGLIB
33 if test "x$CFLAGS_FOR_EGLIB" != "x"; then
34 CFLAGS=$CFLAGS_FOR_EGLIB
37 CFLAGS="$CFLAGS -g -D_GNU_SOURCE"
39 AM_CONDITIONAL(CROSS_COMPILING, [test x$cross_compiling = xyes])
40 AC_C_BIGENDIAN([ORDER=G_BIG_ENDIAN],[ORDER=G_LITTLE_ENDIAN])
45 *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
68 CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
74 CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
80 CFLAGS="$CFLAGS -pthread"
81 LDFLAGS="$LDFLAGS -pthread"
91 AM_CONDITIONAL(HOST_WIN32, test x$OS = xWIN32)
92 AM_CONDITIONAL(TARGET_WIN32, test x$OS = xWIN32)
93 AM_CONDITIONAL(PLATFORM_DARWIN, test x$platform_darwin = xyes)
96 AC_CHECK_SIZEOF(void *)
97 AC_CHECK_FUNCS(strndup strlcpy getpwuid_r strtok_r rewinddir vasprintf)
98 AM_CONDITIONAL(NEED_VASPRINTF, test x$have_vasprintf = x )
99 AC_CHECK_LIB(iconv, iconv_open, LIBS="$LIBS -liconv")
100 AC_CHECK_LIB(iconv, libiconv_open, LIBS="$LIBS -liconv")
101 AC_CHECK_LIB(iconv, iconv_open, ICONV_LIBS="-liconv")
102 AC_CHECK_LIB(iconv, libiconv_open, ICONV_LIBS="-liconv")
104 LIBS="$LIBS $ICONV_LIBS"
105 AC_SEARCH_LIBS(sqrtf, m)
107 # nanosleep may not be part of libc, also search it in other libraries
108 AC_SEARCH_LIBS(nanosleep, rt)
110 AC_SEARCH_LIBS(dlopen, dl)
111 old_ldflags="${LDFLAGS}"
112 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
113 AC_TRY_LINK(, [int i;], found_export_dynamic=yes, found_export_dynamic=no)
114 if test $found_export_dynamic = no; then
115 LDFLAGS="${old_ldflags}"
118 AC_MSG_CHECKING(for varargs macros)
120 int foo (int i, int j);
121 #define bar(...) foo (1, __VA_ARGS__)
125 ],have_iso_varargs=yes,have_iso_varargs=no)
126 AC_MSG_RESULT($have_iso_varargs)
128 if test "x$have_iso_varargs" = "xyes"; then
131 AC_SUBST(G_HAVE_ISO_VARARGS)
133 AC_CHECK_HEADERS(getopt.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h)
134 AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
135 AC_SUBST(HAVE_ALLOCA_H)
137 if test $ac_cv_sizeof_void_p != $ac_cv_sizeof_int; then
138 GPOINTER_TO_INT="((gint)(long) (ptr))"
139 GPOINTER_TO_UINT="((guint)(long) (ptr))"
140 GINT_TO_POINTER="((gpointer)(glong) (v))"
141 GUINT_TO_POINTER="((gpointer)(gulong) (v))"
144 G_GUINT64_FORMAT='"lu"'
145 G_GINT64_FORMAT='"ld"'
147 GPOINTER_TO_INT="((gint) (ptr))"
148 GPOINTER_TO_UINT="((guint) (ptr))"
149 GINT_TO_POINTER="((gpointer) (v))"
150 GUINT_TO_POINTER="((gpointer) (v))"
153 G_GUINT64_FORMAT='"llu"'
154 G_GINT64_FORMAT='"lld"'
157 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
160 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir Change pkg-config dir to custom dir],
161 if test x$with_crosspkgdir = "x"; then
162 if test -s $PKG_CONFIG_PATH; then
163 pkg_config_path=$PKG_CONFIG_PATH
166 pkg_config_path=$with_crosspkgdir
167 PKG_CONFIG_PATH=$pkg_config_path
168 export PKG_CONFIG_PATH
173 dnl No, you can not replace the call below with a pkg.m4 macro
176 if test "x$PKG_CONFIG" != "xno"; then
177 if $PKG_CONFIG --atleast-version=$GLIB_REQUIRED_VERSION glib-2.0; then
183 AM_CONDITIONAL(HAVE_GLIB, $have_glib)
185 AC_ARG_ENABLE(quiet-build, [ --enable-quiet-build Enable quiet runtime build (on by default)], enable_quiet_build=$enableval, enable_quiet_build=yes)
186 AC_SUBST(GPOINTER_TO_INT)
187 AC_SUBST(GPOINTER_TO_UINT)
188 AC_SUBST(GINT_TO_POINTER)
189 AC_SUBST(GUINT_TO_POINTER)
191 AC_SUBST(GSIZE_FORMAT)
192 AC_SUBST(G_GUINT64_FORMAT)
193 AC_SUBST(G_GINT64_FORMAT)
195 if test x$enable_quiet_build = xyes; then
196 AC_CONFIG_COMMANDS([quiet], [for i in `find src test -name Makefile.in | sed -e 's/Makefile.in/Makefile/g'`; do if test -f $i; then $srcdir/../scripts/patch-quiet.sh $i; fi; done], [shell=$SHELL])
197 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])