]> git.mxchange.org Git - simgear.git/blobdiff - configure.in
Tweaks ...
[simgear.git] / configure.in
index a764c4d0cac163785322dba4ec637327ad34a5ba..c27176f41741e90b3e87d0d861b43fa48dc32ce7 100644 (file)
@@ -3,28 +3,62 @@ dnl working configure script.
 dnl
 dnl $Id$
 
-AC_INIT(src/bucket/newbucket.cxx)
+AC_INIT(simgear/bucket/newbucket.cxx)
+
+# Require at least automake 2.13
+AC_PREREQ(2.13)
 
 dnl Initialize the automake stuff
-AM_INIT_AUTOMAKE(SimGear, 0.0.1)
+AM_INIT_AUTOMAKE(SimGear, 0.0.17)
+
+dnl Specify KAI C++ compiler and flags.
+dnl Borrowed with slight modification from blitz distribution.
+AC_ARG_WITH(cxx,
+  [  --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
+  [case "$withval" in
+    KCC*)    # KAI C++ http://www.kai.com/
+      echo "Configuring for KAI C++"
+      AC_SG_SET_COMPILER($withval,"KCC","--restrict --strict_warnings")
+      CXX_OPTIMIZE_FLAGS=="+K3 -O3"
+      CXX_DEBUG_FLAGS="-g +K0"
+    ;;
+  esac
+])
+
+echo CXX = $CXX
+echo CC = $CC
 
 dnl Checks for programs.
 AC_PROG_MAKE_SET
 AC_PROG_CC
+AC_PROG_CPP
 AC_PROG_CXX
 AC_PROG_RANLIB
 AC_PROG_INSTALL
 AC_PROG_LN_S
 
+AR="ar"
+OS=`uname -s`
+if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
+    if test "$CXX" = "CC"; then
+        AR="CC -ar"
+        AC_SUBST(AR)
+    fi
+fi
+
 if echo $includedir | egrep "simgear$" > /dev/null; then
     echo "includedir is" $includedir "libdir is" $libdir
 else
     includedir="${includedir}/simgear"
     echo "includedir changed to" $includedir "libdir is" $libdir
 fi
+         
+# Determine version of automake ... important because of
+# incompatibilities between versions
+AUTO_MAKE_VERSION=`automake --version | head -1 | awk '{print $4}' | sed -e 's/\-p[[0-9]]$//' | sed -e 's/\.//'`
+AM_CONDITIONAL(ANCIENT_AUTOMAKE, test $AUTO_MAKE_VERSION -lt 14)
+AM_CONDITIONAL(OLD_AUTOMAKE, test $AUTO_MAKE_VERSION -lt 15)
 
-
-dnl Specify if we want logging (testing build) or not (release build)
 # set logging default value
 # with_logging=yes
 AC_ARG_WITH(logging, [  --with-logging          Include logging output (default)])
@@ -32,29 +66,67 @@ if test "x$with_logging" = "xno" ; then
     AC_DEFINE(FG_NDEBUG)
 fi
 
-dnl specify if we are building with "checker"
+dnl specify if we are building with "electric fence"
 AC_ARG_WITH(efence, [  --with-efence           Specify if we are building with "electric-fence"])
 
 if test "x$with_efence" = "xyes" ; then
     echo "Building with efence"
-    LIBS= "$LIBS -lefence"
+    LIBS="$LIBS -lefence"
+fi
+
+# Specify if we want to build with Norman's jpeg image server support.
+# This requires libjpeg to be installed and available.
+# Default to with_jpeg_server=no
+JPEGLIB=''
+AC_ARG_WITH(jpeg_factory, [  --with-jpeg-factory     Include Norman's jpeg image factory support code])
+if test "x$with_jpeg_factory" = "xyes" ; then
+    echo "Building with Norman's jpeg image factory support"
+    AC_CHECK_LIB(jpeg, jpeg_start_compress)
+    if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
+        echo
+        echo "In order to build the jpeg factory code you need libjpeg installed."
+        echo "otherwise please configure with the --with-jpeg-sever=no option"
+        echo
+        echo "libjpeg is available at :"
+        echo "  ftp://ftp.uu.net in the directory graphics/jpeg"
+        exit 1
+    fi
+else
+    echo "Building without Norman's jpeg image server support"
 fi
+AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
+
 
 dnl Check for MS Windows environment
 AC_CHECK_HEADER(windows.h)
 
-dnl extra library and include directories
-EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6"
+AC_EGREP_CPP(yes,
+[#ifdef __MINGW32__
+ yes
+ #endif
+],is_mingw=yes, is_mingw=no)
 
-if test -d /opt/X11R6 ; then
-     EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
-fi
+echo "IS_MINGW = $is_mingw"
+AM_CONDITIONAL(IS_MINGW, test "x$is_mingw" = "xyes")
+
+AC_EGREP_CPP(yes,
+[#ifdef __CYGWIN__
+ yes
+ #endif
+],is_cygwin=yes, is_cygwin=no)
+
+echo "IS_CYGWIN = $is_cygwin"
+AM_CONDITIONAL(IS_CYGWIN, test "x$is_cygwin" = "xyes")
+
+if test "x$HOSTTYPE" != "xmacintosh" -a "x$is_mingw" != "xyes"; then
+    dnl extra library and include directories
+    EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6"
 
-if test "x$ac_cv_header_windows_h" = "xyes" ; then
-    EXTRA_DIRS="${EXTRA_DIRS} `pwd`/Win32"
-# elif test `uname -s` = "SunOS" ; then
-#   EXTRA_DIRS="${EXTRA_DIRS} `pwd`/SunOS"
+    if test -d /opt/X11R6 ; then
+        EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
+    fi
 fi
+
 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
 
 dnl Using AM_CONDITIONAL is a step out of the protected little 
@@ -67,8 +139,11 @@ dnl includes, compile alternative source files, etc.
 dnl Enable serial support on Unix type systems
 AM_CONDITIONAL(ENABLE_UNIX_SERIAL, true)
 
-dnl Check for X11 (fancy)
-AC_PATH_XTRA
+dnl X11 might be installed on Mac OS X, don't want to use it if it is.
+if test "x$HOSTTYPE" != "xmacintosh" ; then
+    dnl Check for X11 (fancy)
+    AC_PATH_XTRA
+fi
 
 dnl Checks for libraries.
 
@@ -78,19 +153,35 @@ AC_CHECK_LIB(m, cos)
 
 base_LIBS="$LIBS"
 
+dnl Thread related checks
+AC_CHECK_LIB(pthread, pthread_exit)
+AC_CHECK_HEADER(pthread.h)
+if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
+    CXXFLAGS="$CXXFLAGS -D_REENTRANT"
+    CFLAGS="$CFLAGS -D_REENTRANT"
+fi
+AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
+
 AC_CHECK_LIB(socket, socket)
-AC_CHECK_LIB(X11, XCreateWindow)
-AC_CHECK_LIB(Xext, XShmCreateImage)
-AC_CHECK_LIB(Xi, XGetExtensionVersion)
-AC_CHECK_LIB(ICE, IceOpenConnection)
-AC_CHECK_LIB(SM, SmcOpenConnection)
-AC_CHECK_LIB(Xt, XtMalloc)
-AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
+
+dnl X11 might be installed, but we don't want to use it for OSX -dw-
+if test "x$HOSTTYPE" != "xmacintosh" ; then
+    AC_CHECK_LIB(X11, XCreateWindow)
+    AC_CHECK_LIB(Xext, XShmCreateImage)
+    AC_CHECK_LIB(Xi, XGetExtensionVersion)
+    AC_CHECK_LIB(ICE, IceOpenConnection)
+    AC_CHECK_LIB(SM, SmcOpenConnection)
+    AC_CHECK_LIB(Xt, XtMalloc)
+    AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
+fi
 
 dnl check for OpenGL related libraries
 
-if test "x$ac_cv_header_windows_h" != "xyes" ; then
-    dnl Reasonable stuff for non-windoze variants ... :-)
+if test "x$HOSTTYPE" = "xmacintosh" ; then
+    dnl Macintosh OSX
+    LIBS="$LIBS -framework OpenGL -framework GLUT"
+elif test "x$ac_cv_header_windows_h" != "xyes" ; then
+    dnl Reasonable stuff for X-Windows based machines
 
     AC_CHECK_LIB(GLcore, glNewList)
     if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
@@ -129,8 +220,7 @@ if test "x$ac_cv_header_windows_h" != "xyes" ; then
     AC_CHECK_LIB(glut, glutGameModeString)
     LIBS="$save_LIBS"
 else
-    dnl Win32 is a little wierd because it has to try to handle the various
-    dnl winbloze-isms.  We'll just do this manually for now.
+    dnl Win32 libs
 
     echo Win32 specific hacks...
     AC_DEFINE(WIN32)
@@ -156,6 +246,9 @@ else
 
     LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
     LIBS="$LIBS -luser32 -lgdi32"
+    if test "x$is_mingw" = "xyes" ; then
+        EXTRA_DIRS="${EXTRA_DIRS}"
+    fi
     echo "Will link apps with $LIBS"
 fi
 
@@ -196,18 +289,34 @@ if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
     exit
 fi
 
+dnl Check for system installed metakit
+AC_CHECK_HEADER(mk4.h)
+if test "x$ac_cv_header_mk4_h" != "xyes"; then
+    echo "Metakit not found, you will need to install this first."
+    echo "Please read the README.metakit for more information."
+    exit
+fi
+
+
+dnl Specify if we want logging (testing build) or not (release build)
+
 dnl Check for system installed zlib
 AC_CHECK_HEADER(zlib.h)
 if test "x$ac_cv_header_zlib_h" != "xyes"; then
-    echo "no zlib found, building."
+    echo "zlib not found, you will need to install this first."
+    echo "Please read the README.zlib for more information."
+    exit
 fi
-AM_CONDITIONAL(HAVE_ZLIB, test "x$ac_cv_header_zlib_h" = "xyes" )
 
 dnl Checks for header files.
 AC_HEADER_STDC
 AC_CHECK_HEADERS( \
-       fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
-        sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
+       fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
+       sys/stat.h sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
+
+if test "x$ac_cv_header_stdint_h" = "xyes"; then
+    AC_DEFINE( HAVE_STDINT_H )
+fi
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
@@ -221,24 +330,32 @@ AC_FUNC_VPRINTF
 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
        random setitimer getitimer signal GetLocalTime rint getrusage )
 
-AM_CONFIG_HEADER(src/include/config.h)
+AM_CONFIG_HEADER(simgear/simgear_config.h)
 
 AC_OUTPUT( \
-       VERSION \
        Makefile \
-       src/Makefile \
-       src/include/Makefile \
-       src/bucket/Makefile \
-       src/debug/Makefile \
-       src/math/Makefile \
-       src/misc/Makefile \
-       src/screen/Makefile \
-       src/serial/Makefile \
-       src/xgl/Makefile \
-       src/zlib/Makefile \
+       SimGear.spec \
+       simgear/Makefile \
+       simgear/version.h \
+       simgear/bucket/Makefile \
+       simgear/debug/Makefile \
+       simgear/ephemeris/Makefile \
+       simgear/io/Makefile \
+       simgear/magvar/Makefile \
+       simgear/math/Makefile \
+       simgear/metar/Makefile \
+       simgear/misc/Makefile \
+       simgear/route/Makefile \
+       simgear/screen/Makefile \
+       simgear/serial/Makefile \
+       simgear/sky/Makefile \
+       simgear/threads/Makefile \
+       simgear/timing/Makefile \
+       simgear/xgl/Makefile \
+       simgear/xml/Makefile \
 )
 
-AC_OUTPUT_COMMANDS([./mksymlinks.sh])
+# AC_OUTPUT_COMMANDS([])
 
 echo ""
 echo "Configure Summary"
@@ -257,3 +374,18 @@ if test "x$with_efence" != "x"; then
 else
     echo "Electric fence: no"
 fi
+
+echo -n "Automake version: ($AUTO_MAKE_VERSION) "
+automake --version | head -1
+
+if test "x$with_jpeg_factory" = "xyes"; then
+   echo "With JPEG Factory support"
+else
+   echo "Without JPEG Factory support"
+fi
+
+if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
+   echo "Threads: pthread lib found."
+else
+   echo "Threads: no threads (pthread lib not found.)"
+fi