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 # 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_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"
172 audio_LIBS="$audio_LIBS -framework IOKit -framework CoreFoundation"
175 audio_LIBS="$audio_LIBS -laudio"
181 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
182 dnl just assuming we have audio support on all platform. We can
183 dnl depend on plib to hide the details.
184 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
186 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
187 dnl to use it if it is.
189 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
190 echo no fancy X11 check
199 dnl Checks for libraries.
203 AC_SEARCH_LIBS(cos, m)
207 dnl Thread related checks
208 AC_CHECK_LIB(pthread, pthread_exit)
209 if test "x$ac_cv_lib_pthread_pthread_exit" != "xyes" \
210 -a "x$ac_cv_header_pthread_h" = "xyes"; then
211 dnl FreeBSD: System has pthread.h, but -lpthread library check
212 dnl fails. See if we need -pthread instead of -lpthread and look
213 dnl for the functions in libc_r.
214 save_CXXFLAGS="$CXXFLAGS"
215 save_CFLAGS="$CFLAGS"
216 CXXFLAGS="-pthread $CXXFLAGS"
217 CFLAGS="-pthread $FLAGS"
219 AC_CHECK_LIB(c_r, pthread_exit)
220 if test "x$ac_cv_lib_c_r_pthread_exit" != "xyes"; then
221 CXXFLAGS=$save_CXXFLAGS
227 AC_SEARCH_LIBS(inet_addr, xnet)
228 AC_SEARCH_LIBS(socket, socket)
229 AC_SEARCH_LIBS(main, nsl)
230 AC_SEARCH_LIBS(dlclose, dl)
232 dnl check for glut location
233 AC_CHECK_HEADER(GL/glut.h)
234 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
235 AC_DEFINE([GLUT_H], "GL/glut.h", [Define as glut.h include location])
237 AC_CHECK_HEADER(GLUT/glut.h)
238 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
239 AC_DEFINE([GLUT_H], <GLUT/glut.h>, [Define as glut.h include location])
241 echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue"
246 dnl check for OpenGL related libraries
248 *-*-cygwin* | *-*-mingw32*)
249 dnl CygWin under Windoze.
251 echo Win32 specific hacks...
252 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
253 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
255 LIBS="$LIBS -lglut32 -lglu32 -lopengl32"
256 LIBS="$LIBS -luser32 -lgdi32"
258 dnl add -lwsock32 for mingwin
261 echo "********** BUILDING FOR MINGW32 *************"
262 base_LIBS="$base_LIBS -lws2_32"
266 echo "Will link apps with $LIBS"
273 LIBS="$LIBS -framework GLUT -framework OpenGL -framework Carbon -lobjc"
277 dnl X-Windows based machines
279 dnl Skip X11 library tests if requested.
280 if test "x$no_x" != "xyes"; then
281 AC_SEARCH_LIBS(XCreateWindow, X11)
282 AC_SEARCH_LIBS(XShmCreateImage, Xext)
283 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
284 AC_SEARCH_LIBS(IceOpenConnection, ICE)
285 AC_SEARCH_LIBS(SmcOpenConnection, SM)
286 AC_SEARCH_LIBS(XtMalloc, Xt)
287 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
290 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
291 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
292 dnl if GLcore found, then also check for GL
293 AC_SEARCH_LIBS(glXCreateContext, GL)
296 dnl if using mesa, check for xmesa.h
297 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
298 AC_CHECK_HEADER(GL/fxmesa.h)
299 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
300 AC_DEFINE([XMESA], 1, [Define for fxmesa])
301 AC_DEFINE([FX], 1, [Define for fxmesa])
305 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
306 AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
315 AC_SUBST(opengl_LIBS)
317 # The following are C++ items that need to be tested for with the c++
322 # Check for "plib" without which we cannot go on
323 AC_CHECK_HEADER(plib/ul.h)
324 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
326 echo "You *must* have the plib library installed on your system to build"
327 echo "the FGFS simulator!"
329 echo "Please see README.plib for more details."
331 echo "configure aborted."
335 AC_MSG_CHECKING([for plib 1.6.0 or newer])
339 #define MIN_PLIB_VERSION 160
342 int major, minor, micro;
344 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
353 [AC_MSG_RESULT(wrong version);
354 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
358 dnl If we get here then plib is available, so force use of plib
360 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
363 dnl Checking for PSL in plib
364 dnl version of plib, so check for it.
365 AC_MSG_CHECKING([for plib PSL scripting support])
367 #include <plib/psl.h>
370 // not for running...
371 pslProgram program((pslExtension *)0);
372 program.compile("int main () {}", "");
380 AM_CONDITIONAL(HAVE_PLIB_PSL, test "x$have_plib_psl" = "xyes")
381 if test "x$have_plib_psl" = "xyes"; then
382 AC_DEFINE([HAVE_PLIB_PSL], 1,
383 [Define if plib version is new enough to provide "PSL"])
386 dnl Check for MetaKit
387 AC_CHECK_HEADER(mk4.h)
388 if test "x$ac_cv_header_mk4_h" != "xyes"; then
390 echo "MetaKit library not found."
392 echo "If your OS does not provide an installable package for MetaKit"
393 echo "you will have to compile and install it first yourself. A copy"
394 echo "of metakit-$(VERSION).tar.gz is included with SimGear. You will"
395 echo "have to untar this source code, and follow it's included instructions"
396 echo "to compile and install on your system."
398 echo "configure aborted."
402 AC_MSG_CHECKING([for metakit 2.4.3 or newer])
404 LIBS="$saved_LIBS -lmk4"
408 #define MIN_MK4_VERSION 243
411 int major, minor, micro;
413 if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
422 [AC_MSG_RESULT(wrong version);
425 Install metakit 2.4.3 or later first.
427 Or, the compiler may not be finding your libmk4.so library.
428 Please check the config.log file for specific details of the
429 failure if you believe you have the correct metakit version.
430 Also, look up this issue in the FlightGear FAQ.])],
434 dnl Check for the presence of SimGear
435 AC_CHECK_HEADER(simgear/version.h)
436 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
438 echo "You *must* have the SimGear support library installed on your system"
439 echo "to build the FGFS simulator!"
441 echo "Please see README.SimGear for more details."
443 echo "configure aborted."
447 AC_MSG_CHECKING([for simgear 0.3.3 or newer])
451 #include <simgear/version.h>
453 #define STRINGIFY(X) XSTRINGIFY(X)
454 #define XSTRINGIFY(X) #X
461 int major, minor, micro;
463 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
465 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
467 if ( major < MIN_MAJOR ) {
469 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
471 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
480 [AC_MSG_RESULT(wrong version);
481 AC_MSG_ERROR([Install latest simgear first...])],
487 dnl Check if SimGear was built with Norman JPEG factory support
488 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
489 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
490 AC_CHECK_LIB(jpeg, jpeg_start_compress)
491 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
493 echo "The JPEG factory code was built and installed with SimGear."
494 echo "However it appears the libjpeg is no longer installed."
495 echo "You need to install libjpeg or remove jpgfactory support from"
498 echo "libjpeg is available at :"
499 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
502 AC_DEFINE([FG_JPEG_SERVER], 1,
503 [Define to build with jpeg screen shot server])
505 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
509 dnl Check for system installed zlib
510 AC_CHECK_HEADER(zlib.h)
511 if test "x$ac_cv_header_zlib_h" != "xyes"; then
513 echo "zlib library not found."
515 echo "If your OS does not provide an installable package for zlib"
516 echo "you will have to compile and install it first yourself. A copy"
517 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
518 echo "have to untar this source code, and follow it's included instructions"
519 echo "to compile and install on your system."
521 echo "configure aborted."
525 dnl Checks for header files.
528 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
529 sys/time.h sys/timeb.h unistd.h windows.h values.h )
531 dnl Checks for typedefs, structures, and compiler characteristics.
537 dnl Checks for library functions.
541 ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
542 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
544 AM_CONFIG_HEADER(src/Include/config.h)
556 scripts/debug/Makefile \
557 scripts/python/Makefile \
559 src/Include/Makefile \
560 src/Include/version.h \
561 src/Aircraft/Makefile \
562 src/Airports/Makefile \
564 src/Autopilot/Makefile \
565 src/Cockpit/Makefile \
566 src/Cockpit/built_in/Makefile \
567 src/Controls/Makefile \
568 src/Environment/Makefile \
569 src/FDM/Balloon/Makefile \
570 src/FDM/ExternalNet/Makefile \
571 src/FDM/ExternalPipe/Makefile \
572 src/FDM/JSBSim/Makefile \
573 src/FDM/JSBSim/filtersjb/Makefile \
574 src/FDM/LaRCsim/Makefile \
575 src/FDM/UIUCModel/Makefile \
576 src/FDM/YASim/Makefile \
580 src/Instrumentation/Makefile \
583 src/Main/runfgfs.bat \
585 src/MultiPlayer/Makefile \
586 src/Navaids/Makefile \
587 src/Network/Makefile \
588 src/NetworkOLK/Makefile \
589 src/Objects/Makefile \
590 src/Scenery/Makefile \
591 src/Scripting/Makefile \
593 src/Systems/Makefile \
595 src/WeatherCM/Makefile \
598 utils/TerraSync/Makefile \
602 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
605 echo "Configure Summary"
606 echo "================="
608 echo "Prefix: $prefix"
610 if test "x$have_plib_psl" = "xyes"; then
611 echo "Plib PSL scripting: yes"
613 echo "Plib PSL scripting: $fg_psl_string_compile"
614 echo " You will not be able to run scripts written in PSL"
615 echo " and some advanced GUI and input features may not"
616 echo " work. Download and install the latest CVS version"
617 echo " of plib if you would like to enable PSL support."
620 if test "x$with_logging" != "x"; then
621 echo "Debug messages: $with_logging"
623 echo "Debug messages: yes"
626 echo -n "Automake version: "
627 automake --version | head -1
629 if test "x$with_weathercm" != "x"; then
630 echo "WeatherCM instead of FGEnvironment: $with_weathercm"
632 echo "Using FGEnvironment"
635 if test "x$with_multiplayer" != "xno"; then
636 echo "Using default multiplayer support"
637 elif test "x$with_network_olk" != "xno"; then
638 echo "Using Oliver's multi-pilot network support"
641 if test "x$with_threads" = "xyes"; then