]> git.mxchange.org Git - simgear.git/blob - configure.in
-Added .cvsignore files to clean up CVS messages
[simgear.git] / configure.in
1 dnl Process this file with aclocal ; automake -a ; autoconf to produce a 
2 dnl working configure script.
3 dnl
4 dnl $Id$
5
6 AC_INIT(simgear/bucket/newbucket.cxx)
7
8 dnl Initialize the automake stuff
9 AM_INIT_AUTOMAKE(SimGear, 0.0.17)
10
11 dnl Specify KAI C++ compiler and flags.
12 dnl Borrowed with slight modification from blitz distribution.
13 AC_ARG_WITH(cxx,
14   [  --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
15   [case "$withval" in
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"
21     ;;
22   esac
23 ])
24
25 echo CXX = $CXX
26 echo CC = $CC
27
28 dnl Checks for programs.
29 AC_PROG_MAKE_SET
30 AC_PROG_CC
31 AC_PROG_CPP
32 AC_PROG_CXX
33 AC_PROG_RANLIB
34 AC_PROG_INSTALL
35 AC_PROG_LN_S
36
37 AR="ar"
38 OS=`uname -s`
39 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
40     if test "$CXX" = "CC"; then
41         AR="CC -ar"
42         AC_SUBST(AR)
43     fi
44 fi
45
46 if echo $includedir | egrep "simgear$" > /dev/null; then
47     echo "includedir is" $includedir "libdir is" $libdir
48 else
49     includedir="${includedir}/simgear"
50     echo "includedir changed to" $includedir "libdir is" $libdir
51 fi
52          
53 # set logging default value
54 # with_logging=yes
55 AC_ARG_WITH(logging, [  --with-logging          Include logging output (default)])
56 if test "x$with_logging" = "xno" ; then
57     AC_DEFINE(FG_NDEBUG)
58 fi
59
60 dnl specify if we are building with "checker"
61 AC_ARG_WITH(efence, [  --with-efence           Specify if we are building with "electric-fence"])
62
63 if test "x$with_efence" = "xyes" ; then
64     echo "Building with efence"
65     LIBS="$LIBS -lefence"
66 fi
67
68 dnl Check for MS Windows environment
69 AC_CHECK_HEADER(windows.h)
70
71 if test "$HOSTTYPE" != "macintosh" ; then
72     dnl extra library and include directories
73     EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6"
74
75     if test -d /opt/X11R6 ; then
76         EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
77     fi
78
79     if test "x$ac_cv_header_windows_h" = "xyes" ; then
80         if test -d /usr/mingw/usr ; then
81             EXTRA_DIRS="$EXTRA_DIRS /usr/mingw/usr"
82         fi
83         EXTRA_DIRS="${EXTRA_DIRS} `pwd`/Win32"
84     fi
85 fi
86
87 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
88
89 dnl Using AM_CONDITIONAL is a step out of the protected little 
90 dnl automake fold so it is potentially dangerous.  But, we are
91 dnl beginning to run into cases where the standard checks are not
92 dnl enough.  AM_CONDITIONALS are then referenced to conditionally
93 dnl build a Makefile.in from a Makefile.am which lets us define custom
94 dnl includes, compile alternative source files, etc.
95
96 dnl Enable serial support on Unix type systems
97 AM_CONDITIONAL(ENABLE_UNIX_SERIAL, true)
98
99 dnl X11 might be installed on Mac OS X, don't want to use it if it is.
100 if test "$HOSTTYPE" != "macintosh" ; then
101     dnl Check for X11 (fancy)
102     AC_PATH_XTRA
103 fi
104
105 dnl Checks for libraries.
106
107 null_LIBS="$LIBS"
108
109 AC_CHECK_LIB(m, cos)
110
111 base_LIBS="$LIBS"
112
113 dnl Thread related checks
114 AC_CHECK_LIB(pthread, pthread_exit)
115 AC_CHECK_HEADER(pthread.h)
116 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
117     CXXFLAGS="$CXXFLAGS -D_REENTRANT"
118     CFLAGS="$CFLAGS -D_REENTRANT"
119 fi
120 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
121
122 AC_CHECK_LIB(socket, socket)
123
124 dnl X11 might be installed, but we don't want to use it for OSX -dw-
125 if test "$HOSTTYPE" != "macintosh" ; then
126     AC_CHECK_LIB(X11, XCreateWindow)
127     AC_CHECK_LIB(Xext, XShmCreateImage)
128     AC_CHECK_LIB(Xi, XGetExtensionVersion)
129     AC_CHECK_LIB(ICE, IceOpenConnection)
130     AC_CHECK_LIB(SM, SmcOpenConnection)
131     AC_CHECK_LIB(Xt, XtMalloc)
132     AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
133 fi
134
135 dnl check for OpenGL related libraries
136
137 if test "$HOSTTYPE" = "macintosh" ; then
138     dnl Macintosh OSX
139     LIBS="$LIBS -framework OpenGL -framework GLUT"
140 elif test "x$ac_cv_header_windows_h" != "xyes" ; then
141     dnl Reasonable stuff for non-windoze variants ... :-)
142
143     AC_CHECK_LIB(GLcore, glNewList)
144     if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
145         dnl if no GLcore, check for GL
146         AC_CHECK_LIB(GL, glNewList)
147         if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
148             dnl if no GL, check for MesaGL
149             AC_CHECK_LIB(MesaGL, glNewList)
150         fi
151     else
152         dnl if GLcore found, then also check for GL
153         AC_CHECK_LIB(GL, glXCreateContext)
154     fi
155
156     dnl if using mesa, check for xmesa.h
157     if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
158         AC_CHECK_HEADER(GL/xmesa.h)
159         if test "x$ac_cv_header_GL_xmesa_h" = "xyes"; then
160             AC_DEFINE( XMESA )
161             AC_DEFINE( FX )
162         fi
163     fi
164
165     AC_CHECK_LIB(GLU, gluLookAt)
166     if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
167         dnl if no GLU, check for MesaGLU
168         AC_CHECK_LIB(MesaGLU, gluLookAt)
169     fi
170
171     dnl check for glut
172     AC_CHECK_LIB(glut, glutGetModifiers)
173
174     dnl test for glutGameModeString, but avoid adding glut a second time into
175     dnl the list of libraries
176     save_LIBS="$LIBS"
177     AC_CHECK_LIB(glut, glutGameModeString)
178     LIBS="$save_LIBS"
179 else
180     dnl Win32 is a little wierd because it has to try to handle the various
181     dnl winbloze-isms.  We'll just do this manually for now.
182
183     echo Win32 specific hacks...
184     AC_DEFINE(WIN32)
185
186     dnl force a failed check since we will be building under windoze
187     AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
188
189     dnl just define these to true and hope for the best
190     ac_cv_lib_glut_glutGetModifiers="yes"
191     ac_cv_lib_glut_glutGameModeString="yes"
192
193     if test "x$with_sgi_opengl" = "xyes" ; then
194         echo "Building with glut.dll, glu.dll, and opengl.dll"
195         WIN32_GLUT=glut
196         WIN32_GLU=glu
197         WIN32_OPENGL=opengl
198     else 
199         echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
200         WIN32_GLUT=glut32
201         WIN32_GLU=glu32
202         WIN32_OPENGL=opengl32
203     fi
204
205     LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
206     LIBS="$LIBS -luser32 -lgdi32"
207     echo "Will link apps with $LIBS"
208 fi
209
210 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
211     echo 
212     echo "Unable to find the necessary OpenGL or GLUT libraries."
213     echo "See config.log for automated test details and results ..."
214     exit 1
215 fi
216
217 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
218     echo
219     echo "Your version of glut doesn't support game mode."
220     echo "You need to fetch and install the latest version of glut from:"
221     echo
222     echo "    http://reality.sgi.com/opengl/glut3/glut3.html"
223     exit 1
224 fi
225
226 opengl_LIBS="$LIBS"
227 LIBS="$base_LIBS"
228
229 AC_SUBST(base_LIBS)
230 AC_SUBST(opengl_LIBS)
231
232 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
233
234 dnl Check for "plib" without which we cannot go on
235 AC_CHECK_HEADER(plib/pu.h)
236 if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
237     echo
238     echo "You *must* have the plib library installed on your system to build"
239     echo "the FGFS simulator!"
240     echo
241     echo "Please see README.plib for more details."
242     echo
243     echo "configure aborted."
244     exit
245 fi
246
247 # dnl Check for system installed gdbm
248 # AC_CHECK_HEADER(gdbm.h)
249 # if test "x$ac_cv_header_gdbm_h" = "xyes"; then
250 #     AC_DEFINE( HAVE_GDBM )
251 # else
252 #     echo "no gdbm found, configuring and building."
253 # fi
254 # AM_CONDITIONAL(HAVE_GDBM, test "x$ac_cv_header_gdbm_h" = "xyes" )
255
256 dnl Check for system installed metakit
257 AC_CHECK_HEADER(mk4.h)
258 if test "x$ac_cv_header_mk4_h" != "xyes"; then
259     echo "no metakit found, configuring and building."
260     # Run configure in the metakit subdir
261     AC_CONFIG_SUBDIRS( simgear/metakit/unix )
262 fi
263 AM_CONDITIONAL(HAVE_METAKIT, test "x$ac_cv_header_mk4_h" = "xyes" )
264
265
266 dnl Specify if we want logging (testing build) or not (release build)
267
268 dnl Check for system installed zlib
269 AC_CHECK_HEADER(zlib.h)
270 if test "x$ac_cv_header_zlib_h" = "xyes"; then
271     AC_DEFINE( HAVE_ZLIB )
272 else
273     echo "no zlib found, building."
274 fi
275 AM_CONDITIONAL(HAVE_ZLIB, test "x$ac_cv_header_zlib_h" = "xyes" )
276
277 dnl Checks for header files.
278 AC_HEADER_STDC
279 AC_CHECK_HEADERS( \
280         fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
281         sys/stat.h sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
282
283 if test "x$ac_cv_header_stdint_h" = "xyes"; then
284     AC_DEFINE( HAVE_STDINT_H )
285 fi
286
287 dnl Checks for typedefs, structures, and compiler characteristics.
288 AC_C_CONST
289 AC_TYPE_SIZE_T
290 AC_HEADER_TIME
291 AC_STRUCT_TM
292
293 dnl Checks for library functions.
294 AC_TYPE_SIGNAL
295 AC_FUNC_VPRINTF
296 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
297         random setitimer getitimer signal GetLocalTime rint getrusage )
298
299 AM_CONFIG_HEADER(simgear/simgear_config.h)
300
301 AC_OUTPUT( \
302         Makefile \
303         SimGear.spec \
304         simgear/Makefile \
305         simgear/version.h \
306         simgear/bucket/Makefile \
307         simgear/debug/Makefile \
308         simgear/ephemeris/Makefile \
309         simgear/io/Makefile \
310         simgear/magvar/Makefile \
311         simgear/math/Makefile \
312         simgear/metar/Makefile \
313         simgear/misc/Makefile \
314         simgear/route/Makefile \
315         simgear/screen/Makefile \
316         simgear/serial/Makefile \
317         simgear/sky/Makefile \
318         simgear/threads/Makefile \
319         simgear/timing/Makefile \
320         simgear/xgl/Makefile \
321         simgear/xml/Makefile \
322         simgear/zlib/Makefile \
323 )
324
325 AC_OUTPUT_COMMANDS([
326 #       if test "x$ac_cv_header_windows_h" = "xyes" ; then
327 #               cp simgear/gdbm/autoconf.h.cygwin32 simgear/gdbm/autoconf.h
328 #       fi
329 ])
330
331 echo ""
332 echo "Configure Summary"
333 echo "================="
334
335 echo "Prefix: $prefix"
336
337 if test "x$with_logging" != "x"; then
338     echo "Debug messages: $with_logging"
339 else
340     echo "Debug messages: yes"
341 fi
342
343 if test "x$with_efence" != "x"; then
344     echo "Electric fence: $with_efence"
345 else
346     echo "Electric fence: no"
347 fi
348
349 # if test "x$ac_cv_header_gdbm_h" != "xyes"; then
350 #    echo "Building gdbm"
351 # fi
352
353 if test "x$ac_cv_header_mk4_h" != "xyes"; then
354    echo "Building metakit"
355 fi
356
357 if test "x$ac_cv_header_zlib_h" != "xyes"; then
358    echo "Building zlib"
359 fi
360
361 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
362    echo "Threads: pthread lib found."
363 else
364    echo "Threads: no threads (pthread lib not found.)"
365 fi
366
367 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
368     if test "$CXX" = "CC"; then
369         echo "\nRemember to run: sh ../FlightGear/irix-hack.sh!\07\n"
370     fi
371 fi