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