1 # Process this file with autoconf to produce a configure script.
4 # Save this value here, since automake will set cflags later
5 cflags_set=${CFLAGS+set}
7 # The following version number definitions apply to GLib and GModule
8 # as a whole, so if changes occoured in either of them, they are both
9 # treated with the same interface and binary age.
12 # GLIB_MICRO_VERSION += 1;
13 # GLIB_INTERFACE_AGE += 1;
14 # GLIB_BINARY_AGE += 1;
15 # if any functions have been added, set GLIB_INTERFACE_AGE to 0.
16 # if backwards compatibility has been broken,
17 # set GLIB_BINARY_AGE and GLIB_INTERFACE_AGE to 0.
24 GLIB_VERSION=$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION.$GLIB_MICRO_VERSION
25 AC_SUBST(GLIB_VERSION)
28 LT_RELEASE=$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION
29 LT_CURRENT=`expr $GLIB_MICRO_VERSION - $GLIB_INTERFACE_AGE`
30 LT_REVISION=$GLIB_INTERFACE_AGE
31 LT_AGE=`expr $GLIB_BINARY_AGE - $GLIB_INTERFACE_AGE`
40 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
42 # Specify a configuration file
43 AM_CONFIG_HEADER(glibconfig.h)
45 AC_DEFINE_UNQUOTED(GLIB_MAJOR_VERSION, $GLIB_MAJOR_VERSION)
46 AC_DEFINE_UNQUOTED(GLIB_MINOR_VERSION, $GLIB_MINOR_VERSION)
47 AC_DEFINE_UNQUOTED(GLIB_MICRO_VERSION, $GLIB_MICRO_VERSION)
48 AC_DEFINE_UNQUOTED(GLIB_INTERFACE_AGE, $GLIB_INTERFACE_AGE)
49 AC_DEFINE_UNQUOTED(GLIB_BINARY_AGE, $GLIB_BINARY_AGE)
51 dnl Initialize libtool
54 dnl Initialize maintainer mode
59 AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],,enable_debug=minimum)
60 AC_ARG_ENABLE(mem_check, [ --enable-mem-check=[no/yes] turn on malloc/free sanity checking [default=no]],,enable_mem_check=no)
61 AC_ARG_ENABLE(mem_profile, [ --enable-mem-profile=[no/yes] turn on malloc profiling atexit [default=no]],,enable_mem_profile=no)
63 AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
66 AC_MSG_CHECKING(whether to enable memory checking)
67 if test "x$enable_mem_check" = "xyes"; then
68 AC_DEFINE(ENABLE_MEM_CHECK, 1)
69 AC_SUBST(ENABLE_MEM_CHECK)
75 AC_MSG_CHECKING(whether to enable memory profiling)
76 if test "x$enable_mem_profile" = "xyes"; then
77 AC_DEFINE(ENABLE_MEM_PROFILE, 1)
78 AC_SUBST(ENABLE_MEM_PROFILE)
84 if test "x$enable_debug" = "xyes"; then
85 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
86 CFLAGS="$CFLAGS -DG_ENABLE_DEBUG"
88 if test "x$enable_debug" = "xno"; then
89 CFLAGS="$CFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
93 AC_DEFINE_UNQUOTED(G_COMPILED_WITH_DEBUGGING, "${enable_debug}")
95 # Checks for programs.
100 if eval "test x$GCC = xyes"; then
101 if eval test -z \"`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`\" ; then
102 CFLAGS="$CFLAGS -Wall"
105 if eval "test x$enable_ansi = xyes"; then
106 if eval test -z \"`echo "$CFLAGS" | grep "\-ansi" 2> /dev/null`\" ; then
107 CFLAGS="$CFLAGS -ansi"
110 if eval test -z \"`echo "$CFLAGS" | grep "\-pedantic" 2> /dev/null`\" ; then
111 CFLAGS="$CFLAGS -pedantic"
116 dnl DU4 native cc currently needs -std1 for ANSI mode (instead of K&R)
117 AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
120 AC_TRY_RUN([#include <math.h>
121 int main (void) { return (log(1) != log(1.)); }],
122 AC_MSG_RESULT(none needed),
123 glib_save_CFLAGS=$CFLAGS
124 CFLAGS="$CFLAGS -std1"
125 AC_TRY_RUN([#include <math.h>
126 int main (void) { return (log(1) != log(1.)); }],
127 AC_MSG_RESULT(-std1),
129 CFLAGS=$glib_save_CFLAGS
131 [No ANSI prototypes found in library. (-std1 didn't work.)])
136 dnl NeXTStep cc seems to need this
137 AC_MSG_CHECKING([for extra flags for POSIX compliance])
138 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
139 AC_MSG_RESULT(none needed),
140 glib_save_CFLAGS=$CFLAGS
141 CFLAGS="$CFLAGS -posix"
142 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
143 AC_MSG_RESULT(-posix),
145 CFLAGS=$glib_save_CFLAGS
146 AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
148 # Checks for header files.
151 # Checks for library functions.
154 AC_CHECK_FUNCS(atexit on_exit)
156 AC_CHECK_SIZEOF(char)
157 AC_CHECK_SIZEOF(short)
158 AC_CHECK_SIZEOF(long)
160 AC_CHECK_SIZEOF(void *)
161 AC_CHECK_SIZEOF(long long)
163 dnl long doubles were not used, and a portability problem
167 dnl AC_C_INLINE is useless to us since it bails out too early, we need to
168 dnl truely know which ones of `inline', `__inline' and `__inline__' are
169 dnl actually supported.
170 AC_MSG_CHECKING(for __inline)
171 AC_CACHE_VAL(glib_cv_has__inline,[
173 __inline int foo () { return 0; }
174 int main () { return foo (); }
176 glib_cv_has__inline=yes
178 glib_cv_has__inline=no
181 AC_MSG_RESULT($glib_cv_has__inline)
182 case x$glib_cv_has__inline in
183 xyes) AC_DEFINE(G_HAVE___INLINE)
185 AC_MSG_CHECKING(for __inline__)
186 AC_CACHE_VAL(glib_cv_has__inline__,[
188 __inline__ int foo () { return 0; }
189 int main () { return foo (); }
191 glib_cv_has__inline__=yes
193 glib_cv_has__inline__=no
196 AC_MSG_RESULT($glib_cv_has__inline__)
197 case x$glib_cv_has__inline__ in
198 xyes) AC_DEFINE(G_HAVE___INLINE__)
200 AC_MSG_CHECKING(for inline)
201 AC_CACHE_VAL(glib_cv_hasinline,[
203 inline int foo () { return 0; }
204 int main () { return foo (); }
206 glib_cv_hasinline=yes
211 AC_MSG_RESULT($glib_cv_hasinline)
212 case x$glib_cv_hasinline in
213 xyes) AC_DEFINE(G_HAVE_INLINE)
217 dnl header file checks
218 AC_CHECK_HEADERS(float.h, AC_DEFINE(HAVE_FLOAT_H))
219 AC_CHECK_HEADERS(limits.h, AC_DEFINE(HAVE_LIMITS_H))
220 AC_CHECK_HEADERS(values.h, AC_DEFINE(HAVE_VALUES_H))
222 # Check for strerror, strsignal, memmove, vsnprintf, and strcasecmp functions
223 AC_CHECK_FUNCS(strerror strsignal memmove vsnprintf strcasecmp)
225 # Check for sys_errlist
226 AC_MSG_CHECKING(for sys_errlist)
228 extern char *sys_errlist[];
230 sys_errlist[sys_nerr-1][0] = 0;
231 ], glib_ok=yes, glib_ok=no)
232 AC_MSG_RESULT($glib_ok)
233 if test $glib_ok = no; then
234 AC_DEFINE(NO_SYS_ERRLIST)
237 # Check for sys_siglist
238 AC_MSG_CHECKING(for sys_siglist)
240 extern char *sys_siglist[];
241 sys_siglist[1][0] = 0;
242 ], glib_ok=yes, glib_ok=no)
243 AC_MSG_RESULT($glib_ok)
244 if test $glib_ok = no; then
245 AC_DEFINE(NO_SYS_SIGLIST)
248 # Check if <sys/select.h> needs to be included for fd_set
249 AC_MSG_CHECKING([for fd_set])
250 AC_TRY_COMPILE([#include <sys/types.h>],
251 [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
252 if test $gtk_ok = yes; then
253 AC_MSG_RESULT([yes, found in sys/types.h])
255 AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
256 if test $gtk_ok = yes; then
257 AC_DEFINE(HAVE_SYS_SELECT_H)
258 AC_MSG_RESULT([yes, found in sys/select.h])
265 # This stuff is here, only so that we can define these
266 # things in glibconfig.h. If ../config.h was installed
267 # (under some other name?) then the definitions would
268 # belong there. (They are only used in GDK)
272 AC_MSG_CHECKING(for wchar.h)
273 AC_TRY_CPP([#include <wchar.h>], gtk_ok=yes, gtk_ok=no)
274 if test $gtk_ok = yes; then
275 AC_DEFINE(HAVE_WCHAR_H)
277 AC_MSG_RESULT($gtk_ok)
279 # Check for wctype.h (for iswalnum)
281 AC_MSG_CHECKING(for wctype.h)
282 AC_TRY_CPP([#include <wctype.h>], gtk_ok=yes, gtk_ok=no)
283 if test $gtk_ok = yes; then
284 AC_DEFINE(HAVE_WCTYPE_H)
286 AC_MSG_RESULT($gtk_ok)
288 # The following is necessary for Linux libc-5.4.38
290 AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
291 AC_TRY_LINK([#include <stdlib.h>],[
292 #if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
293 # ifdef HAVE_WCTYPE_H
301 # define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
303 iswalnum((wchar_t) 0);
304 ], gtk_ok=yes, gtk_ok=no)
306 if test $gtk_ok = no; then
307 AC_DEFINE(HAVE_BROKEN_WCTYPE)
309 AC_MSG_RESULT($gtk_ok)
311 dnl **********************
312 dnl *** va_copy checks ***
313 dnl **********************
314 dnl we currently check for all three va_copy possibilities, so we get
315 dnl all results in config.log for bug reports.
316 AC_MSG_CHECKING(for an implementation of va_copy())
317 AC_CACHE_VAL(glib_cv_va_copy,[
320 void f (int i, ...) {
321 va_list args1, args2;
323 va_copy (args2, args1);
324 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
326 va_end (args1); va_end (args2);
337 AC_MSG_RESULT($glib_cv_va_copy)
338 AC_MSG_CHECKING(for an implementation of __va_copy())
339 AC_CACHE_VAL(glib_cv___va_copy,[
342 void f (int i, ...) {
343 va_list args1, args2;
345 __va_copy (args2, args1);
346 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
348 va_end (args1); va_end (args2);
354 glib_cv___va_copy=yes
359 AC_MSG_RESULT($glib_cv___va_copy)
360 AC_MSG_CHECKING(whether va_lists can be copied by value)
361 AC_CACHE_VAL(glib_cv_va_val_copy,[
364 void f (int i, ...) {
365 va_list args1, args2;
368 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
370 va_end (args1); va_end (args2);
376 glib_cv_va_val_copy=yes
378 glib_cv_va_val_copy=no
381 if test "x$glib_cv_va_copy" = "xyes"; then
382 AC_DEFINE(G_VA_COPY, va_copy)
383 else if test "x$glib_cv___va_copy" = "xyes"; then
384 AC_DEFINE(G_VA_COPY, __va_copy)
387 if test "x$glib_cv_va_val_copy" = "xno"; then
388 AC_DEFINE(G_VA_COPY_AS_ARRAY)
390 AC_MSG_RESULT($glib_cv_va_val_copy)
393 dnl ***********************
394 dnl *** g_module checks ***
395 dnl ***********************
399 G_MODULE_NEED_USCORE=0
400 G_MODULE_HAVE_DLERROR=0
401 dnl *** dlopen() in system libraries
402 if test -z "$G_MODULE_IMPL"; then
403 AC_CHECK_FUNC(dlopen,
404 G_MODULE_IMPL=G_MODULE_IMPL_DL
407 dnl *** dlopen() in libdl
408 if test -z "$G_MODULE_IMPL"; then
409 AC_CHECK_LIB(dl, dlopen,
411 G_MODULE_IMPL=G_MODULE_IMPL_DL
414 dnl *** shl_load() in libdld (HP-UX)
415 if test -z "$G_MODULE_IMPL"; then
416 G_MODULE_LDFLAGS='-Wl,-E'
417 AC_CHECK_LIB(dld, shl_load,
419 G_MODULE_IMPL=G_MODULE_IMPL_DLD
422 dnl *** additional checks for G_MODULE_IMPL_DL
423 if test "$G_MODULE_IMPL" = "G_MODULE_IMPL_DL"; then
424 if test -d /usr/include/linux; then
425 G_MODULE_LDFLAGS='-rdynamic'
428 LDFLAGS_orig="$LDFLAGS"
429 LIBS="$LIBS $G_MODULE_LIBS"
430 LDFLAGS="$LDFLAGS $G_MODULE_LDFLAGS"
431 dnl *** check whether we need preceeding underscores
432 AC_MSG_CHECKING(for preceeding underscore in symbols)
433 AC_CACHE_VAL(glib_cv_uscore,[
436 int glib_underscore_test (void) { return 42; }
438 void *f1 = (void*)0, *f2 = (void*)0, *handle;
439 handle = dlopen ((void*)0, 0);
441 f1 = dlsym (handle, "glib_underscore_test");
442 f2 = dlsym (handle, "_glib_underscore_test");
443 } return !(f2 && !f1);
446 G_MODULE_NEED_USCORE=1
449 G_MODULE_NEED_USCORE=0
452 AC_MSG_RESULT($glib_cv_uscore)
453 LDFLAGS="$LDFLAGS_orig"
454 dnl *** check for having dlerror()
455 AC_CHECK_FUNC(dlerror,
456 G_MODULE_HAVE_DLERROR=1,
457 G_MODULE_HAVE_DLERROR=0)
460 dnl *** done, have e got an implementation?
461 if test -z "$G_MODULE_IMPL"; then
464 AC_SUBST(G_MODULE_IMPL)
465 AC_SUBST(G_MODULE_LIBS)
466 AC_SUBST(G_MODULE_LDFLAGS)
467 AC_SUBST(G_MODULE_HAVE_DLERROR)
468 AC_SUBST(G_MODULE_NEED_USCORE)
474 gmodule/gmoduleconf.h
476 ],[chmod +x glib-config])