Implement IPolicyExportExtension support for HttpTransportBindingElement.
[mono.git] / eglib / configure.ac
1 AC_INIT(README)
2 AC_CANONICAL_SYSTEM
3
4 AM_CONFIG_HEADER(config.h)
5 AM_INIT_AUTOMAKE(eglib,0.3)
6 AM_MAINTAINER_MODE
7
8 AC_PROG_CC
9 AM_PROG_LIBTOOL
10 CFLAGS="$CFLAGS -O0"
11 GNUC_PRETTY=
12 GNUC_UNUSED=
13 BREAKPOINT="G_STMT_START { raise (SIGTRAP); } G_STMT_END"
14 if test x$GCC = xyes; then
15    GNUC_UNUSED='__attribute__((__unused__))'
16    GNUC_NORETURN='__attribute__((__noreturn__))'
17    case $target_cpu in
18      i*86|x86_64) BREAKPOINT="G_STMT_START { __asm__ (\"int \$03\"); } G_STMT_END" ;;
19    esac
20 fi
21 AC_SUBST(GNUC_PRETTY)
22 AC_SUBST(GNUC_UNUSED)
23 AC_SUBST(GNUC_NORETURN)
24 AC_SUBST(BREAKPOINT)
25
26 # We use a separate variable to pass down CPPFLAGS and CFLAGS from the main mono 
27 # configure, because of autoconf brokeness
28 if test "x$CPPFLAGS_FOR_EGLIB" != "x"; then
29    CPPFLAGS=$CPPFLAGS_FOR_EGLIB
30 fi
31 if test "x$CFLAGS_FOR_EGLIB" != "x"; then
32    CFLAGS=$CFLAGS_FOR_EGLIB
33 fi
34
35 CFLAGS="$CFLAGS -g -D_GNU_SOURCE"
36
37 AM_CONDITIONAL(CROSS_COMPILING, [test x$cross_compiling = xyes])
38 AC_C_BIGENDIAN([ORDER=G_BIG_ENDIAN],[ORDER=G_LITTLE_ENDIAN])
39
40 case $host in
41 *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
42     PATHSEP='\\'
43     SEARCHSEP=';'
44     OS="WIN32"
45     ;;
46 *)
47     PATHSEP='/'
48     SEARCHSEP=':'
49     OS="UNIX"
50     ;;
51 esac
52
53 case $host in
54         *-*-solaris*)
55         CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
56         ;;
57 esac
58
59 case $target in
60 arm*-darwin*)
61     CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
62     ;;
63 i*86-*-darwin*)
64     ORDER=G_LITTLE_ENDIAN
65     ;;
66 *-*-openbsd*)
67     CFLAGS="$CFLAGS -pthread"
68     LDFLAGS="$LDFLAGS -pthread"
69     ;;
70 esac
71
72 AC_SUBST(ORDER)
73 AC_SUBST(CFLAGS)
74 AC_SUBST(PATHSEP)
75 AC_SUBST(SEARCHSEP)
76 AC_SUBST(OS)
77 AM_CONDITIONAL(HOST_WIN32, test x$OS = xWIN32)
78 AM_CONDITIONAL(TARGET_WIN32, test x$OS = xWIN32)
79
80 AC_CHECK_SIZEOF(int)
81 AC_CHECK_SIZEOF(void *)
82 AC_CHECK_FUNCS(strndup strlcpy getpwuid_r strtok_r rewinddir vasprintf)
83 AM_CONDITIONAL(NEED_VASPRINTF, test x$have_vasprintf = x )
84 AC_CHECK_LIB(iconv, iconv_open, LIBS="$LIBS -liconv")
85 AC_CHECK_LIB(iconv, libiconv_open, LIBS="$LIBS -liconv")
86 AC_CHECK_LIB(iconv, iconv_open, ICONV_LIBS="-liconv")
87 AC_CHECK_LIB(iconv, libiconv_open, ICONV_LIBS="-liconv")
88 AC_SUBST(ICONV_LIBS)
89 LIBS="$LIBS $ICONV_LIBS"
90 AC_SEARCH_LIBS(sqrtf, m)
91
92 # nanosleep may not be part of libc, also search it in other libraries
93 AC_SEARCH_LIBS(nanosleep, rt)
94
95 AC_SEARCH_LIBS(dlopen, dl)
96 old_ldflags="${LDFLAGS}"
97 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
98 AC_TRY_LINK(, [int i;], found_export_dynamic=yes, found_export_dynamic=no)
99 if test $found_export_dynamic = no; then
100         LDFLAGS="${old_ldflags}"
101 fi
102
103 AC_MSG_CHECKING(for varargs macros)
104 AC_TRY_COMPILE([],[
105 int foo (int i, int j);
106 #define bar(...) foo (1, __VA_ARGS__)
107 void main () {
108          bar (2);
109 }
110 ],have_iso_varargs=yes,have_iso_varargs=no)
111 AC_MSG_RESULT($have_iso_varargs)
112 G_HAVE_ISO_VARARGS=0
113 if test "x$have_iso_varargs" = "xyes"; then
114    G_HAVE_ISO_VARARGS=1
115 fi
116 AC_SUBST(G_HAVE_ISO_VARARGS)
117
118 AC_CHECK_HEADERS(getopt.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h)
119
120 if test $ac_cv_sizeof_void_p != $ac_cv_sizeof_int; then
121    GPOINTER_TO_INT="((gint)(long) (ptr))"
122    GPOINTER_TO_UINT="((guint)(long) (ptr))"
123    GINT_TO_POINTER="((gpointer)(glong) (v))"
124    GUINT_TO_POINTER="((gpointer)(gulong) (v))"
125    GSIZE="long"
126    GSIZE_FORMAT='"lu"'
127    G_GUINT64_FORMAT='"lu"'
128    G_GINT64_FORMAT='"ld"'
129 else
130    GPOINTER_TO_INT="((gint) (ptr))"
131    GPOINTER_TO_UINT="((guint) (ptr))"
132    GINT_TO_POINTER="((gpointer) (v))"
133    GUINT_TO_POINTER="((gpointer) (v))"
134    GSIZE="int"
135    GSIZE_FORMAT='"u"'
136    G_GUINT64_FORMAT='"llu"'
137    G_GINT64_FORMAT='"lld"'
138 fi
139
140 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
141
142 pkg_config_path=
143 AC_ARG_WITH(crosspkgdir, [  --with-crosspkgdir=/path/to/pkg-config/dir      Change pkg-config dir to custom dir],
144         if test x$with_crosspkgdir = "x"; then
145                 if test -s $PKG_CONFIG_PATH; then
146                         pkg_config_path=$PKG_CONFIG_PATH
147                 fi
148         else
149                 pkg_config_path=$with_crosspkgdir
150                 PKG_CONFIG_PATH=$pkg_config_path
151                 export PKG_CONFIG_PATH
152         fi
153 )
154
155 dnl
156 dnl No, you can not replace the call below with a pkg.m4 macro
157 dnl
158 have_glib=false
159 if test "x$PKG_CONFIG" != "xno"; then
160     if $PKG_CONFIG --atleast-version=$GLIB_REQUIRED_VERSION glib-2.0; then
161         have_glib=true;
162     else
163         have_glib=false;
164     fi
165 fi
166 AM_CONDITIONAL(HAVE_GLIB, $have_glib)
167
168 AC_ARG_ENABLE(quiet-build, [  --enable-quiet-build  Enable quiet runtime build (on by default)], enable_quiet_build=$enableval, enable_quiet_build=yes)
169 AC_SUBST(GPOINTER_TO_INT)
170 AC_SUBST(GPOINTER_TO_UINT)
171 AC_SUBST(GINT_TO_POINTER)
172 AC_SUBST(GUINT_TO_POINTER)
173 AC_SUBST(GSIZE)
174 AC_SUBST(GSIZE_FORMAT)
175 AC_SUBST(G_GUINT64_FORMAT)
176 AC_SUBST(G_GINT64_FORMAT)
177
178 if test x$enable_quiet_build = xyes; then
179    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])
180    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])
181 fi
182
183 AC_OUTPUT([
184 Makefile
185 src/Makefile
186 src/eglib-config.h
187 test/Makefile
188 ])