dnl AbiWord dnl Copyright (C) 2001 Sam Tobin-Hochstadt dnl MacOS X hackery by Hubert Figuiere dnl dnl This program is free software; you can redistribute it and/or dnl modify it under the terms of the GNU General Public License dnl as published by the Free Software Foundation; either version 2 dnl of the License, or (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but 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 this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA dnl 02111-1307, USA. dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.50) AC_INIT AC_CONFIG_SRCDIR([src/af/ev/xp/ev_Menu.h]) AC_CONFIG_AUX_DIR(ac-helpers) dnl AC_CONFIG_HEADERS(config.h) AM_INIT_AUTOMAKE(AbiSuite,0.9.5) dnl APR [ Apache Portable Runtime ] does it this way, but I don't know dnl why. I figure they probably have a good reason. abs_builddir=`pwd` abs_srcdir="`cd $srcdir && pwd`" if test -n "$BUILD_BASE"; then top_builddir="$BUILD_BASE" else top_builddir="$abs_builddir" fi AC_SUBST(top_builddir) dnl Checks for programs. AC_PROG_CXX AC_PROG_CC AC_ISC_POSIX AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_RANLIB dnl AC_PROG_LIBTOOL AM_ACLOCAL_INCLUDE(ac-helpers) dnl Detect our platform (unix, win32, etc) dnl Do this before the GNOME stuff ABI_DETECT_PLATFORM dnl TODO It would be nice to eventually add -Werror dnl FIXME these flags are gcc-specific, and need to be fixed dnl actually MacOS X build does not want some of them because of dnl precompiled Mac headers.... with Apple's GCC. if test "$PLATFORM" = "mac"; then WARNING_CFLAGS="" elif test "$OS_NAME" = "FreeBSD"; then WARNING_CFLAGS="-Wall -pedantic -ansi -D_BSD_SOURCE -pipe" elif test "$OS_NAME" = "NetBSD"; then WARNING_CFLAGS="-Wall -pedantic -ansi -D_BSD_SOURCE -pipe" else WARNING_CFLAGS="-Wall -pedantic -ansi -D_POSIX_SOURCE -D_BSD_SOURCE -pipe" fi AC_SUBST(WARNING_CFLAGS) dnl Checks for libraries. dnl Define here ABI_FE, PLATFORM_CFLAGS, PLATFORM_LIBS if test "$PLATFORM" = "unix"; then ABI_FE="Unix" AM_CONDITIONAL(WITH_UNIX, true) dnl locate glib and gtk ABI_GLIB_GTK elif test "$PLATFORM" = "mac" ; then ABI_FE="Mac" AM_CONDITIONAL(WITH_MACOSX, true) fi dnl These are the flags required and defined above AC_SUBST(ABI_FE) dnl iconv peer library is in libiconv as per the CVS module name. if test "$PLATFORM" = "mac"; then ICONV_INCLUDES= else ICONV_INCLUDES=-I'$(top_srcdir)/../libiconv/include' fi AC_CHECK_FUNC(iconv,ICONV_LIBS="",ICONV_LIBS="-liconv") AC_SUBST(ICONV_INCLUDES) AC_SUBST(ICONV_LIBS) ABIWORD_APP_NAME="AbiWord" AC_SUBST(ABIWORD_APP_NAME) ABIWORD_APP_LIBDIR="AbiWord" AC_SUBST(ABIWORD_APP_LIBDIR) dnl ./configure command line arguments dnl currently, we have: dnl --enable-gnome dnl --enable-debug dnl --enable-extra-optimization dnl --enable-profile dnl --enable-bidi dnl --enable-peer-config dnl --with-pspell dnl --with-libjpeg dnl --with-libxml2 dnl The defined values are used mostly in includes.mk, but also in dnl some other places AC_ARG_ENABLE(debug, [ --enable-debug Turn on debugging], [case "${enableval}" in yes) debug=true ; DEBUG_CFLAGS="-DDEBUG -DUT_DEBUG -DFMT_TEST -DUT_TEST -DPT_TEST -g" ;; no) debug=false ; DEBUG_CFLAGS="-DNDEBUG" ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; esac],[debug=false]) AM_CONDITIONAL(DEBUG, test x$debug = xtrue) AC_ARG_ENABLE(gnome, [ --enable-gnome Turn on gnome ], [case "${enableval}" in yes) gnome=true ;; no) gnome=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-gnome) ;; esac],[gnome=false]) AM_CONDITIONAL(WITH_GNOME, test "x$gnome" = "xtrue") AC_ARG_WITH(pspell, [ --with-pspell Turn on pspell ], [case "${withval}" in yes) PSPELL_LIBS="-lpspell -lpspell-modules -lltdl" ; pspell=true ;; no) PSPELL_LIBS="" ; pspell=false ;; *) AC_MSG_ERROR(bad value ${withval} for --with-pspell) ;; esac],[PSPELL_LIBS=""]) AM_CONDITIONAL(WITH_PSPELL, test x$pspell = xtrue) AC_ARG_WITH(libjpeg, [ --with-libjpeg Turn on jpeglib support ], [case "${withval}" in yes) libjpeg=true ;; no) libjpeg=false ;; *) AC_MSG_ERROR(bad value ${withval} for --with-libjpeg) ;; esac],[libjpeg=false]) AM_CONDITIONAL(WITH_LIBJPEG, test x$libjpeg = xtrue) AC_ARG_WITH(libwmf, [ --with-libwmf Turn on libwmf ], [case "${withval}" in yes) LIBWMF_DIR="" ;; no) LIBWMF_DIR="" ; libwmf=false ;; *) LIBWMF_DIR="${withval}" ;; esac if [ test "x$libwmf" != "xfalse" ]; then if [ test -n "$LIBWMF_DIR" ]; then AC_PATH_PROG(LIBWMF_CONFIG,libwmf-config, ,[$LIBWMF_DIR/bin:$PATH]) else AC_PATH_PROG(LIBWMF_CONFIG,libwmf-config) fi if [ test -n "$LIBWMF_CONFIG" ]; then LIBWMF_CFLAGS="`$LIBWMF_CONFIG --cflags` -DHAVE_LIBWMF=1" LIBWMF_LIBS="`$LIBWMF_CONFIG --libs`" else AC_MSG_ERROR(* * * unable to find libwmf-config; unable to continue * * *) fi wmf_save_CPPFLAGS="$CPPFLAGS" wmf_save_LDFLAGS="$LDFLAGS" CPPFLAGS="$CPPFLAGS $LIBWMF_CFLAGS" LDFLAGS="$LDFLAGS $LIBWMF_LIBS" AC_CHECK_HEADER(libwmf/gd.h,[ AC_CHECK_LIB(wmf,wmf_size,libwmf=true,[ AC_MSG_ERROR(* * * libwmf version 0.2.1 or later is required * * *) ]) ]) CPPFLAGS="$wmf_save_CPPFLAGS" LDFLAGS="$wmf_save_LDFLAGS" else LIBWMF_CFLAGS="" LIBWMF_LIBS="" fi],[LIBWMF_CFLAGS="" LIBWMF_LIBS=""]) AC_SUBST(LIBWMF_CFLAGS) AC_SUBST(LIBWMF_LIBS) AC_ARG_ENABLE(profile, [ --enable-profile Turn on profile ], [case "${enableval}" in yes) PROFILE_CFLAGS="-pg -fprofile-arcs -ftest-coverage" ;; no) PROFILE_CFLAGS="" ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-profile) ;; esac],[PROFILE_CFLAGS=""]) AC_ARG_ENABLE(extra-optimization, [ --enable-extra-optimization Turn on extra optimizations ], [case "${enableval}" in yes) OPTIMIZE_CFLAGS="-O3" ;; no) OPTIMIZE_CFLAGS="-O2" ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-extra-optimization) ;; esac],[OPTIMIZE_CFLAGS=""]) AC_ARG_ENABLE(bidi, [ --enable-bidi Turn on bidirectional support ], [case "${enableval}" in yes) bidi=true; BIDI_CFLAGS="-DBIDI_ENABLED" ;; no) bidi=false; BIDI_CFLAGS="" ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-bidi) ;; esac],[BIDI_CFLAGS=""]) AM_CONDITIONAL(BIDI_ENABLED, test "x$bidi" = "xtrue") # by default, configure in the abi directory runs the same configure command # in the peer directories (wv, expat, etc...). this provides a way to # disable that behavior. AC_ARG_ENABLE(peer-config, [ --enable-peer-config Enable automatic configuration of peer directories (on by default) ], [case "${enableval}" in yes) peerconfig=true ;; no) peerconfig=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-peer-config) ;; esac],[peerconfig=true]) AC_ARG_ENABLE(scripting, [ --enable-scripting Enable the perl scripting interface ], [case "${enableval}" in yes) script=true ;; no) script=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-scripting) ;; esac],[script=false]) dnl this isn't actually used anywhere, but we provide it anyway AM_CONDITIONAL(SCRIPT, test x$script = xtrue) case "$script" in "true" ) SCRIPT_CFLAGS="-DABI_OPT_PERL `perl -MExtUtils::Embed -e ccopts` -Ubool" SCRIPT_LIBS="`perl -MExtUtils::Embed -e ldopts`" AC_MSG_CHECKING(for perl xsubpp precompiler) XSUBPPDIR="`(cd $abs_srcdir/src/bindings/perl && perl -MExtUtils::MakeMaker -e 'print ExtUtils::MakeMaker->new({NAME => qw(abi)})->tool_xsubpp') | grep ^XSUBPPDIR | sed -e 's/XSUBPPDIR = //g;'`" if test -n "${XSUBPPDIR}"; then AC_MSG_RESULT(${XSUBPPDIR}) else AC_MSG_ERROR(not found) fi ;; * ) SCRIPT_CFLAGS="" SCRIPT_LIBS="" ;; esac if test "$PLATFORM" = unix -a "$gnome" = true ; then AC_MSG_CHECKING(for gnome-libs >= 1.2.0) if gnome-config --modversion gnome 2> /dev/null | grep gnome-libs >/dev/null 2>&1; then dnl We need the "%d" in order not to get e-notation on hpux. vers=`gnome-config --modversion gnome | sed s,gnome-libs-,, | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` if test "$vers" -ge 1002000; then AC_MSG_RESULT(found) else AC_MSG_RESULT(You need at least gnome-libs 1.2.0: disabling gnome) gnome=false fi else AC_MSG_RESULT(not found: disabling gnome) gnome=false fi AM_CONDITIONAL(WITH_GNOME, test "x$gnome" = "xtrue") fi if test "$PLATFORM" = unix -a "$gnome" = true ; then dnl What is the minimum gal library we can use? AC_MSG_CHECKING(for gal >= 0.5) if gnome-config --modversion gal 2> /dev/null | grep gal > /dev/null 2>&1; then dnl We need the "%d" in order not to get e-notation on hpux. vers=`gnome-config --modversion gal | sed s,gal-,, | awk 'BEGIN { FS = "."; } { printf "%d", $1 * 1000 + $2;}'` if test "$vers" -ge 5; then AC_MSG_RESULT(found) else AC_MSG_RESULT(You need at least gal 0.5: disabling gnome) gnome=false fi else AC_MSG_RESULT(not found: disabling gnome) gnome=false fi AM_CONDITIONAL(WITH_GNOME, test "x$gnome" = "xtrue") fi if test "$PLATFORM" = unix -a "$gnome" = true ; then GNOME_CFLAGS="`gnome-config --cflags gnomeui print` -DHAVE_GNOME" dnl This is the old line #GNOME_LIBS="-lgnomeui -lgnomeprint -lgal -lart_lgpl -lgdk_imlib -lgnome -lgnomesupport -lxml -lunicode -lglade-gnome -lglade -lgnomecanvaspixbuf -lgdk_pixbuf -ltiff -ljpeg" GNOME_LIBS="`gnome-config --libs gal print`" else GNOME_CFLAGS="" GNOME_LIBS="" fi AC_SUBST(GNOME_CFLAGS) AC_SUBST(GNOME_LIBS) if test "$PLATFORM" = "unix"; then if test "$gnome" = "true"; then PLATFORM_CFLAGS="$GNOME_CFLAGS $GMODULE_CFLAGS $GTK_CFLAGS -DSUPPORTS_UT_IDLE=1" PLATFORM_LIBS= else PLATFORM_CFLAGS="$GMODULE_CFLAGS $GTK_CFLAGS -DSUPPORTS_UT_IDLE=1" PLATFORM_LIBS= fi fi dnl AUTOCONF SUCKS if test "$PLATFORM" = "mac"; then PLATFORM_LIBS="-liconv -framework Carbon -framework CoreServices -framework ApplicationServices -framework QuickTime" PLATFORM_CFLAGS=-I'$(top_builddir)/src/af/util/unix'\ -fpascal-strings\ -DUSE_CARBON_EVENTS\ -DCARBON_ON_MACH_O=1\ -DNO_SYS_ERRLIST\ -I/Developer/Headers/FlatCarbon fi dnl SUBST all the variables we just defined AC_SUBST(OPTIMIZE_CFLAGS) AC_SUBST(PROFILE_CFLAGS) AC_SUBST(PSPELL_LIBS) AC_SUBST(LIBJPEG_LIBS) AC_SUBST(DEBUG_CFLAGS) AC_SUBST(SCRIPT_CFLAGS) AC_SUBST(SCRIPT_LIBS) AC_SUBST(BIDI_CFLAGS) AC_SUBST(PLATFORM_CFLAGS) AC_SUBST(PLATFORM_LIBS) AC_SUBST(XSUBPPDIR) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(limits.h strings.h sys/time.h unistd.h malloc.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_TYPE_SIZE_T AC_C_BIGENDIAN AM_CONDITIONAL(BIGENDIAN,[ test "x$ac_cv_c_bigendian" = "xyes" ]) dnl Currently, we need all of the following, but in the future we dnl might not. dnl dnl check for an xml parser ABI_NEED_XML_PARSER="yes" ABI_XML_PARSER(${abs_srcdir}/../expat) dnl check for psiconv ABI_NEED_PSICONV="yes" ABI_PSICONV(${abs_srcdir}/../psiconv) dnl check for wv ABI_NEED_WV="yes" ABI_WV(${abs_srcdir}/../wv) dnl check for libpng. ABI_NEED_LIBPNG="yes" ABI_LIBPNG(${abs_srcdir}/../libpng) dnl check for libjpeg ABI_LIBJPEG dnl Checks for library functions. AC_FUNC_ALLOCA AC_TYPE_SIGNAL AC_CHECK_FUNCS(re_comp regcomp strdup strstr) AC_CHECK_FUNC(setenv,,[ AC_DEFINE(SETENV_MISSING,1) ]) if test $peerconfig = "true"; then dnl other configure scripts # AC_CONFIG_SUBDIRS($PEERDIRS) won't work :-( for i in . $PEERDIRS; do if test $i != . ; then echo "Running configure in ${i}" config_flags='--disable-shared --enable-static' if test `basename "$i"` = wv; then config_flags="$config_flags --with-exporter" fi (cd $i; ./configure $config_flags) fi done fi AC_SUBST(PEERDIRS) AC_SUBST(PEERS) AC_CONFIG_FILES([GNUmakefile src/GNUmakefile src/af/GNUmakefile src/af/ev/GNUmakefile src/af/ev/xp/GNUmakefile src/af/ev/unix/GNUmakefile src/af/ev/unix/gnome/GNUmakefile src/af/ev/mac/GNUmakefile src/af/gr/GNUmakefile src/af/gr/xp/GNUmakefile src/af/gr/mac/GNUmakefile src/af/gr/unix/GNUmakefile src/af/util/GNUmakefile src/af/util/xp/GNUmakefile src/af/util/mac/GNUmakefile src/af/util/unix/GNUmakefile src/af/xap/GNUmakefile src/af/xap/xp/GNUmakefile src/af/xap/mac/GNUmakefile src/af/xap/unix/GNUmakefile src/af/xap/unix/gnome/GNUmakefile src/other/GNUmakefile src/other/spell/GNUmakefile src/other/spell/xp/GNUmakefile src/other/fribidi/GNUmakefile src/other/fribidi/xp/GNUmakefile src/text/GNUmakefile src/text/fmt/GNUmakefile src/text/fmt/xp/GNUmakefile src/text/ptbl/GNUmakefile src/text/ptbl/xp/GNUmakefile src/wp/GNUmakefile src/wp/ap/GNUmakefile src/wp/ap/xp/GNUmakefile src/wp/ap/mac/GNUmakefile src/wp/ap/unix/GNUmakefile src/wp/ap/unix/gnome/GNUmakefile src/wp/impexp/GNUmakefile src/wp/impexp/xp/GNUmakefile src/wp/main/GNUmakefile src/wp/main/xp/GNUmakefile src/wp/main/mac/GNUmakefile src/wp/main/unix/GNUmakefile src/wp/main/unix/gnome/GNUmakefile src/tools/GNUmakefile src/tools/cdump/GNUmakefile src/tools/cdump/xp/GNUmakefile src/tools/pfa2afm/GNUmakefile src/tools/pfa2afm/unix/GNUmakefile src/tools/ttftool/GNUmakefile src/tools/ttftool/unix/GNUmakefile src/bindings/GNUmakefile src/bindings/perl/GNUmakefile ]) AC_OUTPUT echo " " case "$PLATFORM" in "unix" ) AC_MSG_RESULT([Configured to build on a Unix/Linux platform.]) ;; "win" ) AC_MSG_RESULT([Configured to build on a Windows platform.]) ;; "beos" ) AC_MSG_RESULT([Configured to build on a BeOS platform.]) ;; "qnx" ) AC_MSG_RESULT([Configured to build on a QNX RTOS platform.]) ;; "mac" ) AC_MSG_RESULT([Configured to build on a Mac OS X platform.]) ;; esac case "$gnome" in "true" ) AC_MSG_RESULT([Configured with GNOME support.]) ;; esac case "$pspell" in "true" ) AC_MSG_RESULT([Configured with Pspell support.]) ;; esac case "$libjpeg" in "true" ) AC_MSG_RESULT([Configured with libjpeg support.]) ;; esac case "$debug" in "true" ) AC_MSG_RESULT([Configured with debugging symbols.]) ;; esac case "$script" in "true" ) AC_MSG_RESULT([Configured with scripting support.]) ;; esac case "$bidi" in "true" ) AC_MSG_RESULT([Configured with BiDi support.]) ;; esac echo " " cat <