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 dnl set the $host variable based on local machine/os
15 AM_INIT_AUTOMAKE(FlightGear, 0.9.6)
17 dnl Checks for programs.
26 # specify the simgear location
27 AC_ARG_WITH(simgear, [ --with-simgear=PREFIX Specify the prefix path to simgear])
29 if test "x$with_simgear" != "x" ; then
30 echo "SimGear prefix path is $with_simgear"
31 EXTRA_DIRS="${EXTRA_DIRS} $with_simgear"
36 if test "$CXX" = "CC"; then
39 CXXFLAGS="$CXXFLAGS -I$with_simgear/include/simgear/compatibility"
53 dnl set logging; default value of with_logging=yes
54 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
55 if test "x$with_logging" = "xno" ; then
56 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
59 # Specify if we want to build with Multiplayer support
60 # default to with_network=yes
61 AC_ARG_WITH(multiplayer, [ --with-multiplayer Include multiplayer support [default=yes]])
63 if test "x$with_multiplayer" = "xno"; then
64 echo "Building without any kind of multiplayer support"
66 echo "Building with multiplayer support"
67 AC_DEFINE([FG_MPLAYER_AS], 1, [Define to build with multiplayer support])
69 AM_CONDITIONAL(ENABLE_MPLAYER_AS, test "x$with_multiplayer" != "xno")
71 AC_ARG_ENABLE(sp_fdms, [ --enable-sp-fdms Include special purpose Flight Models], [enable_sp_fdms="$enableval"] )
72 AC_DEFINE([ENABLE_SP_FMDS], test "x$enable_sp_fdms" = "xyes", [Define to include special purpose FDMs])
73 AM_CONDITIONAL(ENABLE_SP_FDM, test "x$enable_sp_fdms" != "xno")
76 dnl Thread related checks
79 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=yes]])
80 if test "x$with_threads" != "xyes"; then
81 AC_DEFINE([ENABLE_THREADS], 0, [Define to enable threaded tile paging])
83 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
84 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
85 CFLAGS="$CFLAGS -D_REENTRANT"
87 AC_CHECK_HEADER(pthread.h)
88 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
90 # specify the plib location
91 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
93 if test "x$with_plib" != "x" ; then
94 echo "plib prefix is $with_plib"
95 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
98 dnl Used by JSBSim to conditionally compile in fgfs interface code
99 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
101 dnl Used to control whether clouds3d should be compiled in or not
102 AC_DEFINE([FG_USE_CLOUDS_3D], 1, [Define to use 3D cloud support])
103 AM_CONDITIONAL(FG_USE_CLOUDS_3D, test "x" = "x")
105 # Check for MS Windows environment
106 AC_CHECK_HEADER(windows.h)
108 dnl Determine an extra directories to add to include/lib search paths
110 *-apple-darwin* | *-*-mingw32*)
111 echo no EXTRA_DIRS for $host
115 if test -d /usr/local ; then
116 EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
121 if test -d /usr/X11R6 ; then
122 EXTRA_DIR1="/usr/X11R6"
124 if test -d /opt/X11R6 ; then
125 EXTRA_DIR2="/opt/X11R6"
127 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2 /usr/local/"
131 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
134 dnl Using AM_CONDITIONAL is a step out of the protected little
135 dnl automake fold so it is potentially dangerous. But, we are
136 dnl beginning to run into cases where the standard checks are not
137 dnl enough. AM_CONDITIONALS are then referenced to conditionally
138 dnl build a Makefile.in from a Makefile.am which lets us define custom
139 dnl includes, compile alternative source files, etc.
141 dnl Check for external variables daylight and timezone.
143 if test "$have_daylight" = yes; then
144 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
148 if test "$have_timezone" = yes; then
149 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
152 dnl add correct audio libs and configure for audio support
153 audio_LIBS="-lplibsl -lplibsm"
155 *-*-cygwin* | *-*-mingw32*)
156 audio_LIBS="$audio_LIBS -lwinmm"
159 audio_LIBS="$audio_LIBS -framework IOKit -framework CoreFoundation"
162 audio_LIBS="$audio_LIBS -laudio"
168 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
169 dnl just assuming we have audio support on all platform. We can
170 dnl depend on plib to hide the details.
171 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
173 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
174 dnl to use it if it is.
176 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
177 echo no fancy X11 check
186 dnl Checks for libraries.
188 dnl Thread related checks
189 AC_CHECK_LIB(pthread, pthread_exit)
190 if test "x$ac_cv_lib_pthread_pthread_exit" != "xyes" \
191 -a "x$ac_cv_header_pthread_h" = "xyes"; then
192 dnl FreeBSD: System has pthread.h, but -lpthread library check
193 dnl fails. See if we need -pthread instead of -lpthread and look
194 dnl for the functions in libc_r.
195 save_CXXFLAGS="$CXXFLAGS"
196 save_CFLAGS="$CFLAGS"
197 CXXFLAGS="-pthread $CXXFLAGS"
198 CFLAGS="-pthread $CFLAGS"
200 AC_CHECK_LIB(c_r, pthread_exit)
201 if test "x$ac_cv_lib_c_r_pthread_exit" != "xyes"; then
202 CXXFLAGS=$save_CXXFLAGS
211 dnl search for network related libraries
212 AC_SEARCH_LIBS(inet_addr, xnet)
213 AC_SEARCH_LIBS(socket, socket)
214 AC_SEARCH_LIBS(main, nsl)
219 dnl check for some default libraries
220 AC_SEARCH_LIBS(cos, m)
221 AC_SEARCH_LIBS(dlclose, dl)
223 dnl search for FreeBSD library
224 AC_SEARCH_LIBS(hid_init, usbhid)
228 dnl Check for SDL if enabled.
229 AC_ARG_ENABLE(sdl, [ --enable-sdl Configure to use SDL instead of GLUT], [enable_sdl="$enableval"])
230 AM_CONDITIONAL(USE_SDL, test "x$enable_sdl" = "xyes")
231 if test "x$enable_sdl" = "xyes"; then
232 AC_DEFINE([PU_USE_SDL], 1, [Define to use SDL])
234 AC_DEFINE([PU_USE_GLUT], 1, [Define to use glut])
237 dnl check for OpenGL related libraries
239 *-*-cygwin* | *-*-mingw32*)
240 dnl CygWin under Windoze.
242 echo Win32 specific hacks...
243 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
244 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
246 if test "x$enable_sdl" = "xyes"; then
247 AC_SEARCH_LIBS(SDL_Init, SDL)
249 LIBS="$LIBS -lglut32"
252 LIBS="$LIBS -lglu32 -lopengl32 -luser32 -lgdi32"
254 dnl add -lwsock32 for mingwin
257 echo "********** BUILDING FOR MINGW32 *************"
258 base_LIBS="$base_LIBS -lws2_32"
262 echo "Will link apps with $LIBS"
269 LIBS="$LIBS -framework GLUT -framework OpenGL -framework AGL -framework Carbon -lobjc"
273 dnl X-Windows based machines
275 dnl Skip X11 library tests if requested.
276 if test "x$no_x" != "xyes"; then
277 AC_SEARCH_LIBS(XCreateWindow, X11)
278 AC_SEARCH_LIBS(XShmCreateImage, Xext)
279 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
280 AC_SEARCH_LIBS(IceOpenConnection, ICE)
281 AC_SEARCH_LIBS(SmcOpenConnection, SM)
282 AC_SEARCH_LIBS(XtMalloc, Xt)
283 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
286 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
287 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
288 dnl if GLcore found, then also check for GL
289 AC_SEARCH_LIBS(glXCreateContext, GL)
292 dnl if using mesa, check for xmesa.h
293 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
294 AC_CHECK_HEADER(GL/fxmesa.h)
295 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
296 AC_DEFINE([XMESA], 1, [Define for fxmesa])
297 AC_DEFINE([FX], 1, [Define for fxmesa])
301 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
302 AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
303 if test "x$enable_sdl" = "xyes"; then
304 AC_SEARCH_LIBS(SDL_Init, SDL)
313 dnl check for OpenAL libraries
315 *-*-cygwin* | *-*-mingw32*)
316 dnl CygWin under Windoze.
318 AC_SEARCH_LIBS(alGenBuffers, openal32)
319 AC_SEARCH_LIBS(alutInit, [ openal32 ALut ] )
320 LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
326 LIBS="$LIBS -framework IOKit -framework OpenAL"
330 dnl default unix style machines
332 AC_SEARCH_LIBS(alGenBuffers, openal)
341 AC_SUBST(openal_LIBS)
342 AC_SUBST(opengl_LIBS)
343 AC_SUBST(thread_LIBS)
344 AC_SUBST(network_LIBS)
346 # The following are C++ items that need to be tested for with the c++
351 # Check for "plib" without which we cannot go on
352 AC_CHECK_HEADER(plib/ul.h)
353 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
355 echo "You *must* have the plib library installed on your system to build"
356 echo "the FGFS simulator!"
358 echo "Please see README.plib for more details."
360 echo "configure aborted."
364 AC_MSG_CHECKING([for plib 1.8.0 or newer])
368 #define MIN_PLIB_VERSION 170
371 int major, minor, micro;
373 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
382 [AC_MSG_RESULT(wrong version);
383 AC_MSG_ERROR([Install plib 1.8.0 or later first...])],
387 dnl If we get here then plib is available, so force use of plib
389 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
392 dnl Check for the presence of SimGear
393 AC_CHECK_HEADER(simgear/version.h)
394 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
396 echo "You *must* have the SimGear support library installed on your system"
397 echo "to build the FGFS simulator!"
399 echo "Please see README.SimGear for more details."
401 echo "configure aborted."
405 AC_MSG_CHECKING([for simgear 0.3.7 or newer])
409 #include <simgear/version.h>
411 #define STRINGIFY(X) XSTRINGIFY(X)
412 #define XSTRINGIFY(X) #X
419 int major, minor, micro;
421 /* printf("%d.%d.%d or greater, ", MIN_MAJOR, MIN_MINOR, MIN_MICRO); */
422 printf("[found %s] ... ", STRINGIFY(SIMGEAR_VERSION));
424 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
426 if ( (major < MIN_MAJOR) ||
427 (major == MIN_MAJOR && minor < MIN_MINOR) ||
428 (major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO) ) {
437 [AC_MSG_RESULT(wrong version);
438 AC_MSG_ERROR([Install latest simgear first...])],
444 dnl Check if SimGear was built with Norman's JPEG factory support
445 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/Aircraft/Makefile \
526 src/Airports/Makefile \
528 src/Autopilot/Makefile \
529 src/Cockpit/Makefile \
530 src/Cockpit/built_in/Makefile \
531 src/Controls/Makefile \
532 src/Environment/Makefile \
533 src/FDM/Balloon/Makefile \
534 src/FDM/ExternalNet/Makefile \
535 src/FDM/ExternalPipe/Makefile \
536 src/FDM/JSBSim/Makefile \
537 src/FDM/JSBSim/filtersjb/Makefile \
538 src/FDM/LaRCsim/Makefile \
539 src/FDM/SP/Makefile \
540 src/FDM/UIUCModel/Makefile \
541 src/FDM/YASim/Makefile \
545 src/Instrumentation/Makefile \
548 src/Main/runfgfs.bat \
550 src/AIModel/Makefile \
551 src/MultiPlayer/Makefile \
552 src/Navaids/Makefile \
553 src/Network/Makefile \
554 src/Objects/Makefile \
555 src/Replay/Makefile \
556 src/Scenery/Makefile \
557 src/Scripting/Makefile \
559 src/Systems/Makefile \
561 src/Traffic/Makefile \
564 utils/TerraSync/Makefile \
565 utils/Modeller/Makefile \
566 utils/js_server/Makefile \
570 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
573 echo "Configure Summary"
574 echo "================="
576 echo "Prefix: $prefix"
578 if test "x$with_logging" != "x"; then
579 echo "Debug messages: $with_logging"
581 echo "Debug messages: yes"
584 echo -n "Automake version: "
585 automake --version | head -1
587 if test "x$with_multiplayer" != "xno"; then
588 echo "Building with multiplayer support"
591 if test "x$with_threads" = "xyes"; then
597 if test "x$enable_sp_fdms" != "xno"; then
598 echo "Include special purpose flight models: yes"
600 echo "Include special purpose flight models: no"