]> Pileus Git - ~andy/gtk/blob - configure.in
changes for 1.0.0 release.
[~andy/gtk] / configure.in
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(gdk/gdktypes.h)
3
4 # Save this value here, since automake will set cflags later
5 cflags_set=${CFLAGS+set}
6
7 GTK_MAJOR_VERSION=1
8 GTK_MINOR_VERSION=0
9 GTK_MICRO_VERSION=0
10 GTK_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$GTK_MICRO_VERSION
11
12 # For automake.
13 VERSION=$GTK_VERSION
14 PACKAGE=gtk+
15
16 # Configure glib
17 AC_CONFIG_SUBDIRS(glib)
18
19 # Save this value here, since automake will set cflags later
20 cflags_set=${CFLAGS+set}
21
22 dnl Initialize automake stuff
23 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
24
25 # Specify a configuration file
26 AM_CONFIG_HEADER(config.h)
27
28 dnl Initialize libtool
29 AM_PROG_LIBTOOL
30
31 dnl Initialize maintainer mode
32 AM_MAINTAINER_MODE
33
34 AC_CANONICAL_HOST
35
36 AC_ARG_ENABLE(shm, [  --enable-shm            support shared memory if available [default=yes]],
37                    echo $enable_shm, enable_shm="yes")
38 AC_ARG_ENABLE(debug, [  --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],,enable_debug=minimum)
39 AC_ARG_ENABLE(ansi, [  --enable-ansi           turn on strict ansi [default=no]],
40                     , enable_ansi=no)
41 AC_ARG_ENABLE(xim, [  --enable-xim            support XIM [default=yes]],
42                         echo $enable_xim, enable_xim="yes")
43 AC_ARG_WITH(locale, [  --with-locale=LOCALE    locale name you want to use ])
44
45 AC_ARG_WITH(xinput, [  --with-xinput=[no/gxi/xfree] support XInput ])
46
47 if test "x$enable_debug" = "xyes"; then
48   test "$cflags_set" = set || CFLAGS="-g"
49   CFLAGS="$CFLAGS -DG_ENABLE_DEBUG"
50 else
51   if test "x$enable_debug" = "xno"; then
52     CFLAGS="$CFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DGTK_NO_CHECK_CASTS"
53   else
54     CFLAGS="$CFLAGS -DGTK_NO_CHECK_CASTS"
55   fi
56 fi
57
58 # Build time sanity check...
59 AM_SANITY_CHECK
60
61 # Checks for programs.
62 AC_PROG_CC
63 AM_PROG_CC_STDC
64 AC_PROG_INSTALL
65 AC_PROG_MAKE_SET
66
67 if test "x$GCC" = "xyes"; then
68   if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
69     CFLAGS="$CFLAGS -Wall"
70   fi
71
72   if test "x$enable_ansi" = "xyes"; then
73     if test -z "`echo "$CFLAGS" | grep "\-ansi" 2> /dev/null`" ; then
74       CFLAGS="$CFLAGS -ansi"
75     fi
76
77     if test -z "`echo "$CFLAGS" | grep "\-pedantic" 2> /dev/null`" ; then
78       CFLAGS="$CFLAGS -pedantic"
79     fi
80   fi
81 fi
82
83 if test "x$enable_xim" = "xyes"; then
84   CFLAGS="$CFLAGS -DUSE_XIM"
85 fi
86
87 AC_DEFINE_UNQUOTED(GTK_MAJOR_VERSION, $GTK_MAJOR_VERSION)
88 AC_DEFINE_UNQUOTED(GTK_MINOR_VERSION, $GTK_MINOR_VERSION)
89 AC_DEFINE_UNQUOTED(GTK_MICRO_VERSION, $GTK_MICRO_VERSION)
90 AC_DEFINE_UNQUOTED(GTK_VERSION, "$GTK_VERSION")
91
92 # Find the X11 include and library directories
93 AC_PATH_X
94 AC_PATH_XTRA
95
96 if test "x$x_includes" = "x"; then
97   x_includes="/usr/include"
98 fi
99
100 saved_cflags="$CFLAGS"
101 saved_ldflags="$LDFLAGS"
102
103 CFLAGS="$X_CFLAGS"
104 LDFLAGS="$X_LDFLAGS $X_LIBS"
105
106 # Checks for libraries.
107 # Check for the X11 library
108 AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", no_x11_lib=yes, $X_EXTRA_LIBS)
109
110 if test "x$enable_shm" = "xyes"; then
111   # Check for the Xext library (needed for XShm extention)
112   AC_CHECK_LIB(Xext, XShmAttach, 
113       x_libs="-lXext $x_libs", 
114       # On AIX, it is in XextSam instead, but we still need -lXext
115       AC_CHECK_LIB(XextSam, XShmAttach, 
116           x_libs="-lXextSam -lXext $x_libs", 
117           no_xext_lib=yes, $x_libs),
118       $x_libs)
119 fi
120
121 x_cflags="$X_CFLAGS"
122 x_ldflags="$X_LDFLAGS $X_LIBS"
123
124 # set up things for XInput
125
126 if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
127   AC_DEFINE(XINPUT_GXI)
128   xinput_progs=gxid
129   x_libs="-lXi $x_libs"
130 elif test "x$with_xinput" = "xxfree"; then
131   AC_DEFINE(XINPUT_XFREE)
132   x_libs="-lXi $x_libs"
133 else
134   AC_DEFINE(XINPUT_NONE)
135 fi
136
137 AC_SUBST(x_cflags)
138 AC_SUBST(x_includes)
139 AC_SUBST(x_ldflags)
140 AC_SUBST(x_libs)
141 AC_SUBST(xinput_progs)
142 AC_SUBST(GTK_VERSION)
143
144 CFLAGS="$saved_cflags"
145 LDFLAGS="$saved_ldflags"
146
147 if test "x$enable_shm" = "xyes"; then
148   # Check for shared memory
149   AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
150   AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
151
152   # Check whether shmctl IPC_RMID allowes subsequent attaches
153   if test "$ac_cv_header_sys_shm_h" = "yes"; then
154     AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
155     AC_TRY_RUN([
156           #include <sys/types.h>
157           #include <sys/ipc.h>
158           #include <sys/shm.h>
159           int main()
160           {
161             int id;
162             char *shmaddr;
163           id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0777);
164           if (id == -1)
165             exit (2);
166             shmaddr = shmat (id, 0, 0);
167             shmctl (id, IPC_RMID, 0);
168             if ((char*) shmat (id, 0, 0) == (char*) -1)
169             {
170               shmdt (shmaddr);
171               exit (1);
172             }
173             shmdt (shmaddr);
174             shmdt (shmaddr);
175             exit (0);
176           }
177       ],
178       AC_DEFINE(IPC_RMID_DEFERRED_RELEASE)
179         AC_MSG_RESULT(yes),
180       AC_MSG_RESULT(no),
181       AC_MSG_RESULT(assuming no))
182   fi
183
184   # Check for the X shared memory extension header file
185   AC_MSG_CHECKING(X11/extensions/XShm.h)
186   if test "x$no_xext_lib" = "xyes"; then
187     AC_MSG_RESULT(no)
188     no_xshm=yes
189   else
190     if test -f "$x_includes/X11/extensions/XShm.h"; then
191       AC_MSG_RESULT(yes)
192       AC_DEFINE(HAVE_XSHM_H)
193     else
194       AC_MSG_RESULT(no)
195       no_xshm=yes
196     fi
197   fi
198 fi
199
200 # Check for private display resource base variable
201 AC_MSG_CHECKING(resource base field in XDisplay)
202 AC_CACHE_VAL(gtk_cv_display_resource_base,
203 [AC_TRY_RUN([
204 #define XLIB_ILLEGAL_ACCESS
205 #include <X11/Xlib.h>
206
207 int
208 main ()
209 {
210   Display *display;
211
212   return 0;
213
214   display->resource_base;
215 }],
216 gtk_cv_display_resource_base="resource_base",
217 gtk_cv_display_resource_base="private3")])
218 AC_MSG_RESULT($gtk_cv_display_resource_base)
219 AC_DEFINE_UNQUOTED(RESOURCE_BASE, gdk_display->$gtk_cv_display_resource_base)
220
221 # Check if X_LOCALE definition is necessary
222
223 AC_MSG_CHECKING(need -DX_LOCALE)
224
225 AC_TRY_RUN([
226 #include <stdio.h>
227 #include <locale.h>
228
229 int
230 main ()
231 {
232   return setlocale (LC_ALL, "${with_locale}") == NULL;
233 }],
234 need_x_locale=no,
235 need_x_locale=yes)
236 AC_MSG_RESULT($need_x_locale)
237
238 if test $need_x_locale = yes; then
239   CFLAGS="$CFLAGS -DX_LOCALE"
240 fi
241
242 # Checks for header files.
243 AC_HEADER_STDC
244
245 # Checks for typedefs, structures, and compiler characteristics.
246 AC_C_CONST
247
248 # Checks for library functions.
249 AC_TYPE_SIGNAL
250 AC_FUNC_MMAP
251
252 # Check for sys/select.h
253
254 AC_MSG_CHECKING([fd_set and sys/select])
255 AC_TRY_COMPILE([#include <sys/types.h>],
256         [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
257 if test $gtk_ok = no; then
258     AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
259     if test $gtk_ok = yes; then
260         AC_DEFINE(HAVE_SYS_SELECT_H)
261     fi
262 fi
263 AC_MSG_RESULT($gtk_ok)
264 if test $gtk_ok = no; then
265     AC_DEFINE(NO_FD_SET)
266 fi
267
268 AC_OUTPUT([Makefile gtk-config docs/Makefile gdk/Makefile gtk/Makefile],
269           [chmod +x gtk-config])