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/\.\([0-9]*\).*/\1/'`
57 if test $AUTO_MAKE_VERSION -lt 15; then
59 echo "You need to upgrade to automake version 1.5 or greater."
60 echo "Most distributions have packages available to install or you can"
61 echo "find the source for the most recent version at"
62 echo "ftp://ftp.gnu.org/gnu/automake"
67 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
69 # Used on the Irix platform
72 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
73 if test "$CXX" = "CC"; then
80 # Specify if we want logging (testing build) or not (release build)
81 # set logging default value
83 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
84 if test "x$with_logging" = "xno" ; then
85 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
88 # Specify if we want to build with Oliver's networking support
89 # default to with_network=yes
90 AC_ARG_WITH(network_olk, [ --with-network-olk Include Oliver's multi-pilot networking support])
91 if test "x$with_network_olk" = "xno" ; then
92 echo "Building without Oliver's multi-pilot network support"
94 echo "Building with Oliver's multi-pilot network support"
95 AC_DEFINE([FG_NETWORK_OLK], 1, [Define to build with Oliver's networking])
97 AM_CONDITIONAL(ENABLE_NETWORK_OLK, test "x$with_network_olk" != "xno")
100 # Specify if we want to use WeatherCM instead of FGEnvironment.
101 # default to with_weathercm=no
102 AC_ARG_WITH(new-environment, [ --with-weathercm Use WeatherCM instead of FGEnvironment])
103 if test "x$with_weathercm" = "xyes" ; then
104 echo "Building with WeatherCM"
105 AC_DEFINE([FG_WEATHERCM], 1,
106 [Define to build with Christian Mayer's weather code])
108 echo "Building with FGEnvironment"
110 AM_CONDITIONAL(ENABLE_WEATHERCM, test "x$with_weathercm" = "xyes")
112 # Let the Win32 user specify if they want to build with the SGI
113 # opengl.dll as opposed to the more standard openg32.dll
114 AC_ARG_WITH(sgi-opengl, [ --with-sgi-opengl Build against SGI's opengl.dll glu.dll and glut.dll])
116 dnl Thread related checks
117 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=no]])
118 if test "x$with_threads" = "xyes"; then
119 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
120 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
121 CFLAGS="$CFLAGS -D_REENTRANT"
122 AC_CHECK_HEADER(pthread.h)
124 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
126 # specify the plib location
127 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
129 if test "x$with_plib" != "x" ; then
130 echo "plib prefix is $with_plib"
131 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
134 # specify the metakit location
135 AC_ARG_WITH(metakit, [ --with-metakit=PREFIX Specify the prefix path to metakit])
137 if test "x$with_metakit" != "x" ; then
138 echo "metakit prefix is $with_metakit"
139 EXTRA_DIRS="${EXTRA_DIRS} $with_metakit"
142 # specify the simgear location
143 AC_ARG_WITH(simgear, [ --with-simgear=PREFIX Specify the prefix path to simgear])
145 if test "x$with_simgear" != "x" ; then
146 echo "SimGear prefix path is $with_simgear"
147 EXTRA_DIRS="${EXTRA_DIRS} $with_simgear"
150 # Check for MS Windows environment
151 AC_CHECK_HEADER(windows.h)
153 # extra library and include directories
154 if test "x$ac_cv_header_windows_h" != "xyes" ; then
155 EXTRA_DIRS="${EXTRA_DIRS} /usr/local /usr/X11R6"
157 if test -d /opt/X11R6 ; then
158 EXTRA_DIRS="${EXTRA_DIRS} /opt/X11R6"
161 if test "x$is_cygwin" = "xyes" ; then
162 EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
166 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
168 # Using AM_CONDITIONAL is a step out of the protected little
169 # automake fold so it is potentially dangerous. But, we are
170 # beginning to run into cases where the standard checks are not
171 # enough. AM_CONDITIONALS are then referenced to conditionally
172 # build a Makefile.in from a Makefile.am which lets us define custom
173 # includes, compile alternative source files, etc.
175 # Check for external variables daylight and timezone.
177 if test "$have_daylight" = yes; then
178 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
180 # AM_CONDITIONAL(HAVE_DAYLIGHT, test "$have_daylight" = yes )
183 if test "$have_timezone" = yes; then
184 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
186 # AM_CONDITIONAL(HAVE_TIMEZONE, test "$have_timezone" = yes )
188 # Check for audio support
189 AC_MSG_CHECKING(for audio support)
191 if test -r /usr/include/soundcard.h \
192 -o -r /usr/include/linux/soundcard.h \
193 -o -r /usr/include/machine/soundcard.h \
194 -o -r /usr/include/audio.h \
195 -o "x$ac_cv_header_windows_h" = "xyes" \
196 -o "$HOSTTYPE" = "macintosh"; then
198 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
199 audio_LIBS="-lplibsl -lplibsm"
201 if test -r /usr/include/audio.h; then
202 audio_LIBS="$audio_LIBS -laudio"
205 if test "x$ac_cv_header_windows_h" = "xyes"; then
206 audio_LIBS="$audio_LIBS -lwinmm"
209 if test "$HOSTTYPE" = "macintosh"; then
210 audio_LIBS="$audio_LIBS -framework Carbon"
217 # Check for X11 (fancy)
218 if test "x$no_x" != "xyes"; then
222 # Checks for libraries.
228 dnl MINGW requires libwsock32
229 if test "x$is_mingw" = "xyes" ; then
230 LIBS="$LIBS -lws2_32"
235 dnl Mesa >= 3.2 requires pthreads
236 AC_CHECK_LIB(pthread, pthread_exit)
237 AC_CHECK_LIB(socket, socket)
239 dnl Skip X library tests.
240 if test "x$no_x" != "xyes"; then
241 AC_CHECK_LIB(X11, XCreateWindow)
242 AC_CHECK_LIB(Xext, XShmCreateImage)
243 AC_CHECK_LIB(Xi, XGetExtensionVersion)
244 AC_CHECK_LIB(ICE, IceOpenConnection)
245 AC_CHECK_LIB(SM, SmcOpenConnection)
246 AC_CHECK_LIB(Xt, XtMalloc)
247 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
250 # check for OpenGL related libraries
252 if test "$HOSTTYPE" = "macintosh"; then
253 LIBS="$LIBS -framework OpenGL -framework GLUT -lobjc"
254 elif test "x$ac_cv_header_windows_h" != "xyes" ; then
255 # Reasonable stuff for non-windoze variants ... :-)
257 AC_CHECK_LIB(GLcore, glNewList)
258 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
259 # if no GLcore, check for GL
260 AC_CHECK_LIB(GL, glNewList)
261 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
262 # if no GL, check for MesaGL
263 AC_CHECK_LIB(MesaGL, glNewList)
266 # if GLcore found, then also check for GL
267 AC_CHECK_LIB(GL, glXCreateContext)
270 # check for xmesa.h and if found enable XMESA / FX
271 AC_CHECK_HEADER(GL/fxmesa.h)
272 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
274 AC_CHECK_LIB(GL, XMesaSetFXmode)
275 if test "x$ac_cv_lib_GL_XMesaSetFXmode" = "xyes" ; then
276 AC_DEFINE([XMESA], 1, [Define for Mesa FX mode])
277 AC_DEFINE([FX], 1, [Define for Mesa FX mode])
279 AC_CHECK_LIB(MesaGL, XMesaSetFXmode)
280 if test "x$ac_cv_lib_MesaGL_XMesaSetFXmode" = "xyes" ; then
281 AC_DEFINE([XMESA], 1, [Define for Mesa FX mode])
282 AC_DEFINE([FX], 1, [Define for Mesa FX mode])
288 AC_CHECK_LIB(GLU, gluLookAt)
289 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
290 # if no GLU, check for MesaGLU
291 AC_CHECK_LIB(MesaGLU, gluLookAt)
295 AC_CHECK_LIB(glut, glutGetModifiers)
297 # test for glutGameModeString, but avoid adding glut a second time into
298 # the list of libraries
300 AC_CHECK_LIB(glut, glutGameModeString)
303 # Win32 is a little wierd because it has to try to handle the various
304 # winbloze-isms. We'll just do this manually for now.
306 echo Win32 specific hacks...
307 AC_DEFINE([WIN32], 1, [Define if building on a Win32 platform])
309 # just define these to true and hope for the best
310 ac_cv_lib_glut_glutGetModifiers="yes"
311 ac_cv_lib_glut_glutGameModeString="yes"
313 if test "x$with_sgi_opengl" = "xyes" ; then
314 echo "Building with glut.dll, glu.dll, and opengl.dll"
319 echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
322 WIN32_OPENGL=opengl32
325 LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
326 LIBS="$LIBS -luser32 -lgdi32"
327 echo "Will link apps with $LIBS"
330 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
332 echo "Unable to find the necessary OpenGL or GLUT libraries."
333 echo "See config.log for automated test details and results ..."
337 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
339 echo "Your version of glut doesn't support game mode."
340 echo "You need to install the latest version. If your distribution doesn't"
341 echo "provide a newer version, you can get the latest source code from:"
343 echo " http://reality.sgi.com/opengl/glut3/glut3.html"
351 AC_SUBST(opengl_LIBS)
353 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
355 # The following are C++ items that need to be tested for with the c++
360 # Check for "plib" without which we cannot go on
361 AC_CHECK_HEADER(plib/ul.h)
362 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
364 echo "You *must* have the plib library installed on your system to build"
365 echo "the FGFS simulator!"
367 echo "Please see README.plib for more details."
369 echo "configure aborted."
373 AC_MSG_CHECKING([for plib 1.6.0 or newer])
377 #define MIN_PLIB_VERSION 160
380 int major, minor, micro;
382 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
391 [AC_MSG_RESULT(wrong version);
392 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
396 # If we get here then plib is available, so force use of plib joystick lib
397 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
399 # Do we have a new CVS plib version with jsJoystick::getName?
400 echo -n "Testing for Plib joystick getName support: "
401 AC_EGREP_HEADER( getName, plib/js.h,
402 plib_js_has_getname=yes, plib_js_has_getname=no )
403 echo $plib_js_has_getname
404 if test $plib_js_has_getname = 'yes'; then
405 AC_DEFINE([FG_PLIB_JOYSTICK_GETNAME], 1,
406 [Define to enable plib joystick name support])
409 # Check for the presence of SimGear
410 AC_CHECK_HEADER(simgear/version.h)
411 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
413 echo "You *must* have the SimGear support library installed on your system"
414 echo "to build the FGFS simulator!"
416 echo "Please see README.SimGear for more details."
418 echo "configure aborted."
422 AC_MSG_CHECKING([for simgear 0.0.19 or newer])
426 #include <simgear/version.h>
428 #define STRINGIFY(X) XSTRINGIFY(X)
429 #define XSTRINGIFY(X) #X
436 int major, minor, micro;
438 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
440 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
442 if ( major < MIN_MAJOR ) {
444 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
446 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
455 [AC_MSG_RESULT(wrong version);
456 AC_MSG_ERROR([Install latest simgear first...])],
461 AC_CHECK_HEADER(mk4.h)
462 if test "x$ac_cv_header_mk4_h" != "xyes"; then
464 echo "MetaKit library not found."
466 echo "If your OS does not provide an installable package for MetaKit"
467 echo "you will have to compile and install it first yourself. A copy"
468 echo "of metakit-$(VERSION).tar.gz is included with SimGear. You will"
469 echo "have to untar this source code, and follow it's included instructions"
470 echo "to compile and install on your system."
472 echo "configure aborted."
476 AC_MSG_CHECKING([for metakit 2.4.3 or newer])
478 LIBS="$saved_LIBS -lmk4"
482 #define MIN_MK4_VERSION 243
485 int major, minor, micro;
487 if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
496 [AC_MSG_RESULT(wrong version);
497 AC_MSG_ERROR([Install metakit 2.4.3 or later first...])],
502 # Check if SimGear was built with Norman JPEG factory support
503 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
504 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
505 AC_CHECK_LIB(jpeg, jpeg_start_compress)
506 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
508 echo "The JPEG factory code was built and installed with SimGear."
509 echo "However it appears the libjpeg is no longer installed."
510 echo "You need to install libjpeg or remove jpgfactory support from"
513 echo "libjpeg is available at :"
514 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
517 AC_DEFINE([FG_JPEG_SERVER], 1,
518 [Define to build with jpeg screen shot server])
520 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
524 # Check for system installed zlib
525 AC_CHECK_HEADER(zlib.h)
526 if test "x$ac_cv_header_zlib_h" != "xyes"; then
528 echo "zlib library not found."
530 echo "If your OS does not provide an installable package for zlib"
531 echo "you will have to compile and install it first yourself. A copy"
532 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
533 echo "have to untar this source code, and follow it's included instructions"
534 echo "to compile and install on your system."
536 echo "configure aborted."
540 # Checks for header files.
543 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
544 sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
546 # Checks for typedefs, structures, and compiler characteristics.
552 # Checks for library functions.
555 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
556 random setitimer getitimer signal GetLocalTime rint getrusage )
558 AM_CONFIG_HEADER(src/Include/config.h)
570 scripts/debug/Makefile \
571 scripts/python/Makefile \
573 src/Include/Makefile \
574 src/Include/version.h \
575 src/Aircraft/Makefile \
576 src/Airports/Makefile \
578 src/Autopilot/Makefile \
579 src/Cockpit/Makefile \
580 src/Cockpit/built_in/Makefile \
581 src/Controls/Makefile \
582 src/Environment/Makefile \
583 src/FDM/Balloon/Makefile \
584 src/FDM/JSBSim/Makefile \
585 src/FDM/JSBSim/filtersjb/Makefile \
586 src/FDM/LaRCsim/Makefile \
587 src/FDM/UIUCModel/Makefile \
588 src/FDM/YASim/Makefile \
594 src/Main/runfgfs.bat \
596 src/Navaids/Makefile \
597 src/Network/Makefile \
598 src/NetworkOLK/Makefile \
599 src/Objects/Makefile \
600 src/Scenery/Makefile \
603 src/WeatherCM/Makefile \
608 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
611 echo "Configure Summary"
612 echo "================="
614 echo "Prefix: $prefix"
616 if test "x$with_logging" != "x"; then
617 echo "Debug messages: $with_logging"
619 echo "Debug messages: yes"
622 echo -n "Automake version: ($AUTO_MAKE_VERSION) "
623 automake --version | head -1
625 echo "New plib joystick name support: $plib_js_has_getname"
627 if test "x$with_weathercm" != "x"; then
628 echo "WeatherCM instead of FGEnvironment: $with_weathercm"
630 echo "Using FGEnvironment"
633 if test "x$with_threads" = "xyes"; then