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 # specify the osg location
42 AC_ARG_WITH(osg, [ --with-osg=PREFIX Specify the prefix path to osg])
44 if test "x$with_osg" != "x" ; then
45 echo "osg prefix is $with_osg"
46 EXTRA_DIRS="${EXTRA_DIRS} $with_osg"
49 dnl Determine an extra directories to add to include/lib search paths
51 *-apple-darwin* | *-*-mingw32*)
52 echo no EXTRA_DIRS for $host
56 if test -d /usr/local ; then
57 EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
62 if test -d /usr/X11R6 ; then
63 EXTRA_DIR1="/usr/X11R6"
65 if test -d /opt/X11R6 ; then
66 EXTRA_DIR2="/opt/X11R6"
68 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2 /usr/local"
72 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
77 if test "$CXX" = "CC"; then
80 CXXFLAGS="$CXXFLAGS -c99 -I$with_simgear/include/simgear/compatibility"
95 dnl set logging; default value of with_logging=yes
96 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
97 if test "x$with_logging" = "xno" ; then
98 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
101 AC_ARG_ENABLE(sp_fdms, [ --enable-sp-fdms Include special purpose Flight Models], [enable_sp_fdms="$enableval"] )
102 if test "x$enable_sp_fdms" != "xno"; then
103 AC_DEFINE([ENABLE_SP_FDM], 1, [Define to include special purpose FDMs])
105 AC_DEFINE([ENABLE_SP_FDM], 0, [Define to include special purpose FDMs])
107 AM_CONDITIONAL(ENABLE_SP_FDM, test "x$enable_sp_fdms" != "xno")
110 dnl Thread related checks
112 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=yes]], [], [with_threads=yes])
113 if test "x$with_threads" = "xyes"; then
114 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
115 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
116 CFLAGS="$CFLAGS -D_REENTRANT"
118 AC_CHECK_HEADER(pthread.h)
119 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
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 Using AM_CONDITIONAL is a step out of the protected little
128 dnl automake fold so it is potentially dangerous. But, we are
129 dnl beginning to run into cases where the standard checks are not
130 dnl enough. AM_CONDITIONALS are then referenced to conditionally
131 dnl build a Makefile.in from a Makefile.am which lets us define custom
132 dnl includes, compile alternative source files, etc.
134 dnl Check for external variables daylight and timezone.
136 if test "$have_daylight" = yes; then
137 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
141 if test "$have_timezone" = yes; then
142 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
146 dnl add joystick support libraries
147 dnl search for FreeBSD library
148 AC_SEARCH_LIBS(hid_init, usbhid)
149 joystick_LIBS="$LIBS"
153 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
154 dnl just assuming we have audio support on all platform. We can
155 dnl depend on plib to hide the details.
156 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
158 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
159 dnl to use it if it is.
161 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
162 echo no fancy X11 check
171 dnl Checks for libraries.
173 dnl Thread related checks
174 AC_SEARCH_LIBS(pthread_cancel, [pthread c_r])
175 if test "x$ac_cv_header_pthread_h" = "xyes"; then
176 if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
177 CXXFLAGS="-pthread $CXXFLAGS"
178 CFLAGS="-pthread $CFLAGS"
185 dnl search for network related libraries
186 AC_SEARCH_LIBS(inet_addr, xnet)
187 AC_SEARCH_LIBS(socket, socket)
188 AC_SEARCH_LIBS(main, nsl)
193 dnl check for some default libraries
194 AC_SEARCH_LIBS(sqrt, [am ffm fm fastm m])
195 AC_SEARCH_LIBS(ceil, m)
196 AC_SEARCH_LIBS(dlclose, dl)
200 dnl Check for SDL if enabled.
201 AC_ARG_ENABLE(sdl, [ --enable-sdl Configure to use SDL instead of GLUT], [enable_sdl="$enableval"])
202 AC_ARG_ENABLE(osgviewer, [ --enable-osgviewer Configure to use osgViewer], [enable_osgviewer="$enableval"])
203 AM_CONDITIONAL(USE_SDL, test "x$enable_sdl" = "xyes")
204 AM_CONDITIONAL(USE_OSGVIEWER, test "x$enable_osgviewer" = "xyes")
205 if test "x$enable_sdl" = "xyes"; then
206 AC_DEFINE([PU_USE_SDL], 1, [Define to use SDL])
208 if test "x$enable_osgviewer" = "xyes"; then
209 AC_DEFINE([ENABLE_OSGVIEWER], 1, [Define to use osgViewer in renderer])
210 AC_DEFINE([PU_USE_NATIVE], 1, [Define to use native system])
212 AC_DEFINE([PU_USE_GLUT], 1, [Define to use glut])
216 AC_ARG_ENABLE(osgdebug, [ --enable-osgdebug Use OSG debug libraries], [enable_osgdebug="$enableval"])
217 AM_CONDITIONAL(USE_OSGDEBUG, test "x$enable_osgdebug" = "xyes")
219 dnl check for OpenGL related libraries
221 *-*-cygwin* | *-*-mingw32*)
222 dnl CygWin under Windoze.
224 echo Win32 specific hacks...
225 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
226 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
228 if test "x$enable_sdl" = "xyes"; then
229 AC_SEARCH_LIBS(SDL_Init, SDL)
231 LIBS="$LIBS -lglut32"
234 LIBS="$LIBS -lglu32 -lopengl32 -luser32 -lgdi32"
235 joystick_LIBS="$joystick_LIBS -lwinmm"
237 dnl add -lwsock32 for mingwin
240 echo "********** BUILDING FOR MINGW32 *************"
241 network_LIBS="$network_LIBS -lws2_32"
245 echo "Will link apps with $LIBS"
252 LIBS="$LIBS -framework GLUT -framework OpenGL -framework AGL -framework Carbon -lobjc"
253 joystick_LIBS="$joystick_LIBS -framework IOKit -framework CoreFoundation"
257 dnl X-Windows based machines
259 dnl Skip X11 library tests if requested.
260 if test "x$no_x" != "xyes"; then
261 AC_SEARCH_LIBS(XCreateWindow, X11)
262 AC_SEARCH_LIBS(XShmCreateImage, Xext)
263 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
264 AC_SEARCH_LIBS(IceOpenConnection, ICE)
265 AC_SEARCH_LIBS(SmcOpenConnection, SM)
266 AC_SEARCH_LIBS(XtMalloc, Xt)
267 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
270 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
271 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
272 dnl if GLcore found, then also check for GL
273 AC_SEARCH_LIBS(glXCreateContext, GL)
276 dnl if using mesa, check for xmesa.h
277 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
278 AC_CHECK_HEADER(GL/fxmesa.h)
279 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
280 AC_DEFINE([XMESA], 1, [Define for fxmesa])
281 AC_DEFINE([FX], 1, [Define for fxmesa])
285 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
286 AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
287 if test "x$enable_sdl" = "xyes"; then
288 AC_SEARCH_LIBS(SDL_Init, SDL)
295 LIBS="$base_LIBS $joystick_LIBS"
297 dnl check for OpenAL libraries
299 *-*-cygwin* | *-*-mingw32*)
300 dnl CygWin under Windoze.
302 AC_SEARCH_LIBS(alGenBuffers, openal32)
303 AC_SEARCH_LIBS(alutInit, [ openal32 ALut ] )
304 LIBS="$LIBS -ldsound -ldxguid -lole32"
311 LIBS="$LIBS -framework IOKit -framework OpenAL"
316 dnl default unix style machines
319 LIBS="$LIBS $thread_LIBS"
320 AC_SEARCH_LIBS(alGenBuffers, openal)
321 AC_SEARCH_LIBS(alutInit, [ alut openal ] )
322 OPENAL_OK="$ac_cv_search_alGenBuffers"
332 AC_SUBST(openal_LIBS)
333 AC_SUBST(opengl_LIBS)
334 AC_SUBST(thread_LIBS)
335 AC_SUBST(network_LIBS)
336 AC_SUBST(joystick_LIBS)
338 # The following are C++ items that need to be tested for with the c++
343 # Check for "plib" without which we cannot go on
344 AC_CHECK_HEADER(plib/ul.h)
345 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
347 echo "You *must* have the plib library installed on your system to build"
348 echo "the FGFS simulator!"
350 echo "Please see README.plib for more details."
352 echo "configure aborted."
356 AC_MSG_CHECKING([for plib 1.8.4 or newer])
360 #define MIN_PLIB_VERSION 184
363 int major, minor, micro;
365 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
374 [AC_MSG_RESULT(wrong version);
375 AC_MSG_ERROR([Install plib 1.8.4 or later first...])],
379 dnl If we get here then plib is available, so force use of plib
381 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
384 dnl Check for the presence of SimGear
385 if test "x$with_simgear" != "x"; then
386 AC_CHECK_HEADER($with_simgear/include/simgear/version.h, [ac_cv_header_simgear_version_h=yes], [ac_cv_header_simgear_version_h=no])
388 AC_CHECK_HEADER(simgear/version.h)
390 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
392 echo "You *must* have the SimGear support library installed on your system"
393 echo "to build the FGFS simulator!"
395 echo "Please see README.SimGear for more details."
397 echo "configure aborted."
401 AC_MSG_CHECKING([for simgear 0.3.10 or newer])
405 #include <simgear/version.h>
407 #define STRINGIFY(X) XSTRINGIFY(X)
408 #define XSTRINGIFY(X) #X
415 int major, minor, micro;
417 /* printf("%d.%d.%d or greater, ", MIN_MAJOR, MIN_MINOR, MIN_MICRO); */
418 printf("[found %s] ... ", STRINGIFY(SIMGEAR_VERSION));
420 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
422 if ( (major < MIN_MAJOR) ||
423 (major == MIN_MAJOR && minor < MIN_MINOR) ||
424 (major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO) ) {
433 [AC_MSG_RESULT(wrong version);
434 AC_MSG_ERROR([Install latest simgear first...])],
440 dnl Check if SimGear was built with Norman's JPEG factory support
441 if test "x$with_simgear" != "x"; then
442 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])
444 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
446 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
447 AC_CHECK_LIB(jpeg, jpeg_start_compress)
448 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
450 echo "The JPEG factory code was built and installed with SimGear."
451 echo "However it appears the libjpeg is no longer installed."
452 echo "You need to install libjpeg or remove jpgfactory support from"
455 echo "libjpeg is available at :"
456 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
459 AC_DEFINE([FG_JPEG_SERVER], 1,
460 [Define to build with jpeg screen shot server])
462 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
466 dnl Check for system installed zlib
467 AC_CHECK_HEADER(zlib.h)
468 if test "x$ac_cv_header_zlib_h" != "xyes"; then
470 echo "zlib library not found."
472 echo "If your OS does not provide an installable package for zlib"
473 echo "you will have to compile and install it first yourself. A copy"
474 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
475 echo "have to untar this source code, and follow it's included instructions"
476 echo "to compile and install on your system."
478 echo "configure aborted."
482 dnl Checks for header files.
485 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
486 sys/time.h sys/timeb.h unistd.h windows.h values.h )
488 dnl Checks for typedefs, structures, and compiler characteristics.
494 dnl Checks for library functions.
496 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
500 ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
501 random drand48 setitimer getitimer signal GetLocalTime rint getrusage \
505 AM_CONFIG_HEADER(src/Include/config.h)
517 scripts/debug/Makefile \
518 scripts/perl/Makefile \
519 scripts/perl/examples/Makefile \
520 scripts/python/Makefile \
522 src/Include/Makefile \
523 src/Include/version.h \
524 src/Include/config.h-msvc6 \
525 src/Include/config.h-msvc71 \
526 src/Include/config.h-msvc8 \
527 src/Aircraft/Makefile \
528 src/Airports/Makefile \
530 src/Autopilot/Makefile \
531 src/Cockpit/Makefile \
532 src/Cockpit/built_in/Makefile \
533 src/Environment/Makefile \
534 src/FDM/Balloon/Makefile \
535 src/FDM/ExternalNet/Makefile \
536 src/FDM/ExternalPipe/Makefile \
537 src/FDM/JSBSim/Makefile \
538 src/FDM/JSBSim/initialization/Makefile \
539 src/FDM/JSBSim/input_output/Makefile \
540 src/FDM/JSBSim/math/Makefile \
541 src/FDM/JSBSim/models/Makefile \
542 src/FDM/JSBSim/models/flight_control/Makefile \
543 src/FDM/JSBSim/models/atmosphere/Makefile \
544 src/FDM/JSBSim/models/propulsion/Makefile \
545 src/FDM/LaRCsim/Makefile \
546 src/FDM/SP/Makefile \
547 src/FDM/UIUCModel/Makefile \
548 src/FDM/YASim/Makefile \
552 src/Instrumentation/Makefile \
553 src/Instrumentation/KLN89/Makefile \
554 src/Instrumentation/HUD/Makefile \
557 src/Main/runfgfs.bat \
559 src/AIModel/Makefile \
560 src/MultiPlayer/Makefile \
561 src/Navaids/Makefile \
562 src/Network/Makefile \
563 src/Scenery/Makefile \
564 src/Scripting/Makefile \
566 src/Systems/Makefile \
568 src/Traffic/Makefile \
571 utils/GPSsmooth/Makefile \
572 utils/js_server/Makefile \
573 utils/Modeller/Makefile \
574 utils/TerraSync/Makefile \
575 utils/xmlgrep/Makefile \
579 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
582 echo "Configure Summary"
583 echo "================="
585 echo "Prefix: $prefix"
587 if test "x$with_logging" != "x"; then
588 echo "Debug messages: $with_logging"
590 echo "Debug messages: yes"
593 echo -n "Automake version: "
594 automake --version | head -n 1
596 if test "x$with_multiplayer" != "xno"; then
597 echo "Building with multiplayer support"
600 if test "x$with_threads" = "xyes"; then
606 if test "x$enable_sp_fdms" != "xno"; then
607 echo "Include special purpose flight models: yes"
609 echo "Include special purpose flight models: no"