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.4)
15 dnl Checks for programs.
24 # specify the simgear location
25 AC_ARG_WITH(simgear, [ --with-simgear=PREFIX Specify the prefix path to simgear])
27 if test "x$with_simgear" != "x" ; then
28 echo "SimGear prefix path is $with_simgear"
29 EXTRA_DIRS="${EXTRA_DIRS} $with_simgear"
32 dnl set the $host variable based on local machine/os
37 if test "$CXX" = "CC"; then
40 CXXFLAGS="$CXXFLAGS -I$with_simgear/include/simgear/compatibility"
54 dnl set logging; default value of with_logging=yes
55 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
56 if test "x$with_logging" = "xno" ; then
57 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
60 # Specify if we want to build with Multiplayer support
61 # default to with_network=yes
62 AC_ARG_WITH(multiplayer, [ --with-multiplayer Include multiplayer support [default=yes]])
64 if test "x$with_multiplayer" = "xno"; then
65 echo "Building without any kind of multiplayer support"
67 echo "Building with multiplayer support"
68 AC_DEFINE([FG_MPLAYER_AS], 1, [Define to build with multiplayer support])
70 AM_CONDITIONAL(ENABLE_MPLAYER_AS, test "x$with_multiplayer" != "xno")
73 dnl Thread related checks
74 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=no]])
75 if test "x$with_threads" = "xyes"; then
76 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
77 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
78 CFLAGS="$CFLAGS -D_REENTRANT"
80 AC_CHECK_HEADER(pthread.h)
81 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
83 # specify the plib location
84 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
86 if test "x$with_plib" != "x" ; then
87 echo "plib prefix is $with_plib"
88 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
91 dnl Used by JSBSim to conditionally compile in fgfs interface code
92 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
94 dnl Used to controll whether clouds3d should be compiled in or not
95 AC_DEFINE([FG_USE_CLOUDS_3D], 1, [Define to use 3D cloud support])
96 AM_CONDITIONAL(FG_USE_CLOUDS_3D, test "x" = "x")
98 # Check for MS Windows environment
99 AC_CHECK_HEADER(windows.h)
101 dnl Determine an extra directories to add to include/lib search paths
103 *-apple-darwin* | *-*-mingw32*)
104 echo no EXTRA_DIRS for $host
108 if test -d /usr/local ; then
109 EXTRA_DIRS="/usr/local"
114 if test -d /usr/X11R6 ; then
115 EXTRA_DIR1="/usr/X11R6"
117 if test -d /opt/X11R6 ; then
118 EXTRA_DIR2="/opt/X11R6"
120 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2"
124 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
127 dnl Using AM_CONDITIONAL is a step out of the protected little
128 dnl automake fold so it is potentially dangerous. But, we are
129 dnl beginning to run into cases where the standard checks are not
130 dnl enough. AM_CONDITIONALS are then referenced to conditionally
131 dnl build a Makefile.in from a Makefile.am which lets us define custom
132 dnl includes, compile alternative source files, etc.
134 dnl Check for external variables daylight and timezone.
136 if test "$have_daylight" = yes; then
137 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
141 if test "$have_timezone" = yes; then
142 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
145 dnl add correct audio libs and configure for audio support
146 audio_LIBS="-lplibsl -lplibsm"
148 *-*-cygwin* | *-*-mingw32*)
149 audio_LIBS="$audio_LIBS -lwinmm"
152 audio_LIBS="$audio_LIBS -framework IOKit -framework CoreFoundation"
155 audio_LIBS="$audio_LIBS -laudio"
161 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
162 dnl just assuming we have audio support on all platform. We can
163 dnl depend on plib to hide the details.
164 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
166 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
167 dnl to use it if it is.
169 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
170 echo no fancy X11 check
179 dnl Checks for libraries.
181 dnl Thread related checks
182 AC_CHECK_LIB(pthread, pthread_exit)
183 if test "x$ac_cv_lib_pthread_pthread_exit" != "xyes" \
184 -a "x$ac_cv_header_pthread_h" = "xyes"; then
185 dnl FreeBSD: System has pthread.h, but -lpthread library check
186 dnl fails. See if we need -pthread instead of -lpthread and look
187 dnl for the functions in libc_r.
188 save_CXXFLAGS="$CXXFLAGS"
189 save_CFLAGS="$CFLAGS"
190 CXXFLAGS="-pthread $CXXFLAGS"
191 CFLAGS="-pthread $CFLAGS"
193 AC_CHECK_LIB(c_r, pthread_exit)
194 if test "x$ac_cv_lib_c_r_pthread_exit" != "xyes"; then
195 CXXFLAGS=$save_CXXFLAGS
204 dnl search for network related libraries
205 AC_SEARCH_LIBS(inet_addr, xnet)
206 AC_SEARCH_LIBS(socket, socket)
207 AC_SEARCH_LIBS(main, nsl)
212 dnl check for some default libraries
213 AC_SEARCH_LIBS(cos, m)
214 AC_SEARCH_LIBS(dlclose, dl)
218 dnl check for glut location
219 AC_CHECK_HEADER(GL/glut.h)
220 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
221 AC_DEFINE([FG_GLUT_H], <GL/glut.h>, [Define as glut.h include location])
223 AC_CHECK_HEADER(GLUT/glut.h)
224 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
225 AC_DEFINE([FG_GLUT_H], <GLUT/glut.h>, [Define as glut.h include location])
227 echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue"
232 dnl check for OpenGL related libraries
234 *-*-cygwin* | *-*-mingw32*)
235 dnl CygWin under Windoze.
237 echo Win32 specific hacks...
238 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
239 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
241 LIBS="$LIBS -lglut32 -lglu32 -lopengl32"
242 LIBS="$LIBS -luser32 -lgdi32"
244 dnl add -lwsock32 for mingwin
247 echo "********** BUILDING FOR MINGW32 *************"
248 base_LIBS="$base_LIBS -lws2_32"
252 echo "Will link apps with $LIBS"
259 LIBS="$LIBS -framework GLUT -framework OpenGL -framework Carbon -lobjc"
263 dnl X-Windows based machines
265 dnl Skip X11 library tests if requested.
266 if test "x$no_x" != "xyes"; then
267 AC_SEARCH_LIBS(XCreateWindow, X11)
268 AC_SEARCH_LIBS(XShmCreateImage, Xext)
269 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
270 AC_SEARCH_LIBS(IceOpenConnection, ICE)
271 AC_SEARCH_LIBS(SmcOpenConnection, SM)
272 AC_SEARCH_LIBS(XtMalloc, Xt)
273 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
276 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
277 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
278 dnl if GLcore found, then also check for GL
279 AC_SEARCH_LIBS(glXCreateContext, GL)
282 dnl if using mesa, check for xmesa.h
283 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
284 AC_CHECK_HEADER(GL/fxmesa.h)
285 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
286 AC_DEFINE([XMESA], 1, [Define for fxmesa])
287 AC_DEFINE([FX], 1, [Define for fxmesa])
291 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
292 AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
301 AC_SUBST(opengl_LIBS)
302 AC_SUBST(thread_LIBS)
303 AC_SUBST(network_LIBS)
305 # The following are C++ items that need to be tested for with the c++
310 # Check for "plib" without which we cannot go on
311 AC_CHECK_HEADER(plib/ul.h)
312 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
314 echo "You *must* have the plib library installed on your system to build"
315 echo "the FGFS simulator!"
317 echo "Please see README.plib for more details."
319 echo "configure aborted."
323 AC_MSG_CHECKING([for plib 1.6.0 or newer])
327 #define MIN_PLIB_VERSION 160
330 int major, minor, micro;
332 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
341 [AC_MSG_RESULT(wrong version);
342 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
346 dnl If we get here then plib is available, so force use of plib
348 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
351 dnl Check for the presence of SimGear
352 AC_CHECK_HEADER(simgear/version.h)
353 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
355 echo "You *must* have the SimGear support library installed on your system"
356 echo "to build the FGFS simulator!"
358 echo "Please see README.SimGear for more details."
360 echo "configure aborted."
364 AC_MSG_CHECKING([for simgear 0.3.5 or newer])
368 #include <simgear/version.h>
370 #define STRINGIFY(X) XSTRINGIFY(X)
371 #define XSTRINGIFY(X) #X
378 int major, minor, micro;
380 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
382 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
384 if ( major < MIN_MAJOR ) {
386 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
388 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
397 [AC_MSG_RESULT(wrong version);
398 AC_MSG_ERROR([Install latest simgear first...])],
404 dnl Check if SimGear was built with Norman JPEG factory support
405 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
406 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
407 AC_CHECK_LIB(jpeg, jpeg_start_compress)
408 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
410 echo "The JPEG factory code was built and installed with SimGear."
411 echo "However it appears the libjpeg is no longer installed."
412 echo "You need to install libjpeg or remove jpgfactory support from"
415 echo "libjpeg is available at :"
416 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
419 AC_DEFINE([FG_JPEG_SERVER], 1,
420 [Define to build with jpeg screen shot server])
422 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
426 dnl Check for system installed zlib
427 AC_CHECK_HEADER(zlib.h)
428 if test "x$ac_cv_header_zlib_h" != "xyes"; then
430 echo "zlib library not found."
432 echo "If your OS does not provide an installable package for zlib"
433 echo "you will have to compile and install it first yourself. A copy"
434 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
435 echo "have to untar this source code, and follow it's included instructions"
436 echo "to compile and install on your system."
438 echo "configure aborted."
442 dnl Checks for header files.
445 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
446 sys/time.h sys/timeb.h unistd.h windows.h values.h )
448 dnl Checks for typedefs, structures, and compiler characteristics.
454 dnl Checks for library functions.
456 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
460 ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
461 random drand48 setitimer getitimer signal GetLocalTime rint getrusage \
465 AM_CONFIG_HEADER(src/Include/config.h)
477 scripts/debug/Makefile \
478 scripts/perl/Makefile \
479 scripts/perl/examples/Makefile \
480 scripts/python/Makefile \
482 src/Include/Makefile \
483 src/Include/version.h \
484 src/Aircraft/Makefile \
485 src/Airports/Makefile \
487 src/Autopilot/Makefile \
488 src/Cockpit/Makefile \
489 src/Cockpit/built_in/Makefile \
490 src/Controls/Makefile \
491 src/Environment/Makefile \
492 src/FDM/Balloon/Makefile \
493 src/FDM/ExternalNet/Makefile \
494 src/FDM/ExternalPipe/Makefile \
495 src/FDM/JSBSim/Makefile \
496 src/FDM/JSBSim/filtersjb/Makefile \
497 src/FDM/LaRCsim/Makefile \
498 src/FDM/UIUCModel/Makefile \
499 src/FDM/YASim/Makefile \
503 src/Instrumentation/Makefile \
506 src/Main/runfgfs.bat \
508 src/AIModel/Makefile \
509 src/MultiPlayer/Makefile \
510 src/Navaids/Makefile \
511 src/Network/Makefile \
512 src/Objects/Makefile \
513 src/Replay/Makefile \
514 src/Scenery/Makefile \
515 src/Scripting/Makefile \
517 src/Systems/Makefile \
521 utils/TerraSync/Makefile \
522 utils/Modeller/Makefile \
523 utils/js_server/Makefile \
527 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
530 echo "Configure Summary"
531 echo "================="
533 echo "Prefix: $prefix"
535 if test "x$with_logging" != "x"; then
536 echo "Debug messages: $with_logging"
538 echo "Debug messages: yes"
541 echo -n "Automake version: "
542 automake --version | head -1
544 if test "x$with_multiplayer" != "xno"; then
545 echo "Building with multiplayer support"
548 if test "x$with_threads" = "xyes"; then