Blame
Date:
Fri Jul 1 20:15:54 2022 UTC
Message:
provide a better error message on missing x libs
001
2022-07-01
op
#! /bin/sh
002
2022-07-01
op
#
003
2022-07-01
op
# Copyright (c) 2014, 2015, 2016 Ingo Schwarze <schwarze@openbsd.org>
004
2022-07-01
op
# Copyright (c) 2017, 2018 Kristaps Dzonsons <kristaps@bsd.lv>
005
2022-07-01
op
# Copyright (c) 2022 Omar Polo <op@omarpolo.com>
006
2022-07-01
op
#
007
2022-07-01
op
# Permission to use, copy, modify, and distribute this software for any
008
2022-07-01
op
# purpose with or without fee is hereby granted, provided that the above
009
2022-07-01
op
# copyright notice and this permission notice appear in all copies.
010
2022-07-01
op
#
011
2022-07-01
op
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
012
2022-07-01
op
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
013
2022-07-01
op
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
014
2022-07-01
op
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
015
2022-07-01
op
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
016
2022-07-01
op
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
017
2022-07-01
op
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
018
2022-07-01
op
019
2022-07-01
op
OCONFIGURE_VERSION="0.3.8"
020
2022-07-01
op
MYMENU_VERSION="0.2"
021
2022-07-01
op
022
2022-07-01
op
#
023
2022-07-01
op
# This script outputs two files: config.h and Makefile.configure.
024
2022-07-01
op
# It tries to read from configure.local, which contains predefined
025
2022-07-01
op
# values we won't autoconfigure.
026
2022-07-01
op
#
027
2022-07-01
op
# If you want to use configure with your project, have your GNUmakefile
028
2022-07-01
op
# or BSDmakefile---whichever---try to import/include Makefile.configure
029
2022-07-01
op
# at the beginning of the file.
030
2022-07-01
op
#
031
2022-07-01
op
# Like so (note no quotes, no period, etc.):
032
2022-07-01
op
#
033
2022-07-01
op
# include Makefile.configure
034
2022-07-01
op
#
035
2022-07-01
op
# If it exists, configure was run; otherwise, it wasn't.
036
2022-07-01
op
#
037
2022-07-01
op
# You'll probably want to change parts of this file. I've noted the
038
2022-07-01
op
# parts that you'll probably change in the section documentation.
039
2022-07-01
op
#
040
2022-07-01
op
# See https://github.com/kristapsdz/oconfigure for more.
041
2022-07-01
op
042
2022-07-01
op
set -e
043
2022-07-01
op
044
2022-07-01
op
#----------------------------------------------------------------------
045
2022-07-01
op
# Prepare for running: move aside previous configure runs.
046
2022-07-01
op
# Output file descriptor usage:
047
2022-07-01
op
# 1 (stdout): config.h or Makefile.configure
048
2022-07-01
op
# 2 (stderr): original stderr, usually to the console
049
2022-07-01
op
# 3: config.log
050
2022-07-01
op
# You DO NOT want to change this.
051
2022-07-01
op
#----------------------------------------------------------------------
052
2022-07-01
op
053
2022-07-01
op
[ -w config.log ] && mv config.log config.log.old
054
2022-07-01
op
[ -w config.h ] && mv config.h config.h.old
055
2022-07-01
op
056
2022-07-01
op
exec 3> config.log
057
2022-07-01
op
echo "config.log: writing..."
058
2022-07-01
op
059
2022-07-01
op
# GNU submake prints different output if invoked recursively, which
060
2022-07-01
op
# messes up CC and CFLAGS detection. Pass --no-print-directory if
061
2022-07-01
op
# we have a MAKELEVEL (GNU and FreeBSD make) and the argument is
062
2022-07-01
op
# allowed.
063
2022-07-01
op
064
2022-07-01
op
MAKE_FLAGS=""
065
2022-07-01
op
066
2022-07-01
op
if [ -n "${MAKELEVEL}" ]; then
067
2022-07-01
op
if [ "${MAKELEVEL}" -gt 0 ] ; then
068
2022-07-01
op
MAKE_FLAGS="--no-print-directory"
069
2022-07-01
op
echo "all:" | make ${MAKE_FLAGS} -sf - 2>/dev/null || MAKE_FLAGS=""
070
2022-07-01
op
fi
071
2022-07-01
op
fi
072
2022-07-01
op
073
2022-07-01
op
if [ -n "$MAKE_FLAGS" ]; then
074
2022-07-01
op
echo "GNU submake detected: using --no-print-directory" 1>&2
075
2022-07-01
op
echo "GNU submake detected: using --no-print-directory" 1>&3
076
2022-07-01
op
fi
077
2022-07-01
op
078
2022-07-01
op
#----------------------------------------------------------------------
079
2022-07-01
op
# Initialize all variables here such that nothing can leak in from the
080
2022-07-01
op
# environment except for CC and CFLAGS, which we might have passed in.
081
2022-07-01
op
#----------------------------------------------------------------------
082
2022-07-01
op
083
2022-07-01
op
CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | make ${MAKE_FLAGS} -sf -`
084
2022-07-01
op
CFLAGS=`printf "all:\\n\\t@echo \\\$(CFLAGS)\\n" | make ${MAKE_FLAGS} -sf -`
085
2022-07-01
op
CFLAGS="${CFLAGS} -g -W -Wall -Wextra" # -Wmissing-prototypes -Wstrict-prototypes
086
2022-07-01
op
#CFLAGS="${CFLAGS} -Wwrite-strings -Wno-unused-parameter"
087
2022-07-01
op
LDADD=
088
2022-07-01
op
LDADD_LIB_SOCKET=
089
2022-07-01
op
LDADD_STATIC=
090
2022-07-01
op
LDADD_LIB_X11=
091
2022-07-01
op
CPPFLAGS=
092
2022-07-01
op
LDFLAGS=
093
2022-07-01
op
DESTDIR=
094
2022-07-01
op
PREFIX="/usr/local"
095
2022-07-01
op
BINDIR=
096
2022-07-01
op
SBINDIR=
097
2022-07-01
op
INCLUDEDIR=
098
2022-07-01
op
LIBDIR=
099
2022-07-01
op
MANDIR=
100
2022-07-01
op
SHAREDIR=
101
2022-07-01
op
INSTALL="install"
102
2022-07-01
op
INSTALL_PROGRAM=
103
2022-07-01
op
INSTALL_LIB=
104
2022-07-01
op
INSTALL_MAN=
105
2022-07-01
op
INSTALL_DATA=
106
2022-07-01
op
107
2022-07-01
op
# compats needed
108
2022-07-01
op
COBJ=
109
2022-07-01
op
110
2022-07-01
op
# SunOS sets "cc", but this doesn't exist.
111
2022-07-01
op
# It does have gcc, so try that instead.
112
2022-07-01
op
# Prefer clang, though.
113
2022-07-01
op
114
2022-07-01
op
command -v ${CC} 2>/dev/null 1>&2 || {
115
2022-07-01
op
echo "${CC} not found: trying clang" 1>&2
116
2022-07-01
op
echo "${CC} not found: trying clang" 1>&3
117
2022-07-01
op
CC=clang
118
2022-07-01
op
command -v ${CC} 2>/dev/null 1>&2 || {
119
2022-07-01
op
echo "${CC} not found: trying gcc" 1>&2
120
2022-07-01
op
echo "${CC} not found: trying gcc" 1>&3
121
2022-07-01
op
CC=gcc
122
2022-07-01
op
command -v ${CC} 2>/dev/null 1>&2 || {
123
2022-07-01
op
echo "gcc not found: giving up" 1>&2
124
2022-07-01
op
echo "gcc not found: giving up" 1>&3
125
2022-07-01
op
exit 1
126
2022-07-01
op
}
127
2022-07-01
op
}
128
2022-07-01
op
}
129
2022-07-01
op
130
2022-07-01
op
command -v pkg-config 2>/dev/null 1>&2 && {
131
2022-07-01
op
if extra="$(pkg-config --cflags x11 xinerama xft || true)"; then
132
2022-07-01
op
echo "Adding to CFLAGS: $extra (pkg-config)"
133
2022-07-01
op
CFLAGS="$extra ${CFLAGS}"
134
2022-07-01
op
fi
135
2022-07-01
op
if extra="$(pkg-config --libs x11 xinerama xft || true)"; then
136
2022-07-01
op
echo "Adding to LDFLAGS: $extra (pkg-config)"
137
2022-07-01
op
LDFLAGS="$extra ${LDFLAGS}"
138
2022-07-01
op
fi
139
2022-07-01
op
}
140
2022-07-01
op
141
2022-07-01
op
#----------------------------------------------------------------------
142
2022-07-01
op
# Allow certain variables to be overriden on the command line.
143
2022-07-01
op
#----------------------------------------------------------------------
144
2022-07-01
op
145
2022-07-01
op
for keyvals in "$@"
146
2022-07-01
op
do
147
2022-07-01
op
key=`echo $keyvals | cut -s -d '=' -f 1`
148
2022-07-01
op
if [ -z "$key" ]
149
2022-07-01
op
then
150
2022-07-01
op
echo "$0: invalid key-value: $keyvals" 1>&2
151
2022-07-01
op
exit 1
152
2022-07-01
op
fi
153
2022-07-01
op
val=`echo $keyvals | cut -d '=' -f 2-`
154
2022-07-01
op
case "$key" in
155
2022-07-01
op
LDADD)
156
2022-07-01
op
LDADD="$val" ;;
157
2022-07-01
op
LDFLAGS)
158
2022-07-01
op
LDFLAGS="$val" ;;
159
2022-07-01
op
CPPFLAGS)
160
2022-07-01
op
CPPFLAGS="$val" ;;
161
2022-07-01
op
DESTDIR)
162
2022-07-01
op
DESTDIR="$val" ;;
163
2022-07-01
op
PREFIX)
164
2022-07-01
op
PREFIX="$val" ;;
165
2022-07-01
op
MANDIR)
166
2022-07-01
op
MANDIR="$val" ;;
167
2022-07-01
op
LIBDIR)
168
2022-07-01
op
LIBDIR="$val" ;;
169
2022-07-01
op
BINDIR)
170
2022-07-01
op
BINDIR="$val" ;;
171
2022-07-01
op
SHAREDIR)
172
2022-07-01
op
SHAREDIR="$val" ;;
173
2022-07-01
op
SBINDIR)
174
2022-07-01
op
SBINDIR="$val" ;;
175
2022-07-01
op
INCLUDEDIR)
176
2022-07-01
op
INCLUDEDIR="$val" ;;
177
2022-07-01
op
*)
178
2022-07-01
op
echo "$0: invalid key: $key" 1>&2
179
2022-07-01
op
exit 1
180
2022-07-01
op
esac
181
2022-07-01
op
done
182
2022-07-01
op
183
2022-07-01
op
184
2022-07-01
op
#----------------------------------------------------------------------
185
2022-07-01
op
# These are the values that will be pushed into config.h after we test
186
2022-07-01
op
# for whether they're supported or not.
187
2022-07-01
op
# Each of these must have a runtest(), below.
188
2022-07-01
op
# Please sort by alpha, for clarity.
189
2022-07-01
op
# You WANT to change this.
190
2022-07-01
op
#----------------------------------------------------------------------
191
2022-07-01
op
192
2022-07-01
op
HAVE_CAPSICUM=
193
2022-07-01
op
HAVE_ERR=
194
2022-07-01
op
HAVE_GETEXECNAME=
195
2022-07-01
op
HAVE_GETPROGNAME=
196
2022-07-01
op
HAVE_LANDLOCK=
197
2022-07-01
op
HAVE_PLEDGE=
198
2022-07-01
op
HAVE_PROGRAM_INVOCATION_SHORT_NAME=
199
2022-07-01
op
HAVE_REALLOCARRAY=
200
2022-07-01
op
HAVE_RECALLOCARRAY=
201
2022-07-01
op
HAVE_STRTONUM=
202
2022-07-01
op
HAVE___PROGNAME=
203
2022-07-01
op
204
2022-07-01
op
#----------------------------------------------------------------------
205
2022-07-01
op
# Allow configure.local to override all variables, default settings,
206
2022-07-01
op
# command-line arguments, and tested features, above.
207
2022-07-01
op
# You PROBABLY DO NOT want to change this.
208
2022-07-01
op
#----------------------------------------------------------------------
209
2022-07-01
op
210
2022-07-01
op
if [ -r ./configure.local ]; then
211
2022-07-01
op
echo "configure.local: reading..." 1>&2
212
2022-07-01
op
echo "configure.local: reading..." 1>&3
213
2022-07-01
op
cat ./configure.local 1>&3
214
2022-07-01
op
. ./configure.local
215
2022-07-01
op
else
216
2022-07-01
op
echo "configure.local: no (fully automatic configuration)" 1>&2
217
2022-07-01
op
echo "configure.local: no (fully automatic configuration)" 1>&3
218
2022-07-01
op
fi
219
2022-07-01
op
220
2022-07-01
op
echo 1>&3
221
2022-07-01
op
222
2022-07-01
op
#----------------------------------------------------------------------
223
2022-07-01
op
# Infrastructure for running tests.
224
2022-07-01
op
# These consists of a series of functions that will attempt to run the
225
2022-07-01
op
# given test file and record its exit into a HAVE_xxx variable.
226
2022-07-01
op
# You DO NOT want to change this.
227
2022-07-01
op
#----------------------------------------------------------------------
228
2022-07-01
op
229
2022-07-01
op
COMP="${CC} ${CFLAGS} ${CPPFLAGS} -Wno-unused -Werror"
230
2022-07-01
op
231
2022-07-01
op
# Check whether this HAVE_ setting is manually overridden.
232
2022-07-01
op
# If yes, use the override, if no, do not decide anything yet.
233
2022-07-01
op
# Arguments: lower-case test name, manual value
234
2022-07-01
op
235
2022-07-01
op
ismanual() {
236
2022-07-01
op
[ -z "${3}" ] && return 1
237
2022-07-01
op
echo "${1}: manual (HAVE_${2}=${3})" 1>&2
238
2022-07-01
op
echo "${1}: manual (HAVE_${2}=${3})" 1>&3
239
2022-07-01
op
echo 1>&3
240
2022-07-01
op
return 0
241
2022-07-01
op
}
242
2022-07-01
op
243
2022-07-01
op
# Run a single autoconfiguration test.
244
2022-07-01
op
# In case of success, enable the feature.
245
2022-07-01
op
# In case of failure, do not decide anything yet.
246
2022-07-01
op
# Arguments: lower-case test name, upper-case test name, additional
247
2022-07-01
op
# CFLAGS, additional LIBS.
248
2022-07-01
op
249
2022-07-01
op
singletest() {
250
2022-07-01
op
extralib=""
251
2022-07-01
op
cat 1>&3 << __HEREDOC__
252
2022-07-01
op
${1}: testing...
253
2022-07-01
op
${COMP} ${3} -o test-${1} test-${1}.c ${LDFLAGS} ${4}
254
2022-07-01
op
__HEREDOC__
255
2022-07-01
op
if ${COMP} ${3} -o "test-${1}" test-${1}.c ${LDFLAGS} ${4} 1>&3 2>&3; then
256
2022-07-01
op
echo "${1}: ${CC} succeeded" 1>&3
257
2022-07-01
op
else
258
2022-07-01
op
if [ -n "${5}" ] ; then
259
2022-07-01
op
echo "${1}: ${CC} failed with $? (retrying)" 1>&3
260
2022-07-01
op
cat 1>&3 << __HEREDOC__
261
2022-07-01
op
${1}: testing...
262
2022-07-01
op
${COMP} ${3} -o test-${1} test-${1}.c ${LDFLAGS} ${5}
263
2022-07-01
op
__HEREDOC__
264
2022-07-01
op
if ${COMP} ${3} -o "test-${1}" test-${1}.c ${LDFLAGS} ${5} 1>&3 2>&3; then
265
2022-07-01
op
echo "${1}: ${CC} succeeded" 1>&3
266
2022-07-01
op
extralib="(with ${5})"
267
2022-07-01
op
else
268
2022-07-01
op
echo "${1}: ${CC} failed with $?" 1>&3
269
2022-07-01
op
echo 1>&3
270
2022-07-01
op
return 1
271
2022-07-01
op
fi
272
2022-07-01
op
else
273
2022-07-01
op
echo "${1}: ${CC} failed with $?" 1>&3
274
2022-07-01
op
echo 1>&3
275
2022-07-01
op
return 1
276
2022-07-01
op
fi
277
2022-07-01
op
fi
278
2022-07-01
op
279
2022-07-01
op
if [ -n "${extralib}" ]
280
2022-07-01
op
then
281
2022-07-01
op
eval "LDADD_${2}=\"${5}\""
282
2022-07-01
op
elif [ -n "${4}" ]
283
2022-07-01
op
then
284
2022-07-01
op
eval "LDADD_${2}=\"${4}\""
285
2022-07-01
op
fi
286
2022-07-01
op
287
2022-07-01
op
echo "${1}: yes ${extralib}" 1>&2
288
2022-07-01
op
echo "${1}: yes ${extralib}" 1>&3
289
2022-07-01
op
echo 1>&3
290
2022-07-01
op
eval HAVE_${2}=1
291
2022-07-01
op
rm "test-${1}"
292
2022-07-01
op
return 0
293
2022-07-01
op
}
294
2022-07-01
op
295
2022-07-01
op
# Run a complete autoconfiguration test, including the check for
296
2022-07-01
op
# a manual override and disabling the feature on failure.
297
2022-07-01
op
# Arguments: lower case name, upper case name, additional CFLAGS,
298
2022-07-01
op
# additional LDADD, alternative LDADD.
299
2022-07-01
op
300
2022-07-01
op
runtest() {
301
2022-07-01
op
eval _manual=\${HAVE_${2}}
302
2022-07-01
op
ismanual "${1}" "${2}" "${_manual}" && return 0
303
2022-07-01
op
singletest "${1}" "${2}" "${3}" "${4}" "${5}" && return 0
304
2022-07-01
op
echo "${1}: no" 1>&2
305
2022-07-01
op
eval HAVE_${2}=0
306
2022-07-01
op
return 1
307
2022-07-01
op
}
308
2022-07-01
op
309
2022-07-01
op
#----------------------------------------------------------------------
310
2022-07-01
op
# Begin running the tests themselves.
311
2022-07-01
op
# All of your tests must be defined here.
312
2022-07-01
op
# Please sort as the HAVE_xxxx values were defined.
313
2022-07-01
op
# You WANT to change this.
314
2022-07-01
op
# It consists of the following columns:
315
2022-07-01
op
# runtest
316
2022-07-01
op
# (1) test file
317
2022-07-01
op
# (2) macro to set
318
2022-07-01
op
# (3) argument to cc *before* -o
319
2022-07-01
op
# (4) argument to cc *after*
320
2022-07-01
op
# (5) alternative argument to cc *after*
321
2022-07-01
op
#----------------------------------------------------------------------
322
2022-07-01
op
323
2022-07-01
op
runtest capsicum CAPSICUM || true
324
2022-07-01
op
runtest err ERR || true
325
2022-07-01
op
runtest getexecname GETEXECNAME || true
326
2022-07-01
op
runtest getprogname GETPROGNAME || true
327
2022-07-01
op
runtest landlock LANDLOCK || true
328
2022-07-01
op
runtest lib_socket LIB_SOCKET "" "" "-lsocket -lnsl" || true
329
2022-07-01
op
runtest pledge PLEDGE || true
330
2022-07-01
op
runtest program_invocation_short_name PROGRAM_INVOCATION_SHORT_NAME || true
331
2022-07-01
op
runtest reallocarray REALLOCARRAY || true
332
2022-07-01
op
runtest recallocarray RECALLOCARRAY || true
333
2022-07-01
op
runtest static STATIC "" "-static" || true
334
2022-07-01
op
runtest strtonum STRTONUM || true
335
2022-07-01
op
runtest x11 LIB_X11 "" "" "-lX11 -lXinerama -lXft" || true
336
2022-07-01
op
runtest __progname __PROGNAME || true
337
2022-07-01
op
338
2022-07-01
op
if [ "${HAVE_LIB_X11}" -eq 0 ]; then
339
2022-07-01
op
echo "FATAL: libx11 not found" 1>&2
340
2022-07-01
op
echo "make sure to have libx11, libxinerama and libxft installed" 1>&2
341
2022-07-01
op
echo "FATAL: libx11 not found" 1>&3
342
2022-07-01
op
exit 1
343
2022-07-01
op
fi
344
2022-07-01
op
345
2022-07-01
op
#----------------------------------------------------------------------
346
2022-07-01
op
# Output writing: generate the config.h file.
347
2022-07-01
op
# This file contains all of the HAVE_xxxx variables necessary for
348
2022-07-01
op
# compiling your source.
349
2022-07-01
op
# You must include "config.h" BEFORE any other variables.
350
2022-07-01
op
# You WANT to change this.
351
2022-07-01
op
#----------------------------------------------------------------------
352
2022-07-01
op
353
2022-07-01
op
exec > config.h
354
2022-07-01
op
355
2022-07-01
op
# Start with prologue.
356
2022-07-01
op
357
2022-07-01
op
cat << __HEREDOC__
358
2022-07-01
op
#ifndef OCONFIGURE_CONFIG_H
359
2022-07-01
op
#define OCONFIGURE_CONFIG_H
360
2022-07-01
op
361
2022-07-01
op
#ifdef __cplusplus
362
2022-07-01
op
# error "Do not use C++: this is a C application."
363
2022-07-01
op
#endif
364
2022-07-01
op
#if !defined(__GNUC__) || (__GNUC__ < 4)
365
2022-07-01
op
# define __attribute__(x)
366
2022-07-01
op
#endif
367
2022-07-01
op
#if defined(__linux__) || defined(__MINT__)
368
2022-07-01
op
# define _GNU_SOURCE /* memmem, memrchr, setresuid... */
369
2022-07-01
op
# define _DEFAULT_SOURCE /* le32toh, crypt, ... */
370
2022-07-01
op
#endif
371
2022-07-01
op
#if defined(__NetBSD__)
372
2022-07-01
op
# define _OPENBSD_SOURCE /* reallocarray, etc. */
373
2022-07-01
op
#endif
374
2022-07-01
op
#if defined(__sun)
375
2022-07-01
op
# ifndef _XOPEN_SOURCE /* SunOS already defines */
376
2022-07-01
op
# define _XOPEN_SOURCE /* XPGx */
377
2022-07-01
op
# endif
378
2022-07-01
op
# define _XOPEN_SOURCE_EXTENDED 1 /* XPG4v2 */
379
2022-07-01
op
# ifndef __EXTENSIONS__ /* SunOS already defines */
380
2022-07-01
op
# define __EXTENSIONS__ /* reallocarray, etc. */
381
2022-07-01
op
# endif
382
2022-07-01
op
#endif
383
2022-07-01
op
#if !defined(__BEGIN_DECLS)
384
2022-07-01
op
# define __BEGIN_DECLS
385
2022-07-01
op
#endif
386
2022-07-01
op
#if !defined(__END_DECLS)
387
2022-07-01
op
# define __END_DECLS
388
2022-07-01
op
#endif
389
2022-07-01
op
390
2022-07-01
op
__HEREDOC__
391
2022-07-01
op
392
2022-07-01
op
# This is just for size_t, mode_t, and dev_t.
393
2022-07-01
op
# Most of these functions, in the real world, pull in <string.h> or
394
2022-07-01
op
# someting that pulls in support for size_t.
395
2022-07-01
op
# Our function declarations are standalone, so specify them here.
396
2022-07-01
op
397
2022-07-01
op
if [ ${HAVE_REALLOCARRAY} -eq 0 -o \
398
2022-07-01
op
${HAVE_RECALLOCARRAY} -eq 0 ]
399
2022-07-01
op
then
400
2022-07-01
op
echo "#include <sys/types.h> /* size_t, mode_t, dev_t */ "
401
2022-07-01
op
echo
402
2022-07-01
op
fi
403
2022-07-01
op
404
2022-07-01
op
if [ ${HAVE_ERR} -eq 0 ]
405
2022-07-01
op
then
406
2022-07-01
op
echo "#include <stdarg.h> /* err(3) */"
407
2022-07-01
op
echo
408
2022-07-01
op
fi
409
2022-07-01
op
410
2022-07-01
op
# Now we handle our HAVE_xxxx values.
411
2022-07-01
op
# Most will just be defined as 0 or 1.
412
2022-07-01
op
413
2022-07-01
op
cat << __HEREDOC__
414
2022-07-01
op
/*
415
2022-07-01
op
* Results of configuration feature-testing.
416
2022-07-01
op
*/
417
2022-07-01
op
#define HAVE_CAPSICUM ${HAVE_CAPSICUM}
418
2022-07-01
op
#define HAVE_ERR ${HAVE_ERR}
419
2022-07-01
op
#define HAVE_GETEXECNAME ${HAVE_GETEXECNAME}
420
2022-07-01
op
#define HAVE_GETPROGNAME ${HAVE_GETPROGNAME}
421
2022-07-01
op
#define HAVE_LANDLOCK ${HAVE_LANDLOCK}
422
2022-07-01
op
#define HAVE_PLEDGE ${HAVE_PLEDGE}
423
2022-07-01
op
#define HAVE_PROGRAM_INVOCATION_SHORT_NAME ${HAVE_PROGRAM_INVOCATION_SHORT_NAME}
424
2022-07-01
op
#define HAVE_REALLOCARRAY ${HAVE_REALLOCARRAY}
425
2022-07-01
op
#define HAVE_RECALLOCARRAY ${HAVE_RECALLOCARRAY}
426
2022-07-01
op
#define HAVE_STRTONUM ${HAVE_STRTONUM}
427
2022-07-01
op
#define HAVE___PROGNAME ${HAVE___PROGNAME}
428
2022-07-01
op
429
2022-07-01
op
__HEREDOC__
430
2022-07-01
op
431
2022-07-01
op
# Now we do our function declarations for missing functions.
432
2022-07-01
op
433
2022-07-01
op
[ ${HAVE_ERR} -eq 0 ] && \
434
2022-07-01
op
COBJ="compat_err.c ${COBJ}" && \
435
2022-07-01
op
cat << __HEREDOC__
436
2022-07-01
op
/*
437
2022-07-01
op
* Compatibility functions for err(3).
438
2022-07-01
op
*/
439
2022-07-01
op
extern void err(int, const char *, ...) __attribute__((noreturn));
440
2022-07-01
op
extern void errc(int, int, const char *, ...) __attribute__((noreturn));
441
2022-07-01
op
extern void errx(int, const char *, ...) __attribute__((noreturn));
442
2022-07-01
op
extern void verr(int, const char *, va_list) __attribute__((noreturn));
443
2022-07-01
op
extern void verrc(int, int, const char *, va_list) __attribute__((noreturn));
444
2022-07-01
op
extern void verrx(int, const char *, va_list) __attribute__((noreturn));
445
2022-07-01
op
extern void warn(const char *, ...);
446
2022-07-01
op
extern void warnx(const char *, ...);
447
2022-07-01
op
extern void warnc(int, const char *, ...);
448
2022-07-01
op
extern void vwarn(const char *, va_list);
449
2022-07-01
op
extern void vwarnc(int, const char *, va_list);
450
2022-07-01
op
extern void vwarnx(const char *, va_list);
451
2022-07-01
op
__HEREDOC__
452
2022-07-01
op
453
2022-07-01
op
[ ${HAVE_GETPROGNAME} -eq 0 ] && \
454
2022-07-01
op
COBJ="compat_getprogname.c ${COBJ}" && \
455
2022-07-01
op
cat << __HEREDOC__
456
2022-07-01
op
/*
457
2022-07-01
op
* Compatibility for getprogname(3).
458
2022-07-01
op
*/
459
2022-07-01
op
extern const char *getprogname(void);
460
2022-07-01
op
461
2022-07-01
op
__HEREDOC__
462
2022-07-01
op
463
2022-07-01
op
[ ${HAVE_REALLOCARRAY} -eq 0 ] && \
464
2022-07-01
op
COBJ="compat_reallocarray.c ${COBJ}" && \
465
2022-07-01
op
cat << __HEREDOC__
466
2022-07-01
op
/*
467
2022-07-01
op
* Compatibility for reallocarray(3).
468
2022-07-01
op
*/
469
2022-07-01
op
extern void *reallocarray(void *, size_t, size_t);
470
2022-07-01
op
471
2022-07-01
op
__HEREDOC__
472
2022-07-01
op
473
2022-07-01
op
[ ${HAVE_RECALLOCARRAY} -eq 0 ] && \
474
2022-07-01
op
COBJ="compat_recallocarray.c ${COBJ}" && \
475
2022-07-01
op
cat << __HEREDOC__
476
2022-07-01
op
/*
477
2022-07-01
op
* Compatibility for recallocarray(3).
478
2022-07-01
op
*/
479
2022-07-01
op
extern void *recallocarray(void *, size_t, size_t, size_t);
480
2022-07-01
op
481
2022-07-01
op
__HEREDOC__
482
2022-07-01
op
483
2022-07-01
op
[ ${HAVE_STRTONUM} -eq 0 ] && \
484
2022-07-01
op
COBJ="compat_strtonum.c ${COBJ}" && \
485
2022-07-01
op
cat << __HEREDOC__
486
2022-07-01
op
/*
487
2022-07-01
op
* Compatibility for strotnum(3).
488
2022-07-01
op
*/
489
2022-07-01
op
extern long long strtonum(const char *, long long, long long, const char **);
490
2022-07-01
op
491
2022-07-01
op
__HEREDOC__
492
2022-07-01
op
493
2022-07-01
op
cat <<__HEREDOC__
494
2022-07-01
op
/*
495
2022-07-01
op
* mymenu version
496
2022-07-01
op
*/
497
2022-07-01
op
#define VERSION "${MYMENU_VERSION}"
498
2022-07-01
op
499
2022-07-01
op
__HEREDOC__
500
2022-07-01
op
501
2022-07-01
op
cat << __HEREDOC__
502
2022-07-01
op
#endif /*!OCONFIGURE_CONFIG_H*/
503
2022-07-01
op
__HEREDOC__
504
2022-07-01
op
505
2022-07-01
op
echo "config.h: written" 1>&2
506
2022-07-01
op
echo "config.h: written" 1>&3
507
2022-07-01
op
508
2022-07-01
op
#----------------------------------------------------------------------
509
2022-07-01
op
# Now we go to generate our Makefile.configure.
510
2022-07-01
op
# This file is simply a bunch of Makefile variables.
511
2022-07-01
op
# They'll work in both GNUmakefile and BSDmakefile.
512
2022-07-01
op
# You MIGHT want to change this.
513
2022-07-01
op
#----------------------------------------------------------------------
514
2022-07-01
op
515
2022-07-01
op
exec > Makefile.configure
516
2022-07-01
op
517
2022-07-01
op
[ -z "${BINDIR}" ] && BINDIR="${PREFIX}/bin"
518
2022-07-01
op
[ -z "${SBINDIR}" ] && SBINDIR="${PREFIX}/sbin"
519
2022-07-01
op
[ -z "${INCLUDEDIR}" ] && INCLUDEDIR="${PREFIX}/include"
520
2022-07-01
op
[ -z "${LIBDIR}" ] && LIBDIR="${PREFIX}/lib"
521
2022-07-01
op
[ -z "${MANDIR}" ] && MANDIR="${PREFIX}/man"
522
2022-07-01
op
[ -z "${SHAREDIR}" ] && SHAREDIR="${PREFIX}/share"
523
2022-07-01
op
524
2022-07-01
op
[ -z "${INSTALL_PROGRAM}" ] && INSTALL_PROGRAM="${INSTALL} -m 0555"
525
2022-07-01
op
[ -z "${INSTALL_LIB}" ] && INSTALL_LIB="${INSTALL} -m 0444"
526
2022-07-01
op
[ -z "${INSTALL_MAN}" ] && INSTALL_MAN="${INSTALL} -m 0444"
527
2022-07-01
op
[ -z "${INSTALL_DATA}" ] && INSTALL_DATA="${INSTALL} -m 0444"
528
2022-07-01
op
529
2022-07-01
op
cat << __HEREDOC__
530
2022-07-01
op
CC = ${CC}
531
2022-07-01
op
CFLAGS = ${CFLAGS}
532
2022-07-01
op
CPPFLAGS = ${CPPFLAGS}
533
2022-07-01
op
LDADD = ${LDADD}
534
2022-07-01
op
LDADD_LIB_SOCKET = ${LDADD_LIB_SOCKET}
535
2022-07-01
op
LDADD_STATIC = ${LDADD_STATIC}
536
2022-07-01
op
LDADD_LIB_X11 = ${LDADD_LIB_X11}
537
2022-07-01
op
LDFLAGS = ${LDFLAGS}
538
2022-07-01
op
STATIC = ${STATIC}
539
2022-07-01
op
PREFIX = ${PREFIX}
540
2022-07-01
op
BINDIR = ${BINDIR}
541
2022-07-01
op
SHAREDIR = ${SHAREDIR}
542
2022-07-01
op
SBINDIR = ${SBINDIR}
543
2022-07-01
op
INCLUDEDIR = ${INCLUDEDIR}
544
2022-07-01
op
LIBDIR = ${LIBDIR}
545
2022-07-01
op
MANDIR = ${MANDIR}
546
2022-07-01
op
INSTALL = ${INSTALL}
547
2022-07-01
op
INSTALL_PROGRAM = ${INSTALL_PROGRAM}
548
2022-07-01
op
INSTALL_LIB = ${INSTALL_LIB}
549
2022-07-01
op
INSTALL_MAN = ${INSTALL_MAN}
550
2022-07-01
op
INSTALL_DATA = ${INSTALL_DATA}
551
2022-07-01
op
552
2022-07-01
op
COBJ = ${COBJ}
553
2022-07-01
op
__HEREDOC__
554
2022-07-01
op
555
2022-07-01
op
echo "Makefile.configure: written" 1>&2
556
2022-07-01
op
echo "Makefile.configure: written" 1>&3
557
2022-07-01
op
558
2022-07-01
op
exit 0
Omar Polo