-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure
executable file
·156 lines (134 loc) · 4.23 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
150
151
152
153
154
155
#!/bin/sh
#########################################################################
#
# spill - segregated package install logical linker
#
# Copyright (C) Richard P. Curnow 2003, 2004
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
#
# =======================================================================
if [ "x${CC}" = "x" ]; then
MYCC="gcc"
else
MYCC="${CC}"
fi
if [ "x${CFLAGS}" = "x" ]; then
MYCFLAGS="-O2 -Wall -g"
else
MYCFLAGS="${CFLAGS}"
fi
# =======================================================================
# Functions
#{{{ test_cc : basic compiler sanity check
test_cc () {
printf "Testing whether your compiler works : "
cat >docheck.c <<EOF;
#include <stdio.h>
int main (int argc, char **argv)
{
return 0;
}
EOF
${MYCC} ${MYCFLAGS} -o docheck docheck.c >/dev/null 2>&1
if [ $? -eq 0 ]
then
printf "it works\n"
else
printf "it doesn't work\n"
rm -f docheck.c docheck
exit 1
fi
rm -f docheck.c docheck
}
#}}}
#{{{ usage
usage () {
cat <<EOF;
\`configure' configures spill to adapt to many kinds of systems.
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]
By default, \`make install' will install all the files in
\`/usr/local/bin', \`/usr/local/lib' etc. You can specify
an installation prefix other than \`/usr/local' using \`--prefix',
for instance \`--prefix=$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--infodir=DIR info documentation [PREFIX/info]
--mandir=DIR man documentation [PREFIX/man]
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
Use these variables to override the choices made by \`configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to <[email protected]>.
EOF
}
#}}}
# =======================================================================
# Defaults for variables
PREFIX=/usr/local
# Parse options to configure
for option
do
case "$option" in
--prefix=* | --install-prefix=* )
PREFIX=`echo $option | sed -e 's/[^=]*=//;'`
;;
--bindir=* )
BINDIR=`echo $option | sed -e 's/[^=]*=//;'`
;;
--sbindir=* )
SBINDIR=`echo $option | sed -e 's/[^=]*=//;'`
;;
--libdir=* )
LIBDIR=`echo $option | sed -e 's/[^=]*=//;'`
;;
--mandir=* )
MANDIR=`echo $option | sed -e 's/[^=]*=//;'`
;;
-h | --help )
usage
exit 1
;;
esac
done
test_cc
if [ "x" = "x${BINDIR}" ]; then BINDIR=${PREFIX}/bin ; fi
if [ "x" = "x${SBINDIR}" ]; then SBINDIR=${PREFIX}/sbin ; fi
if [ "x" = "x${LIBDIR}" ]; then LIBDIR=${PREFIX}/lib ; fi
if [ "x" = "x${MANDIR}" ]; then MANDIR=${PREFIX}/man ; fi
echo "Generating Makefile"
rm -f Makefile
sed -e "s%@cc@%${MYCC}%; \
s%@cflags@%${MYCFLAGS}%; \
s%@prefix@%${PREFIX}%; \
s%@bindir@%${BINDIR}%; \
s%@sbindir@%${SBINDIR}%; \
s%@libdir@%${LIBDIR}%; \
s%@mandir@%${MANDIR}%; \
" < Makefile.in > Makefile
# =======================================================================
# vim:et:sw=2:ht=2:sts=2:fdm=marker:cms=#%s