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