-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathconfigure
executable file
·149 lines (126 loc) · 3.4 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
#!/bin/sh
set -eu
eecho () {
echo "$*" >&2
}
fail() {
eecho "$0: $*"
exit 1
}
usage () {
cat <<EOF
./configure [OPTS...]
where OPTS are:
CC=...
CFLAGS=...
LDFLAGS=...
--prefix=...
--janet-header-cflags=...
Compiler flags specifying the include path
of the janet headers the extension module is built against.
If not specifed, 'pkg-config --cflags janet' is used.
--with-pkg-config-readline
Use pkg-config to try and find the right compiler
and linker flags for the readline library. This is the default.
--with-pkg-config-libedit
Use pkg-config to try and find the right compiler
and linker flags for the libedit library. This
library replaces readline.
--with-readnoise
Use the bundled readnoise library instead of depending
on a system readline or editline.
--readline-cflags=...
Manually specify the required cflags for using the desired readline compatible library.
--readline-ldflags=...
Manually specify the required ldflags for linking the desired readline compatible library.
EOF
exit 1
}
WITH_MANUAL_JANET="n"
JANET_HEADER_CFLAGS=""
WITH_PKGCONFIG_READLINE="y"
WITH_PKGCONFIG_LIBEDIT="n"
WITH_READNOISE="n"
WITH_MANUAL_READLINE="n"
READLINE_CFLAGS=""
READLINE_LDFLAGS=""
prefix="/usr"
CC="${CC:-cc}"
CFLAGS="${CFLAGS:--Wall -Wfatal-errors -O2}"
LDFLAGS="${LDFLAGS:-}"
for arg ; do
case "$arg" in
--prefix=*) prefix=${arg#*=} ;;
--janet-header-cflags=*)
WITH_MANUAL_JANET="y"
JANET_HEADER_CFLAGS=${arg#*=} ;;
--readline-cflags=*)
WITH_MANUAL_READLINE="y"
READLINE_CFLAGS=${arg#*=}
;;
--readline-ldflags=*)
WITH_MANUAL_READLINE="y"
READLINE_LDFLAGS=${arg#*=}
;;
--with-pkg-config-readline)
WITH_PKGCONFIG_READLINE="y"
;;
--with-pkg-config-libedit)
WITH_PKGCONFIG_LIBEDIT="y"
;;
--with-readnoise)
WITH_READNOISE="y"
;;
CC=*) CC=${arg#*=} ;;
CFLAGS=*) CFLAGS=${arg#*=} ;;
LDFLAGS=*) LDFLAGS=${arg#*=} ;;
--help) usage ;;
*) fail "unknown option '$arg'"
esac
done
if test "$WITH_MANUAL_JANET" = "y"
then
eecho "using manually specifed janet headers."
else
eecho "using pkg-config to find janet headers."
JANET_HEADER_CFLAGS="$(pkg-config --cflags janet)"
fi
if test WITH_MANUAL_READLINE = "y"
then
eecho "using manually specified readline library."
elif test "$WITH_READNOISE" = "y"
then
eecho "using bundled readnoise."
READLINE_CFLAGS="-I./src/readnoise"
READLINE_LDFLAGS=""
elif test "$WITH_PKGCONFIG_LIBEDIT" = "y"
then
eecho "using pkg-config to find libedit."
READLINE_CFLAGS="$(pkg-config --cflags libedit) -D SHLIB_NO_HISTORY_INCLUDE"
READLINE_LDFLAGS="$(pkg-config --libs libedit)"
elif test "$WITH_PKGCONFIG_READLINE" = "y"
then
eecho "using pkg-config to find readline."
READLINE_CFLAGS="$(pkg-config --cflags readline)"
READLINE_LDFLAGS="$(pkg-config --libs readline)"
else
fail "don't know which line input library to use."
fi
echo "writing config.inc"
cat >config.inc <<EOF
PREFIX="${prefix}"
CC="${CC}"
CFLAGS="${CFLAGS}"
LDFLAGS="${LDFLAGS}"
WITH_MANUAL_JANET="${WITH_MANUAL_JANET}"
JANET_HEADER_CFLAGS="${JANET_HEADER_CFLAGS}"
WITH_PKGCONFIG_READLINE="${WITH_PKGCONFIG_READLINE}"
WITH_PKGCONFIG_LIBEDIT="${WITH_PKGCONFIG_LIBEDIT}"
WITH_READNOISE="${WITH_READNOISE}"
READLINE_CFLAGS="${READLINE_CFLAGS}"
READLINE_LDFLAGS="${READLINE_LDFLAGS}"
EOF
echo "configured with:"
cat config.inc
echo ""
echo configure SUCCESS