dnl Process this file with autoconf to produce a configure script. AC_INIT(include/fx.h) dnl Major Library release number FOX_MAJOR_VERSION=1 dnl Minor Library release number FOX_MINOR_VERSION=4 dnl Increment after every source code change FOX_PATCH_LEVEL=35 dnl Binaries compiled with this patchlevel of FOX will need at least dnl version MAJOR.MINOR.INTERFACE_VERSION to run. The assertion dnl FOX_INTERFACE_VERSION >= FOX_BINARY_VERSION must hold. dnl dnl Increment this when an API is added FOX_INTERFACE_VERSION=0 dnl Binaries compiled with at least MAJOR.MINOR.BINARY_VERSION are dnl compatible with this release of FOX. dnl dnl Set this to FOX_INTERFACE_VERSION's value if API changed or removed FOX_BINARY_VERSION=0 dnl Combined version number VERSION=$FOX_MAJOR_VERSION.$FOX_MINOR_VERSION.$FOX_PATCH_LEVEL AM_INIT_AUTOMAKE(fox,$VERSION) dnl Report what was found AC_MSG_CHECKING(major version) AC_MSG_RESULT($FOX_MAJOR_VERSION) AC_MSG_CHECKING(minor version) AC_MSG_RESULT($FOX_MINOR_VERSION) AC_MSG_CHECKING(patchlevel) AC_MSG_RESULT($FOX_PATCH_LEVEL) AC_SUBST(FOX_MAJOR_VERSION) AC_SUBST(FOX_MINOR_VERSION) AC_SUBST(FOX_PATCH_LEVEL) dnl CURRENT: Most recent interface library implements dnl REVISION: The implementation number of the CURRENT interface dnl AGE: The difference between the newest and oldest interfaces that this dnl library implements. The library implements all the interface numbers dnl in the range from number CURRENT - AGE to CURRENT. LT_RELEASE=$FOX_MAJOR_VERSION.$FOX_MINOR_VERSION LT_CURRENT=$FOX_INTERFACE_VERSION LT_REVISION=`expr $FOX_PATCH_LEVEL - $FOX_INTERFACE_VERSION` LT_AGE=`expr $FOX_INTERFACE_VERSION - $FOX_BINARY_VERSION` AC_SUBST(LT_RELEASE) AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION) AC_SUBST(LT_AGE) dnl Prevents setting flags. CXXFLAGS="" dnl Checks for programs. AC_PROG_MAKE_SET AC_PROG_CC AC_PROG_CPP AC_PROG_CXX AM_PROG_LIBTOOL dnl Run tests in C++ dnl AC_LANG_CPLUSPLUS dnl Checks for header files. AC_PATH_X AC_PATH_XTRA dnl Checks for typedefs, structures, and compiler characteristics. AC_HEADER_TIME AC_HEADER_SYS_WAIT AC_HEADER_DIRENT AC_FUNC_MMAP AC_CHECK_HEADERS(unistd.h) AC_CHECK_HEADERS(sys/param.h) AC_CHECK_HEADERS(sys/select.h) AC_CHECK_HEADERS(sys/filio.h) dnl Checks for the MingW32 compiler environment. If present, sets shell dnl variable MINGW32 to 'yes'. If not present, sets MINGW32 to the dnl empty string. AC_MINGW32() dnl Check to see if they specified MingW32 location AC_ARG_WITH(mingw32,[ --with-mingw32[=DIR] MingW32 installation location]) dnl Checks for the Cygwin environment. If present, sets shell variable dnl CYGWIN to 'yes'; if not present, sets CYGWIN to the empty string. AC_CYGWIN() dnl Clear out the X11 flags for the case where we're cross-compiling dnl for i586-mingw32 targets under Unix. if test "x$CYGWIN" = "xyes" -o "x$MINGW32" = "xyes" ; then X_CFLAGS="" X_LIBS="" fi dnl Byte order if test "x$CYGWIN" = "xyes" -o "x$MINGW32" = "xyes" ; then dnl For Win32 X86 => little endian. FOX_BYTEORDER=0 AC_SUBST(FOX_BYTEORDER) else AC_C_BIGENDIAN if test "x$ac_cv_c_bigendian" = "xyes"; then FOX_BYTEORDER=1 else FOX_BYTEORDER=0 fi AC_SUBST(FOX_BYTEORDER) fi if test "x$CYGWIN" = "xyes" -o "x$MINGW32" = "xyes" ; then AC_DEFINE(WIN32) LIBS="${LIBS} -lcomctl32 -lwsock32 -lwinspool -lmpr" LDFLAGS="${LDFLAGS} -mwindows -e _mainCRTStartup" if test "x$with_mingw32" != "x" ; then CPPFLAGS="${CPPFLAGS} -I$with_mingw32/include" LIBS="${LIBS} -L$with_mingw32/lib" fi X_BASE_LIBS="" else X_BASE_LIBS="-lXext -lX11" fi AC_SUBST(X_BASE_LIBS) AC_EXEEXT dnl Checks for QNX (Dustin Graves ) AC_MSG_CHECKING(for QNX environment) case "$host_os" in *-qnx*) AC_MSG_RESULT(yes) dnl Check g++ for -fno-builtin dependency if test "${GXX}" = "yes" ; then AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_MSG_CHECKING(if QNX C++ compiler requires -fno-builtin) AC_CACHE_VAL(ac_cv_no_builtin, [AC_TRY_COMPILE([#include #include #include], [return 0;], [ac_cv_no_builtin=false], [ac_cv_no_builtin=true])]) if test "$ac_cv_no_builtin" = true ; then CXXFLAGS="${CXXFLAGS} -fno-builtin" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi AC_LANG_RESTORE fi ;; *) AC_MSG_RESULT(no) esac dnl Checks for the Sun WorkShop Compiler AC_MSG_CHECKING(for Sun WorkShop C++) if $CXX -V 2>&1 | egrep 'WorkShop Compilers 4.2' > /dev/null; then AC_MSG_RESULT(4.2) CXXFLAGS="${CXXFLAGS} -instances=global -features=anachronisms" elif $CXX -V 2>&1 | egrep 'WorkShop Compilers 5.0' > /dev/null; then AC_MSG_RESULT(5.0) CXXFLAGS="${CXXFLAGS} -instances=global -features=anachronisms,no%conststrings" elif $CXX -V 2>&1 | egrep 'Sun WorkShop 6' > /dev/null; then AC_MSG_RESULT(Forte6) CXXFLAGS="${CXXFLAGS} -instances=global -features=anachronisms,no%conststrings" else AC_MSG_RESULT(no) fi dnl Check for Xft2 support AC_MSG_CHECKING(for Xft support) AC_ARG_WITH(xft,[ --with-xft enable Xft support]) AC_MSG_RESULT([$with_xft]) if test "x$with_xft" = "xyes"; then FTCFLAGS=`freetype-config --cflags` FTLIBX=`freetype-config --libs` XFTCFLAGS=`xft-config --cflags` XFTLIBS=`xft-config --libs` saved_cppflags="${CXXFLAGS}" CXXFLAGS="${CXXFLAGS} -DHAVE_XFT_H=1 $FTCFLAGS $XFTCFLAGS" X_BASE_LIBS="${X_BASE_LIBS} $FTLIBS $XFTLIBS" fi dnl Check for XShape support AC_ARG_ENABLE(shape,[ --with-shape enable XShape support]) AC_MSG_RESULT([$with_shape]) if test "x$with_shape" != "xno"; then AC_CHECK_HEADER(X11/extensions/shape.h,CXXFLAGS="${CXXFLAGS} -DHAVE_XSHAPE_H=1") fi dnl Check for XShm support AC_ARG_ENABLE(xshm,[ --with-xshm compile with XShm support]) AC_MSG_RESULT([$with_xshm]) if test "x$with_xshm" != "xno"; then XSHM="-DHAVE_XSHM_H=1" AC_CHECK_HEADER(X11/extensions/XShm.h,,XSHM="") AC_CHECK_HEADER(sys/ipc.h,,XSHM="") AC_CHECK_HEADER(sys/shm.h,,XSHM="") CXXFLAGS="${CXXFLAGS} ${XSHM}" fi dnl Using reentrant library calls AC_MSG_CHECKING(for thread-safe library calls) AC_ARG_ENABLE(xthreads,[ --enable-threadsafe Thread-safe library calls]) AC_MSG_RESULT([$enable_threadsafe]) if test "x$enable_threadsafe" != "xno" ; then CXXFLAGS="${CXXFLAGS} -DFOX_THREAD_SAFE=1 -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT" fi dnl Find posix thread library if test "x$MINGW32" != "xyes" ; then AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not available ***])) PTHREAD_LIBS=notfound if test "x$PTHREAD_LIBS" = xnotfound; then AC_CHECK_LIB(pthread, pthread_exit, PTHREAD_LIBS="-lpthread") fi if test "x$PTHREAD_LIBS" = xnotfound; then AC_CHECK_LIB(pthreads, pthread_exit, PTHREAD_LIBS="-lpthreads") fi if test "x$PTHREAD_LIBS" = xnotfound; then AC_CHECK_LIB(c_r, pthread_exit, PTHREAD_LIBS="-lc_r") fi if test "x$PTHREAD_LIBS" = xnotfound; then AC_CHECK_FUNC(pthread_exit, PTHREAD_LIBS="") fi if test "x$PTHREAD_LIBS" = xnotfound; then AC_MSG_ERROR(*** Unable to locate working posix thread library ***) fi CXXFLAGS="${CXXFLAGS} -D_GNU_SOURCE" LIBS="${LIBS} $PTHREAD_LIBS" fi dnl Semaphore init AC_CHECK_LIB(rt,sem_init,LIBS="${LIBS} -lrt") dnl Check for JPEG Image support AC_ARG_ENABLE(jpeg,[ --disable-jpeg compile without JPEG image support]) AC_MSG_RESULT([$enable_jpeg]) if test "x$enable_jpeg" != "xno"; then AC_CHECK_HEADER(jpeglib.h,CXXFLAGS="${CXXFLAGS} -DHAVE_JPEG_H=1"; LIBS="${LIBS} ${LIBJPEG:=-ljpeg}") fi dnl Check for PNG Image support; note zlib is needed for PNG AC_ARG_ENABLE(png,[ --disable-png compile without PNG image support]) AC_MSG_RESULT([$enable_png]) if test "x$enable_png" != "xno"; then AC_CHECK_HEADERS(png.h,CXXFLAGS="${CXXFLAGS} -DHAVE_PNG_H=1"; LIBS="${LIBS} ${LIBPNG:=-lpng}") fi dnl Check for TIFF Image support; note zlib is needed for TIFF AC_ARG_ENABLE(tiff,[ --disable-tiff compile without TIFF image support]) AC_MSG_RESULT([$enable_tiff]) if test "x$enable_tiff" != "xno"; then AC_CHECK_HEADERS(tiff.h,CXXFLAGS="${CXXFLAGS} -DHAVE_TIFF_H=1"; LIBS="${LIBS} ${LIBTIFF:=-ltiff}") fi dnl Check for libz compression library AC_ARG_ENABLE(zlib,[ --disable-zlib compile without zlib support]) AC_MSG_RESULT([$enable_zlib]) if test "x$enable_zlib" != "xno"; then AC_CHECK_HEADERS(zlib.h,CXXFLAGS="${CXXFLAGS} -DHAVE_ZLIB_H=1"; LIBS="${LIBS} ${LIBZ:=-lz}") fi dnl Check for bzip2 compression library AC_ARG_ENABLE(bz2lib,[ --disable-bz2lib compile without bz2lib support]) AC_MSG_RESULT([$enable_bz2lib]) if test "x$enable_bz2lib" != "xno"; then AC_CHECK_HEADERS(bzlib.h,CXXFLAGS="${CXXFLAGS} -DHAVE_BZ2LIB_H=1"; LIBS="${LIBS} ${LIBBZ2:=-lbz2}") fi dnl Check for Xcursor support AC_ARG_WITH(xcursor,[ --with-xcursor compile with Xcursor support]) AC_MSG_RESULT([$with_xcursor]) if test "x$with_xcursor" != "xno"; then AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,CXXFLAGS="${CXXFLAGS} -DHAVE_XCURSOR_H=1"; X_BASE_LIBS="${X_BASE_LIBS} -lXcursor") fi dnl Check for XRandR support AC_ARG_WITH(xrandr,[ --with-xrandr compile with XRandR support]) AC_MSG_RESULT([$with_xrandr]) if test "x$with_xrandr" != "xno"; then AC_CHECK_HEADER(X11/extensions/Xrandr.h,CXXFLAGS="${CXXFLAGS} -DHAVE_XRANDR_H=1"; X_BASE_LIBS="${X_BASE_LIBS} -lXrandr") fi dnl Add math lib if TIFF Image support if test "x$enable_tiff" != "xno"; then LIBS="${LIBS} ${MATHLIB:=-lm}" fi dnl Check vsscanf AC_CHECK_FUNCS(vsscanf vsnprintf strtoll strtoull) dnl Checking for socket libraries. SOCKLIBS="" AC_CHECK_LIB(socket,socket, if test "$uname" != "IRIX"; then SOCKLIBS="-lsocket"; fi) AC_CHECK_LIB(nsl,gethostbyaddr,if test "$uname" != "IRIX"; then SOCKLIBS="${SOCKLIBS} -lnsl"; fi) dnl Check for dynamic loader AC_CHECK_LIB(dl, dlopen) AC_CHECK_LIB(dld, shl_load) dnl Checking for CUPS AC_MSG_CHECKING(for CUPS support) AC_ARG_ENABLE(cups,[ --enable-cups compile with CUPS support]) AC_MSG_RESULT([$enable_cups]) if test "x$enable_cups" = "xyes"; then CUPSLIBS="" AC_CHECK_LIB(cups,httpConnect,CUPSLIBS="-lcups") dnl For the moment, we only need to link to socket libraries when linking with cups AC_CHECK_HEADER(cups/cups.h,if test "x${CUPSLIBS}" != "x"; then CXXFLAGS="${CXXFLAGS} -DHAVE_CUPS_H=1"; LIBS="${LIBS} ${CUPSLIBS} ${SOCKLIBS}"; fi) fi dnl Add copious amounts of debugging with gcc, egcs, etc if test "${GXX}" = "yes" ; then CXXFLAGS="${CXXFLAGS} -Wall -W -Woverloaded-virtual -Wformat" fi dnl Debugging turned on AC_MSG_CHECKING(for debugging) AC_ARG_ENABLE(debug,[ --enable-debug compile for debugging]) AC_MSG_RESULT([$enable_debug]) if test "x$enable_debug" = "xyes" ; then CXXFLAGS="${CXXFLAGS} -g -DDEBUG" fi dnl Building for release AC_MSG_CHECKING(for release build) AC_ARG_ENABLE(release,[ --enable-release compile for release]) AC_MSG_RESULT([$enable_release]) if test "x$enable_release" = "xyes" ; then CXXFLAGS="${CXXFLAGS} -O2 -DNDEBUG" if test "${GXX}" = "yes" ; then CXXFLAGS="${CXXFLAGS} -Wuninitialized -ffast-math -fno-strict-aliasing -finline-functions -fomit-frame-pointer -fexpensive-optimizations" fi fi dnl Enable profiling AC_MSG_CHECKING(for profiling) AC_ARG_WITH(profiling,[ --with-profiling choices are yes, no, or gprof]) AC_MSG_RESULT([$with_profiling]) if test "x$with_profiling" = "xyes" ; then CXXFLAGS="${CXXFLAGS} -p" elif test "x$with_profiling" = "xgprof" ; then CXXFLAGS="${CXXFLAGS} -pg" fi saved_cppflags="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $X_CFLAGS" dnl Compile with 3D support dnl You have the option of NOT compiling with 3D support even if you have it AC_MSG_CHECKING(for OpenGL support) AC_ARG_WITH(opengl,[ --with-opengl choices are yes, no]) AC_MSG_RESULT([$with_opengl]) if test "x$with_opengl" != "xno" ; then if test "x$CYGWIN" = "xyes" -o "x$MINGW32" = "xyes" ; then AC_CHECK_HEADER(GL/gl.h,CXXFLAGS="${CXXFLAGS} -DHAVE_GL_H=1"; LIBS="${LIBS} ${LIBGL:=-lopengl32}") AC_CHECK_HEADER(GL/glu.h,CXXFLAGS="${CXXFLAGS} -DHAVE_GLU_H=1"; LIBS="${LIBS} ${LIBGLU:=-lglu32}") GL_TESTS="gltest.exe glviewer.exe" else AC_CHECK_HEADER(GL/gl.h,CXXFLAGS="${CXXFLAGS} -DHAVE_GL_H=1"; LIBS="${LIBS} ${LIBGL:=-lGL}") AC_CHECK_HEADER(GL/glu.h,CXXFLAGS="${CXXFLAGS} -DHAVE_GLU_H=1"; LIBS="${LIBS} ${LIBGLU:=-lGLU}") GL_TESTS="gltest glviewer" fi fi CPPFLAGS="$saved_cppflags" AC_SUBST(GL_LIBS) AC_SUBST(GL_TESTS) dnl Done. AC_OUTPUT(Makefile utils/Makefile include/Makefile include/fxver.h src/Makefile src/version.rc chart/Makefile doc/Makefile doc/art/Makefile doc/screenshots/Makefile tests/Makefile adie/Makefile shutterbug/Makefile pathfinder/Makefile calculator/Makefile windows/Makefile fox.spec fox-config) echo "" echo "Configure finished!" echo " Do: 'make' to compile FOX." echo " Then: 'make install' to install it." echo ""