]> Pileus Git - ~andy/gtk/blob - glib/configure.in
33be108b5dc99e145ceba736ddf2125aa0337a37
[~andy/gtk] / glib / configure.in
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(glist.c)
3
4 # Save this value here, since automake will set cflags later
5 cflags_set=${CFLAGS+set}
6
7 dnl Initialize automake stuff
8 AM_INIT_AUTOMAKE(glib, 0.99.10)
9
10 # Specify a configuration file
11 AM_CONFIG_HEADER(glibconfig.h)
12
13 dnl Initialize libtool
14 AM_PROG_LIBTOOL
15
16 dnl Initialize maintainer mode
17 AM_MAINTAINER_MODE
18
19 AC_CANONICAL_HOST
20
21 AC_ARG_ENABLE(debug, [  --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],,enable_debug=minimum)
22
23 AC_ARG_ENABLE(ansi, [  --enable-ansi           turn on strict ansi [default=no]],
24                     , enable_ansi=no)
25
26 if test "x$enable_debug" = "xyes"; then
27   test "$cflags_set" = set || CFLAGS="-g"
28   CFLAGS="$CFLAGS -DG_ENABLE_DEBUG"
29 else
30   if test "x$enable_debug" = "xno"; then
31     CFLAGS="$CFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
32   fi
33 fi
34
35 AC_DEFINE_UNQUOTED(G_COMPILED_WITH_DEBUGGING, "${enable_debug}")
36
37 # Checks for programs.
38 AC_PROG_CC
39 AM_PROG_CC_STDC
40 AC_PROG_INSTALL
41
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"
45   fi
46
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"
50     fi
51
52     if eval test -z \"`echo "$CFLAGS" | grep "\-pedantic" 2> /dev/null`\" ; then
53       CFLAGS="$CFLAGS -pedantic"
54     fi
55   fi
56 fi
57
58 # Checks for header files.
59 AC_HEADER_STDC
60
61 # Checks for library functions.
62 AC_FUNC_VPRINTF
63
64 AC_CHECK_FUNCS(atexit on_exit)
65
66 AC_CHECK_SIZEOF(char)
67 AC_CHECK_SIZEOF(short)
68 AC_CHECK_SIZEOF(long)
69 AC_CHECK_SIZEOF(int)
70 AC_CHECK_SIZEOF(void *)
71
72 # long doubles were not used, and a portability problem 
73 # AC_C_LONG_DOUBLE
74 AC_C_CONST
75 AC_C_INLINE
76
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))
80
81 # Check for strerror, strsignal, memmove, vsnprintf, and strcasecmp functions
82 AC_CHECK_FUNCS(strerror strsignal memmove vsnprintf strcasecmp)
83
84 # Check for sys_errlist
85 AC_MSG_CHECKING(sys_errlist)
86 AC_TRY_LINK(, [
87 extern char *sys_errlist[];
88 extern int sys_nerr;
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)
94 fi
95
96 # Check for sys_siglist
97 AC_MSG_CHECKING(sys_siglist)
98 AC_TRY_LINK(, [
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)
105 fi
106
107 # Check for sys/select.h
108
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)
116     fi
117 fi
118 AC_MSG_RESULT($gtk_ok)
119 if test $gtk_ok = no; then
120     AC_DEFINE(NO_FD_SET)
121 fi
122
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)
127
128 # Check for wchar.h
129
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)
134 fi
135 AC_MSG_RESULT($gtk_ok)
136
137 # Check for wctype.h (for iswalnum)
138
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)
143 fi
144 AC_MSG_RESULT($gtk_ok)
145
146 # The following is necessary for Linux libc-5.4.38
147
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
152 #    include <wctype.h>
153 #  else
154 #    ifdef HAVE_WCHAR_H
155 #      include <wchar.h>
156 #    endif
157 #  endif
158 #else
159 #  define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
160 #endif
161 iswalnum((wchar_t) 0);
162 ], gtk_ok=yes, gtk_ok=no)
163
164 if test $gtk_ok = no; then
165    AC_DEFINE(HAVE_BROKEN_WCTYPE)
166 fi
167 AC_MSG_RESULT($gtk_ok)
168
169 AC_OUTPUT(Makefile)