1dnl Process this file with autoconf to produce a configure script. 2AC_INIT(include/fx.h) 3 4dnl Major Library release number 5FOX_MAJOR_VERSION=1 6 7dnl Minor Library release number 8FOX_MINOR_VERSION=4 9 10dnl Increment after every source code change 11FOX_PATCH_LEVEL=35 12 13dnl Binaries compiled with this patchlevel of FOX will need at least 14dnl version MAJOR.MINOR.INTERFACE_VERSION to run. The assertion 15dnl FOX_INTERFACE_VERSION >= FOX_BINARY_VERSION must hold. 16dnl 17dnl Increment this when an API is added 18FOX_INTERFACE_VERSION=0 19 20dnl Binaries compiled with at least MAJOR.MINOR.BINARY_VERSION are 21dnl compatible with this release of FOX. 22dnl 23dnl Set this to FOX_INTERFACE_VERSION's value if API changed or removed 24FOX_BINARY_VERSION=0 25 26dnl Combined version number 27VERSION=$FOX_MAJOR_VERSION.$FOX_MINOR_VERSION.$FOX_PATCH_LEVEL 28AM_INIT_AUTOMAKE(fox,$VERSION) 29 30dnl Report what was found 31AC_MSG_CHECKING(major version) 32AC_MSG_RESULT($FOX_MAJOR_VERSION) 33AC_MSG_CHECKING(minor version) 34AC_MSG_RESULT($FOX_MINOR_VERSION) 35AC_MSG_CHECKING(patchlevel) 36AC_MSG_RESULT($FOX_PATCH_LEVEL) 37 38AC_SUBST(FOX_MAJOR_VERSION) 39AC_SUBST(FOX_MINOR_VERSION) 40AC_SUBST(FOX_PATCH_LEVEL) 41 42dnl CURRENT: Most recent interface library implements 43dnl REVISION: The implementation number of the CURRENT interface 44dnl AGE: The difference between the newest and oldest interfaces that this 45dnl library implements. The library implements all the interface numbers 46dnl in the range from number CURRENT - AGE to CURRENT. 47LT_RELEASE=$FOX_MAJOR_VERSION.$FOX_MINOR_VERSION 48LT_CURRENT=$FOX_INTERFACE_VERSION 49LT_REVISION=`expr $FOX_PATCH_LEVEL - $FOX_INTERFACE_VERSION` 50LT_AGE=`expr $FOX_INTERFACE_VERSION - $FOX_BINARY_VERSION` 51 52AC_SUBST(LT_RELEASE) 53AC_SUBST(LT_CURRENT) 54AC_SUBST(LT_REVISION) 55AC_SUBST(LT_AGE) 56 57dnl Prevents setting flags. 58CXXFLAGS="" 59 60dnl Checks for programs. 61AC_PROG_MAKE_SET 62AC_PROG_CC 63AC_PROG_CPP 64AC_PROG_CXX 65AM_PROG_LIBTOOL 66 67dnl Run tests in C++ 68dnl AC_LANG_CPLUSPLUS 69 70 71dnl Checks for header files. 72AC_PATH_X 73AC_PATH_XTRA 74 75dnl Checks for typedefs, structures, and compiler characteristics. 76AC_HEADER_TIME 77AC_HEADER_SYS_WAIT 78AC_HEADER_DIRENT 79AC_FUNC_MMAP 80AC_CHECK_HEADERS(unistd.h) 81AC_CHECK_HEADERS(sys/param.h) 82AC_CHECK_HEADERS(sys/select.h) 83AC_CHECK_HEADERS(sys/filio.h) 84 85dnl Checks for the MingW32 compiler environment. If present, sets shell 86dnl variable MINGW32 to 'yes'. If not present, sets MINGW32 to the 87dnl empty string. 88AC_MINGW32() 89 90dnl Check to see if they specified MingW32 location 91AC_ARG_WITH(mingw32,[ --with-mingw32[=DIR] MingW32 installation location]) 92 93dnl Checks for the Cygwin environment. If present, sets shell variable 94dnl CYGWIN to 'yes'; if not present, sets CYGWIN to the empty string. 95AC_CYGWIN() 96 97dnl Clear out the X11 flags for the case where we're cross-compiling 98dnl for i586-mingw32 targets under Unix. 99if test "x$CYGWIN" = "xyes" -o "x$MINGW32" = "xyes" ; then 100X_CFLAGS="" 101X_LIBS="" 102fi 103 104dnl Byte order 105if test "x$CYGWIN" = "xyes" -o "x$MINGW32" = "xyes" ; then 106dnl For Win32 X86 => little endian. 107FOX_BYTEORDER=0 108AC_SUBST(FOX_BYTEORDER) 109else 110AC_C_BIGENDIAN 111if test "x$ac_cv_c_bigendian" = "xyes"; then 112FOX_BYTEORDER=1 113else 114FOX_BYTEORDER=0 115fi 116AC_SUBST(FOX_BYTEORDER) 117fi 118 119 120if test "x$CYGWIN" = "xyes" -o "x$MINGW32" = "xyes" ; then 121AC_DEFINE(WIN32) 122LIBS="${LIBS} -lcomctl32 -lwsock32 -lwinspool -lmpr" 123LDFLAGS="${LDFLAGS} -mwindows -e _mainCRTStartup" 124if test "x$with_mingw32" != "x" ; then 125CPPFLAGS="${CPPFLAGS} -I$with_mingw32/include" 126LIBS="${LIBS} -L$with_mingw32/lib" 127fi 128X_BASE_LIBS="" 129else 130X_BASE_LIBS="-lXext -lX11" 131fi 132AC_SUBST(X_BASE_LIBS) 133AC_EXEEXT 134 135dnl Checks for QNX (Dustin Graves <dgraves@computer.org>) 136AC_MSG_CHECKING(for QNX environment) 137case "$host_os" in 138 *-qnx*) 139 AC_MSG_RESULT(yes) 140 dnl Check g++ for -fno-builtin dependency 141 if test "${GXX}" = "yes" ; then 142 AC_LANG_SAVE 143 AC_LANG_CPLUSPLUS 144 AC_MSG_CHECKING(if QNX C++ compiler requires -fno-builtin) 145 AC_CACHE_VAL(ac_cv_no_builtin, 146 [AC_TRY_COMPILE([#include<stdlib.h> 147 #include<math.h> 148 #include<string.h>], 149 [return 0;], 150 [ac_cv_no_builtin=false], 151 [ac_cv_no_builtin=true])]) 152 if test "$ac_cv_no_builtin" = true ; then 153 CXXFLAGS="${CXXFLAGS} -fno-builtin" 154 AC_MSG_RESULT(yes) 155 else 156 AC_MSG_RESULT(no) 157 fi 158 AC_LANG_RESTORE 159 fi 160 ;; 161 *) 162 AC_MSG_RESULT(no) 163esac 164 165 166dnl Checks for the Sun WorkShop Compiler 167AC_MSG_CHECKING(for Sun WorkShop C++) 168if $CXX -V 2>&1 | egrep 'WorkShop Compilers 4.2' > /dev/null; then 169AC_MSG_RESULT(4.2) 170CXXFLAGS="${CXXFLAGS} -instances=global -features=anachronisms" 171elif $CXX -V 2>&1 | egrep 'WorkShop Compilers 5.0' > /dev/null; then 172AC_MSG_RESULT(5.0) 173CXXFLAGS="${CXXFLAGS} -instances=global -features=anachronisms,no%conststrings" 174elif $CXX -V 2>&1 | egrep 'Sun WorkShop 6' > /dev/null; then 175AC_MSG_RESULT(Forte6) 176CXXFLAGS="${CXXFLAGS} -instances=global -features=anachronisms,no%conststrings" 177else 178AC_MSG_RESULT(no) 179fi 180 181 182dnl Check for Xft2 support 183AC_MSG_CHECKING(for Xft support) 184AC_ARG_WITH(xft,[ --with-xft enable Xft support]) 185AC_MSG_RESULT([$with_xft]) 186if test "x$with_xft" = "xyes"; then 187FTCFLAGS=`freetype-config --cflags` 188FTLIBX=`freetype-config --libs` 189XFTCFLAGS=`xft-config --cflags` 190XFTLIBS=`xft-config --libs` 191saved_cppflags="${CXXFLAGS}" 192CXXFLAGS="${CXXFLAGS} -DHAVE_XFT_H=1 $FTCFLAGS $XFTCFLAGS" 193X_BASE_LIBS="${X_BASE_LIBS} $FTLIBS $XFTLIBS" 194fi 195 196 197dnl Check for XShape support 198AC_ARG_ENABLE(shape,[ --with-shape enable XShape support]) 199AC_MSG_RESULT([$with_shape]) 200if test "x$with_shape" != "xno"; then 201AC_CHECK_HEADER(X11/extensions/shape.h,CXXFLAGS="${CXXFLAGS} -DHAVE_XSHAPE_H=1") 202fi 203 204 205dnl Check for XShm support 206AC_ARG_ENABLE(xshm,[ --with-xshm compile with XShm support]) 207AC_MSG_RESULT([$with_xshm]) 208if test "x$with_xshm" != "xno"; then 209XSHM="-DHAVE_XSHM_H=1" 210AC_CHECK_HEADER(X11/extensions/XShm.h,,XSHM="") 211AC_CHECK_HEADER(sys/ipc.h,,XSHM="") 212AC_CHECK_HEADER(sys/shm.h,,XSHM="") 213CXXFLAGS="${CXXFLAGS} ${XSHM}" 214fi 215 216 217dnl Using reentrant library calls 218AC_MSG_CHECKING(for thread-safe library calls) 219AC_ARG_ENABLE(xthreads,[ --enable-threadsafe Thread-safe library calls]) 220AC_MSG_RESULT([$enable_threadsafe]) 221if test "x$enable_threadsafe" != "xno" ; then 222CXXFLAGS="${CXXFLAGS} -DFOX_THREAD_SAFE=1 -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT" 223fi 224 225dnl Find posix thread library 226if test "x$MINGW32" != "xyes" ; then 227AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not available ***])) 228PTHREAD_LIBS=notfound 229if test "x$PTHREAD_LIBS" = xnotfound; then 230AC_CHECK_LIB(pthread, pthread_exit, PTHREAD_LIBS="-lpthread") 231fi 232if test "x$PTHREAD_LIBS" = xnotfound; then 233AC_CHECK_LIB(pthreads, pthread_exit, PTHREAD_LIBS="-lpthreads") 234fi 235if test "x$PTHREAD_LIBS" = xnotfound; then 236AC_CHECK_LIB(c_r, pthread_exit, PTHREAD_LIBS="-lc_r") 237fi 238if test "x$PTHREAD_LIBS" = xnotfound; then 239AC_CHECK_FUNC(pthread_exit, PTHREAD_LIBS="") 240fi 241if test "x$PTHREAD_LIBS" = xnotfound; then 242AC_MSG_ERROR(*** Unable to locate working posix thread library ***) 243fi 244CXXFLAGS="${CXXFLAGS} -D_GNU_SOURCE" 245LIBS="${LIBS} $PTHREAD_LIBS" 246fi 247 248dnl Semaphore init 249AC_CHECK_LIB(rt,sem_init,LIBS="${LIBS} -lrt") 250 251dnl Check for JPEG Image support 252AC_ARG_ENABLE(jpeg,[ --disable-jpeg compile without JPEG image support]) 253AC_MSG_RESULT([$enable_jpeg]) 254if test "x$enable_jpeg" != "xno"; then 255AC_CHECK_HEADER(jpeglib.h,CXXFLAGS="${CXXFLAGS} -DHAVE_JPEG_H=1"; LIBS="${LIBS} ${LIBJPEG:=-ljpeg}") 256fi 257 258 259dnl Check for PNG Image support; note zlib is needed for PNG 260AC_ARG_ENABLE(png,[ --disable-png compile without PNG image support]) 261AC_MSG_RESULT([$enable_png]) 262if test "x$enable_png" != "xno"; then 263AC_CHECK_HEADERS(png.h,CXXFLAGS="${CXXFLAGS} -DHAVE_PNG_H=1"; LIBS="${LIBS} ${LIBPNG:=-lpng}") 264fi 265 266 267dnl Check for TIFF Image support; note zlib is needed for TIFF 268AC_ARG_ENABLE(tiff,[ --disable-tiff compile without TIFF image support]) 269AC_MSG_RESULT([$enable_tiff]) 270if test "x$enable_tiff" != "xno"; then 271AC_CHECK_HEADERS(tiff.h,CXXFLAGS="${CXXFLAGS} -DHAVE_TIFF_H=1"; LIBS="${LIBS} ${LIBTIFF:=-ltiff}") 272fi 273 274 275dnl Check for libz compression library 276AC_ARG_ENABLE(zlib,[ --disable-zlib compile without zlib support]) 277AC_MSG_RESULT([$enable_zlib]) 278if test "x$enable_zlib" != "xno"; then 279AC_CHECK_HEADERS(zlib.h,CXXFLAGS="${CXXFLAGS} -DHAVE_ZLIB_H=1"; LIBS="${LIBS} ${LIBZ:=-lz}") 280fi 281 282 283dnl Check for bzip2 compression library 284AC_ARG_ENABLE(bz2lib,[ --disable-bz2lib compile without bz2lib support]) 285AC_MSG_RESULT([$enable_bz2lib]) 286if test "x$enable_bz2lib" != "xno"; then 287AC_CHECK_HEADERS(bzlib.h,CXXFLAGS="${CXXFLAGS} -DHAVE_BZ2LIB_H=1"; LIBS="${LIBS} ${LIBBZ2:=-lbz2}") 288fi 289 290 291dnl Check for Xcursor support 292AC_ARG_WITH(xcursor,[ --with-xcursor compile with Xcursor support]) 293AC_MSG_RESULT([$with_xcursor]) 294if test "x$with_xcursor" != "xno"; then 295AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,CXXFLAGS="${CXXFLAGS} -DHAVE_XCURSOR_H=1"; X_BASE_LIBS="${X_BASE_LIBS} -lXcursor") 296fi 297 298 299dnl Check for XRandR support 300AC_ARG_WITH(xrandr,[ --with-xrandr compile with XRandR support]) 301AC_MSG_RESULT([$with_xrandr]) 302if test "x$with_xrandr" != "xno"; then 303AC_CHECK_HEADER(X11/extensions/Xrandr.h,CXXFLAGS="${CXXFLAGS} -DHAVE_XRANDR_H=1"; X_BASE_LIBS="${X_BASE_LIBS} -lXrandr") 304fi 305 306 307dnl Add math lib if TIFF Image support 308if test "x$enable_tiff" != "xno"; then 309LIBS="${LIBS} ${MATHLIB:=-lm}" 310fi 311 312dnl Check vsscanf 313AC_CHECK_FUNCS(vsscanf vsnprintf strtoll strtoull) 314 315dnl Checking for socket libraries. 316SOCKLIBS="" 317AC_CHECK_LIB(socket,socket, if test "$uname" != "IRIX"; then SOCKLIBS="-lsocket"; fi) 318AC_CHECK_LIB(nsl,gethostbyaddr,if test "$uname" != "IRIX"; then SOCKLIBS="${SOCKLIBS} -lnsl"; fi) 319 320dnl Check for dynamic loader 321AC_CHECK_LIB(dl, dlopen) 322AC_CHECK_LIB(dld, shl_load) 323 324dnl Checking for CUPS 325AC_MSG_CHECKING(for CUPS support) 326AC_ARG_ENABLE(cups,[ --enable-cups compile with CUPS support]) 327AC_MSG_RESULT([$enable_cups]) 328if test "x$enable_cups" = "xyes"; then 329CUPSLIBS="" 330AC_CHECK_LIB(cups,httpConnect,CUPSLIBS="-lcups") 331dnl For the moment, we only need to link to socket libraries when linking with cups 332AC_CHECK_HEADER(cups/cups.h,if test "x${CUPSLIBS}" != "x"; then CXXFLAGS="${CXXFLAGS} -DHAVE_CUPS_H=1"; LIBS="${LIBS} ${CUPSLIBS} ${SOCKLIBS}"; fi) 333fi 334 335 336dnl Add copious amounts of debugging with gcc, egcs, etc 337if test "${GXX}" = "yes" ; then 338CXXFLAGS="${CXXFLAGS} -Wall -W -Woverloaded-virtual -Wformat" 339fi 340 341dnl Debugging turned on 342AC_MSG_CHECKING(for debugging) 343AC_ARG_ENABLE(debug,[ --enable-debug compile for debugging]) 344AC_MSG_RESULT([$enable_debug]) 345if test "x$enable_debug" = "xyes" ; then 346CXXFLAGS="${CXXFLAGS} -g -DDEBUG" 347fi 348 349dnl Building for release 350AC_MSG_CHECKING(for release build) 351AC_ARG_ENABLE(release,[ --enable-release compile for release]) 352AC_MSG_RESULT([$enable_release]) 353if test "x$enable_release" = "xyes" ; then 354CXXFLAGS="${CXXFLAGS} -O2 -DNDEBUG" 355if test "${GXX}" = "yes" ; then 356CXXFLAGS="${CXXFLAGS} -Wuninitialized -ffast-math -fno-strict-aliasing -finline-functions -fomit-frame-pointer -fexpensive-optimizations" 357fi 358fi 359 360dnl Enable profiling 361AC_MSG_CHECKING(for profiling) 362AC_ARG_WITH(profiling,[ --with-profiling choices are yes, no, or gprof]) 363AC_MSG_RESULT([$with_profiling]) 364if test "x$with_profiling" = "xyes" ; then 365CXXFLAGS="${CXXFLAGS} -p" 366elif test "x$with_profiling" = "xgprof" ; then 367CXXFLAGS="${CXXFLAGS} -pg" 368fi 369 370 371saved_cppflags="$CPPFLAGS" 372CPPFLAGS="$CPPFLAGS $X_CFLAGS" 373 374dnl Compile with 3D support 375dnl You have the option of NOT compiling with 3D support even if you have it 376AC_MSG_CHECKING(for OpenGL support) 377AC_ARG_WITH(opengl,[ --with-opengl choices are yes, no]) 378AC_MSG_RESULT([$with_opengl]) 379if test "x$with_opengl" != "xno" ; then 380if test "x$CYGWIN" = "xyes" -o "x$MINGW32" = "xyes" ; then 381AC_CHECK_HEADER(GL/gl.h,CXXFLAGS="${CXXFLAGS} -DHAVE_GL_H=1"; LIBS="${LIBS} ${LIBGL:=-lopengl32}") 382AC_CHECK_HEADER(GL/glu.h,CXXFLAGS="${CXXFLAGS} -DHAVE_GLU_H=1"; LIBS="${LIBS} ${LIBGLU:=-lglu32}") 383GL_TESTS="gltest.exe glviewer.exe" 384else 385AC_CHECK_HEADER(GL/gl.h,CXXFLAGS="${CXXFLAGS} -DHAVE_GL_H=1"; LIBS="${LIBS} ${LIBGL:=-lGL}") 386AC_CHECK_HEADER(GL/glu.h,CXXFLAGS="${CXXFLAGS} -DHAVE_GLU_H=1"; LIBS="${LIBS} ${LIBGLU:=-lGLU}") 387GL_TESTS="gltest glviewer" 388fi 389fi 390 391CPPFLAGS="$saved_cppflags" 392 393 394AC_SUBST(GL_LIBS) 395AC_SUBST(GL_TESTS) 396 397 398dnl Done. 399AC_OUTPUT(Makefile 400utils/Makefile 401include/Makefile 402include/fxver.h 403src/Makefile 404src/version.rc 405chart/Makefile 406doc/Makefile 407doc/art/Makefile 408doc/screenshots/Makefile 409tests/Makefile 410adie/Makefile 411shutterbug/Makefile 412pathfinder/Makefile 413calculator/Makefile 414windows/Makefile 415fox.spec 416fox-config) 417 418echo "" 419echo "Configure finished!" 420echo " Do: 'make' to compile FOX." 421echo " Then: 'make install' to install it." 422echo "" 423 424