1 dnl Process this file with autoget.sh to produce a working configure
5 AC_CONFIG_SRCDIR([simgear/bucket/newbucket.cxx])
7 dnl Require at least automake 2.52
10 dnl Initialize the automake stuff
11 AM_INIT_AUTOMAKE(SimGear, 1.9.1)
13 dnl Specify KAI C++ compiler and flags.
14 dnl Borrowed with slight modification from blitz distribution.
16 [ --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
18 KCC*) # KAI C++ http://www.kai.com/
19 echo "Configuring for KAI C++"
20 AC_SG_SET_COMPILER($withval,"KCC","--restrict --strict_warnings")
21 CXX_OPTIMIZE_FLAGS=="+K3 -O3"
22 CXX_DEBUG_FLAGS="-g +K0"
27 AC_MSG_CHECKING([CXX])
32 dnl Checks for programs.
40 AX_BOOST_BASE([1.34.0])
42 if test "x$BOOST_CPPFLAGS" != "x-I/usr/include" ; then
43 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
46 dnl set the $host variable based on local machine/os
49 dnl Used on the Irix platform
52 if test "x$CXX" = "xCC" -o "x$CXX" = "xccache CC"; then
55 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro740"
56 compatibility_DIR="compatibility"
57 MIPSpro_DIRS="MIPSpro740"
58 AC_MSG_CHECKING([for MIPSpro compiler version 7.4 or newer])
61 if ( _COMPILER_VERSION < 740 ) {
67 ], AC_MSG_RESULT(yes),
69 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro721"
70 MIPSpro_DIRS="$(MIPSpro_DIRS) MIPSpro721"
71 AC_MSG_WARN([Using our own subset of the STL headers])
72 ], AC_MSG_RESULT(yes))
73 AC_SUBST(MIPSpro_DIRS)
84 AC_SUBST(compatibility_DIR)
86 if echo $includedir | egrep "simgear$" > /dev/null; then
87 echo "includedir is" $includedir "libdir is" $libdir
89 includedir="${includedir}/simgear"
90 echo "includedir changed to" $includedir "libdir is" $libdir
93 dnl set logging; default value of with_logging=yes
94 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
95 if test "x$with_logging" = "xno" ; then
96 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
99 # Specify if we want to build with Norman's jpeg image server support.
100 # This requires libjpeg to be installed and available.
101 # Default to with_jpeg_server=no
103 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
104 if test "x$with_jpeg_factory" = "xyes" ; then
105 echo "Building with Norman's jpeg image factory support"
106 AC_CHECK_LIB(jpeg, jpeg_start_compress)
107 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
109 echo "In order to build the jpeg factory code you need libjpeg installed."
110 echo "otherwise please configure with the --with-jpeg-sever=no option"
112 echo "libjpeg is available at :"
113 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
117 echo "Building without Norman's jpeg image server support"
119 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
121 # specify the plib location
122 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
124 if test "x$with_plib" != "x" ; then
125 echo "plib prefix is $with_plib"
126 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
129 # specify the osg location
130 AC_ARG_WITH(osg, [ --with-osg=PREFIX Specify the prefix path to osg])
132 if test "x$with_osg" != "x" ; then
133 echo "osg prefix is $with_osg"
134 EXTRA_DIRS="${EXTRA_DIRS} $with_osg"
137 dnl Determine an extra directories to add to include/lib search paths
139 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
140 echo no EXTRA_DIRS for $host
144 if test -d /usr/X11R6 ; then
145 EXTRA_DIR1="/usr/X11R6"
147 if test -d /opt/X11R6 ; then
148 EXTRA_DIR2="/opt/X11R6"
150 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2"
154 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
157 dnl Using AM_CONDITIONAL is a step out of the protected little
158 dnl automake fold so it is potentially dangerous. But, we are
159 dnl beginning to run into cases where the standard checks are not
160 dnl enough. AM_CONDITIONALS are then referenced to conditionally
161 dnl build a Makefile.in from a Makefile.am which lets us define custom
162 dnl includes, compile alternative source files, etc.
164 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
165 dnl to use it if it is.
167 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
168 echo no fancy X11 check
177 dnl Checks for libraries.
179 dnl Thread related checks
180 AC_CHECK_HEADER(pthread.h)
181 AC_SEARCH_LIBS(pthread_exit, [pthread c_r])
182 if test "x$ac_cv_header_pthread_h" = "xyes"; then
183 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
184 CFLAGS="$CFLAGS -D_REENTRANT"
186 if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
187 CXXFLAGS="-pthread $CXXFLAGS"
188 CFLAGS="-pthread $CFLAGS"
192 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_header_pthread_h" = "xyes")
197 dnl search for network related libraries
198 AC_SEARCH_LIBS(inet_addr, xnet)
199 AC_SEARCH_LIBS(socket, socket)
204 dnl check for some default libraries
205 AC_SEARCH_LIBS(cos, m)
209 dnl check for OpenGL related libraries
211 *-*-cygwin* | *-*-mingw32*)
212 dnl CygWin under Windoze.
214 echo Win32 specific hacks...
215 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
216 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
218 LIBS="$LIBS -lglu32 -lopengl32"
219 LIBS="$LIBS -luser32 -lgdi32 -lwinmm"
221 dnl add -lwsock32 for mingwin
224 base_LIBS="$base_LIBS -lws2_32"
228 echo "Will link apps with $LIBS"
234 LIBS="$LIBS -framework OpenGL -framework Carbon -lobjc"
238 dnl X-Windows based machines
240 AC_SEARCH_LIBS(XCreateWindow, X11)
241 AC_SEARCH_LIBS(XShmCreateImage, Xext)
242 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
243 AC_SEARCH_LIBS(IceOpenConnection, ICE)
244 AC_SEARCH_LIBS(SmcOpenConnection, SM)
245 AC_SEARCH_LIBS(XtMalloc, Xt)
246 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
248 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
249 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
250 dnl if GLcore found, then also check for GL
251 AC_SEARCH_LIBS(glXCreateContext, GL)
254 dnl if using mesa, check for xmesa.h
255 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
256 AC_CHECK_HEADER(GL/fxmesa.h)
257 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
258 AC_DEFINE([XMESA], 1, [Define for fxmesa])
259 AC_DEFINE([FX], 1, [Define for fxmesa])
263 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
268 AC_SEARCH_LIBS(glutGetModifiers, [ glut glut32 freeglut ], have_glut=yes, have_glut=no)
269 AM_CONDITIONAL(HAVE_GLUT, test "x$have_glut" = "xyes")
274 dnl check for OpenAL libraries
278 *-*-cygwin* | *-*-mingw32*)
279 dnl CygWin under Windoze.
280 INCLUDES="$INCLUDES -I/usr/local/include/"
281 LIBS="$LIBS -L/usr/local/lib"
282 AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal ] )
283 AC_SEARCH_LIBS(alutInit, [ openal32 ALut alut ] )
284 LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
286 OPENAL_OK="$ac_cv_search_alGenBuffers"
287 ALUT_OK="$ac_cv_search_alutInit"
293 LIBS="$LIBS -framework IOKit -framework OpenAL"
295 # not sure how to test if OpenAL exists on MacOS (does it come by default?)
301 dnl default unix style machines
304 LIBS="$LIBS $thread_LIBS"
305 AC_SEARCH_LIBS(alGenBuffers, openal)
306 AC_SEARCH_LIBS(alutInit, [ alut openal ] )
307 OPENAL_OK="$ac_cv_search_alGenBuffers"
308 ALUT_OK="$ac_cv_search_alutInit"
315 if test "$OPENAL_OK" == "no"; then
317 echo "You *must* have the openal library installed on your system to build"
320 echo "Please see README.OpenAL for more details."
322 echo "configure aborted."
326 if test "$ALUT_OK" == "no"; then
328 echo "You *must* have the alut library installed on your system to build"
331 echo "Please see README.OpenAL for more details."
333 echo "configure aborted."
342 AC_SUBST(openal_LIBS)
343 AC_SUBST(opengl_LIBS)
344 AC_SUBST(thread_LIBS)
345 AC_SUBST(network_LIBS)
347 dnl Check for MS Windows environment
348 AC_CHECK_HEADER(windows.h)
349 AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
351 # The following are C++ items that need to be tested for with the c++
356 dnl Check for "plib" without which we cannot go on
357 AC_CHECK_HEADER(plib/ul.h)
358 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
360 echo "You *must* have the plib library installed on your system to build"
363 echo "Please see README.plib for more details."
365 echo "configure aborted."
369 AC_MSG_CHECKING([for plib 1.8.5 or newer])
373 #define MIN_PLIB_VERSION 185
376 int major, minor, micro;
378 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
387 [AC_MSG_RESULT(wrong version);
388 AC_MSG_ERROR([Install plib 1.8.5 or later first...])],
394 AC_CHECK_HEADER(osg/Version)
395 if test "x$ac_cv_header_osg_Version" != "xyes"; then
397 echo "You *must* have the OpenSceneGraph support library installed on your system"
398 echo "to build this version of SimGear!"
400 echo "Please see README.OSG for more details."
402 echo "configure aborted."
406 AC_CHECK_HEADER(boost/version.hpp)
407 if test "x$ac_cv_header_boost_version_hpp" != "xyes"; then
409 echo "You *must* have the Boost library installed on your system"
410 echo "to build this version of SimGear!"
412 echo "configure aborted."
418 dnl Check for system installed zlib
419 AC_CHECK_HEADER(zlib.h)
420 if test "x$ac_cv_header_zlib_h" != "xyes"; then
422 echo "zlib library not found."
424 echo "If your OS does not provide an installable package for zlib"
425 echo "you will have to compile and install it first yourself. A copy"
426 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
427 echo "have to untar this source code, and follow its included instructions"
428 echo "to compile and install on your system."
430 echo "configure aborted."
434 dnl Checks for header files.
437 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
438 sys/stat.h sys/time.h sys/timeb.h unistd.h values.h )
440 if test "x$ac_cv_header_stdint_h" = "xyes"; then
441 AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
444 dnl Checks for typedefs, structures, and compiler characteristics.
451 dnl Checks for library functions.
453 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
457 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
458 random drand48 setitimer getitimer signal GetLocalTime rint getrusage ] )
461 AM_CONFIG_HEADER(simgear/simgear_config.h)
468 simgear/compatibility/Makefile \
469 simgear/compatibility/MIPSpro721/Makefile \
470 simgear/compatibility/MIPSpro740/Makefile \
471 simgear/bucket/Makefile \
472 simgear/debug/Makefile \
473 simgear/ephemeris/Makefile \
474 simgear/io/Makefile \
475 simgear/magvar/Makefile \
476 simgear/math/Makefile \
477 simgear/environment/Makefile \
478 simgear/misc/Makefile \
479 simgear/nasal/Makefile \
480 simgear/props/Makefile \
481 simgear/route/Makefile \
482 simgear/scene/Makefile \
483 simgear/scene/bvh/Makefile \
484 simgear/scene/material/Makefile \
485 simgear/scene/model/Makefile \
486 simgear/scene/sky/Makefile \
487 simgear/scene/tgdb/Makefile \
488 simgear/scene/util/Makefile \
489 simgear/screen/Makefile \
490 simgear/serial/Makefile \
491 simgear/sound/Makefile \
492 simgear/structure/Makefile \
493 simgear/threads/Makefile \
494 simgear/timing/Makefile \
495 simgear/xml/Makefile \
501 echo "Configure Summary"
502 echo "================="
504 echo "Prefix: $prefix"
506 if test "x$with_logging" != "x"; then
507 echo "Debug messages: $with_logging"
509 echo "Debug messages: yes"
512 echo -n "Automake version: "
513 automake --version | head -1
515 if test "x$with_jpeg_factory" = "xyes"; then
516 echo "With JPEG Factory support"
518 echo "Without JPEG Factory support"
521 if test "x$ac_cv_header_pthread_h" = "xyes"; then
522 echo "Threads: pthread lib found."
524 echo "Threads: no threads (pthread lib not found.)"