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.3)
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/X11R6 ; then
109 EXTRA_DIR1="/usr/X11R6"
111 if test -d /opt/X11R6 ; then
112 EXTRA_DIR2="/opt/X11R6"
114 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2"
118 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
121 dnl Using AM_CONDITIONAL is a step out of the protected little
122 dnl automake fold so it is potentially dangerous. But, we are
123 dnl beginning to run into cases where the standard checks are not
124 dnl enough. AM_CONDITIONALS are then referenced to conditionally
125 dnl build a Makefile.in from a Makefile.am which lets us define custom
126 dnl includes, compile alternative source files, etc.
128 dnl Check for external variables daylight and timezone.
130 if test "$have_daylight" = yes; then
131 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
135 if test "$have_timezone" = yes; then
136 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
139 dnl add correct audio libs and configure for audio support
140 audio_LIBS="-lplibsl -lplibsm"
142 *-*-cygwin* | *-*-mingw32*)
143 audio_LIBS="$audio_LIBS -lwinmm"
146 audio_LIBS="$audio_LIBS -framework IOKit -framework CoreFoundation"
149 audio_LIBS="$audio_LIBS -laudio"
155 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
156 dnl just assuming we have audio support on all platform. We can
157 dnl depend on plib to hide the details.
158 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
160 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
161 dnl to use it if it is.
163 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
164 echo no fancy X11 check
173 dnl Checks for libraries.
175 dnl Thread related checks
176 AC_CHECK_LIB(pthread, pthread_exit)
177 if test "x$ac_cv_lib_pthread_pthread_exit" != "xyes" \
178 -a "x$ac_cv_header_pthread_h" = "xyes"; then
179 dnl FreeBSD: System has pthread.h, but -lpthread library check
180 dnl fails. See if we need -pthread instead of -lpthread and look
181 dnl for the functions in libc_r.
182 save_CXXFLAGS="$CXXFLAGS"
183 save_CFLAGS="$CFLAGS"
184 CXXFLAGS="-pthread $CXXFLAGS"
185 CFLAGS="-pthread $CFLAGS"
187 AC_CHECK_LIB(c_r, pthread_exit)
188 if test "x$ac_cv_lib_c_r_pthread_exit" != "xyes"; then
189 CXXFLAGS=$save_CXXFLAGS
198 dnl search for network related libraries
199 AC_SEARCH_LIBS(inet_addr, xnet)
200 AC_SEARCH_LIBS(socket, socket)
201 AC_SEARCH_LIBS(main, nsl)
206 dnl check for some default libraries
207 AC_SEARCH_LIBS(cos, m)
208 AC_SEARCH_LIBS(dlclose, dl)
212 dnl check for glut location
213 AC_CHECK_HEADER(GL/glut.h)
214 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
215 AC_DEFINE([FG_GLUT_H], <GL/glut.h>, [Define as glut.h include location])
217 AC_CHECK_HEADER(GLUT/glut.h)
218 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
219 AC_DEFINE([FG_GLUT_H], <GLUT/glut.h>, [Define as glut.h include location])
221 echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue"
226 dnl check for OpenGL related libraries
228 *-*-cygwin* | *-*-mingw32*)
229 dnl CygWin under Windoze.
231 echo Win32 specific hacks...
232 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
233 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
235 LIBS="$LIBS -lglut32 -lglu32 -lopengl32"
236 LIBS="$LIBS -luser32 -lgdi32"
238 dnl add -lwsock32 for mingwin
241 echo "********** BUILDING FOR MINGW32 *************"
242 base_LIBS="$base_LIBS -lws2_32"
246 echo "Will link apps with $LIBS"
253 LIBS="$LIBS -framework GLUT -framework OpenGL -framework Carbon -lobjc"
257 dnl X-Windows based machines
259 dnl Skip X11 library tests if requested.
260 if test "x$no_x" != "xyes"; then
261 AC_SEARCH_LIBS(XCreateWindow, X11)
262 AC_SEARCH_LIBS(XShmCreateImage, Xext)
263 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
264 AC_SEARCH_LIBS(IceOpenConnection, ICE)
265 AC_SEARCH_LIBS(SmcOpenConnection, SM)
266 AC_SEARCH_LIBS(XtMalloc, Xt)
267 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
270 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
271 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
272 dnl if GLcore found, then also check for GL
273 AC_SEARCH_LIBS(glXCreateContext, GL)
276 dnl if using mesa, check for xmesa.h
277 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
278 AC_CHECK_HEADER(GL/fxmesa.h)
279 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
280 AC_DEFINE([XMESA], 1, [Define for fxmesa])
281 AC_DEFINE([FX], 1, [Define for fxmesa])
285 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
286 AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
295 AC_SUBST(opengl_LIBS)
296 AC_SUBST(thread_LIBS)
297 AC_SUBST(network_LIBS)
299 # The following are C++ items that need to be tested for with the c++
304 # Check for "plib" without which we cannot go on
305 AC_CHECK_HEADER(plib/ul.h)
306 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
308 echo "You *must* have the plib library installed on your system to build"
309 echo "the FGFS simulator!"
311 echo "Please see README.plib for more details."
313 echo "configure aborted."
317 AC_MSG_CHECKING([for plib 1.6.0 or newer])
321 #define MIN_PLIB_VERSION 160
324 int major, minor, micro;
326 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
335 [AC_MSG_RESULT(wrong version);
336 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
340 dnl If we get here then plib is available, so force use of plib
342 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
345 dnl Check for the presence of SimGear
346 AC_CHECK_HEADER(simgear/version.h)
347 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
349 echo "You *must* have the SimGear support library installed on your system"
350 echo "to build the FGFS simulator!"
352 echo "Please see README.SimGear for more details."
354 echo "configure aborted."
358 AC_MSG_CHECKING([for simgear 0.3.4 or newer])
362 #include <simgear/version.h>
364 #define STRINGIFY(X) XSTRINGIFY(X)
365 #define XSTRINGIFY(X) #X
372 int major, minor, micro;
374 printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
376 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
378 if ( major < MIN_MAJOR ) {
380 } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
382 } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
391 [AC_MSG_RESULT(wrong version);
392 AC_MSG_ERROR([Install latest simgear first...])],
398 dnl Check if SimGear was built with Norman JPEG factory support
399 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
400 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
401 AC_CHECK_LIB(jpeg, jpeg_start_compress)
402 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
404 echo "The JPEG factory code was built and installed with SimGear."
405 echo "However it appears the libjpeg is no longer installed."
406 echo "You need to install libjpeg or remove jpgfactory support from"
409 echo "libjpeg is available at :"
410 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
413 AC_DEFINE([FG_JPEG_SERVER], 1,
414 [Define to build with jpeg screen shot server])
416 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
420 dnl Check for system installed zlib
421 AC_CHECK_HEADER(zlib.h)
422 if test "x$ac_cv_header_zlib_h" != "xyes"; then
424 echo "zlib library not found."
426 echo "If your OS does not provide an installable package for zlib"
427 echo "you will have to compile and install it first yourself. A copy"
428 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
429 echo "have to untar this source code, and follow it's included instructions"
430 echo "to compile and install on your system."
432 echo "configure aborted."
436 dnl Checks for header files.
439 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
440 sys/time.h sys/timeb.h unistd.h windows.h values.h )
442 dnl Checks for typedefs, structures, and compiler characteristics.
448 dnl Checks for library functions.
450 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
454 ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
455 random drand48 setitimer getitimer signal GetLocalTime rint getrusage \
459 AM_CONFIG_HEADER(src/Include/config.h)
471 scripts/debug/Makefile \
472 scripts/perl/Makefile \
473 scripts/perl/examples/Makefile \
474 scripts/python/Makefile \
476 src/Include/Makefile \
477 src/Include/version.h \
478 src/Aircraft/Makefile \
479 src/Airports/Makefile \
481 src/Autopilot/Makefile \
482 src/Cockpit/Makefile \
483 src/Cockpit/built_in/Makefile \
484 src/Controls/Makefile \
485 src/Environment/Makefile \
486 src/FDM/Balloon/Makefile \
487 src/FDM/ExternalNet/Makefile \
488 src/FDM/ExternalPipe/Makefile \
489 src/FDM/JSBSim/Makefile \
490 src/FDM/JSBSim/filtersjb/Makefile \
491 src/FDM/LaRCsim/Makefile \
492 src/FDM/UIUCModel/Makefile \
493 src/FDM/YASim/Makefile \
497 src/Instrumentation/Makefile \
500 src/Main/runfgfs.bat \
502 src/AIModel/Makefile \
503 src/MultiPlayer/Makefile \
504 src/Navaids/Makefile \
505 src/Network/Makefile \
506 src/Objects/Makefile \
507 src/Replay/Makefile \
508 src/Scenery/Makefile \
509 src/Scripting/Makefile \
511 src/Systems/Makefile \
515 utils/TerraSync/Makefile \
516 utils/Modeller/Makefile \
517 utils/js_server/Makefile \
521 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
524 echo "Configure Summary"
525 echo "================="
527 echo "Prefix: $prefix"
529 if test "x$with_logging" != "x"; then
530 echo "Debug messages: $with_logging"
532 echo "Debug messages: yes"
535 echo -n "Automake version: "
536 automake --version | head -1
538 if test "x$with_multiplayer" != "xno"; then
539 echo "Building with multiplayer support"
542 if test "x$with_threads" = "xyes"; then