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