Mercurial > hg > forks > yadex
annotate configure @ 117:0612954ba99c default tip
Cosmetics.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 06 Oct 2014 16:36:48 +0300 |
parents | 9694eb987bf3 |
children |
rev | line source |
---|---|
0 | 1 #!/bin/sh |
2 # | |
3 # configure - configure script for Yadex | |
4 # AYM 2002-09-15 | |
5 # | |
6 | |
7 # This file is copyright André Majorel 2002-2003. | |
8 # | |
9 # This program is free software; you can redistribute it and/or modify it under | |
10 # the terms of version 2 of the GNU General Public License as published by the | |
11 # Free Software Foundation. | |
12 # | |
13 # This program is distributed in the hope that it will be useful, but WITHOUT | |
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
15 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |
16 # | |
17 # You should have received a copy of the GNU General Public License along with | |
18 # this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |
19 # Place, Suite 330, Boston, MA 02111-1307, USA. | |
20 | |
21 | |
22 set -e | |
23 | |
24 APPNAME=yadex | |
25 VERSION=`cat VERSION` | |
26 | |
27 CC= | |
28 CXX= | |
37
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
29 HAVE_READLINE=auto |
0 | 30 HAVE_GETTIMEOFDAY= |
31 HAVE_NANOSLEEP= | |
32 HAVE_SNPRINTF= | |
33 HAVE_USLEEP= | |
34 INTERFACE=x11 # "bgi" or "x11" | |
35 PLATFORM=unix # "dos" or "unix" | |
36 PREFIX=/usr/local | |
37 | |
38 | |
39 # | |
40 # check - perform a test | |
41 # | |
42 check () { | |
43 cdir=/tmp | |
44 cbasename=${APPNAME}_$$.c | |
45 cout=${APPNAME}_$$.out | |
46 | |
47 printf '%s' "$3" >$cdir/$cbasename | |
48 printf 'checking %s...' "$1" | |
37
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
49 if (cd $cdir && $CC -c $cbasename $4 $5 $6 >$cout 2>&1) |
0 | 50 then |
51 echo " yes" | |
52 eval "$2=1" | |
53 return 0 | |
54 else | |
55 echo " no" | |
56 sed 's/^/> /' $cdir/$cout | |
57 eval "$2=" | |
58 return 1 | |
59 fi | |
60 } | |
61 | |
62 | |
63 # | |
64 # genc - generate config.cc | |
65 # | |
66 genc () { | |
67 pathname=$BUILDDIR/config.cc | |
68 echo generating $pathname | |
69 ( | |
70 set -e | |
71 echo '// DO NOT EDIT -- generated by ./configure' | |
72 echo | |
73 echo '#include "config.h"' | |
74 echo | |
19
16d552a1de9d
Do not use extern in declarations that do not need to be extern.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
75 echo 'const char *yadex_etc_path[] =' |
0 | 76 echo '{' |
77 sed 's/\\/\\\\/g; s/"/\\"/g; s/^.*/ "&",/;' $BUILDDIR/config.etc | |
78 echo ' 0' | |
79 echo '};' | |
80 echo | |
19
16d552a1de9d
Do not use extern in declarations that do not need to be extern.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
81 echo 'const char *yadex_share_path[] =' |
0 | 82 echo '{' |
83 sed 's/\\/\\\\/g; s/"/\\"/g; s/^.*/ "&",/;' $BUILDDIR/config.share | |
84 echo ' 0' | |
85 echo '};' | |
86 echo | |
87 ) >$pathname | |
88 } | |
89 | |
90 | |
91 # | |
92 # genbool - generate a boolean macro definition | |
93 # | |
94 genbool () { | |
95 name=$1 | |
96 if [ -n "`eval echo \\$HAVE_"$name"`" ]; then | |
97 echo "#define Y_$name" | |
98 else | |
99 echo "//#define Y_$name" | |
100 fi | |
101 } | |
102 | |
103 | |
104 # | |
105 # genh - generate config.h | |
106 # | |
107 genh () { | |
108 pathname=$BUILDDIR/config.h | |
109 echo generating $pathname | |
110 ( | |
111 set -e | |
112 echo '// DO NOT EDIT -- generated by ./configure' | |
113 echo | |
114 case "$PLATFORM" in | |
115 dos) | |
116 echo '#define Y_DOS' | |
117 echo '//#define Y_UNIX';; | |
118 unix) | |
119 echo '//#define Y_DOS' | |
120 echo '#define Y_UNIX';; | |
121 *) | |
122 echo "configure: bad \$PLATFORM \"$PLATFORM\"" >&2 | |
123 exit 1;; | |
124 esac | |
125 case "$INTERFACE" in | |
126 bgi) | |
127 echo '#define Y_BGI' | |
128 echo '//#define Y_X11';; | |
129 x11) | |
130 echo '//#define Y_BGI' | |
131 echo '#define Y_X11';; | |
132 *) | |
133 echo "configure: bad \$INTERFACE \"$INTERFACE\"" >&2 | |
134 exit 1;; | |
135 esac | |
136 genbool GETTIMEOFDAY | |
137 genbool NANOSLEEP | |
138 genbool SNPRINTF | |
139 genbool USLEEP | |
37
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
140 genbool READLINE |
0 | 141 echo |
142 echo 'extern const char *yadex_etc_path[];' | |
143 echo 'extern const char *yadex_share_path[];' | |
144 echo | |
145 ) >$pathname | |
146 } | |
147 | |
148 | |
149 | |
150 # | |
151 # Parse the command line | |
152 # | |
153 while [ "$#" -ge 1 ] | |
154 do | |
155 case "$1" in | |
156 --help) | |
157 echo "Usage:" | |
158 echo " configure --help" | |
37
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
159 echo " configure [--prefix=path] [--cc=string] [--cxx=string] [--with-readline=path] [--without-readline]" |
0 | 160 exit 0 |
161 ;; | |
162 | |
163 --cc=*) | |
164 CC=`expr "x$1" : 'x--cc=\(.*\)'` | |
165 ;; | |
166 | |
167 --cxx=*) | |
168 CXX=`expr "x$1" : 'x--cxx=\(.*\)'` | |
169 ;; | |
170 | |
171 --prefix=*) | |
172 PREFIX=`expr "x$1" : 'x--prefix=\(.*\)'` | |
173 ;; | |
174 | |
37
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
175 --with-readline=*) |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
176 READLINE_PREFIX=`expr "x$1" : 'x--with-readline=\(.*\)'` |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
177 HAVE_READLINE=yes |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
178 ;; |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
179 |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
180 --without-readline*) |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
181 HAVE_READLINE= |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
182 ;; |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
183 |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
184 |
0 | 185 -*) |
186 echo "configure: bad argument \"$1\"" 1>&2 | |
187 exit 1 | |
188 ;; | |
189 | |
190 *) | |
191 echo "configure: too many arguments" 1>&2 | |
192 exit 1 | |
193 esac | |
194 shift | |
195 done | |
196 | |
197 # | |
198 # Sanity checks | |
199 # | |
200 if expr "x$PREFIX" : x/ >/dev/null | |
201 then | |
202 true | |
203 else | |
204 echo "configure: --prefix: argument is not an absolute path" 1>&2 | |
205 exit 1 | |
206 fi | |
207 | |
208 # Solaris /bin/grep doesn't know about -Fx. | |
209 GREP=/usr/xpg4/bin/grep | |
210 [ -x $GREP ] || GREP=grep | |
211 | |
212 # | |
213 # Look for a C compiler | |
214 # | |
215 # We try "gcc" first as commercial Unixen often have a bundled | |
216 # "cc" command that's useless for our purposes (antiquated KNR | |
217 # compiler or front-end that just hangs waiting for an answer from | |
218 # some licence manager). | |
219 # | |
220 printf "looking for a C compiler..." | |
221 if [ -n "$CC" ] | |
222 then | |
223 printf ' using user-supplied value:' | |
224 else | |
225 CC=gcc | |
226 if type $CC >/dev/null 2>&1 | |
227 then | |
228 : | |
229 else | |
230 CC=c89 | |
231 if type $CC >/dev/null 2>&1 | |
232 then | |
233 : | |
234 else | |
235 CC=cc | |
236 if type $CC >/dev/null 2>&1 | |
237 then | |
238 : | |
239 else | |
240 echo " none" | |
241 echo "error: none of (gcc, c89, cc) work, is your PATH set right?" 1>&2 | |
242 exit 1 | |
243 fi | |
244 fi | |
245 fi | |
246 fi | |
247 echo " $CC" | |
248 | |
249 # | |
250 # Does the C compiler actually work ? | |
251 # | |
252 cdir=/tmp | |
253 cbasename=${APPNAME}_$$.c | |
254 cout=${APPNAME}_$$.out | |
37
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
255 echo -n "checking whether the C compiler works..." |
0 | 256 echo 'int n;' >$cdir/$cbasename |
257 if (cd $cdir && $CC -c $cbasename >$cout 2>&1) | |
258 then | |
259 echo " yes" | |
260 else | |
261 echo " no" | |
262 sed 's/^/> /' $cdir/$cout | |
263 echo "error: looks like the C compiler is not working" 1>&2 | |
264 exit 1 | |
265 fi | |
266 | |
267 # | |
268 # Do we have gettimeofday() ? | |
269 # | |
270 check "for gettimeofday" HAVE_GETTIMEOFDAY ' | |
271 #include <sys/time.h> | |
272 #include <time.h> | |
273 int main (int argc, char *argv[]) | |
274 { | |
275 struct timeval tv; | |
276 struct timezone tz; | |
277 int n = gettimeofday (&tv, &tz); | |
278 return n; | |
279 } | |
280 ' || true | |
281 | |
282 # | |
283 # Do we have nanosleep() ? | |
284 # | |
285 check "for nanosleep" HAVE_NANOSLEEP ' | |
286 #include <time.h> | |
287 int main (int argc, char *argv[]) | |
288 { | |
289 struct timespec ts; | |
290 ts.tv_sec = 1; | |
291 ts.tv_nsec = 1; | |
292 nanosleep (&ts, &ts); | |
293 return 0; | |
294 } | |
295 ' || true | |
296 | |
297 # | |
298 # Do we have snprintf() ? | |
299 # | |
300 check "for snprintf" HAVE_SNPRINTF ' | |
301 #include <stdio.h> | |
302 int main (int argc, char *argv[]) | |
303 { | |
304 char buf[1]; | |
305 int n = snprintf (buf, sizeof buf, "%d", 42); | |
306 return n; | |
307 } | |
308 ' || true | |
309 | |
310 # | |
311 # Do we have usleep() ? | |
312 # | |
313 check "for usleep" HAVE_USLEEP ' | |
314 #include <unistd.h> | |
315 int main (int argc, char *argv[]) | |
316 { | |
317 unsigned long usec = 1; | |
318 usleep (usec); | |
319 return 0; | |
320 } | |
321 ' || true | |
322 | |
323 # | |
37
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
324 # Do we have GNU readline? |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
325 # |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
326 READLINE_FLAGS= |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
327 if [ "x$HAVE_READLINE" = "xauto" -o "x$HAVE_READLINE" = "xyes" ] |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
328 then |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
329 if [ "x$HAVE_READLINE" = "xyes" ] |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
330 then |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
331 READLINE_FLAGS="-I$READLINE_PREFIX/include -L$READLINE_PREFIX/lib" |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
332 fi |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
333 |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
334 check "for readline" HAVE_READLINE ' |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
335 #include <stdio.h> |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
336 #include <readline/readline.h> |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
337 #include <readline/history.h> |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
338 int main (int argc, char *argv[]) |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
339 { |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
340 char* input = readline("test"); |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
341 add_history(input); |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
342 return 0; |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
343 } |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
344 ' -lreadline $OPTS |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
345 fi |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
346 |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
347 if [ "x$HAVE_READLINE" != "x" ] |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
348 then |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
349 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $READLINE_FLAGS -lreadline" |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
350 fi |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
351 |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
352 # |
0 | 353 # Look for a C++ compiler |
354 # | |
355 # We try "g++" first, then "c++", then "cxx". | |
356 # | |
357 printf "looking for a C++ compiler..." | |
358 if [ -n "$CXX" ] | |
359 then | |
360 printf ' using user-supplied value:' | |
361 else | |
362 CXX=g++ | |
363 if type $CXX >/dev/null 2>&1 | |
364 then | |
365 : | |
366 else | |
367 CXX=c++ | |
368 if type $CXX >/dev/null 2>&1 | |
369 then | |
370 : | |
371 else | |
372 CXX=cxx | |
373 if type $CXX >/dev/null 2>&1 | |
374 then | |
375 : | |
376 else | |
377 echo " none" | |
378 echo "error: none of (g++, c++, cxx) work, is your PATH set right?" 1>&2 | |
379 exit 1 | |
380 fi | |
381 fi | |
382 fi | |
383 fi | |
384 echo " $CXX" | |
385 | |
386 # | |
387 # Does the C++ compiler actually work ? | |
388 # | |
389 cdir=/tmp | |
390 cbasename=${APPNAME}_$$.cc | |
391 cout=${APPNAME}_$$.out | |
392 printf "checking whether the C++ compiler works..." | |
393 echo 'int n;' >$cdir/$cbasename | |
394 if (cd $cdir && $CXX -c $cbasename >$cout 2>&1) | |
395 then | |
396 echo " yes" | |
397 else | |
398 echo " no" | |
399 sed 's/^/> /' $cdir/$cout | |
400 echo "error: looks like the C++ compiler is not working" 1>&2 | |
401 exit 1 | |
402 fi | |
403 | |
112
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
404 |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
405 # |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
406 # Does C++ compiler support -std=c++11 ? |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
407 # |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
408 printf "checking whether the C++ compiler supports C++11..." |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
409 cat > $cdir/$cbasename << _EOF_ |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
410 #include <memory> |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
411 int main(int argc, char *argv[]) |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
412 { |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
413 std::shared_ptr<int> sp(new int(5)); |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
414 (void) argc; |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
415 (void) argv; |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
416 return 0; |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
417 } |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
418 _EOF_ |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
419 if (cd $cdir && $CXX -std=c++11 -c $cbasename >$cout 2>&1) |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
420 then |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
421 echo " yes" |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
422 else |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
423 echo " no" |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
424 sed 's/^/> /' $cdir/$cout |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
425 echo "error: looks like the C++ compiler does not support C++11" 1>&2 |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
426 exit 1 |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
427 fi |
9694eb987bf3
Add check int configure for C++11 support.
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
428 |
0 | 429 # |
430 # Create the directory where the build-specific files go | |
431 # | |
432 SYSTEM_RAW="`uname -n`_`uname -a | cksum`" | |
433 SYSTEM="`echo "$SYSTEM_RAW" | tr -dc '[:alnum:]._-'`" | |
434 BUILDDIR=obj/$SYSTEM | |
435 echo "build directory is $BUILDDIR" | |
436 mkdir -p $BUILDDIR | |
437 | |
438 # | |
439 # FHS paths | |
440 # | |
441 if expr "$PREFIX" : '//*usr/*$' >/dev/null | |
442 then | |
443 BINDIR=/usr/bin # FHS-ly correct is /usr/games | |
444 ETCDIR=/etc/$APPNAME/%v | |
445 ETCDIRNV=/etc/$APPNAME | |
446 MANDIR=/usr/share/man | |
447 SHAREDIR=/usr/share/games/$APPNAME/%v | |
448 SHAREDIRNV=/usr/share/games/$APPNAME | |
449 elif expr "$PREFIX" : '//*usr//*local/*$' >/dev/null | |
450 then | |
451 BINDIR=/usr/local/bin # FHS-ly correct is /usr/local/games | |
11
b37408bf0064
Place configuration under /usr/local/etc/* and not /etc if Yadex is installed under /usr/local.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
452 ETCDIR=/usr/local/etc/$APPNAME/%v |
b37408bf0064
Place configuration under /usr/local/etc/* and not /etc if Yadex is installed under /usr/local.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
453 ETCDIRNV=/usr/local/etc/$APPNAME |
0 | 454 MANDIR=/usr/local/man |
455 SHAREDIR=/usr/local/share/games/$APPNAME/%v | |
456 SHAREDIRNV=/usr/local/share/games/$APPNAME | |
457 elif expr "$PREFIX" : '//*opt/*$' >/dev/null | |
458 then | |
459 echo '/opt ? Surely you mean /opt/something, Mr. Feynman !' 1>&2 | |
460 exit 1 | |
461 elif expr "$PREFIX" : '//*opt//*[^/]' >/dev/null | |
462 then | |
463 BINDIR=$PREFIX/bin | |
464 ETCDIR=/etc/opt/`expr "$PREFIX" : '//*opt//*\(.*\)'` | |
465 ETCDIRNV= | |
466 MANDIR=$PREFIX/man | |
467 SHAREDIR=$PREFIX/share | |
468 SHAREDIRNV= | |
469 else # Probably /home/joe/* | |
470 BINDIR=$PREFIX/bin | |
471 ETCDIR=$PREFIX/etc | |
472 ETCDIRNV= | |
473 MANDIR=$PREFIX/man | |
474 SHAREDIR=$PREFIX/share | |
475 SHAREDIRNV= | |
476 fi | |
477 | |
478 # | |
479 # Write Makefile.config | |
480 # | |
481 echo generating $BUILDDIR/Makefile.config | |
482 ( | |
483 echo "# DO NOT EDIT -- generated by ./configure" | |
484 echo | |
485 echo "BINDIR = $BINDIR" | |
486 echo "CC = $CC" | |
487 echo "CXX = $CXX" | |
488 echo "ETCDIR = $ETCDIR" | sed "s/%v/$VERSION/g" | |
489 echo "ETCDIRNV = $ETCDIRNV" | |
490 echo "HAVE_GETTIMEOFDAY = $HAVE_GETTIMEOFDAY" | |
491 echo "HAVE_NANOSLEEP = $HAVE_NANOSLEEP" | |
492 echo "HAVE_SNPRINTF = $HAVE_SNPRINTF" | |
493 echo "HAVE_USLEEP = $HAVE_USLEEP" | |
37
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
494 echo "HAVE_READLINE = $HAVE_READLINE" |
0 | 495 echo "INTERFACE = $INTERFACE" |
496 echo "MANDIR = $MANDIR" | |
497 echo "PLATFORM = $PLATFORM" | |
498 echo "SHAREDIR = $SHAREDIR" | sed "s/%v/$VERSION/g" | |
499 echo "SHAREDIRNV = $SHAREDIRNV" | |
37
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
500 echo "EXTRA_CFLAGS = $EXTRA_CFLAGS" |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
501 echo "EXTRA_CXXFLAGS = $EXTRA_CXXFLAGS" |
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
502 echo "EXTRA_LDFLAGS = $EXTRA_LDFLAGS" |
0 | 503 ) >$BUILDDIR/Makefile.config |
504 | |
505 # | |
506 # YGD files search path | |
507 # | |
508 echo generating $BUILDDIR/config.share | |
509 $GREP -Fvx '' <<EOF >"$BUILDDIR/config.share" | |
510 . | |
511 ~/.$APPNAME/%v | |
512 ~/.$APPNAME | |
513 $SHAREDIR | |
514 $SHAREDIRNV | |
515 EOF | |
516 | |
517 # | |
518 # Config files search path | |
519 # | |
520 echo generating $BUILDDIR/config.etc | |
521 $GREP -Fvx '' <<EOF >"$BUILDDIR/config.etc" | |
522 . | |
523 ~/.$APPNAME/%v | |
524 ~/.$APPNAME | |
525 $ETCDIR | |
526 $ETCDIRNV | |
527 EOF | |
528 | |
529 # | |
530 # Write config.h and config.cc | |
531 # | |
532 genc | |
533 genh | |
534 | |
535 exit 0 |