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, 1.9.1)
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.
40 AX_BOOST_BASE([1.34.0])
42 if test "x$BOOST_CPPFLAGS" != "x-I/usr/include" ; then
43 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
46 dnl set the $host variable based on local machine/os
49 dnl Used on the Irix platform
52 if test "x$CXX" = "xCC" -o "x$CXX" = "xccache CC"; then
55 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro740"
56 compatibility_DIR="compatibility"
57 MIPSpro_DIRS="MIPSpro740"
58 AC_MSG_CHECKING([for MIPSpro compiler version 7.4 or newer])
61 if ( _COMPILER_VERSION < 740 ) {
67 ], AC_MSG_RESULT(yes),
69 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro721"
70 MIPSpro_DIRS="$(MIPSpro_DIRS) MIPSpro721"
71 AC_MSG_WARN([Using our own subset of the STL headers])
72 ], AC_MSG_RESULT(yes))
73 AC_SUBST(MIPSpro_DIRS)
84 AC_SUBST(compatibility_DIR)
86 if echo $includedir | egrep "simgear$" > /dev/null; then
87 echo "includedir is" $includedir "libdir is" $libdir
89 includedir="${includedir}/simgear"
90 echo "includedir changed to" $includedir "libdir is" $libdir
93 dnl set logging; default value of with_logging=yes
94 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
95 if test "x$with_logging" = "xno" ; then
96 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
99 # Specify if we want to build with Norman's jpeg image server support.
100 # This requires libjpeg to be installed and available.
101 # Default to with_jpeg_server=no
103 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
104 if test "x$with_jpeg_factory" = "xyes" ; then
105 echo "Building with Norman's jpeg image factory support"
106 AC_CHECK_LIB(jpeg, jpeg_start_compress)
107 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
109 echo "In order to build the jpeg factory code you need libjpeg installed."
110 echo "otherwise please configure with the --with-jpeg-sever=no option"
112 echo "libjpeg is available at :"
113 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
117 echo "Building without Norman's jpeg image server support"
119 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
121 # specify the plib location
122 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
124 if test "x$with_plib" != "x" ; then
125 echo "plib prefix is $with_plib"
126 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
129 AC_ARG_WITH(plib_framework, [ --with-plib-framework=PREFIX Specify the prefix path to PLIB.framework ])
131 if test "x$with_plib_framework" != "x"; then
132 echo "plib framework prefix is $with_plib_framework"
135 # specify the osg location
136 AC_ARG_WITH(osg, [ --with-osg=PREFIX Specify the prefix path to osg])
138 if test "x$with_osg" != "x" ; then
139 echo "osg prefix is $with_osg"
140 EXTRA_DIRS="${EXTRA_DIRS} $with_osg"
143 AC_ARG_WITH(osg_framework, [ --with-osg-framework=PREFIX Specify the prefix path to OSG.framework ])
145 if test "x$with_osg_framework" != "x"; then
146 echo "osg framework prefix is $with_osg_framework"
149 dnl Determine an extra directories to add to include/lib search paths
151 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
152 echo no EXTRA_DIRS for $host
156 if test -d /usr/X11R6 ; then
157 EXTRA_DIR1="/usr/X11R6"
159 if test -d /opt/X11R6 ; then
160 EXTRA_DIR2="/opt/X11R6"
162 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2"
166 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
169 dnl Using AM_CONDITIONAL is a step out of the protected little
170 dnl automake fold so it is potentially dangerous. But, we are
171 dnl beginning to run into cases where the standard checks are not
172 dnl enough. AM_CONDITIONALS are then referenced to conditionally
173 dnl build a Makefile.in from a Makefile.am which lets us define custom
174 dnl includes, compile alternative source files, etc.
176 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
177 dnl to use it if it is.
179 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
180 echo no fancy X11 check
189 dnl Checks for libraries.
191 dnl Thread related checks
192 AC_CHECK_HEADER(pthread.h)
193 AC_SEARCH_LIBS(pthread_exit, [pthread c_r])
194 if test "x$ac_cv_header_pthread_h" = "xyes"; then
195 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
196 CFLAGS="$CFLAGS -D_REENTRANT"
198 if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
199 CXXFLAGS="-pthread $CXXFLAGS"
200 CFLAGS="-pthread $CFLAGS"
204 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_header_pthread_h" = "xyes")
209 dnl search for network related libraries
210 AC_SEARCH_LIBS(inet_addr, xnet)
211 AC_SEARCH_LIBS(socket, socket)
216 dnl check for some default libraries
217 AC_SEARCH_LIBS(cos, m)
218 AC_SEARCH_LIBS(clock_gettime, rt)
222 dnl check for OpenGL related libraries
224 *-*-cygwin* | *-*-mingw32*)
225 dnl CygWin under Windoze.
227 echo Win32 specific hacks...
228 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
229 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
231 LIBS="$LIBS -lglu32 -lopengl32"
232 LIBS="$LIBS -luser32 -lgdi32 -lwinmm"
234 dnl add -lwsock32 for mingwin
237 base_LIBS="$base_LIBS -lws2_32"
241 echo "Will link apps with $LIBS"
247 LIBS="$LIBS -framework OpenGL -framework Carbon -lobjc"
251 dnl X-Windows based machines
253 AC_SEARCH_LIBS(XCreateWindow, X11)
254 AC_SEARCH_LIBS(XShmCreateImage, Xext)
255 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
256 AC_SEARCH_LIBS(IceOpenConnection, ICE)
257 AC_SEARCH_LIBS(SmcOpenConnection, SM)
258 AC_SEARCH_LIBS(XtMalloc, Xt)
259 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
261 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
262 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
263 dnl if GLcore found, then also check for GL
264 AC_SEARCH_LIBS(glXCreateContext, GL)
267 dnl if using mesa, check for xmesa.h
268 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
269 AC_CHECK_HEADER(GL/fxmesa.h)
270 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
271 AC_DEFINE([XMESA], 1, [Define for fxmesa])
272 AC_DEFINE([FX], 1, [Define for fxmesa])
276 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
281 AC_SEARCH_LIBS(glutGetModifiers, [ glut glut32 freeglut ], have_glut=yes, have_glut=no)
282 AM_CONDITIONAL(HAVE_GLUT, test "x$have_glut" = "xyes")
287 dnl check for OpenAL libraries
291 *-*-cygwin* | *-*-mingw32*)
292 dnl CygWin under Windoze.
293 INCLUDES="$INCLUDES -I/usr/local/include/"
294 LIBS="$LIBS -L/usr/local/lib"
295 AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal ] )
296 AC_SEARCH_LIBS(alutInit, [ openal32 ALut alut ] )
297 LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
299 OPENAL_OK="$ac_cv_search_alGenBuffers"
300 ALUT_OK="$ac_cv_search_alutInit"
306 LIBS="$LIBS -framework IOKit -framework OpenAL"
308 # not sure how to test if OpenAL exists on MacOS (does it come by default?)
312 dnl Thank you Christian Bauer from SheepSaver
313 dnl Modified by Tatsuhiro Nishioka for accepting a given framework path
314 dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES, $3=FRAMEWORK_PATH) ; $3 is optional
315 AC_DEFUN([AC_CHECK_FRAMEWORK], [
316 AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
317 AC_CACHE_CHECK([whether compiler supports framework $1],
320 FRAMEWORKS="$FRAMEWORKS -framework $1"
321 if test "$3" = ""; then
322 FRAMEWORKS="$FRAMEWORKS $ADD2LD"
323 elif test "`echo $FRAMEWORKS | grep -- -F$3`" = ""; then
324 FRAMEWORKS="$FRAMEWORKS -F$3"
325 CXXFLAGS="$CXXFLAGS -F$3"
326 CCFLAGS="$CCFLAGS -F$3"
327 dnl This is needed for AC_TRY_LINK when a framework path is specified
328 export DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}:$3"
332 [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
335 AS_IF([test AS_VAR_GET(ac_Framework) = yes],
336 [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
338 AS_VAR_POPDEF([ac_Framework])dnl
344 dnl default unix style machines
347 LIBS="$LIBS $thread_LIBS"
348 AC_SEARCH_LIBS(alGenBuffers, openal)
349 AC_SEARCH_LIBS(alutInit, [ alut openal ] )
350 OPENAL_OK="$ac_cv_search_alGenBuffers"
351 ALUT_OK="$ac_cv_search_alutInit"
358 if test "$OPENAL_OK" == "no"; then
360 echo "You *must* have the openal library installed on your system to build"
363 echo "Please see README.OpenAL for more details."
365 echo "configure aborted."
369 if test "$ALUT_OK" == "no"; then
371 echo "You *must* have the alut library installed on your system to build"
374 echo "Please see README.OpenAL for more details."
376 echo "configure aborted."
385 AC_SUBST(openal_LIBS)
386 AC_SUBST(opengl_LIBS)
387 AC_SUBST(thread_LIBS)
388 AC_SUBST(network_LIBS)
390 dnl Check for MS Windows environment
391 AC_CHECK_HEADER(windows.h)
392 AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
394 # The following are C++ items that need to be tested for with the c++
400 dnl Check for "plib" without which we cannot go on
403 # Check PLIB framework availability when with-plib-framework is specified
404 if test "x$with_plib_framework" != "x"; then
405 AC_CHECK_FRAMEWORK(PLIB, [#include <plib/ul.h>], $with_plib_framework)
406 plib_FRAMEWORK="$FRAMEWORKS"
408 AC_SUBST(plib_FRAMEWORK)
412 AM_CONDITIONAL(HAVE_FRAMEWORK_PLIB, test "x$ac_cv_framework_PLIB" != "x")
414 AC_CHECK_HEADER(plib/ul.h)
415 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
417 echo "You *must* have the plib library installed on your system to build"
420 echo "Please see README.plib for more details."
422 echo "configure aborted."
426 AC_MSG_CHECKING([for plib 1.8.5 or newer])
430 #define MIN_PLIB_VERSION 185
433 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
442 [AC_MSG_RESULT(wrong version);
443 AC_MSG_ERROR([Install plib 1.8.5 or later first...])],
452 if test "x$with_osg_framework" != "x"; then
453 AC_CHECK_FRAMEWORK(osgViewer, [#include <osgViewer/Version>], $with_osg_framework)
454 AC_CHECK_FRAMEWORK(osgGA, [#include <osgGA/Version>], $with_osg_framework)
455 AC_CHECK_FRAMEWORK(osgText, [#include <osgText/Version>], $with_osg_framework)
456 AC_CHECK_FRAMEWORK(osgFX, [#include <osgFX/AnisotropicLighting>], $with_osg_framework)
457 AC_CHECK_FRAMEWORK(osgUtil, [#include <osgUtil/Version>], $with_osg_framework)
458 AC_CHECK_FRAMEWORK(osgDB, [#include <osgDB/Version>], $with_osg_framework)
459 AC_CHECK_FRAMEWORK(osgSim, [#include <osgSim/Version>], $with_osg_framework)
460 AC_CHECK_FRAMEWORK(osgParticle, [#include <osgParticle/Version>], $with_osg_framework)
461 AC_CHECK_FRAMEWORK(osg, [#include <osg/Version>], $with_osg_framework)
462 osg_FRAMEWORKS="$FRAMEWORKS"
464 AC_SUBST(osg_FRAMEWORKS)
465 AC_CHECK_FRAMEWORK(OpenThreads, [#include <OpenThreads/Version>], $with_osg_framework)
466 openthreads_FRAMEWORK="$FRAMEWORKS"
468 AC_SUBST(openthreads_FRAMEWORK)
471 dnl This is needed when osg dynamic libs are specified
472 dnl instead of OSG frameworks on Mac OS X
474 LDFLAGS="$LDFLAGS -L$with_osg"
478 AM_CONDITIONAL(HAVE_FRAMEWORK_OSG, test "x$ac_cv_framework_osg" != "x")
480 AC_CHECK_HEADER(osg/Version)
481 if test "x$ac_cv_header_osg_Version" != "xyes"; then
482 if test "x$ac_cv_framework_osg" != "xyes"; then
484 echo "You *must* have the OpenSceneGraph support library installed on your system"
485 echo "to build this version of SimGear!"
487 echo "Please see README.OSG for more details."
489 echo "configure aborted."
494 AC_CHECK_HEADER(boost/version.hpp)
495 if test "x$ac_cv_header_boost_version_hpp" != "xyes"; then
497 echo "You *must* have the Boost library installed on your system"
498 echo "to build this version of SimGear!"
500 echo "configure aborted."
506 dnl Check for system installed zlib
507 AC_CHECK_HEADER(zlib.h)
508 if test "x$ac_cv_header_zlib_h" != "xyes"; then
510 echo "zlib library not found."
512 echo "If your OS does not provide an installable package for zlib"
513 echo "you will have to compile and install it first yourself. A copy"
514 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
515 echo "have to untar this source code, and follow its included instructions"
516 echo "to compile and install on your system."
518 echo "configure aborted."
522 dnl Checks for header files.
525 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
526 sys/stat.h sys/time.h sys/timeb.h unistd.h values.h )
528 if test "x$ac_cv_header_stdint_h" = "xyes"; then
529 AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
532 dnl Checks for typedefs, structures, and compiler characteristics.
539 dnl Checks for library functions.
541 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
545 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
546 random drand48 setitimer getitimer signal GetLocalTime rint getrusage ] )
549 AM_CONFIG_HEADER(simgear/simgear_config.h)
556 simgear/compatibility/Makefile \
557 simgear/compatibility/MIPSpro721/Makefile \
558 simgear/compatibility/MIPSpro740/Makefile \
559 simgear/bucket/Makefile \
560 simgear/debug/Makefile \
561 simgear/ephemeris/Makefile \
562 simgear/io/Makefile \
563 simgear/magvar/Makefile \
564 simgear/math/Makefile \
565 simgear/environment/Makefile \
566 simgear/misc/Makefile \
567 simgear/nasal/Makefile \
568 simgear/props/Makefile \
569 simgear/route/Makefile \
570 simgear/scene/Makefile \
571 simgear/scene/bvh/Makefile \
572 simgear/scene/material/Makefile \
573 simgear/scene/model/Makefile \
574 simgear/scene/sky/Makefile \
575 simgear/scene/tgdb/Makefile \
576 simgear/scene/util/Makefile \
577 simgear/screen/Makefile \
578 simgear/serial/Makefile \
579 simgear/sound/Makefile \
580 simgear/structure/Makefile \
581 simgear/threads/Makefile \
582 simgear/timing/Makefile \
583 simgear/xml/Makefile \
589 echo "Configure Summary"
590 echo "================="
592 echo "Prefix: $prefix"
594 if test "x$with_logging" != "x"; then
595 echo "Debug messages: $with_logging"
597 echo "Debug messages: yes"
600 echo -n "Automake version: "
601 automake --version | head -1
603 if test "x$with_jpeg_factory" = "xyes"; then
604 echo "With JPEG Factory support"
606 echo "Without JPEG Factory support"
609 if test "x$ac_cv_header_pthread_h" = "xyes"; then
610 echo "Threads: pthread lib found."
612 echo "Threads: no threads (pthread lib not found.)"