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.4)
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")
72 dnl Thread related checks
73 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=no]])
74 if test "x$with_threads" = "xyes"; then
75 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
76 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
77 CFLAGS="$CFLAGS -D_REENTRANT"
79 AC_CHECK_HEADER(pthread.h)
80 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
82 # specify the plib location
83 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
85 if test "x$with_plib" != "x" ; then
86 echo "plib prefix is $with_plib"
87 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
90 dnl Used by JSBSim to conditionally compile in fgfs interface code
91 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
93 dnl Used to control whether clouds3d should be compiled in or not
94 AC_DEFINE([FG_USE_CLOUDS_3D], 1, [Define to use 3D cloud support])
95 AM_CONDITIONAL(FG_USE_CLOUDS_3D, test "x" = "x")
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"
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])
144 dnl add correct audio libs and configure for audio support
145 audio_LIBS="-lplibsl -lplibsm"
147 *-*-cygwin* | *-*-mingw32*)
148 audio_LIBS="$audio_LIBS -lwinmm"
151 audio_LIBS="$audio_LIBS -framework IOKit -framework CoreFoundation"
154 audio_LIBS="$audio_LIBS -laudio"
160 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
161 dnl just assuming we have audio support on all platform. We can
162 dnl depend on plib to hide the details.
163 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
165 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
166 dnl to use it if it is.
168 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
169 echo no fancy X11 check
178 dnl Checks for libraries.
180 dnl Thread related checks
181 AC_CHECK_LIB(pthread, pthread_exit)
182 if test "x$ac_cv_lib_pthread_pthread_exit" != "xyes" \
183 -a "x$ac_cv_header_pthread_h" = "xyes"; then
184 dnl FreeBSD: System has pthread.h, but -lpthread library check
185 dnl fails. See if we need -pthread instead of -lpthread and look
186 dnl for the functions in libc_r.
187 save_CXXFLAGS="$CXXFLAGS"
188 save_CFLAGS="$CFLAGS"
189 CXXFLAGS="-pthread $CXXFLAGS"
190 CFLAGS="-pthread $CFLAGS"
192 AC_CHECK_LIB(c_r, pthread_exit)
193 if test "x$ac_cv_lib_c_r_pthread_exit" != "xyes"; then
194 CXXFLAGS=$save_CXXFLAGS
203 dnl search for network related libraries
204 AC_SEARCH_LIBS(inet_addr, xnet)
205 AC_SEARCH_LIBS(socket, socket)
206 AC_SEARCH_LIBS(main, nsl)
211 dnl check for some default libraries
212 AC_SEARCH_LIBS(cos, m)
213 AC_SEARCH_LIBS(dlclose, dl)
217 dnl Check for SDL if enabled.
218 AC_ARG_ENABLE(sdl, [ --enable-sdl Configure to use SDL instead of GLUT], enable_sdl="yes", enable_sdl="")
219 AM_CONDITIONAL(USE_SDL, test "x$enable_sdl" = "xyes")
220 if test "x$enable_sdl" = "xyes"; then
221 AC_DEFINE([PU_USE_SDL], 1, [Define to use SDL])
223 AC_DEFINE([PU_USE_GLUT], 1, [Define to use glut])
226 dnl check for glut location
227 AC_CHECK_HEADER(GL/glut.h)
228 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
229 AC_DEFINE([FG_GLUT_H], <GL/glut.h>, [Define as glut.h include location])
231 AC_CHECK_HEADER(GLUT/glut.h)
232 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
233 AC_DEFINE([FG_GLUT_H], <GLUT/glut.h>, [Define as glut.h include location])
235 if test "x$enable_sdl" != "xyes"; then
236 echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue"
242 dnl check for OpenGL related libraries
244 *-*-cygwin* | *-*-mingw32*)
245 dnl CygWin under Windoze.
247 echo Win32 specific hacks...
248 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
249 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
251 LIBS="$LIBS -lglut32 -lglu32 -lopengl32"
252 LIBS="$LIBS -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 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)
314 AC_SUBST(opengl_LIBS)
315 AC_SUBST(thread_LIBS)
316 AC_SUBST(network_LIBS)
318 # The following are C++ items that need to be tested for with the c++
323 # Check for "plib" without which we cannot go on
324 AC_CHECK_HEADER(plib/ul.h)
325 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
327 echo "You *must* have the plib library installed on your system to build"
328 echo "the FGFS simulator!"
330 echo "Please see README.plib for more details."
332 echo "configure aborted."
336 AC_MSG_CHECKING([for plib 1.7.0 or newer])
340 #define MIN_PLIB_VERSION 170
343 int major, minor, micro;
345 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
354 [AC_MSG_RESULT(wrong version);
355 AC_MSG_ERROR([Install plib 1.8.0 or later first...])],
359 dnl If we get here then plib is available, so force use of plib
361 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
364 dnl Check for the presence of SimGear
365 AC_CHECK_HEADER(simgear/version.h)
366 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
368 echo "You *must* have the SimGear support library installed on your system"
369 echo "to build the FGFS simulator!"
371 echo "Please see README.SimGear for more details."
373 echo "configure aborted."
377 AC_MSG_CHECKING([for simgear 0.3.5 or newer])
381 #include <simgear/version.h>
383 #define STRINGIFY(X) XSTRINGIFY(X)
384 #define XSTRINGIFY(X) #X
391 int major, minor, micro;
393 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
395 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
397 if ( major < MIN_MAJOR ) {
399 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
401 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
410 [AC_MSG_RESULT(wrong version);
411 AC_MSG_ERROR([Install latest simgear first...])],
417 dnl Check if SimGear was built with Norman JPEG factory support
418 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
419 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
420 AC_CHECK_LIB(jpeg, jpeg_start_compress)
421 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
423 echo "The JPEG factory code was built and installed with SimGear."
424 echo "However it appears the libjpeg is no longer installed."
425 echo "You need to install libjpeg or remove jpgfactory support from"
428 echo "libjpeg is available at :"
429 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
432 AC_DEFINE([FG_JPEG_SERVER], 1,
433 [Define to build with jpeg screen shot server])
435 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
439 dnl Check for system installed zlib
440 AC_CHECK_HEADER(zlib.h)
441 if test "x$ac_cv_header_zlib_h" != "xyes"; then
443 echo "zlib library not found."
445 echo "If your OS does not provide an installable package for zlib"
446 echo "you will have to compile and install it first yourself. A copy"
447 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
448 echo "have to untar this source code, and follow it's included instructions"
449 echo "to compile and install on your system."
451 echo "configure aborted."
455 dnl Checks for header files.
458 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
459 sys/time.h sys/timeb.h unistd.h windows.h values.h )
461 dnl Checks for typedefs, structures, and compiler characteristics.
467 dnl Checks for library functions.
469 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
473 ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
474 random drand48 setitimer getitimer signal GetLocalTime rint getrusage \
478 AM_CONFIG_HEADER(src/Include/config.h)
490 scripts/debug/Makefile \
491 scripts/perl/Makefile \
492 scripts/perl/examples/Makefile \
493 scripts/python/Makefile \
495 src/Include/Makefile \
496 src/Include/version.h \
497 src/Aircraft/Makefile \
498 src/Airports/Makefile \
500 src/Autopilot/Makefile \
501 src/Cockpit/Makefile \
502 src/Cockpit/built_in/Makefile \
503 src/Controls/Makefile \
504 src/Environment/Makefile \
505 src/FDM/Balloon/Makefile \
506 src/FDM/ExternalNet/Makefile \
507 src/FDM/ExternalPipe/Makefile \
508 src/FDM/JSBSim/Makefile \
509 src/FDM/JSBSim/filtersjb/Makefile \
510 src/FDM/LaRCsim/Makefile \
511 src/FDM/UIUCModel/Makefile \
512 src/FDM/YASim/Makefile \
516 src/Instrumentation/Makefile \
519 src/Main/runfgfs.bat \
521 src/AIModel/Makefile \
522 src/MultiPlayer/Makefile \
523 src/Navaids/Makefile \
524 src/Network/Makefile \
525 src/Objects/Makefile \
526 src/Replay/Makefile \
527 src/Scenery/Makefile \
528 src/Scripting/Makefile \
530 src/Systems/Makefile \
534 utils/TerraSync/Makefile \
535 utils/Modeller/Makefile \
536 utils/js_server/Makefile \
540 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
543 echo "Configure Summary"
544 echo "================="
546 echo "Prefix: $prefix"
548 if test "x$with_logging" != "x"; then
549 echo "Debug messages: $with_logging"
551 echo "Debug messages: yes"
554 echo -n "Automake version: "
555 automake --version | head -1
557 if test "x$with_multiplayer" != "xno"; then
558 echo "Building with multiplayer support"
561 if test "x$with_threads" = "xyes"; then