forked from ifax/HylaFAX
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure
executable file
·5036 lines (4741 loc) · 135 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
# $Id$
#
# HylaFAX Facsimile Software
#
# Copyright (c) 1988-1996 Sam Leffler
# Copyright (c) 1991-1996 Silicon Graphics, Inc.
# HylaFAX is a trademark of Silicon Graphics
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
#
# Configuration script for HylaFAX (tm) (aka FlexFAX)
#
# Shell script to setup machine-dependent files in
# preparation for building HylaFax source.
#
#
# Setup general configuration parameters.
#
DIR_BIN=/usr/local/bin
DIR_SBIN=/usr/local/sbin
DIR_LIBDATA=/usr/local/lib/fax
DIR_LIB=/usr/local/lib
DIR_LIBEXEC=$DIR_SBIN
DIR_SPOOL=/var/spool/hylafax
DIR_LOCALE=/usr/local/share/locale
DIR_CGI=/var/httpd/cgi-bin
PATH_DPSRIP=$DIR_LIBEXEC/ps2fax.exe
PATH_IMPRIP=/usr/lib/print/psrip
CGIPATH=/cgi-bin
LOCALE_DOMAIN=hylafax
DEFVRES=98
PAGESIZE="North American Letter"
FAXUID=uucp
FAXGID=
SYSUID=bin
SYSGID=
DSO=auto
GETTY=auto
PS=auto
SYSVINIT=auto
FAXQ_SERVER=yes # init script starts faxq
HFAXD_SERVER=yes # init script starts hfaxd
HFAXD_SNPP_SERVER=no # don't start paging protocol
SGI2FAX=auto
LIBMALLOC=auto
LOCKS=auto
DPS=no
GS=no
IMP=no
UTMP=auto
NLS=auto
OPTIMIZER="-O"
LIBCRYPT=
LIBPAM=
LIBTIFF="-ltiff"
TIFFINC=
TIFFBIN=
LIBUTIL=
LIBZ=-lz
ZLIBINC=
LIBINTL=
INTLINC=
REGEX=yes
LIBREGEX='-L${DEPTH}/regex -lregex'
REGEXINC='-I${DEPTH}/${TOPSRCDIR}/regex'
CONFIG_OSFCNH=auto
MANNUM4_5=4F
MANNUM1_8=1M
XGETTEXT="xgettext --foreign-user -ctranslator --no-wrap --sort-by-file --omit-header --strict --indent --force-po"
MSGMERGE="msgmerge --no-wrap --sort-by-file"
MSGFMT=msgfmt
MSGCAT=msgcat
# SVR4 packaging stuff
PKG_ARCH= # ARCH variable in pkginfo file
[email protected] # EMAIL variable in pkginfo file
PKG_VENDOR="Your Name Here" # VENDOR variable in pkginfo file
: ${MAKE=make} # make to use
# screws up the test of `-f -'
unset MAKEFLAGS
RM="rm -f"
#
# Note VARX parameters cannot contain more that 100 entries as it
# breaks HP's sed
#
VAR1="ANSICPP
ANSICXXPP
ABI_VERSION
ABI_PATCH
AR
AROPTS
AWK
BASE64ENCODE
BIN DIR_BIN
CAT
CGIDIR DIR_CGI
CGIPATH
CHGRP
CHMOD
CHOWN
CC
CCOMPILER
CMP
COL
CP
CXX
CXXCOMPILER
CXXFILE
DATE
DEFPAGESIZE
DEFVRES
DIST_ALPHA
DIST_MAJOR
DIST_MINOR
DIST_TYPE
DPS
DPSRIP PATH_DPSRIP
DSO
DSOSUF
DSODELAY
DSOOPTS
ECHO
ENABLE_NLS
ENCODING
ENVOPTS
FAXGID
FAXUID
FAXQ_SERVER
FILLORDER
FONTMAP
FONTPATH PATH_AFM
FUSER
GCOPTS
GCXXOPTS
GLDOPTS
GENDIST
GETTY
GREP
GS
GSRIP PATH_GSRIP
HAVE_PODOFO
HFAXD_SERVER
HFAXD_SNPP_SERVER
IMP
IMPRIP PATH_IMPRIP
INSTALL
INTLINC
LIBDATA DIR_LIBDATA
LIBDIR DIR_LIB
LIBEXEC DIR_LIBEXEC
LIBCRYPT
LIBINTL
LIBPODOFO
LIBPORT
LIBREGEX
LIBTIFF
LIBUTIL
LIBZ
LIBDB
LLDOPTS
LN
LN_S
LOCALEDIR DIR_LOCALE
LOCALE_DOMAIN
HAVE_PAM
LIBPAM
HAVE_JBIG
HAVE_JBIGTIFF
LIBJBIG"
VAR2="MACHDEPLIBS
MAKECXXOVERRIDE
MAKEDEPINCLUDE
MAKEDSOINCLUDE
MAKEINCLUDE
MAKELQUOTE
MAKERQUOTE
MAN
MANDIR DIR_MAN
MANAPPS
MANCAPPNAME
MANCFILENAME
MANCVT
MANFILES
MANNUM4_5
MANNUM1_8
MANSAPPNAME
MANSCHEME
MANSFILENAME
MANSYS
MIMENCODE
MKDEPCOPTS
MKDEPCXXOPTS
MKDEPEND
MKDIR
MKFIFO
MV
MV_F
NLS
NOCLOBBER_OFF
NOCLOBBER_ON
OPTIMIZER
PAGESIZE
PATHGETTY PATH_GETTY
PATHVGETTY PATH_VGETTY
PATHEGETTY PATH_EGETTY
PCL6CMD
PKG_ARCH
PKG_EMAIL
PKG_VENDOR
PODOFOINC
PORTFUNCS
PROTOTYPES
PSPACKAGE PS
PWDCMD
QPENCODE
RANLIB
REGEX
REGEXINC
RM RMCMD
SBIN DIR_SBIN
SCRIPT_SH
SED
SENDMAIL PATH_SENDMAIL
SETMAKE
SGI2FAX
SHDLIBC
SORT
SPOOL DIR_SPOOL
SRCDIR
STRIP
SYSGID
SYSUID
SYSVINIT
SYSVINITDIR DIR_SYSVINIT
SYSVINITSTARTDIR DIR_SYSVINITSTART
SYSVINITSTARTNAME NAME_SYSVINITSTART
SYSVINITSTOPDIR DIR_SYSVINITSTOP
SYSVINITSTOPNAME NAME_SYSVINITSTOP
TARGET
TIFF2PDF
TIFFBIN
TIFFINC
TTYCMD
UTMP
UUCP_LOCKDIR DIR_LOCKS
UUCP_LOCKTYPE LOCKS
UUENCODE
VERSION
WARNING
MSGMERGE
MSGFMT
MSGCAT
XGETTEXT
ZLIBINC"
dumpvars()
{
(for i do echo "$i"; done) |
while read a b; do eval c=\$${b:-$a}; echo "/@$a@/s;;$c;g"; done
}
dumpvals()
{
(echo "$VAR1"; echo "$VAR2") |
while read a b; do eval c=\$${b:-$a}; echo "${b:-$a}='$c'"; done
}
#
# We do this little dance with the search path to insure
# that programs that we select for use by installed programs
# (which may be run by the super-user) come from trusted
# locations before they come from the user's private area.
# This should help avoid accidentally configuring some
# random version of a program in someone's personal bin.
#
OPATH=$PATH
PATH=/bin:/usr/bin:/etc
test -d /usr/ccs/bin && PATH=$PATH:/usr/ccs/bin # SVR4/Solaris2
test -d /usr/sbin && PATH=$PATH:/usr/sbin # SGI and others
test -d /usr/bsd && PATH=$PATH:/usr/bsd # SGI
test -d /usr/ucb && PATH=$PATH:/usr/ucb # Sun and others
test -d /usr/contrib/bin && PATH=$PATH:/usr/contrib/bin # BSDi
test -d /usr/5bin && PATH=/usr/5bin:$PATH:/usr/etc # Sun and others
test -d /usr/local/bin && PATH=/usr/local/bin:$PATH # for GNU stuff
PATH=$PATH:$OPATH
POSIXLY_CORRECT=1; export POSIXLY_CORRECT # disable GNU extensions
LC_ALL=C; export LC_ALL # set a common language
#
# Error diagnostics that should go to the terminal are
# done with this interface (or cat).
#
bitch()
{
echo "$@" 1>&2
}
die()
{
kill -1 $$ # use kill so trap handler is called
}
#
# This is the preferred interface for
# configure to terminate abnormally.
#
boom()
{
bitch ""
bitch "Unrecoverable error! Once you've corrected the problem rerun this script."
die
}
usage()
{
cat<<'EOF'
Usage: configure [options] [host]
Options: [defaults in brackets after descriptions]
--help print this message
--quiet do not print `Using ...' messages
--nointeractive do not prompt for input [INTERACTIVE=no]
--verbose opposite of --quiet
--version print the version of autoconf that created configure
--target=TARGET configure for TARGET [TARGET=HOST]
--srcdir=DIR find the sources in DIR [configure dir or ..]
--disable-nls disable NLS support
--disable-pam disable all PAM support
--with-PARAM[=ARG] set configuration PARAM [ARG=yes]
EOF
}
QUIET=no
INTERACTIVE=${INTERACTIVE:="yes"}
SITE=
TARGET=
RELEASE=
SRCDIR=
WITHARGS=no
#
# Crack command line arguments. We purposely
# use syntax and options that are compatible
# with GNU autoconf.
#
ac_prev=
for ac_option
do
if [ -n "$ac_prev" ]; then # assign the argument to previous option
eval "$ac_prev=\$ac_option"
ac_prev=
continue
fi
case "$ac_option" in # collect optional argument
-*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'`;;
*) ac_optarg=;;
esac
case "$ac_option" in
-with-*|--with-*)
ac_with=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
# Reject names that are not valid shell variable names.
if [ -n "`echo $ac_with| sed 's/[-_a-zA-Z0-9]//g'`" ]; then
bitch "configure: $ac_with: invalid parameter name."
die
fi
ac_with=`echo $ac_with| sed 's/-/_/g'`
case "$ac_option" in
*=*) ;;
*) ac_optarg=yes;;
esac
eval "${ac_with}='$ac_optarg'"
WITHARGS=yes
;;
-enable-nls|--enable-nls) NLS=yes;;
-disable-nls|--disable-nls) NLS=no;;
-quiet|--quiet) QUIET=yes;;
-nointeractive|--nointeractive) INTERACTIVE=no;;
-verbose|--verbose) QUIET=no;;
-site|--site) ac_prev=SITE;;
-site=*|--site=*) SITE="$ac_optarg";;
-srcdir|--srcdir) ac_prev=SRCDIR;;
-srcdir=*|--srcdir=*) SRCDIR="$ac_optarg";;
-target|--target) ac_prev=TARGET;;
-target=*|--target=*) TARGET="$ac_optarg" ;;
-disable-pam|--disable-pam) DISABLE_PAM="yes" ;;
-version|--version)
echo "This is HylaFAX configure $Revision$"
exit 0
;;
-help|--help) usage; exit 0;;
-*)
bitch "configure: $ac_option: invalid option; use -help for usage."
die
;;
*)
if [ x"$TARGET" != x ]; then
bitch "configure: Can only configure for one target at a time."
kill -1 $$
fi
TARGET="$ac_option"
;;
esac
done
if [ -n "$ac_prev" ]; then
bitch "configure: missing argument to --`echo $ac_prev | sed 's/_/-/g'`"
die
fi
#
# Locate source directory by looking for the VERSION file.
# The directory must either be specified through the
# environment or be located in the current directory or a
# parent of the current directory.
#
test "$SRCDIR" || {
configure=$0
# NB: don't use dirname since it may not exist
SRCDIR=`echo $configure | sed 's;/[^/][^/]*$;;'`
if [ @"$SRCDIR" = @"$configure" ]; then
SRCDIR=.
fi
while [ ! -r $SRCDIR/VERSION ]; do
# strip last directory from pathname
newdir=`echo $SRCDIR | sed 's;/[^/]*$;;'`
if [ -z "$newdir" ] || [ "$newdir" = $SRCDIR ]; then
break;
fi
SRCDIR=$newdir
done
}
if [ ! -r $SRCDIR/VERSION ]; then
bitch "Can not locate sources in $SRCDIR; the file $SRCDIR/VERSION"
bitch "does not exist or is unreadable."
boom
fi
SRCDIR=`echo "$SRCDIR" | sed 's;\([^/]\)/*$;\1;'`
#
# Descriptor usage:
# 1: ???
# 2: messages that should be seen even if we're in the background.
# 3: [stdout from test runs]
# 4: verbose-style messages (Using ...)
# 5: compiler stderr when running tests
#
if [ $QUIET = yes ]; then
exec 4>/dev/null # chuck messages
else
exec 4>&1 # messages go to stdout
fi
$RM ./config.log
exec 5>./config.log # compiler messages and the like
DATE=`date`
eval `cat $SRCDIR/VERSION | sed 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)[.-]\([0-9]*\)\(.*\)/DIST_MAJOR=\1; DIST_MINOR=\2; DIST_PATCH=\3; DIST_TYPE=\4/'`
DIST_ALPHA=`awk '{print $3}' $SRCDIR/dist/hylafax.alpha`
VERSION="${DIST_MAJOR}.${DIST_MINOR}.${DIST_PATCH}${DIST_TYPE}"
if [ "$DIST_TYPE" = beta ]; then
VERSION="${VERSION}${DIST_ALPHA}"
fi
ABI_VERSION="${DIST_MAJOR}.${DIST_MINOR}"
if [ -n "$DIST_PATCH" ]
then
ABI_PATCH="${DIST_PATCH}"
else
ABI_PATCH="0"
fi
Note()
{
echo "$@" 1>&4
}
capture()
{
(eval "set -x; $*") >&5 2>&1
return
}
captureX()
{
(eval "set -x; $*") 2>&5
return
}
date >&5
cat 1>&5 <<'EOF'
This file contains information that was captured from running the configure
script. Lines that begin with a "+" are command lines echoed by the
shell. Other lines are the output of commands; usually the contents of
test case files or the output from compilers. If configure does the
wrong thing, use the information captured here to aid in debugging.
EOF
Note ""
Note "Configuring HylaFAX (tm) (aka FlexFAX) $VERSION."
Note ""
Note "If configure does the wrong thing, check the file config.log for"
Note "information that may help you understand what went wrong."
Note ""
# test for broken expr (Tru64 UNIX)
x="00"
match=`expr "$x" : "\([0-9]*\)"`
if [ "$match" != "$x" ]; then
bitch "Your expr is broken. It strips leading zeroes"
bitch "This may cause problems with configure, faxsetup, & faxaddmodem"
bitch "Perhaps there is an environment variable you can set"
bitch "to get the desired behavior."
fi
#
# Read site and local configuration parameters.
#
CONFIG_FILES=
if [ -f $SITE/config.site ]; then
Note "Reading site-wide parameters from $SITE/config.site."
. $SITE/config.site
capture . $SITE/config.site
CONFIG_FILES=$SITE/config.site
elif [ -f $SRCDIR/config.site ]; then
Note "Reading site-wide parameters from $SRCDIR/config.site."
. $SRCDIR/config.site
capture . $SRCDIR/config.site
CONFIG_FILES=$SRCDIR/config.site
fi
if [ -f config.local ]; then
Note "Reading local parameters from config.local."
. ./config.local
capture . ./config.local
CONFIG_FILES="$CONFIG_FILES config.local"
elif [ -f $SRCDIR/config.local ]; then
Note "Reading local parameters from $SRCDIR/config.local."
. $SRCDIR/config.local
capture . $SRCDIR/config.local
CONFIG_FILES="$CONFIG_FILES $SRCDIR/config.local"
fi
#
# Flush cached values if something was specified on the
# command line or if the contents of a config parameter
# file was changed more recently.
#
REASON=
if [ $WITHARGS = yes ]; then
REASON="of command line parameters"
elif [ "$CONFIG_FILES" ]; then
REASON=`find $CONFIG_FILES -newer config.cache -print 2>/dev/null`
test "$REASON" && REASON="$REASON has been updated"
fi
if [ "$REASON" ] && [ -f config.cache ]; then
Note "Flushing cached parameters because $REASON."
Note ""
rm -f config.cache
fi
if [ -f config.cache ]; then
Note "Reading cached parameters from config.cache."
Note ""
ODATE="$DATE"; OVERSION="$VERSION"
OPORTFUNCS="$PORTFUNCS"; OMACHDEPLIBS="$MACHDEPLIBS"
OTIFFINC="$TIFFINC"; OLIBTIFF="$LIBTIFF"
OZLIBINC="$ZLIBINC"; OLIBZ="$LIBZ"
OREGEXINC="$REGEXINC"; OLIBREGEX="$LIBREGEX"
OINTLINC="$INTLINC"; OLIBINTL="$LIBINTL"
. ./config.cache
capture . ./config.cache
# NB: these are calculated each time from scratch
DATE="$ODATE"; VERSION="$OVERSION"
MACHDEPLIBS="$OMACHDEPLIBS"; PORTFUNCS="$OPORTFUNCS"
# NB: these are relativized each time so beware of cached value
TIFFINC="$OTIFFINC"; LIBTIFF="$OLIBTIFF"
ZLIBINC="$OZLIBINC"; LIBZ="$OLIBZ"
REGEXINC="$OREGEXINC"; LIBREGEX="$OLIBREGEX"
INTLINC="$OINTLINC"; LIBINTL="$ILIBINTL"
fi
identifyTarget()
{
random=`date | awk '{print $4}' | sed -e 's/.*://'` 2>/dev/null
case "$random" in
*0) Note "Wow, you've got a $1 system!";;
*1) Note "Hmm, looks like a $1 system.";;
*2) Note "Oh no, not another $1 system...";;
*3) Note "Well I'll be, a $1 system.";;
*4) Note "Fee, fie, foe, this smells like a $1 system.";;
*5) Note "Gosh, aren't you lucky to have a $1 system!";;
*6) Note "YOW!! Did something bad happen or am I on a $1 system?";;
*7) Note "Do they really still make $1 systems?!";;
*8) Note "I'm always happy to encounter another $1 system.";;
*9) Note "Here we are again, this time on a $1 system.";;
esac
}
#
# If no target is specified, try to deduce the system.
# We use the GNU scripts for guessing and canonicalizing
# the system identification, if available.
#
if [ -z "$TARGET" ]; then
test -f $SRCDIR/config.guess && TARGET=`sh $SRCDIR/config.guess` 2>/dev/null
if [ -z "$TARGET" ]; then
bitch "Sorry, no target was specified on the command line and I don't seem to"
bitch "have the GNU config.guess script that is used to deduce your system type."
boom
fi
identifyTarget $TARGET
elif [ -f $SRCDIR/config.sub ]; then
TARGET=`sh $SRCDIR/config.sub "$TARGET"`
else
Note "WARNING, the GNU config.sub script does not seem to be present. This"
Note " script is used to canonicalize your target specification; not"
Note " having it may cause problems later on..."
fi
echo "TARGET: $TARGET" >&5
RELEASE=`(uname -r) 2>/dev/null` || RELEASE=unknown
echo "RELEASE: $RELEASE" >&5
#
# Find the full pathname of a file
# using the specified test operation.
#
findThing()
{
t="$1"; app=$2; path=$3;
case $app in
/*) eval $t $app && { echo $app; return; };;
esac
IFS=:
for i in $path; do
eval $t $i/$app && { echo $i/$app; return 0; }
done
return 1
}
#
# Find the full pathname of a plain file.
#
findFile()
{
findThing "test -f" $1 $2
}
#
# Find the full pathname of an executable.
#
findApp()
{
t="$1"; app=$1; path=$2;
case $app in
/*) eval test -x $app && test ! -d $app && { echo $app; return; };;
esac
IFS=:
for i in $path; do
eval test -x $i/$app && test ! -d $i/$app && { echo $i/$app; return 0; }
done
return 1
}
#
# Find the full pathname of an executable;
# supply a default if nothing is found.
#
findAppDef()
{
app=$1; path=$2; def=$3
case $app in
/*) test -x $app && { echo $app; return; };;
esac
IFS=:
for i in $path; do
test -x $i/$app && { echo $i/$app; return; }
done
echo $def
}
#
# Fixup a list of potentially relative pathnames so
# that they work when used in a subdirectory. The
# string sent to stdout has no extraneous spaces so
# it can be used, for example, in building pathnames.
#
# NB: There's an extra echo done here so we get a
# \n-terminated string passed to sed.
#
relativize()
{
echo `(for i do
case "$i" in
-Wl*) echo "$i" ;;
/*|-l*|-l[$]{DEPTH}/*) echo "$i" ;;
-L|-L/*|-L[$]{DEPTH}/*) echo "$i" ;;
-I|-I/*|-I[$]{DEPTH}/*) echo "$i" ;;
-R|-R/*|-R[$]{DEPTH}/*) echo "$i" ;;
[$][{]DEPTH[}]/*) echo "$i" ;;
-L*) echo "$i" | sed 's;^-L;-L../;' ;;
-R*) echo "$i" | sed 's;^-R;-R../;' ;;
-I*) echo "$i" | sed 's;^-I;-I../;' ;;
*) echo "../$i" ;;
esac
done) | tr '\012' ' '` | \
sed -e 's;/[.]/;/;g' -e 's;[ ][ ]*$;;' -e 's;/[.]$;;'
}
#
# Locate a C and C++ compiler and verify they work and
# satisfy our needs (using assorted heuristics).
#
JUNK="
a.out
conffifo
confsed1
confsed2
conftestmmap
confx confy
confMakefile
conf.db
core
dummy
dummy.C
dummy.a
dummy.c
dummy.o
foo
m.c
so_locations
t.c
t.c++
t.o
t
xMakedepend
xdefs
xgnu.c
xmakeinc
xport.h
xtermios.h
"
trap "$RM \$JUNK; exit 1" 1 2 15
$RM $JUNK
#
# Before we go too far, check some features required by the software
#
if [ -z "$MKFIFO" ]; then
MKFIFO=`findApp mkfifo $PATH`
if [ "$MKFIFO" ]; then
mkfifo()
{
$MKFIFO $1
}
else
MKFIFO=`findApp mknod /sbin:$PATH`
if [ -z "$MKFIFO" ]; then
cat <<EOF
No support for creating a FIFO special file.
There does not appear to be a way to create a FIFO special file.
No mkfifo program or mknod program was located in the expected
locations. One of these programs is required for proper operation
of this software. If these programs are located in a non-standard
location then you can setup the MKFIFO configuration parameter to
reflect the appropriate location. Otherwise you may need to install
additional software on your system to support FIFO special files
before you can configure the building of this software.
EOF
boom
fi
mkfifo()
{
$MKFIFO $1 p
}
fi
fi
cat>xgnu.c<<EOF
#ifdef __GNUC__
yes;
#endif
EOF
#
# Check if the specified compiler is from GNU
#
isGNU()
{
capture "cat xgnu.c; ($1 -E xgnu.c 2>&5 | egrep yes)"
}
checkGCCVersion()
{
app=$1; shift
eval `$app -v 2>&1 | \
sed -n -e '/[Vv]ersion/s/[^(]* [a-z\-]*\([0-9]*\)\.\([0-9]*\).\([0-9]*\).*/GCCdist=\1;GCCmajor=\2;GCCminor=\3/p'`
GCCversion="${GCCdist}.${GCCmajor}.${GCCminor}"; export GCCversion
if [ ${GCCdist} -gt $1 ]; then
return 0
fi
if [ ${GCCdist} -eq $1 ]; then
if [ ${GCCmajor} -gt $2 ]; then
return 0
fi
if [ ${GCCmajor} -eq $2 ] && [ ${GCCminor} -ge $3 ]; then
return 0
fi
fi
return 1
}
#
# NB: use ANSI C prototype to weed out non-ANSI compilers.
#
cat>dummy.c<<EOF
int main(int argc, char* argv) { return 0; }
EOF
checkCompiler()
{
compiler=$1
if isGNU $compiler; then
ISGCC=yes
else
ISGCC=no
fi
#
# Guess special options needed to get an
# ANSI C compiler and/or similar. Must
# be combined with above checks so we only
# select an ANSI C compiler.
#
if [ -z "${ENVOPTS:-}" ]; then
case $ISGCC-$TARGET in
no-*-hpux11*) C_ANSI="-Aa -D_HPUX_SOURCE -Dhpux -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED";;
yes-*-hpux11*) C_ANSI="-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED";;
no-*-hp*) C_ANSI="-Aa -D_HPUX_SOURCE -Dhpux";;
no-*-sco3.2v5.*) C_ANSI="-Dsco -Dsco5 -b elf";;
yes-*-sco3.2v5.*) C_ANSI="-Dsco -Dsco5 -m486";;
*-*-sco*) C_ANSI="-Dsco";;
*-isc*) C_ANSI="-posix -D_SYSV3 -DISC";;
yes-*-solaris*) C_ANSI="-L/usr/local/lib -R/usr/local/lib";;
esac
else
C_ANSI="$ENVOPTS"
fi
$RM dummy dummy.o
capture $compiler -o dummy ${C_ANSI} dummy.c && {
CC=$compiler;
test -z "${CCOMPILER:-}" && CCOMPILER=`findApp $compiler $PATH`
test -z "${ENVOPTS:-}" && ENVOPTS="${C_ANSI:-}"
return 0
}
return 1
}
CCtested=
capture cat dummy.c
if [ -z "${CC:-}" ]; then
CCOMPILER=
for i in gcc cc ncc dcc xlc c89 gcc2 acc; do
CCtested="$CCtested $i"
checkCompiler $i && break
done
else
CCtested="$CCtested $CC"
checkCompiler $CC
fi
if [ -z "$CCOMPILER" ]; then
cat<<EOF
Cannot locate a working ANSI C compiler.
We attempted to compile the following test program:
----------------------------------------------------------
EOF
cat dummy.c
cat<<EOF
----------------------------------------------------------
with these compilers:
$CCtested
but none of them were successful.
If your compiler is in a non-standard location, you can specify its
location in several ways:
o set the environment variable CC
o create a config.local or config.site file that includes a
definition for CC
o supply it on the command line using -with-CC=<pathname>
If command line options are required for ANSI C compilation, set the
ENVOPTS parameter to these options in a similar way (either through
an environment variable or config.local/config.site) and then rerun
this script.
EOF
boom
fi
Note "Using $CCOMPILER for a C compiler (set CC to override)."
test "$ENVOPTS" && {
Note "Using $ENVOPTS to get the appropriate compilation environment."
}
CheckForGandO()
{
f=$1
if test -s $f; then
capture grep -E -i "\(error\|warning\)" $f || return 1
fi
return 0
}
if [ -z "$GCOPTS" ]; then
capture $CCOMPILER $ENVOPTS -g -c dummy.c && {
Note "Looks like $CCOMPILER supports the -g option."
# NB: cannot use captureX here 'cuz we lose stderr
if $CCOMPILER $ENVOPTS $GCOPTS -c -g -O dummy.c >t 2>&1 && CheckForGandO t; then
GCOPTS="$GCOPTS -g"
else
Note "... but not together with the -O option, not using it."
fi
}
fi
if [ "$GCOPTS" ]; then
Note "Using \"$GCOPTS\" for C compiler options."
fi
#
# Figure out if there is an ANSI C-preprocessor and,
# if __ANSI_CPP__ is not automatically set, configure
# it to be set.
#
cat>dummy.c<<EOF
#define ansiIDENT(a) a
#define ansiCAT(a,b) a##b
A=ansiCAT(ANSI,CPP);
EOF
capture cat dummy.c
if capture "$CCOMPILER $ENVOPTS -E dummy.c | grep ANSICPP"; then
Note "Looks like $CCOMPILER has an ANSI C preprocessor."
cat>dummy.c<<EOF
#ifdef __ANSI_CPP__
yes
#else
no
#endif
EOF
capture cat dummy.c
if capture "$CCOMPILER $ENVOPTS -E dummy.c | grep no"; then
ANSICPP='-D__ANSI_CPP__'
Note "... but __ANSI_CPP__ is not automatically defined, will compensate."
fi
else
Note "Looks like $CCOMPILER has a non-ANSI C preprocessor, will try to compensate."
fi
#
# Figure out if the C compiler supports a -M option for generating
# Make dependency information.
#
cat>dummy.c<<EOF
int main(int argc, char* argv) { return 0; }
EOF
capture cat dummy.c
if capture "$CCOMPILER -c -M $MKDEPCOPTS dummy.c | grep '^dummy.o[ ]*:[ ]*dummy.c'"; then
Note "Looks like $CCOMPILER supports the -M option for generating make dependencies."
MKDEPEND='\${SHELL} \${PORT}/mkdepend'
else
Note "Looks like $CCOMPILER does not support the -M option for generating"
Note "make dependencies; will disable automatic make dependency building."
MKDEPEND=":"
fi