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 AM_INIT_AUTOMAKE(FlightGear, 0.9.1)
15 dnl Checks for programs.
24 dnl set the $host variable based on local machine/os
29 if test "$CXX" = "CC"; then
45 dnl set logging; default value of with_logging=yes
46 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
47 if test "x$with_logging" = "xno" ; then
48 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
51 # Specify if we want to build with Oliver's networking support
52 # default to with_network=yes
53 AC_ARG_WITH(network_olk, [ --with-network-olk Include Oliver's multi-pilot networking support])
54 if test "x$with_network_olk" = "xno" ; then
55 echo "Building without Oliver's multi-pilot network support"
57 echo "Building with Oliver's multi-pilot network support"
58 AC_DEFINE([FG_NETWORK_OLK], 1, [Define to build with Oliver's networking])
60 AM_CONDITIONAL(ENABLE_NETWORK_OLK, test "x$with_network_olk" != "xno")
63 # Specify if we want to use WeatherCM instead of FGEnvironment.
64 # default to with_weathercm=no
65 AC_ARG_WITH(new-environment, [ --with-weathercm Use WeatherCM instead of FGEnvironment])
66 if test "x$with_weathercm" = "xyes" ; then
67 echo "Building with WeatherCM"
68 AC_DEFINE([FG_WEATHERCM], 1,
69 [Define to build with Christian Mayer's weather code])
71 echo "Building with FGEnvironment"
73 AM_CONDITIONAL(ENABLE_WEATHERCM, test "x$with_weathercm" = "xyes")
75 dnl Thread related checks
76 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=no]])
77 if test "x$with_threads" = "xyes"; then
78 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
79 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
80 CFLAGS="$CFLAGS -D_REENTRANT"
81 AC_CHECK_HEADER(pthread.h)
83 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
85 # specify the plib location
86 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
88 if test "x$with_plib" != "x" ; then
89 echo "plib prefix is $with_plib"
90 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
93 # specify the metakit location
94 AC_ARG_WITH(metakit, [ --with-metakit=PREFIX Specify the prefix path to metakit])
96 if test "x$with_metakit" != "x" ; then
97 echo "metakit prefix is $with_metakit"
98 EXTRA_DIRS="${EXTRA_DIRS} $with_metakit"
101 # specify the simgear location
102 AC_ARG_WITH(simgear, [ --with-simgear=PREFIX Specify the prefix path to simgear])
104 if test "x$with_simgear" != "x" ; then
105 echo "SimGear prefix path is $with_simgear"
106 EXTRA_DIRS="${EXTRA_DIRS} $with_simgear"
109 dnl Used by JSBSim to conditionally compile in fgfs interface code
110 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
112 # Check for MS Windows environment
113 AC_CHECK_HEADER(windows.h)
115 dnl Determine an extra directories to add to include/lib search paths
117 *-apple-darwin* | *-*-mingw32*)
118 echo no EXTRA_DIRS for $host
122 if test -d /usr/X11R6 ; then
123 EXTRA_DIR1="/usr/X11R6"
125 if test -d /opt/X11R6 ; then
126 EXTRA_DIR2="/opt/X11R6"
128 EXTRA_DIRS="$EXTRA_DIR1 $EXTRA_DIR2"
132 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
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])
153 dnl add correct audio libs and configure for audio support
154 audio_LIBS="-lplibsl -lplibsm"
156 *-*-cygwin* | *-*-mingw32*)
157 audio_LIBS="$audio_LIBS -lwinmm"
161 audio_LIBS="$audio_LIBS -laudio"
167 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
168 dnl just assuming we have audio support on all platform. We can
169 dnl depend on plib to hide the details.
170 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
172 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
173 dnl to use it if it is.
175 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
176 echo no fancy X11 check
185 dnl Checks for libraries.
193 dnl Thread related checks
194 AC_CHECK_LIB(pthread, pthread_exit)
195 AC_CHECK_LIB(socket, socket)
197 dnl check for glut location
198 AC_CHECK_HEADER(GL/glut.h)
199 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
200 AC_DEFINE([GLUT_H], "GL/glut.h", [Define as glut.h include location])
202 AC_CHECK_HEADER(GLUT/glut.h)
203 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
204 AC_DEFINE([GLUT_H], "GLUT/glut.h", [Define as glut.h include location])
206 echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue"
211 dnl check for OpenGL related libraries
213 *-*-cygwin* | *-*-mingw32*)
214 dnl CygWin under Windoze.
216 echo Win32 specific hacks...
217 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
218 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
220 LIBS="$LIBS -lglut32 -lglu32 -lopengl32"
221 LIBS="$LIBS -luser32 -lgdi32"
223 dnl add -lwsock32 for mingwin
226 echo "********** BUILDING FOR MINGW32 *************"
227 base_LIBS="$base_LIBS -lws2_32"
231 echo "Will link apps with $LIBS"
238 LIBS="$LIBS -framework GLUT -framework OpenGL -framework Carbon -lobjc"
242 dnl X-Windows based machines
244 dnl Skip X11 library tests if requested.
245 if test "x$no_x" != "xyes"; then
246 AC_CHECK_LIB(X11, XCreateWindow)
247 AC_CHECK_LIB(Xext, XShmCreateImage)
248 AC_CHECK_LIB(Xi, XGetExtensionVersion)
249 AC_CHECK_LIB(ICE, IceOpenConnection)
250 AC_CHECK_LIB(SM, SmcOpenConnection)
251 AC_CHECK_LIB(Xt, XtMalloc)
252 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
255 AC_CHECK_LIB(GLcore, glNewList)
256 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
257 dnl if no GLcore, check for GL
258 AC_CHECK_LIB(GL, glNewList)
259 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
260 dnl if no GL, check for MesaGL
261 AC_CHECK_LIB(MesaGL, glNewList)
264 dnl if GLcore found, then also check for GL
265 AC_CHECK_LIB(GL, glXCreateContext)
268 dnl if using mesa, check for xmesa.h
269 if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
270 AC_CHECK_HEADER(GL/fxmesa.h)
271 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
272 AC_DEFINE([XMESA], 1, [Define for fxmesa])
273 AC_DEFINE([FX], 1, [Define for fxmesa])
277 AC_CHECK_LIB(GLU, gluLookAt)
278 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
279 dnl if no GLU, check for MesaGLU
280 AC_CHECK_LIB(MesaGLU, gluLookAt)
283 AC_CHECK_LIB(glut, glutGetModifiers)
284 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno" ; then
285 dnl if no "real" glut, check for freeglut
286 AC_CHECK_LIB(freeglut, glutGetModifiers)
296 AC_SUBST(opengl_LIBS)
298 # The following are C++ items that need to be tested for with the c++
303 # Check for "plib" without which we cannot go on
304 AC_CHECK_HEADER(plib/ul.h)
305 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
307 echo "You *must* have the plib library installed on your system to build"
308 echo "the FGFS simulator!"
310 echo "Please see README.plib for more details."
312 echo "configure aborted."
316 AC_MSG_CHECKING([for plib 1.6.0 or newer])
320 #define MIN_PLIB_VERSION 160
323 int major, minor, micro;
325 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
334 [AC_MSG_RESULT(wrong version);
335 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
339 dnl If we get here then plib is available, so force use of plib
341 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
342 AC_DEFINE([FG_PLIB_JOYSTICK_GETNAME], 1,
343 [Define to enable plib joystick name support])
345 dnl Check for MetaKit
346 AC_CHECK_HEADER(mk4.h)
347 if test "x$ac_cv_header_mk4_h" != "xyes"; then
349 echo "MetaKit library not found."
351 echo "If your OS does not provide an installable package for MetaKit"
352 echo "you will have to compile and install it first yourself. A copy"
353 echo "of metakit-$(VERSION).tar.gz is included with SimGear. You will"
354 echo "have to untar this source code, and follow it's included instructions"
355 echo "to compile and install on your system."
357 echo "configure aborted."
361 AC_MSG_CHECKING([for metakit 2.4.3 or newer])
363 LIBS="$saved_LIBS -lmk4"
367 #define MIN_MK4_VERSION 243
370 int major, minor, micro;
372 if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
381 [AC_MSG_RESULT(wrong version);
384 Install metakit 2.4.3 or later first.
386 Or, the compiler may not be finding your libmk4.so library.
387 Please check the config.log file for specific details of the
388 failure if you believe you have the correct metakit version.
389 Also, look up this issue in the FlightGear FAQ.])],
393 dnl Check for the presence of SimGear
394 AC_CHECK_HEADER(simgear/version.h)
395 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
397 echo "You *must* have the SimGear support library installed on your system"
398 echo "to build the FGFS simulator!"
400 echo "Please see README.SimGear for more details."
402 echo "configure aborted."
406 AC_MSG_CHECKING([for simgear 0.3.0 or newer])
410 #include <simgear/version.h>
412 #define STRINGIFY(X) XSTRINGIFY(X)
413 #define XSTRINGIFY(X) #X
420 int major, minor, micro;
422 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
424 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
426 if ( major < MIN_MAJOR ) {
428 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
430 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
439 [AC_MSG_RESULT(wrong version);
440 AC_MSG_ERROR([Install latest simgear first...])],
446 dnl Check if SimGear was built with Norman JPEG factory support
447 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
448 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
449 AC_CHECK_LIB(jpeg, jpeg_start_compress)
450 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
452 echo "The JPEG factory code was built and installed with SimGear."
453 echo "However it appears the libjpeg is no longer installed."
454 echo "You need to install libjpeg or remove jpgfactory support from"
457 echo "libjpeg is available at :"
458 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
461 AC_DEFINE([FG_JPEG_SERVER], 1,
462 [Define to build with jpeg screen shot server])
464 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
468 dnl Check for system installed zlib
469 AC_CHECK_HEADER(zlib.h)
470 if test "x$ac_cv_header_zlib_h" != "xyes"; then
472 echo "zlib library not found."
474 echo "If your OS does not provide an installable package for zlib"
475 echo "you will have to compile and install it first yourself. A copy"
476 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
477 echo "have to untar this source code, and follow it's included instructions"
478 echo "to compile and install on your system."
480 echo "configure aborted."
484 dnl Checks for header files.
487 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
488 sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
490 dnl Checks for typedefs, structures, and compiler characteristics.
496 dnl Checks for library functions.
500 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
501 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
503 AM_CONFIG_HEADER(src/Include/config.h)
515 scripts/debug/Makefile \
516 scripts/python/Makefile \
518 src/Include/Makefile \
519 src/Include/version.h \
520 src/Aircraft/Makefile \
521 src/Airports/Makefile \
523 src/Autopilot/Makefile \
524 src/Cockpit/Makefile \
525 src/Cockpit/built_in/Makefile \
526 src/Controls/Makefile \
527 src/Environment/Makefile \
528 src/FDM/Balloon/Makefile \
529 src/FDM/ExternalNet/Makefile \
530 src/FDM/JSBSim/Makefile \
531 src/FDM/JSBSim/filtersjb/Makefile \
532 src/FDM/LaRCsim/Makefile \
533 src/FDM/UIUCModel/Makefile \
534 src/FDM/YASim/Makefile \
538 src/Instrumentation/Makefile \
541 src/Main/runfgfs.bat \
543 src/Navaids/Makefile \
544 src/Network/Makefile \
545 src/NetworkOLK/Makefile \
546 src/Objects/Makefile \
547 src/Scenery/Makefile \
549 src/Systems/Makefile \
551 src/WeatherCM/Makefile \
554 utils/TerraSync/Makefile \
558 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
561 echo "Configure Summary"
562 echo "================="
564 echo "Prefix: $prefix"
566 if test "x$with_logging" != "x"; then
567 echo "Debug messages: $with_logging"
569 echo "Debug messages: yes"
572 echo -n "Automake version: "
573 automake --version | head -1
575 echo "New plib joystick name support: $plib_js_has_getname"
577 if test "x$with_weathercm" != "x"; then
578 echo "WeatherCM instead of FGEnvironment: $with_weathercm"
580 echo "Using FGEnvironment"
583 if test "x$with_threads" = "xyes"; then