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