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.9)
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 # Specify if we want to build with Multiplayer support
94 # default to with_network=yes
95 AC_ARG_WITH(multiplayer, [ --with-multiplayer Include multiplayer support [default=yes]])
97 if test "x$with_multiplayer" = "xno"; then
98 echo "Building without any kind of multiplayer support"
100 echo "Building with multiplayer support"
101 AC_DEFINE([FG_MPLAYER_AS], 1, [Define to build with multiplayer support])
103 AM_CONDITIONAL(ENABLE_MPLAYER_AS, test "x$with_multiplayer" != "xno")
105 AC_ARG_ENABLE(sp_fdms, [ --enable-sp-fdms Include special purpose Flight Models], [enable_sp_fdms="$enableval"] )
106 AC_DEFINE([ENABLE_SP_FMDS], test "x$enable_sp_fdms" = "xyes", [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 Festival related checks
123 AC_ARG_WITH(festival, [ --with-festival Use festival speech software [default=no]], [], [with_festival=no])
124 if test "x$with_festival" = "xyes"; then
125 AC_DEFINE([USE_FESTIVAL], 1, [Define to enable festival speech software])
127 AM_CONDITIONAL(USE_FESTIVAL, test "x$with_festival" = "xyes")
129 dnl Used by JSBSim to conditionally compile in fgfs interface code
130 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
132 # Check for MS Windows environment
133 AC_CHECK_HEADER(windows.h)
135 dnl Using AM_CONDITIONAL is a step out of the protected little
136 dnl automake fold so it is potentially dangerous. But, we are
137 dnl beginning to run into cases where the standard checks are not
138 dnl enough. AM_CONDITIONALS are then referenced to conditionally
139 dnl build a Makefile.in from a Makefile.am which lets us define custom
140 dnl includes, compile alternative source files, etc.
142 dnl Check for external variables daylight and timezone.
144 if test "$have_daylight" = yes; then
145 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
149 if test "$have_timezone" = yes; then
150 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
154 dnl add joystick support libraries
155 dnl search for FreeBSD library
156 AC_SEARCH_LIBS(hid_init, usbhid)
157 joystick_LIBS="$LIBS"
161 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
162 dnl just assuming we have audio support on all platform. We can
163 dnl depend on plib to hide the details.
164 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
166 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
167 dnl to use it if it is.
169 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
170 echo no fancy X11 check
179 dnl Checks for libraries.
181 dnl Thread related checks
182 AC_SEARCH_LIBS(pthread_cancel, [pthread c_r])
183 if test "x$ac_cv_header_pthread_h" = "xyes"; then
184 if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
185 CXXFLAGS="-pthread $CXXFLAGS"
186 CFLAGS="-pthread $CFLAGS"
193 dnl search for network related libraries
194 AC_SEARCH_LIBS(inet_addr, xnet)
195 AC_SEARCH_LIBS(socket, socket)
196 AC_SEARCH_LIBS(main, nsl)
201 dnl check for some default libraries
202 AC_SEARCH_LIBS(sqrt, [am ffm fm fastm m])
203 AC_SEARCH_LIBS(ceil, m)
204 AC_SEARCH_LIBS(dlclose, dl)
208 dnl Check for SDL if enabled.
209 AC_ARG_ENABLE(sdl, [ --enable-sdl Configure to use SDL instead of GLUT], [enable_sdl="$enableval"])
210 AM_CONDITIONAL(USE_SDL, test "x$enable_sdl" = "xyes")
211 if test "x$enable_sdl" = "xyes"; then
212 AC_DEFINE([PU_USE_SDL], 1, [Define to use SDL])
214 AC_DEFINE([PU_USE_GLUT], 1, [Define to use glut])
217 dnl check for OpenGL related libraries
219 *-*-cygwin* | *-*-mingw32*)
220 dnl CygWin under Windoze.
222 echo Win32 specific hacks...
223 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
224 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
226 if test "x$enable_sdl" = "xyes"; then
227 AC_SEARCH_LIBS(SDL_Init, SDL)
229 LIBS="$LIBS -lglut32"
232 LIBS="$LIBS -lglu32 -lopengl32 -luser32 -lgdi32"
233 joystick_LIBS="$joystick_LIBS -lwinmm"
235 dnl add -lwsock32 for mingwin
238 echo "********** BUILDING FOR MINGW32 *************"
239 network_LIBS="$network_LIBS -lws2_32"
243 echo "Will link apps with $LIBS"
250 LIBS="$LIBS -framework GLUT -framework OpenGL -framework AGL -framework Carbon -lobjc"
251 joystick_LIBS="$joystick_LIBS -framework IOKit -framework CoreFoundation"
255 dnl X-Windows based machines
257 dnl Skip X11 library tests if requested.
258 if test "x$no_x" != "xyes"; then
259 AC_SEARCH_LIBS(XCreateWindow, X11)
260 AC_SEARCH_LIBS(XShmCreateImage, Xext)
261 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
262 AC_SEARCH_LIBS(IceOpenConnection, ICE)
263 AC_SEARCH_LIBS(SmcOpenConnection, SM)
264 AC_SEARCH_LIBS(XtMalloc, Xt)
265 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
268 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
269 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
270 dnl if GLcore found, then also check for GL
271 AC_SEARCH_LIBS(glXCreateContext, GL)
274 dnl if using mesa, check for xmesa.h
275 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
276 AC_CHECK_HEADER(GL/fxmesa.h)
277 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
278 AC_DEFINE([XMESA], 1, [Define for fxmesa])
279 AC_DEFINE([FX], 1, [Define for fxmesa])
283 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
284 AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
285 if test "x$enable_sdl" = "xyes"; then
286 AC_SEARCH_LIBS(SDL_Init, SDL)
293 LIBS="$base_LIBS $joystick_LIBS"
295 dnl check for OpenAL libraries
297 *-*-cygwin* | *-*-mingw32*)
298 dnl CygWin under Windoze.
300 AC_SEARCH_LIBS(alGenBuffers, openal32)
301 AC_SEARCH_LIBS(alutInit, [ openal32 ALut ] )
302 LIBS="$LIBS -ldsound -ldxguid -lole32"
309 LIBS="$LIBS -framework IOKit -framework OpenAL"
314 dnl default unix style machines
317 LIBS="$LIBS $thread_LIBS"
318 AC_SEARCH_LIBS(alGenBuffers, openal)
319 AC_SEARCH_LIBS(alutInit, [ alut openal ] )
320 OPENAL_OK="$ac_cv_search_alGenBuffers"
330 AC_SUBST(openal_LIBS)
331 AC_SUBST(opengl_LIBS)
332 AC_SUBST(thread_LIBS)
333 AC_SUBST(network_LIBS)
334 AC_SUBST(joystick_LIBS)
336 # The following are C++ items that need to be tested for with the c++
341 # Check for "plib" without which we cannot go on
342 AC_CHECK_HEADER(plib/ul.h)
343 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
345 echo "You *must* have the plib library installed on your system to build"
346 echo "the FGFS simulator!"
348 echo "Please see README.plib for more details."
350 echo "configure aborted."
354 AC_MSG_CHECKING([for plib 1.8.4 or newer])
358 #define MIN_PLIB_VERSION 184
361 int major, minor, micro;
363 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
372 [AC_MSG_RESULT(wrong version);
373 AC_MSG_ERROR([Install plib 1.8.4 or later first...])],
377 dnl If we get here then plib is available, so force use of plib
379 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
382 dnl Check for the presence of SimGear
383 if test "x$with_simgear" != "x"; then
384 AC_CHECK_HEADER($with_simgear/include/simgear/version.h, [ac_cv_header_simgear_version_h=yes], [ac_cv_header_simgear_version_h=no])
386 AC_CHECK_HEADER(simgear/version.h)
388 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
390 echo "You *must* have the SimGear support library installed on your system"
391 echo "to build the FGFS simulator!"
393 echo "Please see README.SimGear for more details."
395 echo "configure aborted."
399 AC_MSG_CHECKING([for simgear 0.3.9 or newer])
403 #include <simgear/version.h>
405 #define STRINGIFY(X) XSTRINGIFY(X)
406 #define XSTRINGIFY(X) #X
413 int major, minor, micro;
415 /* printf("%d.%d.%d or greater, ", MIN_MAJOR, MIN_MINOR, MIN_MICRO); */
416 printf("[found %s] ... ", STRINGIFY(SIMGEAR_VERSION));
418 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
420 if ( (major < MIN_MAJOR) ||
421 (major == MIN_MAJOR && minor < MIN_MINOR) ||
422 (major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO) ) {
431 [AC_MSG_RESULT(wrong version);
432 AC_MSG_ERROR([Install latest simgear first...])],
438 dnl Check if SimGear was built with Norman's JPEG factory support
439 if test "x$with_simgear" != "x"; then
440 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])
442 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
444 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
445 AC_CHECK_LIB(jpeg, jpeg_start_compress)
446 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
448 echo "The JPEG factory code was built and installed with SimGear."
449 echo "However it appears the libjpeg is no longer installed."
450 echo "You need to install libjpeg or remove jpgfactory support from"
453 echo "libjpeg is available at :"
454 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
457 AC_DEFINE([FG_JPEG_SERVER], 1,
458 [Define to build with jpeg screen shot server])
460 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
464 dnl Check for system installed zlib
465 AC_CHECK_HEADER(zlib.h)
466 if test "x$ac_cv_header_zlib_h" != "xyes"; then
468 echo "zlib library not found."
470 echo "If your OS does not provide an installable package for zlib"
471 echo "you will have to compile and install it first yourself. A copy"
472 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
473 echo "have to untar this source code, and follow it's included instructions"
474 echo "to compile and install on your system."
476 echo "configure aborted."
480 dnl Checks for header files.
483 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
484 sys/time.h sys/timeb.h unistd.h windows.h values.h )
486 dnl Checks for typedefs, structures, and compiler characteristics.
492 dnl Checks for library functions.
494 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
498 ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
499 random drand48 setitimer getitimer signal GetLocalTime rint getrusage \
503 AM_CONFIG_HEADER(src/Include/config.h)
515 scripts/debug/Makefile \
516 scripts/perl/Makefile \
517 scripts/perl/examples/Makefile \
518 scripts/python/Makefile \
520 src/Include/Makefile \
521 src/Include/version.h \
522 src/Include/config.h-msvc6 \
523 src/Aircraft/Makefile \
524 src/Airports/Makefile \
526 src/Autopilot/Makefile \
527 src/Cockpit/Makefile \
528 src/Cockpit/built_in/Makefile \
529 src/Environment/Makefile \
530 src/FDM/Balloon/Makefile \
531 src/FDM/ExternalNet/Makefile \
532 src/FDM/ExternalPipe/Makefile \
533 src/FDM/JSBSim/Makefile \
534 src/FDM/JSBSim/initialization/Makefile \
535 src/FDM/JSBSim/input_output/Makefile \
536 src/FDM/JSBSim/math/Makefile \
537 src/FDM/JSBSim/models/Makefile \
538 src/FDM/JSBSim/models/flight_control/Makefile \
539 src/FDM/JSBSim/models/atmosphere/Makefile \
540 src/FDM/JSBSim/models/propulsion/Makefile \
541 src/FDM/LaRCsim/Makefile \
542 src/FDM/SP/Makefile \
543 src/FDM/UIUCModel/Makefile \
544 src/FDM/YASim/Makefile \
548 src/Instrumentation/Makefile \
549 src/Instrumentation/KLN89/Makefile \
552 src/Main/runfgfs.bat \
554 src/AIModel/Makefile \
555 src/MultiPlayer/Makefile \
556 src/Navaids/Makefile \
557 src/Network/Makefile \
558 src/Scenery/Makefile \
559 src/Scripting/Makefile \
561 src/Systems/Makefile \
563 src/Traffic/Makefile \
566 utils/GPSsmooth/Makefile \
567 utils/js_server/Makefile \
568 utils/Modeller/Makefile \
569 utils/TerraSync/Makefile \
570 utils/xmlgrep/Makefile \
574 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
577 echo "Configure Summary"
578 echo "================="
580 echo "Prefix: $prefix"
582 if test "x$with_logging" != "x"; then
583 echo "Debug messages: $with_logging"
585 echo "Debug messages: yes"
588 echo -n "Automake version: "
589 automake --version | head -n 1
591 if test "x$with_multiplayer" != "xno"; then
592 echo "Building with multiplayer support"
595 if test "x$with_threads" = "xyes"; then
601 if test "x$enable_sp_fdms" != "xno"; then
602 echo "Include special purpose flight models: yes"
604 echo "Include special purpose flight models: no"