Blame
Date:
Mon Oct 31 22:53:16 2022 UTC
Message:
add memmem compat
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
2022-10-31
op
runtest memmem MEMMEM "" -D_GNU_SOURCE || true
254
2021-01-25
op
runtest openssl OPENSSL || true
255
2021-02-04
op
runtest pr_set_name PR_SET_NAME || true
256
2021-02-23
op
runtest program_invocation_short_name PROGRAM_INVOCATION_SHORT_NAME "" -D_GNU_SOURCE || true
257
2021-02-23
op
runtest queue_h QUEUE_H || true
258
2021-04-25
op
runtest reallocarray REALLOCARRAY || true
259
2021-01-21
op
runtest recallocarray RECALLOCARRAY || true
260
2021-02-04
op
runtest setproctitle SETPROCTITLE || true
261
2021-01-21
op
runtest strlcat STRLCAT || true
262
2021-01-21
op
runtest strlcpy STRLCPY || true
263
2021-01-21
op
runtest strtonum STRTONUM || true
264
2021-10-07
op
runtest tree_h TREE_H || true
265
2021-01-21
op
runtest vasprintf VASPRINTF "" -D_GNU_SOURCE || true
266
2021-01-21
op
267
2021-01-21
op
if [ ${HAVE_LIBTLS} -eq 0 ]; then
268
2021-01-21
op
echo "FATAL: libtls not found" 1>&2
269
2021-01-21
op
echo "FATAL: libtls not found" 1>&3
270
2021-01-21
op
exit 1
271
2021-01-21
op
fi
272
2021-01-21
op
273
2021-01-25
op
if [ ${HAVE_OPENSSL} -eq 0 ]; then
274
2021-01-25
op
echo "FATAL: openssl not found" 1>&2
275
2021-01-25
op
echo "FATAL: openssl not found" 1>&3
276
2021-02-08
op
exit 1
277
2021-02-08
op
fi
278
2021-02-08
op
279
2021-02-08
op
if [ ${HAVE_LIBEVENT} -eq 0 ]; then
280
2021-02-08
op
echo "FATAL: libevent not found" 1>&2
281
2021-02-08
op
echo "FATAL: libevent not found" 1>&3
282
2021-01-25
op
exit 1
283
2021-01-25
op
fi
284
2021-01-25
op
285
2021-10-07
op
if [ ${HAVE_QUEUE_H} -eq 0 -o ${HAVE_IMSG} -eq 0 -o ${HAVE_TREE_H} -eq 0 ]; then
286
2021-02-23
op
CFLAGS="${CFLAGS} -I ${PWD}/compat"
287
2021-02-23
op
fi
288
2021-02-23
op
289
2021-01-21
op
# --------
290
2021-01-21
op
# write config.h
291
2021-01-21
op
292
2021-01-21
op
exec > config.h
293
2021-01-21
op
294
2021-01-21
op
cat <<__HEREDOC__
295
2021-01-21
op
#ifdef __cplusplus
296
2021-01-21
op
#error "Do not use C++."
297
2021-01-21
op
#endif
298
2021-01-21
op
__HEREDOC__
299
2021-01-21
op
300
2021-01-21
op
[ ${NEED_GNU_SOURCE} -eq 0 ] || echo "#define _GNU_SOURCE"
301
2021-01-21
op
[ ${NEED_OPENBSD_SOURCE} -eq 0 ] || echo "#define _OPENBSD_SOURCE"
302
2021-01-21
op
303
2021-02-23
op
[ ${HAVE_STRLCAT} -eq 0 -o ${HAVE_STRLCPY} -eq 0 -o ${HAVE_IMSG} -eq 0 ] \
304
2021-01-21
op
&& echo "#include <sys/types.h>"
305
2021-01-21
op
[ ${HAVE_VASPRINTF} -eq 0 ] && echo "#include <stdarg.h>"
306
2021-01-21
op
307
2021-02-23
op
if [ ${HAVE_QUEUE_H} -eq 1 ]; then
308
2021-02-23
op
echo "#include <sys/queue.h>"
309
2021-02-23
op
else
310
2021-02-23
op
echo "#include <queue.h>"
311
2021-10-07
op
fi
312
2021-10-07
op
313
2021-10-07
op
if [ ${HAVE_TREE_H} -eq 1 ]; then
314
2021-10-07
op
echo "#include <sys/tree.h>"
315
2021-10-07
op
else
316
2021-10-07
op
echo "#include <tree.h>"
317
2021-02-23
op
fi
318
2021-02-23
op
319
2021-02-23
op
echo "#include <sys/types.h>"
320
2021-02-23
op
echo "#include <sys/uio.h>"
321
2021-02-23
op
echo "#include <stdint.h>"
322
2021-02-23
op
echo "#include <imsg.h>"
323
2022-10-30
op
echo "#include <limits.h>"
324
2021-02-23
op
325
2021-01-21
op
cat <<__HEREDOC__
326
2021-01-21
op
327
2021-07-10
op
#define VERSION "${VERSION}"
328
2021-07-02
op
#define DISABLE_SANDBOX ${DISABLE_SANDBOX}
329
2021-07-02
op
330
2021-01-21
op
#define HAVE_ERR ${HAVE_ERR}
331
2021-01-21
op
#define HAVE_EXPLICIT_BZERO ${HAVE_EXPLICIT_BZERO}
332
2021-02-23
op
#define HAVE_FREEZERO ${HAVE_FREEZERO}
333
2021-02-23
op
#define HAVE_GETDTABLECOUNT ${HAVE_GETDTABLECOUNT}
334
2021-02-23
op
#define HAVE_GETDTABLESIZE ${HAVE_GETDTABLESIZE}
335
2021-01-21
op
#define HAVE_GETPROGNAME ${HAVE_GETPROGNAME}
336
2021-02-23
op
#define HAVE_IMSG ${HAVE_IMSG}
337
2021-09-19
op
#define HAVE_LANDLOCK ${HAVE_LANDLOCK}
338
2021-02-08
op
#define HAVE_LIBEVENT ${HAVE_LIBEVENT}
339
2021-10-02
op
#define HAVE_LIBEVENT2 ${HAVE_LIBEVENT2}
340
2021-02-11
op
#define HAVE_PROGRAM_INVOCATION_SHORT_NAME ${HAVE_PROGRAM_INVOCATION_SHORT_NAME}
341
2021-02-04
op
#define HAVE_PR_SET_NAME ${HAVE_PR_SET_NAME}
342
2021-02-23
op
#define HAVE_QUEUE_H ${HAVE_QUEUE_H}
343
2021-04-25
op
#define HAVE_REALLOCARRAY ${HAVE_REALLOCARRAY}
344
2021-01-21
op
#define HAVE_RECALLOCARRAY ${HAVE_RECALLOCARRAY}
345
2021-02-12
op
#define HAVE_SETPROCTITLE ${HAVE_SETPROCTITLE}
346
2021-01-21
op
#define HAVE_STRLCAT ${HAVE_STRLCAT}
347
2021-01-21
op
#define HAVE_STRLCPY ${HAVE_STRLCPY}
348
2021-01-21
op
#define HAVE_STRTONUM ${HAVE_STRTONUM}
349
2021-10-07
op
#define HAVE_TREE_H ${HAVE_TREE_H}
350
2021-01-21
op
#define HAVE_VASPRINTF ${HAVE_VASPRINTF}
351
2021-01-21
op
352
2021-01-21
op
__HEREDOC__
353
2021-01-22
op
354
2021-01-22
op
[ ${HAVE_EXPLICIT_BZERO} -eq 0 -o \
355
2021-02-23
op
${HAVE_FREEZERO} -eq 0 -o \
356
2021-04-25
op
${HAVE_REALLOCARRAY} -eq 0 -o \
357
2021-01-22
op
${HAVE_RECALLOCARRAY} -eq 0 -o \
358
2021-01-22
op
${HAVE_STRLCAT} -eq 0 -o \
359
2021-01-22
op
${HAVE_STRLCPY} -eq 0 -o \
360
2021-01-22
op
${HAVE_STRTONUM} -eq 0 ] && echo "#include <stddef.h>"
361
2021-01-21
op
362
2021-01-21
op
if [ ${HAVE_ERR} -eq 0 ]; then
363
2021-01-21
op
echo "extern void err(int, const char*, ...);"
364
2021-01-21
op
echo "extern void errx(int, const char*, ...);"
365
2021-01-21
op
echo "extern void warn(const char*, ...);"
366
2021-01-21
op
echo "extern void warnx(const char*, ...);"
367
2022-07-04
op
COBJS="${COBJS} compat/err.o"
368
2021-01-21
op
else
369
2021-01-21
op
echo "#include <err.h>"
370
2021-01-21
op
fi
371
2021-01-21
op
if [ ${HAVE_EXPLICIT_BZERO} -eq 0 ]; then
372
2021-01-21
op
echo "extern void explicit_bzero(void*, size_t);"
373
2022-07-04
op
COBJS="${COBJS} compat/explicit_bzero.o"
374
2021-01-25
op
fi
375
2021-02-23
op
if [ ${HAVE_FREEZERO} -eq 0 ]; then
376
2021-02-23
op
echo "extern void freezero(void*, size_t);"
377
2022-07-04
op
COBJS="${COBJS} compat/freezero.o"
378
2021-02-23
op
fi
379
2021-02-23
op
if [ ${HAVE_GETDTABLECOUNT} -eq 0 ]; then
380
2021-02-23
op
echo "extern int getdtablecount(void);"
381
2022-07-04
op
COBJS="${COBJS} compat/getdtablecount.o"
382
2021-02-23
op
fi
383
2021-02-23
op
if [ ${HAVE_GETDTABLESIZE} -eq 0 ]; then
384
2021-02-23
op
echo "extern int getdtablesize(void);"
385
2022-07-04
op
COBJS="${COBJS} compat/getdtablesize.o"
386
2021-02-23
op
fi
387
2021-01-25
op
if [ ${HAVE_GETPROGNAME} -eq 0 ]; then
388
2021-01-25
op
echo "extern const char *getprogname(void);"
389
2022-07-04
op
COBJS="${COBJS} compat/getprogname.o"
390
2021-01-21
op
fi
391
2021-02-23
op
if [ ${HAVE_IMSG} -eq 0 ]; then
392
2022-07-04
op
COBJS="${COBJS} compat/imsg.o compat/imsg-buffer.o"
393
2021-02-23
op
fi
394
2022-10-31
op
if [ ${HAVE_MEMMEM} -eq 0 ]; then
395
2022-10-31
op
echo "extern void *memmem(const void *, size_t, const void *, size_t);"
396
2022-10-31
op
COBJS="${COBJS} compat/memmem.o"
397
2022-10-31
op
fi
398
2021-04-25
op
if [ ${HAVE_REALLOCARRAY} -eq 0 ]; then
399
2021-04-25
op
echo "extern void *reallocarray(void*, size_t, size_t);"
400
2022-07-04
op
COBJS="${COBJS} compat/reallocarray.o"
401
2021-04-25
op
fi
402
2021-01-21
op
if [ ${HAVE_RECALLOCARRAY} -eq 0 ]; then
403
2021-04-25
op
echo "extern void *recallocarray(void*, size_t, size_t, size_t);"
404
2022-07-04
op
COBJS="${COBJS} compat/recallocarray.o"
405
2021-01-21
op
fi
406
2021-02-04
op
if [ ${HAVE_SETPROCTITLE} -eq 0 ]; then
407
2021-02-04
op
echo "extern void setproctitle(const char *fmt, ...);"
408
2022-07-04
op
COBJS="${COBJS} compat/setproctitle.o"
409
2021-02-04
op
fi
410
2021-01-21
op
if [ ${HAVE_STRLCAT} -eq 0 ]; then
411
2021-01-21
op
echo "extern size_t strlcat(char*, const char*, size_t);"
412
2022-07-04
op
COBJS="${COBJS} compat/strlcat.o"
413
2021-01-21
op
fi
414
2021-01-21
op
if [ ${HAVE_STRLCPY} -eq 0 ]; then
415
2021-01-21
op
echo "extern size_t strlcpy(char*, const char*, size_t);"
416
2022-07-04
op
COBJS="${COBJS} compat/strlcpy.o"
417
2021-01-21
op
fi
418
2021-01-21
op
if [ ${HAVE_STRTONUM} -eq 0 ]; then
419
2021-01-22
op
echo "extern long long strtonum(const char*, long long, long long, const char**);"
420
2022-07-04
op
COBJS="${COBJS} compat/strtonum.o"
421
2021-01-21
op
fi
422
2021-01-21
op
if [ ${HAVE_VASPRINTF} -eq 0 ]; then
423
2021-01-21
op
echo "extern int vasprintf(char**, const char*, va_list);"
424
2022-07-04
op
COBJS="${COBJS} compat/vasprintf.o"
425
2021-01-21
op
fi
426
2022-09-08
op
427
2022-09-08
op
cat <<__HEREDOC__
428
2022-09-08
op
429
2022-09-08
op
#ifndef __dead
430
2022-09-08
op
#define __dead __attribute__((noreturn))
431
2022-10-30
op
#endif
432
2022-10-30
op
433
2022-10-30
op
/* Linux and OpenBSD have LOGIN_NAME_MAX, FreeBSD MAXLOGNAME. */
434
2022-10-30
op
#ifndef LOGIN_NAME_MAX
435
2022-10-30
op
# if defined(MAXLOGNAME)
436
2022-10-30
op
# define LOGIN_NAME_MAX MAXLOGNAME
437
2022-10-30
op
# elif defined(_POSIX_LOGIN_NAME_MAX)
438
2022-10-30
op
# define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX
439
2022-10-30
op
# else
440
2022-10-30
op
# define LOGIN_NAME_MAX 32
441
2022-10-30
op
# endif
442
2022-09-08
op
#endif
443
2022-10-30
op
444
2022-10-30
op
#ifndef HOST_NAME_MAX
445
2022-10-30
op
# if defined(_POSIX_HOST_NAME_MAX)
446
2022-10-30
op
# define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
447
2022-10-30
op
# else
448
2022-10-30
op
# define HOST_NAME_MAX 255
449
2022-10-30
op
# endif
450
2022-10-30
op
#endif
451
2022-09-08
op
__HEREDOC__
452
2022-09-08
op
453
2021-01-21
op
echo "file config.h: written" 1>&2
454
2021-01-21
op
echo "file config.h: written" 1>&3
455
2021-01-21
op
456
2021-01-21
op
# --------
457
2021-01-21
op
# tests for Makefile.local
458
2021-01-21
op
459
2021-01-21
op
exec > Makefile.local
460
2021-01-21
op
461
2021-01-21
op
[ -z "${BINDIR}" ] && BINDIR="${PREFIX}/bin"
462
2021-01-21
op
[ -z "${MANDIR}" ] && MANDIR="${PREFIX}/man"
463
2021-01-21
op
464
2021-01-21
op
[ -z "${INSTALL_PROGRAM}" ] && INSTALL_PROGRAM="${INSTALL} -m 0555"
465
2021-01-21
op
[ -z "${INSTALL_LIB}" ] && INSTALL_LIB="${INSTALL} -m 0444"
466
2021-01-21
op
[ -z "${INSTALL_MAN}" ] && INSTALL_MAN="${INSTALL} -m 0444"
467
2021-01-21
op
[ -z "${INSTALL_DATA}" ] && INSTALL_DATA="${INSTALL} -m 0444"
468
2021-01-21
op
469
2021-01-21
op
cat << __HEREDOC__
470
2021-01-21
op
CC = ${CC}
471
2021-01-21
op
CFLAGS = ${CFLAGS}
472
2021-02-23
op
LDFLAGS = ${LDFLAGS} ${LD_IMSG}
473
2021-01-21
op
YACC = ${YACC}
474
2021-01-21
op
STATIC = ${STATIC}
475
2021-01-21
op
PREFIX = ${PREFIX}
476
2021-01-21
op
BINDIR = ${BINDIR}
477
2021-02-07
op
MANDIR = ${MANDIR}
478
2021-01-21
op
INCLUDEDIR = ${INCLUDEDIR}
479
2021-01-21
op
INSTALL = ${INSTALL}
480
2021-01-21
op
INSTALL_PROGRAM = ${INSTALL_PROGRAM}
481
2021-01-21
op
INSTALL_LIB = ${INSTALL_LIB}
482
2021-01-21
op
INSTALL_MAN = ${INSTALL_MAN}
483
2021-01-21
op
INSTALL_DATA = ${INSTALL_DATA}
484
2021-02-10
op
485
2022-07-04
op
COBJS = ${COBJS}
486
2022-01-03
op
487
2021-07-10
op
VERSION = ${VERSION}
488
2021-07-10
op
489
2021-01-21
op
__HEREDOC__
490
2021-02-10
op
491
2021-01-21
op
echo "file Makefile.local: written" 1>&2
492
2021-01-21
op
echo "file Makefile.local: written" 1>&3
493
2021-01-21
op
494
2021-01-21
op
exit 0
Omar Polo