1 dnl Process this file with aclocal ; automake -a ; autoconf to produce a
2 dnl working configure script.
7 AC_CONFIG_SRCDIR([simgear/bucket/newbucket.cxx])
9 # Require at least automake 2.52
12 dnl Initialize the automake stuff
13 AM_INIT_AUTOMAKE(SimGear, 0.0.19pre2)
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.
43 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
44 if test "$CXX" = "CC"; then
50 if echo $includedir | egrep "simgear$" > /dev/null; then
51 echo "includedir is" $includedir "libdir is" $libdir
53 includedir="${includedir}/simgear"
54 echo "includedir changed to" $includedir "libdir is" $libdir
57 # Determine version of automake ... important because of
58 # incompatibilities between versions
59 AUTO_MAKE_VERSION=`automake --version | head -1 | awk '{print $4}' | sed -e 's/\.\([0-9]*\).*/\1/'`
60 if test $AUTO_MAKE_VERSION -lt 15; then\
62 echo "You need to upgrade to automake version 1.5 or greater."
63 echo "Most distributions have packages available to install or you can"
64 echo "find the source for the most recent version at"
65 echo "ftp://ftp.gnu.org/gnu/automake"
69 # set logging default value
71 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
72 if test "x$with_logging" = "xno" ; then
73 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
76 # Specify if we want to build with Norman's jpeg image server support.
77 # This requires libjpeg to be installed and available.
78 # Default to with_jpeg_server=no
80 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
81 if test "x$with_jpeg_factory" = "xyes" ; then
82 echo "Building with Norman's jpeg image factory support"
83 AC_CHECK_LIB(jpeg, jpeg_start_compress)
84 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
86 echo "In order to build the jpeg factory code you need libjpeg installed."
87 echo "otherwise please configure with the --with-jpeg-sever=no option"
89 echo "libjpeg is available at :"
90 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
94 echo "Building without Norman's jpeg image server support"
96 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
99 dnl Check for MS Windows environment
100 AC_CHECK_HEADER(windows.h)
106 ],is_mingw=yes, is_mingw=no)
108 echo "IS_MINGW = $is_mingw"
109 AM_CONDITIONAL(IS_MINGW, test "x$is_mingw" = "xyes")
115 ],is_cygwin=yes, is_cygwin=no)
117 echo "IS_CYGWIN = $is_cygwin"
118 AM_CONDITIONAL(IS_CYGWIN, test "x$is_cygwin" = "xyes")
120 if test "x$HOSTTYPE" != "xmacintosh" -a "x$is_mingw" != "xyes"; then
121 dnl extra library and include directories
122 EXTRA_DIRS="/usr/local /usr/X11R6"
124 if test -d /opt/X11R6 ; then
125 EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
129 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
131 dnl Using AM_CONDITIONAL is a step out of the protected little
132 dnl automake fold so it is potentially dangerous. But, we are
133 dnl beginning to run into cases where the standard checks are not
134 dnl enough. AM_CONDITIONALS are then referenced to conditionally
135 dnl build a Makefile.in from a Makefile.am which lets us define custom
136 dnl includes, compile alternative source files, etc.
138 dnl X11 might be installed on Mac OS X, don't want to use it if it is.
139 if test "x$HOSTTYPE" != "xmacintosh" ; then
140 dnl Check for X11 (fancy)
144 dnl Checks for libraries.
152 dnl Thread related checks
153 AC_CHECK_LIB(pthread, pthread_exit)
154 AC_CHECK_HEADER(pthread.h)
155 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
156 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
157 CFLAGS="$CFLAGS -D_REENTRANT"
159 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
161 AC_CHECK_LIB(socket, socket)
163 dnl X11 might be installed, but we don't want to use it for OSX -dw-
164 if test "x$HOSTTYPE" != "xmacintosh" ; then
165 AC_CHECK_LIB(X11, XCreateWindow)
166 AC_CHECK_LIB(Xext, XShmCreateImage)
167 AC_CHECK_LIB(Xi, XGetExtensionVersion)
168 AC_CHECK_LIB(ICE, IceOpenConnection)
169 AC_CHECK_LIB(SM, SmcOpenConnection)
170 AC_CHECK_LIB(Xt, XtMalloc)
171 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
174 dnl check for OpenGL related libraries
176 if test "x$HOSTTYPE" = "xmacintosh" ; then
178 LIBS="$LIBS -framework OpenGL -framework GLUT"
179 elif test "x$ac_cv_header_windows_h" != "xyes" ; then
180 dnl Reasonable stuff for X-Windows based machines
182 AC_CHECK_LIB(GLcore, glNewList)
183 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
184 dnl if no GLcore, check for GL
185 AC_CHECK_LIB(GL, glNewList)
186 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
187 dnl if no GL, check for MesaGL
188 AC_CHECK_LIB(MesaGL, glNewList)
191 dnl if GLcore found, then also check for GL
192 AC_CHECK_LIB(GL, glXCreateContext)
195 dnl if using mesa, check for xmesa.h
196 if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
197 AC_CHECK_HEADER(GL/fxmesa.h)
198 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
199 AC_DEFINE([XMESA], 1, [Define for fxmesa])
200 AC_DEFINE([FX], 1, [Define for fxmesa])
204 AC_CHECK_LIB(GLU, gluLookAt)
205 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
206 dnl if no GLU, check for MesaGLU
207 AC_CHECK_LIB(MesaGLU, gluLookAt)
211 AC_CHECK_LIB(glut, glutGetModifiers)
213 dnl test for glutGameModeString, but avoid adding glut a second time into
214 dnl the list of libraries
216 AC_CHECK_LIB(glut, glutGameModeString)
221 echo Win32 specific hacks...
222 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
224 dnl just define these to true and hope for the best
225 ac_cv_lib_glut_glutGetModifiers="yes"
226 ac_cv_lib_glut_glutGameModeString="yes"
228 if test "x$with_sgi_opengl" = "xyes" ; then
229 echo "Building with glut.dll, glu.dll, and opengl.dll"
234 echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
237 WIN32_OPENGL=opengl32
240 LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
241 LIBS="$LIBS -luser32 -lgdi32"
242 if test "x$is_mingw" = "xyes" ; then
243 EXTRA_DIRS="${EXTRA_DIRS}"
245 echo "Will link apps with $LIBS"
248 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
250 echo "Unable to find the necessary OpenGL or GLUT libraries."
251 echo "See config.log for automated test details and results ..."
255 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
257 echo "Your version of glut doesn't support game mode."
258 echo "You need to install the latest version of glut. If your"
259 echo "distribution doesn't provide a newer version, you can get the source"
262 echo " http://reality.sgi.com/opengl/glut3/glut3.html"
270 AC_SUBST(opengl_LIBS)
272 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
274 # The following are C++ items that need to be tested for with the c++
279 dnl Check for "plib" without which we cannot go on
280 AC_CHECK_HEADER(plib/ul.h)
281 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
283 echo "You *must* have the plib library installed on your system to build"
286 echo "Please see README.plib for more details."
288 echo "configure aborted."
292 AC_MSG_CHECKING([for plib 1.6.0 or newer])
296 #define MIN_PLIB_VERSION 160
299 int major, minor, micro;
301 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
310 [AC_MSG_RESULT(wrong version);
311 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
315 dnl Check for system installed metakit
316 AC_CHECK_HEADER(mk4.h)
317 if test "x$ac_cv_header_mk4_h" != "xyes"; then
319 echo "Metakit not found, you will need to install this first."
320 echo "Please read the README.metakit for more information."
326 dnl Specify if we want logging (testing build) or not (release build)
328 dnl Check for system installed zlib
329 AC_CHECK_HEADER(zlib.h)
330 if test "x$ac_cv_header_zlib_h" != "xyes"; then
332 echo "zlib not found, you will need to install this first."
333 echo "Please read the README.zlib for more information."
337 dnl Checks for header files.
340 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
341 sys/stat.h sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
343 if test "x$ac_cv_header_stdint_h" = "xyes"; then
344 AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
347 dnl Checks for typedefs, structures, and compiler characteristics.
353 dnl Checks for library functions.
356 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
357 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
359 AM_CONFIG_HEADER(simgear/simgear_config.h)
367 simgear/bucket/Makefile \
368 simgear/debug/Makefile \
369 simgear/ephemeris/Makefile \
370 simgear/interpreter/Makefile \
371 simgear/io/Makefile \
372 simgear/magvar/Makefile \
373 simgear/math/Makefile \
374 simgear/metar/Makefile \
375 simgear/misc/Makefile \
376 simgear/route/Makefile \
377 simgear/screen/Makefile \
378 simgear/serial/Makefile \
379 simgear/sky/Makefile \
380 simgear/threads/Makefile \
381 simgear/timing/Makefile \
382 simgear/xgl/Makefile \
383 simgear/xml/Makefile \
389 echo "Configure Summary"
390 echo "================="
392 echo "Prefix: $prefix"
394 if test "x$with_logging" != "x"; then
395 echo "Debug messages: $with_logging"
397 echo "Debug messages: yes"
400 echo -n "Automake version: ($AUTO_MAKE_VERSION) "
401 automake --version | head -1
403 if test "x$with_jpeg_factory" = "xyes"; then
404 echo "With JPEG Factory support"
406 echo "Without JPEG Factory support"
409 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
410 echo "Threads: pthread lib found."
412 echo "Threads: no threads (pthread lib not found.)"