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_ARG_ENABLE(headless,
28 AS_HELP_STRING([--enable-headless],[Enable only packages for headless build]))
30 AC_MSG_CHECKING([for headless mode])
31 AC_MSG_RESULT([$enable_headless])
33 AM_CONDITIONAL(WANT_HEADLESS,[test "x$enable_headless" = "xyes"])
35 AC_MSG_CHECKING([CXX])
40 dnl Checks for programs.
49 AX_BOOST_BASE([1.37.0])
51 if test "x$BOOST_CPPFLAGS" != "x-I/usr/include" ; then
52 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
55 dnl set the $host variable based on local machine/os
58 dnl Used on the Irix platform
61 if test "x$CXX" = "xCC" -o "x$CXX" = "xccache CC"; then
64 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro740"
65 compatibility_DIR="compatibility"
66 MIPSpro_DIRS="MIPSpro740"
67 AC_MSG_CHECKING([for MIPSpro compiler version 7.4 or newer])
70 if ( _COMPILER_VERSION < 740 ) {
76 ], AC_MSG_RESULT(yes),
78 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro721"
79 MIPSpro_DIRS="$(MIPSpro_DIRS) MIPSpro721"
80 AC_MSG_WARN([Using our own subset of the STL headers])
81 ], AC_MSG_RESULT(yes))
82 AC_SUBST(MIPSpro_DIRS)
93 AC_SUBST(compatibility_DIR)
95 if echo $includedir | egrep "simgear$" > /dev/null; then
96 echo "includedir is" $includedir "libdir is" $libdir
98 includedir="${includedir}/simgear"
99 echo "includedir changed to" $includedir "libdir is" $libdir
102 dnl set logging; default value of with_logging=yes
103 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
104 if test "x$with_logging" = "xno" ; then
105 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
108 # Specify if we want to build with Norman's jpeg image server support.
109 # This requires libjpeg to be installed and available.
110 # Default to with_jpeg_server=no
112 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
113 if test "x$with_jpeg_factory" = "xyes" ; then
114 echo "Building with Norman's jpeg image factory support"
115 AC_CHECK_LIB(jpeg, jpeg_start_compress)
116 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
118 echo "In order to build the jpeg factory code you need libjpeg installed."
119 echo "otherwise please configure with the --with-jpeg-sever=no option"
121 echo "libjpeg is available at :"
122 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
126 echo "Building without Norman's jpeg image server support"
128 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
130 # specify the osg location
131 AC_ARG_WITH(osg, [ --with-osg=PREFIX Specify the prefix path to osg])
133 if test "x$with_osg" != "x" ; then
134 echo "osg prefix is $with_osg"
135 EXTRA_DIRS="${EXTRA_DIRS} $with_osg"
138 AC_ARG_WITH(osg_framework, [ --with-osg-framework=PREFIX Specify the prefix path to OSG.framework ])
140 if test "x$with_osg_framework" != "x"; then
141 echo "osg framework prefix is $with_osg_framework"
142 CPPFLAGS = "$CPPFLAGS -F$with-osg-framework"
143 export DYLD_FRAMEWORK_PATH="$DYLD_FRAMEWORK_PATH:$with_osg_framework"
146 dnl specifying ALUT.framework (for user provided ALUT.framework)
147 AC_ARG_WITH(alut_framework, [ --with-alut-framework=PREFIX Specify the prefix path to ALUT.framework ])
149 if test "x$with_alut_framework" != "x"; then
150 echo "ALUT framework prefix is $with_alut_framework"
153 dnl Determine an extra directories to add to include/lib search paths
155 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
156 echo no EXTRA_DIRS for $host
160 if test -d /usr/X11R6 ; then
161 EXTRA_DIR1="/usr/X11R6"
163 if test -d /opt/X11R6 ; then
164 EXTRA_DIR2="/opt/X11R6"
166 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2"
170 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
173 dnl Using AM_CONDITIONAL is a step out of the protected little
174 dnl automake fold so it is potentially dangerous. But, we are
175 dnl beginning to run into cases where the standard checks are not
176 dnl enough. AM_CONDITIONALS are then referenced to conditionally
177 dnl build a Makefile.in from a Makefile.am which lets us define custom
178 dnl includes, compile alternative source files, etc.
180 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
181 dnl to use it if it is.
183 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
184 echo no fancy X11 check
193 dnl Checks for libraries.
195 dnl Thread related checks
196 AC_CHECK_HEADER(pthread.h)
197 AC_SEARCH_LIBS(pthread_exit, [pthread c_r])
198 if test "x$ac_cv_header_pthread_h" = "xyes"; then
199 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
200 CFLAGS="$CFLAGS -D_REENTRANT"
202 if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
203 CXXFLAGS="-pthread $CXXFLAGS"
204 CFLAGS="-pthread $CFLAGS"
208 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_header_pthread_h" = "xyes")
213 dnl search for network related libraries
214 AC_SEARCH_LIBS(inet_addr, xnet)
215 AC_SEARCH_LIBS(socket, socket)
220 dnl check for some default libraries
221 AC_SEARCH_LIBS(cos, m)
222 AC_SEARCH_LIBS(clock_gettime, rt)
226 dnl check for OpenGL related libraries
228 *-*-cygwin* | *-*-mingw32*)
229 dnl CygWin under Windoze.
231 echo Win32 specific hacks...
232 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
233 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
235 LIBS="$LIBS -lglu32 -lopengl32"
236 LIBS="$LIBS -luser32 -lgdi32 -lwinmm"
238 dnl add -lwsock32 for mingwin
241 base_LIBS="$base_LIBS -lws2_32"
245 echo "Will link apps with $LIBS"
251 LIBS="$LIBS -framework OpenGL -framework Carbon -lobjc"
255 dnl X-Windows based machines
257 AC_SEARCH_LIBS(XCreateWindow, X11)
258 AC_SEARCH_LIBS(XShmCreateImage, Xext)
259 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
260 AC_SEARCH_LIBS(IceOpenConnection, ICE)
261 AC_SEARCH_LIBS(SmcOpenConnection, SM)
262 AC_SEARCH_LIBS(XtMalloc, Xt)
263 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
265 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
266 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
267 dnl if GLcore found, then also check for GL
268 AC_SEARCH_LIBS(glXCreateContext, GL)
271 dnl if using mesa, check for xmesa.h
272 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
273 AC_CHECK_HEADER(GL/fxmesa.h)
274 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
275 AC_DEFINE([XMESA], 1, [Define for fxmesa])
276 AC_DEFINE([FX], 1, [Define for fxmesa])
280 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
288 dnl check for OpenAL libraries
292 *-*-cygwin* | *-*-mingw32*)
293 dnl CygWin under Windoze.
294 INCLUDES="$INCLUDES -I/usr/local/include/"
295 LIBS="$LIBS -L/usr/local/lib"
296 AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal 'openal -ldsound -lwinmm' ] )
297 AC_SEARCH_LIBS(alutInit, [ openal32 ALut alut ] )
298 LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
300 OPENAL_OK="$ac_cv_search_alGenBuffers"
301 ALUT_OK="$ac_cv_search_alutInit"
307 LIBS="$LIBS -framework IOKit -framework OpenAL -framework ALUT"
310 if test "x$with_openal_lib" != "x"; then
311 echo "libopenal is not supported on Mac OS platform."
315 AC_CHECK_HEADERS([OpenAL/al.h],[OPENAL_OK="yes"])
317 AC_CHECK_HEADERS([ALUT/alut.h],[ALUT_OK="yes"])
319 dnl Thank you Christian Bauer from SheepSaver
320 dnl Modified by Tatsuhiro Nishioka for accepting a given framework path
321 dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES, $3=FRAMEWORK_PATH, $4=ACTION_IF_TRUE) ; $3 is optional
322 AC_DEFUN([AC_CHECK_FRAMEWORK], [
323 AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
324 AC_CACHE_CHECK([whether compiler supports framework $1],
327 FRAMEWORKS="$FRAMEWORKS -framework $1"
328 if test "$3" = ""; then
329 FRAMEWORKS="$FRAMEWORKS $ADD2LD"
330 elif test "`echo $FRAMEWORKS | grep -- -F$3`" = ""; then
331 FRAMEWORKS="$FRAMEWORKS -F$3"
332 CXXFLAGS="$CXXFLAGS -F$3"
333 CPPFLAGS="$CPPFLAGS -F$3"
334 CCFLAGS="$CCFLAGS -F$3"
335 dnl This is needed for AC_TRY_LINK when a framework path is specified
336 export DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}:$3"
340 [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
343 AS_IF([test AS_VAR_GET(ac_Framework) = yes],
344 [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
346 AS_IF([test AS_VAR_GET(ac_Framework) = yes], $4)
348 AS_VAR_POPDEF([ac_Framework])dnl
351 dnl Check for ALUT.framework when --with-alut-framework is specified
352 if test "x$with_alut_framework" != "x"; then
353 AC_CHECK_FRAMEWORK(ALUT, [#include <ALUT/alut.h>], $with_alut_framework, [ALUT_OK="yes"])
359 dnl default unix style machines
362 LIBS="$LIBS $thread_LIBS"
363 AC_SEARCH_LIBS(alGenBuffers, openal)
364 AC_SEARCH_LIBS(alutInit, [ alut openal ] )
365 OPENAL_OK="$ac_cv_search_alGenBuffers"
366 ALUT_OK="$ac_cv_search_alutInit"
373 if test "$OPENAL_OK" == "no" -a "x$enable_headless" != "xyes"; then
375 echo "You *must* have the openal library installed on your system to build"
378 echo "Please see README.OpenAL for more details."
380 echo "configure aborted."
384 if test "$ALUT_OK" == "no" -a "x$enable_headless" != "xyes"; then
386 echo "You *must* have the alut library installed on your system to build"
389 echo "Please see README.OpenAL for more details."
391 echo "configure aborted."
400 AC_SUBST(openal_LIBS)
401 AC_SUBST(opengl_LIBS)
402 AC_SUBST(thread_LIBS)
403 AC_SUBST(network_LIBS)
405 dnl Check for MS Windows environment
406 AC_CHECK_HEADER(windows.h)
407 AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
409 # The following are C++ items that need to be tested for with the c++
418 if test "x$with_osg_framework" != "x"; then
419 # AC_CHECK_FRAMEWORK(osgViewer, [#include <osgViewer/Version>], $with_osg_framework)
420 # AC_CHECK_FRAMEWORK(osgGA, [#include <osgGA/Version>], $with_osg_framework)
421 # AC_CHECK_FRAMEWORK(osgText, [#include <osgText/Version>], $with_osg_framework)
422 # AC_CHECK_FRAMEWORK(osgFX, [#include <osgFX/AnisotropicLighting>], $with_osg_framework)
423 # AC_CHECK_FRAMEWORK(osgUtil, [#include <osgUtil/Version>], $with_osg_framework)
424 # AC_CHECK_FRAMEWORK(osgDB, [#include <osgDB/Version>], $with_osg_framework)
425 # AC_CHECK_FRAMEWORK(osgSim, [#include <osgSim/Version>], $with_osg_framework)
426 # AC_CHECK_FRAMEWORK(osgParticle, [#include <osgParticle/Version>], $with_osg_framework)
427 AC_CHECK_FRAMEWORK(osg, [#include <osg/Version>], $with_osg_framework)
428 # osg_FRAMEWORKS="$FRAMEWORKS"
430 # AC_SUBST(osg_FRAMEWORKS)
431 AC_CHECK_FRAMEWORK(OpenThreads, [#include <OpenThreads/Version>], $with_osg_framework)
432 openthreads_FRAMEWORK="$FRAMEWORKS"
434 AC_SUBST(openthreads_FRAMEWORK)
437 dnl This is needed when osg dynamic libs are specified
438 dnl instead of OSG frameworks on Mac OS X
440 AC_CHECK_LIB(OpenThreads,OpenThreadsGetVersion)
444 if test "x$enable_osgdebug" = "xyes"; then
445 AC_CHECK_LIB(OpenThreadsd,OpenThreadsGetVersion)
447 AC_CHECK_LIB(OpenThreads,OpenThreadsGetVersion)
452 AM_CONDITIONAL(HAVE_FRAMEWORK_OSG, test "x$ac_cv_framework_osg" != "x")
454 AC_CHECK_HEADER(osg/Version)
456 if test "x$ac_cv_header_osg_Version" != "xyes" -o "x$ac_cv_lib_OpenThreads_OpenThreadsGetVersion" != "xyes"; then
457 if test "x$ac_cv_framework_osg" != "xyes"; then
459 echo "You *must* have the OpenThreads library installed on your system"
460 echo "to build this version of SimGear!"
461 echo " Maybe you need to specify --with-osg=DIR."
462 echo " Maybe you need to specify some LDFLAGS to help the linker."
464 echo " LIBS: '$LIBS'"
465 echo " LDFLAGS: '$LDFLAGS'"
466 echo " CPPFLAGS: '$CPPFLAGS'"
468 echo "Please see README.OSG for more details."
470 echo "configure aborted."
475 AC_CHECK_HEADER(boost/version.hpp)
476 if test "x$ac_cv_header_boost_version_hpp" != "xyes"; then
478 echo "You *must* have the Boost library installed on your system"
479 echo "to build this version of SimGear!"
481 echo " LIBS: '$LIBS'"
482 echo " LDFLAGS: '$LDFLAGS'"
483 echo " CPPFLAGS: '$CPPFLAGS'"
485 echo "configure aborted."
491 dnl Check for system installed zlib
492 AC_CHECK_HEADER(zlib.h)
493 if test "x$ac_cv_header_zlib_h" != "xyes"; then
495 echo "zlib library not found."
497 echo "If your OS does not provide an installable package for zlib"
498 echo "you will have to compile and install it first yourself. A copy"
499 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
500 echo "have to untar this source code, and follow its included instructions"
501 echo "to compile and install on your system."
503 echo "configure aborted."
507 dnl Checks for header files.
510 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
511 sys/stat.h sys/time.h sys/timeb.h unistd.h values.h )
513 if test "x$ac_cv_header_stdint_h" = "xyes"; then
514 AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
517 dnl Checks for typedefs, structures, and compiler characteristics.
524 dnl Checks for library functions.
526 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
530 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
531 random drand48 setitimer getitimer signal GetLocalTime rint getrusage ] )
534 AM_CONFIG_HEADER(simgear/simgear_config.h)
541 simgear/compatibility/Makefile \
542 simgear/compatibility/MIPSpro721/Makefile \
543 simgear/compatibility/MIPSpro740/Makefile \
544 simgear/bucket/Makefile \
545 simgear/debug/Makefile \
546 simgear/ephemeris/Makefile \
547 simgear/io/Makefile \
548 simgear/magvar/Makefile \
549 simgear/math/Makefile \
550 simgear/environment/Makefile \
551 simgear/misc/Makefile \
552 simgear/nasal/Makefile \
553 simgear/props/Makefile \
554 simgear/route/Makefile \
555 simgear/scene/Makefile \
556 simgear/scene/bvh/Makefile \
557 simgear/scene/material/Makefile \
558 simgear/scene/model/Makefile \
559 simgear/scene/sky/Makefile \
560 simgear/scene/tgdb/Makefile \
561 simgear/scene/util/Makefile \
562 simgear/screen/Makefile \
563 simgear/serial/Makefile \
564 simgear/sound/Makefile \
565 simgear/structure/Makefile \
566 simgear/threads/Makefile \
567 simgear/timing/Makefile \
568 simgear/xml/Makefile \
574 echo "Configure Summary"
575 echo "================="
577 echo "Prefix: $prefix"
579 if test "x$with_logging" != "x"; then
580 echo "Debug messages: $with_logging"
582 echo "Debug messages: yes"
585 echo -n "Automake version: "
586 automake --version | head -1
588 if test "x$with_jpeg_factory" = "xyes"; then
589 echo "With JPEG Factory support"
591 echo "Without JPEG Factory support"
594 if test "x$ac_cv_header_pthread_h" = "xyes"; then
595 echo "Threads: pthread lib found."
597 echo "Threads: no threads (pthread lib not found.)"