-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
377 lines (329 loc) · 12.2 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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
#########################################################################
# #
# Author: Copyright (C) 2014-2024 Mark Grant #
# #
# Released under the GPLv3 only. #
# SPDX-License-Identifier: GPL-3.0-only #
# #
# Purpose: #
# Autoconfigure script file to configure acmbuild project. #
# #
# cmd line syntax of standard configure: #
# ./configure --help #
# #
# cmd line syntax of additional functionality: #
# ./configure [--enable-testinghacks[={yes|no}]] #
# Parameter defaults: #
# When specified on the CL, but without the [={yes|no}], the #
# default is yes. #
# When not specified the default is no. #
# #
# Parameters generic description. For specifics to this configure.ac #
# please see inline comments at the point of definition:- #
# --enable-testinghacks #
# This option should be used when the AT testing environment, (ie #
# using the build directory), requires differences in invocation. #
# An example would be a shell script invoking a program / script #
# / jar file. In the AT build directory the script should invoke #
# the target in the build system, whereas in production it might #
# invoke the target in datadir, datadir/java or pkgdatadir. If #
# this was left unchanged the test invocation of the script would #
# end up testing any old installed version of the target or #
# failing because it cannot be found. #
# #
# Layout: (Only relevant sections will exist). #
# SECTION 1: Initialisation & Setup #
# SECTION 2: Architecture, target and host checks #
# SECTION 3: Command line arguments #
# SECTION 4: Compiler setup #
# SECTION 5: Check for programs #
# SECTION 6: Check for libraries #
# SECTION 7: Check for header files #
# SECTION 8: Check for types #
# SECTION 9: Check for structures #
# SECTION 10: Check for compiler characteristics #
# SECTION 11: Check for library functions #
# SECTION 12: Check for pkg-config files #
# SECTION 13: Check for system services #
# SECTION 14: Additional checks & variables #
# SECTION 15: Specify the output files #
# #
#########################################################################
#########################################
# #
# SECTION 1: Initialisation & Setup #
# #
#########################################
AC_COPYRIGHT([Copyright (C) 2014-2024 Mark Grant
This script is free to copy or distribute under the terms set out
in the package license. See COPYING for details.])
AC_REVISION([$Revision: 1.2.1 $])
AC_PREREQ([2.69])
#
# The following macro uses git, if available, to provide versioning information.
# The logic is as follows:-
# If git is not available, is not initialised or no commit has been made, then
# the local variable pkg_version will be used.
# If git is available but no Tag has been created then just a commit identifier
# will be used.
# If git is available and a tag has been created then the most recent tag, plus
# number of commits since the tag, plus a commit identifier will be used.
# The package version in ac init will be used to create an output variable which
# can be used by ac output and / or the sed setup below to substitute bookmarks
# in source files.
#
# Set pkg_version for a default hard-coded version number.
m4_define(pkg_version, 1.6.3)
AC_INIT([AutoTools Build Script], m4_esyscmd([ \
git describe --always 1>/dev/null 2>/dev/null \
&& sed --help 1>/dev/null 2>/dev/null \
&& git describe --always | sed 's/v//' | tr -d '\n' \
|| echo pkg_version | tr -d '\n']),
[m.grant.prg@gmail.com], [acmbuild])
AC_MSG_NOTICE(initialisation and setup)
AC_SUBST(pkgversion, $PACKAGE_VERSION)
# Separate AutoTools generated files from project root.
AC_CONFIG_AUX_DIR([build-aux])
#
# Passes the options to all am files. Puts objects in the sub-directory
# containing the source. Forces tar to use --format=posix in make dist.
# This also checks :- BSD install make variable set mkdir -p
# gawk
#
AM_INIT_AUTOMAKE([-Wall -Werror subdir-objects tar-pax])
#
# Standard macros will be automatically placed in m4.
# Programmer defined macros should be placed in, say, m4extra which allows us
# to exclude the standard macros from being git tracked. This other directory
# must be specified as an include option in the Makefile.am ACLOCAL_AMFLAGS
# e.g.
# ACLOCAL_AMFLAGS = -I m4 -I m4extra
#
AC_CONFIG_MACRO_DIR([m4])
#########################################
# #
# SECTION 3: Command line arguments #
# #
#########################################
AC_MSG_NOTICE(checking command line arguments)
#
# The following allows for an enable-testinghacks=yes/no command line option.
# The conditional TESTINGHACKS is made available to the makefiles.
# This allows different variable substitutions depending on whether in a test
# environment or a production build / install environment.
#
AC_ARG_ENABLE(testinghacks,
AS_HELP_STRING([--enable-testinghacks], \
[build with testing hacks for local testing]),
[case "${enableval}" in
yes) testinghacks=true ;;
no) testinghacks=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-testinghacks) ;;
esac],testinghacks=false)
AM_CONDITIONAL(TESTINGHACKS, test x$testinghacks = xtrue)
AC_MSG_CHECKING([whether to use TESTINGHACKS for local testing])
if test "x${testinghacks}" = xtrue; then
AC_MSG_RESULT([yes])
AC_SUBST(scriptloc,"\$(builddir)")
else
AC_MSG_RESULT([no])
AC_SUBST(scriptloc,"\$(pkglibexecdir)")
fi
#########################################
# #
# SECTION 5: Check for programs #
# #
#########################################
AC_MSG_NOTICE(checking for basic programs that have AutoConf checks)
#
# The small set of tools you can expect to find on any machine.
#
# awk date grep od
# basename diff join rm
# cat dirname ln rmdir
# cc egrep ls sed
# chgrp expr mkdir sleep
# chown expr (‘|’) mkfifo sort
# chmod expr (‘:’) mknod tar
# cmp fgrep mktemp touch
# cp find mv tr
#
# (For further information including limitations to the above, see Section 11.15
# in the GNU AutoConf Manual).
#
# If using am init automake, gl early or lt init the following programs are
# automatically checked:-
#
# am init automake
# BSD install mkdir -p gawk
#
# gl early
# ar grep egrep ranlib
#
# lt init
# fgrep ranlib sed
#
# Basic and AutoTools program checks.
#
AC_PROG_AWK
AC_PROG_EGREP
AC_PROG_FGREP
AC_PROG_GREP
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_PROG_SED
AC_MSG_NOTICE(checking for some standard AutoTools required programs)
AC_PROG_INSTALL
AC_MSG_NOTICE(checking for particular programs required by this build)
AC_CHECK_PROG([ECHO], [echo], [yes], [no])
if test "x$ECHO" = "xno" ; then
AC_MSG_ERROR([echo not found])
fi
AC_CHECK_PROG([TXT2MAN], [txt2man], [yes], [no])
if test "x$TXT2MAN" = "xno" ; then
AC_MSG_ERROR([txt2man not found])
fi
AC_CHECK_PROG([TXT2MANWRAP], [txt2manwrap], [yes], [no])
if test "x$TXT2MANWRAP" = "xno" ; then
AC_MSG_ERROR([txt2manwrap not found])
fi
AC_MSG_NOTICE(checking for particular programs required at build and run time)
AC_PATH_PROG([BASH], [bash], [no])
if test "x$BASH" = "xno" ; then
AC_MSG_ERROR([bash not found])
fi
AC_CHECK_PROG([TAR], [tar], [yes], [no])
if test "x$TAR" = "xno" ; then
AC_MSG_ERROR([tar not found])
fi
AC_MSG_NOTICE(checking for particular programs required at run time)
AC_CHECK_PROG(CAT, cat, yes, no)
if test "x$CAT" = "xno" ; then
AC_MSG_WARN(cat not found - needed at run time)
fi
AC_CHECK_PROG([GETOPT], [getopt], [yes], [no])
if test "x$GETOPT" = "xno" ; then
AC_MSG_WARN(getopt not found - needed at run time)
fi
AC_CHECK_PROG(PRINTF, printf, yes, no)
if test "x$PRINTF" = "xno" ; then
AC_MSG_WARN(printf not found - needed at run time)
fi
AC_MSG_NOTICE(checking for programs which may be required at run time)
AC_CHECK_PROG(GCC, gcc, yes, no)
if test "x$GCC" = "xno" ; then
AC_MSG_WARN(gcc not found - may be needed at run time)
fi
AC_CHECK_PROG(CGCC, cgcc, yes, no)
if test "x$CGCC" = "xno" ; then
AC_MSG_WARN(sparse not found - may be needed at run time)
fi
AC_CHECK_PROG(CLANG, clang, yes, no)
if test "x$CLANG" = "xno" ; then
AC_MSG_WARN(clang not found - may be needed at run time)
fi
AC_CHECK_PROG(IWYU, iwyu, yes, no)
if test "x$IWYU" = "xno" ; then
AC_MSG_WARN(iwyu not found - may be needed at run time)
fi
AC_CHECK_PROG(SCAN_BUILD, scan-build, yes, no)
if test "x$SCAN_BUILD" = "xno" ; then
AC_MSG_WARN(scan-build not found - may be needed at run time)
fi
AC_CHECK_PROG(GNULIB_TOOL, gnulib-tool, yes, no)
if test "x$GNULIB_TOOL" = "xno" ; then
AC_MSG_WARN(gnulib-tool not found - may be needed at run time)
fi
AC_CHECK_PROG(GIT, git, yes, no)
if test "x$GIT" = "xno" ; then
AC_MSG_WARN(git not found - may be needed at run time)
fi
#################################################
# #
# SECTION 14: Additional checks & variables #
# #
#################################################
AC_MSG_NOTICE(processing additional checks and variables)
#
# Now set up a sed sequence to substitute bookmarks in script files with either
# standard GNU Directory Variables, or with programmer-defined variables set up
# using an AC_SUBST macro above. This sed sequence will be invoked at programmer
# discretion at sub-directory Makefile.am level.
# ----------------------
#
# prefix /usr/local (typically)
# exec_prefix ${prefix}
# bindir ${exec_prefix}/bin user executables
# sbindir ${exec_prefix}/sbin system admin executables
# libexecdir ${exec_prefix}/libexec program executables
# libdir ${exec_prefix}/lib object code libraries
# sysconfdir ${prefix}/etc read-only single-machine data
# sharedstatedir ${prefix}/com modifiable architecture-independent data
# localstatedir ${prefix}/var modifiable single-machine data
# runstatedir ${localstatedir}/run
# includedir ${prefix}/include C header files
# oldincludedir $usr/include C header files
# datarootdir ${prefix}/share read-only arch.-independent data root
# localedir ${datarootdir}/locale locale-dependent data
# datadir ${datarootdir} read-only architecture-independent data
# mandir ${datarootdir}/man man documentation
# infodir ${datarootdir}/info info documentation
# docdir ${datarootdir}/doc/${PACKAGE} documentation root
# htmldir ${docdir} html documentation
# dvidir ${docdir} dvi documentation
# pdfdir ${docdir} pdf documentation
# psdir ${docdir} ps documentation
# lispdir ${datarootdir}/emacs/site-lisp
# pkgdatadir ${datarootdir}/${PACKAGE}
# pkgincludedir ${includedir}/${PACKAGE}
# pkglibdir ${libdir}/${PACKAGE}
# pkglibexecdir ${libexecdir}/${PACKAGE}
#
AC_SUBST([edit], ["sed \
-e 's|@scriptloc[@]|\$(scriptloc)|g' \
-e 's|@bashlocation[@]|\$(BASH)|g' \
-e 's|@pkgversion[@]|\$(pkgversion)|g' \
-e 's|@prefix[@]|\$(prefix)|g' \
-e 's|@exec_prefix[@]|\$(exec_prefix)|g' \
-e 's|@bindir[@]|\$(bindir)|g' \
-e 's|@sbindir[@]|\$(sbindir)|g' \
-e 's|@libexecdir[@]|\$(libexecdir)|g' \
-e 's|@libdir[@]|\$(libdir)|g' \
-e 's|@sysconfdir[@]|\$(sysconfdir)|g' \
-e 's|@sharedstatedir[@]|\$(sharedstatedir)|g' \
-e 's|@localstatedir[@]|\$(localstatedir)|g' \
-e 's|@runstatedir[@]|\$(runstatedir)|g' \
-e 's|@includedir[@]|\$(includedir)|g' \
-e 's|@oldincludedir[@]|\$(oldincludedir)|g' \
-e 's|@datarootdir[@]|\$(datarootdir)|g' \
-e 's|@localedir[@]|\$(localedir)|g' \
-e 's|@datadir[@]|\$(datadir)|g' \
-e 's|@mandir[@]|\$(mandir)|g' \
-e 's|@infodir[@]|\$(infodir)|g' \
-e 's|@docdir[@]|\$(docdir)|g' \
-e 's|@htmldir[@]|\$(htmldir)|g' \
-e 's|@dvidir[@]|\$(dvidir)|g' \
-e 's|@pdfdir[@]|\$(pdfdir)|g' \
-e 's|@psdir[@]|\$(psdir)|g' \
-e 's|@lispdir[@]|\$(lispdir)|g' \
-e 's|@pkgdatadir[@]|\$(pkgdatadir)|g' \
-e 's|@pkgincludedir[@]|\$(pkgincludedir)|g' \
-e 's|@pkglibdir[@]|\$(pkglibdir)|g' \
-e 's|@pkglibexecdir[@]|\$(pkglibexecdir)|g'"])
#########################################
# #
# SECTION 15: Specify the output files #
# #
#########################################
AC_MSG_NOTICE(processing output files)
#
# Non-Makefile files to generate.
# AC_CONFIG_FILES should not be used to substitute AutoConf Installation
# Directory Variables, (bindir and friends), except in Makefiles and pkg-config
# files. See GNU AutoConf manual section 4.8.2 Installation Directory Variables.
#
# Project Makefiles to create.
AC_CONFIG_FILES([Makefile
src/prg/bash/Makefile
src/man/1/Makefile])
AC_OUTPUT