/[axel]/trunk/configure
ViewVC logotype

Contents of /trunk/configure

Parent Directory Parent Directory | Revision Log Revision Log


Revision 118 - (show annotations) (download)
Wed Jan 6 12:40:49 2010 UTC (3 years, 5 months ago) by phihag-guest
File size: 6167 byte(s)
Add HP-UX, fix Solaris support (Fixes: #312092)
1 #!/bin/sh
2
3 ###########################
4 ## Configurer for Axel ##
5 ## ##
6 ## Copyright 2001 Lintux ##
7 ###########################
8
9 prefix='/usr/local'
10 bindir='$prefix/bin'
11 etcdir='$prefix/etc'
12 sharedir='$prefix/share'
13 mandir='$sharedir/man'
14 locale='$sharedir/locale'
15
16 i18n=1
17 debug=0
18 strip=1
19
20 arch=`uname -s`
21
22 while [ -n "$1" ]; do
23 e="`expr "$1" : '--\(.*=.*\)'`"
24 if [ -z "$e" ]; then
25 cat<<EOF
26 Axel configure
27
28 Usage: $0 [OPTIONS]
29
30 Option Description Default
31
32 --prefix=... Directories to put files in $prefix
33 --bindir=... $bindir
34 --etcdir=... $etcdir
35 --mandir=... $mandir
36 --locale=... $locale
37
38 --i18n=0/1 Disable/enable internationalization $i18n
39 --debug=0/1 Disable/enable debugging $debug
40 --strip=0/1 Disable/enable binary stripping $strip
41 EOF
42 exit;
43 fi
44
45 keyname=`expr "$e" : '\(.*\)=.*' | sed 's/[^a-z0-9_]/_/g'`
46 value=`expr "$e" : '.*=\(.*\)' | sed "s/'/_/g"`
47
48 eval "$keyname='$value'"
49 shift;
50 done
51
52 # Expand $prefix
53 bindir=`eval echo $bindir`
54 etcdir=`eval echo $etcdir`
55 sharedir=`eval echo $sharedir`
56 mandir=`eval echo $mandir`
57 locale=`eval echo $locale`
58 if test "$etcdir" = "/usr/etc"; then
59 # FHS explicitely forbids /usr/etc
60 etcdir='/etc'
61 fi
62
63 cat<<EOF>Makefile.settings
64 ## Axel settings, generated by configure
65 PREFIX=$prefix
66 BINDIR=$bindir
67 ETCDIR=$etcdir
68 SHAREDIR=$sharedir
69 MANDIR=$mandir
70 LOCALE=$locale
71
72 OUTFILE=axel
73 ARCH=$arch
74
75 DESTDIR=
76
77 EOF
78
79 cat<<EOF>config.h
80 /* Axel settings, generated by configure */
81 #define _REENTRANT
82 #define _THREAD_SAFE
83 #define ETCDIR "$etcdir"
84 #define LOCALE "$locale"
85 #define ARCH "$arch"
86
87 EOF
88
89 AXEL_LFLAGS=${LFLAGS}
90
91 if [ "$i18n" = "1" ]; then
92 if type msgfmt > /dev/null 2> /dev/null; then :;else
93 echo 'WARNING: Internationalization disabled, you don'\''t have the necessary files'
94 echo ' installed.'
95 echo ''
96 i18n=0;
97 fi;
98
99 echo "all: i18n-mofiles" >> Makefile.settings
100 echo "install: install-i18n" >> Makefile.settings
101 echo "uninstall: uninstall-i18n" >> Makefile.settings
102 fi
103
104 AXEL_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os ${CFLAGS}"
105 if [ "$debug" = "1" ]; then
106 AXEL_CFLAGS="${AXEL_CFLAGS} -g"
107 echo 'DEBUG=1' >> Makefile.settings
108 echo '#define DEBUG' >> config.h;
109 fi
110
111 if [ "$i18n" = "1" ]; then
112 echo 'I18N=1' >> Makefile.settings
113 echo '#define I18N' >> config.h
114 if [ -f /usr/local/include/libintl.h ]; then
115 AXEL_CFLAGS="${AXEL_CFLAGS} -I/usr/local/include"
116 AXEL_LFLAGS="${AXEL_LFLAGS} -L/usr/local/lib"
117 elif [ -f /opt/csw/include/libintl.h ]; then
118 AXEL_CFLAGS="${AXEL_CFLAGS} -I/opt/csw/include"
119 AXEL_LFLAGS="${AXEL_LFLAGS} -L/opt/csw/lib"
120 elif [ -f "${prefix}/include/libintl.h" ]; then
121 AXEL_CFLAGS="${AXEL_CFLAGS} -I${prefix}/include"
122 AXEL_LFLAGS="${AXEL_LFLAGS} -L${prefix}/lib"
123 fi
124 fi
125
126 if [ "${CC}" != "" ]; then
127 echo "CC=${CC}" >> Makefile.settings;
128 elif type gcc > /dev/null 2> /dev/null; then
129 echo "CC=gcc" >> Makefile.settings;
130 AXEL_CFLAGS="${AXEL_CFLAGS} -Wall"
131 elif type cc > /dev/null 2> /dev/null; then
132 echo "CC=cc" >> Makefile.settings;
133 else
134 echo 'Cannot find a C compiler, aborting.'
135 exit 1;
136 fi
137
138 if [ "$strip" = 0 ]; then
139 echo "STRIP=\# skip strip" >> Makefile.settings;
140 else
141 if [ "$debug" = 1 ]; then
142 echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
143 echo
144 echo 'STRIP=\# skip strip' >> Makefile.settings
145 strip=0;
146 elif type strip > /dev/null 2> /dev/null; then
147 echo "STRIP=strip" >> Makefile.settings;
148 elif [ -x /usr/ccs/bin/strip ]; then
149 echo "STRIP=/usr/ccs/bin/strip" >> Makefile.settings;
150 else
151 echo 'No strip utility found, cannot remove unnecessary parts from executable.'
152 echo ''
153 echo 'STRIP=\# skip strip' >> Makefile.settings
154 strip=0;
155 fi;
156 fi
157
158 case "$arch" in
159 FreeBSD )
160 echo '#define NOGETOPTLONG' >> config.h
161 AXEL_LFLAGS="${AXEL_LFLAGS} -pthread"
162 if [ "$i18n" = "1" ]; then
163 AXEL_LFLAGS="${AXEL_LFLAGS} -lintl"
164 fi
165 ;;
166 OpenBSD )
167 echo '#define NOGETOPTLONG' >> config.h
168 AXEL_LFLAGS="${AXEL_LFLAGS} -pthread"
169 if [ "$i18n" = "1" ]; then
170 AXEL_LFLAGS="${AXEL_LFLAGS} -lintl"
171 fi
172 ;;
173 NetBSD )
174 echo 'WARNING: NetBSD not tested! Using OpenBSD settings.'
175 echo '#define NOGETOPTLONG' >> config.h
176 AXEL_LFLAGS="${AXEL_LFLAGS} -pthread"
177 if [ "$i18n" = "1" ]; then
178 AXEL_LFLAGS="${AXEL_LFLAGS} -lintl"
179 fi
180 ;;
181 Darwin )
182 echo '#define NOGETOPTLONG' >> config.h
183 AXEL_LFLAGS="${AXEL_LFLAGS} -pthread"
184 if [ "$i18n" = "1" ]; then
185 AXEL_LFLAGS="${AXEL_LFLAGS} -lintl"
186 fi
187 echo '#define DARWIN' >> config.h
188 ;;
189 Linux | GNU/kFreeBSD)
190 AXEL_LFLAGS="${AXEL_LFLAGS} -pthread"
191 ;;
192 SunOS )
193 echo '#define NOGETOPTLONG' >> config.h
194 echo '#define BSD_COMP' >> config.h
195 AXEL_LFLAGS="${AXEL_LFLAGS} -pthread -lsocket -lnsl"
196 if [ "$i18n" = "1" ]; then
197 AXEL_LFLAGS="${AXEL_LFLAGS} -lintl"
198 fi
199 ;;
200 HP-UX )
201 echo '#define NOGETOPTLONG' >> config.h
202 AXEL_LFLAGS="${AXEL_LFLAGS} -lpthread"
203 if [ "$i18n" = "1" ]; then
204 AXEL_LFLAGS="${AXEL_LFLAGS} -lintl"
205
206 if [ -d /usr/local/lib/hpux32 ]; then
207 AXEL_LFLAGS="${AXEL_LFLAGS} -L/usr/local/lib/hpux32"
208 fi
209 fi
210 ;;
211 CYGWIN_* )
212 AXEL_LFLAGS="${AXEL_LFLAGS} -pthread"
213 if [ "$i18n" = "1" ]; then
214 AXEL_LFLAGS="${AXEL_LFLAGS} -lintl"
215 fi
216 echo 'OUTFILE=axel.exe' >> Makefile.settings
217 ;;
218 * )
219 AXEL_LFLAGS="${AXEL_LFLAGS} -pthread"
220 echo '#define NOGETOPTLONG' >> config.h
221 if [ "$i18n" = "1" ]; then
222 AXEL_LFLAGS="${AXEL_LFLAGS} -lintl";
223 fi
224 echo 'WARNING: This architecture is unknown!'
225 echo ''
226 echo 'That does not mean Axel will not work, it just means Axel is not tested on it.'
227 echo 'It'\''d be a great help if you could send me more information'
228 echo 'about your platform so that it can be addedto the build tools.'
229 echo 'You can try to build the program now, if you wish, this default setup might'
230 echo 'just work.'
231 echo ''
232 ;;
233 esac
234
235 echo "CFLAGS=${AXEL_CFLAGS}" >> Makefile.settings
236 echo "LFLAGS=${AXEL_LFLAGS}" >> Makefile.settings
237
238 echo 'Configuration done:'
239 if [ "$i18n" = "1" ]; then
240 echo ' Internationalization enabled.';
241 else
242 echo ' Internationalization disabled.';
243 fi
244 if [ "$debug" = "1" ]; then
245 echo ' Debugging enabled.';
246 else
247 echo ' Debugging disabled.';
248 fi
249 if [ "$strip" = "1" ]; then
250 echo ' Binary stripping enabled.';
251 else
252 echo ' Binary stripping disabled.';
253 fi

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5