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 dnl Initialize automake stuff
8 AM_INIT_AUTOMAKE(glib, 0.99.10)
10 # Specify a configuration file
11 AM_CONFIG_HEADER(glibconfig.h)
13 dnl Initialize libtool
16 dnl Initialize maintainer mode
21 AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],,enable_debug=minimum)
23 AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
26 if test "x$enable_debug" = "xyes"; then
27 test "$cflags_set" = set || CFLAGS="-g"
28 CFLAGS="$CFLAGS -DG_ENABLE_DEBUG"
30 if test "x$enable_debug" = "xno"; then
31 CFLAGS="$CFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
35 AC_DEFINE_UNQUOTED(G_COMPILED_WITH_DEBUGGING, "${enable_debug}")
37 # Checks for programs.
42 if eval "test x$GCC = xyes"; then
43 if eval test -z \"`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`\" ; then
44 CFLAGS="$CFLAGS -Wall"
47 if eval "test x$enable_ansi = xyes"; then
48 if eval test -z \"`echo "$CFLAGS" | grep "\-ansi" 2> /dev/null`\" ; then
49 CFLAGS="$CFLAGS -ansi"
52 if eval test -z \"`echo "$CFLAGS" | grep "\-pedantic" 2> /dev/null`\" ; then
53 CFLAGS="$CFLAGS -pedantic"
58 # Checks for header files.
61 # Checks for library functions.
64 AC_CHECK_FUNCS(atexit on_exit)
67 AC_CHECK_SIZEOF(short)
70 AC_CHECK_SIZEOF(void *)
72 # long doubles were not used, and a portability problem
77 AC_CHECK_HEADERS(float.h, AC_DEFINE(HAVE_FLOAT_H))
78 AC_CHECK_HEADERS(limits.h, AC_DEFINE(HAVE_LIMITS_H))
79 AC_CHECK_HEADERS(values.h, AC_DEFINE(HAVE_VALUES_H))
81 # Check for strerror, strsignal, memmove, vsnprintf, and strcasecmp functions
82 AC_CHECK_FUNCS(strerror strsignal memmove vsnprintf strcasecmp)
84 # Check for sys_errlist
85 AC_MSG_CHECKING(sys_errlist)
87 extern char *sys_errlist[];
89 sys_errlist[sys_nerr-1][0] = 0;
90 ], glib_ok=yes, glib_ok=no)
91 AC_MSG_RESULT($glib_ok)
92 if test $glib_ok = no; then
93 AC_DEFINE(NO_SYS_ERRLIST)
96 # Check for sys_siglist
97 AC_MSG_CHECKING(sys_siglist)
99 extern char *sys_siglist[];
100 sys_siglist[1][0] = 0;
101 ], glib_ok=yes, glib_ok=no)
102 AC_MSG_RESULT($glib_ok)
103 if test $glib_ok = no; then
104 AC_DEFINE(NO_SYS_SIGLIST)
107 # Check for sys/select.h
109 AC_MSG_CHECKING([fd_set and sys/select])
110 AC_TRY_COMPILE([#include <sys/types.h>],
111 [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
112 if test $gtk_ok = no; then
113 AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
114 if test $gtk_ok = yes; then
115 AC_DEFINE(HAVE_SYS_SELECT_H)
118 AC_MSG_RESULT($gtk_ok)
119 if test $gtk_ok = no; then
123 # This stuff is here, only so that we can define these
124 # things in glibconfig.h. If ../config.h was installed
125 # (under some other name?) then the definitions would
126 # belong there. (They are only used in GDK)
130 AC_MSG_CHECKING(for wchar.h)
131 AC_TRY_CPP([#include <wchar.h>], gtk_ok=yes, gtk_ok=no)
132 if test $gtk_ok = yes; then
133 AC_DEFINE(HAVE_WCHAR_H)
135 AC_MSG_RESULT($gtk_ok)
137 # Check for wctype.h (for iswalnum)
139 AC_MSG_CHECKING(for wctype.h)
140 AC_TRY_CPP([#include <wctype.h>], gtk_ok=yes, gtk_ok=no)
141 if test $gtk_ok = yes; then
142 AC_DEFINE(HAVE_WCTYPE_H)
144 AC_MSG_RESULT($gtk_ok)
146 # The following is necessary for Linux libc-5.4.38
148 AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
149 AC_TRY_LINK([#include <stdlib.h>],[
150 #if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
151 # ifdef HAVE_WCTYPE_H
159 # define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
161 iswalnum((wchar_t) 0);
162 ], gtk_ok=yes, gtk_ok=no)
164 if test $gtk_ok = no; then
165 AC_DEFINE(HAVE_BROKEN_WCTYPE)
167 AC_MSG_RESULT($gtk_ok)