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.4-pre1)
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"
51 compatibility_DIR="compatibility"
62 AC_SUBST(compatibility_DIR)
64 if echo $includedir | egrep "simgear$" > /dev/null; then
65 echo "includedir is" $includedir "libdir is" $libdir
67 includedir="${includedir}/simgear"
68 echo "includedir changed to" $includedir "libdir is" $libdir
71 dnl set logging; default value of with_logging=yes
72 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
73 if test "x$with_logging" = "xno" ; then
74 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
77 # Specify if we want to build with Norman's jpeg image server support.
78 # This requires libjpeg to be installed and available.
79 # Default to with_jpeg_server=no
81 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
82 if test "x$with_jpeg_factory" = "xyes" ; then
83 echo "Building with Norman's jpeg image factory support"
84 AC_CHECK_LIB(jpeg, jpeg_start_compress)
85 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
87 echo "In order to build the jpeg factory code you need libjpeg installed."
88 echo "otherwise please configure with the --with-jpeg-sever=no option"
90 echo "libjpeg is available at :"
91 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
95 echo "Building without Norman's jpeg image server support"
97 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
100 dnl Determine an extra directories to add to include/lib search paths
102 *-apple-darwin* | *-*-mingw32*)
103 echo no EXTRA_DIRS for $host
107 if test -d /usr/X11R6 ; then
108 EXTRA_DIR1="/usr/X11R6"
110 if test -d /opt/X11R6 ; then
111 EXTRA_DIR2="/opt/X11R6"
113 EXTRA_DIRS="$EXTRA_DIR1 $EXTRA_DIR2"
117 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
120 dnl Using AM_CONDITIONAL is a step out of the protected little
121 dnl automake fold so it is potentially dangerous. But, we are
122 dnl beginning to run into cases where the standard checks are not
123 dnl enough. AM_CONDITIONALS are then referenced to conditionally
124 dnl build a Makefile.in from a Makefile.am which lets us define custom
125 dnl includes, compile alternative source files, etc.
127 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
128 dnl to use it if it is.
130 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
131 echo no fancy X11 check
140 dnl Checks for libraries.
142 dnl Thread related checks
143 AC_CHECK_HEADER(pthread.h)
144 AC_CHECK_LIB(pthread, pthread_exit)
145 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
146 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
147 CFLAGS="$CFLAGS -D_REENTRANT"
149 if test "x$ac_cv_lib_pthread_pthread_exit" != "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
150 dnl FreeBSD: System has pthread.h, but -lpthread library check
151 dnl fails. See if we need -pthread instead of -lpthread and look
152 dnl for the functions in libc_r.
153 save_CXXFLAGS="$CXXFLAGS"
154 save_CFLAGS="$CFLAGS"
155 CXXFLAGS="-pthread $CXXFLAGS"
156 CFLAGS="-pthread $FLAGS"
158 AC_CHECK_LIB(c_r, pthread_exit)
159 if test "x$ac_cv_lib_c_r_pthread_exit" != "xyes"; then
160 CXXFLAGS=$save_CXXFLAGS
163 dnl This is cheating a bit. pthread_exit comes with using -pthread, not
165 ac_cv_lib_pthread_pthread_exit="yes"
170 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
175 dnl search for network related libraries
176 AC_SEARCH_LIBS(inet_addr, xnet)
177 AC_SEARCH_LIBS(socket, socket)
182 dnl check for some default libraries
183 AC_SEARCH_LIBS(cos, m)
187 dnl check for OpenGL related libraries
189 *-*-cygwin* | *-*-mingw32*)
190 dnl CygWin under Windoze.
192 echo Win32 specific hacks...
193 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
194 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
196 LIBS="$LIBS -lglu32 -lopengl32"
197 LIBS="$LIBS -luser32 -lgdi32 -lwinmm"
199 dnl add -lwsock32 for mingwin
202 base_LIBS="$base_LIBS -lws2_32"
206 echo "Will link apps with $LIBS"
212 LIBS="$LIBS -framework OpenGL -framework Carbon -lobjc"
216 dnl X-Windows based machines
218 AC_SEARCH_LIBS(XCreateWindow, X11)
219 AC_SEARCH_LIBS(XShmCreateImage, Xext)
220 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
221 AC_SEARCH_LIBS(IceOpenConnection, ICE)
222 AC_SEARCH_LIBS(SmcOpenConnection, SM)
223 AC_SEARCH_LIBS(XtMalloc, Xt)
224 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
226 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
227 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
228 dnl if GLcore found, then also check for GL
229 AC_SEARCH_LIBS(glXCreateContext, GL)
232 dnl if using mesa, check for xmesa.h
233 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
234 AC_CHECK_HEADER(GL/fxmesa.h)
235 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
236 AC_DEFINE([XMESA], 1, [Define for fxmesa])
237 AC_DEFINE([FX], 1, [Define for fxmesa])
241 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
250 AC_SUBST(opengl_LIBS)
251 AC_SUBST(thread_LIBS)
252 AC_SUBST(network_LIBS)
254 dnl Check for MS Windows environment
255 AC_CHECK_HEADER(windows.h)
256 AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
258 # The following are C++ items that need to be tested for with the c++
263 dnl Check for "plib" without which we cannot go on
264 AC_CHECK_HEADER(plib/ul.h)
265 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
267 echo "You *must* have the plib library installed on your system to build"
270 echo "Please see README.plib for more details."
272 echo "configure aborted."
276 AC_MSG_CHECKING([for plib 1.6.0 or newer])
280 #define MIN_PLIB_VERSION 160
283 int major, minor, micro;
285 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
294 [AC_MSG_RESULT(wrong version);
295 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
303 dnl Check for system installed zlib
304 AC_CHECK_HEADER(zlib.h)
305 if test "x$ac_cv_header_zlib_h" != "xyes"; then
307 echo "zlib library not found."
309 echo "If your OS does not provide an installable package for zlib"
310 echo "you will have to compile and install it first yourself. A copy"
311 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
312 echo "have to untar this source code, and follow its included instructions"
313 echo "to compile and install on your system."
315 echo "configure aborted."
319 dnl Checks for header files.
322 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
323 sys/stat.h sys/time.h sys/timeb.h unistd.h values.h )
325 if test "x$ac_cv_header_stdint_h" = "xyes"; then
326 AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
329 dnl Checks for typedefs, structures, and compiler characteristics.
335 dnl Checks for library functions.
339 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
340 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
342 AM_CONFIG_HEADER(simgear/simgear_config.h)
350 simgear/compatibility/Makefile \
351 simgear/bucket/Makefile \
352 simgear/debug/Makefile \
353 simgear/ephemeris/Makefile \
354 simgear/io/Makefile \
355 simgear/magvar/Makefile \
356 simgear/math/Makefile \
357 simgear/metar/Makefile \
358 simgear/misc/Makefile \
359 simgear/props/Makefile \
360 simgear/route/Makefile \
361 simgear/scene/Makefile \
362 simgear/scene/material/Makefile \
363 simgear/scene/model/Makefile \
364 simgear/scene/sky/Makefile \
365 simgear/scene/sky/clouds3d/Makefile \
366 simgear/scene/tgdb/Makefile \
367 simgear/screen/Makefile \
368 simgear/serial/Makefile \
369 simgear/sound/Makefile \
370 simgear/structure/Makefile \
371 simgear/threads/Makefile \
372 simgear/timing/Makefile \
373 simgear/xgl/Makefile \
374 simgear/xml/Makefile \
380 echo "Configure Summary"
381 echo "================="
383 echo "Prefix: $prefix"
385 if test "x$with_logging" != "x"; then
386 echo "Debug messages: $with_logging"
388 echo "Debug messages: yes"
391 echo -n "Automake version: "
392 automake --version | head -1
394 if test "x$with_jpeg_factory" = "xyes"; then
395 echo "With JPEG Factory support"
397 echo "Without JPEG Factory support"
400 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
401 echo "Threads: pthread lib found."
403 echo "Threads: no threads (pthread lib not found.)"