1 | #!/bin/sh |
---|
2 | # $Header: /afs/dev.mit.edu/source/repository/third/tiff/configure,v 1.1.1.1 2002-12-26 02:37:26 ghudson Exp $ |
---|
3 | # |
---|
4 | # Tag Image File Format (TIFF) Software |
---|
5 | # |
---|
6 | # Copyright (c) 1988-1997 Sam Leffler |
---|
7 | # Copyright (c) 1991-1997 Silicon Graphics, Inc. |
---|
8 | # |
---|
9 | # Permission to use, copy, modify, distribute, and sell this software and |
---|
10 | # its documentation for any purpose is hereby granted without fee, provided |
---|
11 | # that (i) the above copyright notices and this permission notice appear in |
---|
12 | # all copies of the software and related documentation, and (ii) the names of |
---|
13 | # Sam Leffler and Silicon Graphics may not be used in any advertising or |
---|
14 | # publicity relating to the software without the specific, prior written |
---|
15 | # permission of Sam Leffler and Silicon Graphics. |
---|
16 | # |
---|
17 | # THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, |
---|
18 | # EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY |
---|
19 | # WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. |
---|
20 | # |
---|
21 | # IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR |
---|
22 | # ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, |
---|
23 | # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, |
---|
24 | # WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF |
---|
25 | # LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE |
---|
26 | # OF THIS SOFTWARE. |
---|
27 | # |
---|
28 | |
---|
29 | # Configuration script for the TIFF Software |
---|
30 | |
---|
31 | # |
---|
32 | # Shell script to setup machine-dependent files in |
---|
33 | # preparation for building TIFF source. |
---|
34 | # |
---|
35 | |
---|
36 | POSIXLY_CORRECT=1; export POSIXLY_CORRECT # disable GNU extensions |
---|
37 | |
---|
38 | QUIET=no # suppress messages to tty |
---|
39 | NONINTERACTIVE=no # control prompting of config params |
---|
40 | SITE= # dir where config.site is located |
---|
41 | TARGET= # target system identity |
---|
42 | SRCDIR= # dir where source is located |
---|
43 | |
---|
44 | # |
---|
45 | # Setup general configuration parameters. |
---|
46 | # |
---|
47 | PREFIX=/usr/local # root of installation |
---|
48 | EPREFIX=${PREFIX} |
---|
49 | DIRS_LIBINC= # dirs to search for ancillary includes |
---|
50 | DIR_JPEGLIB= # dir for IJG -ljpeg |
---|
51 | DIR_GZLIB= # dir for zlib -lgz |
---|
52 | DSO=auto # auto-enable DSO support |
---|
53 | LIBCOPTS= # library-specific C-compiler options |
---|
54 | JPEG=no # configure JPEG support |
---|
55 | ZIP=no # configure ZIP/Deflate support |
---|
56 | PORT=auto # enable portability emulations |
---|
57 | HTML=no # install HTML documentation |
---|
58 | LIBGL=auto # auto-enable build of SGI -lgl apps |
---|
59 | LIBIMAGE=auto # auto-enable build of SGI -limage apps |
---|
60 | : ${CC=} # name of C compiler to use |
---|
61 | : ${CCOMPILER=} # full pathname of C compiler |
---|
62 | : ${OPTIMIZER=-O} # Optimization flag |
---|
63 | : ${ENVOPTS=} # CC opts for ANSI C compilation |
---|
64 | : ${MAKE=make} # make to use |
---|
65 | |
---|
66 | # screws up the test of `-f -' |
---|
67 | : ${MAKEFLAGS=} # unset MAKEFLAGS |
---|
68 | RM="rm -f" |
---|
69 | |
---|
70 | # |
---|
71 | # Error diagnostics that should go to the terminal are |
---|
72 | # done with this interface (or cat). |
---|
73 | # |
---|
74 | bitch() |
---|
75 | { |
---|
76 | echo "configure: $@" 1>&2 |
---|
77 | } |
---|
78 | |
---|
79 | # |
---|
80 | # This is the preferred interface for |
---|
81 | # configure to terminate abnormally. |
---|
82 | # |
---|
83 | boom() |
---|
84 | { |
---|
85 | bitch "" |
---|
86 | bitch "Unrecoverable error! Once you've corrected the problem rerun this script." |
---|
87 | kill -1 $$ # use kill so trap handler is called |
---|
88 | } |
---|
89 | |
---|
90 | usage() |
---|
91 | { |
---|
92 | cat<<'EOF' |
---|
93 | Usage: configure [options] [host] |
---|
94 | Options: [defaults in brackets after descriptions] |
---|
95 | --help print this message |
---|
96 | --quiet do not print `Using ...' messages |
---|
97 | --verbose opposite of --quiet |
---|
98 | --noninteractive don't ask any questions |
---|
99 | --version print the version of autoconf that created configure |
---|
100 | --prefix=PREFIX root of installation [PREFIX=/usr/local] |
---|
101 | --exec-prefix=EPREFIX root of installation [EPREFIX=PREFIX] |
---|
102 | --target=TARGET configure for TARGET [TARGET=HOST] |
---|
103 | --srcdir=DIR find the sources in DIR [configure dir or ..] |
---|
104 | --with-PARAM[=ARG] set configuration PARAM [ARG=yes] |
---|
105 | EOF |
---|
106 | } |
---|
107 | |
---|
108 | # |
---|
109 | # Crack command line arguments. We purposely |
---|
110 | # use syntax and options that are compatible |
---|
111 | # with GNU autoconf. |
---|
112 | # |
---|
113 | ac_prev= |
---|
114 | for ac_option |
---|
115 | do |
---|
116 | if [ -n "$ac_prev" ]; then # assign the argument to previous option |
---|
117 | eval "$ac_prev=\$ac_option" |
---|
118 | ac_prev= |
---|
119 | continue |
---|
120 | fi |
---|
121 | case "$ac_option" in # collect optional argument |
---|
122 | -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'`;; |
---|
123 | *) ac_optarg=;; |
---|
124 | esac |
---|
125 | case "$ac_option" in |
---|
126 | -with-*|--with-*) |
---|
127 | ac_with=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` |
---|
128 | # Reject names that are not valid shell variable names. |
---|
129 | if [ -n "`echo $ac_with| sed 's/[-_a-zA-Z0-9]//g'`" ]; then |
---|
130 | bitch "configure: $ac_with: invalid parameter name." |
---|
131 | kill -1 $$ |
---|
132 | fi |
---|
133 | ac_with=`echo $ac_with| sed 's/-/_/g'` |
---|
134 | case "$ac_option" in |
---|
135 | *=*) ;; |
---|
136 | *) ac_optarg=yes;; |
---|
137 | esac |
---|
138 | eval "${ac_with}='$ac_optarg'" |
---|
139 | ;; |
---|
140 | -quiet|--quiet) QUIET=yes;; |
---|
141 | -verbose|--verbose) QUIET=no;; |
---|
142 | -noninteractive|--noninteractive) NONINTERACTIVE=yes;; |
---|
143 | -site|--site) ac_prev=SITE;; |
---|
144 | -site=*|--site=*) SITE="$ac_optarg";; |
---|
145 | -srcdir|--srcdir) ac_prev=SRCDIR;; |
---|
146 | -srcdir=*|--srcdir=*) SRCDIR="$ac_optarg";; |
---|
147 | --exec-prefix) ac_prev=EPREFIX;; |
---|
148 | --exec-prefix=*) EPREFIX="$ac_optarg" ;; |
---|
149 | --prefix) ac_prev=PREFIX;; |
---|
150 | --prefix=*) PREFIX="$ac_optarg"; |
---|
151 | EPREFIX=${PREFIX} ;; |
---|
152 | -target|--target) ac_prev=TARGET;; |
---|
153 | -target=*|--target=*) TARGET="$ac_optarg" ;; |
---|
154 | -version|--version) |
---|
155 | echo "This is TIFF configure $Revision: 1.1.1.1 $" |
---|
156 | exit 0 |
---|
157 | ;; |
---|
158 | -help|--help) usage; exit 0;; |
---|
159 | -*) |
---|
160 | bitch "configure: $ac_option: invalid option; use -help for usage." |
---|
161 | kill -1 $$ |
---|
162 | ;; |
---|
163 | *) |
---|
164 | if [ x"$TARGET" != x ]; then |
---|
165 | bitch "configure: Can only configure for one target at a time." |
---|
166 | kill -1 $$ |
---|
167 | fi |
---|
168 | TARGET="$ac_option" |
---|
169 | ;; |
---|
170 | esac |
---|
171 | done |
---|
172 | |
---|
173 | DIR_BIN=${EPREFIX}/bin # destination for applications |
---|
174 | DIR_LIB=${EPREFIX}/lib # destination for library |
---|
175 | DIR_INC=${PREFIX}/include # destination for include files |
---|
176 | DIR_HTML=${PREFIX}/doc/libtiff # destination for HTML files |
---|
177 | |
---|
178 | if [ -n "$ac_prev" ]; then |
---|
179 | bitch "configure: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" |
---|
180 | kill -1 $$ |
---|
181 | fi |
---|
182 | |
---|
183 | # |
---|
184 | # Locate source directory by looking for the VERSION file. |
---|
185 | # The directory must either be specified through the |
---|
186 | # environment or be located in the current directory or a |
---|
187 | # parent of the current directory. |
---|
188 | # |
---|
189 | test "$SRCDIR" || { |
---|
190 | configure=$0 |
---|
191 | # NB: don't use dirname since it may not exist |
---|
192 | SRCDIR=`echo $configure | sed 's;/[^/][^/]*$;;'` |
---|
193 | if [ @"$SRCDIR" = @"$configure" ]; then |
---|
194 | SRCDIR=. |
---|
195 | fi |
---|
196 | while [ ! -r $SRCDIR/VERSION ]; do |
---|
197 | # strip last directory from pathname |
---|
198 | newdir=`echo $SRCDIR | sed 's;/[^/]*$;;'` |
---|
199 | if [ -z "$newdir" ] || [ "$newdir" = $SRCDIR ]; then |
---|
200 | break; |
---|
201 | fi |
---|
202 | SRCDIR=$newdir |
---|
203 | done |
---|
204 | } |
---|
205 | if [ ! -r $SRCDIR/VERSION ]; then |
---|
206 | bitch "Cannot locate sources in $SRCDIR." |
---|
207 | kill -1 $$ |
---|
208 | fi |
---|
209 | SRCDIR=`echo "$SRCDIR" | sed 's;\([^/]\)/*$;\1;'` |
---|
210 | |
---|
211 | if [ -r ${SRCDIR}/tif_version.c ] ; then |
---|
212 | SRCDIR_IS_LIBTIFF=yes |
---|
213 | PORTDOTH=port.h |
---|
214 | else |
---|
215 | SRCDIR_IS_LIBTIFF=no |
---|
216 | PORTDOTH=libtiff/port.h |
---|
217 | fi |
---|
218 | |
---|
219 | # |
---|
220 | # Descriptor usage: |
---|
221 | # 1: ??? |
---|
222 | # 2: errors that should be seen even if we're in the background. |
---|
223 | # 3: [stdout from test runs] |
---|
224 | # 4: verbose-style messages (Using ...) |
---|
225 | # 5: compiler stderr when running tests |
---|
226 | # |
---|
227 | if [ $QUIET = yes ]; then |
---|
228 | exec 4>/dev/null # chuck messages |
---|
229 | else |
---|
230 | exec 4>&1 # messages got to stdout |
---|
231 | fi |
---|
232 | exec 5>./config.log # compiler messages and the like |
---|
233 | |
---|
234 | capture() |
---|
235 | { |
---|
236 | (eval "set -x; $*") >&5 2>&1 |
---|
237 | return |
---|
238 | } |
---|
239 | captureX() |
---|
240 | { |
---|
241 | (eval "set -x; $*") 2>&5 |
---|
242 | return |
---|
243 | } |
---|
244 | |
---|
245 | date >&5 |
---|
246 | echo Running "$0" with arguments: "$@" >&5 |
---|
247 | |
---|
248 | cat 1>&5 <<'EOF' |
---|
249 | |
---|
250 | This file contains information that is captured from running the configure |
---|
251 | script. Lines that begin with a "+" are command lines echoed by the |
---|
252 | shell. Other lines are the output of commands; usually the contents of |
---|
253 | test case files or the output from compilers. If configure does the |
---|
254 | wrong thing, you can use the information captured here to aid in debugging. |
---|
255 | |
---|
256 | EOF |
---|
257 | |
---|
258 | VERSIONFILE=$SRCDIR/VERSION |
---|
259 | DATE=`date` |
---|
260 | |
---|
261 | eval `cat $VERSIONFILE | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\(.*\)/DIST_MAJOR=\1; DIST_MINOR=\2; DIST_POINT=\3/'` |
---|
262 | VERSION="v${DIST_MAJOR}.${DIST_MINOR}.${DIST_POINT}" |
---|
263 | |
---|
264 | RELEASE=`cat $VERSIONFILE | sed -e 's/[0-9 \.]//g'` |
---|
265 | Note() |
---|
266 | { |
---|
267 | echo "$@" 1>&4 |
---|
268 | } |
---|
269 | |
---|
270 | Note "" |
---|
271 | if [ $SRCDIR_IS_LIBTIFF = yes ] ; then |
---|
272 | Note "Configuring TIFF Software (library only) $VERSION" |
---|
273 | else |
---|
274 | Note "Configuring TIFF Software $VERSION" |
---|
275 | fi |
---|
276 | |
---|
277 | Note "" |
---|
278 | Note "If configure does the wrong thing, check the file config.log for" |
---|
279 | Note "information that may help you understand what went wrong." |
---|
280 | Note "" |
---|
281 | |
---|
282 | # |
---|
283 | # Read site and local configuration parameters. |
---|
284 | # |
---|
285 | if [ -f $SITE/config.site ]; then |
---|
286 | Note "Reading site-wide parameters from $SITE/config.site." |
---|
287 | . $SITE/config.site |
---|
288 | capture . $SITE/config.site |
---|
289 | elif [ -f $SRCDIR/config.site ]; then |
---|
290 | Note "Reading site-wide parameters from $SRCDIR/config.site." |
---|
291 | . $SRCDIR/config.site |
---|
292 | capture . $SRCDIR/config.site |
---|
293 | fi |
---|
294 | if [ -f config.local ]; then |
---|
295 | Note "Reading local parameters from config.local." |
---|
296 | . ./config.local |
---|
297 | capture . ./config.local |
---|
298 | elif [ -f $SRCDIR/config.local ]; then |
---|
299 | Note "Reading local parameters from $SRCDIR/config.local." |
---|
300 | . $SRCDIR/config.local |
---|
301 | capture . $SRCDIR/config.local |
---|
302 | fi |
---|
303 | |
---|
304 | # |
---|
305 | # Emulate old-style settups... |
---|
306 | # |
---|
307 | test -z "${DIR_JPEG-}" || { |
---|
308 | DIRS_LIBINC="${DIRS_LIBINC} ${DIR_JPEG}" |
---|
309 | DIR_JPEGLIB="${DIR_JPEG}" |
---|
310 | } |
---|
311 | test -z "${DIR_LIBGZ-}" || { |
---|
312 | DIRS_LIBINC="${DIRS_LIBINC} ${DIR_LIBGZ}" |
---|
313 | DIR_GZLIB="${DIR_LIBGZ}" |
---|
314 | } |
---|
315 | |
---|
316 | identifyTarget() |
---|
317 | { |
---|
318 | random=`date | awk '{print $4}' | sed -e 's/.*://'` 2>/dev/null |
---|
319 | case "$random" in |
---|
320 | *0) Note "Wow, you've got a $1 system!";; |
---|
321 | *1) Note "Hmm, looks like a $1 system.";; |
---|
322 | *2) Note "Oh no, not another $1 system...";; |
---|
323 | *3) Note "Well I'll be, a $1 system.";; |
---|
324 | *4) Note "Fee, fie, foe, this smells like a $1 system.";; |
---|
325 | *5) Note "Gosh, aren't you lucky to have a $1 system!";; |
---|
326 | *6) Note "YOW!! Did something bad happen or am I on a $1 system?";; |
---|
327 | *7) Note "Do they really still make $1 systems?!";; |
---|
328 | *8) Note "I'm always happy to encounter another $1 system.";; |
---|
329 | *9) Note "Here we are again, this time on a $1 system.";; |
---|
330 | esac |
---|
331 | } |
---|
332 | |
---|
333 | # |
---|
334 | # If no target is specified, try to deduce the system. |
---|
335 | # We use the GNU scripts for guessing and canonicalizing |
---|
336 | # the system identification, if available. |
---|
337 | # |
---|
338 | if [ -z "$TARGET" ]; then |
---|
339 | test -f $SRCDIR/config.guess && TARGET=`sh $SRCDIR/config.guess` 2>/dev/null |
---|
340 | if [ -z "$TARGET" ]; then |
---|
341 | bitch "Sorry, no target specified on the command line and I don't seem" |
---|
342 | bitch "to have the GNU config.guess script that is used to deduce your" |
---|
343 | bitch "system type." |
---|
344 | kill -1 $$ |
---|
345 | fi |
---|
346 | identifyTarget $TARGET |
---|
347 | elif [ -f $SRCDIR/config.sub ]; then |
---|
348 | TARGET=`sh $SRCDIR/config.sub "$TARGET"` |
---|
349 | else |
---|
350 | Note "Warning, I don't seem to have the GNU config.sub script to canonicalize" |
---|
351 | Note "your target specification; this may cause problems later on..." |
---|
352 | fi |
---|
353 | if [ -z "${FILLORDER-}" ]; then |
---|
354 | # |
---|
355 | # Host bit order within a word. |
---|
356 | # |
---|
357 | case $TARGET in |
---|
358 | mips-dec-*) FILLORDER=LSB2MSB;; |
---|
359 | i[345]86-*) FILLORDER=LSB2MSB;; |
---|
360 | *) FILLORDER=MSB2LSB;; |
---|
361 | esac |
---|
362 | fi |
---|
363 | |
---|
364 | # |
---|
365 | # Find the full pathname of a file |
---|
366 | # using the specified test operation. |
---|
367 | # |
---|
368 | findThing() |
---|
369 | { |
---|
370 | t="$1"; app="$2"; path="$3"; |
---|
371 | case "$app" in |
---|
372 | /*) eval "$t" "$app" && { echo "$app"; return; };; |
---|
373 | esac |
---|
374 | (IFS=: |
---|
375 | for i in $path; do |
---|
376 | eval "$t" "$i/$app" && { echo "$i/$app"; return 0; } |
---|
377 | done |
---|
378 | return 1 |
---|
379 | ) |
---|
380 | } |
---|
381 | |
---|
382 | # |
---|
383 | # Find the full pathname of a plain file. |
---|
384 | # |
---|
385 | findFile() |
---|
386 | { |
---|
387 | findThing "test -f" "$1" "$2" |
---|
388 | } |
---|
389 | |
---|
390 | # |
---|
391 | # Find the full pathname of an executable. |
---|
392 | # |
---|
393 | findApp() |
---|
394 | { |
---|
395 | findThing "test -x" $1 $2 |
---|
396 | } |
---|
397 | |
---|
398 | # |
---|
399 | # Find the full pathname of an executable; |
---|
400 | # supply a default if nothing is found. |
---|
401 | # |
---|
402 | findAppDef() |
---|
403 | { |
---|
404 | app=$1; path=$2; def=$3 |
---|
405 | case $app in |
---|
406 | /*) test -x $app && { echo $app; return; };; |
---|
407 | esac |
---|
408 | IFS=: |
---|
409 | for i in $path; do |
---|
410 | test -x $i/$app && { echo $i/$app; return; } |
---|
411 | done |
---|
412 | echo $def |
---|
413 | } |
---|
414 | |
---|
415 | # |
---|
416 | # Find the full pathname of a header file; in search-path $DIRS_LIBINC |
---|
417 | # |
---|
418 | findHeader() |
---|
419 | { |
---|
420 | case "$1" in |
---|
421 | /*) echo "$1"; return ;; |
---|
422 | esac |
---|
423 | for i in ${DIRS_LIBINC} /usr/include; do |
---|
424 | test -r $i/$1 && { |
---|
425 | case "$i" in |
---|
426 | /*) echo "$i/$1"; return ;; |
---|
427 | esac |
---|
428 | if [ $SRCDIR_IS_LIBTIFF = yes ]; then |
---|
429 | echo "$i/$1"; |
---|
430 | else |
---|
431 | echo "../$i/$1"; |
---|
432 | fi |
---|
433 | return; |
---|
434 | } |
---|
435 | done |
---|
436 | } |
---|
437 | |
---|
438 | # |
---|
439 | # Locate a C compiler that satisfies our needs (using assorted heuristics). |
---|
440 | # |
---|
441 | JUNK=" |
---|
442 | a.out |
---|
443 | confsed |
---|
444 | conftestmmap |
---|
445 | confx confy |
---|
446 | confMakefile |
---|
447 | core |
---|
448 | dummy |
---|
449 | dummy.a |
---|
450 | dummy.c |
---|
451 | dummy.o |
---|
452 | foo |
---|
453 | so_locations |
---|
454 | t.c |
---|
455 | t.o |
---|
456 | t |
---|
457 | xMakedepend |
---|
458 | xdefs |
---|
459 | xgnu.c |
---|
460 | xmakeinc |
---|
461 | xport.h |
---|
462 | " |
---|
463 | trap "$RM \$JUNK; exit 1" 1 2 15 |
---|
464 | |
---|
465 | $RM $JUNK |
---|
466 | |
---|
467 | cat>xgnu.c<<EOF |
---|
468 | #ifdef __GNUC__ |
---|
469 | yes; |
---|
470 | #endif |
---|
471 | EOF |
---|
472 | |
---|
473 | # |
---|
474 | # Check if the specified compiler is from GNU |
---|
475 | # |
---|
476 | isGNU() |
---|
477 | { |
---|
478 | capture "cat xgnu.c; ($1 -E xgnu.c 2>&5 | egrep yes)" |
---|
479 | } |
---|
480 | |
---|
481 | # |
---|
482 | # NB: use ANSI C prototype to weed out non-ANSI compilers. |
---|
483 | # |
---|
484 | cat>dummy.c<<EOF |
---|
485 | main(int argc, char* argv) { exit(0); } |
---|
486 | EOF |
---|
487 | |
---|
488 | checkCompiler() |
---|
489 | { |
---|
490 | compiler=$1 |
---|
491 | if isGNU $compiler; then |
---|
492 | ISGCC=yes |
---|
493 | else |
---|
494 | ISGCC=no |
---|
495 | fi |
---|
496 | # |
---|
497 | # Guess special options needed to get an |
---|
498 | # ANSI C compiler and/or similar. Must |
---|
499 | # be combined with above checks so we only |
---|
500 | # select an ANSI C compiler. |
---|
501 | # |
---|
502 | if [ -z "${ENVOPTS-}" ]; then |
---|
503 | case $ISGCC-$TARGET in |
---|
504 | no-*-irix*) C_ANSI="-ansi";; |
---|
505 | no-*-hp*) C_ANSI="-D_HPUX_SOURCE";; |
---|
506 | no-*-apollo-*) C_ANSI="-A nansi";; |
---|
507 | no-*-aix*) C_ANSI="-Dunix -qlanglvl=ansi -qsrcmsg -qmaxmem=8192";; |
---|
508 | *-sco*) C_ANSI="-Dsco";; |
---|
509 | esac |
---|
510 | else |
---|
511 | C_ANSI="$ENVOPTS" |
---|
512 | fi |
---|
513 | $RM dummy dummy.o |
---|
514 | capture $compiler -o dummy ${C_ANSI} dummy.c && { |
---|
515 | CC=$compiler; |
---|
516 | test -z "${CCOMPILER-}" && CCOMPILER=`findApp $compiler $PATH` |
---|
517 | test -z "${ENVOPTS-}" && ENVOPTS="${C_ANSI-}" |
---|
518 | return 0 |
---|
519 | } |
---|
520 | return 1 |
---|
521 | } |
---|
522 | |
---|
523 | CCtested= |
---|
524 | capture cat dummy.c |
---|
525 | if [ -z "${CC-}" ]; then |
---|
526 | CCOMPILER= |
---|
527 | for i in gcc cc ncc dcc xlc c89 gcc2; do |
---|
528 | CCtested="$CCtested $i" |
---|
529 | checkCompiler $i && break |
---|
530 | done |
---|
531 | else |
---|
532 | CCtested="$CCtested $CC" |
---|
533 | checkCompiler $CC |
---|
534 | fi |
---|
535 | if [ -z "$CCOMPILER" ]; then |
---|
536 | cat<<EOF |
---|
537 | |
---|
538 | Cannot locate a working ANSI C compiler. |
---|
539 | |
---|
540 | We attempted to compile the following test program: |
---|
541 | |
---|
542 | ---------------------------------------------------------- |
---|
543 | EOF |
---|
544 | cat dummy.c |
---|
545 | cat<<EOF |
---|
546 | ---------------------------------------------------------- |
---|
547 | |
---|
548 | with these compilers: |
---|
549 | |
---|
550 | $CCtested |
---|
551 | |
---|
552 | but none of them were successful. |
---|
553 | |
---|
554 | If your compiler is in a non-standard location, you can specify its |
---|
555 | location in several ways: |
---|
556 | |
---|
557 | o set the environment variable CC |
---|
558 | o create a config.local or config.site file that includes a |
---|
559 | definition for CC |
---|
560 | o supply it on the command line using -with-CC=<pathname> |
---|
561 | |
---|
562 | If command line options are required for ANSI C compilation, set the |
---|
563 | ENVOPTS parameter to these options in a similar way (either through |
---|
564 | an environment variable or config.local/config.site) and then rerun |
---|
565 | this script. |
---|
566 | EOF |
---|
567 | boom |
---|
568 | fi |
---|
569 | Note "Using $CCOMPILER for a C compiler (use -with-CC=compilername to override)." |
---|
570 | |
---|
571 | test "$ENVOPTS" && { |
---|
572 | Note "Using $ENVOPTS to get the appropriate compilation environment." |
---|
573 | } |
---|
574 | |
---|
575 | if [ ${ISGCC} = yes ] ; then |
---|
576 | GCCversion="`${CCOMPILER} -v 2>&1 | \ |
---|
577 | sed -n -e '/version/s/.* \([0-9]*\)\.\([0-9]*\).\([0-9]*\)/\1.\2.\3/p'`" |
---|
578 | fi |
---|
579 | |
---|
580 | |
---|
581 | CheckForGandO() |
---|
582 | { |
---|
583 | f=$1 |
---|
584 | if test -s $f; then |
---|
585 | capture grep -i \(error\|warning\) $f || return 1 |
---|
586 | fi |
---|
587 | return 0 |
---|
588 | } |
---|
589 | |
---|
590 | if [ -z "${GCOPTS-}" ]; then |
---|
591 | if capture $CCOMPILER $ENVOPTS -g -c dummy.c; then |
---|
592 | Note "Looks like $CCOMPILER supports the -g option." |
---|
593 | # NB: cannot use captureX here 'cuz we lose stderr |
---|
594 | if $CCOMPILER $ENVOPTS -c -g $OPTIMIZER dummy.c >t 2>&1 && CheckForGandO t; then |
---|
595 | GCOPTS="-g" |
---|
596 | else |
---|
597 | Note "... but not together with the $OPTIMIZER option, not using it." |
---|
598 | GCOPTS= |
---|
599 | fi |
---|
600 | else |
---|
601 | GCOPTS= |
---|
602 | fi |
---|
603 | fi |
---|
604 | if [ ! -z "${GCOPTS}" ]; then |
---|
605 | Note "Using \"$GCOPTS\" for C compiler options." |
---|
606 | fi |
---|
607 | |
---|
608 | # |
---|
609 | # Verify that $MAKE is accessible |
---|
610 | # |
---|
611 | PATHMAKE=`findApp ${MAKE} $PATH` |
---|
612 | if [ "$PATHMAKE" ]; then |
---|
613 | Note "Using $PATHMAKE to configure the software." |
---|
614 | (echo 'all:') | ${MAKE} -f - all >/dev/null 2>&5 || { |
---|
615 | cat<<EOF |
---|
616 | |
---|
617 | Something is wrong with "$MAKE" or $MAKE does not accept Makefiles |
---|
618 | from stdin with "-f -". If you have MAKE set in your environment, |
---|
619 | verify it points to the right program you want to" use to build this |
---|
620 | software. Otherwise, verify that you have the make program installed |
---|
621 | somewhere on your system and set the MAKE environment variable to the |
---|
622 | pathname of the program. |
---|
623 | EOF |
---|
624 | boom |
---|
625 | } |
---|
626 | else |
---|
627 | cat<<EOF |
---|
628 | No $MAKE located in the search path. |
---|
629 | |
---|
630 | There was no $MAKE program in the restricted search used by this script |
---|
631 | If $MAKE is in a non-standard location set the MAKE environment variable |
---|
632 | to the pathname of the appropriate program. |
---|
633 | EOF |
---|
634 | boom |
---|
635 | fi |
---|
636 | |
---|
637 | # Find sh (likely /bin/sh or /usr/bin/sh), and put in SCRIPT_SH |
---|
638 | |
---|
639 | test -z "${SCRIPT_SH-}" && SCRIPT_SH=`findAppDef sh $PATH sh` |
---|
640 | |
---|
641 | # |
---|
642 | # Check whether or not $MAKE automatically sets MAKE |
---|
643 | # in the Makefiles. If not, we add an explicit define |
---|
644 | # for places where recursive calls are made. |
---|
645 | # |
---|
646 | if [ -z "${SETMAKE-}" ]; then |
---|
647 | if (sed "s;@SHELL@;$SCRIPT_SH;" <<'EOF' |
---|
648 | SHELL=@SHELL@ |
---|
649 | all: |
---|
650 | @if [ -n "${MAKE}" ] ; then echo "make sets make" ; fi |
---|
651 | EOF |
---|
652 | ) | $MAKE -f - | grep "make sets make" > /dev/null ; then |
---|
653 | SETMAKE= |
---|
654 | else |
---|
655 | Note "Looks like $MAKE does not setup MAKE in Makefiles, will compensate." |
---|
656 | SETMAKE="MAKE = ${MAKE}" |
---|
657 | fi |
---|
658 | fi |
---|
659 | |
---|
660 | test -z "${AR-}" && AR=`findApp ar $PATH` |
---|
661 | if [ -z "$AR" ]; then |
---|
662 | Note "*** Warning, could not locate a suitable ar command; using a default." |
---|
663 | AR=ar |
---|
664 | fi |
---|
665 | test -z "${AROPTS-}" && AROPTS=rc |
---|
666 | test -z "${RANLIB-}" && RANLIB=`findApp ranlib $PATH` |
---|
667 | if [ -z "$RANLIB" ]; then |
---|
668 | Note "Warning, no ranlib, assuming it's not needed." |
---|
669 | RANLIB=":" |
---|
670 | $RM dummy.a |
---|
671 | if $AR rcs dummy.a >/dev/null 2>&1; then |
---|
672 | AROPTS=crs |
---|
673 | Note "Looks like ar has an s option to build symbol tables." |
---|
674 | fi |
---|
675 | fi |
---|
676 | |
---|
677 | # |
---|
678 | # runMake target rules ... |
---|
679 | # |
---|
680 | runMakeX() |
---|
681 | { |
---|
682 | target="$1"; shift |
---|
683 | $RM $target |
---|
684 | (echo SRCDIR=. |
---|
685 | for i in "$@"; do |
---|
686 | echo "$i"; |
---|
687 | done |
---|
688 | )>confMakefile |
---|
689 | captureX ${MAKE} -f confMakefile $target |
---|
690 | return |
---|
691 | } |
---|
692 | runMake() |
---|
693 | { |
---|
694 | runMakeX "$@" >&5 |
---|
695 | return |
---|
696 | } |
---|
697 | |
---|
698 | # |
---|
699 | # Look for a library using a known (unique) function. |
---|
700 | # |
---|
701 | CheckForLibrary() |
---|
702 | { |
---|
703 | f=$1; shift |
---|
704 | libs="$@"; |
---|
705 | cat>t.c<<EOF |
---|
706 | int t() { $f(); return 0; } |
---|
707 | int main(){ t(); return 0; } |
---|
708 | EOF |
---|
709 | runMake t "t:; ${CCOMPILER} ${ENVOPTS} t.c $libs" |
---|
710 | } |
---|
711 | |
---|
712 | # |
---|
713 | # Look for an include file. |
---|
714 | # |
---|
715 | CheckForIncludeFile() |
---|
716 | { |
---|
717 | (for i do |
---|
718 | echo "#include \"$i\"" |
---|
719 | done)>t.c |
---|
720 | runMake t "t:; ${CCOMPILER} ${ENVOPTS} -E t.c" |
---|
721 | } |
---|
722 | |
---|
723 | # |
---|
724 | # Figure out if certain system-specific interfaces are |
---|
725 | # supported. We craft a port.h file that has external |
---|
726 | # declarations for missing routines that are required by |
---|
727 | # the system and modify defs to reflect which optional |
---|
728 | # interfaces are supported. |
---|
729 | # |
---|
730 | |
---|
731 | EmitCPlusPlusPrologue() |
---|
732 | { |
---|
733 | echo '/*' |
---|
734 | echo ' * Warning, this file was automatically created by the TIFF configure script' |
---|
735 | echo ' * VERSION: ' $VERSION |
---|
736 | echo ' * RELEASE: ' $RELEASE |
---|
737 | echo ' * DATE: ' $DATE |
---|
738 | echo ' * TARGET: ' $TARGET |
---|
739 | if [ $ISGCC = yes ]; then |
---|
740 | echo ' * CCOMPILER: ' ${CCOMPILER}-${GCCversion} |
---|
741 | else |
---|
742 | echo ' * CCOMPILER: ' $CCOMPILER |
---|
743 | fi |
---|
744 | echo ' */' |
---|
745 | echo "#ifndef $1" |
---|
746 | echo "#define $1 1" |
---|
747 | echo '#ifdef __cplusplus' |
---|
748 | echo 'extern "C" {' |
---|
749 | echo '#endif' |
---|
750 | } |
---|
751 | |
---|
752 | EmitCPlusPlusEpilogue() |
---|
753 | { |
---|
754 | echo '#ifdef __cplusplus' |
---|
755 | echo '}' |
---|
756 | echo '#endif' |
---|
757 | echo '#endif' |
---|
758 | } |
---|
759 | |
---|
760 | # |
---|
761 | # Look for a function in one of the standard libraries |
---|
762 | # or one of the machine-dependent libraries selected above. |
---|
763 | # |
---|
764 | CheckForFunc() |
---|
765 | { |
---|
766 | echo "extern int $1(); main(){$1();exit(0);}" >t.c |
---|
767 | runMake t "t:; ${CCOMPILER} ${ENVOPTS} t.c ${MACHDEPLIBS}" |
---|
768 | } |
---|
769 | |
---|
770 | # |
---|
771 | # Verify that we have -lm. Darwin (for instance) does not. Add to |
---|
772 | # MACHDEPLIBS if required. |
---|
773 | # |
---|
774 | |
---|
775 | if [ -z "${MACHDEPLIBS-}" ]; then |
---|
776 | MACHDEPLIBS="" |
---|
777 | if CheckForFunc cos ; then |
---|
778 | echo "Leaving MACHDEPLIBS empty, apparently you don't need -lm." |
---|
779 | else |
---|
780 | MACHDEPLIBS="-lm" |
---|
781 | echo "Defaulting MACHDEPLIBS to -lm." |
---|
782 | fi |
---|
783 | fi |
---|
784 | |
---|
785 | # |
---|
786 | # Look for a function declaration in system include files. |
---|
787 | # |
---|
788 | AddFuncDecl() |
---|
789 | { |
---|
790 | echo "$2"; |
---|
791 | Note "... add function prototype for $1" |
---|
792 | } |
---|
793 | CheckForFuncDecl() |
---|
794 | { |
---|
795 | f=$1; shift |
---|
796 | (for i do |
---|
797 | echo "#include \"$i\"" |
---|
798 | done)>t.c |
---|
799 | capture cat t.c |
---|
800 | runMakeX t "t:; ${CCOMPILER} ${ENVOPTS} -E t.c" |\ |
---|
801 | awk '{while($0~/[,(][ \t]*$/){printf"%s",$0;getline}print}' |\ |
---|
802 | grep "$f[ ]*(.*)" >&5 |
---|
803 | return |
---|
804 | } |
---|
805 | CheckFuncDecl() |
---|
806 | { |
---|
807 | f=$1; shift |
---|
808 | decl=$1; shift |
---|
809 | CheckForFuncDecl "$f" "$@" || AddFuncDecl "$f" "$decl" |
---|
810 | } |
---|
811 | |
---|
812 | # |
---|
813 | # Look for a variable declaration in system include files. |
---|
814 | # |
---|
815 | CheckForVarDecl() |
---|
816 | { |
---|
817 | v="$1"; shift |
---|
818 | (for i do |
---|
819 | echo "#include \"$i\"" |
---|
820 | done)>t.c |
---|
821 | capture cat t.c |
---|
822 | runMakeX t "t:; ${CCOMPILER} ${ENVOPTS} -E t.c" | grep "$v" >&5 |
---|
823 | return |
---|
824 | } |
---|
825 | CheckVarDecl() |
---|
826 | { |
---|
827 | v="$1"; shift |
---|
828 | decl="$1"; shift |
---|
829 | CheckForVarDecl "$v" "$@" || \ |
---|
830 | (echo "$decl"; Note "... add declaration $decl") |
---|
831 | } |
---|
832 | |
---|
833 | # |
---|
834 | # Look for a #define in system include files. |
---|
835 | # |
---|
836 | AddDefine() |
---|
837 | { |
---|
838 | echo '#ifndef' $1 |
---|
839 | echo '#define' "$2" |
---|
840 | echo '#endif' |
---|
841 | Note '... add #define for' "$1" |
---|
842 | } |
---|
843 | CheckForDefine() |
---|
844 | { |
---|
845 | def=$1; shift |
---|
846 | (for i do |
---|
847 | echo "#include \"$i\"" |
---|
848 | done |
---|
849 | echo "#ifdef $def" |
---|
850 | echo "FOUND();" |
---|
851 | echo "#endif" |
---|
852 | )>t.c |
---|
853 | capture cat t.c |
---|
854 | runMakeX t "t:; ${CCOMPILER} ${ENVOPTS} -E t.c" | grep FOUND >&5 |
---|
855 | } |
---|
856 | CheckDefine() |
---|
857 | { |
---|
858 | def=$1; shift |
---|
859 | decl=$1; shift |
---|
860 | CheckForDefine "$def" "$@" || AddDefine "$def" "$decl" |
---|
861 | } |
---|
862 | |
---|
863 | CheckForMMAP() |
---|
864 | { |
---|
865 | if CheckForFunc getpagesize; then |
---|
866 | cat>t.c<<'EOF' |
---|
867 | /* this was lifted from GNU autoconf */ |
---|
868 | /* Thanks to Mike Haertel and Jim Avera for this test. */ |
---|
869 | #include <sys/types.h> |
---|
870 | #include <fcntl.h> |
---|
871 | #include <sys/mman.h> |
---|
872 | EOF |
---|
873 | else |
---|
874 | cat>t.c<<'EOF' |
---|
875 | /* this was lifted from GNU autoconf */ |
---|
876 | /* Thanks to Mike Haertel and Jim Avera for this test. */ |
---|
877 | #include <sys/types.h> |
---|
878 | #include <fcntl.h> |
---|
879 | #include <sys/mman.h> |
---|
880 | |
---|
881 | #ifdef BSD |
---|
882 | # ifndef BSD4_1 |
---|
883 | # define HAVE_GETPAGESIZE |
---|
884 | # endif |
---|
885 | #endif |
---|
886 | |
---|
887 | #ifndef HAVE_GETPAGESIZE |
---|
888 | # include <sys/param.h> |
---|
889 | # ifdef EXEC_PAGESIZE |
---|
890 | # define getpagesize() EXEC_PAGESIZE |
---|
891 | # else |
---|
892 | # ifdef NBPG |
---|
893 | # define getpagesize() NBPG * CLSIZE |
---|
894 | # ifndef CLSIZE |
---|
895 | # define CLSIZE 1 |
---|
896 | # endif |
---|
897 | # else |
---|
898 | # ifdef NBPC |
---|
899 | # define getpagesize() NBPC |
---|
900 | # else |
---|
901 | # define getpagesize() PAGESIZE /* SVR4 */ |
---|
902 | # endif |
---|
903 | # endif |
---|
904 | # endif |
---|
905 | #endif |
---|
906 | EOF |
---|
907 | fi |
---|
908 | cat>>t.c<<'EOF' |
---|
909 | #if defined(__osf__) || defined(_AIX) |
---|
910 | # define valloc malloc |
---|
911 | #endif |
---|
912 | char *valloc(), *malloc(); |
---|
913 | |
---|
914 | int |
---|
915 | main() |
---|
916 | { |
---|
917 | char *buf1, *buf2, *buf3; |
---|
918 | int i = getpagesize(), j; |
---|
919 | int i2 = getpagesize()*2; |
---|
920 | int fd; |
---|
921 | |
---|
922 | buf1 = (char *)valloc(i2); |
---|
923 | buf3 = (char *)malloc(i2); |
---|
924 | for (j = 0; j < i2; ++j) |
---|
925 | *(buf1 + j) = rand(); |
---|
926 | fd = open("conftestmmap", O_CREAT | O_RDWR, 0666); |
---|
927 | write(fd, buf1, i2); |
---|
928 | buf2 = mmap(0, i, PROT_READ|PROT_WRITE, MAP_VARIABLE|MAP_PRIVATE, fd, 0); |
---|
929 | for (j = 0; j < i; ++j) |
---|
930 | if (*(buf1 + j) != *(buf2 + j)) |
---|
931 | exit(1); |
---|
932 | lseek(fd, (long)i, 0); |
---|
933 | read(fd, buf2, i); /* read into mapped memory -- file should not change */ |
---|
934 | /* (it does in i386 SVR4.0 - Jim Avera, jima@netcom.com) */ |
---|
935 | lseek(fd, (long)0, 0); |
---|
936 | read(fd, buf3, i2); |
---|
937 | for (j = 0; j < i2; ++j) |
---|
938 | if (*(buf1 + j) != *(buf3 + j)) |
---|
939 | exit(1); |
---|
940 | exit(0); |
---|
941 | } |
---|
942 | EOF |
---|
943 | capture cat t.c |
---|
944 | runMake t "t:; ${CCOMPILER} ${ENVOPTS} t.c ${MACHDEPLIBS}" && ./a.out |
---|
945 | } |
---|
946 | |
---|
947 | CheckForBigEndian() |
---|
948 | { |
---|
949 | echo 'main() { int one = 1; char* cp = (char*)&one; exit(*cp!=0); }'>t.c |
---|
950 | capture cat t.c |
---|
951 | runMake t "t:; ${CCOMPILER} ${ENVOPTS} t.c" && ./a.out |
---|
952 | } |
---|
953 | |
---|
954 | # |
---|
955 | # Check an existing port.h to see if it was created |
---|
956 | # for the target and compiler we are using. |
---|
957 | # |
---|
958 | CheckPortDotH() |
---|
959 | { |
---|
960 | getConfigTag() |
---|
961 | { |
---|
962 | param=`grep "$1:" $2 | sed -e 's/.*:[ ]*\([^ ]*\).*/\1/'` |
---|
963 | } |
---|
964 | getConfigTag TARGET $PORTDOTH; target="$param" |
---|
965 | getConfigTag CCOMPILER $PORTDOTH; ccompiler="$param" |
---|
966 | CCOMP=$CCOMPILER |
---|
967 | if [ $ISGCC = yes ]; then |
---|
968 | CCOMP="${CCOMP}-${GCCversion}" |
---|
969 | fi |
---|
970 | test "$target" = "$TARGET" && test "$ccompiler" = "$CCOMP" |
---|
971 | } |
---|
972 | |
---|
973 | # |
---|
974 | # Built port.h based on the system and compiler setup. |
---|
975 | # |
---|
976 | BuildPortDotH() |
---|
977 | { |
---|
978 | Note "" |
---|
979 | Note "Creating $PORTDOTH with necessary definitions." |
---|
980 | |
---|
981 | (EmitCPlusPlusPrologue _PORT_ |
---|
982 | |
---|
983 | CheckForIncludeFile sys/types.h && echo '#include <sys/types.h>' |
---|
984 | CheckVarDecl off_t 'typedef long off_t;' sys/types.h stdlib.h |
---|
985 | CheckVarDecl size_t 'typedef unsigned size_t;' sys/types.h stdlib.h |
---|
986 | CheckVarDecl u_char 'typedef unsigned char u_char;' sys/types.h |
---|
987 | CheckVarDecl u_short 'typedef unsigned short u_short;' sys/types.h |
---|
988 | CheckVarDecl u_int 'typedef unsigned int u_int;' sys/types.h |
---|
989 | CheckVarDecl u_long 'typedef unsigned long u_long;' sys/types.h |
---|
990 | |
---|
991 | echo "#define HOST_FILLORDER FILLORDER_${FILLORDER}" |
---|
992 | CPU=`echo $TARGET | sed 's/-.*//'` |
---|
993 | Note "... using $FILLORDER bit order for your $CPU cpu" |
---|
994 | if CheckForBigEndian; then |
---|
995 | echo "#define HOST_BIGENDIAN 1" |
---|
996 | Note "... using big-endian byte order for your $CPU cpu" |
---|
997 | else |
---|
998 | echo "#define HOST_BIGENDIAN 0" |
---|
999 | Note "... using little-endian byte order for your $CPU cpu" |
---|
1000 | fi |
---|
1001 | |
---|
1002 | CheckForMMAP && { |
---|
1003 | echo '#define HAVE_MMAP 1' |
---|
1004 | Note "... configure use of mmap for memory-mapped files" |
---|
1005 | CheckFuncDecl mmap \ |
---|
1006 | 'extern void* mmap(void*, size_t, int, int, int, off_t);' sys/mman.h |
---|
1007 | } |
---|
1008 | |
---|
1009 | CheckForIncludeFile stdio.h && echo '#include <stdio.h>' |
---|
1010 | CheckForIncludeFile unistd.h && echo '#include <unistd.h>' |
---|
1011 | CheckForIncludeFile string.h && echo '#include <string.h>' |
---|
1012 | CheckForIncludeFile stdlib.h && echo '#include <stdlib.h>' |
---|
1013 | if CheckForDefine O_RDONLY fcntl.h; then |
---|
1014 | echo '#include <fcntl.h>' |
---|
1015 | Note "... O_RDONLY is in <fcntl.h>" |
---|
1016 | elif CheckForDefine O_RDONLY sys/file.h; then |
---|
1017 | echo '#include <sys/file.h>' |
---|
1018 | Note "... O_RDONLY is in <sys/file.h>" |
---|
1019 | else |
---|
1020 | AddDefine O_RDONLY "O_RDONLY 0" |
---|
1021 | AddDefine O_WRONLY "O_WRONLY 1" |
---|
1022 | AddDefine O_RDWR "O_RDWR 2" |
---|
1023 | fi |
---|
1024 | |
---|
1025 | echo 'typedef double dblparam_t;' |
---|
1026 | Note "... using double for promoted floating point parameters" |
---|
1027 | |
---|
1028 | if [ -z "${INLINE-}" ]; then |
---|
1029 | if [ $ISGCC = yes ]; then |
---|
1030 | echo '#ifdef __STRICT_ANSI__' |
---|
1031 | echo '#define INLINE __inline__' |
---|
1032 | echo '#else' |
---|
1033 | echo '#define INLINE inline' |
---|
1034 | echo '#endif' |
---|
1035 | Note "... enabling use of inline functions" |
---|
1036 | else |
---|
1037 | echo '#define INLINE' |
---|
1038 | Note "... disabling use of inline functions" |
---|
1039 | fi |
---|
1040 | else |
---|
1041 | echo "#define INLINE $INLINE" |
---|
1042 | Note "... using \"$INLINE\" to control inline function usage" |
---|
1043 | fi |
---|
1044 | |
---|
1045 | echo '#define GLOBALDATA(TYPE,NAME) extern TYPE NAME' |
---|
1046 | |
---|
1047 | CheckFuncDecl memset 'extern void* memset(void*, int, size_t);' string.h |
---|
1048 | CheckFuncDecl floor 'extern double floor(double);' math.h |
---|
1049 | CheckFuncDecl ceil 'extern double ceil(double);' math.h |
---|
1050 | CheckFuncDecl exp 'extern double exp(double);' math.h |
---|
1051 | CheckFuncDecl pow 'extern double pow(double, double);' math.h |
---|
1052 | CheckFuncDecl read 'extern int read(int, const void*, unsigned int);' unistd.h |
---|
1053 | CheckFuncDecl malloc 'extern void* malloc(size_t);' stdlib.h |
---|
1054 | CheckFuncDecl realloc 'extern void* realloc(void*, size_t);' stdlib.h |
---|
1055 | CheckFuncDecl free 'extern void free(void*);' stdlib.h |
---|
1056 | EmitCPlusPlusEpilogue |
---|
1057 | )>xport.h |
---|
1058 | if [ $SRCDIR_IS_LIBTIFF = no -a ! -d libtiff ]; then |
---|
1059 | Note "Creating libtiff directory" |
---|
1060 | mkdir libtiff |
---|
1061 | fi |
---|
1062 | mv xport.h $PORTDOTH; chmod 444 $PORTDOTH |
---|
1063 | Note "Done creating $PORTDOTH." |
---|
1064 | } |
---|
1065 | |
---|
1066 | if [ "$PORT" != no ] && test -f $PORTDOTH && CheckPortDotH; then |
---|
1067 | Note "" |
---|
1068 | Note "Using previously created $PORTDOTH." |
---|
1069 | else |
---|
1070 | $RM xport.h t.c a.out $PORTDOTH |
---|
1071 | BuildPortDotH |
---|
1072 | fi |
---|
1073 | |
---|
1074 | if [ "$PORT" = auto ]; then |
---|
1075 | Note "" |
---|
1076 | Note "Checking system libraries for functionality to emulate." |
---|
1077 | |
---|
1078 | FUNCS=" |
---|
1079 | strcasecmp |
---|
1080 | strtoul |
---|
1081 | getopt |
---|
1082 | " |
---|
1083 | |
---|
1084 | for i in $FUNCS; do |
---|
1085 | CheckForFunc $i || { |
---|
1086 | Note "... emulate $i" |
---|
1087 | PORTFUNCS="${PORTFUNCS-} $i.c" |
---|
1088 | } |
---|
1089 | done |
---|
1090 | if [ "${PORTFUNCS-}" ]; then |
---|
1091 | LIBPORT='../port/libport.a' |
---|
1092 | PORT=yes |
---|
1093 | else |
---|
1094 | PORT=no |
---|
1095 | fi |
---|
1096 | fi |
---|
1097 | if [ $PORT != yes ] ; then |
---|
1098 | LIBPORT= |
---|
1099 | PORTFUNCS= |
---|
1100 | fi |
---|
1101 | Note "Done checking system libraries." |
---|
1102 | |
---|
1103 | Note "" |
---|
1104 | Note "Checking for Dynamic Shared Object (DSO) support." |
---|
1105 | if [ "$DSO" = auto ]; then |
---|
1106 | DSO=no |
---|
1107 | DSOSUF_VERSION= |
---|
1108 | DSOLD='${LD}' |
---|
1109 | TIFFLIBREF= |
---|
1110 | case $TARGET-$CC-$ISGCC in |
---|
1111 | *-irix5.2*) |
---|
1112 | if (findApp rld /lib:/usr/lib:$PATH) >/dev/null 2>&1; then |
---|
1113 | DSOSUF=so |
---|
1114 | DSOOPTS='-elf -shared -no_unresolved -all' |
---|
1115 | DSO=IRIX52 |
---|
1116 | TIFFLIBREF='-L${DEPTH}/libtiff -rpath '${DIR_LIB}' -ltiff' |
---|
1117 | fi |
---|
1118 | ;; |
---|
1119 | *-irix*) |
---|
1120 | if (findApp rld /lib:/usr/lib:$PATH) >/dev/null 2>&1; then |
---|
1121 | DSOSUF=so |
---|
1122 | DSOLD="${CCOMPILER} ${ENVOPTS}" |
---|
1123 | if [ $ISGCC = yes ]; then |
---|
1124 | LIBCOPTS="-fpic" |
---|
1125 | DSOOPTS='-shared -rdata_shared' |
---|
1126 | else |
---|
1127 | LIBCOPTS="-KPIC" |
---|
1128 | DSOOPTS='-shared -rdata_shared -check_registry ${SRCDIR}/port/irix/so_locations -quickstart_info' |
---|
1129 | fi |
---|
1130 | DSO=IRIX |
---|
1131 | TIFFLIBREF='-L${DEPTH}/libtiff -rpath '${DIR_LIB}' -ltiff' |
---|
1132 | fi |
---|
1133 | ;; |
---|
1134 | *-aix*) |
---|
1135 | DSOSUF=a |
---|
1136 | DSOOPTS='-r' |
---|
1137 | LIBCOPTS="-bM\:SRE" |
---|
1138 | DSO=AIX |
---|
1139 | TIFFLIBREF='-L${DEPTH}/libtiff -ltiff' |
---|
1140 | ;; |
---|
1141 | *-hpux*yes) |
---|
1142 | DSOSUF=sl |
---|
1143 | DSOLD=gcc |
---|
1144 | DSOOPTS='-fpic -shared' |
---|
1145 | LIBCOPTS=-fpic |
---|
1146 | DSO=HPUX |
---|
1147 | TIFFLIBREF="-Wl,+s,+b${DIR_LIB}"' -L${DEPTH}/libtiff -ltiff' |
---|
1148 | ;; |
---|
1149 | *-hpux*) |
---|
1150 | DSOSUF=sl |
---|
1151 | DSOSUF_VERSION=${DIST_MAJOR}.${DIST_MINOR}${DIST_POINT} |
---|
1152 | DSOOPTS='-b' |
---|
1153 | LIBCOPTS="+z" |
---|
1154 | DSO=HPUX |
---|
1155 | TIFFLIBREF='-L$(DEPTH)/libtiff -ltiff' |
---|
1156 | ;; |
---|
1157 | *-solaris*) |
---|
1158 | DSOSUF=so |
---|
1159 | DSOOPTS='-G' |
---|
1160 | if [ $ISGCC = yes ]; then |
---|
1161 | LIBCOPTS="-fpic" |
---|
1162 | else |
---|
1163 | LIBCOPTS="-K PIC" |
---|
1164 | fi |
---|
1165 | DSO=SOLARIS |
---|
1166 | TIFFLIBREF='-L${DEPTH}/libtiff -R'${DIR_LIB}' -ltiff' |
---|
1167 | ;; |
---|
1168 | *-netbsd*) |
---|
1169 | DSOSUF=so.${DIST_MAJOR}.0 |
---|
1170 | LIBCOPTS='-fPIC' |
---|
1171 | DSO=NETBSD |
---|
1172 | TIFFLIBREF='-L${DEPTH}/libtiff -ltiff' |
---|
1173 | ;; |
---|
1174 | *-freebsd*) |
---|
1175 | DSOSUF=so.${DIST_MAJOR} |
---|
1176 | DSOSUF_VERSION=${DSOSUF}.${DIST_MINOR}.${DIST_POINT} |
---|
1177 | LIBCOPTS='-fPIC' |
---|
1178 | DSOOPTS='-shared' |
---|
1179 | DSO=GNULD |
---|
1180 | ;; |
---|
1181 | *-openbsd*) |
---|
1182 | DSOSUF=so.${DIST_MAJOR}.${DIST_MINOR} |
---|
1183 | LIBCOPTS='-fpic' |
---|
1184 | TIFFLIBREF='-L${DEPTH}/libtiff -ltiff' |
---|
1185 | case "$TARGET" in |
---|
1186 | *-openbsd[01].* | *-openbsd2.[0-7] | *-openbsd2.[0-7].*) |
---|
1187 | DSO=oldOPENBSD |
---|
1188 | ;; |
---|
1189 | *) |
---|
1190 | DSO=OPENBSD |
---|
1191 | DSOLD="${CCOMPILER} ${ENVOPTS}" |
---|
1192 | DSOOPTS='-shared ${LIBCOPTS}' |
---|
1193 | ;; |
---|
1194 | esac |
---|
1195 | ;; |
---|
1196 | *-darwin*) |
---|
1197 | DSOSUF=${DIST_MAJOR}.dylib |
---|
1198 | DSOSUF_VERSION=${DIST_MAJOR}.${DIST_MINOR}.${DIST_POINT}.dylib |
---|
1199 | LIBCOPTS='-fno-common' |
---|
1200 | DSOLD=gcc |
---|
1201 | DSOOPTS='-dynamiclib -undefined suppress' |
---|
1202 | DSO=DARWIN |
---|
1203 | ;; |
---|
1204 | *-linux*) |
---|
1205 | DSOSUF=so.${DIST_MAJOR} |
---|
1206 | DSOSUF_VERSION=${DSOSUF}.${DIST_MINOR}.${DIST_POINT} |
---|
1207 | LIBCOPTS='-fPIC' |
---|
1208 | DSOOPTS='-shared' |
---|
1209 | DSO=GNULD |
---|
1210 | ;; |
---|
1211 | *-osf3*|*-osf4*) |
---|
1212 | DSOSUF=so |
---|
1213 | DSOOPTS='-shared' |
---|
1214 | DSO=OSF |
---|
1215 | ;; |
---|
1216 | |
---|
1217 | esac |
---|
1218 | fi |
---|
1219 | if [ "$DSO" != no ]; then |
---|
1220 | JUNK="$JUNK t.${DSOSUF}" |
---|
1221 | # |
---|
1222 | # Check to make sure the compilers process |
---|
1223 | # the DSO options in the expected way. |
---|
1224 | # |
---|
1225 | CheckCCDSO() |
---|
1226 | { |
---|
1227 | $RM t.c t.o t.${DSOSUF} |
---|
1228 | cat>t.c<<EOF |
---|
1229 | int f() { return 0; } |
---|
1230 | EOF |
---|
1231 | capture cat t.c |
---|
1232 | runMake t \ |
---|
1233 | "t.o:; ${CCOMPILER} ${ENVOPTS} ${LIBCOPTS} -c t.c" \ |
---|
1234 | "t: t.o; ${DSOLD} ${DSOOPTS} -o t.${DSOSUF} t.o" |
---|
1235 | } |
---|
1236 | if CheckCCDSO; then |
---|
1237 | Note "Looks like your system supports $DSO-style DSOs." |
---|
1238 | else |
---|
1239 | cat 1>&4 <<EOF |
---|
1240 | Looks like your system supports $DSO-style DSOs... |
---|
1241 | ... sigh, but $CCOMPILER does not support DSOs in the expected way. |
---|
1242 | EOF |
---|
1243 | DSO=no |
---|
1244 | fi |
---|
1245 | fi |
---|
1246 | if [ "$DSO" = no ]; then |
---|
1247 | DSOSUF=a DSOOPTS= LIBCOPTS= |
---|
1248 | DSOSUF_VERSION=$DSOSUF |
---|
1249 | fi |
---|
1250 | test -z "$TIFFLIBREF" && TIFFLIBREF="\${DEPTH}/libtiff/libtiff.${DSOSUF}" |
---|
1251 | test -z "$DSOSUF_VERSION" && DSOSUF_VERSION=${DSOSUF} |
---|
1252 | Note "Done checking for DSO support." |
---|
1253 | |
---|
1254 | Note "" |
---|
1255 | if [ "$LIBIMAGE" = auto ]; then |
---|
1256 | if CheckForLibrary iopen -limage && CheckForIncludeFile gl/image.h; then |
---|
1257 | Note "Looks like there is support for SGI RGB images." |
---|
1258 | LIBIMAGE=yes |
---|
1259 | else |
---|
1260 | LIBIMAGE=no |
---|
1261 | fi |
---|
1262 | fi |
---|
1263 | if [ "$LIBGL" = auto ]; then |
---|
1264 | if CheckForLibrary winopen -lgl && CheckForIncludeFile gl.h; then |
---|
1265 | Note "Looks like there is support for IRIS GL." |
---|
1266 | LIBGL=yes |
---|
1267 | else |
---|
1268 | LIBGL=no |
---|
1269 | fi |
---|
1270 | fi |
---|
1271 | |
---|
1272 | test $LIBGL = no -a $LIBIMAGE = no || Note "" |
---|
1273 | Note "Selecting programs used during installation." |
---|
1274 | |
---|
1275 | |
---|
1276 | # |
---|
1277 | # Miscellaneous ``little'' programs. |
---|
1278 | # |
---|
1279 | test -z "${CHMOD-}" && CHMOD=`findAppDef chmod $PATH chmod` |
---|
1280 | test -z "${LN-}" && LN=`findAppDef ln $PATH ln` |
---|
1281 | test -z "${SED-}" && SED=`findAppDef sed $PATH sed` |
---|
1282 | test -z "${STRIP-}" && STRIP=`findAppDef strip $PATH strip` |
---|
1283 | |
---|
1284 | # |
---|
1285 | # Check if mv -f is supported |
---|
1286 | # |
---|
1287 | if [ -z "${MV_F-}" ]; then |
---|
1288 | $RM t.c; echo "">t.c |
---|
1289 | if mv -f t.c t.o; then |
---|
1290 | Note "Looks like mv supports the -f option to force a move." |
---|
1291 | MV_F=-f |
---|
1292 | else |
---|
1293 | Note "Warning, looks like mv has no -f option to force move operations;" |
---|
1294 | Note "... this may cause problems during installation." |
---|
1295 | MV_F= |
---|
1296 | fi |
---|
1297 | fi |
---|
1298 | |
---|
1299 | # |
---|
1300 | # Check if ln -s creates a symbolic link. |
---|
1301 | # |
---|
1302 | if [ -z "${LN_S-}" ]; then |
---|
1303 | $RM t.c; $LN -s foo t.c && LN_S=-s |
---|
1304 | fi |
---|
1305 | if [ -n "$LN_S" ]; then |
---|
1306 | Note "Looks like $LN supports the -s option to create a symbolic link." |
---|
1307 | else |
---|
1308 | Note "Warning, looks like $LN has no -s option to create symbolic links;" |
---|
1309 | Note "... this may cause problems during installation." |
---|
1310 | fi |
---|
1311 | |
---|
1312 | # |
---|
1313 | # Pick install mechanism. |
---|
1314 | # |
---|
1315 | if [ -z "${INSTALL-}" ]; then |
---|
1316 | case $TARGET in |
---|
1317 | *-irix*) INSTALL=`findApp install /sbin:$PATH`;; |
---|
1318 | *) INSTALL='${SCRIPT_SH} ../port/install.sh';; |
---|
1319 | esac |
---|
1320 | fi |
---|
1321 | |
---|
1322 | Note "Done selecting programs." |
---|
1323 | |
---|
1324 | # |
---|
1325 | # User-changable configuration parameters section. |
---|
1326 | # Anything selected here is presented to the user |
---|
1327 | # and may be interactively changed. |
---|
1328 | # |
---|
1329 | |
---|
1330 | Note "" |
---|
1331 | Note "Selecting default TIFF configuration parameters." |
---|
1332 | Note "" |
---|
1333 | |
---|
1334 | # |
---|
1335 | # Fill in any other configuration parameters not |
---|
1336 | # setup in the site and local files. |
---|
1337 | # |
---|
1338 | |
---|
1339 | bitchExecutable() |
---|
1340 | { |
---|
1341 | echo "" |
---|
1342 | echo "Warning, $1 does not seem to be an executable program;" |
---|
1343 | echo "you'll need to correct this before starting up the fax server." |
---|
1344 | echo "" |
---|
1345 | } |
---|
1346 | |
---|
1347 | # |
---|
1348 | # Setup manual page-related stuff. |
---|
1349 | # |
---|
1350 | # Manual pages are processed according to: |
---|
1351 | # 1. Section organization (BSD or System V) |
---|
1352 | # 2. Pre-formatted (w/ nroff) or source. |
---|
1353 | # 3. Compressed (compress, gzip, pack) or uncompressed. |
---|
1354 | # 4. Whether or not the FlexFAX ``F'' suffix must be |
---|
1355 | # stripped for pages to be found (only for 4F pages). |
---|
1356 | # |
---|
1357 | if [ -z "${DIR_MAN-}" ]; then |
---|
1358 | MANPATH=" |
---|
1359 | $MANPATH |
---|
1360 | /usr/local/man |
---|
1361 | /usr/contrib/man |
---|
1362 | /usr/catman/local |
---|
1363 | " |
---|
1364 | DIR_MAN= |
---|
1365 | for i in $MANPATH; do |
---|
1366 | test -d $i && { DIR_MAN=$i; break; } |
---|
1367 | done |
---|
1368 | test -z "$DIR_MAN" && DIR_MAN=${PREFIX}/man |
---|
1369 | fi |
---|
1370 | Note "Looks like manual pages go in $DIR_MAN." |
---|
1371 | if [ -z "${MANSCHEME-}" ]; then |
---|
1372 | case $TARGET in |
---|
1373 | *-bsdi*|*-netbsd*) MANSCHEME=bsd-nroff-gzip-0.gz;; |
---|
1374 | *-freebsd*) MANSCHEME=bsd-source-cat;; |
---|
1375 | *-linux*) MANSCHEME=bsd-source-cat;; |
---|
1376 | *-ultrix*) MANSCHEME=bsd-source-cat;; |
---|
1377 | *-sunos*) MANSCHEME=bsd-source-cat-strip;; |
---|
1378 | *-sysv[234]*) MANSCHEME=sysv-source-cat-strip;; |
---|
1379 | *-hpux*) MANSCHEME=sysv-source-cat;; |
---|
1380 | *-solaris*) MANSCHEME=sysv-source-cat-strip;; |
---|
1381 | *-aix*) MANSCHEME=sysv-source-strip;; |
---|
1382 | *-isc*|*-sco*) MANSCHEME=sysv-source-cat;; |
---|
1383 | *-irix*) MANSCHEME=sysv-nroff-compress-Z;; |
---|
1384 | *) |
---|
1385 | # |
---|
1386 | # Try to deduce the setup from existing manual pages. |
---|
1387 | # XXX needs more work XXX |
---|
1388 | # |
---|
1389 | MANSCHEME=sysv-source-cat |
---|
1390 | if [ -d /usr/share/man ]; then |
---|
1391 | if [ -d /usr/share/man/u_man ]; then |
---|
1392 | MANSCHEME=sysv-source-cat |
---|
1393 | elif [ -d /usr/share/man/man8 ]; then |
---|
1394 | MANSCHEME=bsd-source-cat |
---|
1395 | fi |
---|
1396 | elif [ -d /usr/share/catman ]; then |
---|
1397 | if [ -d /usr/share/catman/u_man ]; then |
---|
1398 | MANSCHEME=sysv-nroff-cat |
---|
1399 | elif [ -d /usr/share/catman/man8 ]; then |
---|
1400 | MANSCHEME=bsd-nroff-cat |
---|
1401 | fi |
---|
1402 | fi |
---|
1403 | ;; |
---|
1404 | esac |
---|
1405 | fi |
---|
1406 | Note "Looks like manual pages should be installed with $MANSCHEME." |
---|
1407 | |
---|
1408 | # |
---|
1409 | # Figure out which brand of echo we have and define |
---|
1410 | # prompt and print shell functions accordingly. |
---|
1411 | # |
---|
1412 | if [ `echo foo\\\c`@ = "foo@" ]; then |
---|
1413 | prompt() |
---|
1414 | { |
---|
1415 | echo "$* \\c" |
---|
1416 | } |
---|
1417 | elif [ "`echo -n foo`@" = "foo@" ]; then |
---|
1418 | prompt() |
---|
1419 | { |
---|
1420 | echo -n "$* " |
---|
1421 | } |
---|
1422 | else |
---|
1423 | prompt() |
---|
1424 | { |
---|
1425 | echo "$*" |
---|
1426 | } |
---|
1427 | fi |
---|
1428 | |
---|
1429 | # |
---|
1430 | # Prompt the user for a string that can not be null. |
---|
1431 | # |
---|
1432 | promptForNonNullStringParameter() |
---|
1433 | { |
---|
1434 | x="" val="$1" desc="$2" |
---|
1435 | while [ -z "$x" ]; do |
---|
1436 | prompt "$desc [$val]?"; read x |
---|
1437 | if [ "$x" ]; then |
---|
1438 | # strip leading and trailing white space |
---|
1439 | x=`echo "$x" | sed -e 's/^[ ]*//' -e 's/[ ]*$//'` |
---|
1440 | else |
---|
1441 | x="$val" |
---|
1442 | fi |
---|
1443 | done |
---|
1444 | param="$x" |
---|
1445 | } |
---|
1446 | |
---|
1447 | promptForManPageScheme() |
---|
1448 | { |
---|
1449 | x="" |
---|
1450 | while [ -z "$x" ]; do |
---|
1451 | prompt "Manual page installation scheme [$MANSCHEME]?"; read x |
---|
1452 | if [ "$x" ]; then |
---|
1453 | # strip leading and trailing white space |
---|
1454 | x=`echo "$x" | sed -e 's/^[ ]*//' -e 's/[ ]*$//'` |
---|
1455 | # XXX do a better job of validating... |
---|
1456 | case "$x" in |
---|
1457 | bsd-nroff-cat*|sysv-nroff-cat*) ;; |
---|
1458 | bsd-nroff-gzip*|sysv-nroff-gzip*) ;; |
---|
1459 | bsd-nroff-comp*|sysv-nroff-comp*) ;; |
---|
1460 | bsd-nroff-pack*|sysv-nroff-pack*) ;; |
---|
1461 | bsd-source-cat*|sysv-source-cat*) ;; |
---|
1462 | bsd-source-gzip*|sysv-source-gzip*) ;; |
---|
1463 | bsd-source-comp*|sysv-source-comp*) ;; |
---|
1464 | bsd-source-pack*|sysv-source-pack*) ;; |
---|
1465 | *) |
---|
1466 | cat <<EOF |
---|
1467 | |
---|
1468 | "$x" is not a valid manual page installation scheme. Schemes are |
---|
1469 | constructed according to: |
---|
1470 | |
---|
1471 | <organization>-<formatting>-<compression>[-<suffix>] |
---|
1472 | |
---|
1473 | where: |
---|
1474 | |
---|
1475 | <organization> is either "bsd" for BSD-style section organization (e.g. |
---|
1476 | file formats in section 5) or "sysv" for System V-style |
---|
1477 | organization (e.g. file formats in section 4). |
---|
1478 | |
---|
1479 | <formatting> is either "nroff" to force installation of formatted |
---|
1480 | materials (using nroff) or "source" to get the nroff |
---|
1481 | source installed. |
---|
1482 | |
---|
1483 | <compression> is either the name of a program to compress the manual |
---|
1484 | pages (gipz, compress, pack) or "cat" for uncompressed data. |
---|
1485 | |
---|
1486 | <suffix> is either the file suffix to convert installed pages to |
---|
1487 | (e.g. 0.gz for gzip-compressed pages under BSD) or "strip" |
---|
1488 | to force the normal ".4f" suffix to be converted to ".4" |
---|
1489 | (or ".5" if using the BSD organization). If no -<suffix> |
---|
1490 | is specified then filenames are not converted when they |
---|
1491 | are installed. |
---|
1492 | |
---|
1493 | Common schemes are: |
---|
1494 | |
---|
1495 | bsd-nroff-gzip-0.gz compressed formatted pages for BSD |
---|
1496 | bsd-source-cat nroff source w/ BSD organization |
---|
1497 | sysv-source-cat-strip nroff source for SysV w/o .4f suffix |
---|
1498 | sysv-source-cat nroff source for SysV as-is |
---|
1499 | |
---|
1500 | EOF |
---|
1501 | x="";; |
---|
1502 | esac |
---|
1503 | else |
---|
1504 | x="$MANSCHEME" |
---|
1505 | fi |
---|
1506 | done |
---|
1507 | MANSCHEME="$x" |
---|
1508 | } |
---|
1509 | |
---|
1510 | printConfig() |
---|
1511 | { |
---|
1512 | cat<<EOF |
---|
1513 | |
---|
1514 | TIFF configuration parameters are: |
---|
1515 | |
---|
1516 | [ 1] Directory for tools: $DIR_BIN |
---|
1517 | [ 2] Directory for libraries: $DIR_LIB |
---|
1518 | [ 3] Directory for include files: $DIR_INC |
---|
1519 | [ 4] Directory for manual pages: $DIR_MAN |
---|
1520 | [ 5] Directory for HTML documents: $DIR_HTML |
---|
1521 | [ 6] Manual page installation scheme: $MANSCHEME |
---|
1522 | |
---|
1523 | EOF |
---|
1524 | } |
---|
1525 | |
---|
1526 | promptForParameter() |
---|
1527 | { |
---|
1528 | case $1 in |
---|
1529 | 1) promptForNonNullStringParameter "$DIR_BIN" \ |
---|
1530 | "Directory to install tools"; DIR_BIN="$param" |
---|
1531 | ;; |
---|
1532 | 2) promptForNonNullStringParameter "$DIR_LIB" \ |
---|
1533 | "Directory to install libraries"; DIR_LIB="$param" |
---|
1534 | ;; |
---|
1535 | 3) promptForNonNullStringParameter "$DIR_INC" \ |
---|
1536 | "Directory to install include files"; DIR_INC="$param" |
---|
1537 | ;; |
---|
1538 | 4) promptForNonNullStringParameter "$DIR_MAN" \ |
---|
1539 | "Directory to install manual pages"; DIR_MAN="$param" |
---|
1540 | ;; |
---|
1541 | 5) promptForNonNullStringParameter "$DIR_HTML" \ |
---|
1542 | "Directory to install HTML documents"; DIR_HTML="$param" |
---|
1543 | ;; |
---|
1544 | 6) promptForManPageScheme;; |
---|
1545 | esac |
---|
1546 | } |
---|
1547 | |
---|
1548 | checkJPEG() |
---|
1549 | { |
---|
1550 | if [ "${JPEG}" = yes ]; then |
---|
1551 | test "`findHeader jpeglib.h`" || { |
---|
1552 | cat<<EOF |
---|
1553 | |
---|
1554 | The set of libtiff include directories, |
---|
1555 | |
---|
1556 | DIRS_LIBINC=${DIRS_LIBINC} |
---|
1557 | |
---|
1558 | does not seem to be setup correctly; "jpeglib.h" was not found. |
---|
1559 | This must be corrected if the JPEG support is to be enabled. |
---|
1560 | Either fix the pathname or disable the JPEG support. |
---|
1561 | |
---|
1562 | EOF |
---|
1563 | } |
---|
1564 | test $SRCDIR_IS_LIBTIFF = yes || \ |
---|
1565 | test -d "${DIR_JPEGLIB:-/dev/null/no-such-file}" || { |
---|
1566 | cat<<EOF |
---|
1567 | |
---|
1568 | The JPEG library directory, "${DIR_JPEGLIB}", does not seem to exist. |
---|
1569 | This must be corrected if the JPEG support is to be enabled. |
---|
1570 | Either fix the pathname or disable the JPEG support. |
---|
1571 | |
---|
1572 | EOF |
---|
1573 | } |
---|
1574 | fi |
---|
1575 | } |
---|
1576 | |
---|
1577 | checkZIP() |
---|
1578 | { |
---|
1579 | if [ "${ZIP}" = yes ]; then |
---|
1580 | test "`findHeader zlib.h`" || { |
---|
1581 | cat<<EOF |
---|
1582 | |
---|
1583 | The set of libtiff include directories, |
---|
1584 | |
---|
1585 | DIRS_LIBINC=${DIRS_LIBINC} |
---|
1586 | |
---|
1587 | does not seem to be setup correctly; "zlib.h" was not found. |
---|
1588 | This must be corrected if the (G)ZIP support is to be enabled. |
---|
1589 | Either fix the pathname or disable the (G)ZIP support. |
---|
1590 | |
---|
1591 | EOF |
---|
1592 | } |
---|
1593 | test $SRCDIR_IS_LIBTIFF = yes \ |
---|
1594 | || test -d "${DIR_GZLIB:-/dev/null/no-such-file}" || { |
---|
1595 | cat<<EOF |
---|
1596 | |
---|
1597 | The libgz library directory, "${DIR_GZLIB}", does not seem to exist. |
---|
1598 | This must be corrected if the ZIP support is to be enabled. |
---|
1599 | Either fix the pathname or disable the ZIP support. |
---|
1600 | |
---|
1601 | EOF |
---|
1602 | } |
---|
1603 | fi |
---|
1604 | } |
---|
1605 | |
---|
1606 | if [ $NONINTERACTIVE = no ] ; then |
---|
1607 | ok=skip |
---|
1608 | while [ "$ok" != y ] && [ "$ok" != yes ]; do |
---|
1609 | if [ "$ok" != skip ]; then |
---|
1610 | for i in 1 2 3 4 5 6; do |
---|
1611 | promptForParameter $i; |
---|
1612 | done |
---|
1613 | fi |
---|
1614 | printConfig; prompt "Are these ok [yes]?"; read ok |
---|
1615 | test -z "$ok" && ok=yes |
---|
1616 | case "$ok" in |
---|
1617 | [1-9]|1[0-7]) promptForParameter $ok;; |
---|
1618 | [yY]*|[nN]*) continue;; |
---|
1619 | ?*) |
---|
1620 | echo "" |
---|
1621 | echo "\"y\", \"yes\", or <RETURN> accepts the displayed parameters." |
---|
1622 | echo "A number lets you change the numbered parameter." |
---|
1623 | echo "" |
---|
1624 | ;; |
---|
1625 | esac |
---|
1626 | ok=skip |
---|
1627 | done |
---|
1628 | checkJPEG |
---|
1629 | checkZIP |
---|
1630 | else |
---|
1631 | checkJPEG |
---|
1632 | checkZIP |
---|
1633 | fi |
---|
1634 | |
---|
1635 | case $MANSCHEME in |
---|
1636 | *-source-*) MANAPPS=man1 MANLIB=man3;; |
---|
1637 | *-nroff-*) MANAPPS=cat1 MANLIB=cat3;; |
---|
1638 | esac |
---|
1639 | case $MANSCHEME in |
---|
1640 | *-strip) MANSEDLOCAL="-e s/3T/3/g";; |
---|
1641 | *) MANSEDLOCAL="";; |
---|
1642 | esac |
---|
1643 | case $MANSCHEME in |
---|
1644 | *-source-*) MANCVT='${MANSED} $? >$@';; |
---|
1645 | *-nroff-gzip-*) MANCVT='${MANSED} $? | nroff -man | gzip > $@';; |
---|
1646 | *-nroff-pack-*) MANCVT='${MANSED} $? | nroff -man | pack > $@';; |
---|
1647 | *-nroff-com*-*) MANCVT='${MANSED} $? | nroff -man | compress > $@';; |
---|
1648 | *-nroff-cat-*) MANCVT='${MANSED} $? | nroff -man > $@';; |
---|
1649 | esac |
---|
1650 | case $MANSCHEME in |
---|
1651 | *-0|*-0.gz|*-0.Z|*-gz|*-Z|*-z) |
---|
1652 | suf=`echo $MANSCHEME | sed 's/.*-/./'` |
---|
1653 | A='`echo $$i | sed' B='`' # workaround shell bugs |
---|
1654 | MANAPPNAME="$A s/\\\\.1\$\$/$suf/$B" |
---|
1655 | MANLIBNAME="$A s/\\\\.3t\$\$/$suf/$B" |
---|
1656 | ;; |
---|
1657 | *-strip) |
---|
1658 | MANAPPNAME='$$i' |
---|
1659 | MANLIBNAME='`echo $$i | sed s/\\.3t$$/.3/`' |
---|
1660 | ;; |
---|
1661 | *) |
---|
1662 | MANAPPNAME='$$i' MANLIBNAME='$$i' |
---|
1663 | ;; |
---|
1664 | esac |
---|
1665 | |
---|
1666 | if [ "${JPEG}" = yes ]; then |
---|
1667 | test -z "${CONF_JPEG-}" && CONF_JPEG="-DJPEG_SUPPORT" |
---|
1668 | if test -z "${LIBJPEG-}" ; then |
---|
1669 | LIBJPEG="-ljpeg" |
---|
1670 | test -z "${DIR_JPEGLIB-}" || LIBJPEG="-L${DIR_JPEGLIB} ${LIBJPEG}" |
---|
1671 | fi |
---|
1672 | else |
---|
1673 | CONF_JPEG= |
---|
1674 | LIBJPEG= |
---|
1675 | fi |
---|
1676 | if [ "${ZIP}" = yes ]; then |
---|
1677 | test -z "${CONF_ZIP-}" && CONF_ZIP="-DZIP_SUPPORT" |
---|
1678 | if test -z "${LIBGZ-}" ; then |
---|
1679 | LIBGZ="-lz" |
---|
1680 | test -z "${DIR_GZLIB-}" || LIBGZ="-L${DIR_GZLIB} ${LIBGZ}" |
---|
1681 | fi |
---|
1682 | else |
---|
1683 | CONF_ZIP= |
---|
1684 | LIBGZ= |
---|
1685 | fi |
---|
1686 | |
---|
1687 | Note "" |
---|
1688 | |
---|
1689 | # |
---|
1690 | # Fixup a list of potentially relative pathnames so |
---|
1691 | # that they work when used in a subdirectory. The |
---|
1692 | # string sent to stdout has no extraneous spaces so |
---|
1693 | # it can be used, for example, in building pathnames. |
---|
1694 | # |
---|
1695 | # NB: There's an extra echo done here so we get a |
---|
1696 | # \n-terminated string passed to sed. |
---|
1697 | # |
---|
1698 | relativize() |
---|
1699 | { |
---|
1700 | echo `if [ $SRCDIR_IS_LIBTIFF = no ]; then |
---|
1701 | (for i do |
---|
1702 | case "$i" in |
---|
1703 | /*|-l*) echo "$i" ;; |
---|
1704 | -[LR]) ;; # XXX??? |
---|
1705 | -[LR]/*) echo "$i" ;; |
---|
1706 | -L*) echo "$i" | sed 's;^-L;-L../;' ;; |
---|
1707 | -R*) echo "$i" | sed 's;^-R;-R../;' ;; |
---|
1708 | *) echo "../$i" ;; |
---|
1709 | esac |
---|
1710 | done) | tr '\012' ' ' |
---|
1711 | else |
---|
1712 | echo "$@" |
---|
1713 | fi` | sed -e 's;[ ][ ]*$;;' -e 's;/[.]$;;' |
---|
1714 | } |
---|
1715 | # |
---|
1716 | # Generate a list of compiler include options, |
---|
1717 | # prepending ``../'' to any relative pathnames. |
---|
1718 | # |
---|
1719 | makeIncArgs() |
---|
1720 | { |
---|
1721 | (for i do |
---|
1722 | case "$i" in |
---|
1723 | /*) echo "-I$i" ;; |
---|
1724 | *) |
---|
1725 | if [ $SRCDIR_IS_LIBTIFF = yes ]; then |
---|
1726 | echo "-I$i" |
---|
1727 | else |
---|
1728 | echo "-I../$i" |
---|
1729 | fi ;; |
---|
1730 | esac |
---|
1731 | done) | tr '\012' ' ' |
---|
1732 | } |
---|
1733 | |
---|
1734 | # |
---|
1735 | # Setup parameters needed below. |
---|
1736 | # |
---|
1737 | if [ $SRCDIR_IS_LIBTIFF = yes ]; then |
---|
1738 | CONFIGDIR="." |
---|
1739 | LIBSRCDIR="${SRCDIR}" |
---|
1740 | else |
---|
1741 | CONFIGDIR=".." |
---|
1742 | LIBSRCDIR=`relativize ${SRCDIR}`/libtiff |
---|
1743 | fi |
---|
1744 | |
---|
1745 | # NB: these should be sorted alphabetically |
---|
1746 | cat>>confsed<<EOF |
---|
1747 | s;@AR@;${AR};g |
---|
1748 | s;@AROPTS@;${AROPTS};g |
---|
1749 | s;@CONFIGDIR@;${CONFIGDIR};g |
---|
1750 | s;@CCOMPILER@;${CCOMPILER};g |
---|
1751 | s;@CHMOD@;${CHMOD};g |
---|
1752 | s;@CONF_JPEG@;${CONF_JPEG};g |
---|
1753 | s;@CONF_ZIP@;${CONF_ZIP};g |
---|
1754 | s;@COPT_LIBINC@;`makeIncArgs ${DIRS_LIBINC}`;g |
---|
1755 | s;@DATE@;${DATE};g |
---|
1756 | s;@DEPEND_JPEGLIB@;${CONF_JPEG:+`findHeader jpeglib.h` `findHeader jerror.h`};g |
---|
1757 | s;@DEPEND_ZLIB@;${CONF_ZIP:+`findHeader zlib.h`};g |
---|
1758 | s;@DIR_BIN@;${DIR_BIN};g |
---|
1759 | s;@DIR_JPEGLIB@;`relativize ${DIR_JPEGLIB}`;g |
---|
1760 | s;@DIR_GZLIB@;`relativize ${DIR_GZLIB}`;g |
---|
1761 | s;@DIR_HTML@;${DIR_HTML};g |
---|
1762 | s;@DIR_INC@;${DIR_INC};g |
---|
1763 | s;@DIR_LIB@;${DIR_LIB};g |
---|
1764 | s;@DIR_MAN@;${DIR_MAN};g |
---|
1765 | s;@DIRS_LIBINC@;`relativize ${DIRS_LIBINC}`;g |
---|
1766 | s;@DIST_POINT@;${DIST_POINT};g |
---|
1767 | s;@DIST_MAJOR@;${DIST_MAJOR};g |
---|
1768 | s;@DIST_MINOR@;${DIST_MINOR};g |
---|
1769 | s;@DSO@;${DSO};g |
---|
1770 | s;@DSOSUF@;${DSOSUF};g |
---|
1771 | s;@DSOSUF_VERSION@;${DSOSUF_VERSION};g |
---|
1772 | s;@ENVOPTS@;${ENVOPTS};g |
---|
1773 | s;@FILLORDER@;${FILLORDER};g |
---|
1774 | s;@GCOPTS@;${GCOPTS};g |
---|
1775 | s;@HTML@;${HTML};g |
---|
1776 | s;@INSTALL@;${INSTALL};g |
---|
1777 | s;@LIBJPEG@;`relativize ${LIBJPEG}`;g |
---|
1778 | s;@LIBGL@;${LIBGL};g |
---|
1779 | s;@LIBGZ@;`relativize ${LIBGZ}`;g |
---|
1780 | s;@LIBSRCDIR@;${LIBSRCDIR};g |
---|
1781 | s;@LIBIMAGE@;${LIBIMAGE};g |
---|
1782 | s;@LIBCOPTS@;${LIBCOPTS};g |
---|
1783 | s;@LIBPORT@;${LIBPORT};g |
---|
1784 | s;@LN@;${LN};g |
---|
1785 | s;@LN_S@;${LN_S};g |
---|
1786 | s;@MACHDEPLIBS@;${MACHDEPLIBS};g |
---|
1787 | s;@MANAPPS@;${MANAPPS};g |
---|
1788 | s;@MANAPPNAME@;${MANAPPNAME};g |
---|
1789 | s;@MANLIBNAME@;${MANLIBNAME};g |
---|
1790 | s;@MANCVT@;${MANCVT};g |
---|
1791 | s;@MANSEDLOCAL@;${MANSEDLOCAL};g |
---|
1792 | s;@MANLIB@;${MANLIB};g |
---|
1793 | s;@MV_F@;${MV_F};g |
---|
1794 | s;@OPTIMIZER@;${OPTIMIZER};g |
---|
1795 | s;@PORT@;${PORT};g |
---|
1796 | s;@PORTFUNCS@;${PORTFUNCS};g |
---|
1797 | s;@RANLIB@;${RANLIB};g |
---|
1798 | s;@SCRIPT_SH@;${SCRIPT_SH};g |
---|
1799 | s;@SED@;${SED};g |
---|
1800 | s;@SETMAKE@;${SETMAKE};g |
---|
1801 | s;@SRCDIR@;${SRCDIR};g |
---|
1802 | s;@RELSRCDIR@;`relativize ${SRCDIR}`;g |
---|
1803 | s;@STRIP@;${STRIP};g |
---|
1804 | s;@TARGET@;${TARGET};g |
---|
1805 | s;@TIFFLIBREF@;${TIFFLIBREF};g |
---|
1806 | s;@VERSION@;${VERSION};g |
---|
1807 | s;@RELEASE@;${RELEASE};g |
---|
1808 | s;@VERSIONFILE@;`relativize ${VERSIONFILE}`;g |
---|
1809 | s;@WARNING@;Warning, this file was automatically created by the TIFF configure script;g |
---|
1810 | EOF |
---|
1811 | |
---|
1812 | SedConfigFiles() |
---|
1813 | { |
---|
1814 | for F do |
---|
1815 | test -f $SRCDIR/$F.in || { |
---|
1816 | bitch "$SRCDIR/$F.in is missing; this should be part of the distribution." |
---|
1817 | boom |
---|
1818 | } |
---|
1819 | dir=`echo $F | $SED 's;/[^/]*$;;'` |
---|
1820 | if [ $dir != $F ] && [ ! -d $dir ]; then |
---|
1821 | Note "Creating $dir directory" |
---|
1822 | mkdir $dir |
---|
1823 | fi |
---|
1824 | suffix=`echo $F | $SED 's/.*\.//'` |
---|
1825 | if [ "$suffix" = h ]; then |
---|
1826 | # |
---|
1827 | # Compare old and new versions so that include files |
---|
1828 | # are only updated when something has changed--this |
---|
1829 | # saves time for subsequent makes. Note we screen |
---|
1830 | # out use of @DATE@ 'cuz otherwise that'll mess up |
---|
1831 | # the comparison (this assumes dates are used in lines |
---|
1832 | # of the form DATE: @DATE@). |
---|
1833 | # |
---|
1834 | $RM $F.new; $SED -f confsed $SRCDIR/$F.in > $F.new |
---|
1835 | $RM confx; $SED '/DATE:/d' $F.new >confx |
---|
1836 | $RM confy; $SED '/DATE:/d' $F >confy 2>/dev/null |
---|
1837 | if cmp -s confx confy >/dev/null 2>&1; then |
---|
1838 | $RM $F.new |
---|
1839 | else |
---|
1840 | Note "Creating $F from $SRCDIR/$F.in" |
---|
1841 | $RM $F; mv $F.new $F; $CHMOD 444 $F |
---|
1842 | fi |
---|
1843 | else |
---|
1844 | Note "Creating $F from $SRCDIR/$F.in" |
---|
1845 | if $SED -f confsed $SRCDIR/$F.in >$F.new; then |
---|
1846 | $RM $F; mv $F.new $F; $CHMOD 444 $F |
---|
1847 | else |
---|
1848 | cat 1>&2 <<EOF |
---|
1849 | Help, there was a problem crafting $F from $F.in. |
---|
1850 | The command: |
---|
1851 | |
---|
1852 | $SED -f confsed $SRCDIR/$F.in >$F.new |
---|
1853 | |
---|
1854 | failed. Aborting without cleaning up files so you can take a look... |
---|
1855 | EOF |
---|
1856 | exit 1 |
---|
1857 | fi |
---|
1858 | fi |
---|
1859 | done |
---|
1860 | } |
---|
1861 | |
---|
1862 | # |
---|
1863 | # port/install.sh is the SGI install program emulator script. |
---|
1864 | # |
---|
1865 | CONF_FILES="Makefile" |
---|
1866 | if [ $SRCDIR_IS_LIBTIFF != yes ] ; then |
---|
1867 | CONF_FILES="$CONF_FILES |
---|
1868 | libtiff/Makefile |
---|
1869 | man/Makefile |
---|
1870 | tools/Makefile |
---|
1871 | port/install.sh |
---|
1872 | " |
---|
1873 | test $HTML = yes && CONF_FILES="$CONF_FILES html/Makefile" |
---|
1874 | test $PORT = yes && CONF_FILES="$CONF_FILES port/Makefile" |
---|
1875 | fi |
---|
1876 | SedConfigFiles $CONF_FILES |
---|
1877 | |
---|
1878 | Note "Done." |
---|
1879 | |
---|
1880 | $RM $JUNK |
---|
1881 | exit 0 |
---|