1 dnl ***********************************
2 dnl *** include special GLib macros ***
3 dnl ***********************************
4 builtin(include, acglib.m4)dnl
6 # Process this file with autoconf to produce a configure script.
9 # Save this value here, since automake will set cflags later
10 cflags_set=${CFLAGS+set}
12 # The following version number definitions apply to GLib and GModule
13 # as a whole, so if changes occoured in either of them, they are both
14 # treated with the same interface and binary age.
17 # GLIB_MICRO_VERSION += 1;
18 # GLIB_INTERFACE_AGE += 1;
19 # GLIB_BINARY_AGE += 1;
20 # if any functions have been added, set GLIB_INTERFACE_AGE to 0.
21 # if backwards compatibility has been broken,
22 # set GLIB_BINARY_AGE and GLIB_INTERFACE_AGE to 0.
29 GLIB_VERSION=$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION.$GLIB_MICRO_VERSION
30 AC_SUBST(GLIB_VERSION)
33 LT_RELEASE=$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION
34 LT_CURRENT=`expr $GLIB_MICRO_VERSION - $GLIB_INTERFACE_AGE`
35 LT_REVISION=$GLIB_INTERFACE_AGE
36 LT_AGE=`expr $GLIB_BINARY_AGE - $GLIB_INTERFACE_AGE`
45 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
47 # Specify a configuration file
48 AM_CONFIG_HEADER(config.h)
50 AC_DEFINE_UNQUOTED(GLIB_MAJOR_VERSION, $GLIB_MAJOR_VERSION)
51 AC_DEFINE_UNQUOTED(GLIB_MINOR_VERSION, $GLIB_MINOR_VERSION)
52 AC_DEFINE_UNQUOTED(GLIB_MICRO_VERSION, $GLIB_MICRO_VERSION)
53 AC_DEFINE_UNQUOTED(GLIB_INTERFACE_AGE, $GLIB_INTERFACE_AGE)
54 AC_DEFINE_UNQUOTED(GLIB_BINARY_AGE, $GLIB_BINARY_AGE)
56 dnl Initialize libtool
59 dnl Initialize maintainer mode
64 AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],,enable_debug=minimum)
65 AC_ARG_ENABLE(mem_check, [ --enable-mem-check turn on malloc/free sanity checking [default=no]],,enable_mem_check=no)
66 AC_ARG_ENABLE(mem_profile, [ --enable-mem-profile turn on malloc profiling atexit [default=no]],,enable_mem_profile=no)
67 AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
69 AC_ARG_ENABLE(threads, [ --enable-threads turn on basic thread support [default=yes]
70 ([=no] will override --with-threads)],,enable_threads=yes)
72 if test "x$enable_threads" != "xyes"; then
76 AC_MSG_CHECKING(whether to enable memory checking)
77 if test "x$enable_mem_check" = "xyes"; then
78 AC_DEFINE(ENABLE_MEM_CHECK, 1)
79 AC_SUBST(ENABLE_MEM_CHECK)
85 AC_MSG_CHECKING(whether to enable memory profiling)
86 if test "x$enable_mem_profile" = "xyes"; then
87 AC_DEFINE(ENABLE_MEM_PROFILE, 1)
88 AC_SUBST(ENABLE_MEM_PROFILE)
94 if test "x$enable_debug" = "xyes"; then
95 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
96 GLIB_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
98 if test "x$enable_debug" = "xno"; then
99 GLIB_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
103 AC_DEFINE_UNQUOTED(G_COMPILED_WITH_DEBUGGING, "${enable_debug}")
105 # Checks for programs.
111 if test "x$GCC" = "xyes"; then
113 *[\ \ ]-Wall[\ \ ]*) ;;
114 *) CFLAGS="$CFLAGS -Wall" ;;
117 if test "x$enable_ansi" = "xyes"; then
119 *[\ \ ]-ansi[\ \ ]*) ;;
120 *) CFLAGS="$CFLAGS -ansi" ;;
124 *[\ \ ]-pedantic[\ \ ]*) ;;
125 *) CFLAGS="$CFLAGS -pedantic" ;;
131 dnl DU4 native cc currently needs -std1 for ANSI mode (instead of K&R)
132 AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
135 AC_TRY_RUN([#include <math.h>
136 int main (void) { return (log(1) != log(1.)); }],
137 AC_MSG_RESULT(none needed),
138 glib_save_CFLAGS=$CFLAGS
139 CFLAGS="$CFLAGS -std1"
140 AC_TRY_RUN([#include <math.h>
141 int main (void) { return (log(1) != log(1.)); }],
142 AC_MSG_RESULT(-std1),
144 CFLAGS=$glib_save_CFLAGS
146 [No ANSI prototypes found in library. (-std1 didn't work.)])
151 dnl NeXTStep cc seems to need this
152 AC_MSG_CHECKING([for extra flags for POSIX compliance])
153 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
154 AC_MSG_RESULT(none needed),
155 glib_save_CFLAGS=$CFLAGS
156 CFLAGS="$CFLAGS -posix"
157 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
158 AC_MSG_RESULT(-posix),
160 CFLAGS=$glib_save_CFLAGS
161 AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
163 # Checks for header files.
166 # Checks for library functions.
169 AC_CHECK_FUNCS(atexit on_exit)
171 AC_CHECK_SIZEOF(char)
172 AC_CHECK_SIZEOF(short)
173 AC_CHECK_SIZEOF(long)
175 AC_CHECK_SIZEOF(void *)
176 AC_CHECK_SIZEOF(long long)
178 dnl long doubles were not used, and a portability problem
182 dnl AC_C_INLINE is useless to us since it bails out too early, we need to
183 dnl truely know which ones of `inline', `__inline' and `__inline__' are
184 dnl actually supported.
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_has__inline__,[
203 __inline__ int foo () { return 0; }
204 int main () { return foo (); }
206 glib_cv_has__inline__=yes
208 glib_cv_has__inline__=no
211 AC_MSG_RESULT($glib_cv_has__inline__)
212 case x$glib_cv_has__inline__ in
213 xyes) AC_DEFINE(G_HAVE___INLINE__)
215 AC_MSG_CHECKING(for inline)
216 AC_CACHE_VAL(glib_cv_hasinline,[
218 inline int foo () { return 0; }
219 int main () { return foo (); }
221 glib_cv_hasinline=yes
226 AC_MSG_RESULT($glib_cv_hasinline)
227 case x$glib_cv_hasinline in
228 xyes) AC_DEFINE(G_HAVE_INLINE)
231 dnl for bytesex stuff
234 dnl header file checks
235 AC_CHECK_HEADERS(float.h, AC_DEFINE(HAVE_FLOAT_H))
236 AC_CHECK_HEADERS(limits.h, AC_DEFINE(HAVE_LIMITS_H))
237 AC_CHECK_HEADERS(pwd.h, AC_DEFINE(HAVE_PWD_H))
238 AC_CHECK_HEADERS(sys/param.h, AC_DEFINE(HAVE_SYS_PARAM_H))
239 AC_CHECK_HEADERS(sys/poll.h, AC_DEFINE(HAVE_SYS_POLL_H))
240 AC_CHECK_HEADERS(sys/select.h, AC_DEFINE(HAVE_SYS_SELECT_H))
241 AC_CHECK_HEADERS(sys/time.h, AC_DEFINE(HAVE_SYS_TIME_H))
242 AC_CHECK_HEADERS(sys/times.h, AC_DEFINE(HAVE_SYS_TIMES_H))
243 AC_CHECK_HEADERS(unistd.h, AC_DEFINE(HAVE_UNISTD_H))
244 AC_CHECK_HEADERS(values.h, AC_DEFINE(HAVE_VALUES_H))
246 # Check for some functions
247 AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf strcasecmp strncasecmp poll)
249 # Check for sys_errlist
250 AC_MSG_CHECKING(for sys_errlist)
252 extern char *sys_errlist[];
254 sys_errlist[sys_nerr-1][0] = 0;
255 ], glib_ok=yes, glib_ok=no)
256 AC_MSG_RESULT($glib_ok)
257 if test $glib_ok = no; then
258 AC_DEFINE(NO_SYS_ERRLIST)
261 # Check for sys_siglist
262 AC_MSG_CHECKING(for sys_siglist)
264 extern char *sys_siglist[];
265 sys_siglist[1][0] = 0;
266 ], glib_ok=yes, glib_ok=no)
267 AC_MSG_RESULT($glib_ok)
268 if test $glib_ok = no; then
269 AC_DEFINE(NO_SYS_SIGLIST)
272 # Check if <sys/select.h> needs to be included for fd_set
273 AC_MSG_CHECKING([for fd_set])
274 AC_TRY_COMPILE([#include <sys/types.h>],
275 [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
276 if test $gtk_ok = yes; then
277 AC_MSG_RESULT([yes, found in sys/types.h])
279 AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
280 if test $gtk_ok = yes; then
281 AC_DEFINE(HAVE_SYS_SELECT_H)
282 AC_MSG_RESULT([yes, found in sys/select.h])
289 # These are used only in GDK (gdki18n.h)
290 # This stuff is here only so that we can define these
291 # things in glibconfig.h. If gtk+ started using an installed
292 # gdkconfig.h file, then the definitions would belong there.
296 AC_MSG_CHECKING(for wchar.h)
297 AC_TRY_CPP([#include <wchar.h>], glib_wchar_h=yes, glib_wchar_h=no)
298 if test $glib_wchar_h = yes; then
299 AC_DEFINE(HAVE_WCHAR_H)
301 AC_MSG_RESULT($glib_wchar_h)
303 # Check for wctype.h (for iswalnum)
305 AC_MSG_CHECKING(for wctype.h)
306 AC_TRY_CPP([#include <wctype.h>], glib_wctype_h=yes, glib_wctype_h=no)
307 if test $glib_wctype_h = yes; then
308 AC_DEFINE(HAVE_WCTYPE_H)
310 AC_MSG_RESULT($glib_wctype_h)
313 # in Solaris 2.5, `iswalnum' is in -lw
314 AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum)])
316 # The following is necessary for Linux libc-5.4.38
317 AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
318 AC_TRY_LINK([#include <stdlib.h>],[
319 #if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
320 # ifdef HAVE_WCTYPE_H
328 # define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
330 iswalnum((wchar_t) 0);
331 ], glib_working_wctype=yes, glib_working_wctype=no)
334 if test $glib_working_wctype = no; then
335 AC_DEFINE(HAVE_BROKEN_WCTYPE)
337 AC_MSG_RESULT($glib_working_wctype)
340 dnl **********************
341 dnl *** va_copy checks ***
342 dnl **********************
343 dnl we currently check for all three va_copy possibilities, so we get
344 dnl all results in config.log for bug reports.
345 AC_MSG_CHECKING(for an implementation of va_copy())
346 AC_CACHE_VAL(glib_cv_va_copy,[
349 void f (int i, ...) {
350 va_list args1, args2;
352 va_copy (args2, args1);
353 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
355 va_end (args1); va_end (args2);
366 AC_MSG_RESULT($glib_cv_va_copy)
367 AC_MSG_CHECKING(for an implementation of __va_copy())
368 AC_CACHE_VAL(glib_cv___va_copy,[
371 void f (int i, ...) {
372 va_list args1, args2;
374 __va_copy (args2, args1);
375 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
377 va_end (args1); va_end (args2);
383 glib_cv___va_copy=yes
388 AC_MSG_RESULT($glib_cv___va_copy)
389 AC_MSG_CHECKING(whether va_lists can be copied by value)
390 AC_CACHE_VAL(glib_cv_va_val_copy,[
393 void f (int i, ...) {
394 va_list args1, args2;
397 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
399 va_end (args1); va_end (args2);
405 glib_cv_va_val_copy=yes
407 glib_cv_va_val_copy=no
410 if test "x$glib_cv_va_copy" = "xyes"; then
411 AC_DEFINE(G_VA_COPY, va_copy)
412 else if test "x$glib_cv___va_copy" = "xyes"; then
413 AC_DEFINE(G_VA_COPY, __va_copy)
416 if test "x$glib_cv_va_val_copy" = "xno"; then
417 AC_DEFINE(G_VA_COPY_AS_ARRAY)
419 AC_MSG_RESULT($glib_cv_va_val_copy)
422 dnl ***********************
423 dnl *** g_module checks ***
424 dnl ***********************
428 G_MODULE_NEED_USCORE=0
429 G_MODULE_HAVE_DLERROR=0
430 dnl *** dlopen() in system libraries
431 if test -z "$G_MODULE_IMPL"; then
432 AC_CHECK_FUNC(dlopen,
433 G_MODULE_IMPL=G_MODULE_IMPL_DL
436 dnl *** dlopen() in libdl
437 if test -z "$G_MODULE_IMPL"; then
438 AC_CHECK_LIB(dl, dlopen,
440 G_MODULE_IMPL=G_MODULE_IMPL_DL
443 dnl *** shl_load() in libdld (HP-UX)
444 if test -z "$G_MODULE_IMPL"; then
445 AC_MSG_CHECKING(how to export all symbols)
446 SAVED_LDFLAGS=$LDFLAGS
447 LDFLAGS="$LDFLAGS -Wl,-E"
448 AC_TRY_LINK(,[ return 0; ],
449 [ G_MODULE_LDFLAGS="-Wl,-E" ],[
450 LDFLAGS="$SAVED_LDFLAGS -bexpall"
451 AC_TRY_LINK(,[ return 0; ],
452 G_MODULE_LDFLAGS="-bexpall",
453 G_MODULE_LDFLAGS="none"
456 LDFLAGS=$SAVED_LDFLAGS
457 AC_MSG_RESULT($G_MODULE_LDFLAGS)
458 if test "x$G_MODULE_LDFLAGS" = "xnone"; then
461 AC_CHECK_LIB(dld, shl_load,
463 G_MODULE_IMPL=G_MODULE_IMPL_DLD
466 dnl *** additional checks for G_MODULE_IMPL_DL
467 if test "$G_MODULE_IMPL" = "G_MODULE_IMPL_DL"; then
470 G_MODULE_LDFLAGS='-rdynamic'
474 LDFLAGS_orig="$LDFLAGS"
475 LIBS="$LIBS $G_MODULE_LIBS"
476 LDFLAGS="$LDFLAGS $G_MODULE_LDFLAGS"
477 dnl *** check whether we need preceeding underscores
478 AC_MSG_CHECKING(for preceeding underscore in symbols)
479 AC_CACHE_VAL(glib_cv_uscore,[
482 int glib_underscore_test (void) { return 42; }
484 void *f1 = (void*)0, *f2 = (void*)0, *handle;
485 handle = dlopen ((void*)0, 0);
487 f1 = dlsym (handle, "glib_underscore_test");
488 f2 = dlsym (handle, "_glib_underscore_test");
489 } return (!f2 || f1);
494 rm -f plugin.c plugin.o plugin.lo
496 AC_MSG_RESULT($glib_cv_uscore)
497 if test "x$glib_cv_uscore" = "xyes"; then
498 G_MODULE_NEED_USCORE=1
500 G_MODULE_NEED_USCORE=0
503 LDFLAGS="$LDFLAGS_orig"
504 dnl *** check for having dlerror()
505 AC_CHECK_FUNC(dlerror,
506 G_MODULE_HAVE_DLERROR=1,
507 G_MODULE_HAVE_DLERROR=0)
510 dnl *** done, have e got an implementation?
511 if test -z "$G_MODULE_IMPL"; then
514 AC_SUBST(G_MODULE_IMPL)
515 AC_SUBST(G_MODULE_LIBS)
516 AC_SUBST(G_MODULE_LDFLAGS)
517 AC_SUBST(G_MODULE_HAVE_DLERROR)
518 AC_SUBST(G_MODULE_NEED_USCORE)
519 AC_SUBST(GLIB_DEBUG_FLAGS)
522 dnl ***********************
523 dnl *** g_thread checks ***
524 dnl ***********************
526 AC_ARG_WITH(threads, [ --with-threads=[none/posix/solaris/nspr] specify a thread implementation to use],
527 if test "x$with_threads" = x; then
530 want_threads=$with_threads
533 if test "x$enable_threads" = "xno"; then
536 if test "x$want_threads" = "xnone"; then
540 dnl error and warning message
541 dnl *************************
543 THREAD_NO_IMPLEMENTATION="You do not have any known thread system on your
544 computer. glib will not be thread safe on your computer."
546 THREAD_UNKNOWN_COMPILER="Your compiler is not known, so I cannot
547 determine the necessary compiler options to compile programs
548 which are using threads. Please provide such information."
550 FLAG_DOES_NOT_WORK="I can't find the MACRO, that enables thread safety on your
551 platform (normaly it's "_REENTRANT"). I'll not use any flag on
552 compilation now, but then your programs might not work.
553 Please provide information on how it is done on your system."
555 LIBS_NOT_FOUND_1="I can't find the libraries for the thread implementation
558 LIBS_NOT_FOUND_2=". Please choose another thread implementation or
559 provide informationon your thread implementation."
561 dnl determination of thread implementation
562 dnl ***************************************
565 if test "x$want_threads" = xyes || test "x$want_threads" = xsolaris; then
568 AC_CHECK_LIB(thread, cond_init, have_threads=solaris)
572 if test "x$want_threads" = xyes || test "x$want_threads" = xposix; then
573 if test "x$have_threads" = xnone; then
574 AC_CHECK_LIB(pthread, pthread_attr_init, have_threads=posix)
576 if test "x$have_threads" = xnone; then
577 AC_CHECK_LIB(pthreads, pthread_attr_init, have_threads=posix)
579 if test "x$have_threads" = xnone; then
580 AC_CHECK_FUNC(pthread_attr_init, have_threads=posix)
583 if test "x$want_threads" = xyes || test "x$want_threads" = xnspr; then
584 if test "x$have_threads" = xnone; then
585 AC_CHECK_LIB(nspr21, PRP_NewNakedCondVar, have_threads=nspr)
589 AC_MSG_CHECKING(for thread implementation)
591 if test "x$have_threads" = xnone && test "x$want_threads" != xno; then
592 AC_MSG_RESULT(none available)
593 AC_MSG_WARN($THREAD_NO_IMPLEMENTATION)
595 AC_MSG_RESULT($have_threads)
599 dnl determination of G_THREAD_LIBS
600 dnl ******************************
605 case $have_threads in
608 AC_CHECK_LIB(pthread, pthread_attr_init,
609 G_THREAD_LIBS="-lpthread")
610 if test "x$G_THREAD_LIBS" = xerror; then
611 AC_CHECK_LIB(pthreads, pthread_attr_init,
612 G_THREAD_LIBS="-lpthreads")
614 if test "x$G_THREAD_LIBS" = xerror; then
615 AC_CHECK_FUNC(pthread_attr_init, G_THREAD_LIBS="")
617 mutex_has_default=yes
618 mutex_default_type='pthread_mutex_t'
619 mutex_default_init='PTHREAD_MUTEX_INITIALIZER'
620 mutex_header_file='pthread.h'
624 AC_CHECK_LIB(thread, cond_init, G_THREAD_LIBS="-lthread")
625 # solaris has a broken initializer for mutexes, if we find it,
626 # we will replace it.
627 AC_MSG_CHECKING(for broken solaris mutex initialization)
628 AC_EGREP_CPP([ *begin *{ *0 *, *0 *, *0 *, *0 *, *0 *, *0 *, *0 *, *0 *, *0 *, *0 *, *0 *, *0 *, *0 *, *0 *} *end *],
630 begin DEFAULTMUTEX end],
631 [solaris_mutex_init_broken=yes],
632 [solaris_mutex_init_broken=no])
633 AC_MSG_RESULT($solaris_mutex_init_broken)
634 mutex_has_default=yes
635 mutex_default_type='mutex_t'
636 if test x$solaris_mutex_init_broken = xyes; then
637 mutex_default_init="{ { { 0, 0, 0, 0 }, USYNC_THREAD }, { { { 0, 0, 0, 0, 0, 0, 0, 0 } } }, 0}"
639 mutex_default_init="DEFAULTMUTEX"
641 mutex_header_file='thread.h'
644 AC_CHECK_LIB(nspr21, PRP_NewNakedCondVar,
645 G_THREAD_LIBS="-lnspr21")
654 if test "x$G_THREAD_LIBS" = xerror; then
655 AC_MSG_ERROR($LIBS_NOT_FOUND_1$have_threads$LIBS_NOT_FOUND_2)
658 AC_MSG_CHECKING(necessary linker options)
659 AC_MSG_RESULT($G_THREAD_LIBS)
662 dnl determination of G_THREAD_CFLAGS
663 dnl ********************************
665 if test x"$have_threads" != xnone; then
666 G_THREAD_CFLAGS="-D_REENTRANT" # good default
670 G_THREAD_CFLAGS="$G_THREAD_CFLAGS -D_THREAD_SAFE"
671 if test x"$GCC" = xyes; then
672 G_THREAD_CFLAGS="$G_THREAD_CFLAGS -mthreads"
677 # if we are not finding the ctime_r function, then we probably are
678 # not using the proper multithread flag
679 old_CPPFLAGS=$CPPFLAGS
680 CPPFLAGS="$CPPFLAGS $G_THREAD_CFLAGS"
681 AC_EGREP_HEADER([[^a-zA-Z_]ctime_r[^a-zA-Z_]], time.h, ,
683 AC_MSG_WARN($FLAG_DOES_NOT_WORK))
684 CPPFLAGS=$old_CPPFLAGS
686 # if test x"$GCC" = xyes; then
687 # # older gcc's do not know the -fstack-check option and will
688 # # stop compiling, so just check this here
689 # old_CPPFLAGS="$CPPFLAGS"
690 # CPPFLAGS="$CPPFLAGS -fstack-check"
692 # G_THREAD_CFLAGS="$G_THREAD_CFLAGS -fstack-check")
693 # CPPFLAGS=$old_CPPFLAGS
695 # AC_MSG_WARN($THREAD_UNKNOWN_COMPILER)
698 AC_MSG_CHECKING(necessary compiler options)
700 AC_MSG_RESULT($G_THREAD_CFLAGS)
705 AC_DEFINE_UNQUOTED(G_THREAD_SOURCE,"gthread-$have_threads.c")
706 AC_SUBST(G_THREAD_CFLAGS)
707 AC_SUBST(G_THREAD_LIBS)
709 CFLAGS="$CFLAGS $G_THREAD_CFLAGS"
712 dnl **********************************************
713 dnl *** GDefaultMutex setup and initialization ***
714 dnl **********************************************
716 dnl if mutex_has_default = yes, we also got
717 dnl mutex_default_type, mutex_default_init and mutex_header_file
718 GLIB_IF_VAR_EQ(mutex_has_default, yes,
719 GLIB_SIZEOF([#include <$mutex_header_file>],
723 GLIB_BYTE_CONTENTS([#include <$mutex_header_file>],
726 $glib_cv_sizeof_gmutex,
732 dnl ******************************
733 dnl *** output the whole stuff ***
734 dnl ******************************
738 ## Generate `glibconfig.h' in two cases
739 ## 1. `config.status' is run either explicitly, or via configure.
740 ## Esp. not when it is run in `Makefile' to generate makefiles and
742 ## 2. CONFIG_OTHER is set explicitly
744 ## Case 1 is difficult. We know that `automake' sets one of
745 ## CONFIG_FILES or CONFIG_HEADERS to empty. This heuristic works
746 ## only when AM_CONFIG_HEADER is set, however.
748 if test -n "${CONFIG_FILES}" && test -n "${CONFIG_HEADERS}"; then
749 # Both CONFIG_FILES and CONFIG_HEADERS are non-empty ==> Case 1
750 CONFIG_OTHER=${CONFIG_OTHER:-glibconfig.h}
752 case "$CONFIG_OTHER" in
754 echo creating glibconfig.h
755 outfile=glibconfig.h-tmp
756 cat > $outfile <<\_______EOF
759 * This is a generated file. Please modify `configure.in'
767 #endif /* __cplusplus */
771 if test x$glib_limits_h = xyes; then
772 echo '#include <limits.h>' >> $outfile
774 if test x$glib_float_h = xyes; then
775 echo '#include <float.h>' >> $outfile
777 if test x$glib_values_h = xyes; then
778 echo '#include <values.h>' >> $outfile
780 if test x$g_mutex_header_file != x; then
781 echo '#include <'"$g_mutex_header_file"'>' >> $outfile
783 if test x$glib_sys_poll_h = xyes; then
784 echo '#include <sys/types.h>' >> $outfile
785 echo '#include <sys/poll.h>' >> $outfile
788 cat >> $outfile <<_______EOF
790 #define G_MINFLOAT $glib_mf
791 #define G_MAXFLOAT $glib_Mf
792 #define G_MINDOUBLE $glib_md
793 #define G_MAXDOUBLE $glib_Md
794 #define G_MINSHORT $glib_ms
795 #define G_MAXSHORT $glib_Ms
796 #define G_MININT $glib_mi
797 #define G_MAXINT $glib_Mi
798 #define G_MINLONG $glib_ml
799 #define G_MAXLONG $glib_Ml
804 ### this should always be true in a modern C/C++ compiler
805 cat >>$outfile <<_______EOF
806 typedef signed char gint8;
807 typedef unsigned char guint8;
811 if test -n "$gint16"; then
812 cat >>$outfile <<_______EOF
813 typedef signed $gint16 gint16;
814 typedef unsigned $gint16 guint16;
819 if test -n "$gint32"; then
820 cat >>$outfile <<_______EOF
821 typedef signed $gint32 gint32;
822 typedef unsigned $gint32 guint32;
827 if test -n "$gint64"; then
828 cat >>$outfile <<_______EOF
829 ${glib_warning_guard}#define G_HAVE_GINT64 1
831 ${glib_extension}typedef signed $gint64 gint64;
832 ${glib_extension}typedef unsigned $gint64 guint64;
834 #define G_GINT64_CONSTANT(val) $gint64_constant
839 if test -z "$glib_unknown_void_p"; then
840 cat >>$outfile <<_______EOF
842 #define GPOINTER_TO_INT(p) ((gint) ${glib_gpi_cast} (p))
843 #define GPOINTER_TO_UINT(p) ((guint) ${glib_gpui_cast} (p))
845 #define GINT_TO_POINTER(i) ((gpointer) ${glib_gpi_cast} (i))
846 #define GUINT_TO_POINTER(u) ((gpointer) ${glib_gpui_cast} (u))
849 echo '#error SIZEOF_VOID_P unknown - This should never happen' >>$outfile
854 cat >>$outfile <<_______EOF
862 #define G_HAVE_INLINE 1
863 #else /* !__cplusplus */
865 #endif /* !__cplusplus */
869 if test x$g_mutex_has_default = xyes; then
870 cat >>$outfile <<_______EOF
871 $g_enable_threads_def G_THREADS_ENABLED
872 typedef struct _GStaticMutex GStaticMutex;
875 struct _GMutex *runtime_mutex;
877 char pad[$g_mutex_sizeof];
883 #define G_STATIC_MUTEX_INIT { NULL, { { $g_mutex_contents} } }
884 #define g_static_mutex_get_mutex(mutex) \
885 (g_thread_use_default_impl ? ((GMutex*) &(mutex).aligned_pad_u) : \
886 g_static_mutex_get_mutex_impl (&(mutex).runtime_mutex))
889 cat >>$outfile <<_______EOF
890 $g_enable_threads_def G_THREADS_ENABLED
891 typedef struct _GMutex* GStaticMutex;
892 #define G_STATIC_MUTEX_INIT NULL
893 #define g_static_mutex_get_mutex(mutex) (g_static_mutex_get_mutex_impl (&(mutex)))
899 if test -n "$gint64"; then
900 g_bit_sizes="$g_bit_sizes 64"
902 for bits in $g_bit_sizes; do
903 cat >>$outfile <<_______EOF
904 #define GINT${bits}_TO_${g_bs_native}(val) ((gint${bits}) (val))
905 #define GUINT${bits}_TO_${g_bs_native}(val) ((guint${bits}) (val))
906 #define GINT${bits}_TO_${g_bs_alien}(val) ((gint${bits}) GUINT${bits}_SWAP_LE_BE (val))
907 #define GUINT${bits}_TO_${g_bs_alien}(val) (GUINT${bits}_SWAP_LE_BE (val))
911 cat >>$outfile <<_______EOF
912 #define GLONG_TO_LE(val) ((glong) GINT${glongbits}_TO_LE (val))
913 #define GULONG_TO_LE(val) ((gulong) GUINT${glongbits}_TO_LE (val))
914 #define GLONG_TO_BE(val) ((glong) GINT${glongbits}_TO_BE (val))
915 #define GULONG_TO_BE(val) ((gulong) GUINT${glongbits}_TO_BE (val))
917 #define GINT_TO_LE(val) ((gint) GINT${gintbits}_TO_LE (val))
918 #define GUINT_TO_LE(val) ((guint) GUINT${gintbits}_TO_LE (val))
919 #define GINT_TO_BE(val) ((gint) GINT${gintbits}_TO_BE (val))
920 #define GUINT_TO_BE(val) ((guint) GUINT${gintbits}_TO_BE (val))
921 #define G_BYTE_ORDER $g_byte_order
928 #endif /* __cplusplus */
930 #endif /* GLIBCONFIG_H */
934 if cmp -s $outfile glibconfig.h; then
935 echo glibconfig.h is unchanged
938 mv $outfile glibconfig.h
943 # Note that if two cases are the same, case goes with the first one.
944 # Note also that this is inside an AC_OUTPUT_COMMAND. We do not depend
945 # on variable expansion in case labels. Look at the generated config.status
949 x$ac_cv_header_float_h)
951 glib_mf=FLT_MIN glib_Mf=FLT_MAX
952 glib_md=DBL_MIN glib_Md=DBL_MAX
954 x$ac_cv_header_values_h)
956 glib_mf=MINFLOAT glib_Mf=MAXFLOAT
957 glib_md=MINDOUBLE glib_Md=MAXDOUBLE
962 x$ac_cv_header_limits_h)
964 glib_ms=SHRT_MIN glib_Ms=SHRT_MAX
965 glib_mi=INT_MIN glib_Mi=INT_MAX
966 glib_ml=LONG_MIN glib_Ml=LONG_MAX
968 x$ac_cv_header_values_h)
970 glib_ms=MINSHORT glib_Ms=MAXSHORT
971 glib_mi=MININT glib_Mi=MAXINT
972 glib_ml=MINLONG glib_Ml=MAXLONG
976 if test x$ac_cv_header_sys_poll_h = xyes ; then
981 $ac_cv_sizeof_short) gint16=short;;
982 $ac_cv_sizeof_int) gint16=int;;
985 $ac_cv_sizeof_short) gint32=short;;
986 $ac_cv_sizeof_int) gint32=int;;
987 $ac_cv_sizeof_long) gint32=long;;
994 gint64_constant='(val)'
1000 gint64_constant='(val##L)'
1002 $ac_cv_sizeof_long_long)
1004 glib_extension='G_GNUC_EXTENSION '
1005 glib_warning_guard="
1006 #if defined (__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 8
1007 # define G_GNUC_EXTENSION __extension__
1009 # define G_GNUC_EXTENSION
1013 gint64_constant='(G_GNUC_EXTENSION (val##LL))'
1017 gintbits=`expr $ac_cv_sizeof_int \* 8`
1018 glongbits=`expr $ac_cv_sizeof_long \* 8`
1021 case $ac_cv_sizeof_void_p in
1022 $ac_cv_sizeof_int) glib_gpi_cast='' glib_gpui_cast='' ;;
1023 $ac_cv_sizeof_long) glib_gpi_cast='(glong)' glib_gpui_cast='(gulong)' ;;
1024 *) glib_unknown_void_p=yes ;;
1029 x$ac_cv_func_atexit)
1031 #ifdef NeXT /* @#%@! NeXTStep */
1032 # define g_ATEXIT(proc) (!atexit (proc))
1034 # define g_ATEXIT(proc) (atexit (proc))
1037 x$ac_cv_func_on_exit)
1039 #define g_ATEXIT(proc) (on_exit ((void (*)(int, void*))(proc), NULL))"
1044 x$ac_cv_func_memmove)
1046 #define g_memmove(d,s,n) G_STMT_START { memmove ((d), (s), (n)); } G_STMT_END'
1050 /* We make the assumption that if memmove isn't available, then
1051 * bcopy will do the job. This isn't safe everywhere. (bcopy can't
1052 * necessarily handle overlapping copies) */
1053 #define g_memmove(d,s,n) G_STMT_START { bcopy ((s), (d), (n)); } G_STMT_END"
1058 #define GLIB_MAJOR_VERSION $GLIB_MAJOR_VERSION
1059 #define GLIB_MINOR_VERSION $GLIB_MINOR_VERSION
1060 #define GLIB_MICRO_VERSION $GLIB_MICRO_VERSION
1064 x$glib_cv_va_copy) glib_vacopy='#define G_VA_COPY va_copy' ;;
1065 x$glib_cv___va_copy) glib_vacopy='#define G_VA_COPY __va_copy' ;;
1069 if test x$glib_cv_va_val_copy = xno; then
1070 glib_vacopy="\$glib_vacopy
1071 #define G_VA_COPY_AS_ARRAY 1"
1074 if test x$glib_cv_hasinline = xyes; then
1075 glib_inline='#define G_HAVE_INLINE 1'
1077 if test x$glib_cv_has__inline = xyes; then
1078 glib_inline="\$glib_inline
1079 #define G_HAVE___INLINE 1"
1081 if test x$glib_cv_has__inline__ = xyes; then
1082 glib_inline="\$glib_inline
1083 #define G_HAVE___INLINE__ 1"
1087 x$ac_cv_c_bigendian)
1088 g_byte_order=G_BIG_ENDIAN
1093 g_byte_order=G_LITTLE_ENDIAN
1099 if test x$glib_wchar_h = xyes; then
1101 #define G_HAVE_WCHAR_H 1'
1103 if test x$glib_wctype_h = xyes; then
1105 #define G_HAVE_WCTYPE_H 1"
1107 if test x$glib_working_wctype = xno; then
1109 #define G_HAVE_BROKEN_WCTYPE 1"
1112 case x$enable_threads in
1113 xyes) g_enable_threads_def="#define";;
1114 *) g_enable_threads_def="#undef ";;
1117 g_mutex_has_default="$mutex_has_default"
1118 g_mutex_sizeof="$glib_cv_sizeof_gmutex"
1119 g_mutex_contents="$glib_cv_byte_contents_gmutex"
1125 gmodule/gmoduleconf.h
1129 ],[case "$CONFIG_FILES" in
1130 *glib-config*)chmod +x glib-config;;