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