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, 0.3.10)
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"
30 dnl Checks for programs.
39 dnl set the $host variable based on local machine/os
42 dnl Used on the Irix platform
45 if test "x$CXX" = "xCC" -o "x$CXX" = "xccache CC"; then
48 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro740"
49 compatibility_DIR="compatibility"
50 MIPSpro_DIRS="MIPSpro740"
51 AC_MSG_CHECKING([for MIPSpro compiler version 7.4 or newer])
54 if ( _COMPILER_VERSION < 740 ) {
60 ], AC_MSG_RESULT(yes),
62 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro721"
63 MIPSpro_DIRS="$(MIPSpro_DIRS) MIPSpro721"
64 AC_MSG_WARN([Using our own subset of the STL headers])
65 ], AC_MSG_RESULT(yes))
66 AC_SUBST(MIPSpro_DIRS)
77 AC_SUBST(compatibility_DIR)
79 if echo $includedir | egrep "simgear$" > /dev/null; then
80 echo "includedir is" $includedir "libdir is" $libdir
82 includedir="${includedir}/simgear"
83 echo "includedir changed to" $includedir "libdir is" $libdir
86 dnl set logging; default value of with_logging=yes
87 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
88 if test "x$with_logging" = "xno" ; then
89 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
92 # Specify if we want to build with Norman's jpeg image server support.
93 # This requires libjpeg to be installed and available.
94 # Default to with_jpeg_server=no
96 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
97 if test "x$with_jpeg_factory" = "xyes" ; then
98 echo "Building with Norman's jpeg image factory support"
99 AC_CHECK_LIB(jpeg, jpeg_start_compress)
100 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
102 echo "In order to build the jpeg factory code you need libjpeg installed."
103 echo "otherwise please configure with the --with-jpeg-sever=no option"
105 echo "libjpeg is available at :"
106 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
110 echo "Building without Norman's jpeg image server support"
112 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
114 # specify the plib location
115 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
117 if test "x$with_plib" != "x" ; then
118 echo "plib prefix is $with_plib"
119 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
122 dnl Determine an extra directories to add to include/lib search paths
124 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
125 echo no EXTRA_DIRS for $host
129 if test -d /usr/X11R6 ; then
130 EXTRA_DIR1="/usr/X11R6"
132 if test -d /opt/X11R6 ; then
133 EXTRA_DIR2="/opt/X11R6"
135 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2"
139 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
142 dnl Using AM_CONDITIONAL is a step out of the protected little
143 dnl automake fold so it is potentially dangerous. But, we are
144 dnl beginning to run into cases where the standard checks are not
145 dnl enough. AM_CONDITIONALS are then referenced to conditionally
146 dnl build a Makefile.in from a Makefile.am which lets us define custom
147 dnl includes, compile alternative source files, etc.
149 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
150 dnl to use it if it is.
152 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
153 echo no fancy X11 check
162 dnl Checks for libraries.
164 dnl Thread related checks
165 AC_CHECK_HEADER(pthread.h)
166 AC_SEARCH_LIBS(pthread_exit, [pthread c_r])
167 if test "x$ac_cv_header_pthread_h" = "xyes"; then
168 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
169 CFLAGS="$CFLAGS -D_REENTRANT"
171 if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
172 CXXFLAGS="-pthread $CXXFLAGS"
173 CFLAGS="-pthread $CFLAGS"
177 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_header_pthread_h" = "xyes")
182 dnl search for network related libraries
183 AC_SEARCH_LIBS(inet_addr, xnet)
184 AC_SEARCH_LIBS(socket, socket)
189 dnl check for some default libraries
190 AC_SEARCH_LIBS(cos, m)
194 dnl check for OpenGL related libraries
196 *-*-cygwin* | *-*-mingw32*)
197 dnl CygWin under Windoze.
199 echo Win32 specific hacks...
200 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
201 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
203 LIBS="$LIBS -lglu32 -lopengl32"
204 LIBS="$LIBS -luser32 -lgdi32 -lwinmm"
206 dnl add -lwsock32 for mingwin
209 base_LIBS="$base_LIBS -lws2_32"
213 echo "Will link apps with $LIBS"
219 LIBS="$LIBS -framework OpenGL -framework Carbon -lobjc"
223 dnl X-Windows based machines
225 AC_SEARCH_LIBS(XCreateWindow, X11)
226 AC_SEARCH_LIBS(XShmCreateImage, Xext)
227 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
228 AC_SEARCH_LIBS(IceOpenConnection, ICE)
229 AC_SEARCH_LIBS(SmcOpenConnection, SM)
230 AC_SEARCH_LIBS(XtMalloc, Xt)
231 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
233 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
234 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
235 dnl if GLcore found, then also check for GL
236 AC_SEARCH_LIBS(glXCreateContext, GL)
239 dnl if using mesa, check for xmesa.h
240 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
241 AC_CHECK_HEADER(GL/fxmesa.h)
242 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
243 AC_DEFINE([XMESA], 1, [Define for fxmesa])
244 AC_DEFINE([FX], 1, [Define for fxmesa])
248 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
253 AC_SEARCH_LIBS(glutGetModifiers, [ glut glut32 freeglut ], have_glut=yes, have_glut=no)
254 AM_CONDITIONAL(HAVE_GLUT, test "x$have_glut" = "xyes")
259 dnl check for OpenAL libraries
262 *-*-cygwin* | *-*-mingw32*)
263 dnl CygWin under Windoze.
264 INCLUDES="$INCLUDES -I/usr/local/include"
265 LIBS="$LIBS -L/usr/local/lib"
266 AC_SEARCH_LIBS(alGenBuffers, openal32)
267 AC_SEARCH_LIBS(alutInit, [ openal32 ALut ] )
268 LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
270 OPENAL_OK="$ac_cv_search_alGenBuffers"
276 LIBS="$LIBS -framework IOKit -framework OpenAL"
278 # not sure how to test if OpenAL exists on MacOS (does it come by default?)
283 dnl default unix style machines
286 LIBS="$LIBS $thread_LIBS"
287 AC_SEARCH_LIBS(alGenBuffers, openal)
288 AC_SEARCH_LIBS(alutInit, [ alut openal ] )
289 OPENAL_OK="$ac_cv_search_alGenBuffers"
296 if test "$OPENAL_OK" == "no"; then
298 echo "You *must* have the openal library installed on your system to build"
301 echo "Please see README.OpenAL for more details."
303 echo "configure aborted."
310 AC_SUBST(openal_LIBS)
311 AC_SUBST(opengl_LIBS)
312 AC_SUBST(thread_LIBS)
313 AC_SUBST(network_LIBS)
315 dnl Check for MS Windows environment
316 AC_CHECK_HEADER(windows.h)
317 AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
319 # The following are C++ items that need to be tested for with the c++
324 dnl Check for "plib" without which we cannot go on
325 AC_CHECK_HEADER(plib/ul.h)
326 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
328 echo "You *must* have the plib library installed on your system to build"
331 echo "Please see README.plib for more details."
333 echo "configure aborted."
337 AC_MSG_CHECKING([for plib 1.8.4 or newer])
341 #define MIN_PLIB_VERSION 184
344 int major, minor, micro;
346 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
355 [AC_MSG_RESULT(wrong version);
356 AC_MSG_ERROR([Install plib 1.8.4 or later first...])],
364 dnl Check for system installed zlib
365 AC_CHECK_HEADER(zlib.h)
366 if test "x$ac_cv_header_zlib_h" != "xyes"; then
368 echo "zlib library not found."
370 echo "If your OS does not provide an installable package for zlib"
371 echo "you will have to compile and install it first yourself. A copy"
372 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
373 echo "have to untar this source code, and follow its included instructions"
374 echo "to compile and install on your system."
376 echo "configure aborted."
380 dnl Checks for header files.
383 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
384 sys/stat.h sys/time.h sys/timeb.h unistd.h values.h )
386 if test "x$ac_cv_header_stdint_h" = "xyes"; then
387 AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
390 dnl Checks for typedefs, structures, and compiler characteristics.
397 dnl Checks for library functions.
399 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
403 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
404 random drand48 setitimer getitimer signal GetLocalTime rint getrusage ] )
407 AM_CONFIG_HEADER(simgear/simgear_config.h)
414 simgear/compatibility/Makefile \
415 simgear/compatibility/MIPSpro721/Makefile \
416 simgear/compatibility/MIPSpro740/Makefile \
417 simgear/bucket/Makefile \
418 simgear/debug/Makefile \
419 simgear/ephemeris/Makefile \
420 simgear/io/Makefile \
421 simgear/magvar/Makefile \
422 simgear/math/Makefile \
423 simgear/environment/Makefile \
424 simgear/misc/Makefile \
425 simgear/nasal/Makefile \
426 simgear/props/Makefile \
427 simgear/route/Makefile \
428 simgear/scene/Makefile \
429 simgear/scene/material/Makefile \
430 simgear/scene/model/Makefile \
431 simgear/scene/sky/Makefile \
432 simgear/scene/tgdb/Makefile \
433 simgear/screen/Makefile \
434 simgear/serial/Makefile \
435 simgear/sound/Makefile \
436 simgear/structure/Makefile \
437 simgear/threads/Makefile \
438 simgear/timing/Makefile \
439 simgear/xml/Makefile \
445 echo "Configure Summary"
446 echo "================="
448 echo "Prefix: $prefix"
450 if test "x$with_logging" != "x"; then
451 echo "Debug messages: $with_logging"
453 echo "Debug messages: yes"
456 echo -n "Automake version: "
457 automake --version | head -1
459 if test "x$with_jpeg_factory" = "xyes"; then
460 echo "With JPEG Factory support"
462 echo "Without JPEG Factory support"
465 if test "x$ac_cv_header_pthread_h" = "xyes"; then
466 echo "Threads: pthread lib found."
468 echo "Threads: no threads (pthread lib not found.)"