1 | dnl Process this file with autoconf to produce a configure script. |
---|
2 | dnl Copyright (C) 1998 John Harper <john@dcs.warwick.ac.uk> |
---|
3 | dnl $Id: configure.in,v 1.4 2003-01-05 00:48:00 ghudson Exp $ |
---|
4 | dnl |
---|
5 | dnl This file is part of sawmill. |
---|
6 | dnl |
---|
7 | dnl sawmill is free software; you can redistribute it and/or modify it |
---|
8 | dnl under the terms of the GNU General Public License as published by |
---|
9 | dnl the Free Software Foundation; either version 2, or (at your option) |
---|
10 | dnl any later version. |
---|
11 | dnl |
---|
12 | dnl sawmill is distributed in the hope that it will be useful, but |
---|
13 | dnl WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | dnl GNU General Public License for more details. |
---|
16 | dnl |
---|
17 | dnl You should have received a copy of the GNU General Public License |
---|
18 | dnl along with sawmill; see the file COPYING. If not, write to |
---|
19 | dnl the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
20 | |
---|
21 | AC_REVISION($Revision: 1.4 $) |
---|
22 | |
---|
23 | AC_INIT(src/sawmill.h) |
---|
24 | AC_CONFIG_HEADER(config.h) |
---|
25 | AC_CONFIG_AUX_DIR(etc) |
---|
26 | |
---|
27 | dnl Release versioning info |
---|
28 | version="1.2" |
---|
29 | subversion="-gtk2" |
---|
30 | |
---|
31 | output_files="src/Makefile lisp/Makefile scripts/Makefile themes/Makefile\ |
---|
32 | lisp/sawfish/ui/Makefile lisp/sawfish/gtk/Makefile sounds/Makefile\ |
---|
33 | man/Makefile po/Makefile Makedefs Makefile sawfish.spec" |
---|
34 | |
---|
35 | SUBDIRS="src lisp scripts themes sounds man po" |
---|
36 | AC_SUBST(SUBDIRS) |
---|
37 | |
---|
38 | add_subdir () { |
---|
39 | sub=$1; shift |
---|
40 | SUBDIRS="$SUBDIRS $sub" |
---|
41 | output_files="$output_files $sub/Makefile" |
---|
42 | for ext in $*; do |
---|
43 | output_files="$output_files $sub/$ext" |
---|
44 | done |
---|
45 | unset sub |
---|
46 | } |
---|
47 | |
---|
48 | dnl Find the system type |
---|
49 | AC_CANONICAL_HOST |
---|
50 | |
---|
51 | dnl Remove trailing slash in $prefix if necessary |
---|
52 | case "${prefix}" in |
---|
53 | */) |
---|
54 | prefix=`echo ${prefix} | sed -e 's/^\(.*\)\/$/\1/'` |
---|
55 | ;; |
---|
56 | esac |
---|
57 | |
---|
58 | sawfishdir='${datadir}/sawfish' |
---|
59 | lispdir='${sawfishdir}/${version}/lisp' |
---|
60 | localedir='${datadir}/locale' |
---|
61 | sawfishexecdir='${libexecdir}/sawfish/${version}/${host_type}' |
---|
62 | |
---|
63 | dnl Checks for programs. |
---|
64 | AC_PROG_CC |
---|
65 | AC_PROG_CPP |
---|
66 | AC_PROG_INSTALL |
---|
67 | AC_PROG_LN_S |
---|
68 | AC_PROG_MAKE_SET |
---|
69 | AC_PROG_GCC_TRADITIONAL |
---|
70 | |
---|
71 | dnl Workaround etc/install-sh not being found from subdirectories |
---|
72 | if test "$INSTALL" = "$ac_install_sh"; then |
---|
73 | dnl Why is the backslash needed? |
---|
74 | INSTALL='\${top_srcdir}/etc/install-sh -c' |
---|
75 | fi |
---|
76 | |
---|
77 | dnl Checks for libraries. |
---|
78 | AC_CHECK_LIB(nsl, xdr_void) |
---|
79 | AC_CHECK_LIB(socket, bind) |
---|
80 | |
---|
81 | dnl Checks for header files. |
---|
82 | AC_PATH_XTRA |
---|
83 | AC_HEADER_STDC |
---|
84 | AC_HEADER_TIME |
---|
85 | AC_HEADER_SYS_WAIT |
---|
86 | AC_CHECK_HEADERS(fcntl.h sys/time.h sys/utsname.h unistd.h memory.h) |
---|
87 | |
---|
88 | dnl Check for X headers, etc |
---|
89 | _cppflags="${CPPFLAGS}" |
---|
90 | CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}" |
---|
91 | |
---|
92 | AC_CHECK_HEADERS(X11/SM/SMlib.h X11/extensions/Xdbe.h) |
---|
93 | |
---|
94 | dnl Checks for X extensions/libraries |
---|
95 | XINERAMA_LIBS="" |
---|
96 | XFT_LIBS="" |
---|
97 | XFT_CFLAGS="" |
---|
98 | |
---|
99 | AC_SUBST(XINERAMA_LIBS) |
---|
100 | AC_SUBST(XFT_LIBS) |
---|
101 | AC_SUBST(XFT_CFLAGS) |
---|
102 | |
---|
103 | AC_CHECK_LIB(Xinerama, XineramaQueryScreens, |
---|
104 | [XINERAMA_LIBS="-lXinerama" |
---|
105 | AC_CHECK_HEADERS(X11/extensions/Xinerama.h)], |
---|
106 | [],[$X_LIBS -lX11 -lXext]) |
---|
107 | |
---|
108 | dnl Try using pkg-config first, since it looks like Xft2 may fail our |
---|
109 | dnl hand-crafted tests |
---|
110 | PKG_CHECK_MODULES(XFT, xft >= 1.0, |
---|
111 | [_cppflags=$CPPFLAGS |
---|
112 | CPPFLAGS="$CPPFLAGS $XFT_CFLAGS" |
---|
113 | AC_CHECK_HEADERS(X11/Xft/Xft.h) |
---|
114 | CPPFLAGS=$_cppflags], |
---|
115 | [AC_CHECK_LIB(Xft, XftDrawCreate, |
---|
116 | [XFT_LIBS="-lXft -lXrender" |
---|
117 | AC_CHECK_HEADERS(X11/Xft/Xft.h)], |
---|
118 | [], [$X_LIBS -lX11 -lXext])]) |
---|
119 | |
---|
120 | CPPFLAGS="${_cppflags}" |
---|
121 | |
---|
122 | dnl Check for librep |
---|
123 | AM_PATH_REP(0.14) |
---|
124 | |
---|
125 | rep_gtk_function=gtk-widget-set-size-request |
---|
126 | rep_gtk_version=0.17 |
---|
127 | |
---|
128 | AC_MSG_CHECKING([for rep-gtk >= $rep_gtk_version]) |
---|
129 | cat >conftest <<EOF |
---|
130 | (condition-case nil |
---|
131 | (progn |
---|
132 | (require 'gui.gtk-2.gtk) |
---|
133 | $rep_gtk_function |
---|
134 | (throw 'quit 0)) |
---|
135 | (error |
---|
136 | (throw 'quit 1))) |
---|
137 | EOF |
---|
138 | if REP_GTK_DONT_INITIALIZE=1 rep ./conftest 2>&5; then |
---|
139 | AC_MSG_RESULT([yes]) |
---|
140 | else |
---|
141 | AC_MSG_RESULT([no]) |
---|
142 | AC_MSG_ERROR([You need rep-gtk version ${rep_gtk_version}+]) |
---|
143 | fi |
---|
144 | rm -f conftest |
---|
145 | |
---|
146 | dnl is X available? |
---|
147 | if test "${no_x}" != "yes"; then |
---|
148 | AC_DEFINE(HAVE_X11) |
---|
149 | else |
---|
150 | AC_MSG_ERROR([You need X11 for sawfish]) |
---|
151 | fi |
---|
152 | |
---|
153 | dnl Check for image handling libraries |
---|
154 | AC_ARG_WITH(gdk-pixbuf, |
---|
155 | [ --with-gdk-pixbuf Use gdk-pixbuf for image management |
---|
156 | --without-gdk-pixbuf Use Imlib1 instead], [], |
---|
157 | [with_gdk_pixbuf=yes]) |
---|
158 | if test "$with_gdk_pixbuf" != "no"; then |
---|
159 | AC_MSG_CHECKING([for gdk_pixbuf (xlib version)]) |
---|
160 | PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-xlib-2.0 >= 1.3.12) |
---|
161 | GDK_PIXBUF_VERSION=`pkg-config --modversion gdk-pixbuf-xlib-2.0` |
---|
162 | AC_SUBST(GDK_PIXBUF_VERSION) |
---|
163 | AC_SUBST(GDK_PIXBUF_CFLAGS) |
---|
164 | AC_SUBST(GDK_PIXBUF_LIBS) |
---|
165 | AC_DEFINE(HAVE_GDK_PIXBUF,1) |
---|
166 | AC_DEFINE(NEED_PIXMAP_CACHE,1) |
---|
167 | IMAGE_LIBS='${GDK_PIXBUF_LIBS}' |
---|
168 | IMAGE_CFLAGS='${GDK_PIXBUF_CFLAGS}' |
---|
169 | with_gdk_pixbuf=yes |
---|
170 | else |
---|
171 | AC_MSG_RESULT(no) |
---|
172 | if test "$with_gdk_pixbuf" = "yes"; then |
---|
173 | AC_MSG_ERROR([can't locate gdk-pixbuf-xlib library]) |
---|
174 | else |
---|
175 | with_gdk_pixbuf=no |
---|
176 | fi |
---|
177 | fi |
---|
178 | if test "$with_gdk_pixbuf" = "no"; then |
---|
179 | AC_PATH_PROG(IMLIB_CONFIG, imlib-config, no) |
---|
180 | AC_MSG_CHECKING([for Imlib]) |
---|
181 | if test "$IMLIB_CONFIG" = "no"; then |
---|
182 | AC_MSG_RESULT([no]) |
---|
183 | AC_MSG_ERROR([can't find imlib-config]) |
---|
184 | else |
---|
185 | IMLIB_VERSION=`$IMLIB_CONFIG --version` |
---|
186 | dnl XXX do version check.. |
---|
187 | AC_MSG_RESULT([version $IMLIB_VERSION]) |
---|
188 | IMLIB_CFLAGS=`$IMLIB_CONFIG --cflags` |
---|
189 | IMLIB_LIBS=`$IMLIB_CONFIG --libs` |
---|
190 | if $IMLIB_CONFIG --libs | grep " -lpng" >/dev/null 2>&1; then true; else |
---|
191 | AC_MSG_ERROR([imlib must be built with support for png images]) |
---|
192 | fi |
---|
193 | AC_DEFINE(HAVE_IMLIB,1) |
---|
194 | IMAGE_LIBS='${IMLIB_LIBS}' |
---|
195 | IMAGE_CFLAGS='${IMLIB_CFLAGS}' |
---|
196 | AC_SUBST(IMLIB_VERSION) |
---|
197 | AC_SUBST(IMLIB_CFLAGS) |
---|
198 | AC_SUBST(IMLIB_LIBS) |
---|
199 | fi |
---|
200 | fi |
---|
201 | AC_SUBST(IMAGE_LIBS) |
---|
202 | AC_SUBST(IMAGE_CFLAGS) |
---|
203 | |
---|
204 | AM_PATH_GTK_2_0(1.3.12) |
---|
205 | |
---|
206 | AC_ARG_WITH(audiofile, |
---|
207 | [ --with-audiofile Use libaudiofile for sound manipulation |
---|
208 | --without-audiofile], [], [with_audiofile=yes]) |
---|
209 | if test "$with_audiofile" = "yes"; then |
---|
210 | PKG_CHECK_MODULES(AUDIOFILE, audiofile >= 0.2.3) |
---|
211 | AC_SUBST(AUDIOFILE_LIBS) |
---|
212 | AC_SUBST(AUDIOFILE_CFLAGS) |
---|
213 | AC_DEFINE(HAVE_LIBAUDIOFILE) |
---|
214 | fi |
---|
215 | |
---|
216 | AC_ARG_WITH(esd, |
---|
217 | [ --with-esd Use the Enlightened Sound Daemon |
---|
218 | --without-esd], [], [with_esd=yes]) |
---|
219 | if test "$with_esd" = "yes"; then |
---|
220 | PKG_CHECK_MODULES(ESD, esound >= 0.2.23) |
---|
221 | AC_SUBST(ESD_LIBS) |
---|
222 | AC_SUBST(ESD_CFLAGS) |
---|
223 | AC_DEFINE(HAVE_ESD) |
---|
224 | fi |
---|
225 | |
---|
226 | AC_ARG_ENABLE(capplet, |
---|
227 | [ --enable-capplet Build the sawfish GNOME capplet [default] |
---|
228 | --disable-capplet Don't built the capplet], [], |
---|
229 | [enable_capplet=yes]) |
---|
230 | |
---|
231 | if test "$enable_capplet" = "yes"; then |
---|
232 | add_subdir "capplet" |
---|
233 | fi |
---|
234 | |
---|
235 | AC_ARG_ENABLE(themer, |
---|
236 | [ --enable-themer Build the sawfish-themer program [default] |
---|
237 | --disable-themer Don't build the themer], [], |
---|
238 | [enable_themer=yes]) |
---|
239 | |
---|
240 | if test "$enable_themer" = yes; then |
---|
241 | dnl configure redirects &5 to config.log |
---|
242 | AC_MSG_CHECKING([for rep-gtk libglade wrapper]) |
---|
243 | if REP_GTK_DONT_INITIALIZE=1 rep --batch -l gui.gtk.libglade 2>&5; then |
---|
244 | AC_MSG_RESULT([yes]) |
---|
245 | add_subdir "themer" |
---|
246 | else |
---|
247 | AC_MSG_RESULT([no]) |
---|
248 | AC_MSG_WARN([Can't load rep's libglade wrapper, not building themer]) |
---|
249 | fi |
---|
250 | fi |
---|
251 | |
---|
252 | AC_ARG_ENABLE(gnome-widgets, |
---|
253 | [ --enable-gnome-widgets Use GNOME widgets in places [default] |
---|
254 | --disable-gnome-widgets Don't use GNOME widgets], [], |
---|
255 | [enable_gnome_widgets=no]) |
---|
256 | |
---|
257 | if test "$enable_gnome_widgets" != "no"; then |
---|
258 | AC_MSG_CHECKING([for rep-gtk GNOME wrappers]) |
---|
259 | if REP_GTK_DONT_INITIALIZE=1 rep --batch -l gui.gtk-2.gnome-ui 2>&5; then |
---|
260 | AC_MSG_RESULT([yes]) |
---|
261 | REP_GTK_GNOME=yes |
---|
262 | else |
---|
263 | AC_MSG_RESULT([no]) |
---|
264 | REP_GTK_GNOME=no |
---|
265 | AC_MSG_WARN([Can't load rep's gnome wrappers]) |
---|
266 | fi |
---|
267 | else |
---|
268 | REP_GTK_GNOME=no |
---|
269 | fi |
---|
270 | AC_SUBST(REP_GTK_GNOME) |
---|
271 | |
---|
272 | dnl Check for Doug Lea's malloc in libc |
---|
273 | doug_lea_malloc=yes |
---|
274 | AC_CHECK_FUNC(malloc_get_state, , doug_lea_malloc=no) |
---|
275 | AC_CHECK_FUNC(malloc_set_state, , doug_lea_malloc=no) |
---|
276 | if test "$doug_lea_malloc" = "no"; then |
---|
277 | dnl We used to compile our own version of dlmalloc on most |
---|
278 | dnl platforms that didn't have it in their libc. But the list |
---|
279 | dnl of exceptions was growing too long.. |
---|
280 | AC_DEFINE(LIBC_MALLOC) |
---|
281 | else |
---|
282 | AC_DEFINE(DOUG_LEA_MALLOC) |
---|
283 | AC_DEFINE(LIBC_MALLOC) |
---|
284 | fi |
---|
285 | |
---|
286 | dnl Check for GNOME location |
---|
287 | AC_ARG_WITH(gnome_prefix, |
---|
288 | [ --with-gnome-prefix=DIR Root of GNOME installation], [], |
---|
289 | [ with_gnome_prefix="" ]) |
---|
290 | AC_MSG_CHECKING([for GNOME prefix]) |
---|
291 | if test "x$with_gnome_prefix" = "x"; then |
---|
292 | with_gnome_prefix='${prefix}' |
---|
293 | fi |
---|
294 | AC_MSG_RESULT([$with_gnome_prefix]) |
---|
295 | GNOMEDIR=$with_gnome_prefix |
---|
296 | AC_SUBST(GNOMEDIR) |
---|
297 | |
---|
298 | dnl Checks for typedefs, structures, and compiler characteristics. |
---|
299 | AC_C_CONST |
---|
300 | AC_C_INLINE |
---|
301 | AC_C_BIGENDIAN |
---|
302 | AC_TYPE_SIZE_T |
---|
303 | |
---|
304 | dnl Checks for library functions. |
---|
305 | AC_FUNC_ALLOCA |
---|
306 | AC_FUNC_VPRINTF |
---|
307 | AC_CHECK_FUNCS(gethostname socket snprintf getpagesize) |
---|
308 | |
---|
309 | dnl Custom tests |
---|
310 | |
---|
311 | dnl How do we get dependency lines in the Makefile? |
---|
312 | if test "x${GCC}" = "xyes"; then |
---|
313 | MAKEDEP='$(CC) -MM' |
---|
314 | else |
---|
315 | case ${host} in |
---|
316 | *-dec-osf*) |
---|
317 | dnl works on Tru64 |
---|
318 | MAKEDEP='$(CC) -M' |
---|
319 | ;; |
---|
320 | *-sun-solaris*) |
---|
321 | dnl works on Solaris |
---|
322 | MAKEDEP='/usr/ccs/lib/cpp -M' |
---|
323 | ;; |
---|
324 | *) |
---|
325 | dnl disable dependences? |
---|
326 | MAKEDEP='true' |
---|
327 | ;; |
---|
328 | esac |
---|
329 | fi |
---|
330 | AC_SUBST(MAKEDEP) |
---|
331 | |
---|
332 | dnl If using GCC and it doesn't look as though the cflags have been |
---|
333 | dnl set explicitly, add some warning options. Turn off implicit-int |
---|
334 | dnl warnings since the X11 includes on Solaris generate a lot of these |
---|
335 | if test "x${GCC}" = "xyes" -a "x$CFLAGS" = "x-g -O2"; then |
---|
336 | CFLAGS="${CFLAGS} -Wall -Wmissing-prototypes -Wno-implicit-int" |
---|
337 | fi |
---|
338 | |
---|
339 | AC_MSG_CHECKING(for languages to install) |
---|
340 | AC_ARG_ENABLE(linguas, |
---|
341 | [ --enable-linguas=LANGS... Install language catalogs for language codes LANGS], |
---|
342 | [ LINGUAS="$enableval" ], [ LINGUAS="" ]) |
---|
343 | if test "x$LINGUAS" = x; then |
---|
344 | changequote({,}) |
---|
345 | LINGUAS="`echo $srcdir/po/*.po | sed -e 's/[^ ]*\/po\/\([^ ]*\)\.po/\1/g'`" |
---|
346 | changequote([,]) |
---|
347 | fi |
---|
348 | dnl too gross for words.. |
---|
349 | if test $REP_MSGFMT = true; then |
---|
350 | LINGUAS="" |
---|
351 | fi |
---|
352 | AC_MSG_RESULT($LINGUAS) |
---|
353 | AC_SUBST(LINGUAS) |
---|
354 | |
---|
355 | dnl Nonstandard exported symbols |
---|
356 | AC_SUBST(version) |
---|
357 | AC_SUBST(subversion) |
---|
358 | AC_SUBST(sawfishdir) |
---|
359 | AC_SUBST(sawfishexecdir) |
---|
360 | AC_SUBST(lispdir) |
---|
361 | AC_SUBST(localedir) |
---|
362 | AC_SUBST(HAVE_X11) |
---|
363 | AC_SUBST(CPPFLAGS) |
---|
364 | AC_SUBST(CFLAGS) |
---|
365 | AC_SUBST(LIBS) |
---|
366 | AC_SUBST(X_CFLAGS) |
---|
367 | AC_SUBST(X_LIBS) |
---|
368 | AC_SUBST(X_EXTRA_LIBS) |
---|
369 | AC_SUBST(IMLIB_CFLAGS) |
---|
370 | AC_SUBST(IMLIB_LIBS) |
---|
371 | |
---|
372 | dnl Build all files |
---|
373 | AC_OUTPUT(${output_files}) |
---|
374 | |
---|
375 | dnl If it doesn't look like GNU Make is being used, give a friendly warning |
---|
376 | tem=`make --version -f /dev/null 2>&1 | grep GNU` |
---|
377 | if test "x$tem" = "x"; then |
---|
378 | AC_MSG_WARN([You need to use GNU Make when compiling sawfish]) |
---|
379 | fi |
---|
380 | |
---|
381 | dnl Local variables: |
---|
382 | dnl major-mode: sh-mode |
---|
383 | dnl End: |
---|