Blame
Date:
Mon Jul 4 19:18:39 2022 UTC
Message:
bump version
001
2021-01-21
op
#!/bin/sh
002
2021-01-21
op
#
003
2022-07-04
op
# Copyright (c) 2021, 2022 Omar Polo <op@omarpolo.com>
004
2022-07-04
op
# Copyright (c) 2011, 2013-2022 Ingo Schwarze <schwarze@openbsd.org>
005
2022-07-04
op
# Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
006
2021-01-21
op
#
007
2021-01-21
op
# Permission to use, copy, modify, and distribute this software for any
008
2021-01-21
op
# purpose with or without fee is hereby granted, provided that the above
009
2021-01-21
op
# copyright notice and this permission notice appear in all copies.
010
2021-01-21
op
#
011
2021-01-21
op
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
012
2021-01-21
op
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
013
2021-01-21
op
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
014
2021-01-21
op
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
015
2021-01-21
op
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
016
2021-01-21
op
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
017
2021-01-21
op
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
018
2021-01-21
op
019
2021-01-21
op
set -e
020
2021-01-21
op
021
2021-01-21
op
[ -w config.log ] && mv config.log config.log.old
022
2021-01-21
op
[ -w config.h ] && mv config.h config.h.old
023
2021-01-21
op
024
2021-01-21
op
# Output file descriptor usage:
025
2021-01-21
op
# 1 (stdout): config.h, Makefile.local
026
2021-01-21
op
# 2 (stderr): original stderr, usually to the console
027
2021-01-21
op
# 3: config.log
028
2021-01-21
op
029
2021-01-21
op
exec 3> config.log
030
2021-01-21
op
echo "file config.log: writing..."
031
2021-01-21
op
032
2021-01-21
op
# --------
033
2021-01-27
op
# default settings: initialize all vars here such that nothing is
034
2021-07-06
op
# leaked from the environment except for CC, CFLAGS and LDFLAGS
035
2021-01-21
op
036
2022-07-04
op
VERSION=1.8.5-current
037
2021-07-10
op
038
2021-01-27
op
CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | make ${MAKE_FLAGS} -sf -`
039
2021-07-06
op
040
2021-07-06
op
if [ -z "${CFLAGS}" ]; then
041
2021-07-06
op
CFLAGS=`printf "all:\\n\\t@echo \\\$(CFLAGS)\\n" | make ${MAKE_FLAGS} -sf -`
042
2021-07-06
op
fi
043
2021-07-06
op
044
2021-07-07
op
CFLAGS="${CFLAGS} -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes"
045
2021-07-07
op
CFLAGS="${CFLAGS} -Wwrite-strings -Wno-unused-parameter"
046
2021-07-07
op
047
2021-07-06
op
if [ -z "${LDFLAGS}" ]; then
048
2021-07-06
op
LDFLAGS=`printf "all:\\n\\t@echo \\\$(LDFLAGS)\\n" | make ${MAKE_FLAGS} -sf -`
049
2021-07-06
op
LDFLAGS="-ltls -levent -lcrypto"
050
2021-07-06
op
fi
051
2021-07-06
op
052
2021-02-23
op
LD_IMSG=
053
2021-01-21
op
STATIC=
054
2021-02-23
op
YACC=yacc
055
2021-01-21
op
056
2022-07-04
op
COBJS=
057
2022-07-04
op
058
2021-07-02
op
DISABLE_SANDBOX=0
059
2021-07-02
op
060
2021-01-21
op
NEED_GNU_SOURCE=0
061
2021-01-21
op
NEED_OPENBSD_SOURCE=0
062
2021-01-21
op
063
2021-01-21
op
PREFIX="/usr/local"
064
2021-01-21
op
BINDIR=
065
2021-01-21
op
066
2021-01-21
op
INSTALL="install"
067
2021-01-21
op
068
2021-07-08
op
add_library() {
069
2021-07-08
op
if pkg-config "$1"; then
070
2021-07-08
op
CFLAGS="${CFLAGS} $(pkg-config --cflags "$1")"
071
2021-07-08
op
LDFLAGS="${LDFLAGS} $(pkg-config --libs "$1")"
072
2021-07-08
op
fi
073
2021-07-06
op
}
074
2021-07-06
op
075
2021-01-21
op
# try to auto detect CFLAGS and LDFLAGS
076
2022-03-18
op
if command -v pkg-config >/dev/null; then
077
2021-07-08
op
add_library "libtls"
078
2021-07-08
op
add_library "openssl"
079
2021-02-08
op
080
2021-02-08
op
case "$(uname)" in
081
2021-07-06
op
OpenBSD)
082
2021-07-07
op
# use libevent and imsg in base
083
2021-07-06
op
;;
084
2021-02-08
op
*)
085
2021-07-08
op
add_library "libevent"
086
2021-07-08
op
add_library "libimsg"
087
2021-02-08
op
;;
088
2021-02-08
op
esac
089
2021-07-08
op
090
2021-07-08
op
case "$(uname)" in
091
2021-07-08
op
*BSD|DragonFly|Darwin)
092
2021-07-08
op
;;
093
2021-07-08
op
*)
094
2021-07-08
op
add_library "libbsd-ctor libbsd-overlay"
095
2021-07-08
op
;;
096
2021-07-08
op
esac
097
2021-01-21
op
fi
098
2021-01-21
op
099
2021-01-21
op
# auto detect yacc/bison
100
2022-03-18
op
command -v ${YACC} >/dev/null || {
101
2021-01-21
op
echo "${YACC} not found: trying bison" 1>&2
102
2021-01-21
op
echo "${YACC} not found: trying bison" 1>&3
103
2021-01-21
op
YACC=bison
104
2022-03-18
op
command -v ${YACC} >/dev/null || {
105
2021-01-21
op
echo "${YACC} not found: giving up" 1>&2
106
2021-01-21
op
echo "${YACC} not found: giving up" 1>&3
107
2021-01-21
op
}
108
2021-01-21
op
}
109
2021-01-21
op
110
2021-01-21
op
# --------
111
2021-01-21
op
# allow certain variables to be overridden on the command line
112
2021-01-21
op
113
2021-01-21
op
for keyvals in "$@"; do
114
2021-07-02
op
if [ "$keyvals" = "--disable-sandbox" ]; then
115
2021-07-02
op
DISABLE_SANDBOX=1
116
2021-07-02
op
continue
117
2021-07-02
op
fi
118
2021-07-02
op
119
2021-07-07
op
if [ "$keyvals" = "--enable-sandbox" ]; then
120
2021-07-07
op
DISABLE_SANDBOX=0
121
2021-07-07
op
continue
122
2021-07-07
op
fi
123
2021-07-07
op
124
2021-01-21
op
key=`echo $keyvals | cut -s -d '=' -f1`
125
2021-01-21
op
if [ -z "$key" ]; then
126
2021-01-21
op
echo "$0: invalid key-value: $keyvals" 1>&2
127
2021-01-21
op
exit 1
128
2021-01-21
op
fi
129
2021-01-21
op
val=`echo $keyvals | cut -d '=' -f 2-`
130
2021-01-21
op
case "$key" in
131
2021-12-09
op
BINDIR) BINDIR="$val" ;;
132
2021-12-09
op
CC) CC="$val" ;;
133
2021-12-09
op
CFLAGS) CFLAGS="$val" ;;
134
2021-12-09
op
DESTDIR) DESTDIR="$val" ;;
135
2021-12-09
op
LDFLAGS) LDFLAGS="$val" ;;
136
2022-03-18
op
MANDIR) MANDIR="$val" ;;
137
2021-12-09
op
PREFIX) PREFIX="$val" ;;
138
2021-12-09
op
YACC) YACC="$val" ;;
139
2021-12-09
op
--prefix) PREFIX="$val" ;;
140
2021-01-21
op
*)
141
2021-01-21
op
echo "$0: invalid key: $key" 1>&2
142
2021-01-21
op
exit 1
143
2021-01-21
op
esac
144
2021-01-21
op
done
145
2021-01-21
op
146
2021-01-21
op
# --------
147
2022-07-04
op
# Allow configure.local to override all variables, default settings,
148
2022-07-04
op
# command-line arguments, and tested features, above.
149
2022-07-04
op
150
2022-07-04
op
if [ -r ./configure.local ]; then
151
2022-07-04
op
echo "configure.local: reading..." 1>&2
152
2022-07-04
op
echo "configure.local: reading..." 1>&3
153
2022-07-04
op
cat ./configure.local 1>&3
154
2022-07-04
op
. ./configure.local
155
2022-07-04
op
else
156
2022-07-04
op
echo "configure.local: no (fully automatic configuration)" 1>&2
157
2022-07-04
op
echo "configure.local: no (fully automatic configuration)" 1>&3
158
2022-07-04
op
fi
159
2022-07-04
op
160
2022-07-04
op
# --------
161
2021-01-21
op
# tests functions
162
2021-01-21
op
163
2021-01-21
op
# Check whether this HAVE_ setting is manually overridden.
164
2021-01-21
op
# If yes, use the override, if no, do not decide anything yet.
165
2021-01-21
op
# Arguments: test file name, test var name, manual value
166
2021-01-21
op
ismanual() {
167
2021-01-21
op
[ -z "${3}" ] && return 1
168
2021-01-21
op
echo "tested ${1}: HAVE_${2}=${3} (manual)" 1>&2
169
2021-01-21
op
echo "tested ${1}: HAVE_${2}=${3} (manual)" 1>&3
170
2021-01-21
op
echo 1>&3
171
2021-01-21
op
return 0
172
2021-01-21
op
}
173
2021-01-21
op
174
2021-01-21
op
# Run a single autoconfiguration test.
175
2021-01-21
op
# In case of success, enable the feature.
176
2021-01-21
op
# In case of failure, do not decide anything yet.
177
2021-01-21
op
# Arguments: test file name, test var name, additional CFLAGS
178
2021-01-21
op
singletest() {
179
2021-01-21
op
n=${1}${3}
180
2021-01-21
op
cat 1>&3 << __HEREDOC__
181
2021-01-21
op
testing ${n} ...
182
2021-01-21
op
${COMP} -o have/${1} have/${1}.c ${3} ${LDFLAGS}
183
2021-01-21
op
__HEREDOC__
184
2021-01-21
op
185
2021-01-21
op
if ${COMP} -o "have/${1}" "have/${1}.c" ${3} ${LDFLAGS} 1>&3 2>&3
186
2021-01-21
op
then
187
2021-01-21
op
echo "tested ${n}: yes" 1>&2
188
2021-11-16
op
echo "tested ${n}: yes" 1>&3
189
2021-01-21
op
echo 1>&3
190
2021-01-21
op
eval HAVE_${2}=1
191
2021-01-21
op
[ "${3}" = "-D_GNU_SOURCE" ] && NEED_GNU_SOURCE=1
192
2021-01-21
op
[ "${3}" = "-D_OPENBSD_SOURCE" ] && NEED_OPENBSD_SOURCE=1
193
2021-02-23
op
[ "${3}" = "-lutil" ] && LD_IMSG="-lutil"
194
2021-01-21
op
rm "have/${1}"
195
2021-01-21
op
return 0
196
2021-01-21
op
else
197
2021-11-16
op
echo "tested ${n}: no (compilation failed)" 1>&2
198
2021-11-16
op
echo "result of ${n}: ${CC} failed with exit status $?" 1>&3
199
2021-11-16
op
echo "result of compiling ${n}: no" 1>&3
200
2021-01-21
op
echo 1>&3
201
2021-01-21
op
return 1
202
2021-01-21
op
fi
203
2021-01-21
op
}
204
2021-01-21
op
205
2021-01-21
op
# Run a complete autoconfiguration test, including the check for
206
2021-01-21
op
# a manual override and disabling the feature on failure.
207
2021-01-21
op
# Arguments: test file name, test var name, additional CFLAGS
208
2021-01-21
op
# The final argument can optionally be repeated a second time.
209
2021-01-21
op
runtest() {
210
2021-01-21
op
eval _manual=\${HAVE_${2}}
211
2021-01-21
op
ismanual "${1}" "${2}" "${_manual}" && return 0
212
2021-01-21
op
singletest "${1}" "${2}" "${3}" && return 0
213
2021-01-21
op
[ -n "${4}" ] && singletest "${1}" "${2}" "${4}" && return 0
214
2021-01-21
op
eval HAVE_${2}=0
215
2021-01-21
op
return 1
216
2021-01-21
op
}
217
2021-01-21
op
218
2021-01-21
op
# --------
219
2021-01-21
op
# compiler options
220
2021-01-21
op
221
2021-01-27
op
COMP="${CC} ${CFLAGS} -Wno-unused -Werror"
222
2021-01-21
op
223
2021-01-21
op
echo "selected CFLAGS=\"${CFLAGS}\"" 1>&2
224
2021-01-21
op
echo "selected CFLAGS=\"${CFLAGS}\"" 1>&3
225
2021-01-21
op
echo 1>&3
226
2021-01-21
op
227
2021-01-21
op
if [ -n "${STATIC}" ]; then
228
2021-01-21
op
echo "selected STATIC=\"${STATIC}\" (manual)" 1>&2
229
2021-01-21
op
echo "selected STATIC=\"${STATIC}\" (manual)" 1>&3
230
2021-01-21
op
echo 1>&3
231
2021-01-21
op
else
232
2021-01-21
op
runtest noop STATIC -static || true
233
2021-01-21
op
[ ${HAVE_STATIC} -eq 0 ] || STATIC="-static"
234
2021-01-21
op
echo "selected STATIC=\"${STATIC}\"" 1>&2
235
2021-01-21
op
echo "selected STATIC=\"${STATIC}\"" 1>&3
236
2021-01-21
op
echo 1>&3
237
2022-01-03
op
fi
238
2022-01-03
op
239
2021-01-21
op
# --------
240
2021-01-21
op
# tests for config.h
241
2021-01-21
op
242
2021-01-21
op
runtest err ERR || true
243
2021-01-21
op
runtest explicit_bzero EXPLICIT_BZERO || true
244
2021-02-23
op
runtest freezero FREEZERO || true
245
2021-02-23
op
runtest getdtablecount GETDTABLECOUNT || true
246
2021-09-18
op
runtest getdtablesize GETDTABLESIZE || true
247
2021-01-21
op
runtest getprogname GETPROGNAME || true
248
2021-02-23
op
runtest imsg IMSG -lutil || true
249
2021-09-19
op
runtest landlock LANDLOCK || true
250
2021-02-08
op
runtest libevent LIBEVENT || true
251
2021-10-02
op
runtest libevent2 LIBEVENT2 || true
252
2021-01-21
op
runtest libtls LIBTLS || true
253
2021-01-25
op
runtest openssl OPENSSL || true
254
2021-02-04
op
runtest pr_set_name PR_SET_NAME || true
255
2021-02-23
op
runtest program_invocation_short_name PROGRAM_INVOCATION_SHORT_NAME "" -D_GNU_SOURCE || true
256
2021-02-23
op
runtest queue_h QUEUE_H || true
257
2021-04-25
op
runtest reallocarray REALLOCARRAY || true
258
2021-01-21
op
runtest recallocarray RECALLOCARRAY || true
259
2021-02-04
op
runtest setproctitle SETPROCTITLE || true
260
2021-01-21
op
runtest strlcat STRLCAT || true
261
2021-01-21
op
runtest strlcpy STRLCPY || true
262
2021-01-21
op
runtest strtonum STRTONUM || true
263
2021-10-07
op
runtest tree_h TREE_H || true
264
2021-01-21
op
runtest vasprintf VASPRINTF "" -D_GNU_SOURCE || true
265
2021-01-21
op
266
2021-01-21
op
if [ ${HAVE_LIBTLS} -eq 0 ]; then
267
2021-01-21
op
echo "FATAL: libtls not found" 1>&2
268
2021-01-21
op
echo "FATAL: libtls not found" 1>&3
269
2021-01-21
op
exit 1
270
2021-01-21
op
fi
271
2021-01-21
op
272
2021-01-25
op
if [ ${HAVE_OPENSSL} -eq 0 ]; then
273
2021-01-25
op
echo "FATAL: openssl not found" 1>&2
274
2021-01-25
op
echo "FATAL: openssl not found" 1>&3
275
2021-02-08
op
exit 1
276
2021-02-08
op
fi
277
2021-02-08
op
278
2021-02-08
op
if [ ${HAVE_LIBEVENT} -eq 0 ]; then
279
2021-02-08
op
echo "FATAL: libevent not found" 1>&2
280
2021-02-08
op
echo "FATAL: libevent not found" 1>&3
281
2021-01-25
op
exit 1
282
2021-01-25
op
fi
283
2021-01-25
op
284
2021-10-07
op
if [ ${HAVE_QUEUE_H} -eq 0 -o ${HAVE_IMSG} -eq 0 -o ${HAVE_TREE_H} -eq 0 ]; then
285
2021-02-23
op
CFLAGS="${CFLAGS} -I ${PWD}/compat"
286
2021-02-23
op
fi
287
2021-02-23
op
288
2021-01-21
op
# --------
289
2021-01-21
op
# write config.h
290
2021-01-21
op
291
2021-01-21
op
exec > config.h
292
2021-01-21
op
293
2021-01-21
op
cat <<__HEREDOC__
294
2021-01-21
op
#ifdef __cplusplus
295
2021-01-21
op
#error "Do not use C++."
296
2021-01-21
op
#endif
297
2021-01-21
op
__HEREDOC__
298
2021-01-21
op
299
2021-01-21
op
[ ${NEED_GNU_SOURCE} -eq 0 ] || echo "#define _GNU_SOURCE"
300
2021-01-21
op
[ ${NEED_OPENBSD_SOURCE} -eq 0 ] || echo "#define _OPENBSD_SOURCE"
301
2021-01-21
op
302
2021-02-23
op
[ ${HAVE_STRLCAT} -eq 0 -o ${HAVE_STRLCPY} -eq 0 -o ${HAVE_IMSG} -eq 0 ] \
303
2021-01-21
op
&& echo "#include <sys/types.h>"
304
2021-01-21
op
[ ${HAVE_VASPRINTF} -eq 0 ] && echo "#include <stdarg.h>"
305
2021-01-21
op
306
2021-02-23
op
if [ ${HAVE_QUEUE_H} -eq 1 ]; then
307
2021-02-23
op
echo "#include <sys/queue.h>"
308
2021-02-23
op
else
309
2021-02-23
op
echo "#include <queue.h>"
310
2021-10-07
op
fi
311
2021-10-07
op
312
2021-10-07
op
if [ ${HAVE_TREE_H} -eq 1 ]; then
313
2021-10-07
op
echo "#include <sys/tree.h>"
314
2021-10-07
op
else
315
2021-10-07
op
echo "#include <tree.h>"
316
2021-02-23
op
fi
317
2021-02-23
op
318
2021-02-23
op
echo "#include <sys/types.h>"
319
2021-02-23
op
echo "#include <sys/uio.h>"
320
2021-02-23
op
echo "#include <stdint.h>"
321
2021-02-23
op
echo "#include <imsg.h>"
322
2021-02-23
op
323
2021-01-21
op
cat <<__HEREDOC__
324
2021-01-21
op
325
2021-07-10
op
#define VERSION "${VERSION}"
326
2021-07-02
op
#define DISABLE_SANDBOX ${DISABLE_SANDBOX}
327
2021-07-02
op
328
2021-01-21
op
#define HAVE_ERR ${HAVE_ERR}
329
2021-01-21
op
#define HAVE_EXPLICIT_BZERO ${HAVE_EXPLICIT_BZERO}
330
2021-02-23
op
#define HAVE_FREEZERO ${HAVE_FREEZERO}
331
2021-02-23
op
#define HAVE_GETDTABLECOUNT ${HAVE_GETDTABLECOUNT}
332
2021-02-23
op
#define HAVE_GETDTABLESIZE ${HAVE_GETDTABLESIZE}
333
2021-01-21
op
#define HAVE_GETPROGNAME ${HAVE_GETPROGNAME}
334
2021-02-23
op
#define HAVE_IMSG ${HAVE_IMSG}
335
2021-09-19
op
#define HAVE_LANDLOCK ${HAVE_LANDLOCK}
336
2021-02-08
op
#define HAVE_LIBEVENT ${HAVE_LIBEVENT}
337
2021-10-02
op
#define HAVE_LIBEVENT2 ${HAVE_LIBEVENT2}
338
2021-02-11
op
#define HAVE_PROGRAM_INVOCATION_SHORT_NAME ${HAVE_PROGRAM_INVOCATION_SHORT_NAME}
339
2021-02-04
op
#define HAVE_PR_SET_NAME ${HAVE_PR_SET_NAME}
340
2021-02-23
op
#define HAVE_QUEUE_H ${HAVE_QUEUE_H}
341
2021-04-25
op
#define HAVE_REALLOCARRAY ${HAVE_REALLOCARRAY}
342
2021-01-21
op
#define HAVE_RECALLOCARRAY ${HAVE_RECALLOCARRAY}
343
2021-02-12
op
#define HAVE_SETPROCTITLE ${HAVE_SETPROCTITLE}
344
2021-01-21
op
#define HAVE_STRLCAT ${HAVE_STRLCAT}
345
2021-01-21
op
#define HAVE_STRLCPY ${HAVE_STRLCPY}
346
2021-01-21
op
#define HAVE_STRTONUM ${HAVE_STRTONUM}
347
2021-10-07
op
#define HAVE_TREE_H ${HAVE_TREE_H}
348
2021-01-21
op
#define HAVE_VASPRINTF ${HAVE_VASPRINTF}
349
2021-01-21
op
350
2021-01-21
op
__HEREDOC__
351
2021-01-22
op
352
2021-01-22
op
[ ${HAVE_EXPLICIT_BZERO} -eq 0 -o \
353
2021-02-23
op
${HAVE_FREEZERO} -eq 0 -o \
354
2021-04-25
op
${HAVE_REALLOCARRAY} -eq 0 -o \
355
2021-01-22
op
${HAVE_RECALLOCARRAY} -eq 0 -o \
356
2021-01-22
op
${HAVE_STRLCAT} -eq 0 -o \
357
2021-01-22
op
${HAVE_STRLCPY} -eq 0 -o \
358
2021-01-22
op
${HAVE_STRTONUM} -eq 0 ] && echo "#include <stddef.h>"
359
2021-01-21
op
360
2021-01-21
op
if [ ${HAVE_ERR} -eq 0 ]; then
361
2021-01-21
op
echo "extern void err(int, const char*, ...);"
362
2021-01-21
op
echo "extern void errx(int, const char*, ...);"
363
2021-01-21
op
echo "extern void warn(const char*, ...);"
364
2021-01-21
op
echo "extern void warnx(const char*, ...);"
365
2022-07-04
op
COBJS="${COBJS} compat/err.o"
366
2021-01-21
op
else
367
2021-01-21
op
echo "#include <err.h>"
368
2021-01-21
op
fi
369
2021-01-21
op
if [ ${HAVE_EXPLICIT_BZERO} -eq 0 ]; then
370
2021-01-21
op
echo "extern void explicit_bzero(void*, size_t);"
371
2022-07-04
op
COBJS="${COBJS} compat/explicit_bzero.o"
372
2021-01-25
op
fi
373
2021-02-23
op
if [ ${HAVE_FREEZERO} -eq 0 ]; then
374
2021-02-23
op
echo "extern void freezero(void*, size_t);"
375
2022-07-04
op
COBJS="${COBJS} compat/freezero.o"
376
2021-02-23
op
fi
377
2021-02-23
op
if [ ${HAVE_GETDTABLECOUNT} -eq 0 ]; then
378
2021-02-23
op
echo "extern int getdtablecount(void);"
379
2022-07-04
op
COBJS="${COBJS} compat/getdtablecount.o"
380
2021-02-23
op
fi
381
2021-02-23
op
if [ ${HAVE_GETDTABLESIZE} -eq 0 ]; then
382
2021-02-23
op
echo "extern int getdtablesize(void);"
383
2022-07-04
op
COBJS="${COBJS} compat/getdtablesize.o"
384
2021-02-23
op
fi
385
2021-01-25
op
if [ ${HAVE_GETPROGNAME} -eq 0 ]; then
386
2021-01-25
op
echo "extern const char *getprogname(void);"
387
2022-07-04
op
COBJS="${COBJS} compat/getprogname.o"
388
2021-01-21
op
fi
389
2021-02-23
op
if [ ${HAVE_IMSG} -eq 0 ]; then
390
2022-07-04
op
COBJS="${COBJS} compat/imsg.o compat/imsg-buffer.o"
391
2021-02-23
op
fi
392
2021-04-25
op
if [ ${HAVE_REALLOCARRAY} -eq 0 ]; then
393
2021-04-25
op
echo "extern void *reallocarray(void*, size_t, size_t);"
394
2022-07-04
op
COBJS="${COBJS} compat/reallocarray.o"
395
2021-04-25
op
fi
396
2021-01-21
op
if [ ${HAVE_RECALLOCARRAY} -eq 0 ]; then
397
2021-04-25
op
echo "extern void *recallocarray(void*, size_t, size_t, size_t);"
398
2022-07-04
op
COBJS="${COBJS} compat/recallocarray.o"
399
2021-01-21
op
fi
400
2021-02-04
op
if [ ${HAVE_SETPROCTITLE} -eq 0 ]; then
401
2021-02-04
op
echo "extern void setproctitle(const char *fmt, ...);"
402
2022-07-04
op
COBJS="${COBJS} compat/setproctitle.o"
403
2021-02-04
op
fi
404
2021-01-21
op
if [ ${HAVE_STRLCAT} -eq 0 ]; then
405
2021-01-21
op
echo "extern size_t strlcat(char*, const char*, size_t);"
406
2022-07-04
op
COBJS="${COBJS} compat/strlcat.o"
407
2021-01-21
op
fi
408
2021-01-21
op
if [ ${HAVE_STRLCPY} -eq 0 ]; then
409
2021-01-21
op
echo "extern size_t strlcpy(char*, const char*, size_t);"
410
2022-07-04
op
COBJS="${COBJS} compat/strlcpy.o"
411
2021-01-21
op
fi
412
2021-01-21
op
if [ ${HAVE_STRTONUM} -eq 0 ]; then
413
2021-01-22
op
echo "extern long long strtonum(const char*, long long, long long, const char**);"
414
2022-07-04
op
COBJS="${COBJS} compat/strtonum.o"
415
2021-01-21
op
fi
416
2021-01-21
op
if [ ${HAVE_VASPRINTF} -eq 0 ]; then
417
2021-01-21
op
echo "extern int vasprintf(char**, const char*, va_list);"
418
2022-07-04
op
COBJS="${COBJS} compat/vasprintf.o"
419
2021-01-21
op
fi
420
2021-01-21
op
echo "file config.h: written" 1>&2
421
2021-01-21
op
echo "file config.h: written" 1>&3
422
2021-01-21
op
423
2021-01-21
op
# --------
424
2021-01-21
op
# tests for Makefile.local
425
2021-01-21
op
426
2021-01-21
op
exec > Makefile.local
427
2021-01-21
op
428
2021-01-21
op
[ -z "${BINDIR}" ] && BINDIR="${PREFIX}/bin"
429
2021-01-21
op
[ -z "${MANDIR}" ] && MANDIR="${PREFIX}/man"
430
2021-01-21
op
431
2021-01-21
op
[ -z "${INSTALL_PROGRAM}" ] && INSTALL_PROGRAM="${INSTALL} -m 0555"
432
2021-01-21
op
[ -z "${INSTALL_LIB}" ] && INSTALL_LIB="${INSTALL} -m 0444"
433
2021-01-21
op
[ -z "${INSTALL_MAN}" ] && INSTALL_MAN="${INSTALL} -m 0444"
434
2021-01-21
op
[ -z "${INSTALL_DATA}" ] && INSTALL_DATA="${INSTALL} -m 0444"
435
2021-01-21
op
436
2021-01-21
op
cat << __HEREDOC__
437
2021-01-21
op
CC = ${CC}
438
2021-01-21
op
CFLAGS = ${CFLAGS}
439
2021-02-23
op
LDFLAGS = ${LDFLAGS} ${LD_IMSG}
440
2021-01-21
op
YACC = ${YACC}
441
2021-01-21
op
STATIC = ${STATIC}
442
2021-01-21
op
PREFIX = ${PREFIX}
443
2021-01-21
op
BINDIR = ${BINDIR}
444
2021-02-07
op
MANDIR = ${MANDIR}
445
2021-01-21
op
INCLUDEDIR = ${INCLUDEDIR}
446
2021-01-21
op
INSTALL = ${INSTALL}
447
2021-01-21
op
INSTALL_PROGRAM = ${INSTALL_PROGRAM}
448
2021-01-21
op
INSTALL_LIB = ${INSTALL_LIB}
449
2021-01-21
op
INSTALL_MAN = ${INSTALL_MAN}
450
2021-01-21
op
INSTALL_DATA = ${INSTALL_DATA}
451
2021-02-10
op
452
2022-07-04
op
COBJS = ${COBJS}
453
2022-01-03
op
454
2021-07-10
op
VERSION = ${VERSION}
455
2021-07-10
op
456
2021-01-21
op
__HEREDOC__
457
2021-02-10
op
458
2021-01-21
op
echo "file Makefile.local: written" 1>&2
459
2021-01-21
op
echo "file Makefile.local: written" 1>&3
460
2021-01-21
op
461
2021-01-21
op
exit 0
Omar Polo