]> git.mxchange.org Git - flightgear.git/blob - configure.ac
Sync. with JSBSim (CVS) again
[flightgear.git] / configure.ac
1 dnl Process this file with autoget.sh to produce a working configure
2 dnl script.
3
4 AC_INIT
5 AC_CONFIG_SRCDIR([src/Aircraft/aircraft.cxx])
6
7 dnl Require at least automake 2.52
8 AC_PREREQ(2.52)
9
10 dnl Initialize the automake stuff
11 dnl set the $host variable based on local machine/os
12 AC_CANONICAL_TARGET
13 AM_INIT_AUTOMAKE(FlightGear, 1.9.1)
14
15 dnl Checks for programs.
16 AC_PROG_MAKE_SET
17 AC_PROG_CC
18 AC_PROG_CPP
19 AC_PROG_CXX
20 AC_PROG_RANLIB
21 AC_PROG_INSTALL
22 AC_PROG_LN_S
23 AX_BOOST_BASE([1.34.0])
24
25 if test "x$BOOST_CPPFLAGS" != "x-I/usr/include" ; then
26    CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
27 fi
28
29 # specify the simgear location
30 AC_ARG_WITH(simgear, [  --with-simgear=PREFIX   Specify the prefix path to SimGear])
31
32 if test "x$with_simgear" != "x" ; then
33     echo "SimGear prefix path is $with_simgear"
34     EXTRA_DIRS="${EXTRA_DIRS} $with_simgear"
35     CXXFLAGS="$CXXFLAGS -I$with_simgear"
36 fi
37
38 # specify the plib location
39 AC_ARG_WITH(plib, [  --with-plib=PREFIX      Specify the prefix path to plib])
40
41 if test "x$with_plib" != "x" ; then
42     echo "plib prefix is $with_plib"
43     EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
44 fi
45
46 # specify the osg location
47 AC_ARG_WITH(osg, [  --with-osg=PREFIX       Specify the prefix path to osg])
48
49 if test "x$with_osg" != "x" ; then
50     echo "osg prefix is $with_osg"
51     EXTRA_DIRS="${EXTRA_DIRS} $with_osg"
52 fi
53
54 dnl Determine an extra directories to add to include/lib search paths
55 case "${host}" in
56 *-apple-darwin* | *-*-mingw32*)
57     echo no EXTRA_DIRS for $host
58     ;;
59
60 *-*-cygwin*)
61     if test -d /usr/local ; then
62         EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
63     fi
64     ;;
65
66 *)
67     if test -d /usr/X11R6 ; then
68         EXTRA_DIR1="/usr/X11R6"
69     fi
70     if test -d /opt/X11R6 ; then
71         EXTRA_DIR2="/opt/X11R6"
72     fi
73     EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2 /usr/local"
74     ;;
75
76 esac
77 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
78
79
80 case "${host}" in
81 *-*-irix*)
82     if test "$CXX" = "CC"; then
83         AR="CC -ar"
84         ARFLAGS="-o"
85         CXXFLAGS="$CXXFLAGS -c99 -I$with_simgear/include/simgear/compatibility"
86         CFLAGS="$CFLAGS -c99"
87     else
88         AR="ar"
89         ARFLAGS="cru"
90     fi
91     ;;
92 *)
93     AR="ar"
94     ARFLAGS="cru"
95     ;;
96 esac
97 AC_SUBST(AR)
98 AC_SUBST(ARFLAGS)
99
100 dnl set logging; default value of with_logging=yes
101 AC_ARG_WITH(logging, [  --with-logging          Include logging output (default)])
102 if test "x$with_logging" = "xno" ; then
103     AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
104 fi
105
106 AC_ARG_ENABLE(sp_fdms, [  --enable-sp-fdms               Include special purpose Flight Models], [enable_sp_fdms="$enableval"] )
107 if test "x$enable_sp_fdms" != "xno"; then
108     AC_DEFINE([ENABLE_SP_FDM], 1, [Define to include special purpose FDMs])
109 else
110     AC_DEFINE([ENABLE_SP_FDM], 0, [Define to include special purpose FDMs])
111 fi
112 AM_CONDITIONAL(ENABLE_SP_FDM, test "x$enable_sp_fdms" != "xno")
113
114
115 dnl EXPERIMENTAL generic event driven input device
116 # defaults to no
117 AC_ARG_WITH(eventinput, [  --with-eventinput       Include event driven input (EXPERIMENTAL) [default=no]], [], [with_eventinput=no])
118 if test "x$with_eventinput" = "xyes"; then
119     AC_DEFINE([WITH_EVENTINPUT], 1, [Define to enable generic event driven input device])
120 fi
121 AM_CONDITIONAL(WITH_EVENTINPUT, test "x$with_eventinput" = "xyes")
122
123 dnl Thread related checks
124 # defaults to yes
125 AC_ARG_WITH(threads, [  --with-threads          Include tile loading threads [default=yes]], [], [with_threads=yes])
126 if test "x$with_threads" = "xyes"; then
127     AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
128     CXXFLAGS="$CXXFLAGS -D_REENTRANT"
129     CFLAGS="$CFLAGS -D_REENTRANT"
130 fi
131 AC_CHECK_HEADER(pthread.h)
132 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
133
134 dnl Used by JSBSim to conditionally compile in fgfs interface code
135 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
136
137 # Check for MS Windows environment
138 AC_CHECK_HEADER(windows.h)
139
140 dnl Using AM_CONDITIONAL is a step out of the protected little 
141 dnl automake fold so it is potentially dangerous.  But, we are
142 dnl beginning to run into cases where the standard checks are not
143 dnl enough.  AM_CONDITIONALS are then referenced to conditionally
144 dnl build a Makefile.in from a Makefile.am which lets us define custom
145 dnl includes, compile alternative source files, etc.
146
147 dnl Check for external variables daylight and timezone.
148 AC_EXT_DAYLIGHT
149 if test "$have_daylight" = yes; then
150     AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
151 fi
152
153 AC_EXT_TIMEZONE
154 if test "$have_timezone" = yes; then
155     AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
156 fi
157
158
159 dnl add joystick support libraries
160 dnl search for FreeBSD library
161 AC_SEARCH_LIBS(hid_init, usbhid)
162 joystick_LIBS="$LIBS"
163 LIBS=""
164
165
166 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
167 dnl just assuming we have audio support on all platform.  We can
168 dnl depend on plib to hide the details.
169 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
170
171 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
172 dnl to use it if it is.
173 case "${host}" in
174 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
175     echo no fancy X11 check
176     ;;
177
178 *)
179     AC_PATH_XTRA
180     ;;
181
182 esac
183
184 dnl Checks for libraries.
185
186 dnl Thread related checks
187 AC_SEARCH_LIBS(pthread_create, [pthread c_r])
188 if test "x$ac_cv_header_pthread_h" = "xyes"; then
189   if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
190     CXXFLAGS="-pthread $CXXFLAGS"
191     CFLAGS="-pthread $CFLAGS"
192   fi
193 fi
194
195 thread_LIBS="$LIBS"
196 LIBS=""
197
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)
202
203 network_LIBS="$LIBS"
204 LIBS=""
205
206 dnl check for some default libraries
207 AC_SEARCH_LIBS(sqrt, [am ffm fm fastm m])
208 AC_SEARCH_LIBS(ceil, m)
209 AC_SEARCH_LIBS(dlclose, dl)
210 AC_SEARCH_LIBS(clock_gettime, rt)
211
212 base_LIBS="$LIBS"
213
214 dnl Check for SDL or glut if enabled.
215 AC_ARG_ENABLE(osgviewer, [  --enable-osgviewer                  Configure to use osgViewer(default)], [enable_osgviewer="$enableval"])
216 AC_ARG_ENABLE(sdl,  [  --enable-sdl                   Configure to use SDL], [enable_sdl="$enableval"])
217 AC_ARG_ENABLE(glut, [  --enable-glut                  Configure to use GLUT], [enable_glut="$enableval"])
218 AM_CONDITIONAL(USE_SDL, test "x$enable_sdl" = "xyes")
219 AM_CONDITIONAL(USE_GLUT, test "x$enable_glut" = "xyes")
220 if test "x$enable_sdl" != "xyes" -a "x$enable_glut" != "xyes" -a "x$enable_osgviewer" != "xno"; then
221    enable_osgviewer="yes"
222 fi
223 if test \( "x$enable_osgviewer" = "xyes" \
224    -a \( "x$enable_sdl" = "xyes" -o "x$enable_glut" = "xyes" \) \) \
225    -o \( "x$enable_sdl" = "xyes" -a "x$enable_glut" = "xyes" \); then
226    echo " Only one of --enable-osgviewer, --enable-sdl, or --enable -glut may"
227    echo " be supplied."
228    exit
229 fi
230 AC_DEFINE([PU_USE_NONE], 1, [Define to use application's pu callbacks])
231
232 AC_ARG_ENABLE(osgdebug, [  --enable-osgdebug              Use OSG debug libraries], [enable_osgdebug="$enableval"])
233
234 dnl check for OpenGL related libraries
235 case "${host}" in
236 *-*-cygwin* | *-*-mingw32*)
237     dnl CygWin under Windoze.
238
239     echo Win32 specific hacks...
240     AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
241     AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
242
243     if test "x$enable_sdl" = "xyes"; then
244         AC_SEARCH_LIBS(SDL_Init, SDL)
245     else
246         LIBS="$LIBS -lglut32"
247     fi
248
249     LIBS="$LIBS -lglu32 -lopengl32 -luser32 -lgdi32"
250     joystick_LIBS="$joystick_LIBS -lwinmm"
251
252     dnl add -lwsock32 for mingwin
253     case "${host}" in
254     *-*-mingw32*)
255         echo "********** BUILDING FOR MINGW32 *************"
256         network_LIBS="$network_LIBS -lws2_32"
257         ;;
258     esac
259
260     echo "Will link apps with $LIBS"
261     ;;
262
263
264 *-apple-darwin*)
265     dnl Mac OS X
266
267     LIBS="$LIBS -framework GLUT -framework OpenGL -framework AGL -framework Carbon -lobjc"
268     joystick_LIBS="$joystick_LIBS -framework IOKit -framework CoreFoundation"
269     ;;
270
271 *)
272     dnl X-Windows based machines
273
274     dnl Skip X11 library tests if requested.
275     if test "x$no_x" != "xyes"; then
276         AC_SEARCH_LIBS(XCreateWindow, X11)
277         AC_SEARCH_LIBS(XShmCreateImage, Xext)
278         AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
279         AC_SEARCH_LIBS(IceOpenConnection, ICE)
280         AC_SEARCH_LIBS(SmcOpenConnection, SM)
281         AC_SEARCH_LIBS(XtMalloc, Xt)
282         AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
283     fi
284
285     AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
286     if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
287         dnl if GLcore found, then also check for GL
288         AC_SEARCH_LIBS(glXCreateContext, GL)
289     fi
290
291     dnl if using mesa, check for xmesa.h
292     if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
293         AC_CHECK_HEADER(GL/fxmesa.h)
294         if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
295             AC_DEFINE([XMESA], 1, [Define for fxmesa])
296             AC_DEFINE([FX], 1, [Define for fxmesa])
297         fi
298     fi
299
300     AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
301     AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
302     if test "x$enable_sdl" = "xyes"; then
303         AC_SEARCH_LIBS(SDL_Init, SDL)
304     fi
305     ;;
306
307 esac
308
309 opengl_LIBS="$LIBS"
310 LIBS="$base_LIBS $joystick_LIBS"
311
312 dnl check for OpenAL libraries
313 OPENAL_OK="no"
314 ALUT_OK="no"
315 case "${host}" in
316 *-*-cygwin* | *-*-mingw32*)
317     dnl CygWin under Windoze.
318     INCLUDES="$INCLUDES -I/usr/local/include/"
319     LIBS="$LIBS -L/usr/local/lib"
320     AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal ] )
321     AC_SEARCH_LIBS(alutInit, [ openal32 ALut alut ] )
322     LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
323     openal_LIBS="$LIBS"
324     OPENAL_OK="$ac_cv_search_alGenBuffers"
325     ALUT_OK="$ac_cv_search_alutInit"
326     ;;
327
328 *-apple-darwin*)
329     dnl Mac OS X
330
331     LIBS="$LIBS -framework IOKit -framework OpenAL"
332     openal_LIBS="$LIBS"
333     # not sure how to test if OpenAL exists on MacOS (does it come by default?)
334     OPENAL_OK="yes"
335     ALUT_OK="yes"
336     ;;
337
338 *)
339     dnl default unix style machines
340
341     save_LIBS=$LIBS
342     LIBS="$LIBS $thread_LIBS"
343     AC_SEARCH_LIBS(alGenBuffers, openal)
344     AC_SEARCH_LIBS(alutInit, [ alut openal ] )
345     OPENAL_OK="$ac_cv_search_alGenBuffers"
346     ALUT_OK="$ac_cv_search_alutInit"
347     openal_LIBS="$LIBS"
348     LIBS=$save_LIBS
349     ;;
350
351 esac
352
353 if test "$OPENAL_OK" == "no"; then
354     echo
355     echo "You *must* have the openal library installed on your system to build"
356     echo "SimGear!"
357     echo
358     echo "Please see README.OpenAL for more details."
359     echo
360     echo "configure aborted."
361     exit
362 fi
363
364 if test "$ALUT_OK" == "no"; then
365     echo
366     echo "You *must* have the alut library installed on your system to build"
367     echo "SimGear!"
368     echo
369     echo "Please see README.OpenAL for more details."
370     echo
371     echo "configure aborted."
372     exit
373 fi
374
375
376 LIBS="$base_LIBS"
377
378 AC_SUBST(base_LIBS)
379 AC_SUBST(openal_LIBS)
380 AC_SUBST(opengl_LIBS)
381 AC_SUBST(thread_LIBS)
382 AC_SUBST(network_LIBS)
383 AC_SUBST(joystick_LIBS)
384
385 # The following are C++ items that need to be tested for with the c++
386 # compiler
387
388 AC_LANG_PUSH(C++)
389
390 dnl Check for the presence of SimGear
391 if test "x$with_simgear" != "x"; then
392 AC_CHECK_HEADER($with_simgear/include/simgear/version.h, [ac_cv_header_simgear_version_h=yes], [ac_cv_header_simgear_version_h=no])
393 else
394 AC_CHECK_HEADER(simgear/version.h)
395 fi
396 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
397     echo
398     echo "You *must* have the SimGear support library installed on your system"
399     echo "to build the FGFS simulator!"
400     echo
401     echo "Please see README.SimGear for more details."
402     echo
403     echo "configure aborted."
404     exit
405 fi
406
407 AC_MSG_CHECKING([for SimGear 1.9.0 or newer])
408 AC_TRY_RUN([
409 #include <stdio.h>
410
411 #include <simgear/version.h>
412
413 #define STRINGIFY(X) XSTRINGIFY(X)
414 #define XSTRINGIFY(X) #X
415
416 #define MIN_MAJOR 1
417 #define MIN_MINOR 9
418 #define MIN_MICRO 0
419
420 int main() {
421     int major, minor, micro;
422
423     /* printf("%d.%d.%d or greater, ", MIN_MAJOR, MIN_MINOR, MIN_MICRO); */
424     printf("[found %s] ... ", STRINGIFY(SIMGEAR_VERSION));
425
426     sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, &micro );
427
428     if ( (major < MIN_MAJOR) ||
429          (major == MIN_MAJOR && minor < MIN_MINOR) ||
430          (major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO) ) {
431          return -1;
432     }
433
434     return 0;
435 }
436
437 ],
438   AC_MSG_RESULT(yes),
439   [AC_MSG_RESULT(wrong version);
440    AC_MSG_ERROR([Install latest SimGear first...])],
441   AC_MSG_RESULT(yes)
442 )
443
444 LIBS="$saved_LIBS"
445
446 dnl Check if SimGear was built with Norman's JPEG factory support
447 if test "x$with_simgear" != "x"; then
448 AC_CHECK_HEADER($with_simgear/include/simgear/screen/jpgfactory.hxx,[ac_cv_header_simgear_screen_jpgfactory_hxx=yes],[ac_cv_header_simgear_screen_jpgfactory_hxx=no])
449 else
450 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
451 fi
452 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
453     AC_CHECK_LIB(jpeg, jpeg_start_compress)
454     if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
455         echo
456         echo "The JPEG factory code was built and installed with SimGear."
457         echo "However it appears the libjpeg is no longer installed."
458         echo "You need to install libjpeg or remove jpgfactory support from"
459         echo "SimGear"
460         echo
461         echo "libjpeg is available at :"
462         echo "  ftp://ftp.uu.net in the directory graphics/jpeg"
463         exit 1
464     fi
465     AC_DEFINE([FG_JPEG_SERVER], 1,
466               [Define to build with jpeg screen shot server])
467 fi
468 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
469
470 # Check for "plib" without which we cannot go on
471 AC_CHECK_HEADER(plib/ul.h)
472 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
473     echo
474     echo "You *must* have the plib library installed on your system to build"
475     echo "the FGFS simulator!"
476     echo
477     echo "Please see README.plib for more details."
478     echo
479     echo "configure aborted."
480     exit
481 fi
482
483 AC_MSG_CHECKING([for plib 1.8.5 or newer])
484 AC_TRY_RUN([
485 #include <plib/ul.h>
486
487 #define MIN_PLIB_VERSION 185
488
489 int main() {
490     int major, minor, micro;
491
492     if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
493          return -1;
494     }
495
496     return 0;
497 }
498
499 ],
500   AC_MSG_RESULT(yes),
501   [AC_MSG_RESULT(wrong version);
502    AC_MSG_ERROR([Install plib 1.8.5 or later first...])],
503   AC_MSG_RESULT(yes)
504 )
505
506 dnl If we get here then plib is available, so force use of plib
507 dnl joystick lib
508 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
509
510 AC_CHECK_HEADER(osg/Version)
511 if test "x$ac_cv_header_osg_Version" != "xyes"; then
512     echo
513     echo "You *must* have the OpenSceneGraph support library installed on your system"
514     echo "to build the FGFS simulator!"
515     echo
516     echo "Please see README.OSG for more details."
517     echo
518     echo "configure aborted."
519     exit
520 fi
521
522 # Find the OSG libraries.  Note special handling for OS X frameworks
523 case "${host}" in
524 *-apple-darwin*)
525
526     dnl Thank you Christian Bauer from SheepSaver
527     dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
528     AC_DEFUN([AC_CHECK_FRAMEWORK], [
529     AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
530     AC_CACHE_CHECK([whether compiler supports framework $1],
531         ac_Framework, [
532         saved_LIBS="$LIBS"
533         LIBS="$LIBS -framework $1"
534         AC_TRY_LINK(
535         [$2], [],
536         [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
537         )
538     ])
539     AS_IF([test AS_VAR_GET(ac_Framework) = yes],
540         [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
541     )
542     AS_VAR_POPDEF([ac_Framework])dnl
543     ])
544
545     if test "x$enable_osgdebug" = "xyes"; then
546         AC_CHECK_LIB(osgViewerd,osgViewerGetVersion)
547         AC_CHECK_LIB(osgGAd,osgGAGetVersion)
548         AC_CHECK_LIB(osgTextd,osgTextGetVersion)
549         LIBS="$LIBS -losgFXd"
550         AC_CHECK_LIB(osgUtild,osgUtilGetVersion)
551         AC_CHECK_LIB(osgDBd,osgDBGetVersion)
552         AC_CHECK_LIB(osgSimd,osgSimGetVersion)
553         AC_CHECK_LIB(osgParticled,osgParticleGetVersion)
554         AC_CHECK_LIB(osgd,osgGetVersion)
555         AC_CHECK_LIB(OpenThreadsd,OpenThreadsGetVersion)
556     else
557         AC_CHECK_FRAMEWORK(osgViewer, [#include <osgViewer/Version>])
558         AC_CHECK_FRAMEWORK(osgGA, [#include <osgGA/Version>])
559         AC_CHECK_FRAMEWORK(osgText, [#include <osgText/Version>])
560         AC_CHECK_FRAMEWORK(osgFX, [#include <osgFX/AnisotropicLighting>])
561         AC_CHECK_FRAMEWORK(osgUtil, [#include <osgUtil/Version>])
562         AC_CHECK_FRAMEWORK(osgDB, [#include <osgDB/Version>])
563         AC_CHECK_FRAMEWORK(osgSim, [#include <osgSim/Version>])
564         AC_CHECK_FRAMEWORK(osgParticle, [#include <osgParticle/Version>])
565         AC_CHECK_FRAMEWORK(osg, [#include <osg/Version>])
566         AC_CHECK_FRAMEWORK(OpenThreads, [#include <OpenThreads/Version>])
567     fi
568     ;;
569 *)
570     if test "x$enable_osgdebug" = "xyes"; then
571         AC_CHECK_LIB(OpenThreadsd,OpenThreadsGetVersion)
572         AC_CHECK_LIB(osgd,osgGetVersion)
573         AC_CHECK_LIB(osgUtild,osgUtilGetVersion)
574         AC_CHECK_LIB(osgDBd,osgDBGetVersion)
575         AC_CHECK_LIB(osgTextd,osgTextGetVersion)
576         AC_CHECK_LIB(osgGAd,osgGAGetVersion)
577         AC_CHECK_LIB(osgViewerd,osgViewerGetVersion)
578         AC_CHECK_LIB(osgSimd,osgSimGetVersion)
579         AC_CHECK_LIB(osgParticled,osgParticleGetVersion)
580         LIBS="$LIBS -losgFXd"
581     else
582         AC_CHECK_LIB(OpenThreads,OpenThreadsGetVersion)
583         AC_CHECK_LIB(osg,osgGetVersion)
584         AC_CHECK_LIB(osgUtil,osgUtilGetVersion)
585         AC_CHECK_LIB(osgDB,osgDBGetVersion)
586         AC_CHECK_LIB(osgText,osgTextGetVersion)
587         AC_CHECK_LIB(osgGA,osgGAGetVersion)
588         AC_CHECK_LIB(osgViewer,osgViewerGetVersion)
589         AC_CHECK_LIB(osgSim,osgSimGetVersion)
590         AC_CHECK_LIB(osgParticle,osgParticleGetVersion)
591         LIBS="$LIBS -losgFX"
592     fi
593     ;;
594 esac
595
596 AC_LANG_POP
597
598 dnl Check for system installed zlib
599 AC_CHECK_HEADER(zlib.h)
600 if test "x$ac_cv_header_zlib_h" != "xyes"; then
601     echo
602     echo "zlib library not found."
603     echo
604     echo "If your OS does not provide an installable package for zlib"
605     echo "you will have to compile and install it first yourself.  A copy"
606     echo "of zlib-1.1.4.tar.gz is included with SimGear.  You will"
607     echo "have to untar this source code, and follow it's included instructions"
608     echo "to compile and install on your system."
609     echo
610     echo "configure aborted."
611     echo
612 fi
613
614 dnl Check for Subversion library support
615 save_LIBS=$LIBS
616 save_CPPFLAGS=$CPPFLAGS
617 LIBS=""
618 CPPFLAGS="-I/usr/include/subversion-1 `apr-1-config --includes`"
619 AC_CHECK_LIB(svn_client-1, svn_client_checkout3)
620 AC_CHECK_HEADERS([svn_client.h])
621 if test "x$ac_cv_header_svn_client_h" != "xyes"; then
622   echo "TerraSync will shell out for command line subversion"
623   svn_LIBS=""
624   svn_CPPFLAGS=""
625 else
626   echo "TerraSync will use integrated subversion library"
627   AC_SEARCH_LIBS(svn_client_checkout, svn_client-1)
628   svn_LIBS=$LIBS
629   svn_CPPFLAGS=$CPPFLAGS
630   AC_SUBST(svn_LIBS)
631   AC_SUBST(svn_CPPFLAGS)
632 fi
633 LIBS=$save_LIBS
634 CPPFLAGS=$save_CPPFLAGS
635
636 AC_MSG_CHECKING([for feenableexcept])
637 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _GNU_SOURCE
638 #include <fenv.h>]], [[feenableexcept(FE_DIVBYZERO)]])],
639 [AC_DEFINE([HAVE_FEENABLEEXCEPT], 1, [define if system has fenableexcept])],
640 AC_MSG_RESULT([yes]),
641 AC_MSG_RESULT([no]))
642
643 dnl Checks for header files.
644 AC_HEADER_STDC
645 AC_CHECK_HEADERS( \
646         fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
647         sys/time.h sys/timeb.h unistd.h windows.h values.h )
648
649 dnl Checks for typedefs, structures, and compiler characteristics.
650 AC_C_CONST
651 AC_TYPE_SIZE_T
652 AC_HEADER_TIME
653 AC_STRUCT_TM
654
655 dnl Checks for library functions.
656 old_LIBS=$LIBS
657 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
658 AC_TYPE_SIGNAL
659 AC_FUNC_VPRINTF
660 AC_CHECK_FUNCS( [ \
661         ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
662         random drand48 setitimer getitimer signal GetLocalTime rint getrusage \
663         truncf ] )
664 LIBS=$old_LIBS
665
666 AM_CONFIG_HEADER(src/Include/config.h)
667
668 AC_CONFIG_FILES([ \
669         Makefile \
670         man/Makefile \
671         man/est-epsilon.1 \
672         man/fgfs.1 \
673         man/fgjs.1 \
674         man/gl-info.1 \
675         man/js_demo.1 \
676         man/pstest.1 \
677         scripts/Makefile \
678         scripts/debug/Makefile \
679         scripts/perl/Makefile \
680         scripts/perl/examples/Makefile \
681         scripts/python/Makefile \
682         src/Makefile \
683         src/Include/Makefile \
684         src/Include/version.h \
685         src/Include/config.h-msvc6 \
686         src/Include/config.h-msvc71 \
687         src/Include/config.h-msvc8 \
688         src/Aircraft/Makefile \
689         src/Airports/Makefile \
690         src/ATC/Makefile \
691         src/ATCDCL/Makefile \
692         src/Autopilot/Makefile \
693         src/Cockpit/Makefile \
694         src/Cockpit/built_in/Makefile \
695         src/Environment/Makefile \
696         src/FDM/ExternalNet/Makefile \
697         src/FDM/ExternalPipe/Makefile \
698         src/FDM/JSBSim/Makefile \
699         src/FDM/JSBSim/initialization/Makefile \
700         src/FDM/JSBSim/input_output/Makefile \
701         src/FDM/JSBSim/math/Makefile \
702         src/FDM/JSBSim/models/Makefile \
703         src/FDM/JSBSim/models/flight_control/Makefile \
704         src/FDM/JSBSim/models/atmosphere/Makefile \
705         src/FDM/JSBSim/models/propulsion/Makefile \
706         src/FDM/LaRCsim/Makefile \
707         src/FDM/SP/Makefile \
708         src/FDM/UIUCModel/Makefile \
709         src/FDM/YASim/Makefile \
710         src/FDM/Makefile \
711         src/GUI/Makefile \
712         src/Input/Makefile \
713         src/Instrumentation/Makefile \
714         src/Instrumentation/KLN89/Makefile \
715         src/Instrumentation/HUD/Makefile \
716         src/Main/Makefile \
717         src/Main/runfgfs \
718         src/Main/runfgfs.bat \
719         src/Model/Makefile \
720         src/AIModel/Makefile \
721         src/MultiPlayer/Makefile \
722         src/Navaids/Makefile \
723         src/Network/Makefile \
724         src/Scenery/Makefile \
725         src/Scripting/Makefile \
726         src/Sound/Makefile \
727         src/Systems/Makefile \
728         src/Time/Makefile \
729         src/Traffic/Makefile \
730         tests/Makefile \
731         utils/Makefile \
732         utils/GPSsmooth/Makefile \
733         utils/fgadmin/Makefile
734         utils/fgadmin/src/Makefile \
735         utils/js_server/Makefile \
736         utils/Modeller/Makefile \
737         utils/propmerge/Makefile \
738         utils/TerraSync/Makefile \
739         utils/xmlgrep/Makefile \
740         utils/fgviewer/Makefile \
741 ])
742 AC_OUTPUT
743
744 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
745
746 echo ""
747 echo "Configure Summary"
748 echo "================="
749
750 echo "Prefix: $prefix"
751
752 if test "x$with_logging" != "x"; then
753     echo "Debug messages: $with_logging"
754 else
755     echo "Debug messages: yes"
756 fi
757
758 echo -n "Automake version: "
759 automake --version | head -n 1
760
761 if test "x$with_multiplayer" != "xno"; then
762     echo "Building with multiplayer support"
763 fi
764
765 if test "x$with_threads" = "xyes"; then
766     echo "threads: yes"
767 else
768     echo "threads: no"
769 fi
770
771 if test "x$with_eventinput" = "xyes"; then
772     echo "event input: yes"
773 else
774     echo "event input: no"
775 fi
776
777 if test "x$enable_sp_fdms" != "xno"; then
778     echo "Include special purpose flight models: yes"
779 else
780     echo "Include special purpose flight models: no"
781 fi
782