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")
55 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
57 # Used on the Irix platform
60 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
61 if test "$CXX" = "CC"; then
68 # Specify if we want logging (testing build) or not (release build)
69 # set logging default value
71 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
72 if test "x$with_logging" = "xno" ; then
73 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
76 # Specify if we want to build with Oliver's networking support
77 # default to with_network=yes
78 AC_ARG_WITH(network_olk, [ --with-network-olk Include Oliver's multi-pilot networking support])
79 if test "x$with_network_olk" = "xno" ; then
80 echo "Building without Oliver's multi-pilot network support"
82 echo "Building with Oliver's multi-pilot network support"
83 AC_DEFINE([FG_NETWORK_OLK], 1, [Define to build with Oliver's networking])
85 AM_CONDITIONAL(ENABLE_NETWORK_OLK, test "x$with_network_olk" != "xno")
88 # Specify if we want to use WeatherCM instead of FGEnvironment.
89 # default to with_weathercm=no
90 AC_ARG_WITH(new-environment, [ --with-weathercm Use WeatherCM instead of FGEnvironment])
91 if test "x$with_weathercm" = "xyes" ; then
92 echo "Building with WeatherCM"
93 AC_DEFINE([FG_WEATHERCM], 1,
94 [Define to build with Christian Mayer's weather code])
96 echo "Building with FGEnvironment"
98 AM_CONDITIONAL(ENABLE_WEATHERCM, test "x$with_weathercm" = "xyes")
100 # Let the Win32 user specify if they want to build with the SGI
101 # opengl.dll as opposed to the more standard openg32.dll
102 AC_ARG_WITH(sgi-opengl, [ --with-sgi-opengl Build against SGI's opengl.dll glu.dll and glut.dll])
104 dnl Thread related checks
105 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=no]])
106 if test "x$with_threads" = "xyes"; then
107 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
108 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
109 CFLAGS="$CFLAGS -D_REENTRANT"
110 AC_CHECK_HEADER(pthread.h)
112 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
114 # specify the plib location
115 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
117 if test "x$with_plib" != "x" ; then
118 echo "plib prefix is $with_plib"
119 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
122 # specify the metakit location
123 AC_ARG_WITH(metakit, [ --with-metakit=PREFIX Specify the prefix path to metakit])
125 if test "x$with_metakit" != "x" ; then
126 echo "metakit prefix is $with_metakit"
127 EXTRA_DIRS="${EXTRA_DIRS} $with_metakit"
130 # specify the simgear location
131 AC_ARG_WITH(simgear, [ --with-simgear=PREFIX Specify the prefix path to simgear])
133 if test "x$with_simgear" != "x" ; then
134 echo "SimGear prefix path is $with_simgear"
135 EXTRA_DIRS="${EXTRA_DIRS} $with_simgear"
138 # Check for MS Windows environment
139 AC_CHECK_HEADER(windows.h)
141 # extra library and include directories
142 if test "x$ac_cv_header_windows_h" != "xyes" ; then
143 EXTRA_DIRS="${EXTRA_DIRS} /usr/local /usr/X11R6"
145 if test -d /opt/X11R6 ; then
146 EXTRA_DIRS="${EXTRA_DIRS} /opt/X11R6"
149 if test "x$is_cygwin" = "xyes" ; then
150 EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
154 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
156 # Using AM_CONDITIONAL is a step out of the protected little
157 # automake fold so it is potentially dangerous. But, we are
158 # beginning to run into cases where the standard checks are not
159 # enough. AM_CONDITIONALS are then referenced to conditionally
160 # build a Makefile.in from a Makefile.am which lets us define custom
161 # includes, compile alternative source files, etc.
163 # Check for external variables daylight and timezone.
165 if test "$have_daylight" = yes; then
166 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
168 # AM_CONDITIONAL(HAVE_DAYLIGHT, test "$have_daylight" = yes )
171 if test "$have_timezone" = yes; then
172 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
174 # AM_CONDITIONAL(HAVE_TIMEZONE, test "$have_timezone" = yes )
176 # Check for audio support
177 AC_MSG_CHECKING(for audio support)
179 if test -r /usr/include/soundcard.h \
180 -o -r /usr/include/linux/soundcard.h \
181 -o -r /usr/include/machine/soundcard.h \
182 -o -r /usr/include/audio.h \
183 -o "x$ac_cv_header_windows_h" = "xyes" \
184 -o "$HOSTTYPE" = "macintosh"; then
186 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
187 audio_LIBS="-lplibsl -lplibsm"
189 if test -r /usr/include/audio.h; then
190 audio_LIBS="$audio_LIBS -laudio"
193 if test "x$ac_cv_header_windows_h" = "xyes"; then
194 audio_LIBS="$audio_LIBS -lwinmm"
197 if test "$HOSTTYPE" = "macintosh"; then
198 audio_LIBS="$audio_LIBS -framework Carbon"
205 # Check for X11 (fancy)
206 if test "x$no_x" != "xyes"; then
210 # Checks for libraries.
216 dnl MINGW requires libwsock32
217 if test "x$is_mingw" = "xyes" ; then
218 LIBS="$LIBS -lws2_32"
223 dnl Mesa >= 3.2 requires pthreads
224 AC_CHECK_LIB(pthread, pthread_exit)
225 AC_CHECK_LIB(socket, socket)
227 dnl Skip X library tests.
228 if test "x$no_x" != "xyes"; then
229 AC_CHECK_LIB(X11, XCreateWindow)
230 AC_CHECK_LIB(Xext, XShmCreateImage)
231 AC_CHECK_LIB(Xi, XGetExtensionVersion)
232 AC_CHECK_LIB(ICE, IceOpenConnection)
233 AC_CHECK_LIB(SM, SmcOpenConnection)
234 AC_CHECK_LIB(Xt, XtMalloc)
235 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
238 # check for OpenGL related libraries
240 if test "$HOSTTYPE" = "macintosh"; then
241 LIBS="$LIBS -framework OpenGL -framework GLUT -lobjc"
242 elif test "x$ac_cv_header_windows_h" != "xyes" ; then
243 # Reasonable stuff for non-windoze variants ... :-)
245 AC_CHECK_LIB(GLcore, glNewList)
246 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
247 # if no GLcore, check for GL
248 AC_CHECK_LIB(GL, glNewList)
249 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
250 # if no GL, check for MesaGL
251 AC_CHECK_LIB(MesaGL, glNewList)
254 # if GLcore found, then also check for GL
255 AC_CHECK_LIB(GL, glXCreateContext)
258 # check for xmesa.h and if found enable XMESA / FX
259 AC_CHECK_HEADER(GL/fxmesa.h)
260 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
262 AC_CHECK_LIB(GL, XMesaSetFXmode)
263 if test "x$ac_cv_lib_GL_XMesaSetFXmode" = "xyes" ; then
264 AC_DEFINE([XMESA], 1, [Define for Mesa FX mode])
265 AC_DEFINE([FX], 1, [Define for Mesa FX mode])
267 AC_CHECK_LIB(MesaGL, XMesaSetFXmode)
268 if test "x$ac_cv_lib_MesaGL_XMesaSetFXmode" = "xyes" ; then
269 AC_DEFINE([XMESA], 1, [Define for Mesa FX mode])
270 AC_DEFINE([FX], 1, [Define for Mesa FX mode])
276 AC_CHECK_LIB(GLU, gluLookAt)
277 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
278 # if no GLU, check for MesaGLU
279 AC_CHECK_LIB(MesaGLU, gluLookAt)
283 AC_CHECK_LIB(glut, glutGetModifiers)
285 # test for glutGameModeString, but avoid adding glut a second time into
286 # the list of libraries
288 AC_CHECK_LIB(glut, glutGameModeString)
291 # Win32 is a little wierd because it has to try to handle the various
292 # winbloze-isms. We'll just do this manually for now.
294 echo Win32 specific hacks...
295 AC_DEFINE([WIN32], 1, [Define if building on a Win32 platform])
297 # just define these to true and hope for the best
298 ac_cv_lib_glut_glutGetModifiers="yes"
299 ac_cv_lib_glut_glutGameModeString="yes"
301 if test "x$with_sgi_opengl" = "xyes" ; then
302 echo "Building with glut.dll, glu.dll, and opengl.dll"
307 echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
310 WIN32_OPENGL=opengl32
313 LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
314 LIBS="$LIBS -luser32 -lgdi32"
315 echo "Will link apps with $LIBS"
318 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
320 echo "Unable to find the necessary OpenGL or GLUT libraries."
321 echo "See config.log for automated test details and results ..."
325 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
327 echo "Your version of glut doesn't support game mode."
328 echo "You need to install the latest version. If your distribution doesn't"
329 echo "provide a newer version, you can get the latest source code from:"
331 echo " http://reality.sgi.com/opengl/glut3/glut3.html"
339 AC_SUBST(opengl_LIBS)
341 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
343 # The following are C++ items that need to be tested for with the c++
348 # Check for "plib" without which we cannot go on
349 AC_CHECK_HEADER(plib/ul.h)
350 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
352 echo "You *must* have the plib library installed on your system to build"
353 echo "the FGFS simulator!"
355 echo "Please see README.plib for more details."
357 echo "configure aborted."
361 AC_MSG_CHECKING([for plib 1.6.0 or newer])
365 #define MIN_PLIB_VERSION 160
368 int major, minor, micro;
370 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
379 [AC_MSG_RESULT(wrong version);
380 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
384 # If we get here then plib is available, so force use of plib joystick lib
385 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
387 # Do we have a new CVS plib version with jsJoystick::getName?
388 echo -n "Testing for Plib joystick getName support: "
389 AC_EGREP_HEADER( getName, plib/js.h,
390 plib_js_has_getname=yes, plib_js_has_getname=no )
391 echo $plib_js_has_getname
392 if test $plib_js_has_getname = 'yes'; then
393 AC_DEFINE([FG_PLIB_JOYSTICK_GETNAME], 1,
394 [Define to enable plib joystick name support])
397 # Check for the presence of SimGear
398 AC_CHECK_HEADER(simgear/version.h)
399 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
401 echo "You *must* have the SimGear support library installed on your system"
402 echo "to build the FGFS simulator!"
404 echo "Please see README.SimGear for more details."
406 echo "configure aborted."
410 AC_MSG_CHECKING([for simgear 0.0.19 or newer])
414 #include <simgear/version.h>
416 #define STRINGIFY(X) XSTRINGIFY(X)
417 #define XSTRINGIFY(X) #X
424 int major, minor, micro;
426 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
428 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
430 if ( major < MIN_MAJOR ) {
432 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
434 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
443 [AC_MSG_RESULT(wrong version);
444 AC_MSG_ERROR([Install latest simgear first...])],
449 AC_CHECK_HEADER(mk4.h)
450 if test "x$ac_cv_header_mk4_h" != "xyes"; then
452 echo "MetaKit library not found."
454 echo "If your OS does not provide an installable package for MetaKit"
455 echo "you will have to compile and install it first yourself. A copy"
456 echo "of metakit-$(VERSION).tar.gz is included with SimGear. You will"
457 echo "have to untar this source code, and follow it's included instructions"
458 echo "to compile and install on your system."
460 echo "configure aborted."
464 AC_MSG_CHECKING([for metakit 2.4.3 or newer])
466 LIBS="$saved_LIBS -lmk4"
470 #define MIN_MK4_VERSION 243
473 int major, minor, micro;
475 if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
484 [AC_MSG_RESULT(wrong version);
485 AC_MSG_ERROR([Install metakit 2.4.3 or later first...])],
490 # Check if SimGear was built with Norman JPEG factory support
491 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
492 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
493 AC_CHECK_LIB(jpeg, jpeg_start_compress)
494 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
496 echo "The JPEG factory code was built and installed with SimGear."
497 echo "However it appears the libjpeg is no longer installed."
498 echo "You need to install libjpeg or remove jpgfactory support from"
501 echo "libjpeg is available at :"
502 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
505 AC_DEFINE([FG_JPEG_SERVER], 1,
506 [Define to build with jpeg screen shot server])
508 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
512 # Check for system installed zlib
513 AC_CHECK_HEADER(zlib.h)
514 if test "x$ac_cv_header_zlib_h" != "xyes"; then
516 echo "zlib library not found."
518 echo "If your OS does not provide an installable package for zlib"
519 echo "you will have to compile and install it first yourself. A copy"
520 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
521 echo "have to untar this source code, and follow it's included instructions"
522 echo "to compile and install on your system."
524 echo "configure aborted."
528 # Checks for header files.
531 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
532 sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
534 # Checks for typedefs, structures, and compiler characteristics.
540 # Checks for library functions.
543 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
544 random setitimer getitimer signal GetLocalTime rint getrusage )
546 AM_CONFIG_HEADER(src/Include/config.h)
558 scripts/debug/Makefile \
559 scripts/python/Makefile \
561 src/Include/Makefile \
562 src/Include/version.h \
563 src/Aircraft/Makefile \
564 src/Airports/Makefile \
566 src/Autopilot/Makefile \
567 src/Cockpit/Makefile \
568 src/Cockpit/built_in/Makefile \
569 src/Controls/Makefile \
570 src/Environment/Makefile \
571 src/FDM/Balloon/Makefile \
572 src/FDM/JSBSim/Makefile \
573 src/FDM/JSBSim/filtersjb/Makefile \
574 src/FDM/LaRCsim/Makefile \
575 src/FDM/UIUCModel/Makefile \
576 src/FDM/YASim/Makefile \
582 src/Main/runfgfs.bat \
584 src/Navaids/Makefile \
585 src/Network/Makefile \
586 src/NetworkOLK/Makefile \
587 src/Objects/Makefile \
588 src/Scenery/Makefile \
591 src/WeatherCM/Makefile \
596 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
599 echo "Configure Summary"
600 echo "================="
602 echo "Prefix: $prefix"
604 if test "x$with_logging" != "x"; then
605 echo "Debug messages: $with_logging"
607 echo "Debug messages: yes"
610 echo -n "Automake version: ($AUTO_MAKE_VERSION) "
611 automake --version | head -1
613 echo "New plib joystick name support: $plib_js_has_getname"
615 if test "x$with_weathercm" != "x"; then
616 echo "WeatherCM instead of FGEnvironment: $with_weathercm"
618 echo "Using FGEnvironment"
621 if test "x$with_threads" = "xyes"; then