1 dnl Process this file with aclocal ; automake -a ; autoconf to produce a
2 dnl working configure script.
9 AC_CONFIG_SRCDIR([src/Aircraft/aircraft.cxx])
11 # Require at least automake 2.52
14 # Initialize the automake stuff
15 AM_INIT_AUTOMAKE(FlightGear, 0.7.11pre1)
17 # Checks for programs.
29 # Initialize maintainer mode
32 # This is needed for AC_TRY_COMPILE later
35 # Check to see if this `configure' is being run in the `Cygwin32' environment
40 ],is_mingw=yes, is_mingw=no)
42 echo "IS_MINGW = $is_mingw"
43 AM_CONDITIONAL(IS_MINGW, test "x$is_mingw" = "xyes")
49 ],is_cygwin=yes, is_cygwin=no)
51 echo "IS_CYGWIN = $is_cygwin"
52 AM_CONDITIONAL(IS_CYGWIN, test "x$is_cygwin" = "xyes")
54 # Determine version of automake ... important becuase of
55 # incompatibilities between versions
56 AUTO_MAKE_VERSION=`automake --version | head -1 | awk '{print $4}' | sed -e 's/\-p[[0-9]]$//' | sed -e 's/\.//g'`
57 if test $AUTO_MAKE_VERSION -lt 15; then
58 echo "You need to upgrade your automake to version 1.5 or newer"
63 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
65 # Used on the Irix platform
68 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
69 if test "$CXX" = "CC"; then
76 # Specify if we want logging (testing build) or not (release build)
77 # set logging default value
79 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
80 if test "x$with_logging" = "xno" ; then
81 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
84 # Specify if we want to build with Oliver's networking support
85 # default to with_network=yes
86 AC_ARG_WITH(network_olk, [ --with-network-olk Include Oliver's multi-pilot networking support])
87 if test "x$with_network_olk" = "xno" ; then
88 echo "Building without Oliver's multi-pilot network support"
90 echo "Building with Oliver's multi-pilot network support"
91 AC_DEFINE([FG_NETWORK_OLK], 1, [Define to build with Oliver's networking])
93 AM_CONDITIONAL(ENABLE_NETWORK_OLK, test "x$with_network_olk" != "xno")
96 # Specify if we want to use WeatherCM instead of FGEnvironment.
97 # default to with_weathercm=no
98 AC_ARG_WITH(new-environment, [ --with-weathercm Use WeatherCM instead of FGEnvironment])
99 if test "x$with_weathercm" = "xyes" ; then
100 echo "Building with WeatherCM"
101 AC_DEFINE([FG_WEATHERCM], 1,
102 [Define to build with Christian Mayer's weather code])
104 echo "Building with FGEnvironment"
106 AM_CONDITIONAL(ENABLE_WEATHERCM, test "x$with_weathercm" = "xyes")
108 # Let the Win32 user specify if they want to build with the SGI
109 # opengl.dll as opposed to the more standard openg32.dll
110 AC_ARG_WITH(sgi-opengl, [ --with-sgi-opengl Build against SGI's opengl.dll glu.dll and glut.dll])
112 dnl Thread related checks
113 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=no]])
114 if test "x$with_threads" = "xyes"; then
115 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
116 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
117 CFLAGS="$CFLAGS -D_REENTRANT"
118 AC_CHECK_HEADER(pthread.h)
120 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "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 # specify the metakit location
131 AC_ARG_WITH(metakit, [ --with-metakit=PREFIX Specify the prefix path to metakit])
133 if test "x$with_metakit" != "x" ; then
134 echo "metakit prefix is $with_metakit"
135 EXTRA_DIRS="${EXTRA_DIRS} $with_metakit"
138 # specify the simgear location
139 AC_ARG_WITH(simgear, [ --with-simgear=PREFIX Specify the prefix path to simgear])
141 if test "x$with_simgear" != "x" ; then
142 echo "SimGear prefix path is $with_simgear"
143 EXTRA_DIRS="${EXTRA_DIRS} $with_simgear"
146 # Check for MS Windows environment
147 AC_CHECK_HEADER(windows.h)
149 # extra library and include directories
150 if test "x$ac_cv_header_windows_h" != "xyes" ; then
151 EXTRA_DIRS="${EXTRA_DIRS} /usr/local /usr/X11R6"
153 if test -d /opt/X11R6 ; then
154 EXTRA_DIRS="${EXTRA_DIRS} /opt/X11R6"
157 if test "x$is_cygwin" = "xyes" ; then
158 EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
162 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
164 # Using AM_CONDITIONAL is a step out of the protected little
165 # automake fold so it is potentially dangerous. But, we are
166 # beginning to run into cases where the standard checks are not
167 # enough. AM_CONDITIONALS are then referenced to conditionally
168 # build a Makefile.in from a Makefile.am which lets us define custom
169 # includes, compile alternative source files, etc.
171 # Check for external variables daylight and timezone.
173 if test "$have_daylight" = yes; then
174 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
176 # AM_CONDITIONAL(HAVE_DAYLIGHT, test "$have_daylight" = yes )
179 if test "$have_timezone" = yes; then
180 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
182 # AM_CONDITIONAL(HAVE_TIMEZONE, test "$have_timezone" = yes )
184 # Check for audio support
185 AC_MSG_CHECKING(for audio support)
187 if test -r /usr/include/soundcard.h \
188 -o -r /usr/include/linux/soundcard.h \
189 -o -r /usr/include/machine/soundcard.h \
190 -o -r /usr/include/audio.h \
191 -o "x$ac_cv_header_windows_h" = "xyes" \
192 -o "$HOSTTYPE" = "macintosh"; then
194 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
195 audio_LIBS="-lplibsl -lplibsm"
197 if test -r /usr/include/audio.h; then
198 audio_LIBS="$audio_LIBS -laudio"
201 if test "x$ac_cv_header_windows_h" = "xyes"; then
202 audio_LIBS="$audio_LIBS -lwinmm"
205 if test "$HOSTTYPE" = "macintosh"; then
206 audio_LIBS="$audio_LIBS -framework Carbon"
213 # Check for X11 (fancy)
214 if test "x$no_x" != "xyes"; then
218 # Checks for libraries.
224 dnl MINGW requires libwsock32
225 if test "x$is_mingw" = "xyes" ; then
226 LIBS="$LIBS -lws2_32"
231 dnl Mesa >= 3.2 requires pthreads
232 AC_CHECK_LIB(pthread, pthread_exit)
233 AC_CHECK_LIB(socket, socket)
235 dnl Skip X library tests.
236 if test "x$no_x" != "xyes"; then
237 AC_CHECK_LIB(X11, XCreateWindow)
238 AC_CHECK_LIB(Xext, XShmCreateImage)
239 AC_CHECK_LIB(Xi, XGetExtensionVersion)
240 AC_CHECK_LIB(ICE, IceOpenConnection)
241 AC_CHECK_LIB(SM, SmcOpenConnection)
242 AC_CHECK_LIB(Xt, XtMalloc)
243 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
246 # check for OpenGL related libraries
248 if test "$HOSTTYPE" = "macintosh"; then
249 LIBS="$LIBS -framework OpenGL -framework GLUT -lobjc"
250 elif test "x$ac_cv_header_windows_h" != "xyes" ; then
251 # Reasonable stuff for non-windoze variants ... :-)
253 AC_CHECK_LIB(GLcore, glNewList)
254 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
255 # if no GLcore, check for GL
256 AC_CHECK_LIB(GL, glNewList)
257 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
258 # if no GL, check for MesaGL
259 AC_CHECK_LIB(MesaGL, glNewList)
262 # if GLcore found, then also check for GL
263 AC_CHECK_LIB(GL, glXCreateContext)
266 # check for xmesa.h and if found enable XMESA / FX
267 AC_CHECK_HEADER(GL/fxmesa.h)
268 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
270 AC_CHECK_LIB(GL, XMesaSetFXmode)
271 if test "x$ac_cv_lib_GL_XMesaSetFXmode" = "xyes" ; then
272 AC_DEFINE([XMESA], 1, [Define for Mesa FX mode])
273 AC_DEFINE([FX], 1, [Define for Mesa FX mode])
275 AC_CHECK_LIB(MesaGL, XMesaSetFXmode)
276 if test "x$ac_cv_lib_MesaGL_XMesaSetFXmode" = "xyes" ; then
277 AC_DEFINE([XMESA], 1, [Define for Mesa FX mode])
278 AC_DEFINE([FX], 1, [Define for Mesa FX mode])
284 AC_CHECK_LIB(GLU, gluLookAt)
285 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
286 # if no GLU, check for MesaGLU
287 AC_CHECK_LIB(MesaGLU, gluLookAt)
291 AC_CHECK_LIB(glut, glutGetModifiers)
293 # test for glutGameModeString, but avoid adding glut a second time into
294 # the list of libraries
296 AC_CHECK_LIB(glut, glutGameModeString)
299 # Win32 is a little wierd because it has to try to handle the various
300 # winbloze-isms. We'll just do this manually for now.
302 echo Win32 specific hacks...
303 AC_DEFINE([WIN32], 1, [Define if building on a Win32 platform])
305 # just define these to true and hope for the best
306 ac_cv_lib_glut_glutGetModifiers="yes"
307 ac_cv_lib_glut_glutGameModeString="yes"
309 if test "x$with_sgi_opengl" = "xyes" ; then
310 echo "Building with glut.dll, glu.dll, and opengl.dll"
315 echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
318 WIN32_OPENGL=opengl32
321 LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
322 LIBS="$LIBS -luser32 -lgdi32"
323 echo "Will link apps with $LIBS"
326 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
328 echo "Unable to find the necessary OpenGL or GLUT libraries."
329 echo "See config.log for automated test details and results ..."
333 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
335 echo "Your version of glut doesn't support game mode."
336 echo "You need to install the latest version. If your distribution doesn't"
337 echo "provide a newer version, you can get the latest source code from:"
339 echo " http://reality.sgi.com/opengl/glut3/glut3.html"
347 AC_SUBST(opengl_LIBS)
349 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
351 # The following are C++ items that need to be tested for with the c++
356 # Check for "plib" without which we cannot go on
357 AC_CHECK_HEADER(plib/pu.h)
358 if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
360 echo "You *must* have the plib library installed on your system to build"
361 echo "the FGFS simulator!"
363 echo "Please see README.plib for more details."
365 echo "configure aborted."
369 # needed for plib 1.3.x and later
370 AC_CHECK_LIB(plibul, ulInit,,,)
372 if test "x$ac_cv_lib_plibul_ulInit" != "xyes"; then
374 echo "You have an old version of plib, you need to upgrade to at least"
379 # If we get here then plib is available, so force use of plib joystick lib
380 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
382 # Do we have a new CVS plib version with jsJoystick::getName?
383 echo -n "Testing for Plib joystick getName support: "
384 AC_EGREP_HEADER( getName, plib/js.h,
385 plib_js_has_getname=yes, plib_js_has_getname=no )
386 echo $plib_js_has_getname
387 if test $plib_js_has_getname = 'yes'; then
388 AC_DEFINE([FG_PLIB_JOYSTICK_GETNAME], 1,
389 [Define to enable plib joystick name support])
392 # Check for the presence of SimGear
393 AC_CHECK_HEADER(simgear/version.h)
394 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
396 echo "You *must* have the SimGear support library installed on your system"
397 echo "to build the FGFS simulator!"
399 echo "Please see README.SimGear for more details."
401 echo "configure aborted."
405 AC_MSG_CHECKING([for proper simgear version])
409 #include <simgear/version.h>
411 #define STRINGIFY(X) XSTRINGIFY(X)
412 #define XSTRINGIFY(X) #X
419 int major, minor, micro;
421 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
423 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
425 if ( major < MIN_MAJOR ) {
427 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
429 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
438 [AC_MSG_RESULT(wrong version);
439 AC_MSG_ERROR([Install latest simgear first...])],
444 AC_CHECK_HEADER(mk4.h)
445 if test "x$ac_cv_header_mk4_h" != "xyes"; then
447 echo "MetaKit library not found."
449 echo "If your OS does not provide an installable package for MetaKit"
450 echo "you will have to compile and install it first yourself. A copy"
451 echo "of metakit-$(VERSION).tar.gz is included with SimGear. You will"
452 echo "have to untar this source code, and follow it's included instructions"
453 echo "to compile and install on your system."
455 echo "configure aborted."
459 AC_MSG_CHECKING([for proper metakit version])
462 LIBS="$saved_LIBS -lmk4"
466 #define MIN_MK4_VERSION 243
469 int major, minor, micro;
471 if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
480 [AC_MSG_RESULT(wrong version);
481 AC_MSG_ERROR([Install metakit 2.4.3 or later first...])],
486 # Check if SimGear was built with Norman JPEG factory support
487 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
488 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
489 AC_CHECK_LIB(jpeg, jpeg_start_compress)
490 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
492 echo "The JPEG factory code was built and installed with SimGear."
493 echo "However it appears the libjpeg is no longer installed."
494 echo "You need to install libjpeg or remove jpgfactory support from"
497 echo "libjpeg is available at :"
498 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
501 AC_DEFINE([FG_JPEG_SERVER], 1,
502 [Define to build with jpeg screen shot server])
504 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
508 # Check for system installed zlib
509 AC_CHECK_HEADER(zlib.h)
510 if test "x$ac_cv_header_zlib_h" != "xyes"; then
512 echo "zlib library not found."
514 echo "If your OS does not provide an installable package for zlib"
515 echo "you will have to compile and install it first yourself. A copy"
516 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
517 echo "have to untar this source code, and follow it's included instructions"
518 echo "to compile and install on your system."
520 echo "configure aborted."
524 # Checks for header files.
527 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
528 sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
530 # Checks for typedefs, structures, and compiler characteristics.
536 # Checks for library functions.
539 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
540 random setitimer getitimer signal GetLocalTime rint getrusage )
542 AM_CONFIG_HEADER(src/Include/config.h)
554 scripts/debug/Makefile \
555 scripts/python/Makefile \
557 src/Include/Makefile \
558 src/Include/version.h \
559 src/Aircraft/Makefile \
560 src/Airports/Makefile \
562 src/Autopilot/Makefile \
563 src/Cockpit/Makefile \
564 src/Cockpit/built_in/Makefile \
565 src/Controls/Makefile \
566 src/Environment/Makefile \
567 src/FDM/Balloon/Makefile \
568 src/FDM/JSBSim/Makefile \
569 src/FDM/JSBSim/filtersjb/Makefile \
570 src/FDM/LaRCsim/Makefile \
571 src/FDM/UIUCModel/Makefile \
572 src/FDM/YASim/Makefile \
578 src/Main/runfgfs.bat \
580 src/Navaids/Makefile \
581 src/Network/Makefile \
582 src/NetworkOLK/Makefile \
583 src/Objects/Makefile \
584 src/Scenery/Makefile \
587 src/WeatherCM/Makefile \
592 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
595 echo "Configure Summary"
596 echo "================="
598 echo "Prefix: $prefix"
600 if test "x$with_logging" != "x"; then
601 echo "Debug messages: $with_logging"
603 echo "Debug messages: yes"
606 echo -n "Automake version: ($AUTO_MAKE_VERSION) "
607 automake --version | head -1
609 echo "New plib joystick name support: $plib_js_has_getname"
611 if test "x$with_weathercm" != "x"; then
612 echo "WeatherCM instead of FGEnvironment: $with_weathercm"
614 echo "Using FGEnvironment"
617 if test "x$with_threads" = "xyes"; then