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(new-environment, [ --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 Thread related checks
85 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=no]])
86 if test "x$with_threads" = "xyes"; then
87 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
88 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
89 CFLAGS="$CFLAGS -D_REENTRANT"
90 AC_CHECK_HEADER(pthread.h)
92 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
94 # specify the plib location
95 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
97 if test "x$with_plib" != "x" ; then
98 echo "plib prefix is $with_plib"
99 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
102 # specify the metakit location
103 AC_ARG_WITH(metakit, [ --with-metakit=PREFIX Specify the prefix path to metakit])
105 if test "x$with_metakit" != "x" ; then
106 echo "metakit prefix is $with_metakit"
107 EXTRA_DIRS="${EXTRA_DIRS} $with_metakit"
110 dnl Used by JSBSim to conditionally compile in fgfs interface code
111 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
113 # Check for MS Windows environment
114 AC_CHECK_HEADER(windows.h)
116 dnl Determine an extra directories to add to include/lib search paths
118 *-apple-darwin* | *-*-mingw32*)
119 echo no EXTRA_DIRS for $host
123 if test -d /usr/X11R6 ; then
124 EXTRA_DIR1="/usr/X11R6"
126 if test -d /opt/X11R6 ; then
127 EXTRA_DIR2="/opt/X11R6"
129 EXTRA_DIRS="$EXTRA_DIR1 $EXTRA_DIR2"
133 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
136 dnl Using AM_CONDITIONAL is a step out of the protected little
137 dnl automake fold so it is potentially dangerous. But, we are
138 dnl beginning to run into cases where the standard checks are not
139 dnl enough. AM_CONDITIONALS are then referenced to conditionally
140 dnl build a Makefile.in from a Makefile.am which lets us define custom
141 dnl includes, compile alternative source files, etc.
143 dnl Check for external variables daylight and timezone.
145 if test "$have_daylight" = yes; then
146 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
150 if test "$have_timezone" = yes; then
151 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
154 dnl add correct audio libs and configure for audio support
155 audio_LIBS="-lplibsl -lplibsm"
157 *-*-cygwin* | *-*-mingw32*)
158 audio_LIBS="$audio_LIBS -lwinmm"
162 audio_LIBS="$audio_LIBS -laudio"
168 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
169 dnl just assuming we have audio support on all platform. We can
170 dnl depend on plib to hide the details.
171 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
173 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
174 dnl to use it if it is.
176 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
177 echo no fancy X11 check
186 dnl Checks for libraries.
194 dnl Thread related checks
195 AC_CHECK_LIB(pthread, pthread_exit)
196 AC_CHECK_LIB(socket, socket)
198 dnl check for glut location
199 AC_CHECK_HEADER(GL/glut.h)
200 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
201 AC_DEFINE([GLUT_H], "GL/glut.h", [Define as glut.h include location])
203 AC_CHECK_HEADER(GLUT/glut.h)
204 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
205 AC_DEFINE([GLUT_H], "GLUT/glut.h", [Define as glut.h include location])
207 echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue"
212 dnl check for OpenGL related libraries
214 *-*-cygwin* | *-*-mingw32*)
215 dnl CygWin under Windoze.
217 echo Win32 specific hacks...
218 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
219 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
221 LIBS="$LIBS -lglut32 -lglu32 -lopengl32"
222 LIBS="$LIBS -luser32 -lgdi32"
224 dnl add -lwsock32 for mingwin
227 echo "********** BUILDING FOR MINGW32 *************"
228 base_LIBS="$base_LIBS -lws2_32"
232 echo "Will link apps with $LIBS"
239 LIBS="$LIBS -framework GLUT -framework OpenGL -framework Carbon -lobjc"
243 dnl X-Windows based machines
245 dnl Skip X11 library tests if requested.
246 if test "x$no_x" != "xyes"; then
247 AC_CHECK_LIB(X11, XCreateWindow)
248 AC_CHECK_LIB(Xext, XShmCreateImage)
249 AC_CHECK_LIB(Xi, XGetExtensionVersion)
250 AC_CHECK_LIB(ICE, IceOpenConnection)
251 AC_CHECK_LIB(SM, SmcOpenConnection)
252 AC_CHECK_LIB(Xt, XtMalloc)
253 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
256 AC_CHECK_LIB(GLcore, glNewList)
257 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
258 dnl if no GLcore, check for GL
259 AC_CHECK_LIB(GL, glNewList)
260 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
261 dnl if no GL, check for MesaGL
262 AC_CHECK_LIB(MesaGL, glNewList)
265 dnl if GLcore found, then also check for GL
266 AC_CHECK_LIB(GL, glXCreateContext)
269 dnl if using mesa, check for xmesa.h
270 if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
271 AC_CHECK_HEADER(GL/fxmesa.h)
272 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
273 AC_DEFINE([XMESA], 1, [Define for fxmesa])
274 AC_DEFINE([FX], 1, [Define for fxmesa])
278 AC_CHECK_LIB(GLU, gluLookAt)
279 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
280 dnl if no GLU, check for MesaGLU
281 AC_CHECK_LIB(MesaGLU, gluLookAt)
284 AC_CHECK_LIB(glut, glutGetModifiers)
285 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno" ; then
286 dnl if no "real" glut, check for freeglut
287 AC_CHECK_LIB(freeglut, glutGetModifiers)
297 AC_SUBST(opengl_LIBS)
299 # The following are C++ items that need to be tested for with the c++
304 # Check for "plib" without which we cannot go on
305 AC_CHECK_HEADER(plib/ul.h)
306 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
308 echo "You *must* have the plib library installed on your system to build"
309 echo "the FGFS simulator!"
311 echo "Please see README.plib for more details."
313 echo "configure aborted."
317 AC_MSG_CHECKING([for plib 1.6.0 or newer])
321 #define MIN_PLIB_VERSION 160
324 int major, minor, micro;
326 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
335 [AC_MSG_RESULT(wrong version);
336 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
340 dnl If we get here then plib is available, so force use of plib
342 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
345 dnl Compiling an in-memory PSL script is available only in the CVS
346 dnl version of plib, so check for it.
347 AC_MSG_CHECKING([for plib PSL in-memory script compilation support])
349 #include <plib/psl.h>
352 // not for running...
353 pslProgram program((pslExtension *)0);
354 program.compile("int main () {}", "");
359 fg_psl_string_compile=yes],
362 if test "x$fg_psl_string_compile" = "xyes"; then
363 AC_DEFINE([FG_PSL_STRING_COMPILE], 1,
364 [Support for compiling PSL scripts from an in-memory string.])
367 dnl Check for MetaKit
368 AC_CHECK_HEADER(mk4.h)
369 if test "x$ac_cv_header_mk4_h" != "xyes"; then
371 echo "MetaKit library not found."
373 echo "If your OS does not provide an installable package for MetaKit"
374 echo "you will have to compile and install it first yourself. A copy"
375 echo "of metakit-$(VERSION).tar.gz is included with SimGear. You will"
376 echo "have to untar this source code, and follow it's included instructions"
377 echo "to compile and install on your system."
379 echo "configure aborted."
383 AC_MSG_CHECKING([for metakit 2.4.3 or newer])
385 LIBS="$saved_LIBS -lmk4"
389 #define MIN_MK4_VERSION 243
392 int major, minor, micro;
394 if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
403 [AC_MSG_RESULT(wrong version);
406 Install metakit 2.4.3 or later first.
408 Or, the compiler may not be finding your libmk4.so library.
409 Please check the config.log file for specific details of the
410 failure if you believe you have the correct metakit version.
411 Also, look up this issue in the FlightGear FAQ.])],
415 dnl Check for the presence of SimGear
416 AC_CHECK_HEADER(simgear/version.h)
417 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
419 echo "You *must* have the SimGear support library installed on your system"
420 echo "to build the FGFS simulator!"
422 echo "Please see README.SimGear for more details."
424 echo "configure aborted."
428 AC_MSG_CHECKING([for simgear 0.3.0 or newer])
432 #include <simgear/version.h>
434 #define STRINGIFY(X) XSTRINGIFY(X)
435 #define XSTRINGIFY(X) #X
442 int major, minor, micro;
444 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
446 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
448 if ( major < MIN_MAJOR ) {
450 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
452 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
461 [AC_MSG_RESULT(wrong version);
462 AC_MSG_ERROR([Install latest simgear first...])],
468 dnl Check if SimGear was built with Norman JPEG factory support
469 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
470 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
471 AC_CHECK_LIB(jpeg, jpeg_start_compress)
472 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
474 echo "The JPEG factory code was built and installed with SimGear."
475 echo "However it appears the libjpeg is no longer installed."
476 echo "You need to install libjpeg or remove jpgfactory support from"
479 echo "libjpeg is available at :"
480 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
483 AC_DEFINE([FG_JPEG_SERVER], 1,
484 [Define to build with jpeg screen shot server])
486 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
490 dnl Check for system installed zlib
491 AC_CHECK_HEADER(zlib.h)
492 if test "x$ac_cv_header_zlib_h" != "xyes"; then
494 echo "zlib library not found."
496 echo "If your OS does not provide an installable package for zlib"
497 echo "you will have to compile and install it first yourself. A copy"
498 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
499 echo "have to untar this source code, and follow it's included instructions"
500 echo "to compile and install on your system."
502 echo "configure aborted."
506 dnl Checks for header files.
509 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
510 sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
512 dnl Checks for typedefs, structures, and compiler characteristics.
518 dnl Checks for library functions.
522 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
523 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
525 AM_CONFIG_HEADER(src/Include/config.h)
537 scripts/debug/Makefile \
538 scripts/python/Makefile \
540 src/Include/Makefile \
541 src/Include/version.h \
542 src/Aircraft/Makefile \
543 src/Airports/Makefile \
545 src/Autopilot/Makefile \
546 src/Cockpit/Makefile \
547 src/Cockpit/built_in/Makefile \
548 src/Controls/Makefile \
549 src/Environment/Makefile \
550 src/FDM/Balloon/Makefile \
551 src/FDM/ExternalNet/Makefile \
552 src/FDM/JSBSim/Makefile \
553 src/FDM/JSBSim/filtersjb/Makefile \
554 src/FDM/LaRCsim/Makefile \
555 src/FDM/UIUCModel/Makefile \
556 src/FDM/YASim/Makefile \
560 src/Instrumentation/Makefile \
563 src/Main/runfgfs.bat \
565 src/Navaids/Makefile \
566 src/Network/Makefile \
567 src/NetworkOLK/Makefile \
568 src/Objects/Makefile \
569 src/Scenery/Makefile \
570 src/Scripting/Makefile \
572 src/Systems/Makefile \
574 src/WeatherCM/Makefile \
577 utils/TerraSync/Makefile \
581 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
584 echo "Configure Summary"
585 echo "================="
587 echo "Prefix: $prefix"
589 if test "x$fg_psl_string_compile" = "xyes"; then
590 echo "Scripts for input bindings: yes"
592 echo "Scripts for input bindings: $fg_psl_string_compile"
593 echo " PSL scripts attached to input bindings will not"
594 echo " work. Download the latest CVS version of plib"
595 echo " if you would like to enable them."
598 if test "x$with_logging" != "x"; then
599 echo "Debug messages: $with_logging"
601 echo "Debug messages: yes"
604 echo -n "Automake version: "
605 automake --version | head -1
607 if test "x$with_weathercm" != "x"; then
608 echo "WeatherCM instead of FGEnvironment: $with_weathercm"
610 echo "Using FGEnvironment"
613 if test "x$with_threads" = "xyes"; then