1 dnl Process this file with autoget.sh to produce a working configure
5 AC_CONFIG_SRCDIR([src/Aircraft/aircraft.cxx])
7 dnl Require at least automake 2.52
10 dnl Initialize the automake stuff
11 dnl set the $host variable based on local machine/os
13 AM_INIT_AUTOMAKE(FlightGear, 0.9.8)
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"
34 if test "$CXX" = "CC"; then
37 CXXFLAGS="$CXXFLAGS -c99 -I$with_simgear/include/simgear/compatibility"
52 dnl set logging; default value of with_logging=yes
53 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
54 if test "x$with_logging" = "xno" ; then
55 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
58 # Specify if we want to build with Multiplayer support
59 # default to with_network=yes
60 AC_ARG_WITH(multiplayer, [ --with-multiplayer Include multiplayer support [default=yes]])
62 if test "x$with_multiplayer" = "xno"; then
63 echo "Building without any kind of multiplayer support"
65 echo "Building with multiplayer support"
66 AC_DEFINE([FG_MPLAYER_AS], 1, [Define to build with multiplayer support])
68 AM_CONDITIONAL(ENABLE_MPLAYER_AS, test "x$with_multiplayer" != "xno")
70 AC_ARG_ENABLE(sp_fdms, [ --enable-sp-fdms Include special purpose Flight Models], [enable_sp_fdms="$enableval"] )
71 AC_DEFINE([ENABLE_SP_FMDS], test "x$enable_sp_fdms" = "xyes", [Define to include special purpose FDMs])
72 AM_CONDITIONAL(ENABLE_SP_FDM, test "x$enable_sp_fdms" != "xno")
75 dnl Thread related checks
78 AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=yes]])
79 if test "x$with_threads" != "xyes"; then
80 AC_DEFINE([ENABLE_THREADS], 0, [Define to enable threaded tile paging])
82 AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
83 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
84 CFLAGS="$CFLAGS -D_REENTRANT"
86 AC_CHECK_HEADER(pthread.h)
87 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
89 # specify the plib location
90 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
92 if test "x$with_plib" != "x" ; then
93 echo "plib prefix is $with_plib"
94 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
97 dnl Used by JSBSim to conditionally compile in fgfs interface code
98 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
100 # Check for MS Windows environment
101 AC_CHECK_HEADER(windows.h)
103 dnl Determine an extra directories to add to include/lib search paths
105 *-apple-darwin* | *-*-mingw32*)
106 echo no EXTRA_DIRS for $host
110 if test -d /usr/local ; then
111 EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
116 if test -d /usr/X11R6 ; then
117 EXTRA_DIR1="/usr/X11R6"
119 if test -d /opt/X11R6 ; then
120 EXTRA_DIR2="/opt/X11R6"
122 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2 /usr/local/"
126 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
129 dnl Using AM_CONDITIONAL is a step out of the protected little
130 dnl automake fold so it is potentially dangerous. But, we are
131 dnl beginning to run into cases where the standard checks are not
132 dnl enough. AM_CONDITIONALS are then referenced to conditionally
133 dnl build a Makefile.in from a Makefile.am which lets us define custom
134 dnl includes, compile alternative source files, etc.
136 dnl Check for external variables daylight and timezone.
138 if test "$have_daylight" = yes; then
139 AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
143 if test "$have_timezone" = yes; then
144 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
148 dnl add joystick support libraries
149 dnl search for FreeBSD library
150 AC_SEARCH_LIBS(hid_init, usbhid)
151 joystick_LIBS="$LIBS"
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_SEARCH_LIBS(pthread_cancel, [pthread c_r])
177 if test "x$ac_cv_header_pthread_h" = "xyes"; then
178 if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
179 CXXFLAGS="-pthread $CXXFLAGS"
180 CFLAGS="-pthread $FLAGS"
187 dnl search for network related libraries
188 AC_SEARCH_LIBS(inet_addr, xnet)
189 AC_SEARCH_LIBS(socket, socket)
190 AC_SEARCH_LIBS(main, nsl)
195 dnl check for some default libraries
196 AC_SEARCH_LIBS(cos, m)
197 AC_SEARCH_LIBS(dlclose, dl)
201 dnl Check for SDL if enabled.
202 AC_ARG_ENABLE(sdl, [ --enable-sdl Configure to use SDL instead of GLUT], [enable_sdl="$enableval"])
203 AM_CONDITIONAL(USE_SDL, test "x$enable_sdl" = "xyes")
204 if test "x$enable_sdl" = "xyes"; then
205 AC_DEFINE([PU_USE_SDL], 1, [Define to use SDL])
207 AC_DEFINE([PU_USE_GLUT], 1, [Define to use glut])
210 dnl check for OpenGL related libraries
212 *-*-cygwin* | *-*-mingw32*)
213 dnl CygWin under Windoze.
215 echo Win32 specific hacks...
216 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
217 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
219 if test "x$enable_sdl" = "xyes"; then
220 AC_SEARCH_LIBS(SDL_Init, SDL)
222 LIBS="$LIBS -lglut32"
225 LIBS="$LIBS -lglu32 -lopengl32 -luser32 -lgdi32"
226 joystick_LIBS="$joystick_LIBS -lwinmm"
228 dnl add -lwsock32 for mingwin
231 echo "********** BUILDING FOR MINGW32 *************"
232 base_LIBS="$base_LIBS -lws2_32"
236 echo "Will link apps with $LIBS"
243 LIBS="$LIBS -framework GLUT -framework OpenGL -framework AGL -framework Carbon -lobjc"
244 joystick_LIBS="$joystick_LIBS -framework IOKit -framework CoreFoundation"
248 dnl X-Windows based machines
250 dnl Skip X11 library tests if requested.
251 if test "x$no_x" != "xyes"; then
252 AC_SEARCH_LIBS(XCreateWindow, X11)
253 AC_SEARCH_LIBS(XShmCreateImage, Xext)
254 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
255 AC_SEARCH_LIBS(IceOpenConnection, ICE)
256 AC_SEARCH_LIBS(SmcOpenConnection, SM)
257 AC_SEARCH_LIBS(XtMalloc, Xt)
258 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
261 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
262 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
263 dnl if GLcore found, then also check for GL
264 AC_SEARCH_LIBS(glXCreateContext, GL)
267 dnl if using mesa, check for xmesa.h
268 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
269 AC_CHECK_HEADER(GL/fxmesa.h)
270 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
271 AC_DEFINE([XMESA], 1, [Define for fxmesa])
272 AC_DEFINE([FX], 1, [Define for fxmesa])
276 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
277 AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
278 if test "x$enable_sdl" = "xyes"; then
279 AC_SEARCH_LIBS(SDL_Init, SDL)
286 LIBS="$base_LIBS $joystick_LIBS"
288 dnl check for OpenAL libraries
290 *-*-cygwin* | *-*-mingw32*)
291 dnl CygWin under Windoze.
293 AC_SEARCH_LIBS(alGenBuffers, openal32)
294 AC_SEARCH_LIBS(alutInit, [ openal32 ALut ] )
295 LIBS="$LIBS -ldsound -ldxguid -lole32"
302 LIBS="$LIBS -framework IOKit -framework OpenAL"
307 dnl default unix style machines
310 LIBS="$LIBS $thread_LIBS"
311 AC_SEARCH_LIBS(alGenBuffers, openal)
312 OPENAL_OK="$ac_cv_search_alGenBuffers"
322 AC_SUBST(openal_LIBS)
323 AC_SUBST(opengl_LIBS)
324 AC_SUBST(thread_LIBS)
325 AC_SUBST(network_LIBS)
326 AC_SUBST(joystick_LIBS)
328 # The following are C++ items that need to be tested for with the c++
333 # Check for "plib" without which we cannot go on
334 AC_CHECK_HEADER(plib/ul.h)
335 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
337 echo "You *must* have the plib library installed on your system to build"
338 echo "the FGFS simulator!"
340 echo "Please see README.plib for more details."
342 echo "configure aborted."
346 AC_MSG_CHECKING([for plib 1.8.4 or newer])
350 #define MIN_PLIB_VERSION 184
353 int major, minor, micro;
355 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
364 [AC_MSG_RESULT(wrong version);
365 AC_MSG_ERROR([Install plib 1.8.0 or later first...])],
369 dnl If we get here then plib is available, so force use of plib
371 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
374 dnl Check for the presence of SimGear
375 AC_CHECK_HEADER(simgear/version.h)
376 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
378 echo "You *must* have the SimGear support library installed on your system"
379 echo "to build the FGFS simulator!"
381 echo "Please see README.SimGear for more details."
383 echo "configure aborted."
387 AC_MSG_CHECKING([for simgear 0.3.8 or newer])
391 #include <simgear/version.h>
393 #define STRINGIFY(X) XSTRINGIFY(X)
394 #define XSTRINGIFY(X) #X
401 int major, minor, micro;
403 /* printf("%d.%d.%d or greater, ", MIN_MAJOR, MIN_MINOR, MIN_MICRO); */
404 printf("[found %s] ... ", STRINGIFY(SIMGEAR_VERSION));
406 sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
408 if ( (major < MIN_MAJOR) ||
409 (major == MIN_MAJOR && minor < MIN_MINOR) ||
410 (major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO) ) {
419 [AC_MSG_RESULT(wrong version);
420 AC_MSG_ERROR([Install latest simgear first...])],
426 dnl Check if SimGear was built with Norman's JPEG factory support
427 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
428 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
429 AC_CHECK_LIB(jpeg, jpeg_start_compress)
430 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
432 echo "The JPEG factory code was built and installed with SimGear."
433 echo "However it appears the libjpeg is no longer installed."
434 echo "You need to install libjpeg or remove jpgfactory support from"
437 echo "libjpeg is available at :"
438 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
441 AC_DEFINE([FG_JPEG_SERVER], 1,
442 [Define to build with jpeg screen shot server])
444 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
448 dnl Check for system installed zlib
449 AC_CHECK_HEADER(zlib.h)
450 if test "x$ac_cv_header_zlib_h" != "xyes"; then
452 echo "zlib library not found."
454 echo "If your OS does not provide an installable package for zlib"
455 echo "you will have to compile and install it first yourself. A copy"
456 echo "of zlib-1.1.4.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 dnl Checks for header files.
467 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
468 sys/time.h sys/timeb.h unistd.h windows.h values.h )
470 dnl Checks for typedefs, structures, and compiler characteristics.
476 dnl Checks for library functions.
478 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
482 ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
483 random drand48 setitimer getitimer signal GetLocalTime rint getrusage \
487 AM_CONFIG_HEADER(src/Include/config.h)
499 scripts/debug/Makefile \
500 scripts/perl/Makefile \
501 scripts/perl/examples/Makefile \
502 scripts/python/Makefile \
504 src/Include/Makefile \
505 src/Include/version.h \
506 src/Include/config.h-msvc6 \
507 src/Aircraft/Makefile \
508 src/Airports/Makefile \
510 src/Autopilot/Makefile \
511 src/Cockpit/Makefile \
512 src/Cockpit/built_in/Makefile \
513 src/Controls/Makefile \
514 src/Environment/Makefile \
515 src/FDM/Balloon/Makefile \
516 src/FDM/ExternalNet/Makefile \
517 src/FDM/ExternalPipe/Makefile \
518 src/FDM/JSBSim/Makefile \
519 src/FDM/JSBSim/filtersjb/Makefile \
520 src/FDM/LaRCsim/Makefile \
521 src/FDM/SP/Makefile \
522 src/FDM/UIUCModel/Makefile \
523 src/FDM/YASim/Makefile \
527 src/Instrumentation/Makefile \
530 src/Main/runfgfs.bat \
532 src/AIModel/Makefile \
533 src/MultiPlayer/Makefile \
534 src/Navaids/Makefile \
535 src/Network/Makefile \
536 src/Objects/Makefile \
537 src/Replay/Makefile \
538 src/Scenery/Makefile \
539 src/Scripting/Makefile \
541 src/Systems/Makefile \
543 src/Traffic/Makefile \
546 utils/GPSsmooth/Makefile \
547 utils/js_server/Makefile \
548 utils/Modeller/Makefile \
549 utils/TerraSync/Makefile \
553 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
556 echo "Configure Summary"
557 echo "================="
559 echo "Prefix: $prefix"
561 if test "x$with_logging" != "x"; then
562 echo "Debug messages: $with_logging"
564 echo "Debug messages: yes"
567 echo -n "Automake version: "
568 automake --version | head -1
570 if test "x$with_multiplayer" != "xno"; then
571 echo "Building with multiplayer support"
574 if test "x$with_threads" = "xyes"; then
580 if test "x$enable_sp_fdms" != "xno"; then
581 echo "Include special purpose flight models: yes"
583 echo "Include special purpose flight models: no"