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