1 dnl Process this file with autoget.sh to produce a working configure
7 AC_CONFIG_SRCDIR([src/Aircraft/aircraft.cxx])
9 dnl Require at least automake 2.52
12 dnl Initialize the automake stuff
13 AM_INIT_AUTOMAKE(FlightGear, 0.9.1)
15 dnl Checks for programs.
24 # specify the simgear location
25 AC_ARG_WITH(simgear, [ --with-simgear=PREFIX Specify the prefix path to simgear])
27 if test "x$with_simgear" != "x" ; then
28 echo "SimGear prefix path is $with_simgear"
29 EXTRA_DIRS="${EXTRA_DIRS} $with_simgear"
32 dnl set the $host variable based on local machine/os
37 if test "$CXX" = "CC"; then
40 CXXFLAGS="$CXXFLAGS -I$with_simgear/include/simgear/compatibility"
54 dnl set logging; default value of with_logging=yes
55 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
56 if test "x$with_logging" = "xno" ; then
57 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
60 # Specify if we want to build with Oliver's networking support
61 # default to with_network=yes
62 AC_ARG_WITH(network_olk, [ --with-network-olk Include Oliver's multi-pilot networking support])
63 if test "x$with_network_olk" = "xno" ; then
64 echo "Building without Oliver's multi-pilot network support"
66 echo "Building with Oliver's multi-pilot network support"
67 AC_DEFINE([FG_NETWORK_OLK], 1, [Define to build with Oliver's networking])
69 AM_CONDITIONAL(ENABLE_NETWORK_OLK, test "x$with_network_olk" != "xno")
72 # Specify if we want to use WeatherCM instead of FGEnvironment.
73 # default to with_weathercm=no
74 AC_ARG_WITH(weathercm, [ --with-weathercm Use WeatherCM instead of FGEnvironment])
75 if test "x$with_weathercm" = "xyes" ; then
76 echo "Building with WeatherCM"
77 AC_DEFINE([FG_WEATHERCM], 1,
78 [Define to build with Christian Mayer's weather code])
80 echo "Building with FGEnvironment"
82 AM_CONDITIONAL(ENABLE_WEATHERCM, test "x$with_weathercm" = "xyes")
84 dnl Specify if we want the old menubar; default to the new one
85 AC_ARG_WITH(old-menubar, [ --with-old-menubar Use the old menu bar])
86 if test "x$with_old_menubar" = "xyes" ; then
87 echo "Building with old menubar"
88 AC_DEFINE([FG_OLD_MENUBAR], 1,
89 [Define to build with old menubar])
91 echo "Building with new menubar"
93 AM_CONDITIONAL(ENABLE_WEATHERCM, test "x$with_weathercm" = "xyes")
95 dnl Thread related checks
96 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=no]])
97 if test "x$with_threads" = "xyes"; then
98 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
99 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
100 CFLAGS="$CFLAGS -D_REENTRANT"
101 AC_CHECK_HEADER(pthread.h)
103 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
105 # specify the plib location
106 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
108 if test "x$with_plib" != "x" ; then
109 echo "plib prefix is $with_plib"
110 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
113 # specify the metakit location
114 AC_ARG_WITH(metakit, [ --with-metakit=PREFIX Specify the prefix path to metakit])
116 if test "x$with_metakit" != "x" ; then
117 echo "metakit prefix is $with_metakit"
118 EXTRA_DIRS="${EXTRA_DIRS} $with_metakit"
121 dnl Used by JSBSim to conditionally compile in fgfs interface code
122 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
124 # Check for MS Windows environment
125 AC_CHECK_HEADER(windows.h)
127 dnl Determine an extra directories to add to include/lib search paths
129 *-apple-darwin* | *-*-mingw32*)
130 echo no EXTRA_DIRS for $host
134 if test -d /usr/X11R6 ; then
135 EXTRA_DIR1="/usr/X11R6"
137 if test -d /opt/X11R6 ; then
138 EXTRA_DIR2="/opt/X11R6"
140 EXTRA_DIRS="$EXTRA_DIR1 $EXTRA_DIR2"
144 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
147 dnl Using AM_CONDITIONAL is a step out of the protected little
148 dnl automake fold so it is potentially dangerous. But, we are
149 dnl beginning to run into cases where the standard checks are not
150 dnl enough. AM_CONDITIONALS are then referenced to conditionally
151 dnl build a Makefile.in from a Makefile.am which lets us define custom
152 dnl includes, compile alternative source files, etc.
154 dnl Check for external variables daylight and timezone.
156 if test "$have_daylight" = yes; then
157 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
161 if test "$have_timezone" = yes; then
162 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
165 dnl add correct audio libs and configure for audio support
166 audio_LIBS="-lplibsl -lplibsm"
168 *-*-cygwin* | *-*-mingw32*)
169 audio_LIBS="$audio_LIBS -lwinmm"
173 audio_LIBS="$audio_LIBS -laudio"
179 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
180 dnl just assuming we have audio support on all platform. We can
181 dnl depend on plib to hide the details.
182 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
184 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
185 dnl to use it if it is.
187 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
188 echo no fancy X11 check
197 dnl Checks for libraries.
205 dnl Thread related checks
206 AC_CHECK_LIB(pthread, pthread_exit)
207 AC_CHECK_LIB(socket, socket)
209 dnl check for glut location
210 AC_CHECK_HEADER(GL/glut.h)
211 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
212 AC_DEFINE([GLUT_H], "GL/glut.h", [Define as glut.h include location])
214 AC_CHECK_HEADER(GLUT/glut.h)
215 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
216 AC_DEFINE([GLUT_H], "GLUT/glut.h", [Define as glut.h include location])
218 echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue"
223 dnl check for OpenGL related libraries
225 *-*-cygwin* | *-*-mingw32*)
226 dnl CygWin under Windoze.
228 echo Win32 specific hacks...
229 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
230 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
232 LIBS="$LIBS -lglut32 -lglu32 -lopengl32"
233 LIBS="$LIBS -luser32 -lgdi32"
235 dnl add -lwsock32 for mingwin
238 echo "********** BUILDING FOR MINGW32 *************"
239 base_LIBS="$base_LIBS -lws2_32"
243 echo "Will link apps with $LIBS"
250 LIBS="$LIBS -framework GLUT -framework OpenGL -framework Carbon -lobjc"
254 dnl X-Windows based machines
256 dnl Skip X11 library tests if requested.
257 if test "x$no_x" != "xyes"; then
258 AC_CHECK_LIB(X11, XCreateWindow)
259 AC_CHECK_LIB(Xext, XShmCreateImage)
260 AC_CHECK_LIB(Xi, XGetExtensionVersion)
261 AC_CHECK_LIB(ICE, IceOpenConnection)
262 AC_CHECK_LIB(SM, SmcOpenConnection)
263 AC_CHECK_LIB(Xt, XtMalloc)
264 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
267 AC_CHECK_LIB(GLcore, glNewList)
268 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
269 dnl if no GLcore, check for GL
270 AC_CHECK_LIB(GL, glNewList)
271 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
272 dnl if no GL, check for MesaGL
273 AC_CHECK_LIB(MesaGL, glNewList)
276 dnl if GLcore found, then also check for GL
277 AC_CHECK_LIB(GL, glXCreateContext)
280 dnl if using mesa, check for xmesa.h
281 if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
282 AC_CHECK_HEADER(GL/fxmesa.h)
283 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
284 AC_DEFINE([XMESA], 1, [Define for fxmesa])
285 AC_DEFINE([FX], 1, [Define for fxmesa])
289 AC_CHECK_LIB(GLU, gluLookAt)
290 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
291 dnl if no GLU, check for MesaGLU
292 AC_CHECK_LIB(MesaGLU, gluLookAt)
295 AC_CHECK_LIB(glut, glutGetModifiers)
296 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno" ; then
297 dnl if no "real" glut, check for freeglut
298 AC_CHECK_LIB(freeglut, glutGetModifiers)
308 AC_SUBST(opengl_LIBS)
310 # The following are C++ items that need to be tested for with the c++
315 # Check for "plib" without which we cannot go on
316 AC_CHECK_HEADER(plib/ul.h)
317 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
319 echo "You *must* have the plib library installed on your system to build"
320 echo "the FGFS simulator!"
322 echo "Please see README.plib for more details."
324 echo "configure aborted."
328 AC_MSG_CHECKING([for plib 1.6.0 or newer])
332 #define MIN_PLIB_VERSION 160
335 int major, minor, micro;
337 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
346 [AC_MSG_RESULT(wrong version);
347 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
351 dnl If we get here then plib is available, so force use of plib
353 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
356 dnl Checking for PSL in plib
357 dnl version of plib, so check for it.
358 AC_MSG_CHECKING([for plib PSL scripting support])
360 #include <plib/psl.h>
363 // not for running...
364 pslProgram program((pslExtension *)0);
365 program.compile("int main () {}", "");
373 AM_CONDITIONAL(HAVE_PLIB_PSL, test "x$have_plib_psl" = "xyes")
375 dnl Check for MetaKit
376 AC_CHECK_HEADER(mk4.h)
377 if test "x$ac_cv_header_mk4_h" != "xyes"; then
379 echo "MetaKit library not found."
381 echo "If your OS does not provide an installable package for MetaKit"
382 echo "you will have to compile and install it first yourself. A copy"
383 echo "of metakit-$(VERSION).tar.gz is included with SimGear. You will"
384 echo "have to untar this source code, and follow it's included instructions"
385 echo "to compile and install on your system."
387 echo "configure aborted."
391 AC_MSG_CHECKING([for metakit 2.4.3 or newer])
393 LIBS="$saved_LIBS -lmk4"
397 #define MIN_MK4_VERSION 243
400 int major, minor, micro;
402 if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
411 [AC_MSG_RESULT(wrong version);
414 Install metakit 2.4.3 or later first.
416 Or, the compiler may not be finding your libmk4.so library.
417 Please check the config.log file for specific details of the
418 failure if you believe you have the correct metakit version.
419 Also, look up this issue in the FlightGear FAQ.])],
423 dnl Check for the presence of SimGear
424 AC_CHECK_HEADER(simgear/version.h)
425 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
427 echo "You *must* have the SimGear support library installed on your system"
428 echo "to build the FGFS simulator!"
430 echo "Please see README.SimGear for more details."
432 echo "configure aborted."
436 AC_MSG_CHECKING([for simgear 0.3.0 or newer])
440 #include <simgear/version.h>
442 #define STRINGIFY(X) XSTRINGIFY(X)
443 #define XSTRINGIFY(X) #X
450 int major, minor, micro;
452 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
454 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
456 if ( major < MIN_MAJOR ) {
458 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
460 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
469 [AC_MSG_RESULT(wrong version);
470 AC_MSG_ERROR([Install latest simgear first...])],
476 dnl Check if SimGear was built with Norman JPEG factory support
477 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
478 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
479 AC_CHECK_LIB(jpeg, jpeg_start_compress)
480 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
482 echo "The JPEG factory code was built and installed with SimGear."
483 echo "However it appears the libjpeg is no longer installed."
484 echo "You need to install libjpeg or remove jpgfactory support from"
487 echo "libjpeg is available at :"
488 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
491 AC_DEFINE([FG_JPEG_SERVER], 1,
492 [Define to build with jpeg screen shot server])
494 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
498 dnl Check for system installed zlib
499 AC_CHECK_HEADER(zlib.h)
500 if test "x$ac_cv_header_zlib_h" != "xyes"; then
502 echo "zlib library not found."
504 echo "If your OS does not provide an installable package for zlib"
505 echo "you will have to compile and install it first yourself. A copy"
506 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
507 echo "have to untar this source code, and follow it's included instructions"
508 echo "to compile and install on your system."
510 echo "configure aborted."
514 dnl Checks for header files.
517 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
518 sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
520 dnl Checks for typedefs, structures, and compiler characteristics.
526 dnl Checks for library functions.
530 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
531 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
533 AM_CONFIG_HEADER(src/Include/config.h)
545 scripts/debug/Makefile \
546 scripts/python/Makefile \
548 src/Include/Makefile \
549 src/Include/version.h \
550 src/Aircraft/Makefile \
551 src/Airports/Makefile \
553 src/Autopilot/Makefile \
554 src/Cockpit/Makefile \
555 src/Cockpit/built_in/Makefile \
556 src/Controls/Makefile \
557 src/Environment/Makefile \
558 src/FDM/Balloon/Makefile \
559 src/FDM/ExternalNet/Makefile \
560 src/FDM/JSBSim/Makefile \
561 src/FDM/JSBSim/filtersjb/Makefile \
562 src/FDM/LaRCsim/Makefile \
563 src/FDM/UIUCModel/Makefile \
564 src/FDM/YASim/Makefile \
568 src/Instrumentation/Makefile \
571 src/Main/runfgfs.bat \
573 src/Navaids/Makefile \
574 src/Network/Makefile \
575 src/NetworkOLK/Makefile \
576 src/Objects/Makefile \
577 src/Scenery/Makefile \
578 src/Scripting/Makefile \
580 src/Systems/Makefile \
582 src/WeatherCM/Makefile \
585 utils/TerraSync/Makefile \
589 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
592 echo "Configure Summary"
593 echo "================="
595 echo "Prefix: $prefix"
597 if test "x$have_plib_psl" = "xyes"; then
598 echo "Plib PSL scripting: yes"
600 echo "Plib PSL scripting: $fg_psl_string_compile"
601 echo " You will not be able to run scripts written in PSL"
602 echo " and some advanced GUI and input features may not"
603 echo " work. Download and install the latest CVS version"
604 echo " of plib if you would like to enable PSL support."
607 if test "x$with_logging" != "x"; then
608 echo "Debug messages: $with_logging"
610 echo "Debug messages: yes"
613 echo -n "Automake version: "
614 automake --version | head -1
616 if test "x$with_weathercm" != "x"; then
617 echo "WeatherCM instead of FGEnvironment: $with_weathercm"
619 echo "Using FGEnvironment"
622 if test "x$with_old_menubar" != "x"; then
623 echo "Using old menubar"
625 echo "Defaulting to new XML-configurable menubar"
628 if test "x$with_threads" = "xyes"; then