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.3)
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 multiplayer support [default=yes]])
64 if test "x$with_multiplayer" = "xno"; then
65 echo "Building without any kind of multiplayer support"
67 echo "Building with multiplayer support"
68 AC_DEFINE([FG_MPLAYER_AS], 1, [Define to build with multiplayer support])
70 AM_CONDITIONAL(ENABLE_MPLAYER_AS, test "x$with_multiplayer" != "xno")
73 # Specify if we want to use WeatherCM instead of FGEnvironment.
74 # default to with_weathercm=no
75 AC_ARG_WITH(weathercm, [ --with-weathercm Use WeatherCM instead of FGEnvironment])
76 if test "x$with_weathercm" = "xyes" ; then
77 echo "Building with WeatherCM"
78 AC_DEFINE([FG_WEATHERCM], 1,
79 [Define to build with Christian Mayer's weather code])
81 echo "Building with FGEnvironment"
83 AM_CONDITIONAL(ENABLE_WEATHERCM, test "x$with_weathercm" = "xyes")
85 dnl Thread related checks
86 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=no]])
87 if test "x$with_threads" = "xyes"; then
88 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
89 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
90 CFLAGS="$CFLAGS -D_REENTRANT"
92 AC_CHECK_HEADER(pthread.h)
93 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
95 # specify the plib location
96 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
98 if test "x$with_plib" != "x" ; then
99 echo "plib prefix is $with_plib"
100 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
103 dnl Used by JSBSim to conditionally compile in fgfs interface code
104 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
106 dnl Used to controll whether clouds3d should be compiled in or not
107 AC_DEFINE([FG_USE_CLOUDS_3D], 1, [Define to use 3D cloud support])
108 AM_CONDITIONAL(FG_USE_CLOUDS_3D, test "x" = "x")
110 # Check for MS Windows environment
111 AC_CHECK_HEADER(windows.h)
113 dnl Determine an extra directories to add to include/lib search paths
115 *-apple-darwin* | *-*-mingw32*)
116 echo no EXTRA_DIRS for $host
120 if test -d /usr/X11R6 ; then
121 EXTRA_DIR1="/usr/X11R6"
123 if test -d /opt/X11R6 ; then
124 EXTRA_DIR2="/opt/X11R6"
126 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2"
130 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
133 dnl Using AM_CONDITIONAL is a step out of the protected little
134 dnl automake fold so it is potentially dangerous. But, we are
135 dnl beginning to run into cases where the standard checks are not
136 dnl enough. AM_CONDITIONALS are then referenced to conditionally
137 dnl build a Makefile.in from a Makefile.am which lets us define custom
138 dnl includes, compile alternative source files, etc.
140 dnl Check for external variables daylight and timezone.
142 if test "$have_daylight" = yes; then
143 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
147 if test "$have_timezone" = yes; then
148 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
151 dnl add correct audio libs and configure for audio support
152 audio_LIBS="-lplibsl -lplibsm"
154 *-*-cygwin* | *-*-mingw32*)
155 audio_LIBS="$audio_LIBS -lwinmm"
158 audio_LIBS="$audio_LIBS -framework IOKit -framework CoreFoundation"
161 audio_LIBS="$audio_LIBS -laudio"
167 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
168 dnl just assuming we have audio support on all platform. We can
169 dnl depend on plib to hide the details.
170 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
172 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
173 dnl to use it if it is.
175 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
176 echo no fancy X11 check
185 dnl Checks for libraries.
187 dnl Thread related checks
188 AC_CHECK_LIB(pthread, pthread_exit)
189 if test "x$ac_cv_lib_pthread_pthread_exit" != "xyes" \
190 -a "x$ac_cv_header_pthread_h" = "xyes"; then
191 dnl FreeBSD: System has pthread.h, but -lpthread library check
192 dnl fails. See if we need -pthread instead of -lpthread and look
193 dnl for the functions in libc_r.
194 save_CXXFLAGS="$CXXFLAGS"
195 save_CFLAGS="$CFLAGS"
196 CXXFLAGS="-pthread $CXXFLAGS"
197 CFLAGS="-pthread $CFLAGS"
199 AC_CHECK_LIB(c_r, pthread_exit)
200 if test "x$ac_cv_lib_c_r_pthread_exit" != "xyes"; then
201 CXXFLAGS=$save_CXXFLAGS
210 dnl search for network related libraries
211 AC_SEARCH_LIBS(inet_addr, xnet)
212 AC_SEARCH_LIBS(socket, socket)
213 AC_SEARCH_LIBS(main, nsl)
218 dnl check for some default libraries
219 AC_SEARCH_LIBS(cos, m)
220 AC_SEARCH_LIBS(dlclose, dl)
224 dnl check for glut location
225 AC_CHECK_HEADER(GL/glut.h)
226 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
227 AC_DEFINE([FG_GLUT_H], <GL/glut.h>, [Define as glut.h include location])
229 AC_CHECK_HEADER(GLUT/glut.h)
230 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
231 AC_DEFINE([FG_GLUT_H], <GLUT/glut.h>, [Define as glut.h include location])
233 echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue"
238 dnl check for OpenGL related libraries
240 *-*-cygwin* | *-*-mingw32*)
241 dnl CygWin under Windoze.
243 echo Win32 specific hacks...
244 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
245 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
247 LIBS="$LIBS -lglut32 -lglu32 -lopengl32"
248 LIBS="$LIBS -luser32 -lgdi32"
250 dnl add -lwsock32 for mingwin
253 echo "********** BUILDING FOR MINGW32 *************"
254 base_LIBS="$base_LIBS -lws2_32"
258 echo "Will link apps with $LIBS"
265 LIBS="$LIBS -framework GLUT -framework OpenGL -framework Carbon -lobjc"
269 dnl X-Windows based machines
271 dnl Skip X11 library tests if requested.
272 if test "x$no_x" != "xyes"; then
273 AC_SEARCH_LIBS(XCreateWindow, X11)
274 AC_SEARCH_LIBS(XShmCreateImage, Xext)
275 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
276 AC_SEARCH_LIBS(IceOpenConnection, ICE)
277 AC_SEARCH_LIBS(SmcOpenConnection, SM)
278 AC_SEARCH_LIBS(XtMalloc, Xt)
279 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
282 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
283 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
284 dnl if GLcore found, then also check for GL
285 AC_SEARCH_LIBS(glXCreateContext, GL)
288 dnl if using mesa, check for xmesa.h
289 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
290 AC_CHECK_HEADER(GL/fxmesa.h)
291 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
292 AC_DEFINE([XMESA], 1, [Define for fxmesa])
293 AC_DEFINE([FX], 1, [Define for fxmesa])
297 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
298 AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
307 AC_SUBST(opengl_LIBS)
308 AC_SUBST(thread_LIBS)
309 AC_SUBST(network_LIBS)
311 # The following are C++ items that need to be tested for with the c++
316 # Check for "plib" without which we cannot go on
317 AC_CHECK_HEADER(plib/ul.h)
318 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
320 echo "You *must* have the plib library installed on your system to build"
321 echo "the FGFS simulator!"
323 echo "Please see README.plib for more details."
325 echo "configure aborted."
329 AC_MSG_CHECKING([for plib 1.6.0 or newer])
333 #define MIN_PLIB_VERSION 160
336 int major, minor, micro;
338 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
347 [AC_MSG_RESULT(wrong version);
348 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
352 dnl If we get here then plib is available, so force use of plib
354 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
357 dnl Checking for PSL in plib
358 dnl version of plib, so check for it.
359 AC_MSG_CHECKING([for plib PSL scripting support])
361 #include <plib/psl.h>
364 // not for running...
365 pslProgram program((pslExtension *)0);
366 program.compile("int main () {}", "");
374 AM_CONDITIONAL(HAVE_PLIB_PSL, test "x$have_plib_psl" = "xyes")
375 if test "x$have_plib_psl" = "xyes"; then
376 AC_DEFINE([HAVE_PLIB_PSL], 1,
377 [Define if plib version is new enough to provide "PSL"])
380 dnl Check for the presence of SimGear
381 AC_CHECK_HEADER(simgear/version.h)
382 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
384 echo "You *must* have the SimGear support library installed on your system"
385 echo "to build the FGFS simulator!"
387 echo "Please see README.SimGear for more details."
389 echo "configure aborted."
393 AC_MSG_CHECKING([for simgear 0.3.4 or newer])
397 #include <simgear/version.h>
399 #define STRINGIFY(X) XSTRINGIFY(X)
400 #define XSTRINGIFY(X) #X
407 int major, minor, micro;
409 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
411 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
413 if ( major < MIN_MAJOR ) {
415 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
417 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
426 [AC_MSG_RESULT(wrong version);
427 AC_MSG_ERROR([Install latest simgear first...])],
433 dnl Check if SimGear was built with Norman JPEG factory support
434 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
435 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
436 AC_CHECK_LIB(jpeg, jpeg_start_compress)
437 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
439 echo "The JPEG factory code was built and installed with SimGear."
440 echo "However it appears the libjpeg is no longer installed."
441 echo "You need to install libjpeg or remove jpgfactory support from"
444 echo "libjpeg is available at :"
445 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
448 AC_DEFINE([FG_JPEG_SERVER], 1,
449 [Define to build with jpeg screen shot server])
451 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
455 dnl Check for system installed zlib
456 AC_CHECK_HEADER(zlib.h)
457 if test "x$ac_cv_header_zlib_h" != "xyes"; then
459 echo "zlib library not found."
461 echo "If your OS does not provide an installable package for zlib"
462 echo "you will have to compile and install it first yourself. A copy"
463 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
464 echo "have to untar this source code, and follow it's included instructions"
465 echo "to compile and install on your system."
467 echo "configure aborted."
471 dnl Checks for header files.
474 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
475 sys/time.h sys/timeb.h unistd.h windows.h values.h )
477 dnl Checks for typedefs, structures, and compiler characteristics.
483 dnl Checks for library functions.
487 ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
488 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
490 AM_CONFIG_HEADER(src/Include/config.h)
502 scripts/debug/Makefile \
503 scripts/python/Makefile \
505 src/Include/Makefile \
506 src/Include/version.h \
507 src/Aircraft/Makefile \
508 src/Airports/Makefile \
510 src/Autopilot/Makefile \
511 src/Cockpit/Makefile \
512 src/Cockpit/built_in/Makefile \
513 src/Controls/Makefile \
514 src/Environment/Makefile \
515 src/FDM/Balloon/Makefile \
516 src/FDM/ExternalNet/Makefile \
517 src/FDM/ExternalPipe/Makefile \
518 src/FDM/JSBSim/Makefile \
519 src/FDM/JSBSim/filtersjb/Makefile \
520 src/FDM/LaRCsim/Makefile \
521 src/FDM/UIUCModel/Makefile \
522 src/FDM/YASim/Makefile \
526 src/Instrumentation/Makefile \
529 src/Main/runfgfs.bat \
531 src/MultiPlayer/Makefile \
532 src/Navaids/Makefile \
533 src/Network/Makefile \
534 src/Objects/Makefile \
535 src/Replay/Makefile \
536 src/Scenery/Makefile \
537 src/Scripting/Makefile \
539 src/Systems/Makefile \
541 src/WeatherCM/Makefile \
544 utils/TerraSync/Makefile \
545 utils/js_server/Makefile \
546 utils/3dconvert/Makefile \
550 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
553 echo "Configure Summary"
554 echo "================="
556 echo "Prefix: $prefix"
558 if test "x$have_plib_psl" = "xyes"; then
559 echo "Plib PSL scripting: yes"
561 echo "Plib PSL scripting: $fg_psl_string_compile"
562 echo " You will not be able to run scripts written in PSL"
563 echo " and some advanced GUI and input features may not"
564 echo " work. Download and install the latest CVS version"
565 echo " of plib if you would like to enable PSL support."
568 if test "x$with_logging" != "x"; then
569 echo "Debug messages: $with_logging"
571 echo "Debug messages: yes"
574 echo -n "Automake version: "
575 automake --version | head -1
577 if test "x$with_weathercm" != "x"; then
578 echo "WeatherCM instead of FGEnvironment: $with_weathercm"
580 echo "Using FGEnvironment"
583 if test "x$with_multiplayer" != "xno"; then
584 echo "Building with multiplayer support"
587 if test "x$with_threads" = "xyes"; then