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.5)
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
75 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=yes]])
76 if test "x$with_threads" != "xyes"; then
77 AC_DEFINE([ENABLE_THREADS], 0, [Define to enable threaded tile paging])
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 dnl Used to control whether clouds3d should be compiled in or not
98 AC_DEFINE([FG_USE_CLOUDS_3D], 1, [Define to use 3D cloud support])
99 AM_CONDITIONAL(FG_USE_CLOUDS_3D, test "x" = "x")
101 # Check for MS Windows environment
102 AC_CHECK_HEADER(windows.h)
104 dnl Determine an extra directories to add to include/lib search paths
106 *-apple-darwin* | *-*-mingw32*)
107 echo no EXTRA_DIRS for $host
111 if test -d /usr/local ; then
112 EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
117 if test -d /usr/X11R6 ; then
118 EXTRA_DIR1="/usr/X11R6"
120 if test -d /opt/X11R6 ; then
121 EXTRA_DIR2="/opt/X11R6"
123 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2 /usr/local/"
127 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
130 dnl Using AM_CONDITIONAL is a step out of the protected little
131 dnl automake fold so it is potentially dangerous. But, we are
132 dnl beginning to run into cases where the standard checks are not
133 dnl enough. AM_CONDITIONALS are then referenced to conditionally
134 dnl build a Makefile.in from a Makefile.am which lets us define custom
135 dnl includes, compile alternative source files, etc.
137 dnl Check for external variables daylight and timezone.
139 if test "$have_daylight" = yes; then
140 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
144 if test "$have_timezone" = yes; then
145 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
148 dnl add correct audio libs and configure for audio support
149 audio_LIBS="-lplibsl -lplibsm"
151 *-*-cygwin* | *-*-mingw32*)
152 audio_LIBS="$audio_LIBS -lwinmm"
155 audio_LIBS="$audio_LIBS -framework IOKit -framework CoreFoundation"
158 audio_LIBS="$audio_LIBS -laudio"
164 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
165 dnl just assuming we have audio support on all platform. We can
166 dnl depend on plib to hide the details.
167 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
169 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
170 dnl to use it if it is.
172 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
173 echo no fancy X11 check
182 dnl Checks for libraries.
184 dnl Thread related checks
185 AC_CHECK_LIB(pthread, pthread_exit)
186 if test "x$ac_cv_lib_pthread_pthread_exit" != "xyes" \
187 -a "x$ac_cv_header_pthread_h" = "xyes"; then
188 dnl FreeBSD: System has pthread.h, but -lpthread library check
189 dnl fails. See if we need -pthread instead of -lpthread and look
190 dnl for the functions in libc_r.
191 save_CXXFLAGS="$CXXFLAGS"
192 save_CFLAGS="$CFLAGS"
193 CXXFLAGS="-pthread $CXXFLAGS"
194 CFLAGS="-pthread $CFLAGS"
196 AC_CHECK_LIB(c_r, pthread_exit)
197 if test "x$ac_cv_lib_c_r_pthread_exit" != "xyes"; then
198 CXXFLAGS=$save_CXXFLAGS
207 dnl search for network related libraries
208 AC_SEARCH_LIBS(inet_addr, xnet)
209 AC_SEARCH_LIBS(socket, socket)
210 AC_SEARCH_LIBS(main, nsl)
215 dnl check for some default libraries
216 AC_SEARCH_LIBS(cos, m)
217 AC_SEARCH_LIBS(dlclose, dl)
221 dnl Check for SDL if enabled.
222 AC_ARG_ENABLE(sdl, [ --enable-sdl Configure to use SDL instead of GLUT], enable_sdl="yes", enable_sdl="")
223 AM_CONDITIONAL(USE_SDL, test "x$enable_sdl" = "xyes")
224 if test "x$enable_sdl" = "xyes"; then
225 AC_DEFINE([PU_USE_SDL], 1, [Define to use SDL])
227 AC_DEFINE([PU_USE_GLUT], 1, [Define to use glut])
230 dnl check for glut location
231 AC_CHECK_HEADER(GL/glut.h)
232 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
233 AC_DEFINE([FG_GLUT_H], <GL/glut.h>, [Define as glut.h include location])
235 AC_CHECK_HEADER(GLUT/glut.h)
236 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
237 AC_DEFINE([FG_GLUT_H], <GLUT/glut.h>, [Define as glut.h include location])
239 if test "x$enable_sdl" != "xyes"; then
240 echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue"
246 dnl check for OpenGL related libraries
248 *-*-cygwin* | *-*-mingw32*)
249 dnl CygWin under Windoze.
251 echo Win32 specific hacks...
252 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
253 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
255 if test "x$enable_sdl" = "xyes"; then
256 AC_SEARCH_LIBS(SDL_Init, SDL)
258 LIBS="$LIBS -lglut32"
261 LIBS="$LIBS -lglu32 -lopengl32 -luser32 -lgdi32"
263 dnl add -lwsock32 for mingwin
266 echo "********** BUILDING FOR MINGW32 *************"
267 base_LIBS="$base_LIBS -lws2_32"
271 echo "Will link apps with $LIBS"
278 LIBS="$LIBS -framework GLUT -framework OpenGL -framework AGL -framework Carbon -lobjc"
282 dnl X-Windows based machines
284 dnl Skip X11 library tests if requested.
285 if test "x$no_x" != "xyes"; then
286 AC_SEARCH_LIBS(XCreateWindow, X11)
287 AC_SEARCH_LIBS(XShmCreateImage, Xext)
288 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
289 AC_SEARCH_LIBS(IceOpenConnection, ICE)
290 AC_SEARCH_LIBS(SmcOpenConnection, SM)
291 AC_SEARCH_LIBS(XtMalloc, Xt)
292 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
295 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
296 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
297 dnl if GLcore found, then also check for GL
298 AC_SEARCH_LIBS(glXCreateContext, GL)
301 dnl if using mesa, check for xmesa.h
302 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
303 AC_CHECK_HEADER(GL/fxmesa.h)
304 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
305 AC_DEFINE([XMESA], 1, [Define for fxmesa])
306 AC_DEFINE([FX], 1, [Define for fxmesa])
310 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
311 AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
312 if test "x$enable_sdl" = "xyes"; then
313 AC_SEARCH_LIBS(SDL_Init, SDL)
322 dnl check for OpenAL libraries
324 *-*-cygwin* | *-*-mingw32*)
325 dnl CygWin under Windoze.
327 AC_SEARCH_LIBS(alGenBuffers, openal32)
328 AC_SEARCH_LIBS(alutInit, [ openal32 ALut ] )
329 LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
335 LIBS="$LIBS -framework IOKit -framework OpenAL"
339 dnl default unix style machines
341 AC_SEARCH_LIBS(alGenBuffers, openal)
350 AC_SUBST(openal_LIBS)
351 AC_SUBST(opengl_LIBS)
352 AC_SUBST(thread_LIBS)
353 AC_SUBST(network_LIBS)
355 # The following are C++ items that need to be tested for with the c++
360 # Check for "plib" without which we cannot go on
361 AC_CHECK_HEADER(plib/ul.h)
362 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
364 echo "You *must* have the plib library installed on your system to build"
365 echo "the FGFS simulator!"
367 echo "Please see README.plib for more details."
369 echo "configure aborted."
373 AC_MSG_CHECKING([for plib 1.8.0 or newer])
377 #define MIN_PLIB_VERSION 170
380 int major, minor, micro;
382 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
391 [AC_MSG_RESULT(wrong version);
392 AC_MSG_ERROR([Install plib 1.8.0 or later first...])],
396 dnl If we get here then plib is available, so force use of plib
398 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
401 dnl Check for the presence of SimGear
402 AC_CHECK_HEADER(simgear/version.h)
403 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
405 echo "You *must* have the SimGear support library installed on your system"
406 echo "to build the FGFS simulator!"
408 echo "Please see README.SimGear for more details."
410 echo "configure aborted."
414 AC_MSG_CHECKING([for simgear 0.3.6 or newer])
418 #include <simgear/version.h>
420 #define STRINGIFY(X) XSTRINGIFY(X)
421 #define XSTRINGIFY(X) #X
428 int major, minor, micro;
430 /* printf("%d.%d.%d or greater, ", MIN_MAJOR, MIN_MINOR, MIN_MICRO); */
431 printf("[found %s] ... ", STRINGIFY(SIMGEAR_VERSION));
433 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
435 if ( (major < MIN_MAJOR) ||
436 (major == MIN_MAJOR && minor < MIN_MINOR) ||
437 (major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO) ) {
446 [AC_MSG_RESULT(wrong version);
447 AC_MSG_ERROR([Install latest simgear first...])],
453 dnl Check if SimGear was built with Norman's JPEG factory support
454 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
455 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
456 AC_CHECK_LIB(jpeg, jpeg_start_compress)
457 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
459 echo "The JPEG factory code was built and installed with SimGear."
460 echo "However it appears the libjpeg is no longer installed."
461 echo "You need to install libjpeg or remove jpgfactory support from"
464 echo "libjpeg is available at :"
465 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
468 AC_DEFINE([FG_JPEG_SERVER], 1,
469 [Define to build with jpeg screen shot server])
471 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
475 dnl Check for system installed zlib
476 AC_CHECK_HEADER(zlib.h)
477 if test "x$ac_cv_header_zlib_h" != "xyes"; then
479 echo "zlib library not found."
481 echo "If your OS does not provide an installable package for zlib"
482 echo "you will have to compile and install it first yourself. A copy"
483 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
484 echo "have to untar this source code, and follow it's included instructions"
485 echo "to compile and install on your system."
487 echo "configure aborted."
491 dnl Checks for header files.
494 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
495 sys/time.h sys/timeb.h unistd.h windows.h values.h )
497 dnl Checks for typedefs, structures, and compiler characteristics.
503 dnl Checks for library functions.
505 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
509 ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
510 random drand48 setitimer getitimer signal GetLocalTime rint getrusage \
514 AM_CONFIG_HEADER(src/Include/config.h)
526 scripts/debug/Makefile \
527 scripts/perl/Makefile \
528 scripts/perl/examples/Makefile \
529 scripts/python/Makefile \
531 src/Include/Makefile \
532 src/Include/version.h \
533 src/Aircraft/Makefile \
534 src/Airports/Makefile \
536 src/Autopilot/Makefile \
537 src/Cockpit/Makefile \
538 src/Cockpit/built_in/Makefile \
539 src/Controls/Makefile \
540 src/Environment/Makefile \
541 src/FDM/Balloon/Makefile \
542 src/FDM/ExternalNet/Makefile \
543 src/FDM/ExternalPipe/Makefile \
544 src/FDM/JSBSim/Makefile \
545 src/FDM/JSBSim/filtersjb/Makefile \
546 src/FDM/LaRCsim/Makefile \
547 src/FDM/UIUCModel/Makefile \
548 src/FDM/YASim/Makefile \
552 src/Instrumentation/Makefile \
555 src/Main/runfgfs.bat \
557 src/AIModel/Makefile \
558 src/MultiPlayer/Makefile \
559 src/Navaids/Makefile \
560 src/Network/Makefile \
561 src/Objects/Makefile \
562 src/Replay/Makefile \
563 src/Scenery/Makefile \
564 src/Scripting/Makefile \
566 src/Systems/Makefile \
568 src/Traffic/Makefile \
571 utils/TerraSync/Makefile \
572 utils/Modeller/Makefile \
573 utils/js_server/Makefile \
577 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
580 echo "Configure Summary"
581 echo "================="
583 echo "Prefix: $prefix"
585 if test "x$with_logging" != "x"; then
586 echo "Debug messages: $with_logging"
588 echo "Debug messages: yes"
591 echo -n "Automake version: "
592 automake --version | head -1
594 if test "x$with_multiplayer" != "xno"; then
595 echo "Building with multiplayer support"
598 if test "x$with_threads" = "xyes"; then