-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·61 lines (54 loc) · 1.28 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
#!/bin/sh
# Usage: ./configure [install prefix]
check_pkg() {
PKG=$1
echo "pkg-config ${PKG}"
pkg-config $PKG
RET=$?
if [ "${RET}" -eq 127 ] ; then
echo "You need to have pkg-config."
exit 1
elif [ "${RET}" -ne 0 ] ; then
echo "You need to have '${PKG}' package installed."
if [ "${PKG_CONFIG_PATH}" != "" ] ; then
echo "PKG_CONFIG_PATH=${PKG_CONFIG_PATH}"
else
echo "Note: PKG_CONFIG_PATH is not set."
fi
exit 1
fi
}
prefix=/usr/local
if [ "$#" -eq 1 ] ; then prefix=$1 ; fi
echo "prefix=${prefix}"
SYSTEM_CFLAGS=
case $(uname) in
Linux )
SYSTEM_CFLAGS=-D_POSIX_C_SOURCE=200809L
SYSTEM_LDFLAGS=
;;
OpenBSD )
SYSTEM_CFLAGS=
SYSTEM_LDFLAGS=
;;
esac
echo "system: $(uname)"
echo "SYSTEM_CFLAGS=" ${SYSTEM_CFLAGS}
PKGS="x11"
for a in ${PKGS} ; do
check_pkg $a
done
PKGS_CFLAGS=$(pkg-config ${PKGS} --cflags)
PKGS_LDFLAGS=$(pkg-config ${PKGS} --libs)
echo "PKGS_CFLAGS=${PKGS_CFLAGS}"
echo "PKGS_LDFLAGS=${PKGS_LDFLAGS}"
echo "create: Makefile"
echo '# Automatically generated from Makefile.in by configure' >Makefile
echo >>Makefile
sed \
-e "s|@prefix@|${prefix}|g" \
-e "s|@PKGS_CFLAGS@|${PKGS_CFLAGS}|g" \
-e "s|@PKGS_LDFLAGS@|${PKGS_LDFLAGS}|g" \
-e "s|@SYSTEM_CFLAGS@|${SYSTEM_CFLAGS}|g" \
-e "s|@SYSTEM_LDFLAGS@|${SYSTEM_LDFLAGS}|g" \
Makefile.in >>Makefile