]> Pileus Git - ~andy/gtk/blob - configure.in
Initial revision
[~andy/gtk] / configure.in
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(gdk/gdktypes.h)
3
4 # Configure glib
5 AC_CONFIG_SUBDIRS(glib)
6
7 dnl Initialize automake stuff
8 AM_INIT_AUTOMAKE(gtk+, 971109)
9
10 # Specify a configuration file
11 AM_CONFIG_HEADER(config.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(shm, [  --enable-shm            support shared memory if available [default=yes]],
22                    echo $enable_shm, enable_shm="yes")
23 AC_ARG_ENABLE(debug, [  --enable-debug          turn on debugging [default=no]],
24 if eval "test x$enable_debug = xyes"; then
25   DEBUGFLAG="-g"
26 fi)
27 AC_ARG_ENABLE(ansi, [  --enable-ansi           turn on strict ansi [default=no]],
28                     , enable_ansi=no)
29
30 AC_ARG_WITH(xinput, [  --with-xinput[=no/gxi/xfree] support XInput ])
31
32 if test -n "$DEBUGFLAG"; then
33   CFLAGS="$DEBUGFLAG"
34 else
35   CFLAGS="$CFLAGS -DNDEBUG"
36 fi
37
38 # Build time sanity check...
39 AM_SANITY_CHECK
40
41 # Checks for programs.
42 AC_PROG_CC
43 AM_PROG_CC_STDC
44 AC_PROG_INSTALL
45 AC_PROG_MAKE_SET
46
47 if eval "test x$GCC = xyes"; then
48   test `echo "$CFLAGS" | grep "\-Wall" > /dev/null 2> /dev/null`
49   if test ! $?; then
50     CFLAGS="$CFLAGS -Wall"
51   fi
52
53   if eval "test x$enable_ansi = xyes"; then
54     test `echo "$CFLAGS" | grep "\-ansi" > /dev/null 2> /dev/null`
55     if test ! $?; then
56       CFLAGS="$CFLAGS -ansi"
57     fi
58
59     test `echo "$CFLAGS" | grep "\-pedantic" > /dev/null 2> /dev/null`
60     if test ! $?; then
61       CFLAGS="$CFLAGS -pedantic"
62     fi
63   fi
64 fi
65
66 # Find the X11 include and library directories
67 AC_PATH_X
68 AC_PATH_XTRA
69
70 if test "x$x_includes" = "x"; then
71   x_includes="/usr/include"
72 fi
73
74 saved_cflags="$CFLAGS"
75 saved_ldflags="$LDFLAGS"
76
77 CFLAGS="$X_CFLAGS"
78 LDFLAGS="$X_LDFLAGS $X_LIBS"
79
80 # Checks for libraries.
81 # Check for the X11 library
82 AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", no_x11_lib=yes, $X_EXTRA_LIBS)
83
84 if eval "test x$enable_shm = xyes"; then
85   # Check for the Xext library (needed for XShm extention)
86   AC_CHECK_LIB(Xext, XShmAttach, x_libs="-lXext $x_libs", no_xext_lib=yes, $x_libs)
87 fi
88
89 x_cflags="$X_CFLAGS"
90 x_ldflags="$X_LDFLAGS $X_LIBS"
91
92 # set up things for XInput
93
94 if eval "test x$with_xinput = xgxi -o x$with_xinput = xyes"; then
95   AC_DEFINE(XINPUT_GXI)
96   xinput_progs=gxid
97   x_libs="-lXi $x_libs"
98 elif eval "test x$with_xinput = xxfree"; then
99   AC_DEFINE(XINPUT_XFREE)
100   x_libs="-lXi $x_libs"
101 else
102   AC_DEFINE(XINPUT_NONE)
103 fi
104
105
106 AC_SUBST(x_cflags)
107 AC_SUBST(x_includes)
108 AC_SUBST(x_ldflags)
109 AC_SUBST(x_libs)
110 AC_SUBST(xinput_progs)
111
112 CFLAGS="$saved_cflags"
113 LDFLAGS="$saved_ldflags"
114
115 if eval "test x$enable_shm = xyes"; then
116   # Check for shared memory
117   AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
118   AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
119
120   # Check whether shmctl IPC_RMID allowes subsequent attaches
121   if test "$ac_cv_header_sys_shm_h" = "yes"; then
122     AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
123     AC_TRY_RUN([
124           #include <sys/types.h>
125           #include <sys/ipc.h>
126           #include <sys/shm.h>
127           int main()
128           {
129             int id;
130             char *shmaddr;
131           id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0777);
132           if (id == -1)
133             exit (2);
134             shmaddr = shmat (id, 0, 0);
135             shmctl (id, IPC_RMID, 0);
136             if ((char*) shmat (id, 0, 0) == (char*) -1)
137             {
138               shmdt (shmaddr);
139               exit (1);
140             }
141             shmdt (shmaddr);
142             shmdt (shmaddr);
143             exit (0);
144           }
145       ],
146       AC_DEFINE(IPC_RMID_DEFERRED_RELEASE)
147         AC_MSG_RESULT(yes),
148       AC_MSG_RESULT(no),
149       AC_MSG_RESULT(assuming no))
150   fi
151
152   # Check for the X shared memory extension header file
153   AC_MSG_CHECKING(X11/extensions/XShm.h)
154   if eval "test x$no_ext_lib = xyes"; then
155     AC_MSG_RESULT(no)
156     no_xshm=yes
157   else
158     if eval "test -f $x_includes/X11/extensions/XShm.h"; then
159       AC_MSG_RESULT(yes)
160       AC_DEFINE(HAVE_XSHM_H)
161     else
162       AC_MSG_RESULT(no)
163       no_xshm=yes
164     fi
165   fi
166 fi
167
168 # Check for private display resource base variable
169 AC_MSG_CHECKING(resource base field in XDisplay)
170 AC_CACHE_VAL(gtk_cv_display_resource_base,
171 [AC_TRY_RUN([
172 #define XLIB_ILLEGAL_ACCESS
173 #include <X11/Xlib.h>
174
175 int
176 main ()
177 {
178   Display *display;
179
180   return 0;
181
182   display->resource_base;
183 }],
184 gtk_cv_display_resource_base="resource_base",
185 gtk_cv_display_resource_base="private3")])
186 AC_MSG_RESULT($gtk_cv_display_resource_base)
187 AC_DEFINE_UNQUOTED(RESOURCE_BASE, gdk_display->$gtk_cv_display_resource_base)
188
189 # Checks for header files.
190 AC_HEADER_STDC
191
192 # Checks for typedefs, structures, and compiler characteristics.
193 AC_C_CONST
194
195 # Checks for library functions.
196 AC_TYPE_SIGNAL
197
198 # Check for sys/select.h
199
200 AC_MSG_CHECKING([fd_set and sys/select])
201 AC_TRY_COMPILE([#include <sys/types.h>],
202         [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
203 if test $gtk_ok = no; then
204     AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
205     if test $gtk_ok = yes; then
206         AC_DEFINE(HAVE_SYS_SELECT_H)
207     fi
208 fi
209 AC_MSG_RESULT($gtk_ok)
210 if test $gtk_ok = no; then
211     AC_DEFINE(NO_FD_SET)
212 fi
213
214 AC_OUTPUT(Makefile gtk+.xconfig docs/Makefile gdk/Makefile gtk/Makefile)