1 dnl Process this file with autoget.sh to produce a working configure
5 AC_CONFIG_SRCDIR([src/Aircraft/aircraft.cxx])
7 dnl Require at least automake 2.52
10 dnl Initialize the automake stuff
11 dnl set the $host variable based on local machine/os
13 AM_INIT_AUTOMAKE(FlightGear, 0.9.10)
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"
30 CXXFLAGS="$CXXFLAGS -I$with_simgear"
33 # specify the plib location
34 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
36 if test "x$with_plib" != "x" ; then
37 echo "plib prefix is $with_plib"
38 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
41 dnl Determine an extra directories to add to include/lib search paths
43 *-apple-darwin* | *-*-mingw32*)
44 echo no EXTRA_DIRS for $host
48 if test -d /usr/local ; then
49 EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
54 if test -d /usr/X11R6 ; then
55 EXTRA_DIR1="/usr/X11R6"
57 if test -d /opt/X11R6 ; then
58 EXTRA_DIR2="/opt/X11R6"
60 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2 /usr/local"
64 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
69 if test "$CXX" = "CC"; then
72 CXXFLAGS="$CXXFLAGS -c99 -I$with_simgear/include/simgear/compatibility"
87 dnl set logging; default value of with_logging=yes
88 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
89 if test "x$with_logging" = "xno" ; then
90 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
93 AC_ARG_ENABLE(sp_fdms, [ --enable-sp-fdms Include special purpose Flight Models], [enable_sp_fdms="$enableval"] )
94 if test "x$enable_sp_fdms" != "xno"; then
95 AC_DEFINE([ENABLE_SP_FDM], 1, [Define to include special purpose FDMs])
97 AC_DEFINE([ENABLE_SP_FDM], 0, [Define to include special purpose FDMs])
99 AM_CONDITIONAL(ENABLE_SP_FDM, test "x$enable_sp_fdms" != "xno")
102 dnl Thread related checks
104 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=yes]], [], [with_threads=yes])
105 if test "x$with_threads" = "xyes"; then
106 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
107 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
108 CFLAGS="$CFLAGS -D_REENTRANT"
110 AC_CHECK_HEADER(pthread.h)
111 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
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 # Check for MS Windows environment
117 AC_CHECK_HEADER(windows.h)
119 dnl Using AM_CONDITIONAL is a step out of the protected little
120 dnl automake fold so it is potentially dangerous. But, we are
121 dnl beginning to run into cases where the standard checks are not
122 dnl enough. AM_CONDITIONALS are then referenced to conditionally
123 dnl build a Makefile.in from a Makefile.am which lets us define custom
124 dnl includes, compile alternative source files, etc.
126 dnl Check for external variables daylight and timezone.
128 if test "$have_daylight" = yes; then
129 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
133 if test "$have_timezone" = yes; then
134 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
138 dnl add joystick support libraries
139 dnl search for FreeBSD library
140 AC_SEARCH_LIBS(hid_init, usbhid)
141 joystick_LIBS="$LIBS"
145 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
146 dnl just assuming we have audio support on all platform. We can
147 dnl depend on plib to hide the details.
148 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
150 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
151 dnl to use it if it is.
153 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
154 echo no fancy X11 check
163 dnl Checks for libraries.
165 dnl Thread related checks
166 AC_SEARCH_LIBS(pthread_cancel, [pthread c_r])
167 if test "x$ac_cv_header_pthread_h" = "xyes"; then
168 if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
169 CXXFLAGS="-pthread $CXXFLAGS"
170 CFLAGS="-pthread $CFLAGS"
177 dnl search for network related libraries
178 AC_SEARCH_LIBS(inet_addr, xnet)
179 AC_SEARCH_LIBS(socket, socket)
180 AC_SEARCH_LIBS(main, nsl)
185 dnl check for some default libraries
186 AC_SEARCH_LIBS(sqrt, [am ffm fm fastm m])
187 AC_SEARCH_LIBS(ceil, m)
188 AC_SEARCH_LIBS(dlclose, dl)
192 dnl Check for SDL if enabled.
193 AC_ARG_ENABLE(sdl, [ --enable-sdl Configure to use SDL instead of GLUT], [enable_sdl="$enableval"])
194 AM_CONDITIONAL(USE_SDL, test "x$enable_sdl" = "xyes")
195 if test "x$enable_sdl" = "xyes"; then
196 AC_DEFINE([PU_USE_SDL], 1, [Define to use SDL])
198 AC_DEFINE([PU_USE_GLUT], 1, [Define to use glut])
201 dnl check for OpenGL related libraries
203 *-*-cygwin* | *-*-mingw32*)
204 dnl CygWin under Windoze.
206 echo Win32 specific hacks...
207 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
208 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
210 if test "x$enable_sdl" = "xyes"; then
211 AC_SEARCH_LIBS(SDL_Init, SDL)
213 LIBS="$LIBS -lglut32"
216 LIBS="$LIBS -lglu32 -lopengl32 -luser32 -lgdi32"
217 joystick_LIBS="$joystick_LIBS -lwinmm"
219 dnl add -lwsock32 for mingwin
222 echo "********** BUILDING FOR MINGW32 *************"
223 network_LIBS="$network_LIBS -lws2_32"
227 echo "Will link apps with $LIBS"
234 LIBS="$LIBS -framework GLUT -framework OpenGL -framework AGL -framework Carbon -lobjc"
235 joystick_LIBS="$joystick_LIBS -framework IOKit -framework CoreFoundation"
239 dnl X-Windows based machines
241 dnl Skip X11 library tests if requested.
242 if test "x$no_x" != "xyes"; then
243 AC_SEARCH_LIBS(XCreateWindow, X11)
244 AC_SEARCH_LIBS(XShmCreateImage, Xext)
245 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
246 AC_SEARCH_LIBS(IceOpenConnection, ICE)
247 AC_SEARCH_LIBS(SmcOpenConnection, SM)
248 AC_SEARCH_LIBS(XtMalloc, Xt)
249 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
252 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
253 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
254 dnl if GLcore found, then also check for GL
255 AC_SEARCH_LIBS(glXCreateContext, GL)
258 dnl if using mesa, check for xmesa.h
259 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
260 AC_CHECK_HEADER(GL/fxmesa.h)
261 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
262 AC_DEFINE([XMESA], 1, [Define for fxmesa])
263 AC_DEFINE([FX], 1, [Define for fxmesa])
267 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
268 AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
269 if test "x$enable_sdl" = "xyes"; then
270 AC_SEARCH_LIBS(SDL_Init, SDL)
277 LIBS="$base_LIBS $joystick_LIBS"
279 dnl check for OpenAL libraries
281 *-*-cygwin* | *-*-mingw32*)
282 dnl CygWin under Windoze.
284 AC_SEARCH_LIBS(alGenBuffers, openal32)
285 AC_SEARCH_LIBS(alutInit, [ openal32 ALut ] )
286 LIBS="$LIBS -ldsound -ldxguid -lole32"
293 LIBS="$LIBS -framework IOKit -framework OpenAL"
298 dnl default unix style machines
301 LIBS="$LIBS $thread_LIBS"
302 AC_SEARCH_LIBS(alGenBuffers, openal)
303 AC_SEARCH_LIBS(alutInit, [ alut openal ] )
304 OPENAL_OK="$ac_cv_search_alGenBuffers"
314 AC_SUBST(openal_LIBS)
315 AC_SUBST(opengl_LIBS)
316 AC_SUBST(thread_LIBS)
317 AC_SUBST(network_LIBS)
318 AC_SUBST(joystick_LIBS)
320 # The following are C++ items that need to be tested for with the c++
325 # Check for "plib" without which we cannot go on
326 AC_CHECK_HEADER(plib/ul.h)
327 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
329 echo "You *must* have the plib library installed on your system to build"
330 echo "the FGFS simulator!"
332 echo "Please see README.plib for more details."
334 echo "configure aborted."
338 AC_MSG_CHECKING([for plib 1.8.4 or newer])
342 #define MIN_PLIB_VERSION 184
345 int major, minor, micro;
347 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
356 [AC_MSG_RESULT(wrong version);
357 AC_MSG_ERROR([Install plib 1.8.4 or later first...])],
361 dnl If we get here then plib is available, so force use of plib
363 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
366 dnl Check for the presence of SimGear
367 if test "x$with_simgear" != "x"; then
368 AC_CHECK_HEADER($with_simgear/include/simgear/version.h, [ac_cv_header_simgear_version_h=yes], [ac_cv_header_simgear_version_h=no])
370 AC_CHECK_HEADER(simgear/version.h)
372 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
374 echo "You *must* have the SimGear support library installed on your system"
375 echo "to build the FGFS simulator!"
377 echo "Please see README.SimGear for more details."
379 echo "configure aborted."
383 AC_MSG_CHECKING([for simgear 0.3.10 or newer])
387 #include <simgear/version.h>
389 #define STRINGIFY(X) XSTRINGIFY(X)
390 #define XSTRINGIFY(X) #X
397 int major, minor, micro;
399 /* printf("%d.%d.%d or greater, ", MIN_MAJOR, MIN_MINOR, MIN_MICRO); */
400 printf("[found %s] ... ", STRINGIFY(SIMGEAR_VERSION));
402 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
404 if ( (major < MIN_MAJOR) ||
405 (major == MIN_MAJOR && minor < MIN_MINOR) ||
406 (major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO) ) {
415 [AC_MSG_RESULT(wrong version);
416 AC_MSG_ERROR([Install latest simgear first...])],
422 dnl Check if SimGear was built with Norman's JPEG factory support
423 if test "x$with_simgear" != "x"; then
424 AC_CHECK_HEADER($with_simgear/include/simgear/screen/jpgfactory.hxx,[ac_cv_header_simgear_screen_jpgfactory_hxx=yes],[ac_cv_header_simgear_screen_jpgfactory_hxx=no])
426 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
428 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
429 AC_CHECK_LIB(jpeg, jpeg_start_compress)
430 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
432 echo "The JPEG factory code was built and installed with SimGear."
433 echo "However it appears the libjpeg is no longer installed."
434 echo "You need to install libjpeg or remove jpgfactory support from"
437 echo "libjpeg is available at :"
438 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
441 AC_DEFINE([FG_JPEG_SERVER], 1,
442 [Define to build with jpeg screen shot server])
444 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
448 dnl Check for system installed zlib
449 AC_CHECK_HEADER(zlib.h)
450 if test "x$ac_cv_header_zlib_h" != "xyes"; then
452 echo "zlib library not found."
454 echo "If your OS does not provide an installable package for zlib"
455 echo "you will have to compile and install it first yourself. A copy"
456 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
457 echo "have to untar this source code, and follow it's included instructions"
458 echo "to compile and install on your system."
460 echo "configure aborted."
464 dnl Checks for header files.
467 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
468 sys/time.h sys/timeb.h unistd.h windows.h values.h )
470 dnl Checks for typedefs, structures, and compiler characteristics.
476 dnl Checks for library functions.
478 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
482 ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
483 random drand48 setitimer getitimer signal GetLocalTime rint getrusage \
487 AM_CONFIG_HEADER(src/Include/config.h)
499 scripts/debug/Makefile \
500 scripts/perl/Makefile \
501 scripts/perl/examples/Makefile \
502 scripts/python/Makefile \
504 src/Include/Makefile \
505 src/Include/version.h \
506 src/Include/config.h-msvc6 \
507 src/Aircraft/Makefile \
508 src/Airports/Makefile \
510 src/Autopilot/Makefile \
511 src/Cockpit/Makefile \
512 src/Cockpit/built_in/Makefile \
513 src/Environment/Makefile \
514 src/FDM/Balloon/Makefile \
515 src/FDM/ExternalNet/Makefile \
516 src/FDM/ExternalPipe/Makefile \
517 src/FDM/JSBSim/Makefile \
518 src/FDM/JSBSim/initialization/Makefile \
519 src/FDM/JSBSim/input_output/Makefile \
520 src/FDM/JSBSim/math/Makefile \
521 src/FDM/JSBSim/models/Makefile \
522 src/FDM/JSBSim/models/flight_control/Makefile \
523 src/FDM/JSBSim/models/atmosphere/Makefile \
524 src/FDM/JSBSim/models/propulsion/Makefile \
525 src/FDM/LaRCsim/Makefile \
526 src/FDM/SP/Makefile \
527 src/FDM/UIUCModel/Makefile \
528 src/FDM/YASim/Makefile \
532 src/Instrumentation/Makefile \
533 src/Instrumentation/KLN89/Makefile \
534 src/Instrumentation/HUD/Makefile \
537 src/Main/runfgfs.bat \
539 src/AIModel/Makefile \
540 src/MultiPlayer/Makefile \
541 src/Navaids/Makefile \
542 src/Network/Makefile \
543 src/Scenery/Makefile \
544 src/Scripting/Makefile \
546 src/Systems/Makefile \
548 src/Traffic/Makefile \
551 utils/GPSsmooth/Makefile \
552 utils/js_server/Makefile \
553 utils/Modeller/Makefile \
554 utils/TerraSync/Makefile \
555 utils/xmlgrep/Makefile \
559 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
562 echo "Configure Summary"
563 echo "================="
565 echo "Prefix: $prefix"
567 if test "x$with_logging" != "x"; then
568 echo "Debug messages: $with_logging"
570 echo "Debug messages: yes"
573 echo -n "Automake version: "
574 automake --version | head -n 1
576 if test "x$with_multiplayer" != "xno"; then
577 echo "Building with multiplayer support"
580 if test "x$with_threads" = "xyes"; then
586 if test "x$enable_sp_fdms" != "xno"; then
587 echo "Include special purpose flight models: yes"
589 echo "Include special purpose flight models: no"