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