1 dnl Process this file with aclocal ; automake -a ; autoconf to produce a
2 dnl working configure script.
9 AC_CONFIG_SRCDIR([src/Aircraft/aircraft.cxx])
11 # Require at least automake 2.52
14 # Initialize the automake stuff
15 AM_INIT_AUTOMAKE(FlightGear, 0.7.11pre1)
17 # Checks for programs.
29 # Initialize maintainer mode
32 # This is needed for AC_TRY_COMPILE later
35 # Check to see if this `configure' is being run in the `Cygwin32' environment
40 ],is_mingw=yes, is_mingw=no)
42 echo "IS_MINGW = $is_mingw"
43 AM_CONDITIONAL(IS_MINGW, test "x$is_mingw" = "xyes")
49 ],is_cygwin=yes, is_cygwin=no)
51 echo "IS_CYGWIN = $is_cygwin"
52 AM_CONDITIONAL(IS_CYGWIN, test "x$is_cygwin" = "xyes")
54 # Determine version of automake ... important becuase of
55 # incompatibilities between versions
56 AUTO_MAKE_VERSION=`automake --version | head -1 | awk '{print $4}' | sed -e 's/\-p[[0-9]]$//' | sed -e 's/\.//g'`
57 if test $AUTO_MAKE_VERSION -lt 15; then
58 echo "You need to upgrade your automake to version 1.5 or newer"
63 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
65 # Used on the Irix platform
68 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
69 if test "$CXX" = "CC"; then
76 # Specify if we want logging (testing build) or not (release build)
77 # set logging default value
79 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
80 if test "x$with_logging" = "xno" ; then
81 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
84 # Specify if we want to build with Oliver's networking support
85 # default to with_network=yes
86 AC_ARG_WITH(network_olk, [ --with-network-olk Include Oliver's multi-pilot networking support])
87 if test "x$with_network_olk" = "xno" ; then
88 echo "Building without Oliver's multi-pilot network support"
90 echo "Building with Oliver's multi-pilot network support"
91 AC_DEFINE([FG_NETWORK_OLK], 1, [Define to build with Oliver's networking])
93 AM_CONDITIONAL(ENABLE_NETWORK_OLK, test "x$with_network_olk" != "xno")
96 # Check if SimGear was built with Norman JPEG factory support
97 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
98 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
99 AC_CHECK_LIB(jpeg, jpeg_start_compress)
100 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
102 echo "The JPEG factory code was built and installed with SimGear."
103 echo "However it appears the libjpeg is no longer installed."
104 echo "You need to install libjpeg or remove jpgfactory support from"
107 echo "libjpeg is available at :"
108 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
111 AC_DEFINE([FG_JPEG_SERVER], 1,
112 [Define to build with jpeg screen shot server])
114 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
116 # Specify if we want to use WeatherCM instead of FGEnvironment.
117 # default to with_weathercm=no
118 AC_ARG_WITH(new-environment, [ --with-weathercm Use WeatherCM instead of FGEnvironment])
119 if test "x$with_weathercm" = "xyes" ; then
120 echo "Building with WeatherCM"
121 AC_DEFINE([FG_WEATHERCM], 1,
122 [Define to build with Christian Mayer's weather code])
124 echo "Building with FGEnvironment"
126 AM_CONDITIONAL(ENABLE_WEATHERCM, test "x$with_weathercm" = "xyes")
128 # Let the Win32 user specify if they want to build with the SGI
129 # opengl.dll as opposed to the more standard openg32.dll
130 AC_ARG_WITH(sgi-opengl, [ --with-sgi-opengl Build against SGI's opengl.dll glu.dll and glut.dll])
132 dnl Thread related checks
133 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=no]])
134 if test "x$with_threads" = "xyes"; then
135 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
136 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
137 CFLAGS="$CFLAGS -D_REENTRANT"
138 AC_CHECK_HEADER(pthread.h)
140 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
142 # specify the plib location
143 AC_ARG_WITH(plib, [ --with-plib=prefix Specify the prefix path to plib])
145 if test "x$with_plib" != "x" ; then
146 echo "plib prefix is $with_plib"
147 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
150 # specify the metakit location
151 AC_ARG_WITH(metakit, [ --with-metakit=prefix Specify the prefix path to metakit])
153 if test "x$with_metakit" != "x" ; then
154 echo "metakit prefix is $with_metakit"
155 EXTRA_DIRS="${EXTRA_DIRS} $with_metakit"
158 # specify the simgear location
159 AC_ARG_WITH(simgear, [ --with-simgear=prefix Specify the prefix path to simgear])
161 if test "x$with_simgear" != "x" ; then
162 echo "SimGear prefix path is $with_simgear"
163 EXTRA_DIRS="${EXTRA_DIRS} $with_simgear"
166 # Check for MS Windows environment
167 AC_CHECK_HEADER(windows.h)
169 # extra library and include directories
170 if test "x$ac_cv_header_windows_h" != "xyes" ; then
171 EXTRA_DIRS="${EXTRA_DIRS} /usr/local /usr/X11R6"
173 if test -d /opt/X11R6 ; then
174 EXTRA_DIRS="${EXTRA_DIRS} /opt/X11R6"
177 if test "x$is_cygwin" = "xyes" ; then
178 EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
182 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
184 # Using AM_CONDITIONAL is a step out of the protected little
185 # automake fold so it is potentially dangerous. But, we are
186 # beginning to run into cases where the standard checks are not
187 # enough. AM_CONDITIONALS are then referenced to conditionally
188 # build a Makefile.in from a Makefile.am which lets us define custom
189 # includes, compile alternative source files, etc.
191 # Check for external variables daylight and timezone.
193 if test "$have_daylight" = yes; then
194 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
196 # AM_CONDITIONAL(HAVE_DAYLIGHT, test "$have_daylight" = yes )
199 if test "$have_timezone" = yes; then
200 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
202 # AM_CONDITIONAL(HAVE_TIMEZONE, test "$have_timezone" = yes )
204 # Check for audio support
205 AC_MSG_CHECKING(for audio support)
207 if test -r /usr/include/soundcard.h \
208 -o -r /usr/include/linux/soundcard.h \
209 -o -r /usr/include/machine/soundcard.h \
210 -o -r /usr/include/audio.h \
211 -o "x$ac_cv_header_windows_h" = "xyes" \
212 -o "$HOSTTYPE" = "macintosh"; then
214 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
215 audio_LIBS="-lplibsl -lplibsm"
217 if test -r /usr/include/audio.h; then
218 audio_LIBS="$audio_LIBS -laudio"
221 if test "x$ac_cv_header_windows_h" = "xyes"; then
222 audio_LIBS="$audio_LIBS -lwinmm"
225 if test "$HOSTTYPE" = "macintosh"; then
226 audio_LIBS="$audio_LIBS -framework Carbon"
233 # Check for X11 (fancy)
234 if test "x$no_x" != "xyes"; then
238 # Checks for libraries.
244 dnl MINGW requires libwsock32
245 if test "x$is_mingw" = "xyes" ; then
246 LIBS="$LIBS -lws2_32"
251 dnl Mesa >= 3.2 requires pthreads
252 AC_CHECK_LIB(pthread, pthread_exit)
253 AC_CHECK_LIB(socket, socket)
255 dnl Skip X library tests.
256 if test "x$no_x" != "xyes"; then
257 AC_CHECK_LIB(X11, XCreateWindow)
258 AC_CHECK_LIB(Xext, XShmCreateImage)
259 AC_CHECK_LIB(Xi, XGetExtensionVersion)
260 AC_CHECK_LIB(ICE, IceOpenConnection)
261 AC_CHECK_LIB(SM, SmcOpenConnection)
262 AC_CHECK_LIB(Xt, XtMalloc)
263 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
266 # check for OpenGL related libraries
268 if test "$HOSTTYPE" = "macintosh"; then
269 LIBS="$LIBS -framework OpenGL -framework GLUT -lobjc"
270 elif test "x$ac_cv_header_windows_h" != "xyes" ; then
271 # Reasonable stuff for non-windoze variants ... :-)
273 AC_CHECK_LIB(GLcore, glNewList)
274 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
275 # if no GLcore, check for GL
276 AC_CHECK_LIB(GL, glNewList)
277 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
278 # if no GL, check for MesaGL
279 AC_CHECK_LIB(MesaGL, glNewList)
282 # if GLcore found, then also check for GL
283 AC_CHECK_LIB(GL, glXCreateContext)
286 # check for xmesa.h and if found enable XMESA / FX
287 AC_CHECK_HEADER(GL/fxmesa.h)
288 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
290 AC_CHECK_LIB(GL, XMesaSetFXmode)
291 if test "x$ac_cv_lib_GL_XMesaSetFXmode" = "xyes" ; then
292 AC_DEFINE([XMESA], 1, [Define for Mesa FX mode])
293 AC_DEFINE([FX], 1, [Define for Mesa FX mode])
295 AC_CHECK_LIB(MesaGL, XMesaSetFXmode)
296 if test "x$ac_cv_lib_MesaGL_XMesaSetFXmode" = "xyes" ; then
297 AC_DEFINE([XMESA], 1, [Define for Mesa FX mode])
298 AC_DEFINE([FX], 1, [Define for Mesa FX mode])
304 AC_CHECK_LIB(GLU, gluLookAt)
305 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
306 # if no GLU, check for MesaGLU
307 AC_CHECK_LIB(MesaGLU, gluLookAt)
311 AC_CHECK_LIB(glut, glutGetModifiers)
313 # test for glutGameModeString, but avoid adding glut a second time into
314 # the list of libraries
316 AC_CHECK_LIB(glut, glutGameModeString)
319 # Win32 is a little wierd because it has to try to handle the various
320 # winbloze-isms. We'll just do this manually for now.
322 echo Win32 specific hacks...
323 AC_DEFINE([WIN32], 1, [Define if building on a Win32 platform])
325 # force a failed check since we will be building under windoze
326 AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
328 # just define these to true and hope for the best
329 ac_cv_lib_glut_glutGetModifiers="yes"
330 ac_cv_lib_glut_glutGameModeString="yes"
332 if test "x$with_sgi_opengl" = "xyes" ; then
333 echo "Building with glut.dll, glu.dll, and opengl.dll"
338 echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
341 WIN32_OPENGL=opengl32
344 LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
345 LIBS="$LIBS -luser32 -lgdi32"
346 echo "Will link apps with $LIBS"
349 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
351 echo "Unable to find the necessary OpenGL or GLUT libraries."
352 echo "See config.log for automated test details and results ..."
356 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
358 echo "Your version of glut doesn't support game mode."
359 echo "You need to install the latest version. If your distribution doesn't"
360 echo "provide a newer version, you can get the latest source code from:"
362 echo " http://reality.sgi.com/opengl/glut3/glut3.html"
370 AC_SUBST(opengl_LIBS)
372 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
374 # The following are C++ items that need to be tested for with the c++
380 # Check for "plib" without which we cannot go on
381 AC_CHECK_HEADER(plib/pu.h)
382 if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
384 echo "You *must* have the plib library installed on your system to build"
385 echo "the FGFS simulator!"
387 echo "Please see README.plib for more details."
389 echo "configure aborted."
393 # needed for plib 1.3.x and later
394 AC_CHECK_LIB(plibul, ulInit,,,)
396 if test "x$ac_cv_lib_plibul_ulInit" != "xyes"; then
398 echo "You have an old version of plib, you need to upgrade to at least"
403 # If we get here then plib is available, so force use of plib joystick lib
404 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
406 # Do we have a new CVS plib version with jsJoystick::getName?
407 echo -n "Testing for Plib joystick getName support: "
408 AC_EGREP_HEADER( getName, plib/js.h,
409 plib_js_has_getname=yes, plib_js_has_getname=no )
410 echo $plib_js_has_getname
411 if test $plib_js_has_getname = 'yes'; then
412 AC_DEFINE([FG_PLIB_JOYSTICK_GETNAME], 1,
413 [Define to enable plib joystick name support])
416 # Check for the presence of SimGear
417 AC_CHECK_HEADER(simgear/version.h)
418 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
420 echo "You *must* have the SimGear support library installed on your system"
421 echo "to build the FGFS simulator!"
423 echo "Please see README.SimGear for more details."
425 echo "configure aborted."
429 AC_MSG_CHECKING(for proper simgear version)
434 #include <simgear/version.h>
436 #define STRINGIFY(X) XSTRINGIFY(X)
437 #define XSTRINGIFY(X) #X
444 int major, minor, micro;
446 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
448 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
450 if ( major < MIN_MAJOR ) {
452 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
454 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
463 [AC_MSG_RESULT(wrong version);
464 AC_MSG_ERROR([Install latest simgear first...])],
469 AC_CHECK_HEADER(mk4.h)
470 if test "x$ac_cv_header_mk4_h" != "xyes"; then
472 echo "MetaKit library not found."
474 echo "If your OS does not provide an installable package for MetaKit"
475 echo "you will have to compile and install it first yourself. A copy"
476 echo "of metakit-$(VERSION).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."
487 #define MIN_MK4_VERSION 243
490 int major, minor, micro;
492 if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
501 [AC_MSG_RESULT(wrong version);
502 AC_MSG_ERROR([Install metakit 2.4.3 or later first...])],
508 # Check for system installed zlib
509 AC_CHECK_HEADER(zlib.h)
510 if test "x$ac_cv_header_zlib_h" != "xyes"; then
512 echo "zlib library not found."
514 echo "If your OS does not provide an installable package for zlib"
515 echo "you will have to compile and install it first yourself. A copy"
516 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
517 echo "have to untar this source code, and follow it's included instructions"
518 echo "to compile and install on your system."
520 echo "configure aborted."
524 # Checks for header files.
527 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
528 sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
530 # Checks for typedefs, structures, and compiler characteristics.
536 # Checks for library functions.
539 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
540 random setitimer getitimer signal GetLocalTime rint getrusage )
542 AM_CONFIG_HEADER([src/Include/config.h])
554 scripts/debug/Makefile \
555 scripts/python/Makefile \
557 src/Include/Makefile \
558 src/Include/version.h \
559 src/Aircraft/Makefile \
560 src/Airports/Makefile \
562 src/Autopilot/Makefile \
563 src/Cockpit/Makefile \
564 src/Cockpit/built_in/Makefile \
565 src/Controls/Makefile \
566 src/Environment/Makefile \
567 src/FDM/Balloon/Makefile \
568 src/FDM/JSBSim/Makefile \
569 src/FDM/JSBSim/filtersjb/Makefile \
570 src/FDM/LaRCsim/Makefile \
571 src/FDM/UIUCModel/Makefile \
572 src/FDM/YASim/Makefile \
578 src/Main/runfgfs.bat \
580 src/Navaids/Makefile \
581 src/Network/Makefile \
582 src/NetworkOLK/Makefile \
583 src/Objects/Makefile \
584 src/Scenery/Makefile \
587 src/WeatherCM/Makefile \
592 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
595 echo "Configure Summary"
596 echo "================="
598 echo "Prefix: $prefix"
600 if test "x$with_logging" != "x"; then
601 echo "Debug messages: $with_logging"
603 echo "Debug messages: yes"
606 echo -n "Automake version: ($AUTO_MAKE_VERSION) "
607 automake --version | head -1
609 echo "New plib joystick name support: $plib_js_has_getname"
611 if test "x$with_weathercm" != "x"; then
612 echo "WeatherCM instead of FGEnvironment: $with_weathercm"
614 echo "Using FGEnvironment"
617 if test "x$with_threads" = "xyes"; then