source: trunk/third/sawfish/configure.in @ 18414

Revision 18414, 10.3 KB checked in by ghudson, 22 years ago (diff)
Merge with sawfish 1.2-gtk2.
Line 
1dnl  Process this file with autoconf to produce a configure script.
2dnl  Copyright (C) 1998 John Harper <john@dcs.warwick.ac.uk>
3dnl  $Id: configure.in,v 1.4 2003-01-05 00:48:00 ghudson Exp $
4dnl
5dnl  This file is part of sawmill.
6dnl
7dnl  sawmill is free software; you can redistribute it and/or modify it
8dnl  under the terms of the GNU General Public License as published by
9dnl  the Free Software Foundation; either version 2, or (at your option)
10dnl  any later version.
11dnl
12dnl  sawmill is distributed in the hope that it will be useful, but
13dnl  WITHOUT ANY WARRANTY; without even the implied warranty of
14dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15dnl  GNU General Public License for more details.
16dnl
17dnl  You should have received a copy of the GNU General Public License
18dnl  along with sawmill; see the file COPYING.  If not, write to
19dnl  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20
21AC_REVISION($Revision: 1.4 $)
22
23AC_INIT(src/sawmill.h)
24AC_CONFIG_HEADER(config.h)
25AC_CONFIG_AUX_DIR(etc)
26
27dnl Release versioning info
28version="1.2"
29subversion="-gtk2"
30
31output_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
35SUBDIRS="src lisp scripts themes sounds man po"
36AC_SUBST(SUBDIRS)
37
38add_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
48dnl Find the system type
49AC_CANONICAL_HOST
50
51dnl Remove trailing slash in $prefix if necessary
52case "${prefix}" in
53  */)
54    prefix=`echo ${prefix} | sed -e 's/^\(.*\)\/$/\1/'`
55    ;;
56esac
57
58sawfishdir='${datadir}/sawfish'
59lispdir='${sawfishdir}/${version}/lisp'
60localedir='${datadir}/locale'
61sawfishexecdir='${libexecdir}/sawfish/${version}/${host_type}'
62
63dnl Checks for programs.
64AC_PROG_CC
65AC_PROG_CPP
66AC_PROG_INSTALL
67AC_PROG_LN_S
68AC_PROG_MAKE_SET
69AC_PROG_GCC_TRADITIONAL
70
71dnl Workaround etc/install-sh not being found from subdirectories
72if test "$INSTALL" = "$ac_install_sh"; then
73  dnl Why is the backslash needed?
74  INSTALL='\${top_srcdir}/etc/install-sh -c'
75fi
76
77dnl Checks for libraries.
78AC_CHECK_LIB(nsl, xdr_void)
79AC_CHECK_LIB(socket, bind)
80
81dnl Checks for header files.
82AC_PATH_XTRA
83AC_HEADER_STDC
84AC_HEADER_TIME
85AC_HEADER_SYS_WAIT
86AC_CHECK_HEADERS(fcntl.h sys/time.h sys/utsname.h unistd.h memory.h)
87
88dnl Check for X headers, etc
89_cppflags="${CPPFLAGS}"
90CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
91
92AC_CHECK_HEADERS(X11/SM/SMlib.h X11/extensions/Xdbe.h)
93
94dnl Checks for X extensions/libraries
95XINERAMA_LIBS=""
96XFT_LIBS=""
97XFT_CFLAGS=""
98
99AC_SUBST(XINERAMA_LIBS)
100AC_SUBST(XFT_LIBS)
101AC_SUBST(XFT_CFLAGS)
102
103AC_CHECK_LIB(Xinerama, XineramaQueryScreens,
104             [XINERAMA_LIBS="-lXinerama"
105              AC_CHECK_HEADERS(X11/extensions/Xinerama.h)],
106             [],[$X_LIBS -lX11 -lXext])
107
108dnl Try using pkg-config first, since it looks like Xft2 may fail our
109dnl hand-crafted tests
110PKG_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
120CPPFLAGS="${_cppflags}"
121
122dnl Check for librep
123AM_PATH_REP(0.14)
124
125rep_gtk_function=gtk-widget-set-size-request
126rep_gtk_version=0.17
127
128AC_MSG_CHECKING([for rep-gtk >= $rep_gtk_version])
129cat >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)))
137EOF
138if REP_GTK_DONT_INITIALIZE=1 rep ./conftest 2>&5; then
139  AC_MSG_RESULT([yes])
140else
141  AC_MSG_RESULT([no])
142  AC_MSG_ERROR([You need rep-gtk version ${rep_gtk_version}+])
143fi
144rm -f conftest
145
146dnl is X available?
147if test "${no_x}" != "yes"; then
148  AC_DEFINE(HAVE_X11)
149else
150  AC_MSG_ERROR([You need X11 for sawfish])
151fi
152
153dnl Check for image handling libraries
154AC_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])
158if 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
177fi
178if 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
200fi
201AC_SUBST(IMAGE_LIBS)
202AC_SUBST(IMAGE_CFLAGS)
203
204AM_PATH_GTK_2_0(1.3.12)
205
206AC_ARG_WITH(audiofile,
207 [  --with-audiofile      Use libaudiofile for sound manipulation
208  --without-audiofile], [], [with_audiofile=yes])
209if 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)
214fi
215
216AC_ARG_WITH(esd,
217 [  --with-esd            Use the Enlightened Sound Daemon
218  --without-esd], [], [with_esd=yes])
219if 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)
224fi
225
226AC_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
231if test "$enable_capplet" = "yes"; then
232  add_subdir "capplet"
233fi
234
235AC_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
240if 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
250fi
251
252AC_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
257if 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
267else
268  REP_GTK_GNOME=no
269fi
270AC_SUBST(REP_GTK_GNOME)
271
272dnl Check for Doug Lea's malloc in libc
273doug_lea_malloc=yes
274AC_CHECK_FUNC(malloc_get_state, , doug_lea_malloc=no)
275AC_CHECK_FUNC(malloc_set_state, , doug_lea_malloc=no)
276if 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)
281else
282  AC_DEFINE(DOUG_LEA_MALLOC)
283  AC_DEFINE(LIBC_MALLOC)
284fi
285
286dnl Check for GNOME location
287AC_ARG_WITH(gnome_prefix,
288 [  --with-gnome-prefix=DIR Root of GNOME installation], [],
289 [ with_gnome_prefix="" ])
290AC_MSG_CHECKING([for GNOME prefix])
291if test "x$with_gnome_prefix" = "x"; then
292  with_gnome_prefix='${prefix}'
293fi
294AC_MSG_RESULT([$with_gnome_prefix])
295GNOMEDIR=$with_gnome_prefix
296AC_SUBST(GNOMEDIR)
297
298dnl Checks for typedefs, structures, and compiler characteristics.
299AC_C_CONST
300AC_C_INLINE
301AC_C_BIGENDIAN
302AC_TYPE_SIZE_T
303
304dnl Checks for library functions.
305AC_FUNC_ALLOCA
306AC_FUNC_VPRINTF
307AC_CHECK_FUNCS(gethostname socket snprintf getpagesize)
308
309dnl Custom tests
310
311dnl How do we get dependency lines in the Makefile?
312if test "x${GCC}" = "xyes"; then
313  MAKEDEP='$(CC) -MM'
314else
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
329fi
330AC_SUBST(MAKEDEP)
331
332dnl If using GCC and it doesn't look as though the cflags have been
333dnl set explicitly, add some warning options. Turn off implicit-int
334dnl warnings since the X11 includes on Solaris generate a lot of these
335if test "x${GCC}" = "xyes" -a "x$CFLAGS" = "x-g -O2"; then
336  CFLAGS="${CFLAGS} -Wall -Wmissing-prototypes -Wno-implicit-int"
337fi
338
339AC_MSG_CHECKING(for languages to install)
340AC_ARG_ENABLE(linguas,
341  [  --enable-linguas=LANGS... Install language catalogs for language codes LANGS],
342  [ LINGUAS="$enableval" ], [ LINGUAS="" ])
343if test "x$LINGUAS" = x; then
344  changequote({,})
345  LINGUAS="`echo $srcdir/po/*.po | sed -e 's/[^ ]*\/po\/\([^ ]*\)\.po/\1/g'`"
346  changequote([,])
347fi
348dnl too gross for words..
349if test $REP_MSGFMT = true; then
350  LINGUAS=""
351fi
352AC_MSG_RESULT($LINGUAS)
353AC_SUBST(LINGUAS)
354
355dnl Nonstandard exported symbols
356AC_SUBST(version)
357AC_SUBST(subversion)
358AC_SUBST(sawfishdir)
359AC_SUBST(sawfishexecdir)
360AC_SUBST(lispdir)
361AC_SUBST(localedir)
362AC_SUBST(HAVE_X11)
363AC_SUBST(CPPFLAGS)
364AC_SUBST(CFLAGS)
365AC_SUBST(LIBS)
366AC_SUBST(X_CFLAGS)
367AC_SUBST(X_LIBS)
368AC_SUBST(X_EXTRA_LIBS)
369AC_SUBST(IMLIB_CFLAGS)
370AC_SUBST(IMLIB_LIBS)
371
372dnl Build all files
373AC_OUTPUT(${output_files})
374
375dnl If it doesn't look like GNU Make is being used, give a friendly warning
376tem=`make --version -f /dev/null 2>&1 | grep GNU`
377if test "x$tem" = "x"; then
378  AC_MSG_WARN([You need to use GNU Make when compiling sawfish])
379fi
380
381dnl Local variables:
382dnl major-mode: sh-mode
383dnl End:
Note: See TracBrowser for help on using the repository browser.