-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure
executable file
·136 lines (114 loc) · 3.36 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
#!/bin/sh
usage() {
cat <<EOF
Usage: ./configure [OPTION]...
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
Fine tuning of the installation directories:
--bindir=DIR user executables [PREFIX/bin]
--sbindir=DIR system admin executables [PREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--datadir=DIR read-only arch.-independent data root [PREFIX/share]
Optional Features:
--enable-debug enable extra debugging [no]
--enable-tests enable test programs [no]
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
EOF
}
for opt; do
optarg=$(expr "$opt" : '[^=]*=\(.*\)')
case "$opt" in
--help) usage ;;
--prefix=*) prefix=$optarg;;
--exec-prefix=*) eprefix=$optarg;;
--bindir=*) bindir=$optarg;;
--sbindir=*) sbindir=$optarg;;
--libexec=*) libexec=$optarg;;
--sysconfdir=*) sysconfdir=$optarg;;
--localstatedir=*) localstatedir=$optarg;;
--datadir=*) datadir=$optarg;;
--build=*) build=$optarg;;
--host=*) host=$optarg;;
--target=*) target=$optarg;;
--enable-debug) enable_debug=yes;;
--enable-tests) enable_tests=yes;;
-* ) echo "$0: unknown option $arg";;
esac
done
: ${prefix:=/usr/local}
: ${eprefix:=${prefix}}
: ${bindir:=${prefix}/bin}
: ${sbindir:=${prefix}/sbin}
: ${libexecdir:=${eprefix}/libexec}
: ${sysconfdir:=${prefix}/etc}
: ${localstatedir:=${prefix}/var}
: ${datadir:=${prefix}/share}
if [ -z "${build}" ]; then
build=$(uname -m)-unknown-$(uname -s | tr '[:upper:]' '[:lower:]')
fi
if [ -z "${host}" ]; then
[ -z "${target}" ] && target=${build}
host=${target}
fi
if [ -z "${target}" ]; then
[ -z "${host}" ] && host=${build}
target=${host}
fi
if [ -z "$CC" ]; then
printf "Looking for compiler ... "
for b in ${target}- ""; do
for cc in gcc pcc icc cc lang; do
if type $b$cc > /dev/null 2>&1; then
CC=$b$cc
echo "$CC"
break
fi
done
[ -n "$CC" ] && break
done
if [ -z "$CC" ]; then
echo
echo "no suitable compiler found" >&2
exit 1
fi
else
echo "using compiler $CC"
fi
version=$(cat VERSION)
cat <<EOF >config.h
/*
* Generated file. DO NOT EDIT!
*/
#define PACKAGE_NAME "lubi"
#define PACKAGE_VERSION "${version}"
EOF
cat <<EOF >config.mk
#
# Generated file. DO NOT EDIT!
#
VERSION = ${version}
PREFIX ?= ${prefix}
EPREFIX ?= ${eprefix}
BINDIR ?= ${bindir}
SBINDIR ?= ${sbindir}
LIBEXECDIR ?= ${libexecdir}
SYSCONFDIR ?= ${sysconfdir}
LOCALSTATEDIR ?= ${localstatedir}
DATADIR ?= ${datadir}
ENABLE_DEBUG ?= ${enable_debug}
ENABLE_TESTS ?= ${enable_tests}
CFLAGS += ${CFLAGS}
CPPFLAGS += ${CPPFLAGS}
LDFLAGS += ${LDFLAGS}
CC = ${CC}
EOF