1 dnl Process this file with autoget.sh to produce a working configure
7 AC_CONFIG_SRCDIR([simgear/bucket/newbucket.cxx])
9 dnl Require at least automake 2.52
12 dnl Initialize the automake stuff
13 AM_INIT_AUTOMAKE(SimGear, 0.3.6-pre3)
15 dnl Specify KAI C++ compiler and flags.
16 dnl Borrowed with slight modification from blitz distribution.
18 [ --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
20 KCC*) # KAI C++ http://www.kai.com/
21 echo "Configuring for KAI C++"
22 AC_SG_SET_COMPILER($withval,"KCC","--restrict --strict_warnings")
23 CXX_OPTIMIZE_FLAGS=="+K3 -O3"
24 CXX_DEBUG_FLAGS="-g +K0"
32 dnl Checks for programs.
41 dnl set the $host variable based on local machine/os
44 dnl Used on the Irix platform
47 if test "x$CXX" = "xCC" -o "x$CXX" = "xccache CC"; then
50 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro740"
51 compatibility_DIR="compatibility"
52 MIPSpro_DIRS="MIPSpro740"
53 AC_MSG_CHECKING([for MIPSpro compiler version 7.4 or newer])
56 if ( _COMPILER_VERSION < 740 ) {
62 ], AC_MSG_RESULT(yes),
64 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro721"
65 MIPSpro_DIRS="$(MIPSpro_DIRS) MIPSpro721"
66 AC_MSG_WARN([Using our own subset of the STL headers])
67 ], AC_MSG_RESULT(yes))
68 AC_SUBST(MIPSpro_DIRS)
79 AC_SUBST(compatibility_DIR)
81 if echo $includedir | egrep "simgear$" > /dev/null; then
82 echo "includedir is" $includedir "libdir is" $libdir
84 includedir="${includedir}/simgear"
85 echo "includedir changed to" $includedir "libdir is" $libdir
88 dnl set logging; default value of with_logging=yes
89 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
90 if test "x$with_logging" = "xno" ; then
91 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
94 # Specify if we want to build with Norman's jpeg image server support.
95 # This requires libjpeg to be installed and available.
96 # Default to with_jpeg_server=no
98 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
99 if test "x$with_jpeg_factory" = "xyes" ; then
100 echo "Building with Norman's jpeg image factory support"
101 AC_CHECK_LIB(jpeg, jpeg_start_compress)
102 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
104 echo "In order to build the jpeg factory code you need libjpeg installed."
105 echo "otherwise please configure with the --with-jpeg-sever=no option"
107 echo "libjpeg is available at :"
108 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
112 echo "Building without Norman's jpeg image server support"
114 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
116 # specify the plib location
117 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
119 if test "x$with_plib" != "x" ; then
120 echo "plib prefix is $with_plib"
121 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
124 dnl Determine an extra directories to add to include/lib search paths
126 *-apple-darwin* | *-*-mingw32*)
127 echo no EXTRA_DIRS for $host
131 if test -d /usr/X11R6 ; then
132 EXTRA_DIR1="/usr/X11R6"
134 if test -d /opt/X11R6 ; then
135 EXTRA_DIR2="/opt/X11R6"
137 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2"
141 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
144 dnl Using AM_CONDITIONAL is a step out of the protected little
145 dnl automake fold so it is potentially dangerous. But, we are
146 dnl beginning to run into cases where the standard checks are not
147 dnl enough. AM_CONDITIONALS are then referenced to conditionally
148 dnl build a Makefile.in from a Makefile.am which lets us define custom
149 dnl includes, compile alternative source files, etc.
151 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
152 dnl to use it if it is.
154 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
155 echo no fancy X11 check
164 dnl Checks for libraries.
166 dnl Thread related checks
167 AC_CHECK_HEADER(pthread.h)
168 AC_CHECK_LIB(pthread, pthread_exit)
169 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
170 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
171 CFLAGS="$CFLAGS -D_REENTRANT"
173 if test "x$ac_cv_lib_pthread_pthread_exit" != "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
174 dnl FreeBSD: System has pthread.h, but -lpthread library check
175 dnl fails. See if we need -pthread instead of -lpthread and look
176 dnl for the functions in libc_r.
177 save_CXXFLAGS="$CXXFLAGS"
178 save_CFLAGS="$CFLAGS"
179 CXXFLAGS="-pthread $CXXFLAGS"
180 CFLAGS="-pthread $FLAGS"
182 AC_CHECK_LIB(c_r, pthread_exit)
183 if test "x$ac_cv_lib_c_r_pthread_exit" != "xyes"; then
184 CXXFLAGS=$save_CXXFLAGS
187 dnl This is cheating a bit. pthread_exit comes with using -pthread, not
189 ac_cv_lib_pthread_pthread_exit="yes"
194 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
199 dnl search for network related libraries
200 AC_SEARCH_LIBS(inet_addr, xnet)
201 AC_SEARCH_LIBS(socket, socket)
206 dnl check for some default libraries
207 AC_SEARCH_LIBS(cos, m)
211 dnl check for OpenGL related libraries
213 *-*-cygwin* | *-*-mingw32*)
214 dnl CygWin under Windoze.
216 echo Win32 specific hacks...
217 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
218 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
220 LIBS="$LIBS -lglu32 -lopengl32"
221 LIBS="$LIBS -luser32 -lgdi32 -lwinmm"
223 dnl add -lwsock32 for mingwin
226 base_LIBS="$base_LIBS -lws2_32"
230 echo "Will link apps with $LIBS"
236 LIBS="$LIBS -framework OpenGL -framework Carbon -lobjc"
240 dnl X-Windows based machines
242 AC_SEARCH_LIBS(XCreateWindow, X11)
243 AC_SEARCH_LIBS(XShmCreateImage, Xext)
244 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
245 AC_SEARCH_LIBS(IceOpenConnection, ICE)
246 AC_SEARCH_LIBS(SmcOpenConnection, SM)
247 AC_SEARCH_LIBS(XtMalloc, Xt)
248 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
250 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
251 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
252 dnl if GLcore found, then also check for GL
253 AC_SEARCH_LIBS(glXCreateContext, GL)
256 dnl if using mesa, check for xmesa.h
257 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
258 AC_CHECK_HEADER(GL/fxmesa.h)
259 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
260 AC_DEFINE([XMESA], 1, [Define for fxmesa])
261 AC_DEFINE([FX], 1, [Define for fxmesa])
265 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
273 dnl check for OpenAL libraries
275 *-*-cygwin* | *-*-mingw32*)
276 dnl CygWin under Windoze.
278 AC_SEARCH_LIBS(alGenBuffers, openal32)
279 AC_SEARCH_LIBS(alutInit, [ openal32 ALut ] )
280 LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
286 LIBS="$LIBS -framework IOKit -framework OpenAL"
290 dnl default unix style machines
292 AC_SEARCH_LIBS(alGenBuffers, openal)
301 AC_SUBST(openal_LIBS)
302 AC_SUBST(opengl_LIBS)
303 AC_SUBST(thread_LIBS)
304 AC_SUBST(network_LIBS)
306 dnl Check for MS Windows environment
307 AC_CHECK_HEADER(windows.h)
308 AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
310 # The following are C++ items that need to be tested for with the c++
315 dnl Check for "plib" without which we cannot go on
316 AC_CHECK_HEADER(plib/ul.h)
317 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
319 echo "You *must* have the plib library installed on your system to build"
322 echo "Please see README.plib for more details."
324 echo "configure aborted."
328 AC_MSG_CHECKING([for plib 1.6.0 or newer])
332 #define MIN_PLIB_VERSION 160
335 int major, minor, micro;
337 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
346 [AC_MSG_RESULT(wrong version);
347 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
355 dnl Check for system installed zlib
356 AC_CHECK_HEADER(zlib.h)
357 if test "x$ac_cv_header_zlib_h" != "xyes"; then
359 echo "zlib library not found."
361 echo "If your OS does not provide an installable package for zlib"
362 echo "you will have to compile and install it first yourself. A copy"
363 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
364 echo "have to untar this source code, and follow its included instructions"
365 echo "to compile and install on your system."
367 echo "configure aborted."
371 dnl Checks for header files.
374 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
375 sys/stat.h sys/time.h sys/timeb.h unistd.h values.h )
377 if test "x$ac_cv_header_stdint_h" = "xyes"; then
378 AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
381 dnl Checks for typedefs, structures, and compiler characteristics.
387 dnl Checks for library functions.
389 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
393 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
394 random drand48 setitimer getitimer signal GetLocalTime rint getrusage ] )
397 AM_CONFIG_HEADER(simgear/simgear_config.h)
405 simgear/compatibility/Makefile \
406 simgear/compatibility/MIPSpro721/Makefile \
407 simgear/compatibility/MIPSpro740/Makefile \
408 simgear/bucket/Makefile \
409 simgear/debug/Makefile \
410 simgear/ephemeris/Makefile \
411 simgear/io/Makefile \
412 simgear/magvar/Makefile \
413 simgear/math/Makefile \
414 simgear/environment/Makefile \
415 simgear/misc/Makefile \
416 simgear/nasal/Makefile \
417 simgear/props/Makefile \
418 simgear/route/Makefile \
419 simgear/scene/Makefile \
420 simgear/scene/material/Makefile \
421 simgear/scene/model/Makefile \
422 simgear/scene/sky/Makefile \
423 simgear/scene/sky/clouds3d/Makefile \
424 simgear/scene/tgdb/Makefile \
425 simgear/screen/Makefile \
426 simgear/serial/Makefile \
427 simgear/sound/Makefile \
428 simgear/structure/Makefile \
429 simgear/threads/Makefile \
430 simgear/timing/Makefile \
431 simgear/xgl/Makefile \
432 simgear/xml/Makefile \
438 echo "Configure Summary"
439 echo "================="
441 echo "Prefix: $prefix"
443 if test "x$with_logging" != "x"; then
444 echo "Debug messages: $with_logging"
446 echo "Debug messages: yes"
449 echo -n "Automake version: "
450 automake --version | head -1
452 if test "x$with_jpeg_factory" = "xyes"; then
453 echo "With JPEG Factory support"
455 echo "Without JPEG Factory support"
458 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
459 echo "Threads: pthread lib found."
461 echo "Threads: no threads (pthread lib not found.)"