-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.in
346 lines (296 loc) · 8.06 KB
/
configure.in
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(April/Headers/signature.h)
AM_INIT_AUTOMAKE(april,5.0.0-beta-14)
dnl Add macros to aclocal include list
ACLOCAL="aclocal -I macros"
dnl We want a configuration header file
AM_CONFIG_HEADER(config.h)
dnl We prefer to install in /opt
AC_PREFIX_DEFAULT(/opt/april)
dnl enable/disable ANSI colours in output
AC_ARG_ENABLE(colours,
[ --enable-colours Turn on ANSI colours in output [default=no]],
[case "${enableval}" in
no)
AC_DEFINE(NOCOLOURS, 1, [Define NOCOLOURS to prevent ANSI output])
;;
yes)
;;
esac],
dnl colours disabled by default.
[AC_DEFINE(NOCOLOURS, 1, [Define NOCLOURS to prevent ANSI output])])
dnl Set up debugging flag
AC_ARG_ENABLE(debug,
[ --enable-debug Turn on debugging code],
[case "${enableval}" in
yes)
CFLAGS='-g -Wall'
AC_DEFINE(ALLTRACE, 1, [Turn on tracing])
;;
profile)
CFLAGS='-g -pg -Wall'
AC_DEFINE(ALLTRACE, 1, [Turn on tracing])
;;
high) CFLAGS='-O2 -g -Wall'
AC_DEFINE(ALLTRACE, 1, [Turn on tracing])
;;
semi) CFLAGS='-g -Wall'
;;
no) CFLAGS='-O3 -fomit-frame-pointer -Wall'
AC_DEFINE(NDEBUG, 1, [Optimise assertions])
;;
*)# AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
esac],[CFLAGS='-O3 -Wall'
AC_DEFINE(NDEBUG, 1, [Optimise assertions])])
dnl Pick up where april is, in order to allow cross compilation
AC_ARG_WITH(april,
[ --with-april[=dir] Indicate location of an existing april installation],
[aprildir=${withval}
aprilexec=${withval}/bin/april
aprilc=${withval}/bin/apc],
[aprildir=\${top_builddir}/April
aprilexec=\${top_builddir}/April/Engine/april
aprilc=\${top_builddir}/April/Compiler/apc
])
AC_SUBST(aprilc)
AC_SUBST(aprilexec)
AC_SUBST(aprildir)
dnl Figure out where to put the html stuff
AC_ARG_WITH(htmldir,
[ --with-html[=PREFIX/html] Indicate location of the html dir],
[htmldir=${withval}],
[htmldir='${prefix}/html'])
AC_SUBST(htmldir)
dnl Pick up where ooio library
AC_MSG_CHECKING([Looking for the the ooio library])
AC_ARG_WITH(ooio,
[ --with-ooio[=dir] Indicate location of the ooio library],
[ooiodir=${withval}],
[ooiodir='/opt/nar/ooio']
)
AC_SUBST(ooiodir)
AC_MSG_RESULT(${ooiodir})
dlibext=.so
dnl Check for system type
AC_CANONICAL_HOST
case "$host_os" in
solaris* )
echo Set up for System V
AC_DEFINE(SYSV,1,[Check if we have a system 5 set up or not])
;;
linux-* )
april_LDFLAGS=-rdynamic
;;
darwin* )
dlibext=
;;
*)
echo Other OS $host_os
;;
esac
AC_SUBST(april_LDFLAGS)
AC_SUBST(dlibext)
AC_DEFINE_UNQUOTED(DLIBEXT,$dlibext,[Extension for dynamically loaded libraries])
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PROG_INSTALL
AM_PATH_LISPDIR
AC_PATH_PROG(TEXI2HTML, texi2html, :, $PATH:/usr/bin:/usr/local/bin)
AC_PATH_PROG(TEXI2PDF, texi2pdf, :, $PATH:/usr/bin:/usr/local/bin)
AC_MSG_CHECKING([if compiler allows zero array size])
save_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE([],
[
struct {
int one;
char somemore[];
} foo;
foo.one = 1;
],
AC_DEFINE(ZEROARRAYSIZE,, [How to specify a zero array size])
AC_MSG_RESULT(no),
AC_DEFINE(ZEROARRAYSIZE, 0, [How to specify a zero array size])
AC_MSG_RESULT(yes))
CFLAGS="$save_cflags"
dnl Define libtool
AM_PROG_LIBTOOL
dnl Checks for libraries.
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h syslog.h unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_MSG_CHECKING([for alignment of long long])
AC_CACHE_VAL(april_llong_alignment,
[AC_TRY_RUN([
int main(){
long v1;
long long v2;
struct {
long v1;
long long v2;
} v3;
if(sizeof(v3)==sizeof(v1)+sizeof(v2))
exit(0);
else
exit(1);
}],
april_llong_alignment=align32,
april_llong_alignment=align64,
april_llong_alignment=align64)])
if test $april_llong_alignment = align64; then
AC_DEFINE(LLONG_ALIGNMENT,1,[long long alignment is necessary])
else
AC_DEFINE(LLONG_ALIGNMENT,0,[long long alignment is unnecessary])
fi
AC_MSG_RESULT($april_llong_alignment)
AC_MSG_CHECKING([for alignment of double])
AC_CACHE_VAL(april_double_alignment,
[AC_TRY_RUN([
int main(){
long v1;
double v2;
struct {
long v1;
double v2;
} v3;
if(sizeof(v3)==sizeof(v1)+sizeof(v2))
exit(0);
else
exit(1);
}],
april_double_alignment=align32,
april_double_alignment=align64,
april_double_alignment=align64)])
if test $april_double_alignment = align64; then
AC_DEFINE(DOUBLE_ALIGNMENT,1,[double alignment is necessary])
else
AC_DEFINE(DOUBLE_ALIGNMENT,0,[double alignment is unnecessary])
fi
AC_MSG_RESULT($april_double_alignment)
AC_CACHE_VAL(april_word16,
[
AC_CHECK_SIZEOF(long,4)
AC_CHECK_SIZEOF(int,4)
AC_CHECK_SIZEOF(short int,2)
if test $ac_cv_sizeof_int = 2; then
april_word16="int"
elif test $ac_cv_sizeof_short_int = 2; then
april_word16="short int"
elif test $ac_cv_sizeof_long = 2; then
april_word16="long"
else
AC_MSG_ERROR([cant determine a 16 bit int type])
fi
])
AC_DEFINE_UNQUOTED(WORD16,$april_word16,[Define with a type that is 16 bits long])
AC_CACHE_VAL(april_word32,
[
AC_CHECK_SIZEOF(long,4)
AC_CHECK_SIZEOF(int,4)
AC_CHECK_SIZEOF(short int,2)
if test $ac_cv_sizeof_int = 4; then
april_word32="int"
elif test $ac_cv_sizeof_short_int = 4; then
april_word32="short int"
elif test $ac_cv_sizeof_long = 4; then
april_word32="long"
else
AC_MSG_ERROR([cant determine a 32 bit int type])
fi
])
AC_DEFINE_UNQUOTED(WORD32,$april_word32,[Define with a type that is 32 bits long])
AC_MSG_CHECKING([32 bit int type])
AC_MSG_RESULT($april_word32)
AC_CACHE_VAL(april_word64,
[
AC_CHECK_SIZEOF(long long,8)
AC_CHECK_SIZEOF(long,4)
if test $ac_cv_sizeof_long_long = 8; then
april_word64="long long"
elif test $ac_cv_sizeof_long = 8; then
april_word64="long"
else
AC_MSG_ERROR([cant determine a 64 bit int type])
fi
])
AC_DEFINE_UNQUOTED(WORD64,$april_word64,[Define with a type that is 64 bits long])
AC_MSG_CHECKING([64 bit int type])
AC_MSG_RESULT($april_word64)
AC_MSG_CHECKING([getopt accepts '+' prefix])
AC_TRY_RUN([
#include <unistd.h>
extern int optind;
int main(int a, char *v[])
{
int argc = 3;
char *argv[4] = { "self", "arg", "-h", NULL };
/* Returns success (zero) if -h option is detected (ie. getopt permutes) */
if (getopt(argc, argv, "+h") == -1) {
optind = 0;
if (getopt(argc, argv, "h") == 'h')
return 0;
}
return 1;
}
],
AC_DEFINE(GNU_GETOPT_NOPERMUTE, "+", [make getopt posixly compliant (non-permuting)])
AC_MSG_RESULT("yes"),
AC_DEFINE(GNU_GETOPT_NOPERMUTE, "", [getopt does not support + prefix])
AC_MSG_RESULT("no"),
AC_DEFINE(GNU_GETOPT_NOPERMUTE, "", [getopt is non-permuting by default])
AC_MSG_RESULT("no")
)
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(gethostname gettimeofday select socket strerror strtol getdtablesize getrlimit)
AC_CHECK_LIB(m,log10)
AC_CHECK_LIB(socket,socket)
AC_CHECK_LIB(nsl,inet_ntoa)
AC_REPLACE_FUNCS(memmove)
AC_REPLACE_FUNCS(memcmp)
AC_REPLACE_FUNCS(setenv)
dnl enable/disable dynamically loaded extensions to April
AC_ARG_ENABLE(dynext,
[ --enable-dynext Enable dynamically loaded extensions to April [default=yes]],
[case "${enableval}" in
yes)
AC_DEFINE(DYNAMICEXT, 1, [Enable dynamically loaded extensions in April])
AC_CHECK_LIB(dl,dlopen)
;;
no)
;;
esac],
dnl extensions enabled by default
[
AC_CHECK_LIB(dl,dlopen)
])
AC_OUTPUT(Makefile April/Makefile
April/Headers/Makefile
April/april.Make
April/Compiler/Makefile April/Compiler/Headers/Makefile
April/Engine/Makefile
April/Engine/Headers/Makefile April/april/Makefile
April/Engine/Doc/Makefile
April/Utilities/Makefile April/include/Makefile
April/Samples/Makefile April/Samples/Test/Makefile
April/Samples/Suite/Makefile
April/Script/Makefile
April/Alex/Makefile April/Alex/Doc/Makefile April/Alex/alex
April/Apg/Makefile April/Apg/Doc/Makefile April/Apg/apg
April/SCS/Makefile April/SCS/scs
April/Dx/Makefile
Doc/Makefile
april.spec)