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 Check for the presence of SimGear
358 AC_CHECK_HEADER(simgear/version.h)
359 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
361 echo "You *must* have the SimGear support library installed on your system"
362 echo "to build the FGFS simulator!"
364 echo "Please see README.SimGear for more details."
366 echo "configure aborted."
370 AC_MSG_CHECKING([for simgear 0.3.4 or newer])
374 #include <simgear/version.h>
376 #define STRINGIFY(X) XSTRINGIFY(X)
377 #define XSTRINGIFY(X) #X
384 int major, minor, micro;
386 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
388 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
390 if ( major < MIN_MAJOR ) {
392 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
394 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
403 [AC_MSG_RESULT(wrong version);
404 AC_MSG_ERROR([Install latest simgear first...])],
410 dnl Check if SimGear was built with Norman JPEG factory support
411 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
412 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
413 AC_CHECK_LIB(jpeg, jpeg_start_compress)
414 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
416 echo "The JPEG factory code was built and installed with SimGear."
417 echo "However it appears the libjpeg is no longer installed."
418 echo "You need to install libjpeg or remove jpgfactory support from"
421 echo "libjpeg is available at :"
422 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
425 AC_DEFINE([FG_JPEG_SERVER], 1,
426 [Define to build with jpeg screen shot server])
428 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
432 dnl Check for system installed zlib
433 AC_CHECK_HEADER(zlib.h)
434 if test "x$ac_cv_header_zlib_h" != "xyes"; then
436 echo "zlib library not found."
438 echo "If your OS does not provide an installable package for zlib"
439 echo "you will have to compile and install it first yourself. A copy"
440 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
441 echo "have to untar this source code, and follow it's included instructions"
442 echo "to compile and install on your system."
444 echo "configure aborted."
448 dnl Checks for header files.
451 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
452 sys/time.h sys/timeb.h unistd.h windows.h values.h )
454 dnl Checks for typedefs, structures, and compiler characteristics.
460 dnl Checks for library functions.
464 ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
465 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
467 AM_CONFIG_HEADER(src/Include/config.h)
479 scripts/debug/Makefile \
480 scripts/python/Makefile \
482 src/Include/Makefile \
483 src/Include/version.h \
484 src/Aircraft/Makefile \
485 src/Airports/Makefile \
487 src/Autopilot/Makefile \
488 src/Cockpit/Makefile \
489 src/Cockpit/built_in/Makefile \
490 src/Controls/Makefile \
491 src/Environment/Makefile \
492 src/FDM/Balloon/Makefile \
493 src/FDM/ExternalNet/Makefile \
494 src/FDM/ExternalPipe/Makefile \
495 src/FDM/JSBSim/Makefile \
496 src/FDM/JSBSim/filtersjb/Makefile \
497 src/FDM/LaRCsim/Makefile \
498 src/FDM/UIUCModel/Makefile \
499 src/FDM/YASim/Makefile \
503 src/Instrumentation/Makefile \
506 src/Main/runfgfs.bat \
508 src/AIModel/Makefile \
509 src/MultiPlayer/Makefile \
510 src/Navaids/Makefile \
511 src/Network/Makefile \
512 src/Objects/Makefile \
513 src/Replay/Makefile \
514 src/Scenery/Makefile \
515 src/Scripting/Makefile \
517 src/Systems/Makefile \
519 src/WeatherCM/Makefile \
522 utils/TerraSync/Makefile \
523 utils/js_server/Makefile \
524 utils/3dconvert/Makefile \
528 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
531 echo "Configure Summary"
532 echo "================="
534 echo "Prefix: $prefix"
536 if test "x$with_logging" != "x"; then
537 echo "Debug messages: $with_logging"
539 echo "Debug messages: yes"
542 echo -n "Automake version: "
543 automake --version | head -1
545 if test "x$with_weathercm" != "x"; then
546 echo "WeatherCM instead of FGEnvironment: $with_weathercm"
548 echo "Using FGEnvironment"
551 if test "x$with_multiplayer" != "xno"; then
552 echo "Building with multiplayer support"
555 if test "x$with_threads" = "xyes"; then