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.8)
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"
34 if test "$CXX" = "CC"; then
37 CXXFLAGS="$CXXFLAGS -c99 -I$with_simgear/include/simgear/compatibility"
52 dnl set logging; default value of with_logging=yes
53 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
54 if test "x$with_logging" = "xno" ; then
55 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
58 # Specify if we want to build with Multiplayer support
59 # default to with_network=yes
60 AC_ARG_WITH(multiplayer, [ --with-multiplayer Include multiplayer support [default=yes]])
62 if test "x$with_multiplayer" = "xno"; then
63 echo "Building without any kind of multiplayer support"
65 echo "Building with multiplayer support"
66 AC_DEFINE([FG_MPLAYER_AS], 1, [Define to build with multiplayer support])
68 AM_CONDITIONAL(ENABLE_MPLAYER_AS, test "x$with_multiplayer" != "xno")
70 AC_ARG_ENABLE(sp_fdms, [ --enable-sp-fdms Include special purpose Flight Models], [enable_sp_fdms="$enableval"] )
71 AC_DEFINE([ENABLE_SP_FMDS], test "x$enable_sp_fdms" = "xyes", [Define to include special purpose FDMs])
72 AM_CONDITIONAL(ENABLE_SP_FDM, test "x$enable_sp_fdms" != "xno")
75 dnl Thread related checks
78 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=yes]])
79 if test "x$with_threads" != "xyes"; then
80 AC_DEFINE([ENABLE_THREADS], 0, [Define to enable threaded tile paging])
82 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
83 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
84 CFLAGS="$CFLAGS -D_REENTRANT"
86 AC_CHECK_HEADER(pthread.h)
87 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
89 # specify the plib location
90 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
92 if test "x$with_plib" != "x" ; then
93 echo "plib prefix is $with_plib"
94 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
97 dnl Used by JSBSim to conditionally compile in fgfs interface code
98 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
100 dnl Used to control whether clouds3d should be compiled in or not
101 AC_DEFINE([FG_USE_CLOUDS_3D], 1, [Define to use 3D cloud support])
102 AM_CONDITIONAL(FG_USE_CLOUDS_3D, test "x" = "x")
104 # Check for MS Windows environment
105 AC_CHECK_HEADER(windows.h)
107 dnl Determine an extra directories to add to include/lib search paths
109 *-apple-darwin* | *-*-mingw32*)
110 echo no EXTRA_DIRS for $host
114 if test -d /usr/local ; then
115 EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
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 /usr/local/"
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])
152 dnl add joystick support libraries
153 dnl search for FreeBSD library
154 AC_SEARCH_LIBS(hid_init, usbhid)
155 joystick_LIBS="$LIBS"
159 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
160 dnl just assuming we have audio support on all platform. We can
161 dnl depend on plib to hide the details.
162 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
164 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
165 dnl to use it if it is.
167 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
168 echo no fancy X11 check
177 dnl Checks for libraries.
179 dnl Thread related checks
180 AC_SEARCH_LIBS(pthread_cancel, [pthread c_r])
181 if test "x$ac_cv_header_pthread_h" = "xyes"; then
182 if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
183 CXXFLAGS="-pthread $CXXFLAGS"
184 CFLAGS="-pthread $FLAGS"
191 dnl search for network related libraries
192 AC_SEARCH_LIBS(inet_addr, xnet)
193 AC_SEARCH_LIBS(socket, socket)
194 AC_SEARCH_LIBS(main, nsl)
199 dnl check for some default libraries
200 AC_SEARCH_LIBS(cos, m)
201 AC_SEARCH_LIBS(dlclose, dl)
205 dnl Check for SDL if enabled.
206 AC_ARG_ENABLE(sdl, [ --enable-sdl Configure to use SDL instead of GLUT], [enable_sdl="$enableval"])
207 AM_CONDITIONAL(USE_SDL, test "x$enable_sdl" = "xyes")
208 if test "x$enable_sdl" = "xyes"; then
209 AC_DEFINE([PU_USE_SDL], 1, [Define to use SDL])
211 AC_DEFINE([PU_USE_GLUT], 1, [Define to use glut])
214 dnl check for OpenGL related libraries
216 *-*-cygwin* | *-*-mingw32*)
217 dnl CygWin under Windoze.
219 echo Win32 specific hacks...
220 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
221 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
223 if test "x$enable_sdl" = "xyes"; then
224 AC_SEARCH_LIBS(SDL_Init, SDL)
226 LIBS="$LIBS -lglut32"
229 LIBS="$LIBS -lglu32 -lopengl32 -luser32 -lgdi32"
230 joystick_LIBS="$joystick_LIBS -lwinmm"
232 dnl add -lwsock32 for mingwin
235 echo "********** BUILDING FOR MINGW32 *************"
236 base_LIBS="$base_LIBS -lws2_32"
240 echo "Will link apps with $LIBS"
247 LIBS="$LIBS -framework GLUT -framework OpenGL -framework AGL -framework Carbon -lobjc"
248 joystick_LIBS="$joystick_LIBS -framework IOKit -framework CoreFoundation"
252 dnl X-Windows based machines
254 dnl Skip X11 library tests if requested.
255 if test "x$no_x" != "xyes"; then
256 AC_SEARCH_LIBS(XCreateWindow, X11)
257 AC_SEARCH_LIBS(XShmCreateImage, Xext)
258 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
259 AC_SEARCH_LIBS(IceOpenConnection, ICE)
260 AC_SEARCH_LIBS(SmcOpenConnection, SM)
261 AC_SEARCH_LIBS(XtMalloc, Xt)
262 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
265 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
266 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
267 dnl if GLcore found, then also check for GL
268 AC_SEARCH_LIBS(glXCreateContext, GL)
271 dnl if using mesa, check for xmesa.h
272 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
273 AC_CHECK_HEADER(GL/fxmesa.h)
274 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
275 AC_DEFINE([XMESA], 1, [Define for fxmesa])
276 AC_DEFINE([FX], 1, [Define for fxmesa])
280 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
281 AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
282 if test "x$enable_sdl" = "xyes"; then
283 AC_SEARCH_LIBS(SDL_Init, SDL)
290 LIBS="$base_LIBS $joystick_LIBS"
292 dnl check for OpenAL libraries
294 *-*-cygwin* | *-*-mingw32*)
295 dnl CygWin under Windoze.
297 AC_SEARCH_LIBS(alGenBuffers, openal32)
298 AC_SEARCH_LIBS(alutInit, [ openal32 ALut ] )
299 LIBS="$LIBS -ldsound -ldxguid -lole32"
306 LIBS="$LIBS -framework IOKit -framework OpenAL"
311 dnl default unix style machines
314 LIBS="$LIBS $thread_LIBS"
315 AC_SEARCH_LIBS(alGenBuffers, openal)
316 OPENAL_OK="$ac_cv_search_alGenBuffers"
326 AC_SUBST(openal_LIBS)
327 AC_SUBST(opengl_LIBS)
328 AC_SUBST(thread_LIBS)
329 AC_SUBST(network_LIBS)
330 AC_SUBST(joystick_LIBS)
332 # The following are C++ items that need to be tested for with the c++
337 # Check for "plib" without which we cannot go on
338 AC_CHECK_HEADER(plib/ul.h)
339 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
341 echo "You *must* have the plib library installed on your system to build"
342 echo "the FGFS simulator!"
344 echo "Please see README.plib for more details."
346 echo "configure aborted."
350 AC_MSG_CHECKING([for plib 1.8.4 or newer])
354 #define MIN_PLIB_VERSION 184
357 int major, minor, micro;
359 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
368 [AC_MSG_RESULT(wrong version);
369 AC_MSG_ERROR([Install plib 1.8.0 or later first...])],
373 dnl If we get here then plib is available, so force use of plib
375 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
378 dnl Check for the presence of SimGear
379 AC_CHECK_HEADER(simgear/version.h)
380 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
382 echo "You *must* have the SimGear support library installed on your system"
383 echo "to build the FGFS simulator!"
385 echo "Please see README.SimGear for more details."
387 echo "configure aborted."
391 AC_MSG_CHECKING([for simgear 0.3.8 or newer])
395 #include <simgear/version.h>
397 #define STRINGIFY(X) XSTRINGIFY(X)
398 #define XSTRINGIFY(X) #X
405 int major, minor, micro;
407 /* printf("%d.%d.%d or greater, ", MIN_MAJOR, MIN_MINOR, MIN_MICRO); */
408 printf("[found %s] ... ", STRINGIFY(SIMGEAR_VERSION));
410 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
412 if ( (major < MIN_MAJOR) ||
413 (major == MIN_MAJOR && minor < MIN_MINOR) ||
414 (major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO) ) {
423 [AC_MSG_RESULT(wrong version);
424 AC_MSG_ERROR([Install latest simgear first...])],
430 dnl Check if SimGear was built with Norman's JPEG factory support
431 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
432 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
433 AC_CHECK_LIB(jpeg, jpeg_start_compress)
434 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
436 echo "The JPEG factory code was built and installed with SimGear."
437 echo "However it appears the libjpeg is no longer installed."
438 echo "You need to install libjpeg or remove jpgfactory support from"
441 echo "libjpeg is available at :"
442 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
445 AC_DEFINE([FG_JPEG_SERVER], 1,
446 [Define to build with jpeg screen shot server])
448 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
452 dnl Check for system installed zlib
453 AC_CHECK_HEADER(zlib.h)
454 if test "x$ac_cv_header_zlib_h" != "xyes"; then
456 echo "zlib library not found."
458 echo "If your OS does not provide an installable package for zlib"
459 echo "you will have to compile and install it first yourself. A copy"
460 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
461 echo "have to untar this source code, and follow it's included instructions"
462 echo "to compile and install on your system."
464 echo "configure aborted."
468 dnl Checks for header files.
471 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
472 sys/time.h sys/timeb.h unistd.h windows.h values.h )
474 dnl Checks for typedefs, structures, and compiler characteristics.
480 dnl Checks for library functions.
482 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
486 ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
487 random drand48 setitimer getitimer signal GetLocalTime rint getrusage \
491 AM_CONFIG_HEADER(src/Include/config.h)
503 scripts/debug/Makefile \
504 scripts/perl/Makefile \
505 scripts/perl/examples/Makefile \
506 scripts/python/Makefile \
508 src/Include/Makefile \
509 src/Include/version.h \
510 src/Include/config.h-msvc6 \
511 src/Aircraft/Makefile \
512 src/Airports/Makefile \
514 src/Autopilot/Makefile \
515 src/Cockpit/Makefile \
516 src/Cockpit/built_in/Makefile \
517 src/Controls/Makefile \
518 src/Environment/Makefile \
519 src/FDM/Balloon/Makefile \
520 src/FDM/ExternalNet/Makefile \
521 src/FDM/ExternalPipe/Makefile \
522 src/FDM/JSBSim/Makefile \
523 src/FDM/JSBSim/filtersjb/Makefile \
524 src/FDM/LaRCsim/Makefile \
525 src/FDM/SP/Makefile \
526 src/FDM/UIUCModel/Makefile \
527 src/FDM/YASim/Makefile \
531 src/Instrumentation/Makefile \
534 src/Main/runfgfs.bat \
536 src/AIModel/Makefile \
537 src/MultiPlayer/Makefile \
538 src/Navaids/Makefile \
539 src/Network/Makefile \
540 src/Objects/Makefile \
541 src/Replay/Makefile \
542 src/Scenery/Makefile \
543 src/Scripting/Makefile \
545 src/Systems/Makefile \
547 src/Traffic/Makefile \
550 utils/TerraSync/Makefile \
551 utils/Modeller/Makefile \
552 utils/js_server/Makefile \
556 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
559 echo "Configure Summary"
560 echo "================="
562 echo "Prefix: $prefix"
564 if test "x$with_logging" != "x"; then
565 echo "Debug messages: $with_logging"
567 echo "Debug messages: yes"
570 echo -n "Automake version: "
571 automake --version | head -1
573 if test "x$with_multiplayer" != "xno"; then
574 echo "Building with multiplayer support"
577 if test "x$with_threads" = "xyes"; then
583 if test "x$enable_sp_fdms" != "xno"; then
584 echo "Include special purpose flight models: yes"
586 echo "Include special purpose flight models: no"