Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / glib / configure.in
blob6de3215f02094584082a53d516dcf8b60c9af7cf
1 dnl ***********************************
2 dnl *** include special GLib macros ***
3 dnl ***********************************
5 # require autoconf 2.53
6 AC_PREREQ(2.53)
8 # init autoconf (and check for presence of glist.c)
9 AC_INIT(glist.c)
11 # Save this value here, since automake will set cflags later
12 cflags_set=${CFLAGS+set}
14 # we rewrite this file
15 if test "x$cross_compiling" != "xyes"; then
16         rm -f glibconfig-sysdefs.h
20 # The following version number definitions apply to GLib, GModule and GThread
21 # as a whole, so if changes occoured in any of them, they are all
22 # treated with the same interface and binary age.
24 # Making releases:
25 #   GLIB_MICRO_VERSION += 1;
26 #   GLIB_INTERFACE_AGE += 1;
27 #   GLIB_BINARY_AGE += 1;
28 # if any functions have been added, set GLIB_INTERFACE_AGE to 0.
29 # if backwards compatibility has been broken,
30 # set GLIB_BINARY_AGE _and_ GLIB_INTERFACE_AGE to 0.
32 GLIB_MAJOR_VERSION=1
33 GLIB_MINOR_VERSION=2
34 GLIB_MICRO_VERSION=10
35 GLIB_INTERFACE_AGE=10
36 GLIB_BINARY_AGE=10
37 GLIB_VERSION=$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION.$GLIB_MICRO_VERSION
38 dnl
40 AC_SUBST(GLIB_MAJOR_VERSION)
41 AC_SUBST(GLIB_MINOR_VERSION)
42 AC_SUBST(GLIB_MICRO_VERSION)
43 AC_SUBST(GLIB_VERSION)
44 AC_SUBST(GLIB_INTERFACE_AGE)
45 AC_SUBST(GLIB_BINARY_AGE)
47 # libtool versioning
48 LT_RELEASE=$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION
49 LT_CURRENT=`expr $GLIB_MICRO_VERSION - $GLIB_INTERFACE_AGE`
50 LT_REVISION=$GLIB_INTERFACE_AGE
51 LT_AGE=`expr $GLIB_BINARY_AGE - $GLIB_INTERFACE_AGE`
52 AC_SUBST(LT_RELEASE)
53 AC_SUBST(LT_CURRENT)
54 AC_SUBST(LT_REVISION)
55 AC_SUBST(LT_AGE)
57 VERSION=$GLIB_VERSION
58 PACKAGE=glib
60 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
62 # Specify a configuration file
63 AM_CONFIG_HEADER(config.h)
65 AC_DEFINE_UNQUOTED(GLIB_MAJOR_VERSION, $GLIB_MAJOR_VERSION)
66 AC_DEFINE_UNQUOTED(GLIB_MINOR_VERSION, $GLIB_MINOR_VERSION)
67 AC_DEFINE_UNQUOTED(GLIB_MICRO_VERSION, $GLIB_MICRO_VERSION)
68 AC_DEFINE_UNQUOTED(GLIB_INTERFACE_AGE, $GLIB_INTERFACE_AGE)
69 AC_DEFINE_UNQUOTED(GLIB_BINARY_AGE, $GLIB_BINARY_AGE)
71 dnl Initialize libtool
72 AM_PROG_LIBTOOL
74 dnl Initialize maintainer mode
75 AM_MAINTAINER_MODE
77 dnl figure debugging default, prior to $ac_help setup
78 dnl
79 if test `expr $GLIB_MINOR_VERSION \% 2` = 1 ; then
80         debug_default=yes
81 else
82         debug_default=minimum
85 dnl declare --enable-* args and collect ac_help strings
86 AC_ARG_ENABLE(debug, [  --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,enable_debug=$debug_default)
87 AC_ARG_ENABLE(mem_check, [  --enable-mem-check      turn on malloc/free sanity checking (not recommended) [default=no]],,enable_mem_check=no)
88 AC_ARG_ENABLE(mem_profile, [  --enable-mem-profile    turn on malloc profiling atexit (not recommended) [default=no]],,enable_mem_profile=no)
89 AC_ARG_ENABLE(ansi, [  --enable-ansi           turn on strict ansi [default=no]],
90                     , enable_ansi=no)
91 AC_ARG_ENABLE(threads, [  --enable-threads        turn on basic thread support [default=yes]
92                           ([=no] will override --with-threads)],,enable_threads=yes)
94 if test "x$enable_threads" != "xyes"; then
95   enable_threads=no
98 mem_warn=false
100 AC_MSG_CHECKING(whether to enable memory checking)
101 if test "x$enable_mem_check" = "xyes"; then
102   AC_DEFINE(ENABLE_MEM_CHECK, 1)
103   AC_SUBST(ENABLE_MEM_CHECK)
104   AC_MSG_RESULT(yes)
105   mem_warn=true
106 else
107   AC_MSG_RESULT(no)
110 AC_MSG_CHECKING(whether to enable memory profiling)
111 if test "x$enable_mem_profile" = "xyes"; then
112   AC_DEFINE(ENABLE_MEM_PROFILE, 1)
113   AC_SUBST(ENABLE_MEM_PROFILE)
114   AC_MSG_RESULT(yes)
115   mem_warn=true
116 else
117   AC_MSG_RESULT(no)
122 if $mem_warn ; then
123   AC_MSG_WARN([
124 **********************************************************************
125  You have specified --enable-mem-profile or --enable-mem-check. 
126  These options are not recommended; they have not been thoroughly 
127  tested, and may cause unwanted side-effects. If --enable-mem-check is 
128  specified, NO MEMORY WILL BE FREED, EVER.
130  References to better memory debugging tools can be found at:
132   http://people.redhat.com/otaylor/memprof/memtools.html
134 **********************************************************************])
137 if test "x$enable_debug" = "xyes"; then
138   test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
139   GLIB_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
140 else
141   if test "x$enable_debug" = "xno"; then
142     GLIB_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
143   fi
146 AC_DEFINE_UNQUOTED(G_COMPILED_WITH_DEBUGGING, "${enable_debug}")
148 # Checks for programs.
149 AC_PROG_CC
150 AM_PROG_CC_STDC
151 AC_PROG_INSTALL
153 changequote(,)dnl
154 if test "x$GCC" = "xyes"; then
155   case " $CFLAGS " in
156   *[\ \ ]-Wall[\ \      ]*) ;;
157   *) CFLAGS="$CFLAGS -Wall" ;;
158   esac
160   if test "x$enable_ansi" = "xyes"; then
161     case " $CFLAGS " in
162     *[\ \       ]-ansi[\ \      ]*) ;;
163     *) CFLAGS="$CFLAGS -ansi" ;;
164     esac
166     case " $CFLAGS " in
167     *[\ \       ]-pedantic[\ \  ]*) ;;
168     *) CFLAGS="$CFLAGS -pedantic" ;;
169     esac
170   fi
172 changequote([,])dnl
174 # Checks for header files.
175 AC_HEADER_STDC
177 # Checks for library functions.
178 AC_FUNC_VPRINTF
180 AC_CHECK_FUNCS(atexit on_exit)
182 AC_CHECK_SIZEOF(char)
183 AC_CHECK_SIZEOF(short)
184 AC_CHECK_SIZEOF(long)
185 AC_CHECK_SIZEOF(int)
186 AC_CHECK_SIZEOF(void *)
187 AC_CHECK_SIZEOF(long long)
189 dnl long doubles were not used, and a portability problem
190 dnl AC_C_LONG_DOUBLE
191 AC_C_CONST
193 dnl AC_C_INLINE is useless to us since it bails out too early, we need to
194 dnl truely know which ones of `inline', `__inline' and `__inline__' are
195 dnl actually supported.
196 AC_MSG_CHECKING(for __inline)
197 AC_CACHE_VAL(glib_cv_has__inline,[
198         AC_TRY_RUN([
199         __inline int foo () { return 0; }
200         int main () { return foo (); }
201         ],
202         glib_cv_has__inline=yes
203         ,
204         glib_cv_has__inline=no
205         ,)
207 AC_MSG_RESULT($glib_cv_has__inline)
208 case x$glib_cv_has__inline in
209 xyes) AC_DEFINE(G_HAVE___INLINE)
210 esac
211 AC_MSG_CHECKING(for __inline__)
212 AC_CACHE_VAL(glib_cv_has__inline__,[
213         AC_TRY_RUN([
214         __inline__ int foo () { return 0; }
215         int main () { return foo (); }
216         ],
217         glib_cv_has__inline__=yes
218         ,
219         glib_cv_has__inline__=no
220         ,)
222 AC_MSG_RESULT($glib_cv_has__inline__)
223 case x$glib_cv_has__inline__ in
224 xyes) AC_DEFINE(G_HAVE___INLINE__)
225 esac
226 AC_MSG_CHECKING(for inline)
227 AC_CACHE_VAL(glib_cv_hasinline,[
228         AC_TRY_RUN([
229         inline int foo () { return 0; }
230         int main () { return foo (); }
231         ],
232         glib_cv_hasinline=yes
233         ,
234         glib_cv_hasinline=no
235         ,)
237 AC_MSG_RESULT($glib_cv_hasinline)
238 case x$glib_cv_hasinline in
239 xyes) AC_DEFINE(G_HAVE_INLINE)
240 esac
242 dnl for bytesex stuff
243 AC_C_BIGENDIAN
245 dnl header file checks
246 AC_CHECK_HEADERS(float.h, AC_DEFINE(HAVE_FLOAT_H))
247 AC_CHECK_HEADERS(limits.h, AC_DEFINE(HAVE_LIMITS_H))
248 AC_CHECK_HEADERS(pwd.h, AC_DEFINE(HAVE_PWD_H))
249 AC_CHECK_HEADERS(sys/param.h, AC_DEFINE(HAVE_SYS_PARAM_H))
250 AC_CHECK_HEADERS(sys/poll.h, AC_DEFINE(HAVE_SYS_POLL_H))
251 AC_CHECK_HEADERS(sys/select.h, AC_DEFINE(HAVE_SYS_SELECT_H))
252 AC_CHECK_HEADERS(sys/time.h, AC_DEFINE(HAVE_SYS_TIME_H))
253 AC_CHECK_HEADERS(sys/times.h, AC_DEFINE(HAVE_SYS_TIMES_H))
254 AC_CHECK_HEADERS(unistd.h, AC_DEFINE(HAVE_UNISTD_H))
255 AC_CHECK_HEADERS(values.h, AC_DEFINE(HAVE_VALUES_H))
257 # Check for some functions
258 AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf strcasecmp strncasecmp poll)
260 # Check for sys_errlist
261 AC_MSG_CHECKING(for sys_errlist)
262 AC_TRY_LINK(, [
263 extern char *sys_errlist[];
264 extern int sys_nerr;
265 sys_errlist[sys_nerr-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_ERRLIST)
272 # Check for sys_siglist
273 AC_MSG_CHECKING(for sys_siglist)
274 AC_TRY_LINK(, [
275 extern char *sys_siglist[];
276 exit (sys_siglist[0]);
277 ], glib_ok=yes, glib_ok=no)
278 AC_MSG_RESULT($glib_ok)
279 if test $glib_ok = no; then
280     AC_DEFINE(NO_SYS_SIGLIST)
283 # Check for sys_siglist decl (see Tue Jan 19 00:44:24 1999 in changelog)
284 AC_MSG_CHECKING(for sys_siglist declaration)
285 AC_TRY_COMPILE([#include <signal.h>], [
286 strlen (sys_siglist[0]);
287 ], glib_ok=yes, glib_ok=no)
288 AC_MSG_RESULT($glib_ok)
289 if test $glib_ok = no; then
290     AC_DEFINE(NO_SYS_SIGLIST_DECL)
293 # Check if <sys/select.h> needs to be included for fd_set
294 AC_MSG_CHECKING([for fd_set])
295 AC_TRY_COMPILE([#include <sys/types.h>],
296         [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
297 if test $gtk_ok = yes; then
298     AC_MSG_RESULT([yes, found in sys/types.h])
299 else
300     AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
301     if test $gtk_ok = yes; then
302         AC_DEFINE(HAVE_SYS_SELECT_H)
303         AC_MSG_RESULT([yes, found in sys/select.h])
304     else
305         AC_DEFINE(NO_FD_SET)
306         AC_MSG_RESULT(no)
307     fi
310 # These are used only in GDK (gdki18n.h)
311 # This stuff is here only so that we can define these
312 # things in glibconfig.h. If gtk+ started using an installed
313 # gdkconfig.h file, then the definitions would belong there.
315 # Check for wchar.h
317 AC_MSG_CHECKING(for wchar.h)
318 AC_TRY_CPP([#include <wchar.h>], glib_wchar_h=yes, glib_wchar_h=no)
319 if test $glib_wchar_h = yes; then
320    AC_DEFINE(HAVE_WCHAR_H)
322 AC_MSG_RESULT($glib_wchar_h)
324 # Check for wctype.h (for iswalnum)
326 AC_MSG_CHECKING(for wctype.h)
327 AC_TRY_CPP([#include <wctype.h>], glib_wctype_h=yes, glib_wctype_h=no)
328 if test $glib_wctype_h = yes; then
329    AC_DEFINE(HAVE_WCTYPE_H)
331 AC_MSG_RESULT($glib_wctype_h)
333 oLIBS="$LIBS"
334 # in Solaris 2.5, `iswalnum' is in -lw
335 AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum)])
337 # The following is necessary for Linux libc-5.4.38
338 AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
339 AC_TRY_LINK([#include <stdlib.h>],[
340 #if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
341 #  ifdef HAVE_WCTYPE_H
342 #    include <wctype.h>
343 #  else
344 #    ifdef HAVE_WCHAR_H
345 #      include <wchar.h>
346 #    endif
347 #  endif
348 #else
349 #  define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
350 #endif
351 iswalnum((wchar_t) 0);
352 ], glib_working_wctype=yes, glib_working_wctype=no)
353 LIBS="$oLIBS"
355 if test $glib_working_wctype = no; then
356    AC_DEFINE(HAVE_BROKEN_WCTYPE)
358 AC_MSG_RESULT($glib_working_wctype)
360 dnl *** check for sane realloc() ***
361 AC_MSG_CHECKING(whether realloc (NULL,) will work)
362 AC_CACHE_VAL(glib_cv_sane_realloc,[
363         AC_TRY_RUN([
364         #include <stdlib.h>
365         int main() {
366           return realloc (0, sizeof (int)) == 0;
367         }],
368         glib_cv_sane_realloc=yes
369         ,
370         glib_cv_sane_realloc=no
371         ,)
373 if test "x$glib_cv_sane_realloc" = "xyes"; then
374         AC_DEFINE(REALLOC_0_WORKS)
376 AC_MSG_RESULT($glib_cv_sane_realloc)
379 dnl **********************
380 dnl *** va_copy checks ***
381 dnl **********************
382 dnl we currently check for all three va_copy possibilities, so we get
383 dnl all results in config.log for bug reports.
384 AC_MSG_CHECKING(for an implementation of va_copy())
385 AC_CACHE_VAL(glib_cv_va_copy,[
386         AC_TRY_RUN([
387         #include <stdarg.h>
388         void f (int i, ...) {
389         va_list args1, args2;
390         va_start (args1, i);
391         va_copy (args2, args1);
392         if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
393           exit (1);
394         va_end (args1); va_end (args2);
395         }
396         int main() {
397           f (0, 42);
398           return 0;
399         }],
400         glib_cv_va_copy=yes
401         ,
402         glib_cv_va_copy=no
403         ,)
405 AC_MSG_RESULT($glib_cv_va_copy)
406 AC_MSG_CHECKING(for an implementation of __va_copy())
407 AC_CACHE_VAL(glib_cv___va_copy,[
408         AC_TRY_RUN([
409         #include <stdarg.h>
410         void f (int i, ...) {
411         va_list args1, args2;
412         va_start (args1, i);
413         __va_copy (args2, args1);
414         if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
415           exit (1);
416         va_end (args1); va_end (args2);
417         }
418         int main() {
419           f (0, 42);
420           return 0;
421         }],
422         glib_cv___va_copy=yes
423         ,
424         glib_cv___va_copy=no
425         ,)
427 AC_MSG_RESULT($glib_cv___va_copy)
428 AC_MSG_CHECKING(whether va_lists can be copied by value)
429 AC_CACHE_VAL(glib_cv_va_val_copy,[
430         AC_TRY_RUN([
431         #include <stdarg.h>
432         void f (int i, ...) {
433         va_list args1, args2;
434         va_start (args1, i);
435         args2 = args1;
436         if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
437           exit (1);
438         va_end (args1); va_end (args2);
439         }
440         int main() {
441           f (0, 42);
442           return 0;
443         }],
444         glib_cv_va_val_copy=yes
445         ,
446         glib_cv_va_val_copy=no
447         ,)
449 if test "x$glib_cv_va_copy" = "xyes"; then
450   AC_DEFINE(G_VA_COPY, va_copy)
451 else
452 if test "x$glib_cv___va_copy" = "xyes"; then
453   AC_DEFINE(G_VA_COPY, __va_copy)
456 if test "x$glib_cv_va_val_copy" = "xno"; then
457   AC_DEFINE(G_VA_COPY_AS_ARRAY)
459 AC_MSG_RESULT($glib_cv_va_val_copy)
462 dnl ***********************
463 dnl *** g_module checks ***
464 dnl ***********************
465 G_MODULE_LIBS=
466 G_MODULE_LDFLAGS=
467 dnl G_MODULE_IMPL= don't reset, so cmd-line can override
468 G_MODULE_NEED_USCORE=0
469 G_MODULE_BROKEN_RTLD_GLOBAL=0
470 G_MODULE_HAVE_DLERROR=0
471 dnl *** dlopen() and dlsym() in system libraries
472 AC_CHECK_FUNC([dlopen], [AC_CHECK_FUNC([dlsym], [G_MODULE_IMPL=G_MODULE_IMPL_DL], [])], [])
473 dnl *** dlopen() and dlsym() in libdl
474 if test -z "$G_MODULE_IMPL"; then
475         AC_CHECK_LIB([dl], [dlopen], [AC_CHECK_LIB([dl], [dlsym], [
476                 G_MODULE_LIBS=-ldl
477                 G_MODULE_IMPL=G_MODULE_IMPL_DL
478         ], [])], [])
480 dnl *** shl_load() in libdld (HP-UX)
481 if test -z "$G_MODULE_IMPL"; then
482         AC_MSG_CHECKING(how to export all symbols)
483         SAVED_LDFLAGS=$LDFLAGS
484         LDFLAGS="$LDFLAGS -Wl,-E"
485         AC_TRY_LINK(,[ return 0; ],
486                 [ G_MODULE_LDFLAGS="-Wl,-E" ],[
487                 LDFLAGS="$SAVED_LDFLAGS -bexpall"
488                 AC_TRY_LINK(,[ return 0; ],
489                         G_MODULE_LDFLAGS="-bexpall",
490                         G_MODULE_LDFLAGS="none"
491                 )
492         ])
493         LDFLAGS=$SAVED_LDFLAGS
494         AC_MSG_RESULT($G_MODULE_LDFLAGS)
495         if test "x$G_MODULE_LDFLAGS" = "xnone"; then
496                 G_MODULE_LDFLAGS=
497         fi
498         AC_CHECK_LIB(dld, shl_load,
499                 G_MODULE_LIBS=-ldld
500                 G_MODULE_IMPL=G_MODULE_IMPL_DLD
501         ,)
503 dnl *** additional checks for G_MODULE_IMPL_DL
504 if test "$G_MODULE_IMPL" = "G_MODULE_IMPL_DL"; then
505         case "$host_os" in
506           linux*)
507             G_MODULE_LDFLAGS='-rdynamic'
508             ;;
509         esac
510         LIBS_orig="$LIBS"
511         LDFLAGS_orig="$LDFLAGS"
512         LIBS="$LIBS $G_MODULE_LIBS"
513         LDFLAGS="$LDFLAGS $G_MODULE_LDFLAGS"
514 dnl *** check for OSF1/5.0 RTLD_GLOBAL brokenness
515         AC_CACHE_CHECK([for RTLD_GLOBAL brokenness],
516                 glib_cv_rtldglobal_broken,[
517                 AC_TRY_RUN([
518                 #include <dlfcn.h>
519                 #ifndef RTLD_GLOBAL
520                 #define RTLD_GLOBAL 0
521                 #endif
522                 #ifndef RTLD_LAZY
523                 #define RTLD_LAZY 0
524                 #endif
525                 int pthread_create;
526                 int main () {
527                 void *handle, *global, *local;
528                 global = &pthread_create;
529                 handle = dlopen ("libpthread.so", RTLD_GLOBAL | RTLD_LAZY);
530                 if (!handle) return 0;
531                 local = dlsym (handle, "pthread_create");
532                 return global == local;
533                 }],
534                         [glib_cv_rtldglobal_broken=no],
535                         [glib_cv_rtldglobal_broken=yes],
536                         [])
537                 rm -f plugin.c plugin.o plugin.lo
538         ])
539         if test "x$glib_cv_rtldglobal_broken" = "xyes"; then
540                 G_MODULE_BROKEN_RTLD_GLOBAL=1
541         else
542                 G_MODULE_BROKEN_RTLD_GLOBAL=0
543         fi
544 dnl *** check whether we need preceeding underscores
545         AC_MSG_CHECKING(for preceeding underscore in symbols)
546         AC_CACHE_VAL(glib_cv_uscore,[
547                 AC_TRY_RUN([
548                 #include <dlfcn.h>
549                 int glib_underscore_test (void) { return 42; }
550                 int main() {
551                   void *f1 = (void*)0, *f2 = (void*)0, *handle;
552                   handle = dlopen ((void*)0, 0);
553                   if (handle) {
554                     f1 = dlsym (handle, "glib_underscore_test");
555                     f2 = dlsym (handle, "_glib_underscore_test");
556                   } return (!f2 || f1);
557                 }],
558                         glib_cv_uscore=yes,
559                         glib_cv_uscore=no,
560                 )
561                 rm -f plugin.c plugin.o plugin.lo
562         ])
563         AC_MSG_RESULT($glib_cv_uscore)
564         if test "x$glib_cv_uscore" = "xyes"; then
565                 G_MODULE_NEED_USCORE=1
566         else
567                 G_MODULE_NEED_USCORE=0
568         fi
570         LDFLAGS="$LDFLAGS_orig"
571 dnl *** check for having dlerror()
572         AC_CHECK_FUNC(dlerror,
573                 G_MODULE_HAVE_DLERROR=1,
574                 G_MODULE_HAVE_DLERROR=0)
575         LIBS="$LIBS_orig"
577 dnl *** done, have e got an implementation?
578 if test -z "$G_MODULE_IMPL"; then
579         G_MODULE_IMPL=0
581 AC_SUBST(G_MODULE_IMPL)
582 AC_SUBST(G_MODULE_LIBS)
583 AC_SUBST(G_MODULE_LDFLAGS)
584 AC_SUBST(G_MODULE_HAVE_DLERROR)
585 AC_SUBST(G_MODULE_NEED_USCORE)
586 AC_SUBST(G_MODULE_BROKEN_RTLD_GLOBAL)
587 AC_SUBST(GLIB_DEBUG_FLAGS)
590 dnl ***********************
591 dnl *** g_thread checks ***
592 dnl ***********************
594 AC_ARG_WITH(threads, [  --with-threads=[none/posix/solaris/nspr] specify a thread implementation to use],
595         if test "x$with_threads" = x; then
596                 want_threads=yes
597         else
598                 want_threads=$with_threads
599         fi,
600         want_threads=yes)
601 if test "x$enable_threads" = "xno"; then
602         want_threads=no
604 if test "x$want_threads" = "xnone"; then
605         want_threads=no
608 dnl error and warning message
609 dnl *************************
611 THREAD_NO_IMPLEMENTATION="You do not have any known thread system on your
612                 computer. glib will not be thread safe on your computer."
614 FLAG_DOES_NOT_WORK="I can't find the MACRO, that enables thread safety on your
615                 platform (normally it's "_REENTRANT"). I'll not use any flag on
616                 compilation now, but then your programs might not work.
617                 Please provide information on how it is done on your system."
619 LIBS_NOT_FOUND_1="I can't find the libraries for the thread implementation
620                 "
622 LIBS_NOT_FOUND_2=". Please choose another thread implementation or
623                 provide information on your thread implementation.
624                 You can also run 'configure --disable-threads' 
625                 to compile without thread support."
627 FUNC_NO_GETPWUID_R="the 'g_get_(user_name|real_name|home_dir|tmp_dir)'
628                 functions will not be MT-safe during their first call because
629                 there is no working 'getpwuid_r' on your system."
631 FUNC_NO_LOCALTIME_R="the 'g_date_set_time' function will not be MT-safe
632                 because there is no 'localtime_r' on your system."
634 dnl determination of thread implementation
635 dnl ***************************************
637 have_threads=none
638 if test "x$want_threads" = xyes || test "x$want_threads" = xsolaris; then
639         case $host in
640                 *-*-solaris*)
641                 AC_CHECK_LIB(thread, cond_init, have_threads=solaris)
642                 ;;
643         esac
645 if test "x$want_threads" = xyes || test "x$want_threads" = xposix; then
646         if test "x$have_threads" = xnone; then
647                 AC_CHECK_HEADER(pthread.h, have_threads=posix)
648         fi
650 if test "x$want_threads" = xyes || test "x$want_threads" = xnspr; then
651         if test "x$have_threads" = xnone; then
652                 AC_CHECK_LIB(nspr21, PRP_NewNakedCondVar, have_threads=nspr)
653         fi
656 AC_MSG_CHECKING(for thread implementation)
658 if test "x$have_threads" = xnone && test "x$want_threads" != xno; then
659         AC_MSG_RESULT(none available)
660         AC_MSG_WARN($THREAD_NO_IMPLEMENTATION)
661 else
662         AC_MSG_RESULT($have_threads)
666 dnl determination of G_THREAD_LIBS
667 dnl ******************************
669 G_THREAD_LIBS=
670 G_THREAD_CFLAGS=
672 mutex_has_default=no
673 case $have_threads in
674         posix)
675                 G_THREAD_LIBS=error
676                 AC_CHECK_LIB(pthread, pthread_attr_init,
677                              G_THREAD_LIBS="-lpthread")
678                 if test "x$G_THREAD_LIBS" = xerror; then
679                         AC_CHECK_LIB(pthreads, pthread_attr_init,
680                                 G_THREAD_LIBS="-lpthreads")
681                 fi
682                 if test "x$G_THREAD_LIBS" = xerror; then
683                         AC_CHECK_LIB(thread, pthread_attr_init,
684                                 G_THREAD_LIBS="-lthread")
685                 fi
686                 if test "x$G_THREAD_LIBS" = xerror; then
687                         AC_CHECK_LIB(c_r, pthread_attr_init,
688                                 G_THREAD_LIBS="-lc_r")
689                 fi
690                 if test "x$G_THREAD_LIBS" = xerror; then
691                         AC_CHECK_FUNC(pthread_attr_init, G_THREAD_LIBS="")
692                 fi
693                 dnl ********** DG/UX ************
694                 if test "x$G_THREAD_LIBS" = xerror; then
695                         AC_CHECK_LIB(thread, __d10_pthread_attr_init,
696                                 G_THREAD_LIBS="-lthread"
697                                 G_THREAD_CFLAGS="-D_POSIX4A_DRAFT10_SOURCE")
698                 fi
699                 dnl ********* HPUX 11 ***********
700                 if test "x$G_THREAD_LIBS" = xerror; then
701                         AC_CHECK_LIB(pthread, __pthread_attr_init_system,
702                                 G_THREAD_LIBS="-lpthread")
703                 fi
704                 mutex_has_default=yes
705                 mutex_default_type='pthread_mutex_t'
706                 mutex_default_init='PTHREAD_MUTEX_INITIALIZER'
707                 mutex_header_file='pthread.h'
708                 g_threads_impl="POSIX"
709                 ;;
710         solaris)
711                 G_THREAD_LIBS=error
712                 AC_CHECK_LIB(thread, cond_init, G_THREAD_LIBS="-lthread")
713                 mutex_has_default=yes
714                 mutex_default_type='mutex_t'
715                 mutex_default_init="DEFAULTMUTEX"
716                 mutex_header_file='thread.h'
717                 g_threads_impl="SOLARIS"
718                 ;;
719         nspr)
720                 AC_CHECK_LIB(nspr21, PRP_NewNakedCondVar,
721                              G_THREAD_LIBS="-lnspr21")
722                 g_threads_impl="NSPR"
723                 ;;
724         none)
725                 g_threads_impl="NONE"
726                 ;;
727         *)
728                 g_threads_impl="NONE"
729                 G_THREAD_LIBS=error
730                 ;;
731 esac
733 if test "x$G_THREAD_LIBS" = xerror; then
734         AC_MSG_ERROR($LIBS_NOT_FOUND_1$have_threads$LIBS_NOT_FOUND_2)
737 AC_MSG_CHECKING(necessary linker options)
738 AC_MSG_RESULT($G_THREAD_LIBS)
740 dnl determination of G_THREAD_CFLAGS
741 dnl ********************************
743 if test x"$have_threads" != xnone; then
744 G_THREAD_CFLAGS="$G_THREAD_CFLAGS -D_REENTRANT" # good default guess
746     case $host in
747         *-aix*)
748                 G_THREAD_CFLAGS="$G_THREAD_CFLAGS -D_THREAD_SAFE"
749                 if test x"$GCC" = xyes; then
750                         G_THREAD_CFLAGS="$G_THREAD_CFLAGS -mthreads"
751                 fi
752                 ;;
753         *-freebsd2.2*)
754                 G_THREAD_CFLAGS="$G_THREAD_CFLAGS -D_THREAD_SAFE"
756                 # FreeBSD 2.2.x shiped with gcc 2.7.2.x, which doesn't support
757                 # -mthreads flag.
758                 ;;
759     esac
761     # if we are not finding the ctime_r function, then we probably are
762     # not using the proper multithread flag
763     # Note: Digital UNIX 4.0d #defines ctime_r to _Pctime_r for gcc.
764     old_CPPFLAGS=$CPPFLAGS
765     CPPFLAGS="$CPPFLAGS $G_THREAD_CFLAGS"
766     AC_EGREP_HEADER([[^a-zA-Z_](_P)?ctime_r[^a-zA-Z_]], time.h, ,
767     G_THREAD_CFLAGS=
768     AC_MSG_WARN($FLAG_DOES_NOT_WORK))
769     CPPFLAGS=$old_CPPFLAGS
771     AC_MSG_CHECKING(necessary compiler options)
773     AC_MSG_RESULT($G_THREAD_CFLAGS)
774 else
775     G_THREAD_CFLAGS=
778 dnl check for mt safe function variants
779 dnl ***********************************
781 if test x"$have_threads" != xnone; then
782         glib_save_LIBS="$LIBS"
783         glib_save_CFLAGS="$CFLAGS"
784         # we are not doing the following for now, as this might require glib 
785         # to always be linked with the thread libs on some platforms. 
786         # LIBS="$LIBS $G_THREAD_LIBS"
787         CFLAGS="$CFLAGS $G_THREAD_CFLAGS"
788         AC_CHECK_FUNCS(localtime_r rand_r)
789         if test "$ac_cv_header_pwd_h" = "yes"; then
790                 AC_MSG_CHECKING([for getpwuid_r])
791                 AC_CACHE_VAL(ac_cv_func_getpwuid_r,
792                         [AC_TRY_RUN([#include <errno.h>
793                                 int main () { char buffer[10000], *pointer; 
794                                 char getpwuid_r (long, void*, void*,
795                                         int, void*);
796                                 int error;
797                                 errno = 0;
798                                 error = getpwuid_r (0, &buffer, &buffer, 
799                                         sizeof (buffer), &pointer);
800                                 return errno == ENOSYS || error == ENOSYS;}],
801                                 [ac_cv_func_getpwuid_r=yes],
802                                 [ac_cv_func_getpwuid_r=no])])
803                 if test "$ac_cv_func_getpwuid_r" = yes; then
804                         AC_MSG_RESULT(yes)
805                         AC_DEFINE(HAVE_GETPWUID_R)
806                 else
807                         AC_MSG_RESULT(no)
808                 fi
809                 if test "$ac_cv_func_getpwuid_r" = "yes"; then
810                         AC_MSG_CHECKING(whether getpwuid_r is posix like)
811                         # The signature for the POSIX version is:
812                         # int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **)
813                         AC_CACHE_CHECK([whether pthread_getspecific is posix like],
814                                 [ac_cv_func_getpwuid_r_posix],
815                                 [AC_TRY_COMPILE([#include <pwd.h>
816                                  #include <sys/types.h>
817                                  #include <stdlib.h>],
818                                         [getpwuid_r((uid_t)0, NULL, NULL, (size_t)0, NULL);],
819                                         [ac_cv_func_getpwuid_r_posix=yes],
820                                         [ac_cv_func_getpwuid_r_posix=no])]
821                         )
822                         if test "x$ac_cv_func_getpwuid_r_posix" = "xyes"; then
823                                 AC_DEFINE(HAVE_GETPWUID_R_POSIX)
824                         fi
825                 fi
826         fi
827         if test x"$have_threads" = xposix; then
828                 LIBS="$LIBS $G_THREAD_LIBS"
829                 AC_MSG_CHECKING(whether pthread_getspecific is posix like)
830                 # PCThreads has pthread_getspecific(pthread_key_t, void **);
831                 AC_CACHE_CHECK([whether pthread_getspecific is posix like],
832                         [glib_cv_sys_pthread_getspecific_posix],
833                         [AC_TRY_COMPILE([#include <pthread.h>],
834                                 [pthread_getspecific(0,NULL);],
835                                 [glib_cv_sys_pthread_getspecific_posix=no],
836                                 [glib_cv_sys_pthread_getspecific_posix=yes])]
837                 )
838                 if test "x$glib_cv_sys_pthread_getspecific_posix" = "xyes"; then
839                         AC_DEFINE(HAVE_PTHREAD_GETSPECIFIC_POSIX)
840                 fi
841                 AC_MSG_CHECKING(whether pthread_mutex_trylock is posix like)
842                 # DCE Threads return 1 as success, posix 0. what a mess.
843                 AC_CACHE_CHECK([whether pthread_mutex_trylock is posix like],
844                         [glib_cv_sys_pthread_mutex_trylock_posix],
845                         [AC_TRY_RUN([#include <pthread.h>
846                                 pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
847                                 int main () { 
848                                 return !pthread_mutex_trylock (&mutex); }],
849                         [glib_cv_sys_pthread_mutex_trylock_posix=no],
850                         [glib_cv_sys_pthread_mutex_trylock_posix=yes])]
851                 )
852                 if test "x$glib_cv_sys_pthread_mutex_trylock_posix=no" = "xyes"; then
853                         AC_DEFINE(HAVE_PTHREAD_MUTEX_TRYLOCK_POSIX)
854                 fi
855                 AC_MSG_CHECKING(whether pthread_cond_timedwait is posix like)
856                 # DCE Threads return -1 as failure, posix ETIMEDOUT.
857                 AC_CACHE_CHECK([whether pthread_cond_timedwait is posix like],
858                         [glib_cv_sys_pthread_cond_timedwait_posix],
859                         [AC_TRY_RUN([#include <pthread.h>
860                                 int main () { 
861                                 pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
862                                 pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
863                                 struct timeval tval;
864                                 struct timespec tspec;
865                                 gettimeofday (&tval, NULL);
866                                 tspec.tv_sec = tval.tv_sec;
867                                 tspec.tv_nsec = 0;
868                                 return pthread_cond_timedwait (&cond,&mutex,&tspec) != -1;}],
869                         [glib_cv_sys_pthread_cond_timedwait_posix=no],
870                         [glib_cv_sys_pthread_cond_timedwait_posix=yes])]
871                 )
872                 if test "x$glib_cv_sys_pthread_cond_timedwait_posix" = "xyes"; then
873                         AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_POSIX)
874                 fi
875         fi
876         LIBS="$glib_save_LIBS"
877         CFLAGS="$glib_save_CFLAGS"
880 if test "x$enable_threads" = "xyes"; then
881         if test "$ac_cv_func_getpwuid_r" != "yes"; then
882                 AC_MSG_WARN($FUNC_NO_GETPWUID_R)
883         fi
884         if test "$ac_cv_func_localtime_r" != "yes"; then
885                 AC_MSG_WARN($FUNC_NO_LOCALTIME_R)
886         fi
889 AC_DEFINE_UNQUOTED(G_THREAD_SOURCE,"gthread-$have_threads.c")
890 AC_SUBST(G_THREAD_CFLAGS)
891 AC_SUBST(G_THREAD_LIBS)
893 CFLAGS="$CFLAGS $G_THREAD_CFLAGS"
895 dnl **********************************************
896 dnl *** GDefaultMutex setup and initialization ***
897 dnl **********************************************
899 dnl if mutex_has_default = yes, we also got
900 dnl mutex_default_type, mutex_default_init and mutex_header_file
901 GLIB_IF_VAR_EQ(mutex_has_default, yes,
902         GLIB_SIZEOF([#include <$mutex_header_file>],
903                     $mutex_default_type,
904                     gmutex,
905                     )
906         GLIB_BYTE_CONTENTS([#include <$mutex_header_file>],
907                            $mutex_default_type,
908                            gmutex,
909                            $glib_cv_sizeof_gmutex,
910                            $mutex_default_init)
911         ,
915 dnl ****************************************
916 dnl *** GLib POLL* compatibility defines ***
917 dnl ****************************************
918 if test "x$cross_compiling" != "xyes"; then
919 GLIB_SYSDEFS(
920 [#include <sys/types.h>
921 #include <sys/poll.h>],
922         POLLIN:1 POLLOUT:4 POLLPRI:2 POLLERR:8 POLLHUP:16 POLLNVAL:32,
923         glibconfig-sysdefs.h,
924         =)
928 dnl ******************************
929 dnl *** output the whole stuff ***
930 dnl ******************************
932 AC_OUTPUT_COMMANDS([
934 ## Generate `glibconfig.h' in two cases
935 ## 1. `config.status' is run either explicitly, or via configure.
936 ##     Esp. not when it is run in `Makefile' to generate makefiles and
937 ##     config.h
938 ## 2. CONFIG_OTHER is set explicitly
940 ## Case 1 is difficult.  We know that `automake' sets one of
941 ## CONFIG_FILES or CONFIG_HEADERS to empty.  This heuristic works
942 ## only when AM_CONFIG_HEADER is set, however.
944 if test -n "${CONFIG_FILES}" && test -n "${CONFIG_HEADERS}"; then
945   # Both CONFIG_FILES and CONFIG_HEADERS are non-empty ==> Case 1
946   CONFIG_OTHER=${CONFIG_OTHER:-glibconfig.h}
948 case "$CONFIG_OTHER" in
949 *glibconfig.h*)
950         echo creating glibconfig.h
951         outfile=glibconfig.h-tmp
952         cat > $outfile <<\_______EOF
953 /* glibconfig.h
955  * This is a generated file.  Please modify `configure.in'
956  */
958 #ifndef GLIBCONFIG_H
959 #define GLIBCONFIG_H
961 _______EOF
963         if test x$glib_limits_h = xyes; then
964           echo '#include <limits.h>' >> $outfile
965         fi
966         if test x$glib_float_h = xyes; then
967           echo '#include <float.h>' >> $outfile
968         fi
969         if test x$glib_values_h = xyes; then
970           echo '#include <values.h>' >> $outfile
971         fi
972         if test x$g_mutex_header_file != x; then
973           echo '#include <'"$g_mutex_header_file"'>' >> $outfile
974         fi
975         if test x$glib_sys_poll_h = xyes; then
976           echo '#define GLIB_HAVE_SYS_POLL_H' >> $outfile
977         fi
979         cat >> $outfile <<_______EOF
981 #ifdef __cplusplus
982 extern "C" {
983 #endif /* __cplusplus */
985 #define G_MINFLOAT      $glib_mf
986 #define G_MAXFLOAT      $glib_Mf
987 #define G_MINDOUBLE     $glib_md
988 #define G_MAXDOUBLE     $glib_Md
989 #define G_MINSHORT      $glib_ms
990 #define G_MAXSHORT      $glib_Ms
991 #define G_MININT        $glib_mi
992 #define G_MAXINT        $glib_Mi
993 #define G_MINLONG       $glib_ml
994 #define G_MAXLONG       $glib_Ml
996 _______EOF
999         ### this should always be true in a modern C/C++ compiler
1000         cat >>$outfile <<_______EOF
1001 typedef signed char gint8;
1002 typedef unsigned char guint8;
1003 _______EOF
1006         if test -n "$gint16"; then
1007           cat >>$outfile <<_______EOF
1008 typedef signed $gint16 gint16;
1009 typedef unsigned $gint16 guint16;
1010 _______EOF
1011         fi
1014         if test -n "$gint32"; then
1015           cat >>$outfile <<_______EOF
1016 typedef signed $gint32 gint32;
1017 typedef unsigned $gint32 guint32;
1018 _______EOF
1019         fi
1022         if test -n "$gint64"; then
1023           cat >>$outfile <<_______EOF
1024 ${glib_warning_guard}#define G_HAVE_GINT64 1
1026 ${glib_extension}typedef signed $gint64 gint64;
1027 ${glib_extension}typedef unsigned $gint64 guint64;
1029 #define G_GINT64_CONSTANT(val)  $gint64_constant
1030 _______EOF
1031         fi
1034         if test -z "$glib_unknown_void_p"; then
1035           cat >>$outfile <<_______EOF
1037 #define GPOINTER_TO_INT(p)      ((gint)  ${glib_gpi_cast} (p))
1038 #define GPOINTER_TO_UINT(p)     ((guint) ${glib_gpui_cast} (p))
1040 #define GINT_TO_POINTER(i)      ((gpointer) ${glib_gpi_cast} (i))
1041 #define GUINT_TO_POINTER(u)     ((gpointer) ${glib_gpui_cast} (u))
1042 _______EOF
1043         else
1044           echo '#error SIZEOF_VOID_P unknown - This should never happen' >>$outfile
1045         fi
1049         cat >>$outfile <<_______EOF
1050 $glib_atexit
1051 $glib_memmove
1052 $glib_defines
1054 $glib_vacopy
1056 #ifdef  __cplusplus
1057 #define G_HAVE_INLINE   1
1058 #else   /* !__cplusplus */
1059 $glib_inline
1060 #endif  /* !__cplusplus */
1061 _______EOF
1063         echo >>$outfile
1064         if test x$g_mutex_has_default = xyes; then
1065                 cat >>$outfile <<_______EOF
1066 $g_enable_threads_def G_THREADS_ENABLED
1067 #define G_THREADS_IMPL_$g_threads_impl_def
1068 typedef struct _GStaticMutex GStaticMutex;
1069 struct _GStaticMutex
1071   struct _GMutex *runtime_mutex;
1072   union {
1073     char   pad[$g_mutex_sizeof];
1074     double dummy_double;
1075     void  *dummy_pointer;
1076     long   dummy_long;
1077   } aligned_pad_u;
1079 #define G_STATIC_MUTEX_INIT     { NULL, { { $g_mutex_contents} } }
1080 #define g_static_mutex_get_mutex(mutex) \
1081   (g_thread_use_default_impl ? ((GMutex*) &((mutex)->aligned_pad_u)) : \
1082    g_static_mutex_get_mutex_impl (&((mutex)->runtime_mutex)))
1083 _______EOF
1084         else
1085                 cat >>$outfile <<_______EOF
1086 $g_enable_threads_def G_THREADS_ENABLED
1087 #define G_THREADS_IMPL_$g_threads_impl_def
1088 typedef struct _GMutex* GStaticMutex;
1089 #define G_STATIC_MUTEX_INIT NULL
1090 #define g_static_mutex_get_mutex(mutex) (g_static_mutex_get_mutex_impl (mutex))
1091 _______EOF
1092         fi
1094         echo >>$outfile
1095         g_bit_sizes="16 32"
1096         if test -n "$gint64"; then
1097           g_bit_sizes="$g_bit_sizes 64"
1098         fi
1099         for bits in $g_bit_sizes; do
1100           cat >>$outfile <<_______EOF
1101 #define GINT${bits}_TO_${g_bs_native}(val)      ((gint${bits}) (val))
1102 #define GUINT${bits}_TO_${g_bs_native}(val)     ((guint${bits}) (val))
1103 #define GINT${bits}_TO_${g_bs_alien}(val)       ((gint${bits}) GUINT${bits}_SWAP_LE_BE (val))
1104 #define GUINT${bits}_TO_${g_bs_alien}(val)      (GUINT${bits}_SWAP_LE_BE (val))
1105 _______EOF
1106         done
1108         cat >>$outfile <<_______EOF
1109 #define GLONG_TO_LE(val)        ((glong) GINT${glongbits}_TO_LE (val))
1110 #define GULONG_TO_LE(val)       ((gulong) GUINT${glongbits}_TO_LE (val))
1111 #define GLONG_TO_BE(val)        ((glong) GINT${glongbits}_TO_BE (val))
1112 #define GULONG_TO_BE(val)       ((gulong) GUINT${glongbits}_TO_BE (val))
1113 #define GINT_TO_LE(val)         ((gint) GINT${gintbits}_TO_LE (val))
1114 #define GUINT_TO_LE(val)        ((guint) GUINT${gintbits}_TO_LE (val))
1115 #define GINT_TO_BE(val)         ((gint) GINT${gintbits}_TO_BE (val))
1116 #define GUINT_TO_BE(val)        ((guint) GUINT${gintbits}_TO_BE (val))
1117 #define G_BYTE_ORDER $g_byte_order
1119 _______EOF
1121         if test -r glibconfig-sysdefs.h; then
1122           cat glibconfig-sysdefs.h >>$outfile
1123         fi
1126         cat >>$outfile <<_______EOF
1128 $glib_wc
1131 #ifdef __cplusplus
1133 #endif /* __cplusplus */
1135 #endif /* GLIBCONFIG_H */
1136 _______EOF
1139         if cmp -s $outfile glibconfig.h; then
1140           echo glibconfig.h is unchanged
1141           rm -f $outfile
1142         else
1143           mv $outfile glibconfig.h
1144         fi ;;
1145 esac
1148 # Note that if two cases are the same, case goes with the first one.
1149 # Note also that this is inside an AC_OUTPUT_COMMAND.  We do not depend
1150 # on variable expansion in case labels.  Look at the generated config.status
1151 # for a hint.
1153 case xyes in
1154 x$ac_cv_header_float_h)
1155   glib_float_h=yes
1156   glib_mf=FLT_MIN glib_Mf=FLT_MAX
1157   glib_md=DBL_MIN glib_Md=DBL_MAX
1158   ;;
1159 x$ac_cv_header_values_h)
1160   glib_values_h=yes
1161   glib_mf=MINFLOAT  glib_Mf=MAXFLOAT
1162   glib_md=MINDOUBLE glib_Md=MAXDOUBLE
1163   ;;
1164 esac
1166 case xyes in
1167 x$ac_cv_header_limits_h)
1168   glib_limits_h=yes
1169   glib_ms=SHRT_MIN glib_Ms=SHRT_MAX
1170   glib_mi=INT_MIN  glib_Mi=INT_MAX
1171   glib_ml=LONG_MIN glib_Ml=LONG_MAX
1172   ;;
1173 x$ac_cv_header_values_h)
1174   glib_values_h=yes
1175   glib_ms=MINSHORT glib_Ms=MAXSHORT
1176   glib_mi=MININT   glib_Mi=MAXINT
1177   glib_ml=MINLONG  glib_Ml=MAXLONG
1178   ;;
1179 esac
1181 if test x$ac_cv_header_sys_poll_h = xyes ; then
1182   glib_sys_poll_h=yes
1185 case 2 in
1186 $ac_cv_sizeof_short)            gint16=short;;
1187 $ac_cv_sizeof_int)              gint16=int;;
1188 esac
1189 case 4 in
1190 $ac_cv_sizeof_short)            gint32=short;;
1191 $ac_cv_sizeof_int)              gint32=int;;
1192 $ac_cv_sizeof_long)             gint32=long;;
1193 esac
1194 case 8 in
1195 $ac_cv_sizeof_int)
1196   gint64=int
1197   glib_extension=
1198   glib_warning_guard=
1199   gint64_constant='(val)'
1200   ;;
1201 $ac_cv_sizeof_long)
1202   gint64=long
1203   glib_extension=
1204   glib_warning_guard=
1205   gint64_constant='(val##L)'
1206   ;;
1207 $ac_cv_sizeof_long_long)
1208   gint64='long long'
1209   glib_extension='G_GNUC_EXTENSION '
1210   glib_warning_guard="
1211 #if defined (__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
1212 #  define G_GNUC_EXTENSION __extension__
1213 #else
1214 #  define G_GNUC_EXTENSION
1215 #endif
1218   gint64_constant='(G_GNUC_EXTENSION (val##LL))'
1219   ;;
1220 esac
1222 gintbits=`expr $ac_cv_sizeof_int \* 8`
1223 glongbits=`expr $ac_cv_sizeof_long \* 8`
1226 case $ac_cv_sizeof_void_p in
1227 $ac_cv_sizeof_int)      glib_gpi_cast=''        glib_gpui_cast=''         ;;
1228 $ac_cv_sizeof_long)     glib_gpi_cast='(glong)' glib_gpui_cast='(gulong)' ;;
1229 *)                      glib_unknown_void_p=yes ;;
1230 esac
1233 case xyes in
1234 x$ac_cv_func_atexit)
1235   glib_atexit="
1236 #ifdef NeXT /* @#%@! NeXTStep */
1237 # define g_ATEXIT(proc) (!atexit (proc))
1238 #else
1239 # define g_ATEXIT(proc) (atexit (proc))
1240 #endif"
1241   ;;
1242 x$ac_cv_func_on_exit)
1243   glib_atexit="
1244 #define g_ATEXIT(proc)  (on_exit ((void (*)(int, void*))(proc), NULL))"
1245   ;;
1246 esac
1248 case xyes in
1249 x$ac_cv_func_memmove)
1250   glib_memmove='
1251 #define g_memmove(d,s,n) G_STMT_START { memmove ((d), (s), (n)); } G_STMT_END'
1252   ;;
1254   glib_memmove="
1255 /* We make the assumption that if memmove isn't available, then
1256  * bcopy will do the job. This isn't safe everywhere. (bcopy can't
1257  * necessarily handle overlapping copies) */
1258 #define g_memmove(d,s,n) G_STMT_START { bcopy ((s), (d), (n)); } G_STMT_END"
1259   ;;
1260 esac
1262 glib_defines="
1263 #define GLIB_MAJOR_VERSION $GLIB_MAJOR_VERSION
1264 #define GLIB_MINOR_VERSION $GLIB_MINOR_VERSION
1265 #define GLIB_MICRO_VERSION $GLIB_MICRO_VERSION
1268 case xyes in
1269 x$glib_cv_va_copy)      glib_vacopy='#define G_VA_COPY  va_copy' ;;
1270 x$glib_cv___va_copy)    glib_vacopy='#define G_VA_COPY  __va_copy' ;;
1271 *)                      glib_vacopy=''
1272 esac
1274 if test x$glib_cv_va_val_copy = xno; then
1275   glib_vacopy="\$glib_vacopy
1276 #define G_VA_COPY_AS_ARRAY 1"
1279 if test x$glib_cv_hasinline = xyes; then
1280     glib_inline='#define G_HAVE_INLINE 1'
1282 if test x$glib_cv_has__inline = xyes; then
1283     glib_inline="\$glib_inline
1284 #define G_HAVE___INLINE 1"
1286 if test x$glib_cv_has__inline__ = xyes; then
1287     glib_inline="\$glib_inline
1288 #define G_HAVE___INLINE__ 1"
1291 case xyes in
1292 x$ac_cv_c_bigendian)
1293   g_byte_order=G_BIG_ENDIAN
1294   g_bs_native=BE
1295   g_bs_alien=LE
1296   ;;
1298   g_byte_order=G_LITTLE_ENDIAN
1299   g_bs_native=LE
1300   g_bs_alien=BE
1301   ;;
1302 esac
1304 if test x$glib_wchar_h = xyes; then
1305   glib_wc='
1306 #define G_HAVE_WCHAR_H 1'
1308 if test x$glib_wctype_h = xyes; then
1309   glib_wc="\$glib_wc
1310 #define G_HAVE_WCTYPE_H 1"
1312 if test x$glib_working_wctype = xno; then
1313   glib_wc="\$glib_wc
1314 #define G_HAVE_BROKEN_WCTYPE 1"
1317 case x$enable_threads in
1318 xyes)   g_enable_threads_def="#define";;
1319 *)      g_enable_threads_def="#undef ";;
1320 esac
1322 g_threads_impl_def=$g_threads_impl
1324 g_mutex_has_default="$mutex_has_default"
1325 g_mutex_sizeof="$glib_cv_sizeof_gmutex"
1326 g_mutex_contents="$glib_cv_byte_contents_gmutex"
1329 AC_OUTPUT([
1330 glib.spec
1331 Makefile
1332 glib-config
1333 gmodule/gmoduleconf.h
1334 gmodule/Makefile
1335 gthread/Makefile
1336 docs/Makefile
1337 docs/glib-config.1
1338 tests/Makefile
1339 glib.pc
1340 gmodule.pc
1341 gthread.pc
1342 ],[case "$CONFIG_FILES" in
1343 *glib-config*)chmod +x glib-config;;
1344 esac])