dnl --------------------- dnl configure.in for surf dnl --------------------- AC_PREREQ(2.13) AC_INIT(yaccsrc/degree.h) AM_INIT_AUTOMAKE(surf, 1.0.5) CF_VERBOSE dnl check options: dnl -------------- AC_ARG_ENABLE(gui, [ --disable-gui disable graphical user interface], gui="$enableval", gui="yes") AC_ARG_ENABLE(pthread-test, [ --disable-pthread-test do not determine how to compile multithreaded programs (You'll have to specify the necessary flags)], pthread_test="$enableval", pthread_test="yes") AC_ARG_WITH(gmp-prefix,[ --with-gmp-prefix=PFX Prefix where GMP is installed (optional)], gmp_prefix="$withval", gmp_prefix="") dnl some standard checks: dnl --------------------- AC_PROG_CC AC_PROG_CXX AC_AIX AC_ISC_POSIX AC_MINIX AC_HEADER_STDC AM_PROG_LEX AC_PROG_YACC AC_PROG_RANLIB dnl check if C++ compiler really works: dnl ----------------------------------- LF_CHECK_CC_FLAG(-Wall -W -Wwrite-strings -Wpointer-arith -Wconversion -Wno-unused -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs) RS_CHECK_HAVE_BOOL if test "$rs_cv_have_bool" = "no" then AC_DEFINE(bool, int) AC_DEFINE(true, 1) AC_DEFINE(false,0) fi LF_CHECK_CXX_FLAG(-fno-rtti -fno-exceptions) LF_CHECK_CXX_FLAG(-Wall -W -Wwrite-strings -Wpointer-arith -Wconversion -Wno-unused -Wstrict-prototypes -Wmissing-prototypes -Woverloaded-virtual -Wno-deprecated) ICE_CXX_EXPLICIT_TEMPLATE_INSTANTIATION AC_CXX_FUNCTION_NONTYPE_PARAMETERS if test "$ac_cv_cxx_function_nontype_parameters" = "no"; then AC_MSG_ERROR(["Sorry, your compiler is not smart enough to build surf"]) fi if test "$GCC" = "no" ; then case `uname` in IRIX*) CXXFLAGS="-LANG:std $CXXFLAGS" ;; esac fi dnl pthread stuff: dnl -------------- if test "$pthread_test" = "yes" then AC_CANONICAL_HOST case "$host_os" in *irix* | *linux* |*solaris*) try_threads="linux";; *freebsd*) try_threads="freebsd";; *) try_threads="other"; AC_MSG_WARN([Unknown os $host_os. Maybe it's better to configure with --disable-pthread-test]);; esac fi if test "$try_threads" = "linux" then RS_CHECK_LIB(pthread) AC_DEFINE(_REENTRANT) fi if test "$try_threads" = "freebsd" then CPPFLAGS="$CPPFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" fi RS_CHECK_HEADER(pthread.h) RS_CHECK_PTHREADS dnl check for gethostname prototype in unistd.h: dnl -------------------------------------------- AC_CACHE_CHECK(whether there is a prototype for gethostname in unistd.h, ac_cv_gethostname_has_prototype, AC_EGREP_HEADER(gethostname, unistd.h, ac_cv_gethostname_has_prototype=yes, ac_cv_gethostname_has_prototype=no AC_DEFINE(NO_GETHOSTNAME_PROTO))) dnl check for libraries: dnl -------------------- dnl when compiling with GUI support check for GTK >= 1.2.0 and X: if test "$gui" = "yes" then AM_PATH_GTK(1.2.0) CFLAGS="$CFLAGS $GTK_CFLAGS" CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" else AC_DEFINE(NO_GUI) fi AC_PATH_X AC_PATH_XTRA CFLAGS="$CFLAGS $X_CFLAGS" CXXFLAGS="$CXXFLAGS $X_CFLAGS" AM_CONDITIONAL(GUI, test "x$gui" = "xyes"); dnl math lib, power function and (g)zlib: RS_CHECK_LIB(m, main) RS_CHECK_POW() AC_CHECK_LIB(z, main,, AC_CHECK_LIB(gz, main,, AC_MSG_ERROR([Sorry: can't find libz/libgz.]))) dnl jpeg library and jpeglib.h: RS_CHECK_LIB(jpeg, main) RS_CHECK_HEADER(jpeglib.h) dnl check for tiff library and header file (FreeBSD 3.0 has tiff34.so dnl instead of tiff.so and the header files are in /usr/local/lib/tiff34): AC_CHECK_LIB(tiff, main,, AC_CHECK_LIB(tiff34, main,, AC_MSG_ERROR([Sorry: can't find libtiff]))) AC_CHECK_HEADER(tiffio.h,, [AC_CHECK_HEADER(tiff34/tiffio.h,AC_DEFINE(TIFF_HEADER_34))], [AC_MSG_ERROR(["Sorry: cannot find header file tiffio.h"])] ) dnl gmp library and header file: if test x"$gmp_prefix" != x ; then LDFLAGS="-L$gmp_prefix/lib $LDFLAGS" CPPFLAGS="-I$gmp_prefix/include $CPPFLAGS" fi AC_CHECK_HEADER(gmp.h,, [AC_CHECK_HEADER(gmp2/gmp.h, AC_DEFINE(GMP2_PREFIX), AC_MSG_ERROR([Sorry: can't find header file gmp.h]))]) AC_CHECK_LIB(gmp, main,, AC_CHECK_LIB(gmp2, main,, AC_MSG_ERROR([Sorry: can't find gmp]))) dnl set DATADIR variable: dnl --------------------- dnl (Is there a another way to quote this...sometimes dnl "/bin/sh ./config.status --recheck" complains about a non working dnl C compiler) CPPFLAGS="$CPPFLAGS -DDATADIR=\\\"$datadir\\\"" AC_OUTPUT( Makefile src/Makefile image-formats/Makefile drawfunc/Makefile yaccsrc/Makefile curve/Makefile mt/Makefile draw/Makefile misc/Makefile debug/Makefile gtkgui/Makefile dither/Makefile )