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 # just define these to true and hope for the best
326 ac_cv_lib_glut_glutGetModifiers="yes"
327 ac_cv_lib_glut_glutGameModeString="yes"
329 if test "x$with_sgi_opengl" = "xyes" ; then
330 echo "Building with glut.dll, glu.dll, and opengl.dll"
335 echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
338 WIN32_OPENGL=opengl32
341 LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
342 LIBS="$LIBS -luser32 -lgdi32"
343 echo "Will link apps with $LIBS"
346 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
348 echo "Unable to find the necessary OpenGL or GLUT libraries."
349 echo "See config.log for automated test details and results ..."
353 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
355 echo "Your version of glut doesn't support game mode."
356 echo "You need to install the latest version. If your distribution doesn't"
357 echo "provide a newer version, you can get the latest source code from:"
359 echo " http://reality.sgi.com/opengl/glut3/glut3.html"
367 AC_SUBST(opengl_LIBS)
369 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
371 # The following are C++ items that need to be tested for with the c++
376 # Check for "plib" without which we cannot go on
377 AC_CHECK_HEADER(plib/pu.h)
378 if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
380 echo "You *must* have the plib library installed on your system to build"
381 echo "the FGFS simulator!"
383 echo "Please see README.plib for more details."
385 echo "configure aborted."
389 # needed for plib 1.3.x and later
390 AC_CHECK_LIB(plibul, ulInit,,,)
392 if test "x$ac_cv_lib_plibul_ulInit" != "xyes"; then
394 echo "You have an old version of plib, you need to upgrade to at least"
399 # If we get here then plib is available, so force use of plib joystick lib
400 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
402 # Do we have a new CVS plib version with jsJoystick::getName?
403 echo -n "Testing for Plib joystick getName support: "
404 AC_EGREP_HEADER( getName, plib/js.h,
405 plib_js_has_getname=yes, plib_js_has_getname=no )
406 echo $plib_js_has_getname
407 if test $plib_js_has_getname = 'yes'; then
408 AC_DEFINE([FG_PLIB_JOYSTICK_GETNAME], 1,
409 [Define to enable plib joystick name support])
412 # Check for the presence of SimGear
413 AC_CHECK_HEADER(simgear/version.h)
414 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
416 echo "You *must* have the SimGear support library installed on your system"
417 echo "to build the FGFS simulator!"
419 echo "Please see README.SimGear for more details."
421 echo "configure aborted."
425 AC_MSG_CHECKING([for proper simgear version])
429 #include <simgear/version.h>
431 #define STRINGIFY(X) XSTRINGIFY(X)
432 #define XSTRINGIFY(X) #X
439 int major, minor, micro;
441 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
443 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
445 if ( major < MIN_MAJOR ) {
447 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
449 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
458 [AC_MSG_RESULT(wrong version);
459 AC_MSG_ERROR([Install latest simgear first...])],
464 AC_CHECK_HEADER(mk4.h)
465 if test "x$ac_cv_header_mk4_h" != "xyes"; then
467 echo "MetaKit library not found."
469 echo "If your OS does not provide an installable package for MetaKit"
470 echo "you will have to compile and install it first yourself. A copy"
471 echo "of metakit-$(VERSION).tar.gz is included with SimGear. You will"
472 echo "have to untar this source code, and follow it's included instructions"
473 echo "to compile and install on your system."
475 echo "configure aborted."
479 AC_MSG_CHECKING([for proper metakit version])
483 #define MIN_MK4_VERSION 243
486 int major, minor, micro;
488 if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
497 [AC_MSG_RESULT(wrong version);
498 AC_MSG_ERROR([Install metakit 2.4.3 or later first...])],
504 # Check for system installed zlib
505 AC_CHECK_HEADER(zlib.h)
506 if test "x$ac_cv_header_zlib_h" != "xyes"; then
508 echo "zlib library not found."
510 echo "If your OS does not provide an installable package for zlib"
511 echo "you will have to compile and install it first yourself. A copy"
512 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
513 echo "have to untar this source code, and follow it's included instructions"
514 echo "to compile and install on your system."
516 echo "configure aborted."
520 # Checks for header files.
523 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
524 sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
526 # Checks for typedefs, structures, and compiler characteristics.
532 # Checks for library functions.
535 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
536 random setitimer getitimer signal GetLocalTime rint getrusage )
538 AM_CONFIG_HEADER(src/Include/config.h)
550 scripts/debug/Makefile \
551 scripts/python/Makefile \
553 src/Include/Makefile \
554 src/Include/version.h \
555 src/Aircraft/Makefile \
556 src/Airports/Makefile \
558 src/Autopilot/Makefile \
559 src/Cockpit/Makefile \
560 src/Cockpit/built_in/Makefile \
561 src/Controls/Makefile \
562 src/Environment/Makefile \
563 src/FDM/Balloon/Makefile \
564 src/FDM/JSBSim/Makefile \
565 src/FDM/JSBSim/filtersjb/Makefile \
566 src/FDM/LaRCsim/Makefile \
567 src/FDM/UIUCModel/Makefile \
568 src/FDM/YASim/Makefile \
574 src/Main/runfgfs.bat \
576 src/Navaids/Makefile \
577 src/Network/Makefile \
578 src/NetworkOLK/Makefile \
579 src/Objects/Makefile \
580 src/Scenery/Makefile \
583 src/WeatherCM/Makefile \
588 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
591 echo "Configure Summary"
592 echo "================="
594 echo "Prefix: $prefix"
596 if test "x$with_logging" != "x"; then
597 echo "Debug messages: $with_logging"
599 echo "Debug messages: yes"
602 echo -n "Automake version: ($AUTO_MAKE_VERSION) "
603 automake --version | head -1
605 echo "New plib joystick name support: $plib_js_has_getname"
607 if test "x$with_weathercm" != "x"; then
608 echo "WeatherCM instead of FGEnvironment: $with_weathercm"
610 echo "Using FGEnvironment"
613 if test "x$with_threads" = "xyes"; then