BSD 4_4_Lite2 development
[unix-history] / usr / src / contrib / groff-1.08 / configure
CommitLineData
e2802270
C
1#!/bin/sh
2# Guess values for system-dependent variables and create Makefiles.
3# Generated automatically using autoconf.
4# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
5
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20# Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
21# [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET]
22# Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and
23# --with-PACKAGE unless this script has special code to handle it.
24
25
26for arg
27do
28 # Handle --exec-prefix with a space before the argument.
29 if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
30 # Handle --host with a space before the argument.
31 elif test x$next_host = xyes; then next_host=
32 # Handle --prefix with a space before the argument.
33 elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
34 # Handle --srcdir with a space before the argument.
35 elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
36 else
37 case $arg in
38 # For backward compatibility, also recognize exact --exec_prefix.
39 -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
40 exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
41 -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
42 next_exec_prefix=yes ;;
43
44 -gas | --gas | --ga | --g) ;;
45
46 -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
47 -host | --host | --hos | --ho | --h)
48 next_host=yes ;;
49
50 -nfp | --nfp | --nf) ;;
51
52 -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
53 no_create=1 ;;
54
55 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
56 prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
57 -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
58 next_prefix=yes ;;
59
60 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
61 srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
62 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
63 next_srcdir=yes ;;
64
65 -with-* | --with-*)
66 package=`echo $arg|sed 's/-*with-//'`
67 # Delete all the valid chars; see if any are left.
68 if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then
69 echo "configure: $package: invalid package name" >&2; exit 1
70 fi
71 eval "with_`echo $package|sed s/-/_/g`=1" ;;
72
73 *) ;;
74 esac
75 fi
76done
77
78trap 'rm -f conftest* core; exit 1' 1 3 15
79
80rm -f conftest*
81compile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
82
83# A filename unique to this package, relative to the directory that
84# configure is in, which we can look for to find out if srcdir is correct.
85unique_file=groff/groff.cc
86
87# Find the source files, if location was not specified.
88if test -z "$srcdir"; then
89 srcdirdefaulted=yes
90 # Try the directory containing this script, then `..'.
91 prog=$0
92 confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
93 test "X$confdir" = "X$prog" && confdir=.
94 srcdir=$confdir
95 if test ! -r $srcdir/$unique_file; then
96 srcdir=..
97 fi
98fi
99if test ! -r $srcdir/$unique_file; then
100 if test x$srcdirdefaulted = xyes; then
101 echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
102 else
103 echo "configure: Can not find sources in \`${srcdir}'." 1>&2
104 fi
105 exit 1
106fi
107# Preserve a srcdir of `.' to avoid automounter screwups with pwd.
108# But we can't avoid them for `..', to make subdirectories work.
109case $srcdir in
110 .|/*|~*) ;;
111 *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
112esac
113
114if test -z "$prefix"
115then
116 echo checking for grops to derive installation directory prefix
117 saveifs="$IFS"; IFS="$IFS:"
118 for dir in $PATH; do
119 test -z "$dir" && dir=.
120 if test $dir != . && test -f $dir/grops; then
121 # Not all systems have dirname.
122 prefix=`echo $dir|sed 's%/[^/][^/]*$%%'`
123 break
124 fi
125 done
126 IFS="$saveifs"
127fi
128if test -z "$prefix"
129then
130 echo checking for gcc to derive installation directory prefix
131 saveifs="$IFS"; IFS="$IFS:"
132 for dir in $PATH; do
133 test -z "$dir" && dir=.
134 if test $dir != . && test -f $dir/gcc; then
135 # Not all systems have dirname.
136 prefix=`echo $dir|sed 's%/[^/][^/]*$%%'`
137 break
138 fi
139 done
140 IFS="$saveifs"
141fi
142
143if test -z "$CC"; then
144 echo checking for gcc
145 saveifs="$IFS"; IFS="${IFS}:"
146 for dir in $PATH; do
147 test -z "$dir" && dir=.
148 if test -f $dir/gcc; then
149 CC="gcc"
150 break
151 fi
152 done
153 IFS="$saveifs"
154fi
155test -z "$CC" && CC="cc"
156
157# Find out if we are using GNU C, under whatever name.
158cat > conftest.c <<EOF
159#ifdef __GNUC__
160 yes
161#endif
162EOF
163${CC-cc} -E conftest.c > conftest.out 2>&1
164if egrep yes conftest.out >/dev/null 2>&1; then
165 GCC=1 # For later tests.
166fi
167rm -f conftest*
168
169cc_compile='$CCC conftest.cc -o conftest $CCLIBS $LIBS >/dev/null 2>&1'
170
171if test -z "$CCC"; then
172# See whether the C compiler is also a C++ compiler.
173echo checking if C compiler is also a C++ compiler
174cat <<EOF > conftest.cc
175#ifdef __cplusplus
176 yes
177#endif
178EOF
179$CC -E conftest.cc >conftest.out 2>&1
180if egrep yes conftest.out >/dev/null 2>&1; then
181 CCC="$CC"
182fi
183fi
184if test -z "$CCC"; then
185 echo checking for g++
186 saveifs="$IFS"; IFS="${IFS}:"
187 for dir in $PATH; do
188 test -z "$dir" && dir=.
189 if test -f $dir/g++; then
190 CCC="g++"
191 break
192 fi
193 done
194 IFS="$saveifs"
195fi
196test -z "$CCC" && CCC=""
197
198if test -z "$CCC"; then
199 echo checking for CC
200 saveifs="$IFS"; IFS="${IFS}:"
201 for dir in $PATH; do
202 test -z "$dir" && dir=.
203 if test -f $dir/CC; then
204 CCC="CC"
205 break
206 fi
207 done
208 IFS="$saveifs"
209fi
210test -z "$CCC" && CCC=""
211
212if test -z "$CCC"; then
213 echo checking for cc++
214 saveifs="$IFS"; IFS="${IFS}:"
215 for dir in $PATH; do
216 test -z "$dir" && dir=.
217 if test -f $dir/cc++; then
218 CCC="cc++"
219 break
220 fi
221 done
222 IFS="$saveifs"
223fi
224test -z "$CCC" && CCC=""
225
226if test -z "$CCC"; then
227cat <<EOM
228This package requires a C++ compiler, but I couldn't find one.
229Set the environment variable CCC to the name of your C++ compiler.
230EOM
231rm -f conftest* core; exit 1
232fi
233echo checking that C++ compiler can compile very simple C++ program
234cat <<EOF > conftest.cc
235
236extern "C" { void exit(int); }
237int main() { exit(0); }
238
239EOF
240rm -f conftest
241eval $cc_compile
242if test -s conftest && (./conftest) 2>/dev/null; then
243 :
244else
245 cat <<EOM
246$CCC was unable successfully to compile a very simple C++ program
247(the C++ program was in a file with a suffix of .cc)
248EOM
249rm -f conftest* core; exit 1
250
251fi
252rm -f conftest*
253echo checking that C++ static constructors and destructors are called
254cat <<EOF > conftest.cc
255
256extern "C" {
257 void exit(int);
258 void _exit(int);
259}
260int i;
261struct A {
262 char dummy;
263 A() { i = 1; }
264 ~A() { if (i == 1) _exit(0); }
265};
266A a;
267main() { exit(1); }
268
269EOF
270rm -f conftest
271eval $cc_compile
272if test -s conftest && (./conftest) 2>/dev/null; then
273 :
274else
275 cat <<EOM
276$CCC is not installed correctly: static constructors and destructors do not work
277EOM
278rm -f conftest* core; exit 1
279
280fi
281rm -f conftest*
282echo checking for C++ header files
283cat <<EOF >conftest.cc
284#include <stdio.h>
285extern "C" { void exit(int); }
286int main() { exit(0); } void t() { fopen(0, 0); }
287EOF
288if eval $cc_compile; then
289 :
290else
291 cat <<\EOF
292Your header files do not appear to support C++.
293I was unable to compile and link a simple C++ program that used a function
294declared in <stdio.h>.
295If you're using gcc/g++, you should install libg++.
296EOF
297rm -f conftest* core; exit 1
298fi
299rm -f conftest*
300if test -z "$PSPRINT"
301then
302 for p in lpr
303do
304if test -z "$LPR"; then
305 echo checking for $p
306 saveifs="$IFS"; IFS="${IFS}:"
307 for dir in $PATH; do
308 test -z "$dir" && dir=.
309 if test -f $dir/$p; then
310 LPR="$p"
311 break
312 fi
313 done
314 IFS="$saveifs"
315fi
316test -z "$LPR" && LPR=""
317
318test -n "$LPR" && break
319done
320
321 for p in lp
322do
323if test -z "$LP"; then
324 echo checking for $p
325 saveifs="$IFS"; IFS="${IFS}:"
326 for dir in $PATH; do
327 test -z "$dir" && dir=.
328 if test -f $dir/$p; then
329 LP="$p"
330 break
331 fi
332 done
333 IFS="$saveifs"
334fi
335test -z "$LP" && LP=""
336
337test -n "$LP" && break
338done
339
340 if test -n "$LPR" && test -n "$LP"
341 then
342 # HP-UX provides an lpr command that emulates lpr using lp,
343 # but it doesn't have lpq; in this case we want to use lp
344 # rather than lpr.
345 for p in lpq
346do
347if test -z "$LPQ"; then
348 echo checking for $p
349 saveifs="$IFS"; IFS="${IFS}:"
350 for dir in $PATH; do
351 test -z "$dir" && dir=.
352 if test -f $dir/$p; then
353 LPQ="$p"
354 break
355 fi
356 done
357 IFS="$saveifs"
358fi
359test -z "$LPQ" && LPQ=""
360
361test -n "$LPQ" && break
362done
363
364 test -n "$LPQ" || LPR=
365 fi
366 if test -n "$LPR"
367 then
368 PSPRINT="$LPR"
369 elif test -n "$LP"
370 then
371 PSPRINT="$LP"
372 fi
373fi
374
375# Figure out DVIPRINT from PSPRINT.
376if test -n "$PSPRINT" && test -z "$DVIPRINT"
377then
378 if test "X$PSPRINT" = "Xlpr"
379 then
380 DVIPRINT="lpr -d"
381 else
382 DVIPRINT="$PSPRINT"
383 fi
384fi
385
386echo checking for perl
387PERLPATH=
388saveifs="$IFS"; IFS="${IFS}:"
389for dir in $PATH; do
390 test -z "$dir" && dir=.
391 if test -f $dir/perl; then
392 PERLPATH="$dir/perl"
393 break
394 fi
395done
396IFS="$saveifs"
397
398if test -z "$YACC"; then
399 echo checking for byacc
400 saveifs="$IFS"; IFS="${IFS}:"
401 for dir in $PATH; do
402 test -z "$dir" && dir=.
403 if test -f $dir/byacc; then
404 YACC="byacc"
405 break
406 fi
407 done
408 IFS="$saveifs"
409fi
410test -z "$YACC" && YACC=""
411
412if test -z "$YACC"; then
413 echo checking for bison
414 saveifs="$IFS"; IFS="${IFS}:"
415 for dir in $PATH; do
416 test -z "$dir" && dir=.
417 if test -f $dir/bison; then
418 YACC="bison -y"
419 break
420 fi
421 done
422 IFS="$saveifs"
423fi
424test -z "$YACC" && YACC="yacc"
425
426
427if test -z "$RANLIB"; then
428 echo checking for ranlib
429 saveifs="$IFS"; IFS="${IFS}:"
430 for dir in $PATH; do
431 test -z "$dir" && dir=.
432 if test -f $dir/ranlib; then
433 RANLIB="ranlib"
434 break
435 fi
436 done
437 IFS="$saveifs"
438fi
439test -z "$RANLIB" && RANLIB="@:"
440
441# Make sure to not get the incompatible SysV /etc/install and
442# /usr/sbin/install, which might be in PATH before a BSD-like install,
443# or the SunOS /usr/etc/install directory, or the AIX /bin/install,
444# or the AFS install, which mishandles nonexistent args. (Sigh.)
445if test -z "$INSTALL"; then
446 echo checking for install
447 saveifs="$IFS"; IFS="${IFS}:"
448 for dir in $PATH; do
449 test -z "$dir" && dir=.
450 case $dir in
451 /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;;
452 *)
453 if test -f $dir/install; then
454 if grep dspmsg $dir/install >/dev/null 2>&1; then
455 : # AIX
456 else
457 INSTALL="$dir/install -c"
458 INSTALL_PROGRAM='$(INSTALL)'
459 INSTALL_DATA='$(INSTALL) -m 644'
460 break
461 fi
462 fi
463 ;;
464 esac
465 done
466 IFS="$saveifs"
467fi
468INSTALL=${INSTALL-cp}
469INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
470INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
471
472echo checking for ln -s
473rm -f conftestdata
474if ln -s X conftestdata 2>/dev/null
475then
476 rm -f conftestdata
477 LN_S="ln -s"
478else
479 LN_S=ln
480fi
481
482
483echo checking for etags C++ option
484for flag in p C
485do
486 test -z "$ETAGSCCFLAG" || break
487 >conftest.c
488 (etags -$flag -o /dev/null conftest.c >/dev/null 2>&1) 2>/dev/null &&
489 ETAGSCCFLAG="-$flag"
490 rm -f conftest.c
491done
492
493echo 'checking for csh # hack'
494cat <<EOF >conftest.sh
495#!/bin/sh
496true || exit 0
497export PATH || exit 0
498exit 1
499EOF
500chmod +x conftest.sh
501if echo ./conftest.sh | (csh >/dev/null 2>&1) >/dev/null 2>&1
502then
503 :; SH_SCRIPT_SED_CMD='1s/.*/:/'
504else
505 :; SH_SCRIPT_SED_CMD=''
506fi
507rm -f conftest.sh
508
509
510echo checking for unistd.h
511echo checking how to run the C preprocessor
512if test -z "$CPP"; then
513 CPP='${CC-cc} -E'
514 cat > conftest.c <<EOF
515#include <stdio.h>
516EOF
517err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
518if test -z "$err"; then
519 :
520else
521 CPP=/lib/cpp
522fi
523rm -f conftest*
524fi
525
526cat > conftest.c <<EOF
527#include <unistd.h>
528EOF
529err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
530if test -z "$err"; then
531 DEFS="$DEFS -DHAVE_UNISTD_H=1"
532fi
533rm -f conftest*
534
535for hdr in dirent.h limits.h sys/dir.h stdlib.h
536do
537trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
538echo checking for ${hdr}
539cat > conftest.c <<EOF
540#include <${hdr}>
541EOF
542err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
543if test -z "$err"; then
544 DEFS="$DEFS -D${trhdr}=1"
545fi
546rm -f conftest*
547done
548
549echo checking for 'C++ <limits.h>'
550cat <<EOF >conftest.cc
551#include <limits.h>
552extern "C" { void exit(int); }
553int main() { exit(0); } void t() { int x = INT_MIN; int y = INT_MAX; int z = UCHAR_MAX; }
554EOF
555if eval $cc_compile; then
556 DEFS="$DEFS -DHAVE_CC_LIMITS_H=1"
557fi
558rm -f conftest*
559echo checking for 'C++ <unistd.h>'
560cat <<EOF >conftest.cc
561#include <unistd.h>
562extern "C" { void exit(int); }
563int main() { exit(0); } void t() { read(0, 0, 0); }
564EOF
565if eval $cc_compile; then
566 DEFS="$DEFS -DHAVE_CC_UNISTD_H=1"
567fi
568rm -f conftest*
569echo checking for declaration of getopt in stdlib.h
570cat <<EOF >conftest.cc
571#include <stdlib.h>
572extern "C" { void exit(int); }
573int main() { exit(0); } void t() { int opt = getopt(0, 0, 0); optarg = "foo"; optind = 1; }
574EOF
575if eval $cc_compile; then
576 DEFS="$DEFS -DSTDLIB_H_DECLARES_GETOPT=1"
577fi
578rm -f conftest*
579echo checking for declaration of getopt in unistd.h
580cat <<EOF >conftest.cc
581#include <sys/types.h>
582#include <unistd.h>
583extern "C" { void exit(int); }
584int main() { exit(0); } void t() { int opt = getopt(0, 0, 0); }
585EOF
586if eval $cc_compile; then
587 DEFS="$DEFS -DUNISTD_H_DECLARES_GETOPT=1"
588fi
589rm -f conftest*
590
591echo checking for declaration of putenv
592cat <<EOF >conftest.cc
593#include <stdlib.h>
594extern "C" { void exit(int); }
595int main() { exit(0); } void t() { putenv((char *)0); }
596EOF
597if eval $cc_compile; then
598 DEFS="$DEFS -DSTDLIB_H_DECLARES_PUTENV=1"
599fi
600rm -f conftest*
601echo checking for time_t
602cat <<EOF >conftest.cc
603#include <time.h>
604extern "C" { void exit(int); }
605int main() { exit(0); } void t() { time_t t = time(0); struct tm *p = localtime(&t); }
606EOF
607if eval $cc_compile; then
608 :
609else
610 DEFS="$DEFS -DLONG_FOR_TIME_T=1"
611fi
612rm -f conftest*
613echo checking for return type of signal handlers
614cat > conftest.c <<EOF
615#include <sys/types.h>
616#include <signal.h>
617#ifdef signal
618#undef signal
619#endif
620extern void (*signal ()) ();
621main() { exit(0); }
622t() { int i; }
623EOF
624if eval $compile; then
625 DEFS="$DEFS -DRETSIGTYPE=void"
626else
627 DEFS="$DEFS -DRETSIGTYPE=int"
628fi
629rm -f conftest*
630
631
632echo checking for struct exception
633cat > conftest.c <<EOF
634#include <math.h>
635main() { exit(0); }
636t() { struct exception e; }
637EOF
638if eval $compile; then
639 DEFS="$DEFS -DHAVE_STRUCT_EXCEPTION=1"
640fi
641rm -f conftest*
642
643echo checking for mmap
644cat > conftest.c <<EOF
645#include <sys/types.h>
646#include <sys/mman.h>
647main() { exit(0); }
648t() { char *p = mmap(0, 0, PROT_READ, MAP_PRIVATE, 0, 0); munmap(p, 0); }
649EOF
650if eval $compile; then
651 DEFS="$DEFS -DHAVE_MMAP=1"
652fi
653rm -f conftest*
654
655echo checking for pid_t in sys/types.h
656echo '#include <sys/types.h>' > conftest.c
657eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
658if egrep "pid_t" conftest.out >/dev/null 2>&1; then
659 :
660else
661 DEFS="$DEFS -Dpid_t=int"
662fi
663rm -f conftest*
664
665echo checking for vfork.h
666cat > conftest.c <<EOF
667#include <vfork.h>
668EOF
669err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
670if test -z "$err"; then
671 DEFS="$DEFS -DHAVE_VFORK_H=1"
672fi
673rm -f conftest*
674
675echo checking for working vfork
676cat > conftest.c <<EOF
677/* Thanks to Paul Eggert for this test. */
678#include <stdio.h>
679#include <sys/types.h>
680#include <sys/stat.h>
681#ifdef HAVE_UNISTD_H
682#include <unistd.h>
683#endif
684#ifdef HAVE_VFORK_H
685#include <vfork.h>
686#endif
687main() {
688 pid_t parent = getpid();
689 pid_t child = vfork();
690
691 if (child == 0) {
692 /* On sparc systems, changes by the child to local and incoming
693 argument registers are propagated back to the parent.
694 The compiler is told about this with #include <vfork.h>,
695 but some compilers (e.g. gcc -O) don't grok <vfork.h>.
696 Test for this by using lots of local variables, at least
697 as many local variables as main has allocated so far
698 including compiler temporaries. 4 locals are enough for
699 gcc 1.40.3 on a sparc, but we use 8 to be safe.
700 A buggy compiler should reuse the register of parent
701 for one of the local variables, since it will think that
702 parent can't possibly be used any more in this routine.
703 Assigning to the local variable will thus munge parent
704 in the parent process. */
705 pid_t
706 p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
707 p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
708 /* Convince the compiler that p..p7 are live; otherwise, it might
709 use the same hardware register for all 8 local variables. */
710 if (p != p1 || p != p2 || p != p3 || p != p4
711 || p != p5 || p != p6 || p != p7)
712 _exit(1);
713
714 /* On some systems (e.g. IRIX 3.3),
715 vfork doesn't separate parent from child file descriptors.
716 If the child closes a descriptor before it execs or exits,
717 this munges the parent's descriptor as well.
718 Test for this by closing stdout in the child. */
719 _exit(close(fileno(stdout)) != 0);
720 } else {
721 int status;
722 struct stat st;
723
724 while (wait(&status) != child)
725 ;
726 exit(
727 /* Was there some problem with vforking? */
728 child < 0
729
730 /* Did the child fail? (This shouldn't happen.) */
731 || status
732
733 /* Did the vfork/compiler bug occur? */
734 || parent != getpid()
735
736 /* Did the file descriptor bug occur? */
737 || fstat(fileno(stdout), &st) != 0
738 );
739 }
740}
741EOF
742eval $compile
743if test -s conftest && (./conftest; exit) 2>/dev/null; then
744 :
745else
746 DEFS="$DEFS -Dvfork=fork"
747fi
748rm -f conftest*
749
750saved_libs="$LIBS"
751LIBS="$LIBS -lm"
752for func in fmod strtol getcwd strerror putenv
753do
754echo checking for ${func}
755cat > conftest.c <<EOF
756
757main() { exit(0); }
758t() {
759/* Override any gcc2 internal prototype to avoid an error. */
760extern char ${func}(); ${func}(); }
761EOF
762if eval $compile; then
763 :
764else
765 LIBOBJS="$LIBOBJS ${func}.o"
766fi
767rm -f conftest*
768
769done
770
771LIBS="$saved_libs"
772for func in rename mkstemp
773do
774trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
775echo checking for ${func}
776cat > conftest.c <<EOF
777#include <stdio.h>
778main() { exit(0); }
779t() {
780#ifdef __stub_${func}
781choke me
782#else
783/* Override any gcc2 internal prototype to avoid an error. */
784extern char ${func}(); ${func}();
785#endif
786 }
787EOF
788if eval $compile; then
789 DEFS="$DEFS -D${trfunc}=1"
790fi
791rm -f conftest*
792#endif
793done
794
795echo checking for sys_siglist
796cat > conftest.c <<EOF
797
798main() { exit(0); }
799t() { extern char *sys_siglist[]; sys_siglist[0] = 0; }
800EOF
801if eval $compile; then
802 DEFS="$DEFS -DHAVE_SYS_SIGLIST=1"
803fi
804rm -f conftest*
805
806echo checking for gcc/g++ delete bug
807cat <<EOF > conftest.cc
808
809#include <stdlib.h>
810#include <stddef.h>
811
812int testit = 0;
813
814int main()
815{
816 testit = 1;
817 int *p = new int;
818 delete p;
819 testit = 0;
820 exit(1);
821}
822
823static unsigned dummy[3];
824
825void *operator new(size_t n)
826{
827 if (testit) {
828 dummy[1] = -(unsigned)(dummy + 2);
829 return dummy + 2;
830 }
831 else
832 return (void *)malloc(n);
833}
834
835void operator delete(void *p)
836{
837 if (testit) {
838 if (p == dummy)
839 exit(0);
840 }
841 else
842 free(p);
843}
844
845EOF
846rm -f conftest
847eval $cc_compile
848if test -s conftest && (./conftest) 2>/dev/null; then
849 DEFS="$DEFS -DCOOKIE_BUG=1"
850fi
851rm -f conftest*
852echo checking for cfront ANSI C INT_MIN bug
853cat <<EOF > conftest.cc
854#include <stdlib.h>
855#ifdef HAVE_CC_LIMITS_H
856#include <limits.h>
857#else
858#define INT_MAX 2147483647
859#endif
860
861#undef INT_MIN
862#define INT_MIN (-INT_MAX-1)
863
864int main()
865{
866 int z = 0;
867 exit(INT_MIN < z);
868}
869
870EOF
871rm -f conftest
872eval $cc_compile
873if test -s conftest && (./conftest) 2>/dev/null; then
874 DEFS="$DEFS -DCFRONT_ANSI_BUG=1"
875fi
876rm -f conftest*
877echo checking for new array delete syntax
878cat <<EOF >conftest.cc
879
880extern "C" { void exit(int); }
881int main() { exit(0); } void t() { char *p = new char[5]; delete [] p; }
882EOF
883if eval $cc_compile; then
884 :
885else
886 DEFS="$DEFS -DARRAY_DELETE_NEEDS_SIZE=1"
887fi
888rm -f conftest*
889echo checking for traditional preprocessor
890cat <<EOF >conftest.cc
891#define name2(a,b) a/**/b
892extern "C" { void exit(int); }
893int main() { exit(0); } void t() { int name2(foo,bar); }
894EOF
895if eval $cc_compile; then
896 DEFS="$DEFS -DTRADITIONAL_CPP=1"
897fi
898rm -f conftest*
899echo checking for w_coredump
900cat > conftest.c <<EOF
901
902#include <sys/types.h>
903#include <sys/wait.h>
904main()
905{
906#ifdef WCOREFLAG
907 exit(1);
908#else
909 int i = 0;
910 ((union wait *)&i)->w_coredump = 1;
911 exit(i != 0200);
912#endif
913}
914
915EOF
916eval $compile
917if test -s conftest && (./conftest; exit) 2>/dev/null; then
918 DEFS="$DEFS -DWCOREFLAG=0200"
919fi
920rm -f conftest*
921test -n "${BROKEN_SPOOLER_FLAGS}" || BROKEN_SPOOLER_FLAGS=7
922echo using default value of ${BROKEN_SPOOLER_FLAGS} for grops -b option
923
924
925if test -z "$PAGE" && test -r $prefix/lib/groff/font/devps/DESC
926then
927 if grep "^paperlength 841890" \
928 $prefix/lib/groff/font/devps/DESC >/dev/null 2>&1
929 then
930 PAGE=A4
931 else
932 PAGE=letter
933 fi
934fi
935if test -z "$PAGE"
936then
937 dom=`awk '($1 == "dom" || $1 == "search") { print $2; exit}' \
938 /etc/resolv.conf 2>/dev/null`
939
940 if test -z "$dom"
941 then
942 dom=`(domainname) 2>/dev/null | tr -d '+'`
943 if test -z "$dom"
944 then
945 dom=`(hostname) 2>/dev/null | grep '\.'`
946 fi
947 fi
948
949 # If the top-level domain is two letters and it's not `us' or `ca'
950 # then they probably use A4 paper.
951 case "$dom" in
952 *.[Uu][Ss]|*.[Cc][Aa]) ;;
953 *.[A-Za-z][A-Za-z]) PAGE=A4 ;;
954 esac
955fi
956test -n "$PAGE" || PAGE=letter
957echo guessing $PAGE size paper
958
959if test -n "$prefix"; then
960 test -z "$exec_prefix" && exec_prefix='${prefix}'
961 prsub="s%^prefix\\([ ]*\\)=\\([ ]*\\).*$%prefix\\1=\\2$prefix%"
962fi
963if test -n "$exec_prefix"; then
964 prsub="$prsub
965s%^exec_prefix\\([ ]*\\)=\\([ ]*\\).*$%\
966exec_prefix\\1=\\2$exec_prefix%"
967fi
968
969trap 'rm -f config.status; exit 1' 1 3 15
970echo creating config.status
971rm -f config.status
972cat > config.status <<EOF
973#!/bin/sh
974# Generated automatically by configure.
975# Run this file to recreate the current configuration.
976# This directory was configured as follows,
977# on host `(hostname || uname -n) 2>/dev/null`:
978#
979# $0 $*
980
981for arg
982do
983 case "\$arg" in
984 -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
985 exec /bin/sh $0 $* ;;
986 *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
987 esac
988done
989
990trap 'rm -f Makefile; exit 1' 1 3 15
991CC='$CC'
992CCLIBS='$CCLIBS'
993CCC='$CCC'
994LPR='$LPR'
995LP='$LP'
996LPQ='$LPQ'
997PSPRINT='$PSPRINT'
998DVIPRINT='$DVIPRINT'
999PERLPATH='$PERLPATH'
1000YACC='$YACC'
1001RANLIB='$RANLIB'
1002INSTALL='$INSTALL'
1003INSTALL_PROGRAM='$INSTALL_PROGRAM'
1004INSTALL_DATA='$INSTALL_DATA'
1005LN_S='$LN_S'
1006ETAGSCCFLAG='$ETAGSCCFLAG'
1007SH_SCRIPT_SED_CMD='$SH_SCRIPT_SED_CMD'
1008CPP='$CPP'
1009LIBOBJS='$LIBOBJS'
1010BROKEN_SPOOLER_FLAGS='$BROKEN_SPOOLER_FLAGS'
1011PAGE='$PAGE'
1012LIBS='$LIBS'
1013srcdir='$srcdir'
1014DEFS='$DEFS'
1015prefix='$prefix'
1016exec_prefix='$exec_prefix'
1017prsub='$prsub'
1018EOF
1019cat >> config.status <<\EOF
1020
1021top_srcdir=$srcdir
1022for file in .. Makefile; do if [ "x$file" != "x.." ]; then
1023 srcdir=$top_srcdir
1024 # Remove last slash and all that follows it. Not all systems have dirname.
1025 dir=`echo $file|sed 's%/[^/][^/]*$%%'`
1026 if test "$dir" != "$file"; then
1027 test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
1028 test ! -d $dir && mkdir $dir
1029 fi
1030 echo creating $file
1031 rm -f $file
1032 echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
1033 sed -e "
1034$prsub
1035s%@CC@%$CC%g
1036s%@CCLIBS@%$CCLIBS%g
1037s%@CCC@%$CCC%g
1038s%@LPR@%$LPR%g
1039s%@LP@%$LP%g
1040s%@LPQ@%$LPQ%g
1041s%@PSPRINT@%$PSPRINT%g
1042s%@DVIPRINT@%$DVIPRINT%g
1043s%@PERLPATH@%$PERLPATH%g
1044s%@YACC@%$YACC%g
1045s%@RANLIB@%$RANLIB%g
1046s%@INSTALL@%$INSTALL%g
1047s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
1048s%@INSTALL_DATA@%$INSTALL_DATA%g
1049s%@LN_S@%$LN_S%g
1050s%@ETAGSCCFLAG@%$ETAGSCCFLAG%g
1051s%@SH_SCRIPT_SED_CMD@%$SH_SCRIPT_SED_CMD%g
1052s%@CPP@%$CPP%g
1053s%@LIBOBJS@%$LIBOBJS%g
1054s%@BROKEN_SPOOLER_FLAGS@%$BROKEN_SPOOLER_FLAGS%g
1055s%@PAGE@%$PAGE%g
1056s%@LIBS@%$LIBS%g
1057s%@srcdir@%$srcdir%g
1058s%@DEFS@%$DEFS%
1059" $top_srcdir/${file}.in >> $file
1060fi; done
1061
1062EOF
1063chmod +x config.status
1064test -n "$no_create" || ./config.status
1065