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 becuase 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 dnl Check for MS Windows environment
75 AC_CHECK_HEADER(windows.h)
77 if test "x$HOSTTYPE" != "xmacintosh" ; then
78 dnl extra library and include directories
79 EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6"
81 if test -d /opt/X11R6 ; then
82 EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
85 if test "x$ac_cv_header_windows_h" = "xyes" ; then
86 if test -d /usr/mingw/usr ; then
87 EXTRA_DIRS="$EXTRA_DIRS /usr/mingw/usr"
89 EXTRA_DIRS="${EXTRA_DIRS} `pwd`/Win32"
93 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
95 dnl Using AM_CONDITIONAL is a step out of the protected little
96 dnl automake fold so it is potentially dangerous. But, we are
97 dnl beginning to run into cases where the standard checks are not
98 dnl enough. AM_CONDITIONALS are then referenced to conditionally
99 dnl build a Makefile.in from a Makefile.am which lets us define custom
100 dnl includes, compile alternative source files, etc.
102 dnl Enable serial support on Unix type systems
103 AM_CONDITIONAL(ENABLE_UNIX_SERIAL, true)
105 dnl X11 might be installed on Mac OS X, don't want to use it if it is.
106 if test "x$HOSTTYPE" != "xmacintosh" ; then
107 dnl Check for X11 (fancy)
111 dnl Checks for libraries.
119 dnl Thread related checks
120 AC_CHECK_LIB(pthread, pthread_exit)
121 AC_CHECK_HEADER(pthread.h)
122 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
123 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
124 CFLAGS="$CFLAGS -D_REENTRANT"
126 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
128 AC_CHECK_LIB(socket, socket)
130 dnl X11 might be installed, but we don't want to use it for OSX -dw-
131 if test "x$HOSTTYPE" != "xmacintosh" ; then
132 AC_CHECK_LIB(X11, XCreateWindow)
133 AC_CHECK_LIB(Xext, XShmCreateImage)
134 AC_CHECK_LIB(Xi, XGetExtensionVersion)
135 AC_CHECK_LIB(ICE, IceOpenConnection)
136 AC_CHECK_LIB(SM, SmcOpenConnection)
137 AC_CHECK_LIB(Xt, XtMalloc)
138 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
141 dnl check for OpenGL related libraries
143 if test "x$HOSTTYPE" = "xmacintosh" ; then
145 LIBS="$LIBS -framework OpenGL -framework GLUT"
146 elif test "x$ac_cv_header_windows_h" != "xyes" ; then
147 dnl Reasonable stuff for X-Windows based machines
149 AC_CHECK_LIB(GLcore, glNewList)
150 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
151 dnl if no GLcore, check for GL
152 AC_CHECK_LIB(GL, glNewList)
153 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
154 dnl if no GL, check for MesaGL
155 AC_CHECK_LIB(MesaGL, glNewList)
158 dnl if GLcore found, then also check for GL
159 AC_CHECK_LIB(GL, glXCreateContext)
162 dnl if using mesa, check for xmesa.h
163 if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
164 AC_CHECK_HEADER(GL/xmesa.h)
165 if test "x$ac_cv_header_GL_xmesa_h" = "xyes"; then
171 AC_CHECK_LIB(GLU, gluLookAt)
172 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
173 dnl if no GLU, check for MesaGLU
174 AC_CHECK_LIB(MesaGLU, gluLookAt)
178 AC_CHECK_LIB(glut, glutGetModifiers)
180 dnl test for glutGameModeString, but avoid adding glut a second time into
181 dnl the list of libraries
183 AC_CHECK_LIB(glut, glutGameModeString)
188 echo Win32 specific hacks...
191 dnl force a failed check since we will be building under windoze
192 AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
194 dnl just define these to true and hope for the best
195 ac_cv_lib_glut_glutGetModifiers="yes"
196 ac_cv_lib_glut_glutGameModeString="yes"
198 if test "x$with_sgi_opengl" = "xyes" ; then
199 echo "Building with glut.dll, glu.dll, and opengl.dll"
204 echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
207 WIN32_OPENGL=opengl32
210 LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
211 LIBS="$LIBS -luser32 -lgdi32"
212 echo "Will link apps with $LIBS"
215 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
217 echo "Unable to find the necessary OpenGL or GLUT libraries."
218 echo "See config.log for automated test details and results ..."
222 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
224 echo "Your version of glut doesn't support game mode."
225 echo "You need to fetch and install the latest version of glut from:"
227 echo " http://reality.sgi.com/opengl/glut3/glut3.html"
235 AC_SUBST(opengl_LIBS)
237 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
239 dnl Check for "plib" without which we cannot go on
240 AC_CHECK_HEADER(plib/pu.h)
241 if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
243 echo "You *must* have the plib library installed on your system to build"
244 echo "the FGFS simulator!"
246 echo "Please see README.plib for more details."
248 echo "configure aborted."
252 dnl Check for system installed metakit
253 AC_CHECK_HEADER(mk4.h)
254 if test "x$ac_cv_header_mk4_h" != "xyes"; then
255 echo "Metakit not found, you will need to install this first."
256 echo "Please read the README.metakit for more information."
261 dnl Specify if we want logging (testing build) or not (release build)
263 dnl Check for system installed zlib
264 AC_CHECK_HEADER(zlib.h)
265 if test "x$ac_cv_header_zlib_h" != "xyes"; then
266 echo "zlib not found, you will need to install this first."
267 echo "Please read the README.zlib for more information."
271 dnl Checks for header files.
274 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
275 sys/stat.h sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
277 if test "x$ac_cv_header_stdint_h" = "xyes"; then
278 AC_DEFINE( HAVE_STDINT_H )
281 dnl Checks for typedefs, structures, and compiler characteristics.
287 dnl Checks for library functions.
290 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
291 random setitimer getitimer signal GetLocalTime rint getrusage )
293 AM_CONFIG_HEADER(simgear/simgear_config.h)
300 simgear/bucket/Makefile \
301 simgear/debug/Makefile \
302 simgear/ephemeris/Makefile \
303 simgear/io/Makefile \
304 simgear/magvar/Makefile \
305 simgear/math/Makefile \
306 simgear/metar/Makefile \
307 simgear/misc/Makefile \
308 simgear/route/Makefile \
309 simgear/screen/Makefile \
310 simgear/serial/Makefile \
311 simgear/sky/Makefile \
312 simgear/threads/Makefile \
313 simgear/timing/Makefile \
314 simgear/xgl/Makefile \
315 simgear/xml/Makefile \
318 # AC_OUTPUT_COMMANDS([])
321 echo "Configure Summary"
322 echo "================="
324 echo "Prefix: $prefix"
326 if test "x$with_logging" != "x"; then
327 echo "Debug messages: $with_logging"
329 echo "Debug messages: yes"
332 if test "x$with_efence" != "x"; then
333 echo "Electric fence: $with_efence"
335 echo "Electric fence: no"
338 echo -n "Automake version: ($AUTO_MAKE_VERSION) "
339 automake --version | head -1
341 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
342 echo "Threads: pthread lib found."
344 echo "Threads: no threads (pthread lib not found.)"
347 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
348 if test "$CXX" = "CC"; then
349 echo "\nRemember to run: sh ../FlightGear/irix-hack.sh!\07\n"