forked from angelj-a/axel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·252 lines (224 loc) · 6.02 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#!/bin/sh
###########################
## Configurer for Axel ##
## ##
## Copyright 2001 Lintux ##
###########################
prefix='/usr/local'
bindir='$prefix/bin'
etcdir='$prefix/etc'
sharedir='$prefix/share'
mandir='$sharedir/man'
locale='$sharedir/locale'
i18n=1
debug=0
strip=1
arch=`uname -s`
while [ -n "$1" ]; do
e="`expr "$1" : '--\(.*=.*\)'`"
if [ -z "$e" ]; then
cat<<EOF
Axel configure
Usage: $0 [OPTIONS]
Option Description Default
--prefix=... Directories to put files in $prefix
--bindir=... $bindir
--etcdir=... $etcdir
--mandir=... $mandir
--locale=... $locale
--i18n=0/1 Disable/enable internationalization $i18n
--debug=0/1 Disable/enable debugging $debug
--strip=0/1 Disable/enable binary stripping $strip
EOF
exit;
fi
keyname=`expr "$e" : '\(.*\)=.*' | sed 's/[^a-z0-9_]/_/g'`
value=`expr "$e" : '.*=\(.*\)' | sed "s/'/_/g"`
eval "$keyname='$value'"
shift;
done
# Expand $prefix
bindir=`eval echo $bindir`
etcdir=`eval echo $etcdir`
sharedir=`eval echo $sharedir`
mandir=`eval echo $mandir`
locale=`eval echo $locale`
if test "$etcdir" = "/usr/etc"; then
# FHS explicitely forbids /usr/etc
etcdir='/etc'
fi
cat<<EOF>Makefile.settings
## Axel settings, generated by configure
PREFIX=$prefix
BINDIR=$bindir
ETCDIR=$etcdir
SHAREDIR=$sharedir
MANDIR=$mandir
LOCALE=$locale
OUTFILE=axel
ARCH=$arch
DESTDIR=
EOF
cat<<EOF>config.h
/* Axel settings, generated by configure */
#define _REENTRANT
#define _THREAD_SAFE
#define ETCDIR "$etcdir"
#define LOCALE "$locale"
#define ARCH "$arch"
EOF
AXEL_LFLAGS=${LFLAGS}
if [ "$i18n" = "1" ]; then
if type msgfmt > /dev/null 2> /dev/null; then :;else
echo 'WARNING: Internationalization disabled, you don'\''t have the necessary files'
echo ' installed.'
echo ''
i18n=0;
fi;
echo "all: i18n-mofiles" >> Makefile.settings
echo "install: install-i18n" >> Makefile.settings
echo "uninstall: uninstall-i18n" >> Makefile.settings
fi
AXEL_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os ${CFLAGS}"
if [ "$debug" = "1" ]; then
AXEL_CFLAGS="${AXEL_CFLAGS} -g"
echo 'DEBUG=1' >> Makefile.settings
echo '#define DEBUG' >> config.h;
fi
if [ "$i18n" = "1" ]; then
echo 'I18N=1' >> Makefile.settings
echo '#define I18N' >> config.h
if [ -f /usr/local/include/libintl.h ]; then
AXEL_CFLAGS="${AXEL_CFLAGS} -I/usr/local/include"
AXEL_LFLAGS="${AXEL_LFLAGS} -L/usr/local/lib"
elif [ -f /opt/csw/include/libintl.h ]; then
AXEL_CFLAGS="${AXEL_CFLAGS} -I/opt/csw/include"
AXEL_LFLAGS="${AXEL_LFLAGS} -L/opt/csw/lib"
elif [ -f "${prefix}/include/libintl.h" ]; then
AXEL_CFLAGS="${AXEL_CFLAGS} -I${prefix}/include"
AXEL_LFLAGS="${AXEL_LFLAGS} -L${prefix}/lib"
fi
fi
if [ "${CC}" != "" ]; then
echo "CC=${CC}" >> Makefile.settings;
elif type gcc > /dev/null 2> /dev/null; then
echo "CC=gcc" >> Makefile.settings;
AXEL_CFLAGS="${AXEL_CFLAGS} -Wall"
elif type cc > /dev/null 2> /dev/null; then
echo "CC=cc" >> Makefile.settings;
else
echo 'Cannot find a C compiler, aborting.'
exit 1;
fi
if [ "$strip" = 0 ]; then
echo "STRIP=\# skip strip" >> Makefile.settings;
else
if [ "$debug" = 1 ]; then
echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
echo
echo 'STRIP=\# skip strip' >> Makefile.settings
strip=0;
elif type strip > /dev/null 2> /dev/null; then
echo "STRIP=strip" >> Makefile.settings;
elif [ -x /usr/ccs/bin/strip ]; then
echo "STRIP=/usr/ccs/bin/strip" >> Makefile.settings;
else
echo 'No strip utility found, cannot remove unnecessary parts from executable.'
echo ''
echo 'STRIP=\# skip strip' >> Makefile.settings
strip=0;
fi;
fi
case "$arch" in
FreeBSD )
echo '#define NOGETOPTLONG' >> config.h
AXEL_LFLAGS="${AXEL_LFLAGS} -pthread"
if [ "$i18n" = "1" ]; then
AXEL_LFLAGS="${AXEL_LFLAGS} -lintl"
fi
;;
OpenBSD )
echo '#define NOGETOPTLONG' >> config.h
AXEL_LFLAGS="${AXEL_LFLAGS} -pthread"
if [ "$i18n" = "1" ]; then
AXEL_LFLAGS="${AXEL_LFLAGS} -lintl"
fi
;;
NetBSD )
echo 'WARNING: NetBSD not tested! Using OpenBSD settings.'
echo '#define NOGETOPTLONG' >> config.h
AXEL_LFLAGS="${AXEL_LFLAGS} -pthread"
if [ "$i18n" = "1" ]; then
AXEL_LFLAGS="${AXEL_LFLAGS} -lintl"
fi
;;
Darwin )
echo '#define NOGETOPTLONG' >> config.h
AXEL_LFLAGS="${AXEL_LFLAGS} -pthread"
if [ "$i18n" = "1" ]; then
AXEL_LFLAGS="${AXEL_LFLAGS} -lintl"
fi
echo '#define DARWIN' >> config.h
;;
Linux | GNU/kFreeBSD)
AXEL_LFLAGS="${AXEL_LFLAGS} -pthread"
;;
SunOS )
echo '#define NOGETOPTLONG' >> config.h
echo '#define BSD_COMP' >> config.h
AXEL_LFLAGS="${AXEL_LFLAGS} -pthread -lsocket -lnsl"
if [ "$i18n" = "1" ]; then
AXEL_LFLAGS="${AXEL_LFLAGS} -lintl"
fi
;;
HP-UX )
echo '#define NOGETOPTLONG' >> config.h
if [ "$i18n" = "1" ]; then
if [ -d /usr/local/lib/hpux32 ]; then
AXEL_LFLAGS="${AXEL_LFLAGS} -L/usr/local/lib/hpux32"
fi
AXEL_LFLAGS="${AXEL_LFLAGS} -lintl"
fi
AXEL_LFLAGS="${AXEL_LFLAGS} -lpthread"
;;
CYGWIN_* )
AXEL_LFLAGS="${AXEL_LFLAGS} -pthread"
if [ "$i18n" = "1" ]; then
AXEL_LFLAGS="${AXEL_LFLAGS} -lintl"
fi
echo 'OUTFILE=axel.exe' >> Makefile.settings
;;
* )
AXEL_LFLAGS="${AXEL_LFLAGS} -pthread"
echo '#define NOGETOPTLONG' >> config.h
if [ "$i18n" = "1" ]; then
AXEL_LFLAGS="${AXEL_LFLAGS} -lintl";
fi
echo 'WARNING: This architecture is unknown!'
echo ''
echo 'That does not mean Axel will not work, it just means Axel is not tested on it.'
echo 'It'\''d be a great help if you could send me more information'
echo 'about your platform so that it can be addedto the build tools.'
echo 'You can try to build the program now, if you wish, this default setup might'
echo 'just work.'
echo ''
;;
esac
echo "CFLAGS=${AXEL_CFLAGS}" >> Makefile.settings
echo "LFLAGS=${AXEL_LFLAGS}" >> Makefile.settings
echo 'Configuration done:'
if [ "$i18n" = "1" ]; then
echo ' Internationalization enabled.';
else
echo ' Internationalization disabled.';
fi
if [ "$debug" = "1" ]; then
echo ' Debugging enabled.';
else
echo ' Debugging disabled.';
fi
if [ "$strip" = "1" ]; then
echo ' Binary stripping enabled.';
else
echo ' Binary stripping disabled.';
fi