dnl Process this file with autoconf to produce a configure script. dnl Copyright (C) 1998 John Harper dnl $Id: configure.in,v 1.134 2003/03/25 08:24:36 jsh Exp $ dnl dnl This file is part of sawmill. dnl dnl sawmill is free software; you can redistribute it and/or modify it dnl under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2, or (at your option) dnl any later version. dnl dnl sawmill is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with sawmill; see the file COPYING. If not, write to dnl the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. AC_REVISION($Revision: 1.134 $) AC_INIT(src/sawmill.h) AC_CONFIG_HEADER(config.h) AC_CONFIG_AUX_DIR(etc) dnl Release versioning info version="1.3" subversion="" output_files="src/Makefile lisp/Makefile scripts/Makefile themes/Makefile\ lisp/sawfish/ui/Makefile lisp/sawfish/gtk/Makefile sounds/Makefile\ man/Makefile po/Makefile Makedefs Makefile sawfish.spec" SUBDIRS="src lisp scripts themes sounds man po" AC_SUBST(SUBDIRS) add_subdir () { sub=$1; shift SUBDIRS="$SUBDIRS $sub" output_files="$output_files $sub/Makefile" for ext in $*; do output_files="$output_files $sub/$ext" done unset sub } dnl Find the system type AC_CANONICAL_HOST dnl Remove trailing slash in $prefix if necessary case "${prefix}" in */) prefix=`echo ${prefix} | sed -e 's/^\(.*\)\/$/\1/'` ;; esac sawfishdir='${datadir}/sawfish' lispdir='${sawfishdir}/${version}/lisp' localedir='${datadir}/locale' sawfishexecdir='${libexecdir}/sawfish/${version}/${host_type}' dnl Checks for programs. AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_GCC_TRADITIONAL dnl Workaround etc/install-sh not being found from subdirectories if test "$INSTALL" = "$ac_install_sh"; then dnl Why is the backslash needed? INSTALL='\${top_srcdir}/etc/install-sh -c' fi dnl Checks for libraries. AC_CHECK_LIB(nsl, xdr_void) AC_CHECK_LIB(socket, bind) dnl Checks for header files. AC_PATH_XTRA AC_HEADER_STDC AC_HEADER_TIME AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h sys/time.h sys/utsname.h unistd.h memory.h) dnl Check for X headers, etc _cppflags="${CPPFLAGS}" CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}" AC_CHECK_HEADERS(X11/SM/SMlib.h X11/extensions/Xdbe.h) dnl Checks for X extensions/libraries XINERAMA_LIBS="" XFT_LIBS="" XFT_CFLAGS="" AC_SUBST(XINERAMA_LIBS) AC_SUBST(XFT_LIBS) AC_SUBST(XFT_CFLAGS) AC_CHECK_LIB(Xinerama, XineramaQueryScreens, [XINERAMA_LIBS="-lXinerama" AC_CHECK_HEADERS(X11/extensions/Xinerama.h)], [],[$X_LIBS -lX11 -lXext]) dnl Try using pkg-config first, since it looks like Xft2 may fail our dnl hand-crafted tests PKG_CHECK_MODULES(XFT, xft >= 1.0, [_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS $XFT_CFLAGS" AC_CHECK_HEADERS(X11/Xft/Xft.h) CPPFLAGS=$_cppflags], [AC_CHECK_LIB(Xft, XftDrawCreate, [XFT_LIBS="-lXft -lXrender" AC_CHECK_HEADERS(X11/Xft/Xft.h)], [], [$X_LIBS -lX11 -lXext])]) CPPFLAGS="${_cppflags}" dnl Check for librep AM_PATH_REP(0.14) rep_gtk_function=gtk-widget-set-size-request rep_gtk_version=0.17 AC_MSG_CHECKING([for rep-gtk >= $rep_gtk_version]) cat >conftest <&5; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) AC_MSG_ERROR([You need rep-gtk version ${rep_gtk_version}+]) fi rm -f conftest dnl is X available? if test "${no_x}" != "yes"; then AC_DEFINE(HAVE_X11) else AC_MSG_ERROR([You need X11 for sawfish]) fi dnl Check for image handling libraries AC_ARG_WITH(gdk-pixbuf, [ --with-gdk-pixbuf Use gdk-pixbuf for image management --without-gdk-pixbuf Use Imlib1 instead], [], [with_gdk_pixbuf=yes]) if test "$with_gdk_pixbuf" != "no"; then AC_MSG_CHECKING([for gdk_pixbuf (xlib version)]) PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-xlib-2.0 >= 1.3.12) GDK_PIXBUF_VERSION=`pkg-config --modversion gdk-pixbuf-xlib-2.0` AC_SUBST(GDK_PIXBUF_VERSION) AC_SUBST(GDK_PIXBUF_CFLAGS) AC_SUBST(GDK_PIXBUF_LIBS) AC_DEFINE(HAVE_GDK_PIXBUF,1) AC_DEFINE(NEED_PIXMAP_CACHE,1) IMAGE_LIBS='${GDK_PIXBUF_LIBS}' IMAGE_CFLAGS='${GDK_PIXBUF_CFLAGS}' with_gdk_pixbuf=yes else AC_MSG_RESULT(no) if test "$with_gdk_pixbuf" = "yes"; then AC_MSG_ERROR([can't locate gdk-pixbuf-xlib library]) else with_gdk_pixbuf=no fi fi if test "$with_gdk_pixbuf" = "no"; then AC_PATH_PROG(IMLIB_CONFIG, imlib-config, no) AC_MSG_CHECKING([for Imlib]) if test "$IMLIB_CONFIG" = "no"; then AC_MSG_RESULT([no]) AC_MSG_ERROR([can't find imlib-config]) else IMLIB_VERSION=`$IMLIB_CONFIG --version` dnl XXX do version check.. AC_MSG_RESULT([version $IMLIB_VERSION]) IMLIB_CFLAGS=`$IMLIB_CONFIG --cflags` IMLIB_LIBS=`$IMLIB_CONFIG --libs` if $IMLIB_CONFIG --libs | grep " -lpng" >/dev/null 2>&1; then true; else AC_MSG_ERROR([imlib must be built with support for png images]) fi AC_DEFINE(HAVE_IMLIB,1) IMAGE_LIBS='${IMLIB_LIBS}' IMAGE_CFLAGS='${IMLIB_CFLAGS}' AC_SUBST(IMLIB_VERSION) AC_SUBST(IMLIB_CFLAGS) AC_SUBST(IMLIB_LIBS) fi fi AC_SUBST(IMAGE_LIBS) AC_SUBST(IMAGE_CFLAGS) AM_PATH_GTK_2_0(1.3.12) AC_ARG_WITH(audiofile, [ --with-audiofile Use libaudiofile for sound manipulation --without-audiofile], [], [with_audiofile=yes]) if test "$with_audiofile" = "yes"; then PKG_CHECK_MODULES(AUDIOFILE, audiofile >= 0.2.3) AC_SUBST(AUDIOFILE_LIBS) AC_SUBST(AUDIOFILE_CFLAGS) AC_DEFINE(HAVE_LIBAUDIOFILE) fi AC_ARG_WITH(esd, [ --with-esd Use the Enlightened Sound Daemon --without-esd], [], [with_esd=yes]) if test "$with_esd" = "yes"; then PKG_CHECK_MODULES(ESD, esound >= 0.2.23) AC_SUBST(ESD_LIBS) AC_SUBST(ESD_CFLAGS) AC_DEFINE(HAVE_ESD) fi AC_ARG_ENABLE(capplet, [ --enable-capplet Build the sawfish GNOME capplet [default] --disable-capplet Don't built the capplet], [], [enable_capplet=no]) if test "$enable_capplet" = "yes"; then add_subdir "capplet" fi AC_ARG_ENABLE(themer, [ --enable-themer Build the sawfish-themer program [default] --disable-themer Don't build the themer], [], [enable_themer=yes]) if test "$enable_themer" = yes; then dnl configure redirects &5 to config.log AC_MSG_CHECKING([for rep-gtk libglade wrapper]) if REP_GTK_DONT_INITIALIZE=1 rep --batch -l gui.gtk.libglade 2>&5; then AC_MSG_RESULT([yes]) add_subdir "themer" else AC_MSG_RESULT([no]) AC_MSG_WARN([Can't load rep's libglade wrapper, not building themer]) fi fi AC_ARG_ENABLE(gnome-widgets, [ --enable-gnome-widgets Use GNOME widgets in places [default] --disable-gnome-widgets Don't use GNOME widgets], [], [enable_gnome_widgets=no]) if test "$enable_gnome_widgets" != "no"; then AC_MSG_CHECKING([for rep-gtk GNOME wrappers]) if REP_GTK_DONT_INITIALIZE=1 rep --batch -l gui.gtk-2.gnome-ui 2>&5; then AC_MSG_RESULT([yes]) REP_GTK_GNOME=yes else AC_MSG_RESULT([no]) REP_GTK_GNOME=no AC_MSG_WARN([Can't load rep's gnome wrappers]) fi else REP_GTK_GNOME=no fi AC_SUBST(REP_GTK_GNOME) dnl Check for Doug Lea's malloc in libc doug_lea_malloc=yes AC_CHECK_FUNC(malloc_get_state, , doug_lea_malloc=no) AC_CHECK_FUNC(malloc_set_state, , doug_lea_malloc=no) if test "$doug_lea_malloc" = "no"; then dnl We used to compile our own version of dlmalloc on most dnl platforms that didn't have it in their libc. But the list dnl of exceptions was growing too long.. AC_DEFINE(LIBC_MALLOC) else AC_DEFINE(DOUG_LEA_MALLOC) AC_DEFINE(LIBC_MALLOC) fi dnl Check for GNOME location AC_ARG_WITH(gnome_prefix, [ --with-gnome-prefix=DIR Root of GNOME installation], [], [ with_gnome_prefix="" ]) AC_MSG_CHECKING([for GNOME prefix]) if test "x$with_gnome_prefix" = "x"; then with_gnome_prefix='${prefix}' fi AC_MSG_RESULT([$with_gnome_prefix]) GNOMEDIR=$with_gnome_prefix AC_SUBST(GNOMEDIR) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_C_BIGENDIAN AC_TYPE_SIZE_T dnl Checks for library functions. AC_FUNC_ALLOCA AC_FUNC_VPRINTF AC_CHECK_FUNCS(gethostname socket snprintf getpagesize) dnl Custom tests dnl How do we get dependency lines in the Makefile? if test "x${GCC}" = "xyes"; then MAKEDEP='$(CC) -MM' else case ${host} in *-dec-osf*) dnl works on Tru64 MAKEDEP='$(CC) -M' ;; *-sun-solaris*) dnl works on Solaris MAKEDEP='/usr/ccs/lib/cpp -M' ;; *) dnl disable dependences? MAKEDEP='true' ;; esac fi AC_SUBST(MAKEDEP) dnl If using GCC and it doesn't look as though the cflags have been dnl set explicitly, add some warning options. Turn off implicit-int dnl warnings since the X11 includes on Solaris generate a lot of these if test "x${GCC}" = "xyes" -a "x$CFLAGS" = "x-g -O2"; then CFLAGS="${CFLAGS} -Wall -Wmissing-prototypes -Wno-implicit-int" fi AC_MSG_CHECKING(for languages to install) AC_ARG_ENABLE(linguas, [ --enable-linguas=LANGS... Install language catalogs for language codes LANGS], [ LINGUAS="$enableval" ], [ LINGUAS="" ]) if test "x$LINGUAS" = x; then changequote({,}) LINGUAS="`echo $srcdir/po/*.po | sed -e 's/[^ ]*\/po\/\([^ ]*\)\.po/\1/g'`" changequote([,]) fi dnl too gross for words.. if test $REP_MSGFMT = true; then LINGUAS="" fi AC_MSG_RESULT($LINGUAS) AC_SUBST(LINGUAS) dnl Nonstandard exported symbols AC_SUBST(version) AC_SUBST(subversion) AC_SUBST(sawfishdir) AC_SUBST(sawfishexecdir) AC_SUBST(lispdir) AC_SUBST(localedir) AC_SUBST(HAVE_X11) AC_SUBST(CPPFLAGS) AC_SUBST(CFLAGS) AC_SUBST(LIBS) AC_SUBST(X_CFLAGS) AC_SUBST(X_LIBS) AC_SUBST(X_EXTRA_LIBS) AC_SUBST(IMLIB_CFLAGS) AC_SUBST(IMLIB_LIBS) dnl Build all files AC_OUTPUT(${output_files}) dnl If it doesn't look like GNU Make is being used, give a friendly warning tem=`make --version -f /dev/null 2>&1 | grep GNU` if test "x$tem" = "x"; then AC_MSG_WARN([You need to use GNU Make when compiling sawfish]) fi dnl Local variables: dnl major-mode: sh-mode dnl End: