1 dnl Process this file with autogen.sh to produce a working configure
4 AC_INIT(SimGear, m4_esyscmd([cat ./version | tr -d '\n']), [http://www.flightgear.org])
6 dnl Ensure touching the version causes autoconf to re-run
7 AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/version'])
9 AC_CONFIG_SRCDIR([simgear/bucket/newbucket.cxx])
11 dnl Require at least automake 2.52
14 dnl Initialize the automake stuff
15 dnl Specify KAI C++ compiler and flags.
16 dnl Borrowed with slight modification from blitz distribution.
18 [ --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
20 KCC*) # KAI C++ http://www.kai.com/
21 echo "Configuring for KAI C++"
22 AC_SG_SET_COMPILER($withval,"KCC","--restrict --strict_warnings")
23 CXX_OPTIMIZE_FLAGS=="+K3 -O3"
24 CXX_DEBUG_FLAGS="-g +K0"
28 dnl set the $host variable based on local machine/os
30 AM_INIT_AUTOMAKE([dist-bzip2])
32 AC_ARG_ENABLE(headless,
33 AS_HELP_STRING([--enable-headless],[Enable only packages for headless build]))
35 AC_MSG_CHECKING([for headless mode])
36 AC_MSG_RESULT([$enable_headless])
38 AM_CONDITIONAL(WANT_HEADLESS,[test "x$enable_headless" = "xyes"])
40 AC_MSG_CHECKING([CXX])
45 dnl Checks for programs.
54 AX_BOOST_BASE([1.37.0])
56 if test "x$BOOST_CPPFLAGS" != "x-I/usr/include" ; then
57 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
60 dnl set the $host variable based on local machine/os
63 dnl Used on the Irix platform
66 if test "x$CXX" = "xCC" -o "x$CXX" = "xccache CC"; then
69 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro740"
70 compatibility_DIR="compatibility"
71 MIPSpro_DIRS="MIPSpro740"
72 AC_MSG_CHECKING([for MIPSpro compiler version 7.4 or newer])
75 if ( _COMPILER_VERSION < 740 ) {
81 ], AC_MSG_RESULT(yes),
83 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro721"
84 MIPSpro_DIRS="$(MIPSpro_DIRS) MIPSpro721"
85 AC_MSG_WARN([Using our own subset of the STL headers])
86 ], AC_MSG_RESULT(yes))
87 AC_SUBST(MIPSpro_DIRS)
98 AC_SUBST(compatibility_DIR)
100 # Show all compiler warnings by default
101 CXXFLAGS="$CXXFLAGS -Wall"
102 CFLAGS="$CFLAGS -Wall"
104 if echo $includedir | egrep "simgear$" > /dev/null; then
105 echo "includedir is" $includedir "libdir is" $libdir
107 includedir="${includedir}/simgear"
108 echo "includedir changed to" $includedir "libdir is" $libdir
111 dnl set logging; default value of with_logging=yes
112 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
113 if test "x$with_logging" = "xno" ; then
114 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
117 # Specify if we want to build with Norman's jpeg image server support.
118 # This requires libjpeg to be installed and available.
119 # Default to with_jpeg_server=no
121 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
122 if test "x$with_jpeg_factory" = "xyes" ; then
123 echo "Building with Norman's jpeg image factory support"
124 AC_CHECK_LIB(jpeg, jpeg_start_compress)
125 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
127 echo "In order to build the jpeg factory code you need libjpeg installed."
128 echo "otherwise please configure with the --with-jpeg-sever=no option"
130 echo "libjpeg is available at :"
131 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
135 echo "Building without Norman's jpeg image server support"
137 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
139 # specify the osg location
140 AC_ARG_WITH(osg, [ --with-osg=PREFIX Specify the prefix path to osg])
142 if test "x$with_osg" != "x" ; then
143 echo "osg prefix is $with_osg"
144 EXTRA_DIRS="${EXTRA_DIRS} $with_osg"
147 AC_ARG_WITH(osg_framework, [ --with-osg-framework=PREFIX Specify the prefix path to OSG.framework ])
149 if test "x$with_osg_framework" != "x"; then
150 echo "osg framework prefix is $with_osg_framework"
151 CPPFLAGS = "$CPPFLAGS -F$with-osg-framework"
152 export DYLD_FRAMEWORK_PATH="$DYLD_FRAMEWORK_PATH:$with_osg_framework"
155 dnl specifying ALUT.framework (for user provided ALUT.framework)
156 AC_ARG_WITH(alut_framework, [ --with-alut-framework=PREFIX Specify the prefix path to ALUT.framework ])
158 if test "x$with_alut_framework" != "x"; then
159 echo "ALUT framework prefix is $with_alut_framework"
162 # specify the rti13 location
163 AC_ARG_WITH(rti13, [ --with-rti13=PREFIX Specify the prefix path to a HLA13 rti])
165 if test "x$with_rti13" != "x" ; then
166 echo "rti13 prefix is $with_rti13"
167 EXTRA_DIRS="${EXTRA_DIRS} $with_rti13"
170 # specify the rti13 location
171 AC_ARG_WITH(rti1516, [ --with-rti1516=PREFIX Specify the prefix path to a HLA1516 rti])
173 if test "x$with_rti1516" != "x" ; then
174 echo "rti1516 prefix is $with_rti1516"
175 EXTRA_DIRS="${EXTRA_DIRS} $with_rti1516"
178 dnl Determine an extra directories to add to include/lib search paths
180 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
181 echo no EXTRA_DIRS for $host
185 if test -d /usr/X11R6 ; then
186 EXTRA_DIR1="/usr/X11R6"
188 if test -d /opt/X11R6 ; then
189 EXTRA_DIR2="/opt/X11R6"
191 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2"
195 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
198 dnl Using AM_CONDITIONAL is a step out of the protected little
199 dnl automake fold so it is potentially dangerous. But, we are
200 dnl beginning to run into cases where the standard checks are not
201 dnl enough. AM_CONDITIONALS are then referenced to conditionally
202 dnl build a Makefile.in from a Makefile.am which lets us define custom
203 dnl includes, compile alternative source files, etc.
205 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
206 dnl to use it if it is.
208 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
209 echo no fancy X11 check
218 dnl Checks for libraries.
220 dnl Thread related checks
221 AC_CHECK_HEADER(pthread.h)
222 AC_SEARCH_LIBS(pthread_exit, [pthread c_r])
223 if test "x$ac_cv_header_pthread_h" = "xyes"; then
224 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
225 CFLAGS="$CFLAGS -D_REENTRANT"
227 if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
228 CXXFLAGS="-pthread $CXXFLAGS"
229 CFLAGS="-pthread $CFLAGS"
233 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_header_pthread_h" = "xyes")
238 dnl search for network related libraries
239 AC_SEARCH_LIBS(inet_addr, xnet)
240 AC_SEARCH_LIBS(socket, socket)
245 dnl check for some default libraries
246 AC_SEARCH_LIBS(cos, m)
247 AC_SEARCH_LIBS(clock_gettime, rt)
251 dnl check for OpenGL related libraries
253 *-*-cygwin* | *-*-mingw32*)
254 dnl CygWin under Windoze.
256 echo Win32 specific hacks...
257 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
258 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
260 LIBS="$LIBS -lglu32 -lopengl32"
261 LIBS="$LIBS -luser32 -lgdi32 -lwinmm"
263 dnl add -lwsock32 for mingwin
266 base_LIBS="$base_LIBS -lws2_32"
270 echo "Will link apps with $LIBS"
276 LIBS="$LIBS -framework OpenGL -framework Carbon -lobjc"
280 dnl X-Windows based machines
282 AC_SEARCH_LIBS(XCreateWindow, X11)
283 AC_SEARCH_LIBS(XShmCreateImage, Xext)
284 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
285 AC_SEARCH_LIBS(IceOpenConnection, ICE)
286 AC_SEARCH_LIBS(SmcOpenConnection, SM)
287 AC_SEARCH_LIBS(XtMalloc, Xt)
288 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
290 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
291 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
292 dnl if GLcore found, then also check for GL
293 AC_SEARCH_LIBS(glXCreateContext, GL)
296 dnl if using mesa, check for xmesa.h
297 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
298 AC_CHECK_HEADER(GL/fxmesa.h)
299 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
300 AC_DEFINE([XMESA], 1, [Define for fxmesa])
301 AC_DEFINE([FX], 1, [Define for fxmesa])
305 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
313 dnl check for OpenAL libraries
317 *-*-cygwin* | *-*-mingw32*)
318 dnl CygWin under Windoze.
319 INCLUDES="$INCLUDES -I/usr/local/include/"
320 LIBS="$LIBS -L/usr/local/lib"
321 AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal 'openal -ldsound -lwinmm' ] )
322 AC_SEARCH_LIBS(alutInit, [ openal32 ALut alut ] )
323 LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
325 OPENAL_OK="$ac_cv_search_alGenBuffers"
326 ALUT_OK="$ac_cv_search_alutInit"
332 LIBS="$LIBS -framework IOKit -framework OpenAL -framework ALUT"
335 if test "x$with_openal_lib" != "x"; then
336 echo "libopenal is not supported on Mac OS platform."
340 AC_CHECK_HEADERS([OpenAL/al.h],[OPENAL_OK="yes"])
342 AC_CHECK_HEADERS([ALUT/alut.h],[ALUT_OK="yes"])
344 dnl Thank you Christian Bauer from SheepSaver
345 dnl Modified by Tatsuhiro Nishioka for accepting a given framework path
346 dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES, $3=FRAMEWORK_PATH, $4=ACTION_IF_TRUE) ; $3 is optional
347 AC_DEFUN([AC_CHECK_FRAMEWORK], [
348 AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
349 AC_CACHE_CHECK([whether compiler supports framework $1],
352 FRAMEWORKS="$FRAMEWORKS -framework $1"
353 if test "$3" = ""; then
354 FRAMEWORKS="$FRAMEWORKS $ADD2LD"
355 elif test "`echo $FRAMEWORKS | grep -- -F$3`" = ""; then
356 FRAMEWORKS="$FRAMEWORKS -F$3"
357 CXXFLAGS="$CXXFLAGS -F$3"
358 CPPFLAGS="$CPPFLAGS -F$3"
359 CCFLAGS="$CCFLAGS -F$3"
360 dnl This is needed for AC_TRY_LINK when a framework path is specified
361 export DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}:$3"
365 [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
368 AS_IF([test AS_VAR_GET(ac_Framework) = yes],
369 [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
371 AS_IF([test AS_VAR_GET(ac_Framework) = yes], $4)
373 AS_VAR_POPDEF([ac_Framework])dnl
376 dnl Check for ALUT.framework when --with-alut-framework is specified
377 if test "x$with_alut_framework" != "x"; then
378 AC_CHECK_FRAMEWORK(ALUT, [#include <ALUT/alut.h>], $with_alut_framework, [ALUT_OK="yes"])
384 dnl default unix style machines
387 LIBS="$LIBS $thread_LIBS"
388 AC_SEARCH_LIBS(alGenBuffers, openal)
389 AC_SEARCH_LIBS(alutInit, [ alut openal ] )
390 OPENAL_OK="$ac_cv_search_alGenBuffers"
391 ALUT_OK="$ac_cv_search_alutInit"
398 if test "$OPENAL_OK" == "no" -a "x$enable_headless" != "xyes"; then
400 echo "You *must* have the openal library installed on your system to build"
403 echo "Please see README.OpenAL for more details."
405 echo "configure aborted."
409 if test "$ALUT_OK" == "no" -a "x$enable_headless" != "xyes"; then
411 echo "You *must* have the alut library installed on your system to build"
414 echo "Please see README.OpenAL for more details."
416 echo "configure aborted."
425 AC_SUBST(openal_LIBS)
426 AC_SUBST(opengl_LIBS)
427 AC_SUBST(thread_LIBS)
428 AC_SUBST(network_LIBS)
430 dnl Check for MS Windows environment
431 AC_CHECK_HEADER(windows.h)
432 AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
434 # The following are C++ items that need to be tested for with the c++
443 if test "x$with_osg_framework" != "x"; then
444 # AC_CHECK_FRAMEWORK(osgViewer, [#include <osgViewer/Version>], $with_osg_framework)
445 # AC_CHECK_FRAMEWORK(osgGA, [#include <osgGA/Version>], $with_osg_framework)
446 # AC_CHECK_FRAMEWORK(osgText, [#include <osgText/Version>], $with_osg_framework)
447 # AC_CHECK_FRAMEWORK(osgFX, [#include <osgFX/AnisotropicLighting>], $with_osg_framework)
448 # AC_CHECK_FRAMEWORK(osgUtil, [#include <osgUtil/Version>], $with_osg_framework)
449 # AC_CHECK_FRAMEWORK(osgDB, [#include <osgDB/Version>], $with_osg_framework)
450 # AC_CHECK_FRAMEWORK(osgSim, [#include <osgSim/Version>], $with_osg_framework)
451 # AC_CHECK_FRAMEWORK(osgParticle, [#include <osgParticle/Version>], $with_osg_framework)
452 AC_CHECK_FRAMEWORK(osg, [#include <osg/Version>], $with_osg_framework)
453 # osg_FRAMEWORKS="$FRAMEWORKS"
455 # AC_SUBST(osg_FRAMEWORKS)
456 AC_CHECK_FRAMEWORK(OpenThreads, [#include <OpenThreads/Version>], $with_osg_framework)
457 openthreads_FRAMEWORK="$FRAMEWORKS"
459 AC_SUBST(openthreads_FRAMEWORK)
462 dnl This is needed when osg dynamic libs are specified
463 dnl instead of OSG frameworks on Mac OS X
465 AC_CHECK_LIB(OpenThreads,OpenThreadsGetVersion)
469 if test "x$enable_osgdebug" = "xyes"; then
470 AC_CHECK_LIB(OpenThreadsd,OpenThreadsGetVersion)
472 AC_CHECK_LIB(OpenThreads,OpenThreadsGetVersion)
477 AM_CONDITIONAL(HAVE_FRAMEWORK_OSG, test "x$ac_cv_framework_osg" != "x")
479 AC_CHECK_HEADER(osg/Version)
481 if test "x$ac_cv_header_osg_Version" != "xyes" -o "x$ac_cv_lib_OpenThreads_OpenThreadsGetVersion" != "xyes"; then
482 if test "x$ac_cv_framework_osg" != "xyes"; then
484 echo "You *must* have the OpenThreads library installed on your system"
485 echo "to build this version of SimGear!"
486 echo " Maybe you need to specify --with-osg=DIR."
487 echo " Maybe you need to specify some LDFLAGS to help the linker."
489 echo " LIBS: '$LIBS'"
490 echo " LDFLAGS: '$LDFLAGS'"
491 echo " CPPFLAGS: '$CPPFLAGS'"
493 echo "Please see README.OSG for more details."
495 echo "configure aborted."
500 AC_CHECK_HEADER(boost/version.hpp)
501 if test "x$ac_cv_header_boost_version_hpp" != "xyes"; then
503 echo "You *must* have the Boost library installed on your system"
504 echo "to build this version of SimGear!"
506 echo " LIBS: '$LIBS'"
507 echo " LDFLAGS: '$LDFLAGS'"
508 echo " CPPFLAGS: '$CPPFLAGS'"
510 echo "configure aborted."
514 dnl Check for a HLA13 rti.
515 dnl This is really tricky because of the ancient iostream stuff in RTI13
516 saved_CPPFLAGS="$CPPFLAGS"
517 CPPFLAGS="$CPPFLAGS -DRTI_USES_STD_FSTREAM"
518 AC_CHECK_HEADER(RTI.hh)
519 CPPFLAGS="${saved_CPPFLAGS}"
521 dnl Up to now only RTI13
522 AM_CONDITIONAL(ENABLE_HLA, test "x$ac_cv_header_RTI_hh" = "xyes")
523 AM_CONDITIONAL(ENABLE_HLA13, test "x$ac_cv_header_RTI_hh" = "xyes")
527 dnl Check for system installed zlib
528 AC_CHECK_HEADER(zlib.h)
529 if test "x$ac_cv_header_zlib_h" != "xyes"; then
531 echo "zlib library not found."
533 echo "If your OS does not provide an installable package for zlib"
534 echo "you will have to compile and install it first yourself. A copy"
535 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
536 echo "have to untar this source code, and follow its included instructions"
537 echo "to compile and install on your system."
539 echo "configure aborted."
543 dnl Check for Subversion library support
544 # libsvn support defaults to yes
546 save_CPPFLAGS=$CPPFLAGS
547 AC_ARG_WITH(libsvn, [ --without-libsvn Do not use built-in subversion (libsvn) for simgear [default=no]], [], [with_libsvn=yes])
548 if test "x$with_libsvn" = "xyes"; then
549 LIBS="`apr-1-config --link-ld`"
550 CPPFLAGS="-I/usr/include/subversion-1 `apr-1-config --includes --cppflags`"
551 AC_CHECK_HEADERS([svn_client.h])
552 if test "x$ac_cv_header_svn_client_h" = "xyes"; then
553 echo "Using built-in subversion (libsvn) for scenery downloads."
554 AC_SEARCH_LIBS(svn_client_checkout, svn_client-1,
555 [AC_DEFINE([HAVE_LIBSVN_CLIENT_1], [1], [Define to 1 if you have libsvn_client-1])],
556 [AC_MSG_ERROR(svn_client-1 library not found.)],)
557 AC_SEARCH_LIBS(svn_cmdline_init, svn_subr-1, , [AC_MSG_ERROR(svn_subr-1 library not found.)],)
558 AC_SEARCH_LIBS(svn_ra_initialize, svn_ra-1, , [AC_MSG_ERROR(svn_ra-1 library not found.)],)
560 svn_CPPFLAGS=$CPPFLAGS
562 AC_SUBST(svn_CPPFLAGS)
564 echo "Libsvn not found. Will use command line subversion for scenery downloads."
569 echo "Libsvn explicitly disabled. Will use command line subversion for scenery downloads."
574 CPPFLAGS=$save_CPPFLAGS
576 dnl Checks for header files.
579 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
580 sys/stat.h sys/time.h sys/timeb.h unistd.h values.h )
582 if test "x$ac_cv_header_stdint_h" = "xyes"; then
583 AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
586 dnl Checks for typedefs, structures, and compiler characteristics.
593 dnl Checks for library functions.
595 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
599 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
600 random drand48 setitimer getitimer signal GetLocalTime rint getrusage ] )
603 AM_CONFIG_HEADER(simgear/simgear_config.h)
610 simgear/compatibility/Makefile \
611 simgear/compatibility/MIPSpro721/Makefile \
612 simgear/compatibility/MIPSpro740/Makefile \
613 simgear/bucket/Makefile \
614 simgear/debug/Makefile \
615 simgear/ephemeris/Makefile \
616 simgear/hla/Makefile \
617 simgear/io/Makefile \
618 simgear/magvar/Makefile \
619 simgear/math/Makefile \
620 simgear/environment/Makefile \
621 simgear/misc/Makefile \
622 simgear/nasal/Makefile \
623 simgear/props/Makefile \
624 simgear/route/Makefile \
625 simgear/scene/Makefile \
626 simgear/scene/bvh/Makefile \
627 simgear/scene/material/Makefile \
628 simgear/scene/model/Makefile \
629 simgear/scene/sky/Makefile \
630 simgear/scene/tgdb/Makefile \
631 simgear/scene/util/Makefile \
632 simgear/scene/tsync/Makefile \
633 simgear/screen/Makefile \
634 simgear/serial/Makefile \
635 simgear/sound/Makefile \
636 simgear/structure/Makefile \
637 simgear/threads/Makefile \
638 simgear/timing/Makefile \
639 simgear/xml/Makefile \
645 echo "Configure Summary"
646 echo "================="
648 echo "Prefix: $prefix"
650 if test "x$with_logging" != "x"; then
651 echo "Debug messages: $with_logging"
653 echo "Debug messages: yes"
656 echo -n "Automake version: "
657 automake --version | head -1
659 if test "x$with_jpeg_factory" = "xyes"; then
660 echo "With JPEG Factory support"
662 echo "Without JPEG Factory support"
665 if test "x$ac_cv_header_pthread_h" = "xyes"; then
666 echo "Threads: pthread lib found."
668 echo "Threads: no threads (pthread lib not found.)"