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
27 dnl Used on the Irix platform
32 if test "$CXX" = "CC"; then
41 dnl set logging; default value of with_logging=yes
42 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
43 if test "x$with_logging" = "xno" ; then
44 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
47 # Specify if we want to build with Oliver's networking support
48 # default to with_network=yes
49 AC_ARG_WITH(network_olk, [ --with-network-olk Include Oliver's multi-pilot networking support])
50 if test "x$with_network_olk" = "xno" ; then
51 echo "Building without Oliver's multi-pilot network support"
53 echo "Building with Oliver's multi-pilot network support"
54 AC_DEFINE([FG_NETWORK_OLK], 1, [Define to build with Oliver's networking])
56 AM_CONDITIONAL(ENABLE_NETWORK_OLK, test "x$with_network_olk" != "xno")
59 # Specify if we want to use WeatherCM instead of FGEnvironment.
60 # default to with_weathercm=no
61 AC_ARG_WITH(new-environment, [ --with-weathercm Use WeatherCM instead of FGEnvironment])
62 if test "x$with_weathercm" = "xyes" ; then
63 echo "Building with WeatherCM"
64 AC_DEFINE([FG_WEATHERCM], 1,
65 [Define to build with Christian Mayer's weather code])
67 echo "Building with FGEnvironment"
69 AM_CONDITIONAL(ENABLE_WEATHERCM, test "x$with_weathercm" = "xyes")
71 dnl Thread related checks
72 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=no]])
73 if test "x$with_threads" = "xyes"; then
74 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
75 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
76 CFLAGS="$CFLAGS -D_REENTRANT"
77 AC_CHECK_HEADER(pthread.h)
79 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
81 # specify the plib location
82 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
84 if test "x$with_plib" != "x" ; then
85 echo "plib prefix is $with_plib"
86 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
89 # specify the metakit location
90 AC_ARG_WITH(metakit, [ --with-metakit=PREFIX Specify the prefix path to metakit])
92 if test "x$with_metakit" != "x" ; then
93 echo "metakit prefix is $with_metakit"
94 EXTRA_DIRS="${EXTRA_DIRS} $with_metakit"
97 # specify the simgear location
98 AC_ARG_WITH(simgear, [ --with-simgear=PREFIX Specify the prefix path to simgear])
100 if test "x$with_simgear" != "x" ; then
101 echo "SimGear prefix path is $with_simgear"
102 EXTRA_DIRS="${EXTRA_DIRS} $with_simgear"
105 dnl Used by JSBSim to conditionally compile in fgfs interface code
106 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
108 # Check for MS Windows environment
109 AC_CHECK_HEADER(windows.h)
111 dnl Determine an extra directories to add to include/lib search paths
113 *-apple-darwin* | *-*-mingw32*)
114 echo no EXTRA_DIRS for $host
118 if test -d /usr/X11R6 ; then
119 EXTRA_DIR1="/usr/X11R6"
121 if test -d /opt/X11R6 ; then
122 EXTRA_DIR2="/opt/X11R6"
124 EXTRA_DIRS="$EXTRA_DIR1 $EXTRA_DIR2"
128 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
131 dnl Using AM_CONDITIONAL is a step out of the protected little
132 dnl automake fold so it is potentially dangerous. But, we are
133 dnl beginning to run into cases where the standard checks are not
134 dnl enough. AM_CONDITIONALS are then referenced to conditionally
135 dnl build a Makefile.in from a Makefile.am which lets us define custom
136 dnl includes, compile alternative source files, etc.
138 # Check for external variables daylight and timezone.
140 if test "$have_daylight" = yes; then
141 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
145 if test "$have_timezone" = yes; then
146 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
149 # Check for audio support
150 audio_LIBS="-lplibsl -lplibsm"
152 *-*-cygwin* | *-*-mingw32*)
153 audio_LIBS="$audio_LIBS -lwinmm"
157 audio_LIBS="$audio_LIBS -laudio"
163 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
164 dnl to use it if it is.
166 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
167 echo no fancy X11 check
176 dnl Checks for libraries.
182 dnl MINGW requires libwsock32
183 if test "x$is_mingw" = "xyes" ; then
184 LIBS="$LIBS -lws2_32"
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 LIBS="$LIBS -lws2_32"
226 echo "Will link apps with $LIBS"
233 LIBS="$LIBS -framework GLUT -framework OpenGL -framework Carbon -lobjc"
237 dnl X-Windows based machines
239 dnl Skip X11 library tests if requested.
240 if test "x$no_x" != "xyes"; then
241 AC_CHECK_LIB(X11, XCreateWindow)
242 AC_CHECK_LIB(Xext, XShmCreateImage)
243 AC_CHECK_LIB(Xi, XGetExtensionVersion)
244 AC_CHECK_LIB(ICE, IceOpenConnection)
245 AC_CHECK_LIB(SM, SmcOpenConnection)
246 AC_CHECK_LIB(Xt, XtMalloc)
247 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
250 AC_CHECK_LIB(GLcore, glNewList)
251 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
252 dnl if no GLcore, check for GL
253 AC_CHECK_LIB(GL, glNewList)
254 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
255 dnl if no GL, check for MesaGL
256 AC_CHECK_LIB(MesaGL, glNewList)
259 dnl if GLcore found, then also check for GL
260 AC_CHECK_LIB(GL, glXCreateContext)
263 dnl if using mesa, check for xmesa.h
264 if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
265 AC_CHECK_HEADER(GL/fxmesa.h)
266 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
267 AC_DEFINE([XMESA], 1, [Define for fxmesa])
268 AC_DEFINE([FX], 1, [Define for fxmesa])
272 AC_CHECK_LIB(GLU, gluLookAt)
273 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
274 dnl if no GLU, check for MesaGLU
275 AC_CHECK_LIB(MesaGLU, gluLookAt)
287 AC_SUBST(opengl_LIBS)
289 # The following are C++ items that need to be tested for with the c++
294 # Check for "plib" without which we cannot go on
295 AC_CHECK_HEADER(plib/ul.h)
296 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
298 echo "You *must* have the plib library installed on your system to build"
299 echo "the FGFS simulator!"
301 echo "Please see README.plib for more details."
303 echo "configure aborted."
307 AC_MSG_CHECKING([for plib 1.6.0 or newer])
311 #define MIN_PLIB_VERSION 160
314 int major, minor, micro;
316 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
325 [AC_MSG_RESULT(wrong version);
326 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
330 dnl If we get here then plib is available, so force use of plib
332 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
333 AC_DEFINE([FG_PLIB_JOYSTICK_GETNAME], 1,
334 [Define to enable plib joystick name support])
336 dnl Check for MetaKit
337 AC_CHECK_HEADER(mk4.h)
338 if test "x$ac_cv_header_mk4_h" != "xyes"; then
340 echo "MetaKit library not found."
342 echo "If your OS does not provide an installable package for MetaKit"
343 echo "you will have to compile and install it first yourself. A copy"
344 echo "of metakit-$(VERSION).tar.gz is included with SimGear. You will"
345 echo "have to untar this source code, and follow it's included instructions"
346 echo "to compile and install on your system."
348 echo "configure aborted."
352 AC_MSG_CHECKING([for metakit 2.4.3 or newer])
354 LIBS="$saved_LIBS -lmk4"
358 #define MIN_MK4_VERSION 243
361 int major, minor, micro;
363 if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
372 [AC_MSG_RESULT(wrong version);
375 Install metakit 2.4.3 or later first.
377 Or, the compiler may not be finding your libmk4.so library.
378 Please check the config.log file for specific details of the
379 failure if you believe you have the correct metakit version.
380 Also, look up this issue in the FlightGear FAQ.])],
384 dnl Check for the presence of SimGear
385 AC_CHECK_HEADER(simgear/version.h)
386 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
388 echo "You *must* have the SimGear support library installed on your system"
389 echo "to build the FGFS simulator!"
391 echo "Please see README.SimGear for more details."
393 echo "configure aborted."
397 AC_MSG_CHECKING([for simgear 0.3.0 or newer])
401 #include <simgear/version.h>
403 #define STRINGIFY(X) XSTRINGIFY(X)
404 #define XSTRINGIFY(X) #X
411 int major, minor, micro;
413 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
415 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
417 if ( major < MIN_MAJOR ) {
419 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
421 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
430 [AC_MSG_RESULT(wrong version);
431 AC_MSG_ERROR([Install latest simgear first...])],
437 dnl Check if SimGear was built with Norman JPEG factory support
438 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
439 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
440 AC_CHECK_LIB(jpeg, jpeg_start_compress)
441 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
443 echo "The JPEG factory code was built and installed with SimGear."
444 echo "However it appears the libjpeg is no longer installed."
445 echo "You need to install libjpeg or remove jpgfactory support from"
448 echo "libjpeg is available at :"
449 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
452 AC_DEFINE([FG_JPEG_SERVER], 1,
453 [Define to build with jpeg screen shot server])
455 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
459 dnl Check for system installed zlib
460 AC_CHECK_HEADER(zlib.h)
461 if test "x$ac_cv_header_zlib_h" != "xyes"; then
463 echo "zlib library not found."
465 echo "If your OS does not provide an installable package for zlib"
466 echo "you will have to compile and install it first yourself. A copy"
467 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
468 echo "have to untar this source code, and follow it's included instructions"
469 echo "to compile and install on your system."
471 echo "configure aborted."
475 dnl Checks for header files.
478 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
479 sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
481 dnl Checks for typedefs, structures, and compiler characteristics.
487 dnl Checks for library functions.
491 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
492 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
494 AM_CONFIG_HEADER(src/Include/config.h)
506 scripts/debug/Makefile \
507 scripts/python/Makefile \
509 src/Include/Makefile \
510 src/Include/version.h \
511 src/Aircraft/Makefile \
512 src/Airports/Makefile \
514 src/Autopilot/Makefile \
515 src/Cockpit/Makefile \
516 src/Cockpit/built_in/Makefile \
517 src/Controls/Makefile \
518 src/Environment/Makefile \
519 src/FDM/Balloon/Makefile \
520 src/FDM/ExternalNet/Makefile \
521 src/FDM/JSBSim/Makefile \
522 src/FDM/JSBSim/filtersjb/Makefile \
523 src/FDM/LaRCsim/Makefile \
524 src/FDM/UIUCModel/Makefile \
525 src/FDM/YASim/Makefile \
529 src/Instrumentation/Makefile \
532 src/Main/runfgfs.bat \
534 src/Navaids/Makefile \
535 src/Network/Makefile \
536 src/NetworkOLK/Makefile \
537 src/Objects/Makefile \
538 src/Scenery/Makefile \
540 src/Systems/Makefile \
542 src/WeatherCM/Makefile \
545 utils/TerraSync/Makefile \
549 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
552 echo "Configure Summary"
553 echo "================="
555 echo "Prefix: $prefix"
557 if test "x$with_logging" != "x"; then
558 echo "Debug messages: $with_logging"
560 echo "Debug messages: yes"
563 echo -n "Automake version: "
564 automake --version | head -1
566 echo "New plib joystick name support: $plib_js_has_getname"
568 if test "x$with_weathercm" != "x"; then
569 echo "WeatherCM instead of FGEnvironment: $with_weathercm"
571 echo "Using FGEnvironment"
574 if test "x$with_threads" = "xyes"; then