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.8.0)
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])
58 # Used on the Irix platform
62 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
63 if test "$CXX" = "CC"; then
72 # Specify if we want logging (testing build) or not (release build)
73 # set logging default value
75 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
76 if test "x$with_logging" = "xno" ; then
77 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
80 # Specify if we want to build with Oliver's networking support
81 # default to with_network=yes
82 AC_ARG_WITH(network_olk, [ --with-network-olk Include Oliver's multi-pilot networking support])
83 if test "x$with_network_olk" = "xno" ; then
84 echo "Building without Oliver's multi-pilot network support"
86 echo "Building with Oliver's multi-pilot network support"
87 AC_DEFINE([FG_NETWORK_OLK], 1, [Define to build with Oliver's networking])
89 AM_CONDITIONAL(ENABLE_NETWORK_OLK, test "x$with_network_olk" != "xno")
92 # Specify if we want to use WeatherCM instead of FGEnvironment.
93 # default to with_weathercm=no
94 AC_ARG_WITH(new-environment, [ --with-weathercm Use WeatherCM instead of FGEnvironment])
95 if test "x$with_weathercm" = "xyes" ; then
96 echo "Building with WeatherCM"
97 AC_DEFINE([FG_WEATHERCM], 1,
98 [Define to build with Christian Mayer's weather code])
100 echo "Building with FGEnvironment"
102 AM_CONDITIONAL(ENABLE_WEATHERCM, test "x$with_weathercm" = "xyes")
104 # Let the Win32 user specify if they want to build with the SGI
105 # opengl.dll as opposed to the more standard openg32.dll
106 AC_ARG_WITH(sgi-opengl, [ --with-sgi-opengl Build against SGI's opengl.dll glu.dll and glut.dll])
108 dnl Thread related checks
109 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=no]])
110 if test "x$with_threads" = "xyes"; then
111 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
112 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
113 CFLAGS="$CFLAGS -D_REENTRANT"
114 AC_CHECK_HEADER(pthread.h)
116 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
118 # specify the plib location
119 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
121 if test "x$with_plib" != "x" ; then
122 echo "plib prefix is $with_plib"
123 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
126 # specify the metakit location
127 AC_ARG_WITH(metakit, [ --with-metakit=PREFIX Specify the prefix path to metakit])
129 if test "x$with_metakit" != "x" ; then
130 echo "metakit prefix is $with_metakit"
131 EXTRA_DIRS="${EXTRA_DIRS} $with_metakit"
134 # specify the simgear location
135 AC_ARG_WITH(simgear, [ --with-simgear=PREFIX Specify the prefix path to simgear])
137 if test "x$with_simgear" != "x" ; then
138 echo "SimGear prefix path is $with_simgear"
139 EXTRA_DIRS="${EXTRA_DIRS} $with_simgear"
142 # Check for MS Windows environment
143 AC_CHECK_HEADER(windows.h)
145 # extra library and include directories
146 if test "x$ac_cv_header_windows_h" != "xyes" ; then
147 EXTRA_DIRS="${EXTRA_DIRS} /usr/local /usr/X11R6"
149 if test -d /opt/X11R6 ; then
150 EXTRA_DIRS="${EXTRA_DIRS} /opt/X11R6"
153 if test "x$is_cygwin" = "xyes" ; then
154 EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
158 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
160 # Using AM_CONDITIONAL is a step out of the protected little
161 # automake fold so it is potentially dangerous. But, we are
162 # beginning to run into cases where the standard checks are not
163 # enough. AM_CONDITIONALS are then referenced to conditionally
164 # build a Makefile.in from a Makefile.am which lets us define custom
165 # includes, compile alternative source files, etc.
167 # Check for external variables daylight and timezone.
169 if test "$have_daylight" = yes; then
170 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
172 # AM_CONDITIONAL(HAVE_DAYLIGHT, test "$have_daylight" = yes )
175 if test "$have_timezone" = yes; then
176 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
178 # AM_CONDITIONAL(HAVE_TIMEZONE, test "$have_timezone" = yes )
180 # Check for audio support
181 AC_MSG_CHECKING(for audio support)
183 if test -r /usr/include/soundcard.h \
184 -o -r /usr/include/linux/soundcard.h \
185 -o -r /usr/include/machine/soundcard.h \
186 -o -r /usr/include/audio.h \
187 -o "x$ac_cv_header_windows_h" = "xyes" \
188 -o "$HOSTTYPE" = "macintosh"; then
190 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
191 audio_LIBS="-lplibsl -lplibsm"
193 if test -r /usr/include/audio.h; then
194 audio_LIBS="$audio_LIBS -laudio"
197 if test "x$ac_cv_header_windows_h" = "xyes"; then
198 audio_LIBS="$audio_LIBS -lwinmm"
201 if test "$HOSTTYPE" = "macintosh"; then
202 audio_LIBS="$audio_LIBS -framework Carbon"
209 # Check for X11 (fancy)
210 if test "x$no_x" != "xyes"; then
214 # Checks for libraries.
220 dnl MINGW requires libwsock32
221 if test "x$is_mingw" = "xyes" ; then
222 LIBS="$LIBS -lws2_32"
227 dnl Mesa >= 3.2 requires pthreads
228 AC_CHECK_LIB(pthread, pthread_exit)
229 AC_CHECK_LIB(socket, socket)
231 dnl Skip X library tests.
232 if test "x$no_x" != "xyes"; then
233 AC_CHECK_LIB(X11, XCreateWindow)
234 AC_CHECK_LIB(Xext, XShmCreateImage)
235 AC_CHECK_LIB(Xi, XGetExtensionVersion)
236 AC_CHECK_LIB(ICE, IceOpenConnection)
237 AC_CHECK_LIB(SM, SmcOpenConnection)
238 AC_CHECK_LIB(Xt, XtMalloc)
239 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
242 # check for OpenGL related libraries
244 if test "$HOSTTYPE" = "macintosh"; then
245 LIBS="$LIBS -framework OpenGL -framework GLUT -lobjc"
246 elif test "x$ac_cv_header_windows_h" != "xyes" ; then
247 # Reasonable stuff for non-windoze variants ... :-)
249 AC_CHECK_LIB(GLcore, glNewList)
250 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
251 # if no GLcore, check for GL
252 AC_CHECK_LIB(GL, glNewList)
253 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
254 # if no GL, check for MesaGL
255 AC_CHECK_LIB(MesaGL, glNewList)
258 # if GLcore found, then also check for GL
259 AC_CHECK_LIB(GL, glXCreateContext)
262 # check for xmesa.h and if found enable XMESA / FX
263 AC_CHECK_HEADER(GL/fxmesa.h)
264 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
266 AC_CHECK_LIB(GL, XMesaSetFXmode)
267 if test "x$ac_cv_lib_GL_XMesaSetFXmode" = "xyes" ; then
268 AC_DEFINE([XMESA], 1, [Define for Mesa FX mode])
269 AC_DEFINE([FX], 1, [Define for Mesa FX mode])
271 AC_CHECK_LIB(MesaGL, XMesaSetFXmode)
272 if test "x$ac_cv_lib_MesaGL_XMesaSetFXmode" = "xyes" ; then
273 AC_DEFINE([XMESA], 1, [Define for Mesa FX mode])
274 AC_DEFINE([FX], 1, [Define for Mesa FX mode])
280 AC_CHECK_LIB(GLU, gluLookAt)
281 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
282 # if no GLU, check for MesaGLU
283 AC_CHECK_LIB(MesaGLU, gluLookAt)
287 AC_CHECK_LIB(glut, glutGetModifiers)
289 # test for glutGameModeString, but avoid adding glut a second time into
290 # the list of libraries
292 AC_CHECK_LIB(glut, glutGameModeString)
295 # Win32 is a little wierd because it has to try to handle the various
296 # winbloze-isms. We'll just do this manually for now.
298 echo Win32 specific hacks...
299 AC_DEFINE([WIN32], 1, [Define if building on a Win32 platform])
301 # just define these to true and hope for the best
302 ac_cv_lib_glut_glutGetModifiers="yes"
303 ac_cv_lib_glut_glutGameModeString="yes"
305 if test "x$with_sgi_opengl" = "xyes" ; then
306 echo "Building with glut.dll, glu.dll, and opengl.dll"
311 echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
314 WIN32_OPENGL=opengl32
317 LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
318 LIBS="$LIBS -luser32 -lgdi32"
319 echo "Will link apps with $LIBS"
322 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
324 echo "Unable to find the necessary OpenGL or GLUT libraries."
325 echo "See config.log for automated test details and results ..."
329 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
331 echo "Your version of glut doesn't support game mode."
332 echo "You need to install the latest version. If your distribution doesn't"
333 echo "provide a newer version, you can get the latest source code from:"
335 echo " http://reality.sgi.com/opengl/glut3/glut3.html"
343 AC_SUBST(opengl_LIBS)
345 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
347 # The following are C++ items that need to be tested for with the c++
352 # Check for "plib" without which we cannot go on
353 AC_CHECK_HEADER(plib/ul.h)
354 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
356 echo "You *must* have the plib library installed on your system to build"
357 echo "the FGFS simulator!"
359 echo "Please see README.plib for more details."
361 echo "configure aborted."
365 AC_MSG_CHECKING([for plib 1.6.0 or newer])
369 #define MIN_PLIB_VERSION 160
372 int major, minor, micro;
374 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
383 [AC_MSG_RESULT(wrong version);
384 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
388 # If we get here then plib is available, so force use of plib joystick lib
389 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
391 # Do we have a new CVS plib version with jsJoystick::getName?
392 echo -n "Testing for Plib joystick getName support: "
393 AC_EGREP_HEADER( getName, plib/js.h,
394 plib_js_has_getname=yes, plib_js_has_getname=no )
395 echo $plib_js_has_getname
396 if test $plib_js_has_getname = 'yes'; then
397 AC_DEFINE([FG_PLIB_JOYSTICK_GETNAME], 1,
398 [Define to enable plib joystick name support])
401 # Check for the presence of SimGear
402 AC_CHECK_HEADER(simgear/version.h)
403 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
405 echo "You *must* have the SimGear support library installed on your system"
406 echo "to build the FGFS simulator!"
408 echo "Please see README.SimGear for more details."
410 echo "configure aborted."
414 AC_MSG_CHECKING([for simgear 0.2.0 or newer])
418 #include <simgear/version.h>
420 #define STRINGIFY(X) XSTRINGIFY(X)
421 #define XSTRINGIFY(X) #X
428 int major, minor, micro;
430 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
432 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
434 if ( major < MIN_MAJOR ) {
436 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
438 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
447 [AC_MSG_RESULT(wrong version);
448 AC_MSG_ERROR([Install latest simgear first...])],
453 AC_CHECK_HEADER(mk4.h)
454 if test "x$ac_cv_header_mk4_h" != "xyes"; then
456 echo "MetaKit library not found."
458 echo "If your OS does not provide an installable package for MetaKit"
459 echo "you will have to compile and install it first yourself. A copy"
460 echo "of metakit-$(VERSION).tar.gz is included with SimGear. You will"
461 echo "have to untar this source code, and follow it's included instructions"
462 echo "to compile and install on your system."
464 echo "configure aborted."
468 AC_MSG_CHECKING([for metakit 2.4.3 or newer])
470 LIBS="$saved_LIBS -lmk4"
474 #define MIN_MK4_VERSION 243
477 int major, minor, micro;
479 if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
488 [AC_MSG_RESULT(wrong version);
489 AC_MSG_ERROR([Install metakit 2.4.3 or later first...])],
494 # Check if SimGear was built with Norman JPEG factory support
495 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
496 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
497 AC_CHECK_LIB(jpeg, jpeg_start_compress)
498 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
500 echo "The JPEG factory code was built and installed with SimGear."
501 echo "However it appears the libjpeg is no longer installed."
502 echo "You need to install libjpeg or remove jpgfactory support from"
505 echo "libjpeg is available at :"
506 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
509 AC_DEFINE([FG_JPEG_SERVER], 1,
510 [Define to build with jpeg screen shot server])
512 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
516 # Check for system installed zlib
517 AC_CHECK_HEADER(zlib.h)
518 if test "x$ac_cv_header_zlib_h" != "xyes"; then
520 echo "zlib library not found."
522 echo "If your OS does not provide an installable package for zlib"
523 echo "you will have to compile and install it first yourself. A copy"
524 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
525 echo "have to untar this source code, and follow it's included instructions"
526 echo "to compile and install on your system."
528 echo "configure aborted."
532 # Checks for header files.
535 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
536 sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
538 # Checks for typedefs, structures, and compiler characteristics.
544 # Checks for library functions.
547 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
548 random setitimer getitimer signal GetLocalTime rint getrusage )
550 AM_CONFIG_HEADER(src/Include/config.h)
562 scripts/debug/Makefile \
563 scripts/python/Makefile \
565 src/Include/Makefile \
566 src/Include/version.h \
567 src/Aircraft/Makefile \
568 src/Airports/Makefile \
570 src/Autopilot/Makefile \
571 src/Cockpit/Makefile \
572 src/Cockpit/built_in/Makefile \
573 src/Controls/Makefile \
574 src/Environment/Makefile \
575 src/FDM/Balloon/Makefile \
576 src/FDM/JSBSim/Makefile \
577 src/FDM/JSBSim/filtersjb/Makefile \
578 src/FDM/LaRCsim/Makefile \
579 src/FDM/UIUCModel/Makefile \
580 src/FDM/YASim/Makefile \
586 src/Main/runfgfs.bat \
588 src/Navaids/Makefile \
589 src/Network/Makefile \
590 src/NetworkOLK/Makefile \
591 src/Objects/Makefile \
592 src/Scenery/Makefile \
595 src/WeatherCM/Makefile \
600 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
603 echo "Configure Summary"
604 echo "================="
606 echo "Prefix: $prefix"
608 if test "x$with_logging" != "x"; then
609 echo "Debug messages: $with_logging"
611 echo "Debug messages: yes"
614 echo -n "Automake version: ($AUTO_MAKE_VERSION) "
615 automake --version | head -1
617 echo "New plib joystick name support: $plib_js_has_getname"
619 if test "x$with_weathercm" != "x"; then
620 echo "WeatherCM instead of FGEnvironment: $with_weathercm"
622 echo "Using FGEnvironment"
625 if test "x$with_threads" = "xyes"; then