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"
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
77 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=yes]], [], [with_threads=yes])
78 if test "x$with_threads" = "xyes"; then
79 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
80 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
81 CFLAGS="$CFLAGS -D_REENTRANT"
83 AC_CHECK_HEADER(pthread.h)
84 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
86 # specify the plib location
87 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
89 if test "x$with_plib" != "x" ; then
90 echo "plib prefix is $with_plib"
91 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
94 dnl Used by JSBSim to conditionally compile in fgfs interface code
95 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
97 # Check for MS Windows environment
98 AC_CHECK_HEADER(windows.h)
100 dnl Determine an extra directories to add to include/lib search paths
102 *-apple-darwin* | *-*-mingw32*)
103 echo no EXTRA_DIRS for $host
107 if test -d /usr/local ; then
108 EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
113 if test -d /usr/X11R6 ; then
114 EXTRA_DIR1="/usr/X11R6"
116 if test -d /opt/X11R6 ; then
117 EXTRA_DIR2="/opt/X11R6"
119 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2 /usr/local"
123 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
126 dnl Using AM_CONDITIONAL is a step out of the protected little
127 dnl automake fold so it is potentially dangerous. But, we are
128 dnl beginning to run into cases where the standard checks are not
129 dnl enough. AM_CONDITIONALS are then referenced to conditionally
130 dnl build a Makefile.in from a Makefile.am which lets us define custom
131 dnl includes, compile alternative source files, etc.
133 dnl Check for external variables daylight and timezone.
135 if test "$have_daylight" = yes; then
136 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
140 if test "$have_timezone" = yes; then
141 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
145 dnl add joystick support libraries
146 dnl search for FreeBSD library
147 AC_SEARCH_LIBS(hid_init, usbhid)
148 joystick_LIBS="$LIBS"
152 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
153 dnl just assuming we have audio support on all platform. We can
154 dnl depend on plib to hide the details.
155 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
157 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
158 dnl to use it if it is.
160 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
161 echo no fancy X11 check
170 dnl Checks for libraries.
172 dnl Thread related checks
173 AC_SEARCH_LIBS(pthread_cancel, [pthread c_r])
174 if test "x$ac_cv_header_pthread_h" = "xyes"; then
175 if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
176 CXXFLAGS="-pthread $CXXFLAGS"
177 CFLAGS="-pthread $CFLAGS"
184 dnl search for network related libraries
185 AC_SEARCH_LIBS(inet_addr, xnet)
186 AC_SEARCH_LIBS(socket, socket)
187 AC_SEARCH_LIBS(main, nsl)
192 dnl check for some default libraries
193 AC_SEARCH_LIBS(sqrt, [am ffm fm fastm m])
194 AC_SEARCH_LIBS(ceil, m)
195 AC_SEARCH_LIBS(dlclose, dl)
199 dnl Check for SDL if enabled.
200 AC_ARG_ENABLE(sdl, [ --enable-sdl Configure to use SDL instead of GLUT], [enable_sdl="$enableval"])
201 AM_CONDITIONAL(USE_SDL, test "x$enable_sdl" = "xyes")
202 if test "x$enable_sdl" = "xyes"; then
203 AC_DEFINE([PU_USE_SDL], 1, [Define to use SDL])
205 AC_DEFINE([PU_USE_GLUT], 1, [Define to use glut])
208 dnl check for OpenGL related libraries
210 *-*-cygwin* | *-*-mingw32*)
211 dnl CygWin under Windoze.
213 echo Win32 specific hacks...
214 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
215 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
217 if test "x$enable_sdl" = "xyes"; then
218 AC_SEARCH_LIBS(SDL_Init, SDL)
220 LIBS="$LIBS -lglut32"
223 LIBS="$LIBS -lglu32 -lopengl32 -luser32 -lgdi32"
224 joystick_LIBS="$joystick_LIBS -lwinmm"
226 dnl add -lwsock32 for mingwin
229 echo "********** BUILDING FOR MINGW32 *************"
230 network_LIBS="$network_LIBS -lws2_32"
234 echo "Will link apps with $LIBS"
241 LIBS="$LIBS -framework GLUT -framework OpenGL -framework AGL -framework Carbon -lobjc"
242 joystick_LIBS="$joystick_LIBS -framework IOKit -framework CoreFoundation"
246 dnl X-Windows based machines
248 dnl Skip X11 library tests if requested.
249 if test "x$no_x" != "xyes"; then
250 AC_SEARCH_LIBS(XCreateWindow, X11)
251 AC_SEARCH_LIBS(XShmCreateImage, Xext)
252 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
253 AC_SEARCH_LIBS(IceOpenConnection, ICE)
254 AC_SEARCH_LIBS(SmcOpenConnection, SM)
255 AC_SEARCH_LIBS(XtMalloc, Xt)
256 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
259 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
260 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
261 dnl if GLcore found, then also check for GL
262 AC_SEARCH_LIBS(glXCreateContext, GL)
265 dnl if using mesa, check for xmesa.h
266 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
267 AC_CHECK_HEADER(GL/fxmesa.h)
268 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
269 AC_DEFINE([XMESA], 1, [Define for fxmesa])
270 AC_DEFINE([FX], 1, [Define for fxmesa])
274 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
275 AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
276 if test "x$enable_sdl" = "xyes"; then
277 AC_SEARCH_LIBS(SDL_Init, SDL)
284 LIBS="$base_LIBS $joystick_LIBS"
286 dnl check for OpenAL libraries
288 *-*-cygwin* | *-*-mingw32*)
289 dnl CygWin under Windoze.
291 AC_SEARCH_LIBS(alGenBuffers, openal32)
292 AC_SEARCH_LIBS(alutInit, [ openal32 ALut ] )
293 LIBS="$LIBS -ldsound -ldxguid -lole32"
300 LIBS="$LIBS -framework IOKit -framework OpenAL"
305 dnl default unix style machines
308 LIBS="$LIBS $thread_LIBS"
309 AC_SEARCH_LIBS(alGenBuffers, openal)
310 AC_SEARCH_LIBS(alutInit, [ alut openal ] )
311 OPENAL_OK="$ac_cv_search_alGenBuffers"
321 AC_SUBST(openal_LIBS)
322 AC_SUBST(opengl_LIBS)
323 AC_SUBST(thread_LIBS)
324 AC_SUBST(network_LIBS)
325 AC_SUBST(joystick_LIBS)
327 # The following are C++ items that need to be tested for with the c++
332 # Check for "plib" without which we cannot go on
333 AC_CHECK_HEADER(plib/ul.h)
334 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
336 echo "You *must* have the plib library installed on your system to build"
337 echo "the FGFS simulator!"
339 echo "Please see README.plib for more details."
341 echo "configure aborted."
345 AC_MSG_CHECKING([for plib 1.8.4 or newer])
349 #define MIN_PLIB_VERSION 184
352 int major, minor, micro;
354 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
363 [AC_MSG_RESULT(wrong version);
364 AC_MSG_ERROR([Install plib 1.8.4 or later first...])],
368 dnl If we get here then plib is available, so force use of plib
370 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
373 dnl Check for the presence of SimGear
374 AC_CHECK_HEADER(simgear/version.h)
375 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
377 echo "You *must* have the SimGear support library installed on your system"
378 echo "to build the FGFS simulator!"
380 echo "Please see README.SimGear for more details."
382 echo "configure aborted."
386 AC_MSG_CHECKING([for simgear 0.3.9 or newer])
390 #include <simgear/version.h>
392 #define STRINGIFY(X) XSTRINGIFY(X)
393 #define XSTRINGIFY(X) #X
400 int major, minor, micro;
402 /* printf("%d.%d.%d or greater, ", MIN_MAJOR, MIN_MINOR, MIN_MICRO); */
403 printf("[found %s] ... ", STRINGIFY(SIMGEAR_VERSION));
405 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
407 if ( (major < MIN_MAJOR) ||
408 (major == MIN_MAJOR && minor < MIN_MINOR) ||
409 (major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO) ) {
418 [AC_MSG_RESULT(wrong version);
419 AC_MSG_ERROR([Install latest simgear first...])],
425 dnl Check if SimGear was built with Norman's JPEG factory support
426 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
427 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
428 AC_CHECK_LIB(jpeg, jpeg_start_compress)
429 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
431 echo "The JPEG factory code was built and installed with SimGear."
432 echo "However it appears the libjpeg is no longer installed."
433 echo "You need to install libjpeg or remove jpgfactory support from"
436 echo "libjpeg is available at :"
437 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
440 AC_DEFINE([FG_JPEG_SERVER], 1,
441 [Define to build with jpeg screen shot server])
443 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
447 dnl Check for system installed zlib
448 AC_CHECK_HEADER(zlib.h)
449 if test "x$ac_cv_header_zlib_h" != "xyes"; then
451 echo "zlib library not found."
453 echo "If your OS does not provide an installable package for zlib"
454 echo "you will have to compile and install it first yourself. A copy"
455 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
456 echo "have to untar this source code, and follow it's included instructions"
457 echo "to compile and install on your system."
459 echo "configure aborted."
463 dnl Checks for header files.
466 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
467 sys/time.h sys/timeb.h unistd.h windows.h values.h )
469 dnl Checks for typedefs, structures, and compiler characteristics.
475 dnl Checks for library functions.
477 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
481 ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
482 random drand48 setitimer getitimer signal GetLocalTime rint getrusage \
486 AM_CONFIG_HEADER(src/Include/config.h)
498 scripts/debug/Makefile \
499 scripts/perl/Makefile \
500 scripts/perl/examples/Makefile \
501 scripts/python/Makefile \
503 src/Include/Makefile \
504 src/Include/version.h \
505 src/Include/config.h-msvc6 \
506 src/Aircraft/Makefile \
507 src/Airports/Makefile \
509 src/Autopilot/Makefile \
510 src/Cockpit/Makefile \
511 src/Cockpit/built_in/Makefile \
512 src/Environment/Makefile \
513 src/FDM/Balloon/Makefile \
514 src/FDM/ExternalNet/Makefile \
515 src/FDM/ExternalPipe/Makefile \
516 src/FDM/JSBSim/Makefile \
517 src/FDM/JSBSim/filtersjb/Makefile \
518 src/FDM/LaRCsim/Makefile \
519 src/FDM/SP/Makefile \
520 src/FDM/UIUCModel/Makefile \
521 src/FDM/YASim/Makefile \
525 src/Instrumentation/Makefile \
526 src/Instrumentation/KLN89/Makefile \
529 src/Main/runfgfs.bat \
531 src/AIModel/Makefile \
532 src/MultiPlayer/Makefile \
533 src/Navaids/Makefile \
534 src/Network/Makefile \
535 src/Scenery/Makefile \
536 src/Scripting/Makefile \
538 src/Systems/Makefile \
540 src/Traffic/Makefile \
543 utils/GPSsmooth/Makefile \
544 utils/js_server/Makefile \
545 utils/Modeller/Makefile \
546 utils/TerraSync/Makefile \
547 utils/xmlgrep/Makefile \
551 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
554 echo "Configure Summary"
555 echo "================="
557 echo "Prefix: $prefix"
559 if test "x$with_logging" != "x"; then
560 echo "Debug messages: $with_logging"
562 echo "Debug messages: yes"
565 echo -n "Automake version: "
566 automake --version | head -1
568 if test "x$with_multiplayer" != "xno"; then
569 echo "Building with multiplayer support"
572 if test "x$with_threads" = "xyes"; then
578 if test "x$enable_sp_fdms" != "xno"; then
579 echo "Include special purpose flight models: yes"
581 echo "Include special purpose flight models: no"