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 -I$with_simgear/include/simgear/compatibility"
51 dnl set logging; default value of with_logging=yes
52 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
53 if test "x$with_logging" = "xno" ; then
54 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
57 # Specify if we want to build with Multiplayer support
58 # default to with_network=yes
59 AC_ARG_WITH(multiplayer, [ --with-multiplayer Include multiplayer support [default=yes]])
61 if test "x$with_multiplayer" = "xno"; then
62 echo "Building without any kind of multiplayer support"
64 echo "Building with multiplayer support"
65 AC_DEFINE([FG_MPLAYER_AS], 1, [Define to build with multiplayer support])
67 AM_CONDITIONAL(ENABLE_MPLAYER_AS, test "x$with_multiplayer" != "xno")
69 AC_ARG_ENABLE(sp_fdms, [ --enable-sp-fdms Include special purpose Flight Models], [enable_sp_fdms="$enableval"] )
70 AC_DEFINE([ENABLE_SP_FMDS], test "x$enable_sp_fdms" = "xyes", [Define to include special purpose FDMs])
71 AM_CONDITIONAL(ENABLE_SP_FDM, test "x$enable_sp_fdms" != "xno")
74 dnl Thread related checks
77 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=yes]])
78 if test "x$with_threads" != "xyes"; then
79 AC_DEFINE([ENABLE_THREADS], 0, [Define to enable threaded tile paging])
81 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
82 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
83 CFLAGS="$CFLAGS -D_REENTRANT"
85 AC_CHECK_HEADER(pthread.h)
86 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
88 # specify the plib location
89 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
91 if test "x$with_plib" != "x" ; then
92 echo "plib prefix is $with_plib"
93 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
96 dnl Used by JSBSim to conditionally compile in fgfs interface code
97 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
99 dnl Used to control whether clouds3d should be compiled in or not
100 AC_DEFINE([FG_USE_CLOUDS_3D], 1, [Define to use 3D cloud support])
101 AM_CONDITIONAL(FG_USE_CLOUDS_3D, test "x" = "x")
103 # Check for MS Windows environment
104 AC_CHECK_HEADER(windows.h)
106 dnl Determine an extra directories to add to include/lib search paths
108 *-apple-darwin* | *-*-mingw32*)
109 echo no EXTRA_DIRS for $host
113 if test -d /usr/local ; then
114 EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
119 if test -d /usr/X11R6 ; then
120 EXTRA_DIR1="/usr/X11R6"
122 if test -d /opt/X11R6 ; then
123 EXTRA_DIR2="/opt/X11R6"
125 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2 /usr/local/"
129 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
132 dnl Using AM_CONDITIONAL is a step out of the protected little
133 dnl automake fold so it is potentially dangerous. But, we are
134 dnl beginning to run into cases where the standard checks are not
135 dnl enough. AM_CONDITIONALS are then referenced to conditionally
136 dnl build a Makefile.in from a Makefile.am which lets us define custom
137 dnl includes, compile alternative source files, etc.
139 dnl Check for external variables daylight and timezone.
141 if test "$have_daylight" = yes; then
142 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
146 if test "$have_timezone" = yes; then
147 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
151 dnl add joystick support libraries
152 dnl search for FreeBSD library
153 AC_SEARCH_LIBS(hid_init, usbhid)
154 joystick_LIBS="$LIBS"
158 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
159 dnl just assuming we have audio support on all platform. We can
160 dnl depend on plib to hide the details.
161 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
163 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
164 dnl to use it if it is.
166 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
167 echo no fancy X11 check
176 dnl Checks for libraries.
178 dnl Thread related checks
179 AC_SEARCH_LIBS(pthread_cancel, [pthread c_r])
180 if test "x$ac_cv_header_pthread_h" = "xyes"; then
181 if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
182 CXXFLAGS="-pthread $CXXFLAGS"
183 CFLAGS="-pthread $FLAGS"
190 dnl search for network related libraries
191 AC_SEARCH_LIBS(inet_addr, xnet)
192 AC_SEARCH_LIBS(socket, socket)
193 AC_SEARCH_LIBS(main, nsl)
198 dnl check for some default libraries
199 AC_SEARCH_LIBS(cos, m)
200 AC_SEARCH_LIBS(dlclose, dl)
204 dnl Check for SDL if enabled.
205 AC_ARG_ENABLE(sdl, [ --enable-sdl Configure to use SDL instead of GLUT], [enable_sdl="$enableval"])
206 AM_CONDITIONAL(USE_SDL, test "x$enable_sdl" = "xyes")
207 if test "x$enable_sdl" = "xyes"; then
208 AC_DEFINE([PU_USE_SDL], 1, [Define to use SDL])
210 AC_DEFINE([PU_USE_GLUT], 1, [Define to use glut])
213 dnl check for OpenGL related libraries
215 *-*-cygwin* | *-*-mingw32*)
216 dnl CygWin under Windoze.
218 echo Win32 specific hacks...
219 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
220 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
222 if test "x$enable_sdl" = "xyes"; then
223 AC_SEARCH_LIBS(SDL_Init, SDL)
225 LIBS="$LIBS -lglut32"
228 LIBS="$LIBS -lglu32 -lopengl32 -luser32 -lgdi32"
230 dnl add -lwsock32 for mingwin
233 echo "********** BUILDING FOR MINGW32 *************"
234 base_LIBS="$base_LIBS -lws2_32"
238 echo "Will link apps with $LIBS"
245 LIBS="$LIBS -framework GLUT -framework OpenGL -framework AGL -framework Carbon -lobjc"
246 joystick_LIBS="$joystick_LIBS -framework IOKit -framework CoreFoundation"
250 dnl X-Windows based machines
252 dnl Skip X11 library tests if requested.
253 if test "x$no_x" != "xyes"; then
254 AC_SEARCH_LIBS(XCreateWindow, X11)
255 AC_SEARCH_LIBS(XShmCreateImage, Xext)
256 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
257 AC_SEARCH_LIBS(IceOpenConnection, ICE)
258 AC_SEARCH_LIBS(SmcOpenConnection, SM)
259 AC_SEARCH_LIBS(XtMalloc, Xt)
260 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
263 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
264 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
265 dnl if GLcore found, then also check for GL
266 AC_SEARCH_LIBS(glXCreateContext, GL)
269 dnl if using mesa, check for xmesa.h
270 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
271 AC_CHECK_HEADER(GL/fxmesa.h)
272 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
273 AC_DEFINE([XMESA], 1, [Define for fxmesa])
274 AC_DEFINE([FX], 1, [Define for fxmesa])
278 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
279 AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
280 if test "x$enable_sdl" = "xyes"; then
281 AC_SEARCH_LIBS(SDL_Init, SDL)
288 LIBS="$base_LIBS $joystick_LIBS"
290 dnl check for OpenAL libraries
292 *-*-cygwin* | *-*-mingw32*)
293 dnl CygWin under Windoze.
295 AC_SEARCH_LIBS(alGenBuffers, openal32)
296 AC_SEARCH_LIBS(alutInit, [ openal32 ALut ] )
297 LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
304 LIBS="$LIBS -framework IOKit -framework OpenAL"
309 dnl default unix style machines
312 LIBS="$LIBS $thread_LIBS"
313 AC_SEARCH_LIBS(alGenBuffers, openal)
314 OPENAL_OK="$ac_cv_search_alGenBuffers"
324 AC_SUBST(openal_LIBS)
325 AC_SUBST(opengl_LIBS)
326 AC_SUBST(thread_LIBS)
327 AC_SUBST(network_LIBS)
328 AC_SUBST(joystick_LIBS)
330 # The following are C++ items that need to be tested for with the c++
335 # Check for "plib" without which we cannot go on
336 AC_CHECK_HEADER(plib/ul.h)
337 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
339 echo "You *must* have the plib library installed on your system to build"
340 echo "the FGFS simulator!"
342 echo "Please see README.plib for more details."
344 echo "configure aborted."
348 AC_MSG_CHECKING([for plib 1.8.4 or newer])
352 #define MIN_PLIB_VERSION 184
355 int major, minor, micro;
357 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
366 [AC_MSG_RESULT(wrong version);
367 AC_MSG_ERROR([Install plib 1.8.0 or later first...])],
371 dnl If we get here then plib is available, so force use of plib
373 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
376 dnl Check for the presence of SimGear
377 AC_CHECK_HEADER(simgear/version.h)
378 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
380 echo "You *must* have the SimGear support library installed on your system"
381 echo "to build the FGFS simulator!"
383 echo "Please see README.SimGear for more details."
385 echo "configure aborted."
389 AC_MSG_CHECKING([for simgear 0.3.8 or newer])
393 #include <simgear/version.h>
395 #define STRINGIFY(X) XSTRINGIFY(X)
396 #define XSTRINGIFY(X) #X
403 int major, minor, micro;
405 /* printf("%d.%d.%d or greater, ", MIN_MAJOR, MIN_MINOR, MIN_MICRO); */
406 printf("[found %s] ... ", STRINGIFY(SIMGEAR_VERSION));
408 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
410 if ( (major < MIN_MAJOR) ||
411 (major == MIN_MAJOR && minor < MIN_MINOR) ||
412 (major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO) ) {
421 [AC_MSG_RESULT(wrong version);
422 AC_MSG_ERROR([Install latest simgear first...])],
428 dnl Check if SimGear was built with Norman's JPEG factory support
429 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
430 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
431 AC_CHECK_LIB(jpeg, jpeg_start_compress)
432 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
434 echo "The JPEG factory code was built and installed with SimGear."
435 echo "However it appears the libjpeg is no longer installed."
436 echo "You need to install libjpeg or remove jpgfactory support from"
439 echo "libjpeg is available at :"
440 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
443 AC_DEFINE([FG_JPEG_SERVER], 1,
444 [Define to build with jpeg screen shot server])
446 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
450 dnl Check for system installed zlib
451 AC_CHECK_HEADER(zlib.h)
452 if test "x$ac_cv_header_zlib_h" != "xyes"; then
454 echo "zlib library not found."
456 echo "If your OS does not provide an installable package for zlib"
457 echo "you will have to compile and install it first yourself. A copy"
458 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
459 echo "have to untar this source code, and follow it's included instructions"
460 echo "to compile and install on your system."
462 echo "configure aborted."
466 dnl Checks for header files.
469 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
470 sys/time.h sys/timeb.h unistd.h windows.h values.h )
472 dnl Checks for typedefs, structures, and compiler characteristics.
478 dnl Checks for library functions.
480 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
484 ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
485 random drand48 setitimer getitimer signal GetLocalTime rint getrusage \
489 AM_CONFIG_HEADER(src/Include/config.h)
501 scripts/debug/Makefile \
502 scripts/perl/Makefile \
503 scripts/perl/examples/Makefile \
504 scripts/python/Makefile \
506 src/Include/Makefile \
507 src/Include/version.h \
508 src/Include/config.h-msvc6 \
509 src/Aircraft/Makefile \
510 src/Airports/Makefile \
512 src/Autopilot/Makefile \
513 src/Cockpit/Makefile \
514 src/Cockpit/built_in/Makefile \
515 src/Controls/Makefile \
516 src/Environment/Makefile \
517 src/FDM/Balloon/Makefile \
518 src/FDM/ExternalNet/Makefile \
519 src/FDM/ExternalPipe/Makefile \
520 src/FDM/JSBSim/Makefile \
521 src/FDM/JSBSim/filtersjb/Makefile \
522 src/FDM/LaRCsim/Makefile \
523 src/FDM/SP/Makefile \
524 src/FDM/UIUCModel/Makefile \
525 src/FDM/YASim/Makefile \
529 src/Instrumentation/Makefile \
532 src/Main/runfgfs.bat \
534 src/AIModel/Makefile \
535 src/MultiPlayer/Makefile \
536 src/Navaids/Makefile \
537 src/Network/Makefile \
538 src/Objects/Makefile \
539 src/Replay/Makefile \
540 src/Scenery/Makefile \
541 src/Scripting/Makefile \
543 src/Systems/Makefile \
545 src/Traffic/Makefile \
548 utils/TerraSync/Makefile \
549 utils/Modeller/Makefile \
550 utils/js_server/Makefile \
554 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
557 echo "Configure Summary"
558 echo "================="
560 echo "Prefix: $prefix"
562 if test "x$with_logging" != "x"; then
563 echo "Debug messages: $with_logging"
565 echo "Debug messages: yes"
568 echo -n "Automake version: "
569 automake --version | head -1
571 if test "x$with_multiplayer" != "xno"; then
572 echo "Building with multiplayer support"
575 if test "x$with_threads" = "xyes"; then
581 if test "x$enable_sp_fdms" != "xno"; then
582 echo "Include special purpose flight models: yes"
584 echo "Include special purpose flight models: no"