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.2)
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 Multiplayer support
61 # default to with_network=yes
62 AC_ARG_WITH(multiplayer, [ --with-multiplayer Include default multiplayer support])
63 AC_ARG_WITH(network_olk, [ --with-network-olk Include Oliver's multi-pilot networking support [default=no]])
65 if test "x$with_multiplayer" = "xno" -a "x$with_network_olk" = "xno"; then
66 echo "Building without any kind of multiplayer support"
68 elif test "x$with_multiplayer" = "xno"; then
69 # echo "Building without default multiplayer support"
70 echo "Building with Oliver's multi-pilot network support"
71 AC_DEFINE([FG_NETWORK_OLK], 1, [Define to build with Oliver's networking])
74 echo "Building with default multiplayer support"
75 # echo "Building without Oliver's multi-pilot network support"
76 AC_DEFINE([FG_MPLAYER_AS], 1, [Define to build with default multiplayer support])
79 AM_CONDITIONAL(ENABLE_NETWORK_OLK, test "x$with_network_olk" != "xno" -a "x$with_multiplayer" = "xno")
80 AM_CONDITIONAL(ENABLE_MPLAYER_AS, test "x$with_multiplayer" != "xno")
83 # Specify if we want to use WeatherCM instead of FGEnvironment.
84 # default to with_weathercm=no
85 AC_ARG_WITH(weathercm, [ --with-weathercm Use WeatherCM instead of FGEnvironment])
86 if test "x$with_weathercm" = "xyes" ; then
87 echo "Building with WeatherCM"
88 AC_DEFINE([FG_WEATHERCM], 1,
89 [Define to build with Christian Mayer's weather code])
91 echo "Building with FGEnvironment"
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"
102 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 dnl Used by JSBSim to conditionally compile in fgfs interface code
114 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
116 dnl Used to controll whether clouds3d should be compiled in or not
117 AC_DEFINE([FG_USE_CLOUDS_3D], 1, [Define to use 3D cloud support])
118 AM_CONDITIONAL(FG_USE_CLOUDS_3D, test "x" = "x")
120 # Check for MS Windows environment
121 AC_CHECK_HEADER(windows.h)
123 dnl Determine an extra directories to add to include/lib search paths
125 *-apple-darwin* | *-*-mingw32*)
126 echo no EXTRA_DIRS for $host
130 if test -d /usr/X11R6 ; then
131 EXTRA_DIR1="/usr/X11R6"
133 if test -d /opt/X11R6 ; then
134 EXTRA_DIR2="/opt/X11R6"
136 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2"
140 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
143 dnl Using AM_CONDITIONAL is a step out of the protected little
144 dnl automake fold so it is potentially dangerous. But, we are
145 dnl beginning to run into cases where the standard checks are not
146 dnl enough. AM_CONDITIONALS are then referenced to conditionally
147 dnl build a Makefile.in from a Makefile.am which lets us define custom
148 dnl includes, compile alternative source files, etc.
150 dnl Check for external variables daylight and timezone.
152 if test "$have_daylight" = yes; then
153 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
157 if test "$have_timezone" = yes; then
158 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
161 dnl add correct audio libs and configure for audio support
162 audio_LIBS="-lplibsl -lplibsm"
164 *-*-cygwin* | *-*-mingw32*)
165 audio_LIBS="$audio_LIBS -lwinmm"
168 audio_LIBS="$audio_LIBS -framework IOKit -framework CoreFoundation"
171 audio_LIBS="$audio_LIBS -laudio"
177 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
178 dnl just assuming we have audio support on all platform. We can
179 dnl depend on plib to hide the details.
180 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
182 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
183 dnl to use it if it is.
185 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
186 echo no fancy X11 check
195 dnl Checks for libraries.
197 dnl Thread related checks
198 AC_CHECK_LIB(pthread, pthread_exit)
199 if test "x$ac_cv_lib_pthread_pthread_exit" != "xyes" \
200 -a "x$ac_cv_header_pthread_h" = "xyes"; then
201 dnl FreeBSD: System has pthread.h, but -lpthread library check
202 dnl fails. See if we need -pthread instead of -lpthread and look
203 dnl for the functions in libc_r.
204 save_CXXFLAGS="$CXXFLAGS"
205 save_CFLAGS="$CFLAGS"
206 CXXFLAGS="-pthread $CXXFLAGS"
207 CFLAGS="-pthread $CFLAGS"
209 AC_CHECK_LIB(c_r, pthread_exit)
210 if test "x$ac_cv_lib_c_r_pthread_exit" != "xyes"; then
211 CXXFLAGS=$save_CXXFLAGS
220 dnl search for network related libraries
221 AC_SEARCH_LIBS(inet_addr, xnet)
222 AC_SEARCH_LIBS(socket, socket)
223 AC_SEARCH_LIBS(main, nsl)
228 dnl check for some default libraries
229 AC_SEARCH_LIBS(cos, m)
230 AC_SEARCH_LIBS(dlclose, dl)
234 dnl check for glut location
235 AC_CHECK_HEADER(GL/glut.h)
236 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
237 AC_DEFINE([FG_GLUT_H], <GL/glut.h>, [Define as glut.h include location])
239 AC_CHECK_HEADER(GLUT/glut.h)
240 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
241 AC_DEFINE([FG_GLUT_H], <GLUT/glut.h>, [Define as glut.h include location])
243 echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue"
248 dnl check for OpenGL related libraries
250 *-*-cygwin* | *-*-mingw32*)
251 dnl CygWin under Windoze.
253 echo Win32 specific hacks...
254 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
255 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
257 LIBS="$LIBS -lglut32 -lglu32 -lopengl32"
258 LIBS="$LIBS -luser32 -lgdi32"
260 dnl add -lwsock32 for mingwin
263 echo "********** BUILDING FOR MINGW32 *************"
264 base_LIBS="$base_LIBS -lws2_32"
268 echo "Will link apps with $LIBS"
275 LIBS="$LIBS -framework GLUT -framework OpenGL -framework Carbon -lobjc"
279 dnl X-Windows based machines
281 dnl Skip X11 library tests if requested.
282 if test "x$no_x" != "xyes"; then
283 AC_SEARCH_LIBS(XCreateWindow, X11)
284 AC_SEARCH_LIBS(XShmCreateImage, Xext)
285 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
286 AC_SEARCH_LIBS(IceOpenConnection, ICE)
287 AC_SEARCH_LIBS(SmcOpenConnection, SM)
288 AC_SEARCH_LIBS(XtMalloc, Xt)
289 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
292 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
293 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
294 dnl if GLcore found, then also check for GL
295 AC_SEARCH_LIBS(glXCreateContext, GL)
298 dnl if using mesa, check for xmesa.h
299 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
300 AC_CHECK_HEADER(GL/fxmesa.h)
301 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
302 AC_DEFINE([XMESA], 1, [Define for fxmesa])
303 AC_DEFINE([FX], 1, [Define for fxmesa])
307 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
308 AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
317 AC_SUBST(opengl_LIBS)
318 AC_SUBST(thread_LIBS)
319 AC_SUBST(network_LIBS)
321 # The following are C++ items that need to be tested for with the c++
326 # Check for "plib" without which we cannot go on
327 AC_CHECK_HEADER(plib/ul.h)
328 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
330 echo "You *must* have the plib library installed on your system to build"
331 echo "the FGFS simulator!"
333 echo "Please see README.plib for more details."
335 echo "configure aborted."
339 AC_MSG_CHECKING([for plib 1.6.0 or newer])
343 #define MIN_PLIB_VERSION 160
346 int major, minor, micro;
348 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
357 [AC_MSG_RESULT(wrong version);
358 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
362 dnl If we get here then plib is available, so force use of plib
364 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
367 dnl Checking for PSL in plib
368 dnl version of plib, so check for it.
369 AC_MSG_CHECKING([for plib PSL scripting support])
371 #include <plib/psl.h>
374 // not for running...
375 pslProgram program((pslExtension *)0);
376 program.compile("int main () {}", "");
384 AM_CONDITIONAL(HAVE_PLIB_PSL, test "x$have_plib_psl" = "xyes")
385 if test "x$have_plib_psl" = "xyes"; then
386 AC_DEFINE([HAVE_PLIB_PSL], 1,
387 [Define if plib version is new enough to provide "PSL"])
390 dnl Check for the presence of SimGear
391 AC_CHECK_HEADER(simgear/version.h)
392 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
394 echo "You *must* have the SimGear support library installed on your system"
395 echo "to build the FGFS simulator!"
397 echo "Please see README.SimGear for more details."
399 echo "configure aborted."
403 AC_MSG_CHECKING([for simgear 0.3.3 or newer])
407 #include <simgear/version.h>
409 #define STRINGIFY(X) XSTRINGIFY(X)
410 #define XSTRINGIFY(X) #X
417 int major, minor, micro;
419 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
421 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
423 if ( major < MIN_MAJOR ) {
425 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
427 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
436 [AC_MSG_RESULT(wrong version);
437 AC_MSG_ERROR([Install latest simgear first...])],
443 dnl Check if SimGear was built with Norman JPEG factory support
444 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
445 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
446 AC_CHECK_LIB(jpeg, jpeg_start_compress)
447 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
449 echo "The JPEG factory code was built and installed with SimGear."
450 echo "However it appears the libjpeg is no longer installed."
451 echo "You need to install libjpeg or remove jpgfactory support from"
454 echo "libjpeg is available at :"
455 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
458 AC_DEFINE([FG_JPEG_SERVER], 1,
459 [Define to build with jpeg screen shot server])
461 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
465 dnl Check for system installed zlib
466 AC_CHECK_HEADER(zlib.h)
467 if test "x$ac_cv_header_zlib_h" != "xyes"; then
469 echo "zlib library not found."
471 echo "If your OS does not provide an installable package for zlib"
472 echo "you will have to compile and install it first yourself. A copy"
473 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
474 echo "have to untar this source code, and follow it's included instructions"
475 echo "to compile and install on your system."
477 echo "configure aborted."
481 dnl Checks for header files.
484 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
485 sys/time.h sys/timeb.h unistd.h windows.h values.h )
487 dnl Checks for typedefs, structures, and compiler characteristics.
493 dnl Checks for library functions.
497 ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
498 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
500 AM_CONFIG_HEADER(src/Include/config.h)
512 scripts/debug/Makefile \
513 scripts/python/Makefile \
515 src/Include/Makefile \
516 src/Include/version.h \
517 src/Aircraft/Makefile \
518 src/Airports/Makefile \
520 src/Autopilot/Makefile \
521 src/Cockpit/Makefile \
522 src/Cockpit/built_in/Makefile \
523 src/Controls/Makefile \
524 src/Environment/Makefile \
525 src/FDM/Balloon/Makefile \
526 src/FDM/ExternalNet/Makefile \
527 src/FDM/ExternalPipe/Makefile \
528 src/FDM/JSBSim/Makefile \
529 src/FDM/JSBSim/filtersjb/Makefile \
530 src/FDM/LaRCsim/Makefile \
531 src/FDM/UIUCModel/Makefile \
532 src/FDM/YASim/Makefile \
536 src/Instrumentation/Makefile \
539 src/Main/runfgfs.bat \
541 src/MultiPlayer/Makefile \
542 src/Navaids/Makefile \
543 src/Network/Makefile \
544 src/NetworkOLK/Makefile \
545 src/Objects/Makefile \
546 src/Replay/Makefile \
547 src/Scenery/Makefile \
548 src/Scripting/Makefile \
550 src/Systems/Makefile \
552 src/WeatherCM/Makefile \
555 utils/TerraSync/Makefile \
559 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
562 echo "Configure Summary"
563 echo "================="
565 echo "Prefix: $prefix"
567 if test "x$have_plib_psl" = "xyes"; then
568 echo "Plib PSL scripting: yes"
570 echo "Plib PSL scripting: $fg_psl_string_compile"
571 echo " You will not be able to run scripts written in PSL"
572 echo " and some advanced GUI and input features may not"
573 echo " work. Download and install the latest CVS version"
574 echo " of plib if you would like to enable PSL support."
577 if test "x$with_logging" != "x"; then
578 echo "Debug messages: $with_logging"
580 echo "Debug messages: yes"
583 echo -n "Automake version: "
584 automake --version | head -1
586 if test "x$with_weathercm" != "x"; then
587 echo "WeatherCM instead of FGEnvironment: $with_weathercm"
589 echo "Using FGEnvironment"
592 if test "x$with_multiplayer" != "xno"; then
593 echo "Using default multiplayer support"
594 elif test "x$with_network_olk" != "xno"; then
595 echo "Using Oliver's multi-pilot network support"
598 if test "x$with_threads" = "xyes"; then