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 dnl 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 dnl add correct audio libs and configure for audio support
150 audio_LIBS="-lplibsl -lplibsm"
152 *-*-cygwin* | *-*-mingw32*)
153 audio_LIBS="$audio_LIBS -lwinmm"
157 audio_LIBS="$audio_LIBS -laudio"
162 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
164 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
165 dnl to use it if it is.
167 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
168 echo no fancy X11 check
177 dnl Checks for libraries.
183 dnl MINGW requires libwsock32
184 if test "x$is_mingw" = "xyes" ; then
185 LIBS="$LIBS -lws2_32"
190 dnl Thread related checks
191 AC_CHECK_LIB(pthread, pthread_exit)
192 AC_CHECK_LIB(socket, socket)
194 dnl check for glut location
195 AC_CHECK_HEADER(GL/glut.h)
196 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
197 AC_DEFINE([GLUT_H], "GL/glut.h", [Define as glut.h include location])
199 AC_CHECK_HEADER(GLUT/glut.h)
200 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
201 AC_DEFINE([GLUT_H], "GLUT/glut.h", [Define as glut.h include location])
203 echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue"
208 dnl check for OpenGL related libraries
210 *-*-cygwin* | *-*-mingw32*)
211 dnl CygWin under Windoze.
213 echo Win32 specific hacks...
214 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
215 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
217 LIBS="$LIBS -lglut32 -lglu32 -lopengl32"
218 LIBS="$LIBS -luser32 -lgdi32"
220 dnl add -lwsock32 for mingwin
223 LIBS="$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)
288 AC_SUBST(opengl_LIBS)
290 # The following are C++ items that need to be tested for with the c++
295 # Check for "plib" without which we cannot go on
296 AC_CHECK_HEADER(plib/ul.h)
297 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
299 echo "You *must* have the plib library installed on your system to build"
300 echo "the FGFS simulator!"
302 echo "Please see README.plib for more details."
304 echo "configure aborted."
308 AC_MSG_CHECKING([for plib 1.6.0 or newer])
312 #define MIN_PLIB_VERSION 160
315 int major, minor, micro;
317 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
326 [AC_MSG_RESULT(wrong version);
327 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
331 dnl If we get here then plib is available, so force use of plib
333 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
334 AC_DEFINE([FG_PLIB_JOYSTICK_GETNAME], 1,
335 [Define to enable plib joystick name support])
337 dnl Check for MetaKit
338 AC_CHECK_HEADER(mk4.h)
339 if test "x$ac_cv_header_mk4_h" != "xyes"; then
341 echo "MetaKit library not found."
343 echo "If your OS does not provide an installable package for MetaKit"
344 echo "you will have to compile and install it first yourself. A copy"
345 echo "of metakit-$(VERSION).tar.gz is included with SimGear. You will"
346 echo "have to untar this source code, and follow it's included instructions"
347 echo "to compile and install on your system."
349 echo "configure aborted."
353 AC_MSG_CHECKING([for metakit 2.4.3 or newer])
355 LIBS="$saved_LIBS -lmk4"
359 #define MIN_MK4_VERSION 243
362 int major, minor, micro;
364 if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
373 [AC_MSG_RESULT(wrong version);
376 Install metakit 2.4.3 or later first.
378 Or, the compiler may not be finding your libmk4.so library.
379 Please check the config.log file for specific details of the
380 failure if you believe you have the correct metakit version.
381 Also, look up this issue in the FlightGear FAQ.])],
385 dnl Check for the presence of SimGear
386 AC_CHECK_HEADER(simgear/version.h)
387 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
389 echo "You *must* have the SimGear support library installed on your system"
390 echo "to build the FGFS simulator!"
392 echo "Please see README.SimGear for more details."
394 echo "configure aborted."
398 AC_MSG_CHECKING([for simgear 0.3.0 or newer])
402 #include <simgear/version.h>
404 #define STRINGIFY(X) XSTRINGIFY(X)
405 #define XSTRINGIFY(X) #X
412 int major, minor, micro;
414 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
416 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
418 if ( major < MIN_MAJOR ) {
420 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
422 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
431 [AC_MSG_RESULT(wrong version);
432 AC_MSG_ERROR([Install latest simgear first...])],
438 dnl Check if SimGear was built with Norman JPEG factory support
439 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
440 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
441 AC_CHECK_LIB(jpeg, jpeg_start_compress)
442 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
444 echo "The JPEG factory code was built and installed with SimGear."
445 echo "However it appears the libjpeg is no longer installed."
446 echo "You need to install libjpeg or remove jpgfactory support from"
449 echo "libjpeg is available at :"
450 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
453 AC_DEFINE([FG_JPEG_SERVER], 1,
454 [Define to build with jpeg screen shot server])
456 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
460 dnl Check for system installed zlib
461 AC_CHECK_HEADER(zlib.h)
462 if test "x$ac_cv_header_zlib_h" != "xyes"; then
464 echo "zlib library not found."
466 echo "If your OS does not provide an installable package for zlib"
467 echo "you will have to compile and install it first yourself. A copy"
468 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
469 echo "have to untar this source code, and follow it's included instructions"
470 echo "to compile and install on your system."
472 echo "configure aborted."
476 dnl Checks for header files.
479 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
480 sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
482 dnl Checks for typedefs, structures, and compiler characteristics.
488 dnl Checks for library functions.
492 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
493 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
495 AM_CONFIG_HEADER(src/Include/config.h)
507 scripts/debug/Makefile \
508 scripts/python/Makefile \
510 src/Include/Makefile \
511 src/Include/version.h \
512 src/Aircraft/Makefile \
513 src/Airports/Makefile \
515 src/Autopilot/Makefile \
516 src/Cockpit/Makefile \
517 src/Cockpit/built_in/Makefile \
518 src/Controls/Makefile \
519 src/Environment/Makefile \
520 src/FDM/Balloon/Makefile \
521 src/FDM/ExternalNet/Makefile \
522 src/FDM/JSBSim/Makefile \
523 src/FDM/JSBSim/filtersjb/Makefile \
524 src/FDM/LaRCsim/Makefile \
525 src/FDM/UIUCModel/Makefile \
526 src/FDM/YASim/Makefile \
530 src/Instrumentation/Makefile \
533 src/Main/runfgfs.bat \
535 src/Navaids/Makefile \
536 src/Network/Makefile \
537 src/NetworkOLK/Makefile \
538 src/Objects/Makefile \
539 src/Scenery/Makefile \
541 src/Systems/Makefile \
543 src/WeatherCM/Makefile \
546 utils/TerraSync/Makefile \
550 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
553 echo "Configure Summary"
554 echo "================="
556 echo "Prefix: $prefix"
558 if test "x$with_logging" != "x"; then
559 echo "Debug messages: $with_logging"
561 echo "Debug messages: yes"
564 echo -n "Automake version: "
565 automake --version | head -1
567 echo "New plib joystick name support: $plib_js_has_getname"
569 if test "x$with_weathercm" != "x"; then
570 echo "WeatherCM instead of FGEnvironment: $with_weathercm"
572 echo "Using FGEnvironment"
575 if test "x$with_threads" = "xyes"; then