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"
166 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
168 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
169 dnl to use it if it is.
171 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
172 echo no fancy X11 check
181 dnl Checks for libraries.
189 dnl Thread related checks
190 AC_CHECK_LIB(pthread, pthread_exit)
191 AC_CHECK_LIB(socket, socket)
193 dnl check for glut location
194 AC_CHECK_HEADER(GL/glut.h)
195 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
196 AC_DEFINE([GLUT_H], "GL/glut.h", [Define as glut.h include location])
198 AC_CHECK_HEADER(GLUT/glut.h)
199 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
200 AC_DEFINE([GLUT_H], "GLUT/glut.h", [Define as glut.h include location])
202 echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue"
207 dnl check for OpenGL related libraries
209 *-*-cygwin* | *-*-mingw32*)
210 dnl CygWin under Windoze.
212 echo Win32 specific hacks...
213 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
214 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
216 LIBS="$LIBS -lglut32 -lglu32 -lopengl32"
217 LIBS="$LIBS -luser32 -lgdi32"
219 dnl add -lwsock32 for mingwin
222 echo "********** BUILDING FOR MINGW32 *************"
223 base_LIBS="$base_LIBS -lws2_32"
227 echo "Will link apps with $LIBS"
234 LIBS="$LIBS -framework GLUT -framework OpenGL -framework Carbon -lobjc"
238 dnl X-Windows based machines
240 dnl Skip X11 library tests if requested.
241 if test "x$no_x" != "xyes"; then
242 AC_CHECK_LIB(X11, XCreateWindow)
243 AC_CHECK_LIB(Xext, XShmCreateImage)
244 AC_CHECK_LIB(Xi, XGetExtensionVersion)
245 AC_CHECK_LIB(ICE, IceOpenConnection)
246 AC_CHECK_LIB(SM, SmcOpenConnection)
247 AC_CHECK_LIB(Xt, XtMalloc)
248 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
251 AC_CHECK_LIB(GLcore, glNewList)
252 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
253 dnl if no GLcore, check for GL
254 AC_CHECK_LIB(GL, glNewList)
255 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
256 dnl if no GL, check for MesaGL
257 AC_CHECK_LIB(MesaGL, glNewList)
260 dnl if GLcore found, then also check for GL
261 AC_CHECK_LIB(GL, glXCreateContext)
264 dnl if using mesa, check for xmesa.h
265 if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
266 AC_CHECK_HEADER(GL/fxmesa.h)
267 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
268 AC_DEFINE([XMESA], 1, [Define for fxmesa])
269 AC_DEFINE([FX], 1, [Define for fxmesa])
273 AC_CHECK_LIB(GLU, gluLookAt)
274 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
275 dnl if no GLU, check for MesaGLU
276 AC_CHECK_LIB(MesaGLU, gluLookAt)
279 AC_CHECK_LIB(glut, glutGetModifiers)
280 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno" ; then
281 dnl if no "real" glut, check for freeglut
282 AC_CHECK_LIB(freeglut, glutGetModifiers)
292 AC_SUBST(opengl_LIBS)
294 # The following are C++ items that need to be tested for with the c++
299 # Check for "plib" without which we cannot go on
300 AC_CHECK_HEADER(plib/ul.h)
301 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
303 echo "You *must* have the plib library installed on your system to build"
304 echo "the FGFS simulator!"
306 echo "Please see README.plib for more details."
308 echo "configure aborted."
312 AC_MSG_CHECKING([for plib 1.6.0 or newer])
316 #define MIN_PLIB_VERSION 160
319 int major, minor, micro;
321 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
330 [AC_MSG_RESULT(wrong version);
331 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
335 dnl If we get here then plib is available, so force use of plib
337 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
338 AC_DEFINE([FG_PLIB_JOYSTICK_GETNAME], 1,
339 [Define to enable plib joystick name support])
341 dnl Check for MetaKit
342 AC_CHECK_HEADER(mk4.h)
343 if test "x$ac_cv_header_mk4_h" != "xyes"; then
345 echo "MetaKit library not found."
347 echo "If your OS does not provide an installable package for MetaKit"
348 echo "you will have to compile and install it first yourself. A copy"
349 echo "of metakit-$(VERSION).tar.gz is included with SimGear. You will"
350 echo "have to untar this source code, and follow it's included instructions"
351 echo "to compile and install on your system."
353 echo "configure aborted."
357 AC_MSG_CHECKING([for metakit 2.4.3 or newer])
359 LIBS="$saved_LIBS -lmk4"
363 #define MIN_MK4_VERSION 243
366 int major, minor, micro;
368 if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
377 [AC_MSG_RESULT(wrong version);
380 Install metakit 2.4.3 or later first.
382 Or, the compiler may not be finding your libmk4.so library.
383 Please check the config.log file for specific details of the
384 failure if you believe you have the correct metakit version.
385 Also, look up this issue in the FlightGear FAQ.])],
389 dnl Check for the presence of SimGear
390 AC_CHECK_HEADER(simgear/version.h)
391 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
393 echo "You *must* have the SimGear support library installed on your system"
394 echo "to build the FGFS simulator!"
396 echo "Please see README.SimGear for more details."
398 echo "configure aborted."
402 AC_MSG_CHECKING([for simgear 0.3.0 or newer])
406 #include <simgear/version.h>
408 #define STRINGIFY(X) XSTRINGIFY(X)
409 #define XSTRINGIFY(X) #X
416 int major, minor, micro;
418 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
420 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
422 if ( major < MIN_MAJOR ) {
424 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
426 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
435 [AC_MSG_RESULT(wrong version);
436 AC_MSG_ERROR([Install latest simgear first...])],
442 dnl Check if SimGear was built with Norman JPEG factory support
443 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 winbase.h values.h )
486 dnl Checks for typedefs, structures, and compiler characteristics.
492 dnl Checks for library functions.
496 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
497 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
499 AM_CONFIG_HEADER(src/Include/config.h)
511 scripts/debug/Makefile \
512 scripts/python/Makefile \
514 src/Include/Makefile \
515 src/Include/version.h \
516 src/Aircraft/Makefile \
517 src/Airports/Makefile \
519 src/Autopilot/Makefile \
520 src/Cockpit/Makefile \
521 src/Cockpit/built_in/Makefile \
522 src/Controls/Makefile \
523 src/Environment/Makefile \
524 src/FDM/Balloon/Makefile \
525 src/FDM/ExternalNet/Makefile \
526 src/FDM/JSBSim/Makefile \
527 src/FDM/JSBSim/filtersjb/Makefile \
528 src/FDM/LaRCsim/Makefile \
529 src/FDM/UIUCModel/Makefile \
530 src/FDM/YASim/Makefile \
534 src/Instrumentation/Makefile \
537 src/Main/runfgfs.bat \
539 src/Navaids/Makefile \
540 src/Network/Makefile \
541 src/NetworkOLK/Makefile \
542 src/Objects/Makefile \
543 src/Scenery/Makefile \
545 src/Systems/Makefile \
547 src/WeatherCM/Makefile \
550 utils/TerraSync/Makefile \
554 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
557 echo "Configure Summary"
558 echo "================="
560 echo "Prefix: $prefix"
562 if test "x$with_logging" != "x"; then
563 echo "Debug messages: $with_logging"
565 echo "Debug messages: yes"
568 echo -n "Automake version: "
569 automake --version | head -1
571 echo "New plib joystick name support: $plib_js_has_getname"
573 if test "x$with_weathercm" != "x"; then
574 echo "WeatherCM instead of FGEnvironment: $with_weathercm"
576 echo "Using FGEnvironment"
579 if test "x$with_threads" = "xyes"; then