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 # 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"
32 dnl set the $host variable based on local machine/os
37 if test "$CXX" = "CC"; then
40 CXXFLAGS="$CXXFLAGS -I$with_simgear/include/simgear/compatibility"
54 dnl set logging; default value of with_logging=yes
55 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
56 if test "x$with_logging" = "xno" ; then
57 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
60 # Specify if we want to build with Oliver's networking support
61 # default to with_network=yes
62 AC_ARG_WITH(network_olk, [ --with-network-olk Include Oliver's multi-pilot networking support])
63 if test "x$with_network_olk" = "xno" ; then
64 echo "Building without Oliver's multi-pilot network support"
66 echo "Building with Oliver's multi-pilot network support"
67 AC_DEFINE([FG_NETWORK_OLK], 1, [Define to build with Oliver's networking])
69 AM_CONDITIONAL(ENABLE_NETWORK_OLK, test "x$with_network_olk" != "xno")
72 # Specify if we want to use WeatherCM instead of FGEnvironment.
73 # default to with_weathercm=no
74 AC_ARG_WITH(new-environment, [ --with-weathercm Use WeatherCM instead of FGEnvironment])
75 if test "x$with_weathercm" = "xyes" ; then
76 echo "Building with WeatherCM"
77 AC_DEFINE([FG_WEATHERCM], 1,
78 [Define to build with Christian Mayer's weather code])
80 echo "Building with FGEnvironment"
82 AM_CONDITIONAL(ENABLE_WEATHERCM, test "x$with_weathercm" = "xyes")
84 dnl Thread related checks
85 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=no]])
86 if test "x$with_threads" = "xyes"; then
87 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
88 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
89 CFLAGS="$CFLAGS -D_REENTRANT"
90 AC_CHECK_HEADER(pthread.h)
92 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
94 # specify the plib location
95 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
97 if test "x$with_plib" != "x" ; then
98 echo "plib prefix is $with_plib"
99 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
102 # specify the metakit location
103 AC_ARG_WITH(metakit, [ --with-metakit=PREFIX Specify the prefix path to metakit])
105 if test "x$with_metakit" != "x" ; then
106 echo "metakit prefix is $with_metakit"
107 EXTRA_DIRS="${EXTRA_DIRS} $with_metakit"
110 dnl Used by JSBSim to conditionally compile in fgfs interface code
111 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
113 # Check for MS Windows environment
114 AC_CHECK_HEADER(windows.h)
116 dnl Determine an extra directories to add to include/lib search paths
118 *-apple-darwin* | *-*-mingw32*)
119 echo no EXTRA_DIRS for $host
123 if test -d /usr/X11R6 ; then
124 EXTRA_DIR1="/usr/X11R6"
126 if test -d /opt/X11R6 ; then
127 EXTRA_DIR2="/opt/X11R6"
129 EXTRA_DIRS="$EXTRA_DIR1 $EXTRA_DIR2"
133 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
136 dnl Using AM_CONDITIONAL is a step out of the protected little
137 dnl automake fold so it is potentially dangerous. But, we are
138 dnl beginning to run into cases where the standard checks are not
139 dnl enough. AM_CONDITIONALS are then referenced to conditionally
140 dnl build a Makefile.in from a Makefile.am which lets us define custom
141 dnl includes, compile alternative source files, etc.
143 dnl Check for external variables daylight and timezone.
145 if test "$have_daylight" = yes; then
146 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
150 if test "$have_timezone" = yes; then
151 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
154 dnl add correct audio libs and configure for audio support
155 audio_LIBS="-lplibsl -lplibsm"
157 *-*-cygwin* | *-*-mingw32*)
158 audio_LIBS="$audio_LIBS -lwinmm"
162 audio_LIBS="$audio_LIBS -laudio"
168 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
169 dnl just assuming we have audio support on all platform. We can
170 dnl depend on plib to hide the details.
171 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
173 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
174 dnl to use it if it is.
176 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
177 echo no fancy X11 check
186 dnl Checks for libraries.
194 dnl Thread related checks
195 AC_CHECK_LIB(pthread, pthread_exit)
196 AC_CHECK_LIB(socket, socket)
198 dnl check for glut location
199 AC_CHECK_HEADER(GL/glut.h)
200 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
201 AC_DEFINE([GLUT_H], "GL/glut.h", [Define as glut.h include location])
203 AC_CHECK_HEADER(GLUT/glut.h)
204 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
205 AC_DEFINE([GLUT_H], "GLUT/glut.h", [Define as glut.h include location])
207 echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue"
212 dnl check for OpenGL related libraries
214 *-*-cygwin* | *-*-mingw32*)
215 dnl CygWin under Windoze.
217 echo Win32 specific hacks...
218 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
219 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
221 LIBS="$LIBS -lglut32 -lglu32 -lopengl32"
222 LIBS="$LIBS -luser32 -lgdi32"
224 dnl add -lwsock32 for mingwin
227 echo "********** BUILDING FOR MINGW32 *************"
228 base_LIBS="$base_LIBS -lws2_32"
232 echo "Will link apps with $LIBS"
239 LIBS="$LIBS -framework GLUT -framework OpenGL -framework Carbon -lobjc"
243 dnl X-Windows based machines
245 dnl Skip X11 library tests if requested.
246 if test "x$no_x" != "xyes"; then
247 AC_CHECK_LIB(X11, XCreateWindow)
248 AC_CHECK_LIB(Xext, XShmCreateImage)
249 AC_CHECK_LIB(Xi, XGetExtensionVersion)
250 AC_CHECK_LIB(ICE, IceOpenConnection)
251 AC_CHECK_LIB(SM, SmcOpenConnection)
252 AC_CHECK_LIB(Xt, XtMalloc)
253 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
256 AC_CHECK_LIB(GLcore, glNewList)
257 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
258 dnl if no GLcore, check for GL
259 AC_CHECK_LIB(GL, glNewList)
260 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
261 dnl if no GL, check for MesaGL
262 AC_CHECK_LIB(MesaGL, glNewList)
265 dnl if GLcore found, then also check for GL
266 AC_CHECK_LIB(GL, glXCreateContext)
269 dnl if using mesa, check for xmesa.h
270 if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
271 AC_CHECK_HEADER(GL/fxmesa.h)
272 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
273 AC_DEFINE([XMESA], 1, [Define for fxmesa])
274 AC_DEFINE([FX], 1, [Define for fxmesa])
278 AC_CHECK_LIB(GLU, gluLookAt)
279 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
280 dnl if no GLU, check for MesaGLU
281 AC_CHECK_LIB(MesaGLU, gluLookAt)
284 AC_CHECK_LIB(glut, glutGetModifiers)
285 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno" ; then
286 dnl if no "real" glut, check for freeglut
287 AC_CHECK_LIB(freeglut, glutGetModifiers)
297 AC_SUBST(opengl_LIBS)
299 # The following are C++ items that need to be tested for with the c++
304 # Check for "plib" without which we cannot go on
305 AC_CHECK_HEADER(plib/ul.h)
306 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
308 echo "You *must* have the plib library installed on your system to build"
309 echo "the FGFS simulator!"
311 echo "Please see README.plib for more details."
313 echo "configure aborted."
317 AC_MSG_CHECKING([for plib 1.6.0 or newer])
321 #define MIN_PLIB_VERSION 160
324 int major, minor, micro;
326 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
335 [AC_MSG_RESULT(wrong version);
336 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
340 dnl If we get here then plib is available, so force use of plib
342 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
343 AC_DEFINE([FG_PLIB_JOYSTICK_GETNAME], 1,
344 [Define to enable plib joystick name support])
346 dnl Check for MetaKit
347 AC_CHECK_HEADER(mk4.h)
348 if test "x$ac_cv_header_mk4_h" != "xyes"; then
350 echo "MetaKit library not found."
352 echo "If your OS does not provide an installable package for MetaKit"
353 echo "you will have to compile and install it first yourself. A copy"
354 echo "of metakit-$(VERSION).tar.gz is included with SimGear. You will"
355 echo "have to untar this source code, and follow it's included instructions"
356 echo "to compile and install on your system."
358 echo "configure aborted."
362 AC_MSG_CHECKING([for metakit 2.4.3 or newer])
364 LIBS="$saved_LIBS -lmk4"
368 #define MIN_MK4_VERSION 243
371 int major, minor, micro;
373 if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
382 [AC_MSG_RESULT(wrong version);
385 Install metakit 2.4.3 or later first.
387 Or, the compiler may not be finding your libmk4.so library.
388 Please check the config.log file for specific details of the
389 failure if you believe you have the correct metakit version.
390 Also, look up this issue in the FlightGear FAQ.])],
394 dnl Check for the presence of SimGear
395 AC_CHECK_HEADER(simgear/version.h)
396 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
398 echo "You *must* have the SimGear support library installed on your system"
399 echo "to build the FGFS simulator!"
401 echo "Please see README.SimGear for more details."
403 echo "configure aborted."
407 AC_MSG_CHECKING([for simgear 0.3.0 or newer])
411 #include <simgear/version.h>
413 #define STRINGIFY(X) XSTRINGIFY(X)
414 #define XSTRINGIFY(X) #X
421 int major, minor, micro;
423 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
425 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
427 if ( major < MIN_MAJOR ) {
429 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
431 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
440 [AC_MSG_RESULT(wrong version);
441 AC_MSG_ERROR([Install latest simgear first...])],
447 dnl Check if SimGear was built with Norman JPEG factory support
448 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
449 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
450 AC_CHECK_LIB(jpeg, jpeg_start_compress)
451 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
453 echo "The JPEG factory code was built and installed with SimGear."
454 echo "However it appears the libjpeg is no longer installed."
455 echo "You need to install libjpeg or remove jpgfactory support from"
458 echo "libjpeg is available at :"
459 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
462 AC_DEFINE([FG_JPEG_SERVER], 1,
463 [Define to build with jpeg screen shot server])
465 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
469 dnl Check for system installed zlib
470 AC_CHECK_HEADER(zlib.h)
471 if test "x$ac_cv_header_zlib_h" != "xyes"; then
473 echo "zlib library not found."
475 echo "If your OS does not provide an installable package for zlib"
476 echo "you will have to compile and install it first yourself. A copy"
477 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
478 echo "have to untar this source code, and follow it's included instructions"
479 echo "to compile and install on your system."
481 echo "configure aborted."
485 dnl Checks for header files.
488 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
489 sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
491 dnl Checks for typedefs, structures, and compiler characteristics.
497 dnl Checks for library functions.
501 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
502 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
504 AM_CONFIG_HEADER(src/Include/config.h)
516 scripts/debug/Makefile \
517 scripts/python/Makefile \
519 src/Include/Makefile \
520 src/Include/version.h \
521 src/Aircraft/Makefile \
522 src/Airports/Makefile \
524 src/Autopilot/Makefile \
525 src/Cockpit/Makefile \
526 src/Cockpit/built_in/Makefile \
527 src/Controls/Makefile \
528 src/Environment/Makefile \
529 src/FDM/Balloon/Makefile \
530 src/FDM/ExternalNet/Makefile \
531 src/FDM/JSBSim/Makefile \
532 src/FDM/JSBSim/filtersjb/Makefile \
533 src/FDM/LaRCsim/Makefile \
534 src/FDM/UIUCModel/Makefile \
535 src/FDM/YASim/Makefile \
539 src/Instrumentation/Makefile \
542 src/Main/runfgfs.bat \
544 src/Navaids/Makefile \
545 src/Network/Makefile \
546 src/NetworkOLK/Makefile \
547 src/Objects/Makefile \
548 src/Scenery/Makefile \
550 src/Systems/Makefile \
552 src/WeatherCM/Makefile \
555 utils/TerraSync/Makefile \
559 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
562 echo "Configure Summary"
563 echo "================="
565 echo "Prefix: $prefix"
567 if test "x$with_logging" != "x"; then
568 echo "Debug messages: $with_logging"
570 echo "Debug messages: yes"
573 echo -n "Automake version: "
574 automake --version | head -1
576 echo "New plib joystick name support: $plib_js_has_getname"
578 if test "x$with_weathercm" != "x"; then
579 echo "WeatherCM instead of FGEnvironment: $with_weathercm"
581 echo "Using FGEnvironment"
584 if test "x$with_threads" = "xyes"; then