-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·146 lines (122 loc) · 3.25 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
#!/bin/sh
#
# Copyright (c) 2014, 2015, 2016 Ingo Schwarze <schwarze@openbsd.org>
# Copyright (c) 2017, 2018 Kristaps Dzonsons <kristaps@bsd.lv>
# Copyright (c) 2022, 2023 Omar Polo <op@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
set -e
RELEASE=no
usage()
{
echo "usage: $0 [--help] [--option=value] [OPTION=VALUE]" >&2
exit 1
}
PKG_CONFIG=
if command -v pkg-config 2>/dev/null >&2; then
PKG_CONFIG=pkg-config
fi
while [ $# -gt 0 ]; do
key="${1%%=*}"
val="${1#*=}"
if [ "$key" = --help ]; then
usage
fi
if [ "$key" = "$1" ]; then
# if no --x=y, look at the next arg
if !shift 2>/dev/null; then
echo "$0: missing value for $key" >&2
exit 1
fi
val="$1"
fi
case "$key" in
--mandir) key=MANDIR ;;
--perllib) key=PERL_LIB ;;
--prefix) key=PREFIX ;;
--realsysconfdir) key=REALSYSCONFDIR ;;
--sharedir) key=SHAREDIR ;;
--sysconfdir) key=SYSCONFDIR ;;
--wwwuser) key=WWWUSER ;;
esac
case "$key" in
CC) CC="$val" ;;
CFLAGS) CFLAGS="$val" ;;
LDFLAGS) LDFLAGS="$val" ;;
MANDIR) MANDIR="$val" ;;
PERL_LIB) PERL_LIB="$val" ;;
PKG_CONFIG) PKG_CONFIG="$val" ;;
PREFIX) PREFIX="$val" ;;
REALSYSCONFDIR) REALSYSCONFDIR="$val" ;;
SHAREDIR) SHAREDIR="$val" ;;
SYSCONFDIR) SYSCONFDIR="$val" ;;
WWWUSER) WWWUSER="$val" ;;
esac
shift
done
CC=${CC:-cc}
CFLAGS=${CFLAGS:--O2 -pipe}
PREFIX=${PREFIX-/usr/local}
SYSCONFDIR=${SYSCONFDIR-/etc}
WWWUSER=${WWWUSER:-www}
pkgconfig=${PKG_CONFIG}
if [ "$pkgconfig" = no ]; then
pkgconfig=
fi
export CC CFLAGS LDFLAGS pkgconfig
mv config.log config.log.old 2>/dev/null || true
exec 3> config.log
echo "config.log: writing..."
echo >&2
echo "running configure for \`msearchd':" >&2
(cd msearchd && ./configure)
echo >&2
echo "returning to the configure for \`smarc':" >&2
exec > config.mk
echo "config.mk: writing...">&2
cat <<EOF
INSTALL = install
INSTALL_PROGRAM = \${INSTALL} -m 0555
INSTALL_LIB = \${INSTALL} -m 0444
INSTALL_MAN = \${INSTALL} -m 0444
INSTALL_DATA = \${INSTALL} -m 0444
BINDIR = \${PREFIX}/bin
PREFIX = ${PREFIX}
LIBEXEC = \${PREFIX}/libexec
SBINDIR = \${PREFIX}/sbin
SYSCONFDIR = ${SYSCONFDIR}
WWWUSER = ${WWWUSER}
EOF
if [ -n "$REALSYSCONFDIR" ]; then
echo "REALSYSCONFDIR = ${REALSYSCONFDIR}"
else
echo 'REALSYSCONFDIR = ${SYSCONFDIR}'
fi
if [ -n "$MANDIR" ]; then
echo "MANDIR = ${MANDIR}"
else
echo 'MANDIR = ${PREFIX}/man'
fi
if [ -n "$SHAREDIR" ]; then
echo "SHAREDIR = ${SHAREDIR}"
else
echo 'SHAREDIR = ${PREFIX}/share'
fi
if [ -n "$PERL_LIB" ]; then
echo "PERL_LIB = ${PERL_LIB}"
else
echo 'PERL_LIB = ${PREFIX}/libdata/perl5/site_perl'
fi
echo >&2
echo "Now run \`make' to compile." >&2
echo >&2