-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·91 lines (85 loc) · 2.4 KB
/
Copy pathconfigure
File metadata and controls
executable file
·91 lines (85 loc) · 2.4 KB
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
#!/bin/sh
# Hand-rolled configure — no autotools by design (see README).
#
# Recognized options:
# --with-tcl=DIR directory containing tclConfig.sh
# --host=TRIPLE cross prefix for cc/ar/ranlib (e.g. x86_64-w64-mingw32)
# Anything else (--disable-shared, --prefix, ...) is accepted and
# ignored: the static library is always built; the shared library only
# on native builds (SHARED in config.mk).
set -e
TCLDIR=
HOST=
for arg in "$@"; do
case $arg in
--with-tcl=*) TCLDIR=${arg#--with-tcl=} ;;
--host=*) HOST=${arg#--host=} ;;
esac
done
# An empty submodule fails loudly here; otherwise the compiler falls
# through -Ideps/secp256k1/include to the system headers, which may be
# a libsecp256k1 too old for secp256k1_schnorrsig_sign32, and the
# shared-lib link would not even notice the missing symbol.
if [ ! -f "$(dirname "$0")/deps/secp256k1/include/secp256k1.h" ]; then
echo "configure: deps/secp256k1 is empty (libsecp256k1 submodule);" >&2
echo " run: git submodule update --init" >&2
exit 1
fi
if [ -z "$TCLDIR" ]; then
for sh in tclsh9.0 tclsh8.6 tclsh; do
guess=$(echo 'puts [::tcl::pkgconfig get libdir,install]' \
| $sh 2>/dev/null || true)
[ -n "$guess" ] && break
done
for d in "$guess" /usr/local/lib /usr/lib64 /usr/lib \
/usr/lib/tcl9.0 /usr/lib/tcl8.6; do
if [ -n "$d" ] && [ -f "$d/tclConfig.sh" ]; then
TCLDIR=$d
break
fi
done
fi
if [ -z "$TCLDIR" ] || [ ! -f "$TCLDIR/tclConfig.sh" ]; then
echo "configure: tclConfig.sh not found; pass --with-tcl=DIR" >&2
exit 1
fi
. "$TCLDIR/tclConfig.sh"
if [ -n "$HOST" ]; then
CC=${CC:-$HOST-gcc}
AR=${AR:-$HOST-ar}
RANLIB=${RANLIB:-$HOST-ranlib}
else
CC=${CC:-cc}
AR=${AR:-ar}
RANLIB=${RANLIB:-ranlib}
fi
EXTRA_DEFS=
EXTRA_SHLIBS=
SHARED=libnostr.so
TCLSH=
case $HOST in
*mingw*)
# static-consumer macro is mandatory on Windows since
# libsecp256k1 0.4.0; no shared lib on cross builds
EXTRA_DEFS=-DSECP256K1_STATIC
SHARED=
;;
"")
TCLSH="$TCL_EXEC_PREFIX/bin/tclsh$TCL_VERSION"
;;
esac
mkdir -p build/s build/p
here=$(dirname "$0")
cp "$here/Makefile.in" Makefile
cat > config.mk <<EOF
# generated by configure — do not edit
CC = $CC
AR = $AR
RANLIB = $RANLIB
TCL_INCLUDE_SPEC = $TCL_INCLUDE_SPEC
TCL_STUB_LIB_SPEC = $TCL_STUB_LIB_SPEC
EXTRA_DEFS = $EXTRA_DEFS
SHARED = $SHARED
TCLSH = $TCLSH
EOF
echo "configure: wrote config.mk (CC=$CC, tcl=$TCLDIR)"