-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·214 lines (191 loc) · 5.41 KB
/
configure
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
#!/bin/sh
#
# libslack - https://libslack.org
#
# Copyright (C) 1999-2004, 2010, 2020-2023 raf <raf@raf.org>
#
# 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 2 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 <https://www.gnu.org/licenses/>.
#
# 20230824 raf <raf@raf.org>
#
# Handle --default (for distribution)
case "$1" in
--default|default)
set -- --platform=Linux --prefix=default --destdir= --disable-test-rwlock --enable-mail-test
CC=
;;
esac
die() { echo "$0: $@" >&2; exit 1; }
PLATFORM=
for opt in "$@"
do
case "$opt" in
--help|-h)
echo "$0 [options]"
echo "options:"
echo " --help - Print this message then exit"
echo " --prefix=/path - Override platform-specific installation prefix"
echo " --destdir=/path - Override DESTDIR in Makefile for building packages"
echo " --enable-test-rwlock - Enable backup rwlock implementation"
echo " --disable-test-rwlock - Disable backup rwlock implementation (default)"
echo " --enable-mail-test - Enable sending an email during tests (default)"
echo " --disable-mail-test - Disable sending an email during tests"
echo " --enable-test - Include backup implementations of some functions (don't)"
echo " --default - Restore Makefile (et al.) to default state (for distribution)"
echo " --platform=platform - Override platform (one of the below) for --default"
echo
echo "This configure script knows what to do for several platforms:"
echo
echo " Linux, macOS, FreeBSD, OpenBSD, NetBSD, GNU/kFreeBSD, GNU/Hurd, Solaris"
echo ""
echo "To override a platform-specific install prefix, use --prefix (e.g. /opt/local)."
echo "Note: For --prefix=default and --prefix=/usr, /etc and /var/run are still used."
echo "For other values, these paths are affected by the prefix."
echo ""
echo "To override the makefile \$(DESTDIR), use --destdir."
echo "This is for building packages and doesn't affect paths in the final binary."
echo ""
echo "When creating packages, use --disable-mail-test to suppress an internal"
echo "test that sends an email message."
echo ""
echo "To undo the effects of --disable-mail-test, use --enable-mail-test."
echo ""
echo "If set here, \$CC will override the compiler in the Makefile."
echo ""
echo "\$CPPFLAGS, \$CFLAGS and \$LDFLAGS additions need to be supplied to make later."
echo ""
exit 0
;;
--platform=*)
PLATFORM="${opt#--platform=}"
case "$PLATFORM" in
Linux*|GNU/kFreeBSD*|GNU*|FreeBSD*|NetBSD*|OpenBSD*|SunOS*|Solaris|Darwin*|macOS)
;;
*)
die "Unknown platform: $PLATFORM\nMust be one of: Linux, macOS, FreeBSD, OpenBSD, NetBSD, GNU/kFreeBSD, GNU/Hurd, Solaris"
;;
esac
;;
esac
done
case "${PLATFORM:-`uname -a`}" in
Linux*)
echo "Configuring for linux"
conf/linux
if [ -f /etc/slackware-version ]
then
echo "Configuring for slackware"
conf/slackware
fi
;;
GNU/kFreeBSD*)
echo "Configuring for kfreebsd"
conf/kfreebsd
;;
GNU*)
echo "Configuring for hurd"
conf/gnuhurd
;;
FreeBSD*)
echo "Configuring for freebsd"
conf/freebsd
;;
NetBSD*)
echo "Configuring for netbsd"
conf/netbsd
;;
OpenBSD*)
echo "Configuring for openbsd"
conf/openbsd
;;
SunOS*|Solaris)
cc=""
solaris="solaris10"
[ "x`uname -r`" = "x5.8" ] && solaris="solaris8"
[ "x`uname -r`" = "x5.6" ] && solaris="solaris6"
if [ "`uname -m`" = sun4u ]
then
[ "x`which gcc 2>&-`" != "x" ] && cc="gcc"
[ "x`which cc 2>&-`" != "x" ] && cc="cc"
else
[ "x`which cc 2>&-`" != "x" ] && cc="cc"
[ "x`which gcc 2>&-`" != "x" ] && cc="gcc"
fi
[ "$cc" = "" ] && die "Failed to find a compiler"
echo "Configuring for $solaris (with $cc)"
conf/$solaris-$cc
;;
Darwin*|macOS)
echo "Configuring for macos"
conf/macosx
;;
*)
die "Unknown platform: Please configure manually"
;;
esac
# Set CC from $CC (for macports)
if [ "x$CC" != x ]
then
echo "Configuring CC as $CC"
conf/ccenv
fi
# Process command line options
for opt in "$@"
do
case "$opt" in
--platform=*)
;;
--prefix=*)
echo "Configuring $opt"
conf/prefix "$opt"
;;
--destdir=*)
echo "Configuring $opt"
conf/destdir "$opt"
;;
--enable-test)
echo "Configuring to include backup function implementations."
conf/test
;;
--enable-test-rwlock)
echo "Configuring to include backup rwlock implementation."
conf/test-rwlock-start
;;
--disable-test-rwlock)
echo "Configuring to exclude backup rwlock implementation (default)."
conf/test-rwlock-stop
;;
--enable-mail-test)
echo "Configuring to include mail tests (default)."
conf/mail-test-start
;;
--disable-mail-test)
echo "Configuring to exclude mail tests."
conf/mail-test-stop
;;
*)
echo "$0: Unknown argument: $opt" >&2
exit 1
;;
esac
done
# Prepare for parallel make
if [ x"`which gmake 2>&-`" != x"" ]
then
gmake ready
else
make ready
fi
exit 0
# vi:set ts=4 sw=4: