]> git.mxchange.org Git - flightgear.git/blob - configure.ac
Merge branch 'next' of gitorious.org:fg/flightgear into next
[flightgear.git] / configure.ac
1 dnl Process this file with autogen.sh to produce a working configure
2 dnl script.
3
4 AC_INIT(FlightGear, m4_esyscmd([cat ./version | tr -d '\n']), [http://www.flightgear.org])
5
6 dnl Ensure touching the version causes autoconf to re-run
7 AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/version'])
8
9 AC_CONFIG_SRCDIR([src/Airports/simple.cxx])
10
11 dnl Require at least automake 2.52
12 AC_PREREQ(2.52)
13
14 dnl Initialize the automake stuff
15 dnl set the $host variable based on local machine/os
16 AC_CANONICAL_TARGET
17 AM_INIT_AUTOMAKE([dist-bzip2])
18
19 # variables for version.h
20 AC_DEFINE([HAVE_VERSION_H], 1, [Set if version.h is generated])
21
22 # are we running under Hudson? (defines BUILD_ID, BUILD_NUMBER in the environment)
23 if test "x$BUILD_ID" != "x" ; then
24     AC_SUBST([HUDSON_BUILD_ID], $BUILD_ID)
25     AC_SUBST([HUDSON_BUILD_NUMBER], $BUILD_NUMBER)
26 else
27     AC_SUBST([HUDSON_BUILD_ID], [none])
28     AC_SUBST([HUDSON_BUILD_NUMBER], 0)
29 fi
30
31 AC_CHECK_PROG([HAVE_GIT], git, 1)
32 if test "x$HAVE_GIT" != "x" ; then
33     # git might be installed, but we might be building from a tarball
34     if git rev-parse ; then
35         AC_SUBST([REVISION], `git rev-parse HEAD`)
36     else
37         AC_SUBST([REVISION], [none])
38     fi
39 else
40     AC_SUBST([REVISION], [none])
41 fi
42
43 dnl Checks for programs.
44 AC_PROG_MAKE_SET
45 AC_PROG_CC
46 AC_PROG_CPP
47 AC_PROG_CXX
48 AC_PROG_CXXCPP
49 AC_PROG_RANLIB
50 AC_PROG_INSTALL
51 AC_PROG_LN_S
52 AX_BOOST_BASE([1.37.0])
53
54 # Show all compiler warnings by default
55 CXXFLAGS="$CXXFLAGS -Wall"
56 CFLAGS="$CFLAGS -Wall"
57
58 if test "x$BOOST_CPPFLAGS" != "x-I/usr/include" ; then
59    CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
60 fi
61
62 # specify the simgear location
63 AC_ARG_WITH(simgear, [  --with-simgear=PREFIX   Specify the prefix path to SimGear])
64
65 if test "x$with_simgear" != "x" ; then
66     echo "SimGear prefix path is $with_simgear"
67     EXTRA_DIRS="${EXTRA_DIRS} $with_simgear"
68     CXXFLAGS="$CXXFLAGS -I$with_simgear"
69 fi
70
71 # specify the plib location
72 AC_ARG_WITH(plib, [  --with-plib=PREFIX      Specify the prefix path to plib])
73
74 if test "x$with_plib" != "x" ; then
75     echo "plib prefix is $with_plib"
76     EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
77 fi
78
79 # specify the osg location
80 AC_ARG_WITH(osg, [  --with-osg=PREFIX       Specify the prefix path to osg])
81
82 if test "x$with_osg" != "x" ; then
83     echo "osg prefix is $with_osg"
84     EXTRA_DIRS="${EXTRA_DIRS} $with_osg"
85 fi
86
87 # specify framework related locations for Mac OS X
88 case "${host}" in
89 *-apple-darwin*)
90
91     dnl Thank you Christian Bauer from SheepSaver
92     dnl Modified by Tatsuhiro Nishioka for accepting a given framework path
93     dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES, $3=FRAMEWORK_PATH, $4=ACTION_IF_FOUND) ;
94     AC_DEFUN([AC_CHECK_FRAMEWORK], [
95     AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
96     AC_CACHE_CHECK([whether compiler supports framework $1],
97         ac_Framework, [
98         saved_LIBS="$LIBS"
99         FRAMEWORKS="$FRAMEWORKS -framework $1"
100         if test "$3" = ""; then
101             FRAMEWORKS="$FRAMEWORKS $ADD2LD"
102         elif test "`echo $FRAMEWORKS | grep -- -F$3`" = ""; then
103             FRAMEWORKS="$FRAMEWORKS -F$3"
104             CXXFLAGS="$CXXFLAGS -F$3"
105             CCFLAGS="$CCFLAGS -F$3"
106             CPPFLAGS="$CPPFLAGS -F$3"
107             dnl This is needed for AC_TRY_LINK when a framework path is specified
108             export DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}:$3"
109         fi
110         AC_TRY_LINK(
111         [$2], [],
112         [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
113         )
114     ])
115     AS_IF([test AS_VAR_GET(ac_Framework) = yes],
116         [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
117     )
118     AS_IF([test AS_VAR_GET(ac_Framework) = yes], $4)
119     AS_VAR_POPDEF([ac_Framework])dnl
120     ])
121
122     # Mac OS X specific configure options
123     AC_ARG_WITH(cocoa_framework, [  --with-cocoa-framework         Use the Cocoa rather than Carbon])
124     if test "x$with_cocoa_framework" != "x" ; then
125         macAPI=Cocoa
126         AC_MSG_NOTICE([Using Cocoa framework])
127     else
128         macAPI=Carbon
129         AC_MSG_NOTICE([Using Carbon framework])
130     fi
131
132     AC_ARG_WITH(osg_framework, [  --with-osg-framework=PREFIX    Specify the prefix path to osg frameworks [default=standard framework paths]])
133     if test "x$with_osg_framework" != "x" ; then
134         echo "osg prefix is $with_osg_framework"
135         export DYLD_FRAMEWORK_PATH="$DYLD_FRAMEWORK_PATH:$with_osg_framework"
136     fi
137
138     AC_ARG_WITH(plib_framework, [  --with-plib-framework=PREFIX   Specify the prefix path to PLIB framework [default=standard framework paths]])
139     if test "x$with_plib_framework" != "x" ; then
140         echo "plib prefix is $with_plib_framework"
141         export DYLD_FRAMEWORK_PATH="$DYLD_FRAMEWORK_PATH:$with_plib_framework"
142     fi
143
144     AC_ARG_WITH(alut_framework, [  --with-alut-framework=PREFIX   Specify the prefix path to ALUT.framework ])
145     if test "x$with_alut_framework" != "x"; then
146         echo "ALUT framework prefix is $with_alut_framework"
147     fi
148
149     ;;
150 esac
151
152 dnl Determine an extra directories to add to include/lib search paths
153 case "${host}" in
154 *-apple-darwin* | *-*-mingw32*)
155     echo no EXTRA_DIRS for $host
156     ;;
157
158 *-*-cygwin*)
159     if test -d /usr/local ; then
160         EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
161     fi
162     ;;
163
164 *)
165     if test -d /usr/X11R6 ; then
166         EXTRA_DIR1="/usr/X11R6"
167     fi
168     if test -d /opt/X11R6 ; then
169         EXTRA_DIR2="/opt/X11R6"
170     fi
171     EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2 /usr/local"
172     ;;
173
174 esac
175 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
176
177
178 case "${host}" in
179 *-*-irix*)
180     if test "$CXX" = "CC"; then
181         AR="CC -ar"
182         ARFLAGS="-o"
183         CXXFLAGS="$CXXFLAGS -c99 -I$with_simgear/include/simgear/compatibility"
184         CFLAGS="$CFLAGS -c99"
185     else
186         AR="ar"
187         ARFLAGS="cru"
188     fi
189     ;;
190 *)
191     AR="ar"
192     ARFLAGS="cru"
193     ;;
194 esac
195 AC_SUBST(AR)
196 AC_SUBST(ARFLAGS)
197
198 dnl set logging; default value of with_logging=yes
199 AC_ARG_WITH(logging, [  --with-logging          Include logging output (default)])
200 if test "x$with_logging" = "xno" ; then
201     AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
202 fi
203
204 AC_ARG_ENABLE(sp_fdms, [  --enable-sp-fdms               Include special purpose Flight Models], [enable_sp_fdms="$enableval"] )
205 if test "x$enable_sp_fdms" != "xno"; then
206     AC_DEFINE([ENABLE_SP_FDM], 1, [Define to include special purpose FDMs])
207 else
208     AC_DEFINE([ENABLE_SP_FDM], 0, [Define to include special purpose FDMs])
209 fi
210 AM_CONDITIONAL(ENABLE_SP_FDM, test "x$enable_sp_fdms" != "xno")
211
212 dnl EXPERIMENTAL generic event driven input device
213 # defaults to no
214 AC_ARG_WITH(eventinput, [  --with-eventinput       Include event driven input (EXPERIMENTAL) [default=no]], [], [with_eventinput=no])
215 if test "x$with_eventinput" = "xyes"; then
216     AC_DEFINE([WITH_EVENTINPUT], 1, [Define to enable generic event driven input device])
217     case "${host}" in
218     dnl OS specific sources for event driven input
219     dnl Linux and Mac OS X are supported at this moment
220     *-apple-darwin*)
221         eventinput_EXTRA_OBJS="FGMacOSXEventInput.o"
222         eventinput_INCUDES=""
223         eventinput_LIBS=""
224         ;;
225     *linux*)
226         dnl
227         dnl FIXME: include paths for dbus are hard-coded at this moment.
228         dnl FIXME: these must be found in configure
229         dnl
230         eventinput_EXTRA_OBJS="FGLinuxEventInput.o"
231         eventinput_INCLUDES="-I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/lib/dbus-1.0/include"
232         eventinput_LIBS="-ldbus-1 -lhal"
233         ;;
234     *)
235         echo "Event driven input is not supported on ${host}."
236         ;;
237     esac
238     AC_SUBST(eventinput_EXTRA_OBJS)
239     AC_SUBST(eventinput_INCLUDES)
240     AC_SUBST(eventinput_LIBS)
241 fi
242 AM_CONDITIONAL(WITH_EVENTINPUT, test "x$with_eventinput" = "xyes")
243
244 dnl Thread related checks
245 # defaults to yes
246 AC_ARG_WITH(threads, [  --with-threads          Include tile loading threads [default=yes]], [], [with_threads=yes])
247 if test "x$with_threads" = "xyes"; then
248     AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
249     CXXFLAGS="$CXXFLAGS -D_REENTRANT"
250     CFLAGS="$CFLAGS -D_REENTRANT"
251 fi
252 AC_CHECK_HEADER(pthread.h)
253
254 dnl Configure HLA support
255 AC_ARG_WITH(rti13, [  --with-rti13[[=PATH]]     Enable the HLA/RTI 1.3 interface, set a path to the RTI13 RTI libraries (default=no)])
256 if test "x$with_rti13" != "xno"; then
257     if test "x$with_rti13" != "xyes"; then
258         AC_SUBST(HLA_CPPFLAGS, "-I$with_rti13/include")
259         AC_SUBST(HLA_LDFLAGS, "-L$with_rti13/lib")
260     fi
261
262     dnl Configure HLA support
263     AC_MSG_CHECKING([for simgear HLA/RTI support])
264     AC_LANG_PUSH(C++)
265     AC_TRY_COMPILE([
266         #include <simgear/hla/HLA13Federate.hxx>
267         ],[
268         new simgear::HLA13Federate;
269         ], simgear_hla=yes, simgear_hla=no)
270     AC_MSG_RESULT($simgear_hla)
271     if test "x$simgear_hla" = "xyes" ; then
272         AC_MSG_CHECKING([for hla libraries])
273         saved_LIBS="$LIBS"
274         saved_LDFLAGS="$LDFLAGS"
275         for rti13libs in "-lRTI-NG -lFedTime" "-lRTI-NGd -lFedTimed" ; do
276             if test "x$hla_libs" = "x" ; then
277                 LIBS="-lsghla13 -lsghla -lsgxml -lsgstructure -lsgmath -lsgdebug -lsgtiming $rti13libs -lrt $saved_LIBS"
278                 LDFLAGS="$HLA_LDFLAGS $saved_LDFLAGS"
279                 AC_TRY_LINK([
280                     #include <simgear/hla/HLA13Federate.hxx>
281                     ],[
282                     new simgear::HLA13Federate;
283                     ], [hla_libs="$rti13libs"; have_rti13=yes],)
284             fi
285         done
286         LIBS="$saved_LIBS"
287         LDFLAGS="$saved_LDFLAGS"
288         AC_MSG_RESULT($hla_libs)
289     fi
290     AC_LANG_POP()
291 fi
292 dnl Currently only the rti13 variant, but in the future also rti1516
293 AM_CONDITIONAL(WITH_HLA, test "x$have_rti13" = "xyes")
294 if test "x$have_rti13" = "xyes" ; then
295     AC_DEFINE([FG_HAVE_HLA], 1, [Define if HLA/RTI is available.])
296     AC_SUBST(HLA_LIBS, "-lsghla13 -lsghla $hla_libs")
297 fi
298
299 dnl EXPERIMENTAL fgpanel application
300 # defaults to no
301 AC_ARG_WITH(fgpanel, [  --with-fgpanel          Include fgpanel application (EXPERIMENTAL) [default=no]], [], [with_fgpanel=no])
302 if test "x$with_fgpanel" = "xyes"; then
303     AC_DEFINE([WITH_FGPANEL], 1, [Define to enable fgpanel application])
304 fi
305 AM_CONDITIONAL(WITH_FGPANEL, test "x$with_fgpanel" = "xyes")
306
307 dnl Used by JSBSim to conditionally compile in fgfs interface code
308 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
309
310 # Check for MS Windows environment
311 AC_CHECK_HEADER(windows.h)
312
313 dnl Using AM_CONDITIONAL is a step out of the protected little
314 dnl automake fold so it is potentially dangerous.  But, we are
315 dnl beginning to run into cases where the standard checks are not
316 dnl enough.  AM_CONDITIONALS are then referenced to conditionally
317 dnl build a Makefile.in from a Makefile.am which lets us define custom
318 dnl includes, compile alternative source files, etc.
319
320 dnl Check for external variables daylight and timezone.
321 AC_EXT_DAYLIGHT
322 if test "$have_daylight" = yes; then
323     AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
324 fi
325
326 AC_EXT_TIMEZONE
327 if test "$have_timezone" = yes; then
328     AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
329 fi
330
331
332 dnl add joystick support libraries
333 dnl search for FreeBSD library
334 AC_SEARCH_LIBS(hid_init, usbhid)
335 joystick_LIBS="$LIBS"
336 LIBS=""
337
338
339 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
340 dnl just assuming we have audio support on all platform.  We can
341 dnl depend on plib to hide the details.
342 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
343
344 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
345 dnl to use it if it is.
346 case "${host}" in
347 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
348     echo no fancy X11 check
349     ;;
350
351 *)
352     AC_PATH_XTRA
353     ;;
354
355 esac
356
357 dnl Checks for libraries.
358
359 dnl Thread related checks
360 AC_SEARCH_LIBS(pthread_create, [pthread c_r])
361 if test "x$ac_cv_header_pthread_h" = "xyes"; then
362   if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
363     CXXFLAGS="-pthread $CXXFLAGS"
364     CFLAGS="-pthread $CFLAGS"
365     LIBS="-lsgthreads $LIBS"
366   fi
367 fi
368
369 thread_LIBS="$LIBS"
370 LIBS=""
371
372 dnl search for network related libraries
373 AC_SEARCH_LIBS(inet_addr, xnet)
374 AC_SEARCH_LIBS(socket, socket)
375 AC_SEARCH_LIBS(main, nsl)
376
377 network_LIBS="$LIBS"
378 LIBS=""
379
380 dnl check for some default libraries
381 AC_SEARCH_LIBS(sqrt, [am ffm fm fastm m])
382 AC_SEARCH_LIBS(ceil, m)
383 AC_SEARCH_LIBS(dlclose, dl)
384 AC_SEARCH_LIBS(clock_gettime, rt)
385
386 base_LIBS="$LIBS"
387
388 dnl Check for SDL or glut if enabled.
389 AC_ARG_ENABLE(osgviewer, [  --enable-osgviewer             Configure to use osgViewer (default)], [enable_osgviewer="$enableval"])
390 AC_ARG_ENABLE(sdl,  [  --enable-sdl                   Configure to use SDL], [enable_sdl="$enableval"])
391 AC_ARG_ENABLE(glut, [  --enable-glut                  Configure to use GLUT], [enable_glut="$enableval"])
392 AM_CONDITIONAL(USE_SDL, test "x$enable_sdl" = "xyes")
393 AM_CONDITIONAL(USE_GLUT, test "x$enable_glut" = "xyes")
394 if test "x$enable_sdl" != "xyes" -a "x$enable_glut" != "xyes" -a "x$enable_osgviewer" != "xno"; then
395    enable_osgviewer="yes"
396 fi
397 if test \( "x$enable_osgviewer" = "xyes" \
398    -a \( "x$enable_sdl" = "xyes" -o "x$enable_glut" = "xyes" \) \) \
399    -o \( "x$enable_sdl" = "xyes" -a "x$enable_glut" = "xyes" \); then
400    echo " Only one of --enable-osgviewer, --enable-sdl, or --enable -glut may"
401    echo " be supplied."
402    exit
403 fi
404 AC_DEFINE([PU_USE_NONE], 1, [Define to use application's pu callbacks])
405
406 AC_ARG_ENABLE(osgdebug, [  --enable-osgdebug              Use OSG debug libraries], [enable_osgdebug="$enableval"])
407
408 dnl check for OpenGL related libraries
409 case "${host}" in
410 *-*-cygwin* | *-*-mingw32*)
411     dnl CygWin under Windoze.
412
413     echo Win32 specific hacks...
414     AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
415     AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
416
417     if test "x$enable_sdl" = "xyes"; then
418         AC_SEARCH_LIBS(SDL_Init, SDL)
419     else
420         LIBS="$LIBS -lglut32"
421     fi
422
423     LIBS="$LIBS -lglu32 -lopengl32 -luser32 -lgdi32"
424     joystick_LIBS="$joystick_LIBS -lwinmm"
425
426     dnl add -lwsock32 for mingwin
427     case "${host}" in
428     *-*-mingw32*)
429         echo "********** BUILDING FOR MINGW32 *************"
430         network_LIBS="$network_LIBS -lws2_32"
431         ;;
432     esac
433
434     echo "Will link apps with $LIBS"
435     ;;
436
437
438 *-apple-darwin*)
439     dnl Mac OS X
440
441     LIBS="$LIBS -framework GLUT -framework OpenGL -framework AGL -framework $macAPI -lobjc"
442     LDFLAGS="$LDFLAGS -headerpad_max_install_names"
443     joystick_LIBS="$joystick_LIBS -framework IOKit -framework CoreFoundation"
444     ;;
445
446 *)
447     dnl X-Windows based machines
448
449     dnl Skip X11 library tests if requested.
450     if test "x$no_x" != "xyes"; then
451         AC_SEARCH_LIBS(XCreateWindow, X11)
452         AC_SEARCH_LIBS(XShmCreateImage, Xext)
453         AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
454         AC_SEARCH_LIBS(IceOpenConnection, ICE)
455         AC_SEARCH_LIBS(SmcOpenConnection, SM)
456         AC_SEARCH_LIBS(XtMalloc, Xt)
457         AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
458     fi
459
460     AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
461     if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
462         dnl if GLcore found, then also check for GL
463         AC_SEARCH_LIBS(glXCreateContext, GL)
464     fi
465
466     dnl if using mesa, check for xmesa.h
467     if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
468         AC_CHECK_HEADER(GL/fxmesa.h)
469         if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
470             AC_DEFINE([XMESA], 1, [Define for fxmesa])
471             AC_DEFINE([FX], 1, [Define for fxmesa])
472         fi
473     fi
474
475     AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
476     AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
477     if test "x$enable_sdl" = "xyes"; then
478         AC_SEARCH_LIBS(SDL_Init, SDL)
479     fi
480     ;;
481
482 esac
483
484 opengl_LIBS="$LIBS"
485 LIBS="$base_LIBS $joystick_LIBS"
486
487 dnl check for OpenAL libraries
488 OPENAL_OK="no"
489 ALUT_OK="no"
490 case "${host}" in
491 *-*-cygwin* | *-*-mingw32*)
492     dnl CygWin under Windoze.
493     INCLUDES="$INCLUDES -I/usr/local/include/"
494     LIBS="$LIBS -L/usr/local/lib"
495     AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal 'openal -ldsound -lwinmm' ] )
496     AC_SEARCH_LIBS(alutInit, [ openal32 ALut alut ] )
497     LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
498     openal_LIBS="$LIBS"
499     OPENAL_OK="$ac_cv_search_alGenBuffers"
500     ALUT_OK="$ac_cv_search_alutInit"
501     ;;
502
503 *-apple-darwin*)
504     dnl Mac OS X
505
506     # Mac OS X has OpenAL.framework, but no ALUT, by default, so we
507     # require use of a non-Apple ALUT.framework which we provide
508     openal_LIBS="-framework IOKit -framework OpenAL"
509
510     AC_CHECK_FRAMEWORK(OpenAL, [#include <OpenAL/al.h>], "", [OPENAL_OK="yes"])
511     AC_CHECK_FRAMEWORK(ALUT, [#include <ALUT/alut.h>], $with_alut_framework, [
512         ALUT_OK="yes"
513         openal_LIBS="$openal_LIBS -framework ALUT"
514     ])
515     ;;
516
517 *)
518     dnl default unix style machines
519
520     save_LIBS=$LIBS
521     LIBS="$LIBS $thread_LIBS"
522     AC_SEARCH_LIBS(alGenBuffers, openal)
523     AC_SEARCH_LIBS(alutInit, [ alut openal ] )
524     OPENAL_OK="$ac_cv_search_alGenBuffers"
525     ALUT_OK="$ac_cv_search_alutInit"
526     openal_LIBS="$LIBS"
527     LIBS=$save_LIBS
528     ;;
529
530 esac
531
532 if test "$OPENAL_OK" == "no"; then
533     echo
534     echo "You *must* have the openal library installed on your system to build"
535     echo "SimGear!"
536     echo
537     echo "Please see README.OpenAL for more details."
538     echo
539     echo "configure aborted."
540     exit
541 fi
542
543 if test "$ALUT_OK" == "no"; then
544     echo
545     echo "You *must* have the alut library installed on your system to build"
546     echo "SimGear!"
547     echo
548     echo "Please see README.OpenAL for more details."
549     echo
550     echo "configure aborted."
551     exit
552 fi
553
554
555 LIBS="$base_LIBS"
556
557 AC_SUBST(base_LIBS)
558 AC_SUBST(openal_LIBS)
559 AC_SUBST(opengl_LIBS)
560 AC_SUBST(thread_LIBS)
561 AC_SUBST(network_LIBS)
562 AC_SUBST(joystick_LIBS)
563
564 # The following are C++ items that need to be tested for with the c++
565 # compiler
566
567 AC_LANG_PUSH(C++)
568
569 dnl Check for the presence of SimGear
570 if test "x$with_simgear" != "x"; then
571 AC_CHECK_HEADER($with_simgear/include/simgear/version.h, [ac_cv_header_simgear_version_h=yes], [ac_cv_header_simgear_version_h=no])
572 else
573 AC_CHECK_HEADER(simgear/version.h)
574 fi
575 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
576     echo
577     echo "You *must* have the SimGear support library installed on your system"
578     echo "to build the FGFS simulator!"
579     echo
580     echo "Please see README.SimGear for more details."
581     echo
582     echo "configure aborted."
583     exit
584 fi
585
586 AC_MSG_CHECKING([for SimGear 2.2.0 or newer])
587 AC_TRY_RUN([
588 #include <stdio.h>
589
590 #include <simgear/version.h>
591
592 #define STRINGIFY(X) XSTRINGIFY(X)
593 #define XSTRINGIFY(X) #X
594
595 #define MIN_MAJOR 2
596 #define MIN_MINOR 2
597 #define MIN_MICRO 0
598
599 int main() {
600     int major, minor, micro;
601
602     /* printf("%d.%d.%d or greater, ", MIN_MAJOR, MIN_MINOR, MIN_MICRO); */
603     printf("[found %s] ... ", STRINGIFY(SIMGEAR_VERSION));
604
605     sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, &micro );
606
607     if ( (major < MIN_MAJOR) ||
608          (major == MIN_MAJOR && minor < MIN_MINOR) ||
609          (major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO) ) {
610          return -1;
611     }
612
613     return 0;
614 }
615
616 ],
617   AC_MSG_RESULT(yes),
618   [AC_MSG_RESULT(wrong version);
619    AC_MSG_ERROR([Install latest SimGear first...])],
620   AC_MSG_RESULT(yes)
621 )
622
623 LIBS="$saved_LIBS"
624
625 dnl Check if SimGear was built with Norman's JPEG factory support
626 if test "x$with_simgear" != "x"; then
627 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])
628 else
629 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
630 fi
631 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
632     AC_CHECK_LIB(jpeg, jpeg_start_compress)
633     if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
634         echo
635         echo "The JPEG factory code was built and installed with SimGear."
636         echo "However it appears the libjpeg is no longer installed."
637         echo "You need to install libjpeg or remove jpgfactory support from"
638         echo "SimGear"
639         echo
640         echo "libjpeg is available at :"
641         echo "  ftp://ftp.uu.net in the directory graphics/jpeg"
642         exit 1
643     fi
644     AC_DEFINE([FG_JPEG_SERVER], 1,
645               [Define to build with jpeg screen shot server])
646 fi
647 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
648
649 # Check for "plib" without which we cannot go on
650 case "${host}" in
651 *-apple-darwin*)
652     if test "x$with_plib_framework" != "x"; then
653         AC_CHECK_FRAMEWORK(PLIB, [#include <plib/ul.h>], $with_plib_framework, no)
654         plib_FRAMEWORK="$FRAMEWORKS"
655         AC_SUBST(plib_FRAMEWORK)
656         FRAMEWORKS=""
657     fi
658     ;;
659 esac
660 AM_CONDITIONAL(HAVE_FRAMEWORK_PLIB, test "x$ac_cv_framework_PLIB" != "x")
661
662 AC_CHECK_HEADER(plib/ul.h)
663 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
664     echo
665     echo "You *must* have the plib library installed on your system to build"
666     echo "the FGFS simulator!"
667     echo
668     echo "Please see README.plib for more details."
669     echo
670     echo "configure aborted."
671     exit
672 fi
673
674 echo "$DYLD_FRAMEWORK_PATH"
675 AC_MSG_CHECKING([for plib 1.8.5 or newer])
676 AC_TRY_RUN([
677 #include <plib/ul.h>
678
679 #define MIN_PLIB_VERSION 185
680
681 int main() {
682     if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
683          return -1;
684     }
685
686     return 0;
687 }
688
689 ],
690   AC_MSG_RESULT(yes),
691   [AC_MSG_RESULT(wrong version);
692    AC_MSG_ERROR([Install plib 1.8.5 or later first...])],
693   AC_MSG_RESULT(yes)
694 )
695
696 dnl If we get here then plib is available, so force use of plib
697 dnl joystick lib
698 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
699
700 # Find the OSG libraries.  Note special handling for OS X frameworks
701 if test "x$with_osg_framework" = "x"; then
702     if test "x$enable_osgdebug" = "xyes"; then
703         AC_CHECK_LIB(OpenThreadsd,OpenThreadsGetVersion, , [AC_MSG_ERROR(OpenThreads library not found.)],)
704         AC_CHECK_LIB(osgd,osgGetVersion, , [AC_MSG_ERROR(OpenSceneGraph library not found.)],)
705         AC_CHECK_LIB(osgUtild,osgUtilGetVersion, , [AC_MSG_ERROR(OpenSceneGraph utility library not found.)],)
706         AC_CHECK_LIB(osgDBd,osgDBGetVersion, , [AC_MSG_ERROR(OpenSceneGraph database library not found.)],)
707         AC_CHECK_LIB(osgTextd,osgTextGetVersion, , [AC_MSG_ERROR(OpenSceneGraph Text library not found.)],)
708         AC_CHECK_LIB(osgGAd,osgGAGetVersion, , [AC_MSG_ERROR(OpenSceneGraph GUI Abstraction library not found.)],)
709         AC_CHECK_LIB(osgViewerd,osgViewerGetVersion, , [AC_MSG_ERROR(OpenSceneGraph Viewer library not found.)],)
710         AC_CHECK_LIB(osgSimd,osgSimGetVersion, , [AC_MSG_ERROR(OpenSceneGraph simulation library not found.)],)
711         AC_CHECK_LIB(osgParticled,osgParticleGetVersion, , [AC_MSG_ERROR(OpenSceneGraph Particle library not found.)],)
712         AC_CHECK_LIB(osgFXd, osgFXGetVersion, , [AC_MSG_ERROR(OpenSceneGraph FX library not found.)],)
713     else
714         AC_CHECK_LIB(OpenThreads,OpenThreadsGetVersion, , [AC_MSG_ERROR(OpenThreads library not found.)],)
715         AC_CHECK_LIB(osg,osgGetVersion, , [AC_MSG_ERROR(OpenSceneGraph library not found.)],)
716         AC_CHECK_LIB(osgUtil,osgUtilGetVersion, , [AC_MSG_ERROR(OpenSceneGraph utility library not found.)],)
717         AC_CHECK_LIB(osgDB,osgDBGetVersion, , [AC_MSG_ERROR(OpenSceneGraph database library not found.)],)
718         AC_CHECK_LIB(osgText,osgTextGetVersion, , [AC_MSG_ERROR(OpenSceneGraph Text library not found.)],)
719         AC_CHECK_LIB(osgGA,osgGAGetVersion, , [AC_MSG_ERROR(OpenSceneGraph GUI Abstraction library not found.)],)
720         AC_CHECK_LIB(osgViewer,osgViewerGetVersion, , [AC_MSG_ERROR(OpenSceneGraph Viewer library not found.)],)
721         AC_CHECK_LIB(osgSim,osgSimGetVersion, , [AC_MSG_ERROR(OpenSceneGraph simulation library not found.)],)
722         AC_CHECK_LIB(osgParticle,osgParticleGetVersion, , [AC_MSG_ERROR(OpenSceneGraph Particle library not found.)],)
723         AC_CHECK_LIB(osgFX, osgFXGetVersion, , [AC_MSG_ERROR(OpenSceneGraph FX library not found.)],)
724     fi
725 else
726     # Checking osg frameworks.
727     AC_CHECK_FRAMEWORK(osgViewer, [#include <osgViewer/Version>], $with_osg_framework)
728     AC_CHECK_FRAMEWORK(osgGA, [#include <osgGA/Version>], $with_osg_framework)
729     AC_CHECK_FRAMEWORK(osgText, [#include <osgText/Version>], $with_osg_framework)
730     AC_CHECK_FRAMEWORK(osgFX, [#include <osgFX/AnisotropicLighting>], $with_osg_framework)
731     AC_CHECK_FRAMEWORK(osgUtil, [#include <osgUtil/Version>], $with_osg_framework)
732     AC_CHECK_FRAMEWORK(osgDB, [#include <osgDB/Version>], $with_osg_framework)
733     AC_CHECK_FRAMEWORK(osgSim, [#include <osgSim/Version>], $with_osg_framework)
734     AC_CHECK_FRAMEWORK(osgParticle, [#include <osgParticle/Version>], $with_osg_framework)
735     AC_CHECK_FRAMEWORK(osg, [#include <osg/Version>], $with_osg_framework)
736     osg_FRAMEWORKS="$FRAMEWORKS"
737     FRAMEWORKS=""
738     AC_CHECK_FRAMEWORK(OpenThreads, [#include <OpenThreads/Version>], $with_osg_framework)
739     openthreads_FRAMEWORK="$FRAMEWORKS"
740     AC_SUBST(osg_FRAMEWORKS)
741     AC_SUBST(openthreads_FRAMEWORK)
742 fi
743 AM_CONDITIONAL(HAVE_FRAMEWORK_OSG, test "x$ac_cv_framework_osg" != "x")
744
745 AC_CHECK_HEADER(osg/Version)
746 if test "x$ac_cv_header_osg_Version" != "xyes"; then
747     echo
748     echo "You *must* have the OpenSceneGraph support library installed on your system"
749     echo "to build the FGFS simulator!"
750     echo
751     echo "Please see README.OSG for more details."
752     echo
753     echo "configure aborted."
754     exit
755 fi
756
757
758 AC_MSG_CHECKING([checking for osg::CullSettings::CLEAR_MASK])
759 AC_COMPILE_IFELSE(
760   [AC_LANG_PROGRAM([[#include <osg/CullSettings>]],
761     [[osg::CullSettings::VariablesMask mask = osg::CullSettings::CLEAR_MASK;]])],
762   [AC_DEFINE([HAVE_CULLSETTINGS_CLEAR_MASK],1,[define if OSG has CullSettings::CLEAR_MASK])
763    AC_MSG_RESULT([yes])],
764   [AC_MSG_RESULT([no])])
765
766 # Special handling for static version of OSG
767 if test -n "`echo "$CPPFLAGS" "$CXXFLAGS" "$CFLAGS" | grep "\-DOSG_LIBRARY_STATIC" 2>/dev/null`" ; then
768     saved_LIBS="$LIBS"
769     LIBS=""
770     #***** Check image support (needed for static build) *****
771     AC_SEARCH_LIBS([jpeg_read_header], [jpeg], [CPPFLAGS="$CPPFLAGS -DOSG_JPEG_ENABLED"])
772     AC_SEARCH_LIBS([png_read_image], [png 'png -lz'], [CPPFLAGS="$CPPFLAGS -DOSG_PNG_ENABLED"])
773     AC_SEARCH_LIBS([TIFFOpen], [tiff], [CPPFLAGS="$CPPFLAGS -DOSG_TIFF_ENABLED"])
774     img_LIBS="$LIBS"
775     LIBS="$saved_LIBS"
776
777     if test "x$with_osg" != "x" ; then
778         osg_prefix="$with_osg"
779     else
780         osg_prefix="/usr"
781     fi
782     PKG_CHECK_EXISTS([openscenegraph], [osg_version="`$PKG_CONFIG --modversion openscenegraph 2>/dev/null`"])
783     LIBS="-L$osg_prefix/lib/osgPlugins-$osg_version -losgdb_bmp -losgdb_dds -losgdb_hdr -losgdb_pic -losgdb_pnm -losgdb_rgb -losgdb_tga \
784                                                           -losgdb_3ds -losgdb_ac -losgdb_ive -losgdb_osg -losgdb_txf \
785                                                           -losgVolume -losgTerrain $LIBS -losgUtil"
786
787     if test -n "`echo "$CPPFLAGS" "$CXXFLAGS" "$CFLAGS" | grep "\-DOSG_JPEG_ENABLED" 2>/dev/null`" ; then
788       LIBS="$LIBS -losgdb_jpeg"
789     fi
790     if test -n "`echo "$CPPFLAGS" "$CXXFLAGS" "$CFLAGS" | grep "\-DOSG_PNG_ENABLED" 2>/dev/null`" ; then
791       LIBS="$LIBS -losgdb_png"
792     fi
793     if test -n "`echo "$CPPFLAGS" "$CXXFLAGS" "$CFLAGS" | grep "\-DOSG_TIFF_ENABLED" 2>/dev/null`" ; then
794       LIBS="$LIBS -losgdb_tiff"
795     fi
796
797     LIBS="$LIBS $img_LIBS"
798 fi
799
800 AC_LANG_POP
801
802 dnl Check for system installed zlib
803 AC_CHECK_HEADER(zlib.h)
804 if test "x$ac_cv_header_zlib_h" != "xyes"; then
805     echo
806     echo "zlib library not found."
807     echo
808     echo "If your OS does not provide an installable package for zlib"
809     echo "you will have to compile and install it first yourself.  A copy"
810     echo "of zlib-1.1.4.tar.gz is included with SimGear.  You will"
811     echo "have to untar this source code, and follow it's included instructions"
812     echo "to compile and install on your system."
813     echo
814     echo "configure aborted."
815     echo
816 fi
817
818 dnl Check for Subversion library support
819 # libsvn support defaults to yes
820 save_LIBS=$LIBS
821 save_CPPFLAGS=$CPPFLAGS
822 AC_ARG_WITH(libsvn, [  --without-libsvn        Do not use libsvn for terrasync [default=no]], [], [with_libsvn=yes])
823 if test "x$with_libsvn" = "xyes"; then
824     LIBS="`apr-1-config --link-ld`"
825     CPPFLAGS="-I/usr/include/subversion-1 `apr-1-config --includes --cppflags`"
826     AC_CHECK_HEADERS([svn_client.h])
827        if test "x$ac_cv_header_svn_client_h" = "xyes"; then
828         echo "TerraSync will use libsvn"
829         AC_SEARCH_LIBS(svn_client_checkout, svn_client-1)
830         AC_SEARCH_LIBS(svn_cmdline_init, svn_subr-1)
831         svn_LIBS=$LIBS
832         svn_CPPFLAGS=$CPPFLAGS
833         AC_SUBST(svn_LIBS)
834         AC_SUBST(svn_CPPFLAGS)
835        else
836         echo "Libsvn not found. TerraSync will use command line subversion"
837         svn_LIBS=""
838         svn_CPPFLAGS=""
839        fi
840 else
841 echo "Libsvn explicitly disabled. TerraSync will use command line subversion"
842   svn_LIBS=""
843   svn_CPPFLAGS=""
844 fi
845 LIBS=$save_LIBS
846 CPPFLAGS=$save_CPPFLAGS
847
848 AC_MSG_CHECKING([for feenableexcept])
849 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _GNU_SOURCE
850 #include <fenv.h>]], [[feenableexcept(FE_DIVBYZERO)]])],
851 [AC_DEFINE([HAVE_FEENABLEEXCEPT], 1, [define if system has fenableexcept])],
852 AC_MSG_RESULT([yes]),
853 AC_MSG_RESULT([no]))
854
855 dnl Checks for header files.
856 AC_HEADER_STDC
857 AC_CHECK_HEADERS( \
858         fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
859         sys/time.h sys/timeb.h unistd.h windows.h values.h )
860
861 dnl Checks for typedefs, structures, and compiler characteristics.
862 AC_C_CONST
863 AC_TYPE_SIZE_T
864 AC_HEADER_TIME
865 AC_STRUCT_TM
866
867 dnl Checks for library functions.
868 old_LIBS=$LIBS
869 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
870 AC_TYPE_SIGNAL
871 AC_FUNC_VPRINTF
872 AC_CHECK_FUNCS( [ \
873         ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
874         random drand48 setitimer getitimer signal GetLocalTime rint getrusage \
875         truncf ] )
876 LIBS=$old_LIBS
877
878 AM_CONFIG_HEADER(src/Include/config.h)
879
880 AC_CONFIG_FILES([ \
881         Makefile \
882         man/Makefile \
883         man/est-epsilon.1 \
884         man/fgfs.1 \
885         man/fgjs.1 \
886         man/gl-info.1 \
887         man/js_demo.1 \
888         man/pstest.1 \
889         scripts/Makefile \
890         scripts/debug/Makefile \
891         scripts/perl/Makefile \
892         scripts/perl/examples/Makefile \
893         scripts/perl/traffic/Makefile \
894         scripts/python/Makefile \
895         src/Makefile \
896         src/Include/Makefile \
897         src/Include/version.h \
898         src/Aircraft/Makefile \
899         src/Airports/Makefile \
900         src/ATC/Makefile \
901         src/ATCDCL/Makefile \
902         src/Autopilot/Makefile \
903         src/Cockpit/Makefile \
904         src/Cockpit/built_in/Makefile \
905         src/Environment/Makefile \
906         src/FDM/ExternalNet/Makefile \
907         src/FDM/ExternalPipe/Makefile \
908         src/FDM/JSBSim/Makefile \
909         src/FDM/JSBSim/initialization/Makefile \
910         src/FDM/JSBSim/input_output/Makefile \
911         src/FDM/JSBSim/math/Makefile \
912         src/FDM/JSBSim/models/Makefile \
913         src/FDM/JSBSim/models/flight_control/Makefile \
914         src/FDM/JSBSim/models/atmosphere/Makefile \
915         src/FDM/JSBSim/models/propulsion/Makefile \
916         src/FDM/LaRCsim/Makefile \
917         src/FDM/SP/Makefile \
918         src/FDM/UIUCModel/Makefile \
919         src/FDM/YASim/Makefile \
920         src/FDM/Makefile \
921         src/GUI/Makefile \
922         src/Input/Makefile \
923         src/Instrumentation/Makefile \
924         src/Instrumentation/KLN89/Makefile \
925         src/Instrumentation/HUD/Makefile \
926         src/Main/Makefile \
927         src/Main/runfgfs \
928         src/Main/runfgfs.bat \
929         src/Model/Makefile \
930         src/AIModel/Makefile \
931         src/MultiPlayer/Makefile \
932         src/Navaids/Makefile \
933         src/Network/Makefile \
934         src/Network/HLA/Makefile \
935         src/Scenery/Makefile \
936         src/Scripting/Makefile \
937         src/Sound/Makefile \
938         src/Systems/Makefile \
939         src/Time/Makefile \
940         src/Traffic/Makefile \
941         tests/Makefile \
942         utils/Makefile \
943         utils/GPSsmooth/Makefile \
944         utils/fgadmin/Makefile
945         utils/fgadmin/src/Makefile \
946         utils/js_server/Makefile \
947         utils/Modeller/Makefile \
948         utils/propmerge/Makefile \
949         utils/TerraSync/Makefile \
950         utils/xmlgrep/Makefile \
951         utils/fgviewer/Makefile \
952         utils/fgpanel/Makefile
953 ])
954 AC_OUTPUT
955
956 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
957
958 echo ""
959 echo "Configure Summary"
960 echo "================="
961
962 echo "Prefix: $prefix"
963
964 if test "x$with_logging" != "x"; then
965     echo "Log messages: $with_logging"
966 else
967     echo "Log messages: yes"
968 fi
969
970 echo -n "Automake version: "
971 automake --version | head -n 1
972
973 if test "x$with_multiplayer" != "xno"; then
974     echo "Building with multiplayer support"
975 fi
976
977 if test "x$with_threads" = "xyes"; then
978     echo "Threads: yes"
979 else
980     echo "Threads: no"
981 fi
982
983 if test "x$with_eventinput" = "xyes"; then
984     echo "Event input: yes"
985 else
986     echo "Event input: no"
987 fi
988
989 if test "x$with_fgpanel" = "xyes"; then
990     echo "fgpanel: yes"
991 else
992     echo "fgpanel: no"
993 fi
994
995 if test "x$enable_sp_fdms" != "xno"; then
996     echo "Include special purpose flight models: yes"
997 else
998     echo "Include special purpose flight models: no"
999 fi