-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.conf
290 lines (242 loc) · 10.8 KB
/
bootstrap.conf
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
# Bootstrap configuration for GNU Astronomy Utilities
#
# This file will be read by the './bootstrap' script and everything that is
# defined here will be replaced with the variables defined
# there. ./bootstrap is a script made by Gnulib in order to run Gnulib and
# any other operation that is necessary to do on the version controlled
# source prior to running ./configure.
#
# Original author:
# Mosè Giordano <[email protected]>
# Contributing author(s):
# Mohammad Akhlaghi <[email protected]>
# Copyright (C) 2016-2024 Free Software Foundation, Inc.
#
# 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
# Gnuastro specific configuration variables
# =========================================
#
# These are configurations that were added specifically for
# bootstrapping Gnuastro, these variables were originally not in this
# configuration file, we have copied them from the bootstrap script
# since everything here is going to be replaced with the same variable
# that was defined there.
# Run the genauthors script to create the AUTHORS file which is
# necessary in autoreconf. Recall that we have to satisfy the GNU
# Coding Standards which require this file's existence and autoreconf
# will complain if its not here.
if ./genauthors ./ ; then
echo "AUTHORS file created."
else
echo "AUTHORS file NOT created."
exit 1
fi
# Extra options we want to have added to the execution of gnulib-tool
# for Gnuastro. See the 'gnulib_tool_options' variable in bootstrap
# for the default options that will be used and as a template.
gnulib_tool_option_extras="\
--with-tests\
--no-vc-files\
"
# Redefine the base directories for output files. We don't want
# imported files to be mixed up with hand-written Gnuastro
# files.
m4_base="bootstrapped/m4"
doc_base="bootstrapped/doc"
source_base="bootstrapped/lib"
tests_base="bootstrapped/tests"
build_aux="bootstrapped/build-aux"
# This name will be appended to the Gnulib's Automake variables. By
# default the ./bootstrap script takes the long package name as a
# reference, but for Gnuastro, since the long package name contains a
# space, it is replaced with astronomy-utilities, and so Automake will
# complain (for example: bad characters in variable name
# 'libastronomy-utilities_la_SOURCES'). So we are also redefining it
# here. This name is irrelevant for the final process.
gnulib_name="libgnu"
# Processes to run after gnulib-tool and before autoreconf.
bootstrap_post_import_hook()
{
# List of m4 files we need from the GNU Autoconf Archives (excluding the
# 'ax_' prefix and '.m4' suffix):
neededm4s="pthread compare_version check_compile_flag"
# Get the necesssary Autoconf-archive macros. It is assumed that
# autoconf-archives is cloned the same directory as gnulib. Therefore we
# simply copy the desired m4 macros if an Autoconf-archive exists or
# download it otherwise.
if [ -f "$GNULIB_SRCDIR/../autoconf-archive/m4/ax_pthread.m4" ]; then
for m4name in $neededm4s; do
cp "$GNULIB_SRCDIR/../autoconf-archive/m4/ax_$m4name.m4" $m4_base/
done
else
# Choose the program to use to download files from the web. 'curl' is
# present in most GNU/Linux systems and OS X as well, 'wget' is usually
# present only on GNU/Linux systems. Since 'curl' is available in more
# systems, we first try if it's installed, otherwise we fallback on
# 'wget'.
if type curl > /dev/null; then
downloader="curl -o"
else
downloader="wget -O"
fi
for m4name in $neededm4s; do
$downloader "$m4_base/ax_$m4name.m4" \
"http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_$m4name.m4" || die "Failed to download ax_$m4name.m4!"
done
fi
# Hack in 'AC_LIB_HAVE_LINKFLAGS' so it doesn't search for shared
# libraries when '--disable-shared' is used.
sed 's|if test -n \"$acl_shlibext\"; then|if test -n \"\$acl_shlibext\" -a \"X$enable_shared\" = \"Xyes\"; then|' bootstrapped/m4/lib-link.m4 > bootstrapped/m4/lib-link_tmp.m4
mv bootstrapped/m4/lib-link_tmp.m4 bootstrapped/m4/lib-link.m4
# Add a value pointer to 'argp_option' for easy setting of option values.
awk '{ \
if($1=="struct" && $2=="argp_option") \
inargp=1; \
\
if(inargp==0) \
print; \
else if($1=="};") \
{ \
printf "\n"; \
print " /* Pointer to value."; \
print " IMPORTANT: A Gnuastro addition. */"; \
print " void *value;"; \
\
printf "\n"; \
print " /* Type of value (see lib/gnuastro/data.h)."; \
print " IMPORTANT: A Gnuastro addition. */"; \
print " int type;"; \
\
printf "\n"; \
print " /* Acceptable range of value (see lib/options.h)."; \
print " IMPORTANT: A Gnuastro addition. */"; \
print " int range;"; \
\
printf "\n"; \
print " /* Is this option mandatory? (see lib/options.h)."; \
print " IMPORTANT: A Gnuastro addition. */"; \
print " unsigned char mandatory;"; \
\
printf "\n"; \
print " /* Is value already set or not? (see lib/options.h).";\
print " IMPORTANT: A Gnuastro addition. */"; \
print " unsigned char set;"; \
\
printf "\n"; \
print " /* Function to process the given value."; \
print " Arguments to the function:"; \
print " struct argp_option *option: This argp_option."; \
print " char *arg: String given by the user."; \
print " char *filename: Filename option was read from."; \
print " size_t lineno: Line number of option in file."; \
print " void *struct: Pointer to main program struct.";\
print ""; \
print " IMPORTANT: A Gnuastro addition. */"; \
print " void *(*func)(struct argp_option *, char *, char *, size_t, void *);"; \
\
print; \
inargp=0; \
} \
else \
print; \
}' bootstrapped/lib/argp.h > argp_tmp.h
mv argp_tmp.h bootstrapped/lib/argp.h
}
# Configuration variable values for Gnuastro
# ==========================================
#
# These are variables that were included in the gnulib's
# bootstrap.conf template but have been given values specifically for
# Gnuastro.
# gnulib modules used by this package.
gnulib_modules="
func
math
argp
time
fcntl
regex
error
nproc
stdio
execv
select
stdint
strtod
mktime
signbit
fcntl-h
havelib
memmove
getline
strcase
gendocs
gpl-3.0
mbstok_r
strtok_r
inttypes
sys_time
strptime
faccessat
system-posix
secure_getenv
git-version-gen
"
# Exact copy of Gnulib's template
# ===============================
#
# Everything under this is an exact copy from the template
# bootstrap.conf from Gnulib, it can readily be replaced with the
# ending parts of an updated template.
# Additional xgettext options to use. Use "\\\newline" to break lines.
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
--from-code=UTF-8\\\
--flag=asprintf:2:c-format --flag=vasprintf:2:c-format\\\
--flag=asnprintf:3:c-format --flag=vasnprintf:3:c-format\\\
--flag=wrapf:1:c-format\\\
'
# If "AM_GNU_GETTEXT(external" or "AM_GNU_GETTEXT([external]"
# appears in configure.ac, exclude some unnecessary files.
# Without grep's -E option (not portable enough, pre-configure),
# the following test is ugly. Also, this depends on the existence
# of configure.ac, not the obsolescent-named configure.in. But if
# you're using this infrastructure, you should care about such things.
gettext_external=0
grep '^[ ]*AM_GNU_GETTEXT(external\>' configure.ac > /dev/null &&
gettext_external=1
grep '^[ ]*AM_GNU_GETTEXT(\[external\]' configure.ac > /dev/null &&
gettext_external=1
if test $gettext_external = 1; then
# Gettext supplies these files, but we don't need them since
# we don't have an intl subdirectory.
excluded_files='
m4/glibc2.m4
m4/intdiv0.m4
m4/lcmessage.m4
m4/lock.m4
m4/printf-posix.m4
m4/size_max.m4
m4/uintmax_t.m4
m4/ulonglong.m4
m4/visibility.m4
m4/xsize.m4
'
fi
# Build prerequisites
buildreq="\
autoconf 2.59
automake 1.9.6
git 1.5.5
tar -
"