1 dnl Process this file with autoget.sh to produce a working configure
5 AC_CONFIG_SRCDIR([simgear/bucket/newbucket.cxx])
7 dnl Require at least automake 2.52
10 dnl Initialize the automake stuff
11 AM_INIT_AUTOMAKE(SimGear, 2.0.0)
13 dnl Specify KAI C++ compiler and flags.
14 dnl Borrowed with slight modification from blitz distribution.
16 [ --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
18 KCC*) # KAI C++ http://www.kai.com/
19 echo "Configuring for KAI C++"
20 AC_SG_SET_COMPILER($withval,"KCC","--restrict --strict_warnings")
21 CXX_OPTIMIZE_FLAGS=="+K3 -O3"
22 CXX_DEBUG_FLAGS="-g +K0"
27 AC_MSG_CHECKING([CXX])
32 dnl Checks for programs.
41 AX_BOOST_BASE([1.37.0])
43 if test "x$BOOST_CPPFLAGS" != "x-I/usr/include" ; then
44 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
47 dnl set the $host variable based on local machine/os
50 dnl Used on the Irix platform
53 if test "x$CXX" = "xCC" -o "x$CXX" = "xccache CC"; then
56 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro740"
57 compatibility_DIR="compatibility"
58 MIPSpro_DIRS="MIPSpro740"
59 AC_MSG_CHECKING([for MIPSpro compiler version 7.4 or newer])
62 if ( _COMPILER_VERSION < 740 ) {
68 ], AC_MSG_RESULT(yes),
70 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro721"
71 MIPSpro_DIRS="$(MIPSpro_DIRS) MIPSpro721"
72 AC_MSG_WARN([Using our own subset of the STL headers])
73 ], AC_MSG_RESULT(yes))
74 AC_SUBST(MIPSpro_DIRS)
85 AC_SUBST(compatibility_DIR)
87 if echo $includedir | egrep "simgear$" > /dev/null; then
88 echo "includedir is" $includedir "libdir is" $libdir
90 includedir="${includedir}/simgear"
91 echo "includedir changed to" $includedir "libdir is" $libdir
94 dnl set logging; default value of with_logging=yes
95 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
96 if test "x$with_logging" = "xno" ; then
97 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
100 # Specify if we want to build with Norman's jpeg image server support.
101 # This requires libjpeg to be installed and available.
102 # Default to with_jpeg_server=no
104 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
105 if test "x$with_jpeg_factory" = "xyes" ; then
106 echo "Building with Norman's jpeg image factory support"
107 AC_CHECK_LIB(jpeg, jpeg_start_compress)
108 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
110 echo "In order to build the jpeg factory code you need libjpeg installed."
111 echo "otherwise please configure with the --with-jpeg-sever=no option"
113 echo "libjpeg is available at :"
114 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
118 echo "Building without Norman's jpeg image server support"
120 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
122 # specify the plib location
123 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
125 if test "x$with_plib" != "x" ; then
126 echo "plib prefix is $with_plib"
127 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
130 AC_ARG_WITH(plib_framework, [ --with-plib-framework=PREFIX Specify the prefix path to PLIB.framework ])
132 if test "x$with_plib_framework" != "x"; then
133 echo "plib framework prefix is $with_plib_framework"
136 # specify the osg location
137 AC_ARG_WITH(osg, [ --with-osg=PREFIX Specify the prefix path to osg])
139 if test "x$with_osg" != "x" ; then
140 echo "osg prefix is $with_osg"
141 EXTRA_DIRS="${EXTRA_DIRS} $with_osg"
144 AC_ARG_WITH(osg_framework, [ --with-osg-framework=PREFIX Specify the prefix path to OSG.framework ])
146 if test "x$with_osg_framework" != "x"; then
147 echo "osg framework prefix is $with_osg_framework"
148 CPPFLAGS = "$CPPFLAGS -F$with-osg-framework"
149 export DYLD_FRAMEWORK_PATH="$DYLD_FRAMEWORK_PATH:$with_osg_framework"
152 dnl specifying OpenAL.framework (for user provided OpenAL.framework / ALUT)
153 AC_ARG_WITH(openal_framework, [ --with-openal-framework=PREFIX Speicfy the prefix path to OpenAL.framework ])
155 if test "x$with_openal_framework" != "x"; then
156 echo "OpenAL framework prefix is $with_openal_framework"
159 dnl Determine an extra directories to add to include/lib search paths
161 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
162 echo no EXTRA_DIRS for $host
166 if test -d /usr/X11R6 ; then
167 EXTRA_DIR1="/usr/X11R6"
169 if test -d /opt/X11R6 ; then
170 EXTRA_DIR2="/opt/X11R6"
172 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2"
176 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
179 dnl Using AM_CONDITIONAL is a step out of the protected little
180 dnl automake fold so it is potentially dangerous. But, we are
181 dnl beginning to run into cases where the standard checks are not
182 dnl enough. AM_CONDITIONALS are then referenced to conditionally
183 dnl build a Makefile.in from a Makefile.am which lets us define custom
184 dnl includes, compile alternative source files, etc.
186 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
187 dnl to use it if it is.
189 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
190 echo no fancy X11 check
199 dnl Checks for libraries.
201 dnl Thread related checks
202 AC_CHECK_HEADER(pthread.h)
203 AC_SEARCH_LIBS(pthread_exit, [pthread c_r])
204 if test "x$ac_cv_header_pthread_h" = "xyes"; then
205 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
206 CFLAGS="$CFLAGS -D_REENTRANT"
208 if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
209 CXXFLAGS="-pthread $CXXFLAGS"
210 CFLAGS="-pthread $CFLAGS"
214 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_header_pthread_h" = "xyes")
219 dnl search for network related libraries
220 AC_SEARCH_LIBS(inet_addr, xnet)
221 AC_SEARCH_LIBS(socket, socket)
226 dnl check for some default libraries
227 AC_SEARCH_LIBS(cos, m)
228 AC_SEARCH_LIBS(clock_gettime, rt)
232 dnl check for OpenGL related libraries
234 *-*-cygwin* | *-*-mingw32*)
235 dnl CygWin under Windoze.
237 echo Win32 specific hacks...
238 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
239 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
241 LIBS="$LIBS -lglu32 -lopengl32"
242 LIBS="$LIBS -luser32 -lgdi32 -lwinmm"
244 dnl add -lwsock32 for mingwin
247 base_LIBS="$base_LIBS -lws2_32"
251 echo "Will link apps with $LIBS"
257 LIBS="$LIBS -framework OpenGL -framework Carbon -lobjc"
261 dnl X-Windows based machines
263 AC_SEARCH_LIBS(XCreateWindow, X11)
264 AC_SEARCH_LIBS(XShmCreateImage, Xext)
265 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
266 AC_SEARCH_LIBS(IceOpenConnection, ICE)
267 AC_SEARCH_LIBS(SmcOpenConnection, SM)
268 AC_SEARCH_LIBS(XtMalloc, Xt)
269 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
271 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
272 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
273 dnl if GLcore found, then also check for GL
274 AC_SEARCH_LIBS(glXCreateContext, GL)
277 dnl if using mesa, check for xmesa.h
278 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
279 AC_CHECK_HEADER(GL/fxmesa.h)
280 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
281 AC_DEFINE([XMESA], 1, [Define for fxmesa])
282 AC_DEFINE([FX], 1, [Define for fxmesa])
286 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
291 AC_SEARCH_LIBS(glutGetModifiers, [ glut glut32 freeglut ], have_glut=yes, have_glut=no)
292 AM_CONDITIONAL(HAVE_GLUT, test "x$have_glut" = "xyes")
297 dnl check for OpenAL libraries
301 *-*-cygwin* | *-*-mingw32*)
302 dnl CygWin under Windoze.
303 INCLUDES="$INCLUDES -I/usr/local/include/"
304 LIBS="$LIBS -L/usr/local/lib"
305 AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal 'openal -ldsound -lwinmm' ] )
306 AC_SEARCH_LIBS(alutInit, [ openal32 ALut alut ] )
307 LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
309 OPENAL_OK="$ac_cv_search_alGenBuffers"
310 ALUT_OK="$ac_cv_search_alutInit"
316 LIBS="$LIBS -framework IOKit -framework OpenAL"
321 if test "x$with_openal_lib" != "x"; then
322 echo "libopenal is not supported on Mac OS platform."
326 # Looking for alut.h, if found assume that it is a part of
327 # the OpenAL package.
328 AC_CHECK_HEADERS([OpenAL/alut.h],[ALUT_OK="yes"])
331 dnl Thank you Christian Bauer from SheepSaver
332 dnl Modified by Tatsuhiro Nishioka for accepting a given framework path
333 dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES, $3=FRAMEWORK_PATH) ; $3 is optional
334 AC_DEFUN([AC_CHECK_FRAMEWORK], [
335 AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
336 AC_CACHE_CHECK([whether compiler supports framework $1],
339 FRAMEWORKS="$FRAMEWORKS -framework $1"
340 if test "$3" = ""; then
341 FRAMEWORKS="$FRAMEWORKS $ADD2LD"
342 elif test "`echo $FRAMEWORKS | grep -- -F$3`" = ""; then
343 FRAMEWORKS="$FRAMEWORKS -F$3"
344 CXXFLAGS="$CXXFLAGS -F$3"
345 CCFLAGS="$CCFLAGS -F$3"
346 dnl This is needed for AC_TRY_LINK when a framework path is specified
347 export DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}:$3"
351 [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
354 AS_IF([test AS_VAR_GET(ac_Framework) = yes],
355 [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
357 AS_VAR_POPDEF([ac_Framework])dnl
360 dnl Check for OpenAL.framework when --with-openal-framework is specified
361 dnl Of cource OpenAL.framework needs to have alut.h
362 if test "x$with_openal_framework" != "x"; then
363 AC_CHECK_FRAMEWORK(OpenAL, [#include <OpenAL/alut.h>], $with_openal_framework)
369 dnl default unix style machines
372 LIBS="$LIBS $thread_LIBS"
373 AC_SEARCH_LIBS(alGenBuffers, openal)
374 AC_SEARCH_LIBS(alutInit, [ alut openal ] )
375 OPENAL_OK="$ac_cv_search_alGenBuffers"
376 ALUT_OK="$ac_cv_search_alutInit"
383 if test "$OPENAL_OK" == "no"; then
385 echo "You *must* have the openal library installed on your system to build"
388 echo "Please see README.OpenAL for more details."
390 echo "configure aborted."
394 if test "$ALUT_OK" == "no"; then
396 echo "You *must* have the alut library installed on your system to build"
399 echo "Please see README.OpenAL for more details."
401 echo "configure aborted."
410 AC_SUBST(openal_LIBS)
411 AC_SUBST(opengl_LIBS)
412 AC_SUBST(thread_LIBS)
413 AC_SUBST(network_LIBS)
415 dnl Check for MS Windows environment
416 AC_CHECK_HEADER(windows.h)
417 AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
419 # The following are C++ items that need to be tested for with the c++
425 dnl Check for "plib" without which we cannot go on
428 # Check PLIB framework availability when with-plib-framework is specified
429 if test "x$with_plib_framework" != "x"; then
430 AC_CHECK_FRAMEWORK(PLIB, [#include <plib/ul.h>], $with_plib_framework)
431 plib_FRAMEWORK="$FRAMEWORKS"
433 AC_SUBST(plib_FRAMEWORK)
437 AM_CONDITIONAL(HAVE_FRAMEWORK_PLIB, test "x$ac_cv_framework_PLIB" != "x")
439 AC_CHECK_HEADER(plib/ul.h)
440 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
442 echo "You *must* have the plib library installed on your system to build"
445 echo "Please see README.plib for more details."
447 echo "configure aborted."
451 AC_MSG_CHECKING([for plib 1.8.5 or newer])
455 #define MIN_PLIB_VERSION 185
458 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
467 [AC_MSG_RESULT(wrong version);
468 AC_MSG_ERROR([Install plib 1.8.5 or later first...])],
477 if test "x$with_osg_framework" != "x"; then
478 # AC_CHECK_FRAMEWORK(osgViewer, [#include <osgViewer/Version>], $with_osg_framework)
479 # AC_CHECK_FRAMEWORK(osgGA, [#include <osgGA/Version>], $with_osg_framework)
480 # AC_CHECK_FRAMEWORK(osgText, [#include <osgText/Version>], $with_osg_framework)
481 # AC_CHECK_FRAMEWORK(osgFX, [#include <osgFX/AnisotropicLighting>], $with_osg_framework)
482 # AC_CHECK_FRAMEWORK(osgUtil, [#include <osgUtil/Version>], $with_osg_framework)
483 # AC_CHECK_FRAMEWORK(osgDB, [#include <osgDB/Version>], $with_osg_framework)
484 # AC_CHECK_FRAMEWORK(osgSim, [#include <osgSim/Version>], $with_osg_framework)
485 # AC_CHECK_FRAMEWORK(osgParticle, [#include <osgParticle/Version>], $with_osg_framework)
486 # AC_CHECK_FRAMEWORK(osg, [#include <osg/Version>], $with_osg_framework)
487 # osg_FRAMEWORKS="$FRAMEWORKS"
489 # AC_SUBST(osg_FRAMEWORKS)
490 AC_CHECK_FRAMEWORK(OpenThreads, [#include <OpenThreads/Version>], $with_osg_framework)
491 openthreads_FRAMEWORK="$FRAMEWORKS"
493 AC_SUBST(openthreads_FRAMEWORK)
496 dnl This is needed when osg dynamic libs are specified
497 dnl instead of OSG frameworks on Mac OS X
499 AC_CHECK_LIB(OpenThreads,OpenThreadsGetVersion)
500 LDFLAGS="$LDFLAGS -L$with_osg"
504 if test "x$enable_osgdebug" = "xyes"; then
505 AC_CHECK_LIB(OpenThreadsd,OpenThreadsGetVersion)
507 AC_CHECK_LIB(OpenThreads,OpenThreadsGetVersion)
511 AM_CONDITIONAL(HAVE_FRAMEWORK_OSG, test "x$ac_cv_framework_osg" != "x")
513 AC_CHECK_HEADER(osg/Version)
514 if test "x$ac_cv_header_osg_Version" != "xyes" -o "x$ac_cv_lib_OpenThreads_OpenThreadsGetVersion" != "xyes"; then
515 if test "x$ac_cv_framework_osg" != "xyes"; then
517 echo "Warning: The OpenThreads library was not found on this system."
518 echo " Mybe you forgot to sepcify --with-osg?"
519 echo "Without the OpenSceneGraph library FlightGear will not work."
521 echo "Please see README.OSG for more details."
523 echo "configure aborted."
528 AC_CHECK_HEADER(boost/version.hpp)
529 if test "x$ac_cv_header_boost_version_hpp" != "xyes"; then
531 echo "You *must* have the Boost library installed on your system"
532 echo "to build this version of SimGear!"
534 echo "configure aborted."
540 dnl Check for system installed zlib
541 AC_CHECK_HEADER(zlib.h)
542 if test "x$ac_cv_header_zlib_h" != "xyes"; then
544 echo "zlib library not found."
546 echo "If your OS does not provide an installable package for zlib"
547 echo "you will have to compile and install it first yourself. A copy"
548 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
549 echo "have to untar this source code, and follow its included instructions"
550 echo "to compile and install on your system."
552 echo "configure aborted."
556 dnl Checks for header files.
559 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
560 sys/stat.h sys/time.h sys/timeb.h unistd.h values.h )
562 if test "x$ac_cv_header_stdint_h" = "xyes"; then
563 AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
566 dnl Checks for typedefs, structures, and compiler characteristics.
573 dnl Checks for library functions.
575 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
579 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
580 random drand48 setitimer getitimer signal GetLocalTime rint getrusage ] )
583 AM_CONFIG_HEADER(simgear/simgear_config.h)
590 simgear/compatibility/Makefile \
591 simgear/compatibility/MIPSpro721/Makefile \
592 simgear/compatibility/MIPSpro740/Makefile \
593 simgear/bucket/Makefile \
594 simgear/debug/Makefile \
595 simgear/ephemeris/Makefile \
596 simgear/io/Makefile \
597 simgear/magvar/Makefile \
598 simgear/math/Makefile \
599 simgear/environment/Makefile \
600 simgear/misc/Makefile \
601 simgear/nasal/Makefile \
602 simgear/props/Makefile \
603 simgear/route/Makefile \
604 simgear/scene/Makefile \
605 simgear/scene/bvh/Makefile \
606 simgear/scene/material/Makefile \
607 simgear/scene/model/Makefile \
608 simgear/scene/sky/Makefile \
609 simgear/scene/tgdb/Makefile \
610 simgear/scene/util/Makefile \
611 simgear/screen/Makefile \
612 simgear/serial/Makefile \
613 simgear/sound/Makefile \
614 simgear/structure/Makefile \
615 simgear/threads/Makefile \
616 simgear/timing/Makefile \
617 simgear/xml/Makefile \
623 echo "Configure Summary"
624 echo "================="
626 echo "Prefix: $prefix"
628 if test "x$with_logging" != "x"; then
629 echo "Debug messages: $with_logging"
631 echo "Debug messages: yes"
634 echo -n "Automake version: "
635 automake --version | head -1
637 if test "x$with_jpeg_factory" = "xyes"; then
638 echo "With JPEG Factory support"
640 echo "Without JPEG Factory support"
643 if test "x$ac_cv_header_pthread_h" = "xyes"; then
644 echo "Threads: pthread lib found."
646 echo "Threads: no threads (pthread lib not found.)"