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_ARG_ENABLE(osgdebug,
36 AS_HELP_STRING([--enable-osgdebug],[Enable debug OSG libraries]))
38 AC_MSG_CHECKING([for headless mode])
39 AC_MSG_RESULT([$enable_headless])
41 AM_CONDITIONAL(WANT_HEADLESS,[test "x$enable_headless" = "xyes"])
43 AC_MSG_CHECKING([CXX])
48 dnl Checks for programs.
57 AX_BOOST_BASE([1.37.0])
59 if test "x$BOOST_CPPFLAGS" != "x-I/usr/include" ; then
60 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
63 dnl set the $host variable based on local machine/os
66 dnl Used on the Irix platform
69 if test "x$CXX" = "xCC" -o "x$CXX" = "xccache CC"; then
72 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro740"
73 compatibility_DIR="compatibility"
74 MIPSpro_DIRS="MIPSpro740"
75 AC_MSG_CHECKING([for MIPSpro compiler version 7.4 or newer])
78 if ( _COMPILER_VERSION < 740 ) {
84 ], AC_MSG_RESULT(yes),
86 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro721"
87 MIPSpro_DIRS="$(MIPSpro_DIRS) MIPSpro721"
88 AC_MSG_WARN([Using our own subset of the STL headers])
89 ], AC_MSG_RESULT(yes))
90 AC_SUBST(MIPSpro_DIRS)
101 AC_SUBST(compatibility_DIR)
103 # Show all compiler warnings by default
104 CXXFLAGS="$CXXFLAGS -Wall"
105 CFLAGS="$CFLAGS -Wall"
107 if echo $includedir | egrep "simgear$" > /dev/null; then
108 echo "includedir is" $includedir "libdir is" $libdir
110 includedir="${includedir}/simgear"
111 echo "includedir changed to" $includedir "libdir is" $libdir
114 dnl set logging; default value of with_logging=yes
115 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
116 if test "x$with_logging" = "xno" ; then
117 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
120 # Specify if we want to build with Norman's jpeg image server support.
121 # This requires libjpeg to be installed and available.
122 # Default to with_jpeg_server=no
124 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
125 if test "x$with_jpeg_factory" = "xyes" ; then
126 echo "Building with Norman's jpeg image factory support"
127 AC_CHECK_LIB(jpeg, jpeg_start_compress)
128 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
130 echo "In order to build the jpeg factory code you need libjpeg installed."
131 echo "otherwise please configure with the --with-jpeg-sever=no option"
133 echo "libjpeg is available at :"
134 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
138 echo "Building without Norman's jpeg image server support"
140 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
142 # specify the osg location
143 AC_ARG_WITH(osg, [ --with-osg=PREFIX Specify the prefix path to osg])
145 if test "x$with_osg" != "x" ; then
146 echo "osg prefix is $with_osg"
147 EXTRA_DIRS="${EXTRA_DIRS} $with_osg"
150 AC_ARG_WITH(osg_framework, [ --with-osg-framework=PREFIX Specify the prefix path to OSG.framework ])
152 if test "x$with_osg_framework" != "x"; then
153 echo "osg framework prefix is $with_osg_framework"
154 CPPFLAGS = "$CPPFLAGS -F$with-osg-framework"
155 export DYLD_FRAMEWORK_PATH="$DYLD_FRAMEWORK_PATH:$with_osg_framework"
158 dnl specifying ALUT.framework (for user provided ALUT.framework)
159 AC_ARG_WITH(alut_framework, [ --with-alut-framework=PREFIX Specify the prefix path to ALUT.framework ])
161 if test "x$with_alut_framework" != "x"; then
162 echo "ALUT framework prefix is $with_alut_framework"
165 # specify the rti13 location
166 AC_ARG_WITH(rti13, [ --with-rti13=PREFIX Specify the prefix path to a HLA13 rti])
168 if test "x$with_rti13" != "x" ; then
169 echo "rti13 prefix is $with_rti13"
170 EXTRA_DIRS="${EXTRA_DIRS} $with_rti13"
173 # specify the rti13 location
174 AC_ARG_WITH(rti1516, [ --with-rti1516=PREFIX Specify the prefix path to a HLA1516 rti])
176 if test "x$with_rti1516" != "x" ; then
177 echo "rti1516 prefix is $with_rti1516"
178 EXTRA_DIRS="${EXTRA_DIRS} $with_rti1516"
181 dnl Determine an extra directories to add to include/lib search paths
183 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
184 echo no EXTRA_DIRS for $host
188 if test -d /usr/X11R6 ; then
189 EXTRA_DIR1="/usr/X11R6"
191 if test -d /opt/X11R6 ; then
192 EXTRA_DIR2="/opt/X11R6"
194 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2"
198 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
201 dnl Using AM_CONDITIONAL is a step out of the protected little
202 dnl automake fold so it is potentially dangerous. But, we are
203 dnl beginning to run into cases where the standard checks are not
204 dnl enough. AM_CONDITIONALS are then referenced to conditionally
205 dnl build a Makefile.in from a Makefile.am which lets us define custom
206 dnl includes, compile alternative source files, etc.
208 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
209 dnl to use it if it is.
211 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
212 echo no fancy X11 check
221 dnl Checks for libraries.
223 dnl Thread related checks
224 AC_CHECK_HEADER(pthread.h)
225 AC_SEARCH_LIBS(pthread_exit, [pthread c_r])
226 if test "x$ac_cv_header_pthread_h" = "xyes"; then
227 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
228 CFLAGS="$CFLAGS -D_REENTRANT"
230 if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
231 CXXFLAGS="-pthread $CXXFLAGS"
232 CFLAGS="-pthread $CFLAGS"
236 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_header_pthread_h" = "xyes")
241 dnl search for network related libraries
242 AC_SEARCH_LIBS(inet_addr, xnet)
243 AC_SEARCH_LIBS(socket, socket)
248 dnl check for some default libraries
249 AC_SEARCH_LIBS(cos, m)
250 AC_SEARCH_LIBS(clock_gettime, rt)
254 dnl check for OpenGL related libraries
256 *-*-cygwin* | *-*-mingw32*)
257 dnl CygWin under Windoze.
259 echo Win32 specific hacks...
260 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
261 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
263 LIBS="$LIBS -lglu32 -lopengl32"
264 LIBS="$LIBS -luser32 -lgdi32 -lwinmm"
266 dnl add -lwsock32 for mingwin
269 base_LIBS="$base_LIBS -lws2_32"
273 echo "Will link apps with $LIBS"
279 LIBS="$LIBS -framework OpenGL -framework Carbon -lobjc"
283 dnl X-Windows based machines
285 AC_SEARCH_LIBS(XCreateWindow, X11)
286 AC_SEARCH_LIBS(XShmCreateImage, Xext)
287 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
288 AC_SEARCH_LIBS(IceOpenConnection, ICE)
289 AC_SEARCH_LIBS(SmcOpenConnection, SM)
290 AC_SEARCH_LIBS(XtMalloc, Xt)
291 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
293 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
294 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
295 dnl if GLcore found, then also check for GL
296 AC_SEARCH_LIBS(glXCreateContext, GL)
299 dnl if using mesa, check for xmesa.h
300 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
301 AC_CHECK_HEADER(GL/fxmesa.h)
302 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
303 AC_DEFINE([XMESA], 1, [Define for fxmesa])
304 AC_DEFINE([FX], 1, [Define for fxmesa])
308 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
316 dnl check for OpenAL libraries
320 *-*-cygwin* | *-*-mingw32*)
321 dnl CygWin under Windoze.
322 INCLUDES="$INCLUDES -I/usr/local/include/"
323 LIBS="$LIBS -L/usr/local/lib"
324 AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal 'openal -ldsound -lwinmm' ] )
325 AC_SEARCH_LIBS(alutInit, [ openal32 ALut alut ] )
326 LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
328 OPENAL_OK="$ac_cv_search_alGenBuffers"
329 ALUT_OK="$ac_cv_search_alutInit"
335 LIBS="$LIBS -framework IOKit -framework OpenAL -framework ALUT"
338 if test "x$with_openal_lib" != "x"; then
339 echo "libopenal is not supported on Mac OS platform."
343 AC_CHECK_HEADERS([OpenAL/al.h],[OPENAL_OK="yes"])
345 AC_CHECK_HEADERS([ALUT/alut.h],[ALUT_OK="yes"])
347 dnl Thank you Christian Bauer from SheepSaver
348 dnl Modified by Tatsuhiro Nishioka for accepting a given framework path
349 dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES, $3=FRAMEWORK_PATH, $4=ACTION_IF_TRUE) ; $3 is optional
350 AC_DEFUN([AC_CHECK_FRAMEWORK], [
351 AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
352 AC_CACHE_CHECK([whether compiler supports framework $1],
355 FRAMEWORKS="$FRAMEWORKS -framework $1"
356 if test "$3" = ""; then
357 FRAMEWORKS="$FRAMEWORKS $ADD2LD"
358 elif test "`echo $FRAMEWORKS | grep -- -F$3`" = ""; then
359 FRAMEWORKS="$FRAMEWORKS -F$3"
360 CXXFLAGS="$CXXFLAGS -F$3"
361 CPPFLAGS="$CPPFLAGS -F$3"
362 CCFLAGS="$CCFLAGS -F$3"
363 dnl This is needed for AC_TRY_LINK when a framework path is specified
364 export DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}:$3"
368 [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
371 AS_IF([test AS_VAR_GET(ac_Framework) = yes],
372 [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
374 AS_IF([test AS_VAR_GET(ac_Framework) = yes], $4)
376 AS_VAR_POPDEF([ac_Framework])dnl
379 dnl Check for ALUT.framework when --with-alut-framework is specified
380 if test "x$with_alut_framework" != "x"; then
381 AC_CHECK_FRAMEWORK(ALUT, [#include <ALUT/alut.h>], $with_alut_framework, [ALUT_OK="yes"])
387 dnl default unix style machines
390 LIBS="$LIBS $thread_LIBS"
391 AC_SEARCH_LIBS(alGenBuffers, openal)
392 AC_SEARCH_LIBS(alutInit, [ alut openal ] )
393 OPENAL_OK="$ac_cv_search_alGenBuffers"
394 ALUT_OK="$ac_cv_search_alutInit"
401 if test "$OPENAL_OK" == "no" -a "x$enable_headless" != "xyes"; then
403 echo "You *must* have the openal library installed on your system to build"
406 echo "Please see README.OpenAL for more details."
408 echo "configure aborted."
412 if test "$ALUT_OK" == "no" -a "x$enable_headless" != "xyes"; then
414 echo "You *must* have the alut library installed on your system to build"
417 echo "Please see README.OpenAL for more details."
419 echo "configure aborted."
428 AC_SUBST(openal_LIBS)
429 AC_SUBST(opengl_LIBS)
430 AC_SUBST(thread_LIBS)
431 AC_SUBST(network_LIBS)
433 dnl Check for MS Windows environment
434 AC_CHECK_HEADER(windows.h)
435 AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
437 # The following are C++ items that need to be tested for with the c++
448 if test "x$with_osg_framework" != "x"; then
449 # AC_CHECK_FRAMEWORK(osgViewer, [#include <osgViewer/Version>], $with_osg_framework)
450 # AC_CHECK_FRAMEWORK(osgGA, [#include <osgGA/Version>], $with_osg_framework)
451 # AC_CHECK_FRAMEWORK(osgText, [#include <osgText/Version>], $with_osg_framework)
452 # AC_CHECK_FRAMEWORK(osgFX, [#include <osgFX/AnisotropicLighting>], $with_osg_framework)
453 # AC_CHECK_FRAMEWORK(osgUtil, [#include <osgUtil/Version>], $with_osg_framework)
454 # AC_CHECK_FRAMEWORK(osgDB, [#include <osgDB/Version>], $with_osg_framework)
455 # AC_CHECK_FRAMEWORK(osgSim, [#include <osgSim/Version>], $with_osg_framework)
456 # AC_CHECK_FRAMEWORK(osgParticle, [#include <osgParticle/Version>], $with_osg_framework)
457 AC_CHECK_FRAMEWORK(osg, [#include <osg/Version>], $with_osg_framework)
458 # osg_FRAMEWORKS="$FRAMEWORKS"
460 # AC_SUBST(osg_FRAMEWORKS)
461 AC_CHECK_FRAMEWORK(OpenThreads, [#include <OpenThreads/Version>], $with_osg_framework)
462 openthreads_FRAMEWORK="$FRAMEWORKS"
464 AC_SUBST(openthreads_FRAMEWORK)
467 dnl This is needed when osg dynamic libs are specified
468 dnl instead of OSG frameworks on Mac OS X
470 AC_CHECK_LIB(OpenThreads,OpenThreadsGetVersion)
474 if test "x$enable_osgdebug" = "xyes"; then
475 AC_CHECK_LIB(OpenThreadsd,OpenThreadsGetVersion)
477 AC_CHECK_LIB(OpenThreads,OpenThreadsGetVersion)
482 AM_CONDITIONAL(HAVE_FRAMEWORK_OSG, test "x$ac_cv_framework_osg" != "x")
484 AC_CHECK_HEADER(osg/Version)
486 if test "x$ac_cv_header_osg_Version" != "xyes" -o "x$ac_cv_lib_OpenThreads_OpenThreadsGetVersion" != "xyes"; then
487 if test "x$ac_cv_framework_osg" != "xyes"; then
489 echo "You *must* have the OpenThreads library installed on your system"
490 echo "to build this version of SimGear!"
491 echo " Maybe you need to specify --with-osg=DIR."
492 echo " Maybe you need to specify some LDFLAGS to help the linker."
494 echo " LIBS: '$LIBS'"
495 echo " LDFLAGS: '$LDFLAGS'"
496 echo " CPPFLAGS: '$CPPFLAGS'"
498 echo "Please see README.OSG for more details."
500 echo "configure aborted."
509 AC_CHECK_HEADER(boost/version.hpp)
510 if test "x$ac_cv_header_boost_version_hpp" != "xyes"; then
512 echo "You *must* have the Boost library installed on your system"
513 echo "to build this version of SimGear!"
515 echo " LIBS: '$LIBS'"
516 echo " LDFLAGS: '$LDFLAGS'"
517 echo " CPPFLAGS: '$CPPFLAGS'"
519 echo "configure aborted."
523 dnl Check for a HLA13 rti.
524 dnl This is really tricky because of the ancient iostream stuff in RTI13
525 saved_CPPFLAGS="$CPPFLAGS"
526 CPPFLAGS="$CPPFLAGS -DRTI_USES_STD_FSTREAM"
527 AC_CHECK_HEADER(RTI.hh)
528 CPPFLAGS="${saved_CPPFLAGS}"
530 dnl Up to now only RTI13
531 AM_CONDITIONAL(ENABLE_HLA, test "x$ac_cv_header_RTI_hh" = "xyes")
532 AM_CONDITIONAL(ENABLE_HLA13, test "x$ac_cv_header_RTI_hh" = "xyes")
536 dnl Check for system installed zlib
537 AC_CHECK_HEADER(zlib.h)
538 if test "x$ac_cv_header_zlib_h" != "xyes"; then
540 echo "zlib library not found."
542 echo "If your OS does not provide an installable package for zlib"
543 echo "you will have to compile and install it first yourself. A copy"
544 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
545 echo "have to untar this source code, and follow its included instructions"
546 echo "to compile and install on your system."
548 echo "configure aborted."
552 dnl Check for Subversion library support
553 # libsvn support defaults to yes
555 save_CPPFLAGS=$CPPFLAGS
556 AC_ARG_WITH(libsvn, [ --without-libsvn Do not use built-in subversion (libsvn) for simgear [default=no]], [], [with_libsvn=yes])
557 if test "x$with_libsvn" = "xyes"; then
558 LIBS="`apr-1-config --link-ld`"
559 CPPFLAGS="-I/usr/include/subversion-1 `apr-1-config --includes --cppflags`"
560 AC_CHECK_HEADERS([svn_client.h])
561 if test "x$ac_cv_header_svn_client_h" = "xyes"; then
562 echo "Using built-in subversion (libsvn) for scenery downloads."
563 AC_SEARCH_LIBS(svn_client_checkout, svn_client-1,
564 [AC_DEFINE([HAVE_LIBSVN_CLIENT_1], [1], [Define to 1 if you have libsvn_client-1])],
565 [AC_MSG_ERROR(svn_client-1 library not found.)],)
566 AC_SEARCH_LIBS(svn_cmdline_init, svn_subr-1, , [AC_MSG_ERROR(svn_subr-1 library not found.)],)
567 AC_SEARCH_LIBS(svn_ra_initialize, svn_ra-1, , [AC_MSG_ERROR(svn_ra-1 library not found.)],)
569 svn_CPPFLAGS=$CPPFLAGS
571 AC_SUBST(svn_CPPFLAGS)
573 echo "Libsvn not found. Will use command line subversion for scenery downloads."
578 echo "Libsvn explicitly disabled. Will use command line subversion for scenery downloads."
583 CPPFLAGS=$save_CPPFLAGS
585 dnl Checks for header files.
588 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
589 sys/stat.h sys/time.h sys/timeb.h unistd.h values.h )
591 if test "x$ac_cv_header_stdint_h" = "xyes"; then
592 AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
595 dnl Checks for typedefs, structures, and compiler characteristics.
602 dnl Checks for library functions.
604 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
608 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
609 random drand48 setitimer getitimer signal GetLocalTime rint getrusage ] )
612 AM_CONFIG_HEADER(simgear/simgear_config.h)
619 simgear/compatibility/Makefile \
620 simgear/compatibility/MIPSpro721/Makefile \
621 simgear/compatibility/MIPSpro740/Makefile \
622 simgear/bucket/Makefile \
623 simgear/debug/Makefile \
624 simgear/ephemeris/Makefile \
625 simgear/hla/Makefile \
626 simgear/io/Makefile \
627 simgear/magvar/Makefile \
628 simgear/math/Makefile \
629 simgear/environment/Makefile \
630 simgear/misc/Makefile \
631 simgear/nasal/Makefile \
632 simgear/props/Makefile \
633 simgear/route/Makefile \
634 simgear/scene/Makefile \
635 simgear/scene/bvh/Makefile \
636 simgear/scene/material/Makefile \
637 simgear/scene/model/Makefile \
638 simgear/scene/sky/Makefile \
639 simgear/scene/tgdb/Makefile \
640 simgear/scene/util/Makefile \
641 simgear/scene/tsync/Makefile \
642 simgear/screen/Makefile \
643 simgear/serial/Makefile \
644 simgear/sound/Makefile \
645 simgear/structure/Makefile \
646 simgear/threads/Makefile \
647 simgear/timing/Makefile \
648 simgear/xml/Makefile \
654 echo "Configure Summary"
655 echo "================="
657 echo "Prefix: $prefix"
659 if test "x$with_logging" != "x"; then
660 echo "Debug messages: $with_logging"
662 echo "Debug messages: yes"
665 echo -n "Automake version: "
666 automake --version | head -1
668 if test "x$with_jpeg_factory" = "xyes"; then
669 echo "With JPEG Factory support"
671 echo "Without JPEG Factory support"
674 if test "x$ac_cv_header_pthread_h" = "xyes"; then
675 echo "Threads: pthread lib found."
677 echo "Threads: no threads (pthread lib not found.)"