-
Notifications
You must be signed in to change notification settings - Fork 6
/
configure.ac
286 lines (254 loc) · 8.35 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
# configure.in -- Process this file with autoconf to produce configure
# Copyright (C) 2000 Gary V. Vaughan
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
AC_INIT(src/mmseg_main.cpp)
AC_CONFIG_AUX_DIR(config)
AM_CONFIG_HEADER(config.h:config-h.in)
AM_INIT_AUTOMAKE(mmseg, 0.7)
#AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_STDC
AM_PROG_CC_C_O
AM_PROG_LIBTOOL
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(stdlib.h unistd.h errno.h assert.h)
AC_CHECK_HEADERS(string.h strings.h, break)
# @start 2
# am_cv_prog_cc_stdc is set by AM_PROG_CC_STDC
case $am_cv_prog_cc_stdc,$ac_cv_header_varargs_h in
no,)
# Non-ANSI compiler, so we must use varargs.h.
AC_CHECK_HEADERS(varargs.h)
;;
*,yes)
# Parent package is using varargs.h which is incompatible with
# stdarg.h, so we do the same (recheck to generate checking...
# message).
AC_CHECK_HEADERS(varargs.h)
;;
*)
# If stdarg.h is present define HAVE_STDARG_H.
AC_CHECK_HEADERS(stdarg.h)
;;
esac
case x$ac_cv_header_stdarg_h$ac_cv_header_varargs_h in
x*yes*) ;;
*) AC_MSG_ERROR(Could not find stdarg.h or varargs.h, one of which \
is required for the build to proceed.) ;;
esac
# @end 2
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_CHECK_FUNCS(bzero memset, break)
AC_CHECK_FUNCS(calloc strchr strrchr)
AC_REPLACE_FUNCS(basename strspn strcspn strerror strsignal vfprintf waitpid)
# @start 5
# ----------------------------------------------------------------------
# Add code to config.status to create an installable host dependent
# configuration file.
# ----------------------------------------------------------------------
AC_OUTPUT_COMMANDS([
#if test -n "$CONFIG_FILES" && test -n "$CONFIG_HEADERS"; then
# # If both these vars are non-empty, then config.status wasn't run by
# # automake rules (which always set one or the other to empty).
# CONFIG_OTHER=${CONFIG_OTHER-sic/common.h}
#fi
case "$CONFIG_OTHER" in
*sic/common.h*)
outfile=sic/common.h
stampfile=sic/stamp-common
tmpfile=${outfile}T
dirname="sed s,^.*/,,g"
echo creating $outfile
cat > $tmpfile << _EOF_
/* -*- Mode: C -*-
* --------------------------------------------------------------------
* DO NOT EDIT THIS FILE! It has been automatically generated
* from: configure.in and `echo $outfile|$dirname`.in
* on host: `(hostname || uname -n) 2>/dev/null | sed 1q`
* --------------------------------------------------------------------
*/
#ifndef SIC_COMMON_H
#define SIC_COMMON_H 1
#include <stdio.h>
#include <sys/types.h>
_EOF_
# @end 5
# @start 4
# Add the code to include these headers only if autoconf has
# shown them to be present.
if test x$ac_cv_header_stdlib_h = xyes; then
echo '#include <stdlib.h>' >> $tmpfile
fi
if test x$ac_cv_header_unistd_h = xyes; then
echo '#include <unistd.h>' >> $tmpfile
fi
if test x$ac_cv_header_sys_wait_h = xyes; then
echo '#include <sys/wait.h>' >> $tmpfile
fi
if test x$ac_cv_header_errno_h = xyes; then
echo '#include <errno.h>' >> $tmpfile
fi
cat >> $tmpfile << '_EOF_'
#ifndef errno
/* Some sytems #define this! */
extern int errno;
#endif
_EOF_
if test x$ac_cv_header_string_h = xyes; then
echo '#include <string.h>' >> $tmpfile
elif test x$ac_cv_header_strings_h = xyes; then
echo '#include <strings.h>' >> $tmpfile
fi
if test x$ac_cv_header_assert_h = xyes; then
cat >> $tmpfile << '_EOF_'
#include <assert.h>
#define SIC_ASSERT assert
_EOF_
else
echo '#define SIC_ASSERT(expr) ((void) 0)' >> $tmpfile
fi
# @end 4
# @start 3
# Make a choice between the two different API's for variadic
# functions. In general, prefer stdarg.h over varargs.h, except
# where varargs.h has already been chosen by the parent package.
if test x$ac_cv_header_stdarg_h = xyes \
&& test x$ac_cv_header_varargs_h != xyes
then
cat >> $tmpfile << '_EOF_'
#include <stdarg.h>
#ifndef VA_START
# define VA_START(a, f) va_start(a, f)
#endif /* !VA_START */
_EOF_
else
cat >> $tmpfile << '_EOF_'
#include <varargs.h>
#ifndef VA_START
# define VA_START(a, f) va_start(a)
#endif /* !VA_START */
_EOF_
fi
# @end 3
# @start 5
if test x$ac_cv_func_bzero = xno && \
test x$ac_cv_func_memset = xyes; then
cat >> $tmpfile << '_EOF_'
#define bzero(buf, bytes) ((void) memset (buf, 0, bytes))
_EOF_
fi
if test x$ac_cv_func_strchr = xno; then
echo '#define strchr index' >> $tmpfile
fi
if test x$ac_cv_func_strrchr = xno; then
echo '#define strrchr rindex' >> $tmpfile
fi
# The ugly but portable cpp stuff comes from here
infile=$srcdir/sic/`echo $outfile | sed 's,.*/,,g;s,\..*$,,g'`-h.in
sed '/^##.*$/d' $infile >> $tmpfile
# @end 5
${RM-/bin/rm -f} ${tmpfile}2 2>/dev/null
if test x$ac_cv_func_basename = xno; then
echo 'extern char *basename PARAMS((const char *path));' >> ${tmpfile}2
fi
if test x$ac_cv_func_strcspn = xno; then
echo 'extern size_t strcspn PARAMS((const char *string, const char *accept));' >> ${tmpfile}2
fi
if test x$ac_cv_func_strerror = xno; then
echo 'extern char *strerror PARAMS((int err));' >> ${tmpfile}2
fi
if test x$ac_cv_func_strsignal = xno; then
echo 'extern char *strsignal PARAMS((int signo));' >> ${tmpfile}2
fi
if test x$ac_cv_func_strspn = xno; then
echo 'extern size_t strspn PARAMS((const char *string, const char *reject));' >> ${tmpfile}2
fi
if test x$ac_cv_func_vfprintf = xno; then
echo 'extern int vfprintf PARAMS((FILE *file, const char *format, va_list ap));' >> ${tmpfile}2
fi
if test x$ac_cv_func_waitpid = xno; then
echo 'extern pid_t waitpid PARAMS((pid_t pid, int *pstatus, int options));' >> ${tmpfile}2
fi
if test -f ${tmpfile}2; then
cat >> $tmpfile << '_EOF_'
BEGIN_C_DECLS
_EOF_
cat ${tmpfile}2 >> $tmpfile
echo 'END_C_DECLS' >> $tmpfile
${RM-/bin/rm -f} ${tmpfile}2 2>/dev/null
fi
cat >> $tmpfile << '_EOF_'
#endif /* !SIC_COMMON_H */
_EOF_
if cmp -s $tmpfile $outfile; then
echo $outfile is unchanged
rm -f $tmpfile
else
mv $tmpfile $outfile
touch $stampfile
fi
;;
esac
# @start 5
],[
srcdir=$srcdir
ac_cv_func_bzero=$ac_cv_func_bzero
ac_cv_func_memset=$ac_cv_func_memset
ac_cv_func_strchr=$ac_cv_func_strchr
ac_cv_func_strrchr=$ac_cv_func_strrchr
# @end 5
ac_cv_func_basename=$ac_cv_func_basename
ac_cv_func_strcspn=$ac_cv_func_strcspn
ac_cv_func_strerror=$ac_cv_func_strerror
ac_cv_func_strsignal=$ac_cv_func_strsignal
ac_cv_func_strspn=$ac_cv_func_strspn
ac_cv_func_vfprintf=$ac_cv_func_vfprintf
ac_cv_func_waitpid=$ac_cv_func_waitpid
ac_cv_header_assert_h=$ac_cv_header_assert_h
ac_cv_header_errno_h=$ac_cv_header_errno_h
ac_cv_header_stdlib_h=$ac_cv_header_stdlib_h
ac_cv_header_stdarg_h=$ac_cv_header_stdarg_h
ac_cv_header_string_h=$ac_cv_header_string_h
ac_cv_header_strings_h=$ac_cv_header_strings_h
ac_cv_header_sys_wait_h=$ac_cv_header_sys_wait_h
ac_cv_header_unistd_h=$ac_cv_header_unistd_h
ac_cv_header_varargs_h=$ac_cv_header_varargs_h
# @start 5
])
# @end 5
# @start 1
Xsed="sed -e s/^X//"
AC_LIBOBJ
#LTLIBOBJS=`echo X"$LIBOBJS" | \
# [$Xsed -e 's,\.[^.]* ,.lo ,g;s,\.[^.]*$,.lo,']`
#AC_SUBST(LTLIBOBJS)
# @end 1
AC_SUBST(ac_aux_dir)
AC_OUTPUT([Makefile src/Makefile],
[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h.in])
echo \
"------------------------------------------------------------------------
Configuration:
Source code location: ${srcdir}
Compiler: ${CC}
Compiler flags: ${CFLAGS}
Host System Type: ${host}
Install path: ${prefix}
See config.h for further configuration information.
------------------------------------------------------------------------"