1 dnl Process this file with aclocal ; automake -a ; autoconf to produce a
2 dnl working configure script.
6 AC_INIT(simgear/bucket/newbucket.cxx)
8 dnl Initialize the automake stuff
9 AM_INIT_AUTOMAKE(SimGear, 0.0.17)
11 dnl Specify KAI C++ compiler and flags.
12 dnl Borrowed with slight modification from blitz distribution.
14 [ --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
16 KCC*) # KAI C++ http://www.kai.com/
17 echo "Configuring for KAI C++"
18 AC_SG_SET_COMPILER($withval,"KCC","--restrict --strict_warnings")
19 CXX_OPTIMIZE_FLAGS=="+K3 -O3"
20 CXX_DEBUG_FLAGS="-g +K0"
28 dnl Checks for programs.
39 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
40 if test "$CXX" = "CC"; then
46 if echo $includedir | egrep "simgear$" > /dev/null; then
47 echo "includedir is" $includedir "libdir is" $libdir
49 includedir="${includedir}/simgear"
50 echo "includedir changed to" $includedir "libdir is" $libdir
53 # Determine version of automake ... important because of
54 # incompatibilities between versions
55 AUTO_MAKE_VERSION=`automake --version | head -1 | awk '{print $4}' | sed -e 's/\-p[[0-9]]$//' | sed -e 's/\.//'`
56 AM_CONDITIONAL(ANCIENT_AUTOMAKE, test $AUTO_MAKE_VERSION -lt 14)
57 AM_CONDITIONAL(OLD_AUTOMAKE, test $AUTO_MAKE_VERSION -lt 15)
59 # set logging default value
61 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
62 if test "x$with_logging" = "xno" ; then
66 dnl specify if we are building with "electric fence"
67 AC_ARG_WITH(efence, [ --with-efence Specify if we are building with "electric-fence"])
69 if test "x$with_efence" = "xyes" ; then
70 echo "Building with efence"
74 # Specify if we want to build with Norman's jpeg image server support.
75 # This requires libjpeg to be installed and available.
76 # Default to with_jpeg_server=no
78 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
79 if test "x$with_jpeg_factory" = "xyes" ; then
80 echo "Building with Norman's jpeg image factory support"
81 AC_CHECK_LIB(jpeg, jpeg_start_compress)
82 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
84 echo "In order to build the jpeg factory code you need libjpeg installed."
85 echo "otherwise please configure with the --with-jpeg-sever=no option"
87 echo "libjpeg is available at :"
88 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
92 echo "Building without Norman's jpeg image server support"
94 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
97 dnl Check for MS Windows environment
98 AC_CHECK_HEADER(windows.h)
104 ],is_mingw=yes, is_mingw=no)
106 echo "IS_MINGW = "$is_mingw
107 AM_CONDITIONAL(IS_MINGW, test $is_mingw="yes")
113 ],is_cygwin=yes, is_cygwin=no)
115 echo "IS_CYGWIN = "$is_cygwin
116 AM_CONDITIONAL(IS_CYGWIN, test $is_cygwin="yes")
118 if test "x$HOSTTYPE" != "xmacintosh" -a "x$is_mingw" != "xyes"; then
119 dnl extra library and include directories
120 EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6"
122 if test -d /opt/X11R6 ; then
123 EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
127 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
129 dnl Using AM_CONDITIONAL is a step out of the protected little
130 dnl automake fold so it is potentially dangerous. But, we are
131 dnl beginning to run into cases where the standard checks are not
132 dnl enough. AM_CONDITIONALS are then referenced to conditionally
133 dnl build a Makefile.in from a Makefile.am which lets us define custom
134 dnl includes, compile alternative source files, etc.
136 dnl Enable serial support on Unix type systems
137 AM_CONDITIONAL(ENABLE_UNIX_SERIAL, true)
139 dnl X11 might be installed on Mac OS X, don't want to use it if it is.
140 if test "x$HOSTTYPE" != "xmacintosh" ; then
141 dnl Check for X11 (fancy)
145 dnl Checks for libraries.
153 dnl Thread related checks
154 AC_CHECK_LIB(pthread, pthread_exit)
155 AC_CHECK_HEADER(pthread.h)
156 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
157 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
158 CFLAGS="$CFLAGS -D_REENTRANT"
160 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
162 AC_CHECK_LIB(socket, socket)
164 dnl X11 might be installed, but we don't want to use it for OSX -dw-
165 if test "x$HOSTTYPE" != "xmacintosh" ; then
166 AC_CHECK_LIB(X11, XCreateWindow)
167 AC_CHECK_LIB(Xext, XShmCreateImage)
168 AC_CHECK_LIB(Xi, XGetExtensionVersion)
169 AC_CHECK_LIB(ICE, IceOpenConnection)
170 AC_CHECK_LIB(SM, SmcOpenConnection)
171 AC_CHECK_LIB(Xt, XtMalloc)
172 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
175 dnl check for OpenGL related libraries
177 if test "x$HOSTTYPE" = "xmacintosh" ; then
179 LIBS="$LIBS -framework OpenGL -framework GLUT"
180 elif test "x$ac_cv_header_windows_h" != "xyes" ; then
181 dnl Reasonable stuff for X-Windows based machines
183 AC_CHECK_LIB(GLcore, glNewList)
184 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
185 dnl if no GLcore, check for GL
186 AC_CHECK_LIB(GL, glNewList)
187 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
188 dnl if no GL, check for MesaGL
189 AC_CHECK_LIB(MesaGL, glNewList)
192 dnl if GLcore found, then also check for GL
193 AC_CHECK_LIB(GL, glXCreateContext)
196 dnl if using mesa, check for xmesa.h
197 if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
198 AC_CHECK_HEADER(GL/xmesa.h)
199 if test "x$ac_cv_header_GL_xmesa_h" = "xyes"; then
205 AC_CHECK_LIB(GLU, gluLookAt)
206 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
207 dnl if no GLU, check for MesaGLU
208 AC_CHECK_LIB(MesaGLU, gluLookAt)
212 AC_CHECK_LIB(glut, glutGetModifiers)
214 dnl test for glutGameModeString, but avoid adding glut a second time into
215 dnl the list of libraries
217 AC_CHECK_LIB(glut, glutGameModeString)
222 echo Win32 specific hacks...
225 dnl force a failed check since we will be building under windoze
226 AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
228 dnl just define these to true and hope for the best
229 ac_cv_lib_glut_glutGetModifiers="yes"
230 ac_cv_lib_glut_glutGameModeString="yes"
232 if test "x$with_sgi_opengl" = "xyes" ; then
233 echo "Building with glut.dll, glu.dll, and opengl.dll"
238 echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
241 WIN32_OPENGL=opengl32
244 LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
245 LIBS="$LIBS -luser32 -lgdi32"
246 if test "x$is_mingw" = "xyes" ; then
247 EXTRA_DIRS="${EXTRA_DIRS}"
249 echo "Will link apps with $LIBS"
252 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
254 echo "Unable to find the necessary OpenGL or GLUT libraries."
255 echo "See config.log for automated test details and results ..."
259 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
261 echo "Your version of glut doesn't support game mode."
262 echo "You need to fetch and install the latest version of glut from:"
264 echo " http://reality.sgi.com/opengl/glut3/glut3.html"
272 AC_SUBST(opengl_LIBS)
274 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
276 dnl Check for "plib" without which we cannot go on
277 AC_CHECK_HEADER(plib/pu.h)
278 if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
280 echo "You *must* have the plib library installed on your system to build"
281 echo "the FGFS simulator!"
283 echo "Please see README.plib for more details."
285 echo "configure aborted."
289 dnl Check for system installed metakit
290 AC_CHECK_HEADER(mk4.h)
291 if test "x$ac_cv_header_mk4_h" != "xyes"; then
292 echo "Metakit not found, you will need to install this first."
293 echo "Please read the README.metakit for more information."
298 dnl Specify if we want logging (testing build) or not (release build)
300 dnl Check for system installed zlib
301 AC_CHECK_HEADER(zlib.h)
302 if test "x$ac_cv_header_zlib_h" != "xyes"; then
303 echo "zlib not found, you will need to install this first."
304 echo "Please read the README.zlib for more information."
308 dnl Checks for header files.
311 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
312 sys/stat.h sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
314 if test "x$ac_cv_header_stdint_h" = "xyes"; then
315 AC_DEFINE( HAVE_STDINT_H )
318 dnl Checks for typedefs, structures, and compiler characteristics.
324 dnl Checks for library functions.
327 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
328 random setitimer getitimer signal GetLocalTime rint getrusage )
330 AM_CONFIG_HEADER(simgear/simgear_config.h)
337 simgear/bucket/Makefile \
338 simgear/debug/Makefile \
339 simgear/ephemeris/Makefile \
340 simgear/io/Makefile \
341 simgear/magvar/Makefile \
342 simgear/math/Makefile \
343 simgear/metar/Makefile \
344 simgear/misc/Makefile \
345 simgear/route/Makefile \
346 simgear/screen/Makefile \
347 simgear/serial/Makefile \
348 simgear/sky/Makefile \
349 simgear/threads/Makefile \
350 simgear/timing/Makefile \
351 simgear/xgl/Makefile \
352 simgear/xml/Makefile \
355 # AC_OUTPUT_COMMANDS([])
358 echo "Configure Summary"
359 echo "================="
361 echo "Prefix: $prefix"
363 if test "x$with_logging" != "x"; then
364 echo "Debug messages: $with_logging"
366 echo "Debug messages: yes"
369 if test "x$with_efence" != "x"; then
370 echo "Electric fence: $with_efence"
372 echo "Electric fence: no"
375 echo -n "Automake version: ($AUTO_MAKE_VERSION) "
376 automake --version | head -1
378 if test "x$with_jpeg_factory" = "xyes"; then
379 echo "With JPEG Factory support"
381 echo "Without JPEG Factory support"
384 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
385 echo "Threads: pthread lib found."
387 echo "Threads: no threads (pthread lib not found.)"