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