-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
350 lines (283 loc) · 8.6 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
dnl Process this file with aclocal ; automake -a ; autoconf to produce a
dnl working configure script.
dnl
dnl $Id: configure.ac,v 1.9 2005/07/27 22:32:16 daveluff Exp $
AC_INIT
AC_CONFIG_SRCDIR([src/Atlas.cxx])
dnl Initialize the automake stuff
AC_PREREQ(2.52)
AM_INIT_AUTOMAKE(Atlas, 0.3.0)
AC_CONFIG_HEADERS
dnl Checks for programs.
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_LN_S
dnl Check for MS Windows environment
AC_CHECK_HEADER(windows.h)
dnl Specify the plib location
AC_ARG_WITH(plib, [ --with-plib=prefix specify the prefix path to plib])
if test "x$with_plib" != "x" ; then
echo "Plib prefix path is $with_plib"
PLIB_DIR="$with_plib"
else
echo "Plib not specified"
PLIB_DIR=
fi
dnl Specify the simgear location
AC_ARG_WITH(simgear, [ --with-simgear=prefix specify the prefix path to simgear])
if test "x$with_simgear" != "x" ; then
echo "SimGear prefix path is $with_simgear"
SIMGEAR_DIR="$with_simgear"
else
echo "SimGear not specified"
SIMGEAR_DIR=
fi
dnl Specify the base package location
AC_ARG_WITH(fgbase, [ --with-fgbase=prefix specify the location of the FlightGear base package])
if test "x$with_fgbase" != "x" ; then
echo "FlightGear base package location is $with_fgbase"
fgbase_dir="$with_fgbase"
else
echo "FlightGear base package location not specified"
if test "x$prefix" != "x" ; then
echo "Default ${prefix}/lib/FlightGear"
fgbase_dir="${prefix}/lib/FlightGear"
else
echo "Default /usr/local/lib/FlightGear"
fgbase_dir="/usr/local/lib/FlightGear"
fi
fi
CXXFLAGS="$CXXFLAGS -DFGBASE_DIR='\"$fgbase_dir\"'"
AC_SUBST(fgbase_dir)
dnl set the $host variable based on local machine/os
AC_CANONICAL_HOST
case "${host}" in
*-*-irix*)
if test "$CXX" = "CC"; then
AR="CC -ar"
ARFLAGS="-o"
CXXFLAGS="$CXXFLAGS -I$with_simgear/include/simgear/compatibility"
else
AR="ar"
ARFLAGS="cru"
fi
;;
*)
AR="ar"
ARFLAGS="cru"
;;
esac
AC_SUBST(AR)
AC_SUBST(ARFLAGS)
dnl extra library and include directories
EXTRA_DIRS="${SIMGEAR_DIR} ${PLIB_DIR} /usr/local/plib"
dnl Determine an extra directories to add to include/lib search paths
case "${host}" in
*-apple-darwin* | *-*-mingw32*)
echo no EXTRA_DIRS for $host
;;
*-*-cygwin*)
if test -d /usr/local ; then
EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
fi
;;
*)
if test -d /usr/X11R6 ; then
EXTRA_DIR1="/usr/X11R6"
fi
if test -d /opt/X11R6 ; then
EXTRA_DIR2="/opt/X11R6"
fi
EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2 /usr/local/"
;;
esac
wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
dnl Using AM_CONDITIONAL is a step out of the protected little
dnl automake fold so it is potentially dangerous. But, we are
dnl beginning to run into cases where the standard checks are not
dnl enough. AM_CONDITIONALS are then referenced to conditionally
dnl build a Makefile.in from a Makefile.am which lets us define custom
dnl includes, compile alternative source files, etc.
dnl Enable serial support on Unix type systems
AM_CONDITIONAL(ENABLE_UNIX_SERIAL, true)
dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
dnl to use it if it is.
case "${host}" in
*-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
echo no fancy X11 check
;;
*)
AC_PATH_XTRA
;;
esac
dnl Checks for libraries.
null_LIBS="$LIBS"
AC_CHECK_LIB(m, cos)
base_LIBS="$LIBS"
AC_CHECK_LIB(pthread, pthread_exit)
dnl check for OpenGL related libraries
if test "x$ac_cv_header_windows_h" != "xyes" ; then
dnl Reasonable stuff for non-windoze variants ... :-)
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(X11, XCreateWindow)
AC_CHECK_LIB(Xext, XShmCreateImage)
AC_CHECK_LIB(Xi, XGetExtensionVersion)
AC_CHECK_LIB(ICE, IceOpenConnection)
AC_CHECK_LIB(SM, SmcOpenConnection)
AC_CHECK_LIB(Xt, XtMalloc)
AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
AC_CHECK_LIB(GLcore, glNewList)
if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
dnl if no GLcore, check for GL
AC_CHECK_LIB(GL, glNewList)
if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
dnl if no GL, check for MesaGL
AC_CHECK_LIB(MesaGL, glNewList)
fi
else
dnl if GLcore found, then also check for GL
AC_CHECK_LIB(GL, glXCreateContext)
fi
dnl if using mesa, check for xmesa.h
if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
AC_CHECK_HEADER(GL/xmesa.h)
if test "x$ac_cv_header_GL_xmesa_h" = "xyes"; then
AC_DEFINE([XMESA], 1, [Define for Mesa FX mode])
AC_DEFINE([FX], 1, [Define for Mesa FX mode])
fi
fi
AC_CHECK_LIB(GLU, gluLookAt)
if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
dnl if no GLU, check for MesaGLU
AC_CHECK_LIB(MesaGLU, gluLookAt)
fi
dnl check for glut
AC_CHECK_LIB(glut, glutGetModifiers)
dnl test for glutGameModeString, but avoid adding glut a second time into
dnl the list of libraries
save_LIBS="$LIBS"
AC_CHECK_LIB(glut, glutGameModeString)
LIBS="$save_LIBS"
else
dnl Win32 is a little wierd because it has to try to handle the various
dnl winbloze-isms. We'll just do this manually for now.
echo Win32 specific hacks...
AC_DEFINE([WIN32], 1, [Define if building on a Win32 platform])
dnl force a failed check since we will be building under windoze
# AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
dnl just define these to true and hope for the best
ac_cv_lib_glut_glutGetModifiers="yes"
ac_cv_lib_glut_glutGameModeString="yes"
if test "x$with_sgi_opengl" = "xyes" ; then
echo "Building with glut.dll, glu.dll, and opengl.dll"
WIN32_GLUT=glut
WIN32_GLU=glu
WIN32_OPENGL=opengl
else
echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
WIN32_GLUT=glut32
WIN32_GLU=glu32
WIN32_OPENGL=opengl32
fi
LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
LIBS="$LIBS -luser32 -lgdi32"
echo "Will link apps with $LIBS"
fi
if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
echo
echo "Unable to find the necessary OpenGL or GLUT libraries."
echo "See config.log for automated test details and results ..."
exit 1
fi
opengl_LIBS="$LIBS"
LIBS="$base_LIBS"
AC_SUBST(base_LIBS)
AC_SUBST(opengl_LIBS)
AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
AC_LANG_PUSH(C++)
dnl Check for "plib" without which we cannot go on
AC_CHECK_HEADER(plib/pu.h)
if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
echo
echo "You *must* have the plib library installed on your system to build"
echo "the FGFS simulator!"
echo
echo "Please see README.plib for more details."
echo
echo "configure aborted."
exit
fi
AC_CHECK_LIB(plibul, ulInit,,,)
AC_LANG_POP(C++)
# Check for the presence of SimGear
AC_CHECK_HEADER(simgear/version.h)
if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
echo
echo "You *must* have the SimGear support library installed on your system"
echo "to build the FGFS simulator!"
echo
echo "Please see README.SimGear for more details."
echo
echo "configure aborted."
exit
fi
AC_MSG_CHECKING(for proper simgear version)
AC_TRY_RUN([
#include <stdio.h>
#include <simgear/version.h>
#if !defined(SIMGEAR_VERSION)
#error simgear version too old, please upgrade.
#endif
#define STRINGIFY(X) XSTRINGIFY(X)
#define XSTRINGIFY(X) #X
#define MIN_MAJOR 0
#define MIN_MINOR 0
#define MIN_MICRO 13
int main() {
int major, minor, micro;
printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ );
if ( major < MIN_MAJOR ) {
return -1;
} else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
return -1;
} else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
return -1;
}
return 0;
}
],
AC_MSG_RESULT(yes),
[AC_MSG_RESULT(wrong version);
AC_MSG_ERROR([Install latest simgear first...])],
AC_MSG_RESULT(yes)
)
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS( fcntl.h unistd.h windows.h winbase.h values.h )
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
random setitimer getitimer signal GetLocalTime rint getrusage )
AM_CONFIG_HEADER(src/config.h)
AC_CONFIG_FILES([ \
Makefile \
src/Makefile \
src/buildmaps.sh \
src/data/Makefile
])
AC_OUTPUT
echo ""
echo "Configure Summary"
echo "================="
echo "Prefix: $prefix"
echo ""