xref: /386bsd/usr/src/libexec/uucp/configure (revision a2142627)
1:
2# Guess values for system-dependent variables and create Makefiles.
3# Generated automatically by autoconf.
4# Copyright (C) 1991 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] [TARGET]
21# All args except --srcdir=DIR are ignored.
22
23trap 'rm -f conftest conftest.c; exit 1' 1 3 15
24
25set +u # Make sure unset variables are ok.
26
27for arg in $*; do
28  # Handle --srcdir with a space before the argument.
29  if test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
30  # Handle --host with a space before the argument.
31  elif test x$next_host = xyes; then next_host=
32  else
33    case $arg in
34     +srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
35	srcdir=`echo $arg | sed 's/[+-]s[a-z]*=//'` ;;
36     +srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
37	next_srcdir=yes ;;
38     +host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
39     +host | --host | --hos | --ho | --h)
40	next_host=yes ;;
41     +gas | --gas | --ga | --g) ;;
42     +nfp | --nfp | --nf | --n) ;;
43     *) ;;
44    esac
45  fi
46done
47
48INCLUDEDIR=${INCLUDEDIR-/usr/include}
49
50rm -f conftest conftest.c
51compile='$CC $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
52
53# A filename unique to this package, relative to the directory that
54# configure is in, which we can look for to find out if srcdir is correct.
55unique_file=uucico.c
56
57# Makefile rules whose targets are searched for in VPATH need to use $<.
58# However, old makes do not support it, so we use a combination
59# construction in Makefile.in: `$file<'.
60# If srcdir is `.', we use sed to change that to `file' for old makes.
61# Otherwise, we use sed to change it to `$<'.
62# vpsub is the sed program, which changes `$file<' to one or the other.
63vpsub='s,\$\([-./a-zA-Z0-9_][-./a-zA-Z0-9_]*\)<,\1,g'
64# Find the source files, if location was not specified.
65if test x$srcdir = x; then
66  srcdirdefaulted=yes; srcdir=.
67  if test ! -r $unique_file; then srcdir=`pwd`/..; fi
68fi
69if test $srcdir != .; then
70  VPATH='VPATH = $(srcdir)'
71  vpsub='s,\$\([-./a-zA-Z0-9_][-./a-zA-Z0-9_]*\)<,\$<,g'
72fi
73
74if test ! -r $srcdir/$unique_file; then
75  if test x$srcdirdefaulted = xyes; then
76    echo "configure: Can not find sources in \`.' or \`..'." 1>&2
77  else
78    echo "configure: Can not find sources in \`${srcdir}'." 1>&2
79  fi
80  exit 1
81fi
82
83# The Bourne shell writes "command not found" to /dev/tty, so if we get
84# a usage message on stderr, we have the program.
85#
86# ksh and zsh write "command not found" to stderr, but test -n does not
87# want any output if there is no program.  So we use the `type' builtin
88# instead for them (and bash).
89if test "$RANDOM" = "$RANDOM"; then
90  checkfor='test -n "`$checkprog $checkargs 2>&1`"'
91else
92  checkfor='type $checkprog >/dev/null'
93fi
94
95
96exec 6>conf.h
97trap 'rm -f conftest conftest.c conf.h; exit 1' 1 3 15
98echo 1>&6 "/* conf.h */"
99
100echo 1>&6 "/* Configuration header file for Taylor UUCP.
101   Generated on `date`.  */
102"
103echo checking for install
104# Make sure to not get the incompatible SysV /etc/install.
105if test -z "$INSTALL" || test -z "$INSTALLDATA"; then
106  saveifs="$IFS"; IFS="$IFS:"
107  for dir in $PATH; do
108    test -z "$dir" && dir=.
109    if test $dir != /etc && test -f $dir/install; then
110      test -z "$INSTALL" && INSTALL="$dir/install -c"
111      test -z "$INSTALLDATA" && INSTALLDATA="$dir/install -c -m 644"
112      break
113    fi
114  done
115  IFS="$saveifs"
116fi
117INSTALL=${INSTALL-cp}
118INSTALLDATA=${INSTALLDATA-cp}
119
120echo checking for gcc
121checkprog=gcc checkargs=''
122test -z "$CC" && eval $checkfor && CC='gcc -O'
123CC=${CC-cc}
124
125CFLAGS=${CFLAGS--g}
126echo checking for mail program
127echo 1>&6 "/* Set MAIL_PROGRAM to a program which takes a mail address as an argument
128   and accepts a mail message to send to that address on stdin.  */
129#define MAIL_PROGRAM `if test -s /usr/ucb/mail; then echo '"/usr/ucb/mail"'; else if test -s /bin/mail; then echo '"/bin/mail"'; else echo 'undefined'; fi; fi`"
130echo checking for echo program
131echo 1>&6 "
132/* Set ECHO_PROGRAM to a program which echoes its arguments; if echo
133   is a shell builtin you can just use \"echo\".  */
134#define ECHO_PROGRAM `if test -s /bin/echo; then echo '"/bin/echo"'; else echo '"echo"'; fi`"
135echo checking for symbolic links
136if ln -s X NoSucHFile 2>/dev/null; then
137  LN_S='ln -s'
138else
139  LN_S='ln'
140fi
141rm -f NoSucHFile
142
143echo 1>&6 "
144/* The following macros indicate what header files you have.  Set the
145   macro to 1 if you have the corresponding header file, or 0 if you
146   do not.  */"
147for hdr in string.h strings.h unistd.h stdlib.h limits.h time.h
148do
149havehdr=HAVE_`echo ${hdr} | tr "[a-z]./" "[A-Z]__"`
150echo checking for ${hdr}
151echo 1>&6 "#define ${havehdr} `if test -f $INCLUDEDIR/${hdr}; then echo 1; else echo 0; fi`   	/* <${hdr}> */"
152done
153for hdr in sys/wait.h sys/ioctl.h dirent.h memory.h sys/param.h
154do
155havehdr=HAVE_`echo ${hdr} | tr "[a-z]./" "[A-Z]__"`
156echo checking for ${hdr}
157echo 1>&6 "#define ${havehdr} `if test -f $INCLUDEDIR/${hdr}; then echo 1; else echo 0; fi`   	/* <${hdr}> */"
158done
159for hdr in utime.h fcntl.h sys/file.h libc.h sysexits.h
160do
161havehdr=HAVE_`echo ${hdr} | tr "[a-z]./" "[A-Z]__"`
162echo checking for ${hdr}
163echo 1>&6 "#define ${havehdr} `if test -f $INCLUDEDIR/${hdr}; then echo 1; else echo 0; fi`   	/* <${hdr}> */"
164done
165for hdr in poll.h stropts.h
166do
167havehdr=HAVE_`echo ${hdr} | tr "[a-z]./" "[A-Z]__"`
168echo checking for ${hdr}
169echo 1>&6 "#define ${havehdr} `if test -f $INCLUDEDIR/${hdr}; then echo 1; else echo 0; fi`   	/* <${hdr}> */"
170done
171
172echo 1>&6 ""
173echo checking for signal handler type
174pattern='void[ 	]*(\*signal[ 	]*('
175echo 1>&6 "/* Set SIGtype to the return type of a signal handler.  On newer systems
176   this will be void; some older systems use int.  */
177#define SIGtype `if grep "$pattern" $INCLUDEDIR/signal.h >/dev/null 2>&1 ||
178     grep "$pattern" $INCLUDEDIR/sys/signal.h >/dev/null 2>&1; then
179    echo void
180  else
181    echo int
182  fi`"
183
184echo checking for time_t in time.h
185echo "#include <time.h>
186main() { exit(0); } t() { time_t i; }" > conftest.c
187eval $compile
188echo 1>&6 "
189/* Set HAVE_TIME_T to 1 if time_t is defined in <time.h>, as required by
190   the ANSI C standard.  */
191#define HAVE_TIME_T `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
192rm -f conftest conftest.c
193
194echo checking for time_t in sys/types.h
195echo "#include <sys/types.h>
196main() { exit(0); } t() { time_t i; }" > conftest.c
197eval $compile
198echo 1>&6 "
199/* Set HAVE_SYS_TIME_T to 1 if time_t is defined in <sys/types.h>;  this
200   is only checked if HAVE_TIME_T is 0.  */
201#define HAVE_SYS_TIME_T `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
202rm -f conftest conftest.c
203
204echo 1>&6 ""
205echo checking for time.h and sys/time.h being included together
206echo "#include <sys/time.h>
207#include <time.h>
208main () { exit (0); }" > conftest.c
209eval $compile
210echo 1>&6 "/* Set HAVE_SYS_TIME_AND_TIME_H to 1 if <time.h> and <sys/time.h> can both
211   be included in a single source file; if you don't have either or both of
212   them, it doesn't matter what you set this to.  */
213#define HAVE_SYS_TIME_AND_TIME_H `(if test -f $INCLUDEDIR/time.h -a -f $INCLUDEDIR/sys/time.h -a -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
214rm -f conftest conftest.c
215
216echo 1>&6 ""
217echo checking for termios.h and sys/ioctl.h being included together
218echo "#include <termios.h>
219#include <sys/ioctl.h>
220main () { exit (0); }" > conftest.c
221eval $compile
222echo 1>&6 "/* Set HAVE_TERMIOS_AND_SYS_IOCTL_H to 1 if <termios.h> and <sys/ioctl.h>
223   can both be included in a single source file; if you don't have either
224   or both of them, it doesn't matter what you set this to.  */
225#define HAVE_TERMIOS_AND_SYS_IOCTL_H `(if test -f $INCLUDEDIR/termios.h -a -f $INCLUDEDIR/sys/ioctl.h -a -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
226rm -f conftest conftest.c
227
228echo 1>&6 ""
229echo checking for CBREAK
230echo "#include <sgtty.h>
231main() { exit(0); } t() { int i = CBREAK; }" > conftest.c
232eval $compile
233echo 1>&6 "/* If you are configuring by hand, you should set one of the terminal
234   driver options in policy.h.  If you are autoconfiguring, the script
235   will check whether your system defines CBREAK, which is a terminal
236   setting; if your system supports CBREAK, and you don't set a terminal
237   driver in policy.h, the code will assume that you have a BSD style
238   terminal driver.  */
239#define HAVE_CBREAK `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
240rm -f conftest conftest.c
241
242echo 1>&6 "
243/* The package needs several standard types.  If you are using the
244   configure script, it will look in standard places for these types,
245   and give default definitions for them here if it doesn't find them.
246   The default definitions should work on most systems, but you may
247   want to check them.  If you are configuring by hand, you will have
248   to figure out whether the types are defined on your system, and
249   what they should be defined to.
250
251   Each of the types should be defined using #define.  For example,
252   #define pid_t int
253   */"
254echo 1>&6 "
255/* The type pid_t is used to hold a process ID number.  It is normally
256   defined in <sys/types.h>.  This is the type returned by the
257   functions fork or getpid.  Usually int will work fine.  */"
258echo checking for pid_t in sys/types.h
259echo "#include <sys/types.h>
260main() { exit(0); } t() {pid_t x; }" >conftest.c
261eval $compile
262if test -s conftest && ./conftest 2>/dev/null; then
263 echo 1>&6 "/* A definition of pid_t was found on your system.  */"
264else
265 echo 1>&6 "#define pid_t int"
266fi
267rm -f conftest conftest.c
268
269echo 1>&6 "
270/* The type uid_t is used to hold a user ID number.  It is normally
271   defined in <sys/types.h>.  This is the type returned by the getuid
272   function.  Usually int will work fine.  */"
273echo checking for uid_t in sys/types.h
274echo "#include <sys/types.h>
275main() { exit(0); } t() {uid_t x; }" >conftest.c
276eval $compile
277if test -s conftest && ./conftest 2>/dev/null; then
278 echo 1>&6 "/* A definition of uid_t was found on your system.  */"
279else
280 echo 1>&6 "#define uid_t int"
281fi
282rm -f conftest conftest.c
283
284echo 1>&6 "
285/* The type gid_t is used to hold a group ID number.  It is sometimes
286   defined in <sys/types.h>.  This is the type returned by the getgid
287   function.  Usually int will work fine.  */"
288echo checking for gid_t in sys/types.h
289echo "#include <sys/types.h>
290main() { exit(0); } t() {gid_t x; }" >conftest.c
291eval $compile
292if test -s conftest && ./conftest 2>/dev/null; then
293 echo 1>&6 "/* A definition of gid_t was found on your system.  */"
294else
295 echo 1>&6 "#define gid_t int"
296fi
297rm -f conftest conftest.c
298
299echo 1>&6 "
300/* The type off_t is used to hold an offset in a file.  It is sometimes
301   defined in <sys/types.h>.  This is the type of the second argument to
302   the lseek function.  Usually long will work fine.  */"
303echo checking for off_t in sys/types.h
304echo "#include <sys/types.h>
305main() { exit(0); } t() {off_t x; }" >conftest.c
306eval $compile
307if test -s conftest && ./conftest 2>/dev/null; then
308 echo 1>&6 "/* A definition of off_t was found on your system.  */"
309else
310 echo 1>&6 "#define off_t long"
311fi
312rm -f conftest conftest.c
313
314
315echo checking for sig_atomic_t in signal.h
316echo "#include <signal.h>
317main() { exit(0); } t() { sig_atomic_t x; }" > conftest.c
318eval $compile
319echo 1>&6 "
320/* Set HAVE_SIG_ATOMIC_T_IN_SIGNAL_H if the type sig_atomic_t is defined
321   in <signal.h> as required by ANSI C.  */
322#define HAVE_SIG_ATOMIC_T_IN_SIGNAL_H `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
323rm -f conftest conftest.c
324
325echo checking for sig_atomic_t in sys/types.h
326echo "#include <sys/types.h>
327main() { exit(0); } t() { sig_atomic_t x; }" > conftest.c
328eval $compile
329echo 1>&6 "
330/* Set HAVE_SIG_ATOMIC_T_IN_TYPES_H if the type sig_atomic_t is defined
331   in <sys/types.h>.  This is ignored if HAVE_SIG_ATOMIC_T_IN_SIGNAL_H is
332   set to 1.  */
333#define HAVE_SIG_ATOMIC_T_IN_TYPES_H `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
334rm -f conftest conftest.c
335
336echo 1>&6 "
337/* The type sig_atomic_t is used to hold a value which may be
338   referenced in a single atomic operation.  If it is not defined in
339   either <signal.h> or <sys/types.h>, you may want to give it a
340   definition here (if you don't, the code will use char).  If your
341   compiler does not support sig_atomic_t, there is no type which is
342   really correct; fortunately, for this package it does not really
343   matter very much.  */"
344
345echo checking how to get filesystem info
346echo 1>&6 "
347/* When Taylor UUCP is talking to another instance of itself, it will
348   tell the other side the size of a file before it is transferred.
349   If the package can determine how much disk space is available, it
350   will use this information to avoid filling up the disk.  Define one
351   of the following macros to tell the code how to determine the
352   amount of available disk space.  It is possible that none of these
353   are appropriate; it will do no harm to use none of them, but, of
354   course, nothing will then prevent the package from filling up the
355   disk.  Note that this space check is only useful when talking to
356   another instance of Taylor UUCP.
357
358   FS_STATVFS    the statvfs function
359   FS_USG_STATFS the four argument statfs function
360   FS_MNTENT     the two argument statfs function with the f_bsize field
361   FS_STATFS     the two argument statfs function with the f_fsize field
362   FS_GETMNT     the two argument statfs function with the fd_req field
363   FS_USTAT      the ustat function with 512 byte blocks.  */"
364if test -f $INCLUDEDIR/sys/statvfs.h -a -f $INCLUDEDIR/sys/fstyp.h; then
365  echo 1>&6 "#define FS_STATVFS "
366elif test -f $INCLUDEDIR/sys/statfs.h -a -f $INCLUDEDIR/sys/fstyp.h; then
367  echo 1>&6 "#define FS_USG_STATFS "
368elif test -f $INCLUDEDIR/mntent.h; then
369  echo 1>&6 "#define FS_MNTENT "
370elif test -f $INCLUDEDIR/sys/mount.h -a -f $INCLUDEDIR/sys/fs_types.h; then
371  echo 1>&6 "#define FS_GETMNT "
372elif grep MOUNT_UFS $INCLUDEDIR/sys/mount.h >/dev/null 2>&1; then
373  echo 1>&6 "#define FS_STATFS "
374else
375  echo checking for ustat
376echo "
377main() { exit(0); } t() { ustat(); }" > conftest.c
378eval $compile
379if test -s conftest && ./conftest 2>/dev/null; then
380  echo 1>&6 "#define FS_USTAT "
381fi
382rm -f conftest conftest.c
383
384fi
385
386echo checking for void
387echo "void main() { (void) exit (0); }" > conftest.c
388eval $compile
389echo 1>&6 "
390/* Set HAVE_VOID to 1 if the compiler supports declaring functions with
391   a return type of void and casting values to void.  */
392#define HAVE_VOID `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
393rm -f conftest.c conftest
394
395echo checking for unsigned char
396echo "main () { unsigned char i = (unsigned char) -1; exit (0); }" > conftest.c
397eval $compile
398echo 1>&6 "
399/* Set HAVE_UNSIGNED_CHAR to 1 if the compiler supports the type unsigned
400   char.  */
401#define HAVE_UNSIGNED_CHAR `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
402rm -f conftest.c conftest
403
404echo checking for "int.*errno" in "errno.h"
405echo 1>&6 "
406/* Set HAVE_ERRNO_DECLARATION to 1 if errno is declared in <errno.h>.  */
407#define HAVE_ERRNO_DECLARATION `if grep 'int.*errno' $INCLUDEDIR/errno.h >/dev/null 2>&1; then echo 1; else echo 0; fi`"
408
409echo checking for combined use of O_NONBLOCK and O_NDELAY
410echo "#include <fcntl.h>
411#ifndef O_NDELAY
412#ifdef FNDELAY
413#define O_NDELAY FNDELAY
414#else
415#define O_NDELAY 0
416#endif
417#endif
418#ifndef O_NONBLOCK
419#ifdef FNBLOCK
420#define O_NONBLOCK FNBLOCK
421#else
422#define O_NONBLOCK 0
423#endif
424#endif
425main () { exit (fcntl (open ("'"conftest.c"'", O_RDONLY),
426		       F_SETFL,
427		       O_NONBLOCK | O_NDELAY)); }" > conftest.c
428eval $compile
429echo 1>&6 "
430/* Set COMBINED_UNBLOCK to 1 if the flags O_NONBLOCK and O_NDELAY can
431   both be specified at once on a file descriptor.  If your system
432   does not support both flags, it doesn't matter what you set this
433   to.  */
434#define COMBINED_UNBLOCK `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
435
436echo checking for alloca
437echo "#ifdef __GNUC__
438#define alloca __builtin_alloca
439#else /* ! defined(__GNUC__) */
440#ifdef sparc
441#include <alloca.h>
442#else /* ! defined (sparc) */
443#ifdef _AIX
444 #pragma alloca
445#else /* ! defined (_AIX) */
446char *alloca ();
447#endif /* ! defined (_AIX) */
448#endif /* ! defined (sparc) */
449#endif /* ! defined (__GNUC__) */
450main() { exit(0); } t() { char *p = (char *) alloca(1); }" > conftest.c
451eval $compile
452if test -s conftest && ./conftest 2>/dev/null; then :
453else
454  OLIBS=$LIBS
455  if test -f /usr/ucblib/libucb.a; then
456    LIBS="$LIBS -L/usr/ucblib -lucb" # SVR4
457  elif test -f /lib/libPW.a; then
458    LIBS="$LIBS -lPW" # SVR2 and SVR3
459  else
460    ALLOCA=alloca.o
461  fi
462  if test "$OLIBS" != "$LIBS"; then
463    eval $compile
464    if test -s conftest && ./conftest 2>/dev/null; then :
465    else
466      LIBS=$OLIBS
467      ALLOCA=alloca.o
468    fi
469  fi
470fi
471
472echo 1>&6 "
473/* There are now a number of functions to check for.  For each of these,
474   the macro HAVE_FUNC should be set to 1 if your system has FUNC.  For
475   example, HAVE_STRERROR should be set to 1 if your system has strerror,
476   0 otherwise.  */"
477
478echo 1>&6 "
479/* Taylor UUCP provides its own versions of the following functions,
480   or knows how to work around their absence.  */"
481
482for func in memset memcmp memchr memcpy bcopy bcmp bzero
483do
484havefunc=HAVE_`echo ${func} | tr "[a-z]" "[A-Z]"`
485echo checking for ${func}
486echo "main() { exit (0); } t() { ${func}(); }" > conftest.c
487eval $compile
488echo 1>&6 "#define ${havefunc} `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
489rm -f conftest conftest.c
490done
491
492echo checking for memmove
493echo "main () { exit (0); } t() { memmove(); }" > conftest.c
494eval $compile
495havememmove=`(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`
496rm -f conftest conftest.c
497if test "${havememmove}" != "1"; then
498  echo 1>&6 "#define HAVE_MEMMOVE 0"
499else
500        echo "main()
501  {
502     register int x1, x2, x3;
503     char s[2];
504
505     x1 = 1;
506     x2 = 2;
507     x3 = 3;
508     memmove(s, "'""'", 1);
509     exit((x1 != 1) || (x2 != 2) || (x3 != 3));
510  }" > conftest.c
511      cc -o conftest conftest.c >/dev/null 2>/dev/null
512  if test ! -s ./conftest; then
513        echo 1>&6 "#define HAVE_MEMMOVE 1"
514  elif ./conftest 2>/dev/null; then
515    echo 1>&6 "#define HAVE_MEMMOVE 1"
516  else
517    echo 1>&6 "#define HAVE_MEMMOVE 0    /* Your memmove seems to be buggy.  */"
518  fi
519  rm -f conftest conftest.c
520fi
521
522for func in strchr strrchr index rindex strerror strtol strstr
523do
524havefunc=HAVE_`echo ${func} | tr "[a-z]" "[A-Z]"`
525echo checking for ${func}
526echo "main() { exit (0); } t() { ${func}(); }" > conftest.c
527eval $compile
528echo 1>&6 "#define ${havefunc} `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
529rm -f conftest conftest.c
530done
531for func in strdup strcasecmp stricmp strlwr bsearch vfprintf
532do
533havefunc=HAVE_`echo ${func} | tr "[a-z]" "[A-Z]"`
534echo checking for ${func}
535echo "main() { exit (0); } t() { ${func}(); }" > conftest.c
536eval $compile
537echo 1>&6 "#define ${havefunc} `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
538rm -f conftest conftest.c
539done
540for func in remove ftruncate ltrunc rename opendir dup2 waitpid wait4
541do
542havefunc=HAVE_`echo ${func} | tr "[a-z]" "[A-Z]"`
543echo checking for ${func}
544echo "main() { exit (0); } t() { ${func}(); }" > conftest.c
545eval $compile
546echo 1>&6 "#define ${havefunc} `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
547rm -f conftest conftest.c
548done
549
550echo 1>&6 "
551/* If you have either sigsetjmp or setret, it will be used instead of
552   setjmp.  These functions will only be used if your system restarts
553   system calls after interrupts (see HAVE_RESTARTABLE_SYSCALLS,
554   below).  */"
555for func in sigsetjmp setret
556do
557havefunc=HAVE_`echo ${func} | tr "[a-z]" "[A-Z]"`
558echo checking for ${func}
559echo "main() { exit (0); } t() { ${func}(); }" > conftest.c
560eval $compile
561echo 1>&6 "#define ${havefunc} `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
562rm -f conftest conftest.c
563done
564
565echo 1>&6 "
566/* The code needs to know what function to use to set a signal
567   handler.  If will try to use each of the following functions in
568   turn.  If none are available, it will use signal, which is assumed
569   to always exist.  */"
570for func in sigaction sigvec sigset
571do
572havefunc=HAVE_`echo ${func} | tr "[a-z]" "[A-Z]"`
573echo checking for ${func}
574echo "main() { exit (0); } t() { ${func}(); }" > conftest.c
575eval $compile
576echo 1>&6 "#define ${havefunc} `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
577rm -f conftest conftest.c
578done
579
580echo 1>&6 "
581/* The code will try to use each of the following functions in turn
582   when blocking signals from delivery.  If none are available, a
583   relatively unimportant race condition will exist.  */"
584for func in sigprocmask sigblock sighold
585do
586havefunc=HAVE_`echo ${func} | tr "[a-z]" "[A-Z]"`
587echo checking for ${func}
588echo "main() { exit (0); } t() { ${func}(); }" > conftest.c
589eval $compile
590echo 1>&6 "#define ${havefunc} `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
591rm -f conftest conftest.c
592done
593
594echo 1>&6 "
595/* If you have either of the following functions, it will be used to
596   determine the number of file descriptors which may be open.
597   Otherwise, the code will use OPEN_MAX if defined, then NOFILE if
598   defined, then 20.  */"
599for func in getdtablesize sysconf
600do
601havefunc=HAVE_`echo ${func} | tr "[a-z]" "[A-Z]"`
602echo checking for ${func}
603echo "main() { exit (0); } t() { ${func}(); }" > conftest.c
604eval $compile
605echo 1>&6 "#define ${havefunc} `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
606rm -f conftest conftest.c
607done
608
609echo 1>&6 "
610/* The code will use one of the following functions when detaching
611   from a terminal.  One of these must exist.  */"
612for func in setpgrp setsid
613do
614havefunc=HAVE_`echo ${func} | tr "[a-z]" "[A-Z]"`
615echo checking for ${func}
616echo "main() { exit (0); } t() { ${func}(); }" > conftest.c
617eval $compile
618echo 1>&6 "#define ${havefunc} `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
619rm -f conftest conftest.c
620done
621
622echo 1>&6 "
623/* If you do not specify the local node name in the main configuration
624   file, Taylor UUCP will try to use each of the following functions
625   in turn.  If neither is available, you must specify the local node
626   name in the configuration file.  */"
627for func in gethostname uname
628do
629havefunc=HAVE_`echo ${func} | tr "[a-z]" "[A-Z]"`
630echo checking for ${func}
631echo "main() { exit (0); } t() { ${func}(); }" > conftest.c
632eval $compile
633echo 1>&6 "#define ${havefunc} `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
634rm -f conftest conftest.c
635done
636
637echo 1>&6 "
638/* The code will try to use each of the following functions in turn to
639   determine the current time.  If none are available, it will use
640   time, which is assume to always exist.  */"
641for func in gettimeofday
642do
643havefunc=HAVE_`echo ${func} | tr "[a-z]" "[A-Z]"`
644echo checking for ${func}
645echo "main() { exit (0); } t() { ${func}(); }" > conftest.c
646eval $compile
647echo 1>&6 "#define ${havefunc} `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
648rm -f conftest conftest.c
649done
650
651echo checking for ftime
652echo "main () { exit (0); } t() { ftime(); }" > conftest.c
653eval $compile
654haveftime=`(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`
655rm -f conftest conftest.c
656if test "${haveftime}" != "1"; then
657  echo 1>&6 "#define HAVE_FTIME 0"
658else
659    echo "#include <sys/types.h>
660  #include <sys/timeb.h>
661  main ()
662  {
663    struct timeb s, slast;
664    int c = 0;
665    ftime (&slast);
666    while (c < 10)
667      {
668        ftime (&s);
669        if (s.time < slast.time
670	    || (s.time == slast.time && s.millitm < slast.millitm))
671	  exit (1);
672	if (s.time != slast.time)
673	  ++c;
674        slast.time = s.time;
675	slast.millitm = s.millitm;
676      }
677    exit (0);
678  }" > conftest.c
679  eval $compile
680  if test -s ./conftest && ./conftest 2>/dev/null; then
681    echo 1>&6 "#define HAVE_FTIME 1"
682  else
683    echo 1>&6 "#define HAVE_FTIME 0    /* Your ftime seems to be buggy.  */"
684  fi
685  rm -f conftest conftest.c
686fi
687
688echo 1>&6 "
689/* If neither gettimeofday nor ftime is available, the code will use
690   times (if available) to measure a span of time.  See also the
691   discussion of TIMES_TICK in policy.h.  */"
692for func in times
693do
694havefunc=HAVE_`echo ${func} | tr "[a-z]" "[A-Z]"`
695echo checking for ${func}
696echo "main() { exit (0); } t() { ${func}(); }" > conftest.c
697eval $compile
698echo 1>&6 "#define ${havefunc} `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
699rm -f conftest conftest.c
700done
701
702echo 1>&6 "
703/* When a chat script requests a pause of less than a second with \\p,
704   Taylor UUCP will try to use each of the following functions in
705   turn.  If none are available, it will sleep for a full second.
706   Also, the (non-portable) tstuu program requires either select or
707   poll.  */"
708for func in napms nap usleep poll select
709do
710havefunc=HAVE_`echo ${func} | tr "[a-z]" "[A-Z]"`
711echo checking for ${func}
712echo "main() { exit (0); } t() { ${func}(); }" > conftest.c
713eval $compile
714echo 1>&6 "#define ${havefunc} `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
715rm -f conftest conftest.c
716done
717echo '#include <stdio.h>
718#include "conf.h"
719main ()
720{
721#if ! HAVE_NAPMS
722#if ! HAVE_NAP
723#if ! HAVE_USLEEP
724#if ! HAVE_POLL
725#if ! HAVE_SELECT
726  fprintf (stderr, "WARNING: No way to sleep for less than one second\n");
727  fprintf (stderr, "         \\p in chat scripts will sleep for a full second\n");
728#endif
729#endif
730#endif
731#endif
732#endif
733}' > conftest.c
734eval $compile
735if test -s ./conftest; then
736  ./conftest
737fi
738rm -f conftest conftest.c
739
740echo 1>&6 "
741/* If the getgrent function is available, it will be used to determine
742   all the groups a user belongs to when checking file access
743   permissions.  */"
744for func in getgrent
745do
746havefunc=HAVE_`echo ${func} | tr "[a-z]" "[A-Z]"`
747echo checking for ${func}
748echo "main() { exit (0); } t() { ${func}(); }" > conftest.c
749eval $compile
750echo 1>&6 "#define ${havefunc} `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
751rm -f conftest conftest.c
752done
753
754echo 1>&6 "
755/* If the socket function is available, TCP support code will be
756   compiled in.  */"
757for func in socket
758do
759havefunc=HAVE_`echo ${func} | tr "[a-z]" "[A-Z]"`
760echo checking for ${func}
761echo "main() { exit (0); } t() { ${func}(); }" > conftest.c
762eval $compile
763echo 1>&6 "#define ${havefunc} `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
764rm -f conftest conftest.c
765done
766
767echo 1>&6 "
768/* The code needs to know to how to get the name of the current
769   directory.  If getcwd is available it will be used, otherwise if
770   getwd is available it will be used.  Otherwise, set PWD_PROGRAM to
771   the name of the program which will print the name of the current
772   working directory.  */"
773echo checking for getcwd
774echo "main() { exit (0); } t() { getcwd(); }" >conftest.c
775eval $compile
776havegetcwd=`(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`
777echo 1>&6 "#define HAVE_GETCWD ${havegetcwd}"
778echo checking for getwd
779echo "main() { exit (0); } t() { getwd(); }" >conftest.c
780eval $compile
781havegetwd=`(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`
782echo 1>&6 "#define HAVE_GETWD ${havegetwd}"
783if test "${havegetcwd}" != 1 -a "${havegetwd}" != 1; then
784  echo 1>&6 "#define PWD_PROGRAM `if test -s /bin/pwd; then echo '"/bin/pwd"'; else echo unknown; fi`"
785else
786  echo 1>&6 "#define PWD_PROGRAM unused"
787fi
788
789echo 1>&6 "
790/* The code needs to know how to create directories.  If you have the
791   mkdir function, set HAVE_MKDIR to 1 and replace @UUDIR@ in
792   Makefile.in with '# ' (the configure script will set @UUDIR@
793   according to the variable UUDIR).  Otherwise, set HAVE_MKDIR to 0,
794   remove @UUDIR@ from Makefile.in, and set MKDIR_PROGRAM to the name
795   of the program which will create a directory named on the command
796   line.  */"
797echo checking for mkdir
798echo "main() { exit (0); } t() { mkdir(); }" > conftest.c
799eval $compile
800havemkdir=`(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`
801echo 1>&6 "#define HAVE_MKDIR ${havemkdir}"
802if test "${havemkdir}" = "1"; then
803 UUDIR='# '
804 echo 1>&6 "#define MKDIR_PROGRAM unused"
805else
806 UUDIR=
807 echo 1>&6 "#define MKDIR_PROGRAM `if test -f /bin/mkdir; then echo '"/bin/mkdir"'; else echo unknown; fi`"
808fi
809rm -f conftest conftest.c
810
811echo 1>&6 "
812/* That's the end of the list of the functions.  Now there are a few
813   last miscellaneous items.  */"
814
815echo checking whether times can be declared as long
816echo "#include <sys/types.h>
817`if test -f $INCLUDEDIR/sys/times.h; then echo '#include <sys/times.h>'; fi`
818main () { exit(0); } extern long times ();" > conftest.c
819eval $compile
820echo 1>&6 "
821/* On some systems times is declared in <sys/times.h> as returning
822   int, so the code cannot safely declare it as returning long.  On
823   the other hand, on some systems times will not work unless it is
824   declared as returning long.  Set TIMES_DECLARATION_OK to 1 if times
825   can be safely declared as returning long.  If you will not be using
826   times, it doesn't matter what you set this to.  */
827#define TIMES_DECLARATION_OK `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
828rm -f conftest conftest.c
829
830echo checking for BSD setpgrp
831echo "`if test -f $INCLUDEDIR/unistd.h; then echo '#include <unistd.h>'; fi`
832main() { exit(0); } t() { getpgrp (0); setpgrp (0, 0); }" > conftest.c
833eval $compile
834echo 1>&6 "
835/* Set HAVE_BSD_PGRP to 1 if your getpgrp call takes 1 argument and
836   your setpgrp calls takes 2 argument (on System V they generally
837   take no arguments).  You can safely set this to 1 on System V,
838   provided the call will compile without any errors.  */
839#define HAVE_BSD_PGRP `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
840rm -f conftest conftest.c
841
842
843echo checking for union wait
844echo "#include <sys/wait.h>
845main() { exit(0); } t() { union wait u; wait (&u); }" > conftest.c
846eval $compile
847echo 1>&6 "
848/* Set HAVE_UNION_WAIT to 1 if union wait is defined in the header
849   file <sys/wait.h>.  */
850#define HAVE_UNION_WAIT `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
851rm -f conftest conftest.c
852
853
854echo 1>&6 "
855/* Define UTIME_NULL_MISSING if utime with a NULL second argument does not
856   set the file times to the current time.  */"
857echo checking utime with null argument
858rm -f uttest; > uttest
859# Sequent interprets utime(file, 0) to mean use start of epoch.  Wrong.
860echo '#include <sys/types.h>
861#include <sys/stat.h>
862main() {
863struct stat s, t;
864exit(!(stat ("uttest", &s) == 0 && utime("uttest", (long *)0) == 0
865&& stat("uttest", &t) == 0 && t.st_mtime >= s.st_mtime
866&& t.st_mtime - s.st_mtime < 120));
867}' > conftest.c
868eval $compile
869./conftest 2>/dev/null || echo 1>&6 "#define UTIME_NULL_MISSING "
870rm -f conftest conftest.c uttest core
871
872
873echo checking for long file names
874(echo "1" > 123456789012345) 2>/dev/null
875(echo "2" > 123456789012346) 2>/dev/null
876long=`cat 123456789012345 2>/dev/null`
877echo 1>&6 "
878/* Set HAVE_LONG_NAMES to 1 if the system supports file names longer
879   than 14 characters.  */
880#define HAVE_LONG_NAMES `if test -f 123456789012345 -a "${long}" = "1"; then echo 1; else echo 0; fi 2>/dev/null`"
881rm -f 123456789012345 123456789012346 2>/dev/null
882
883echo checking for restartable system calls
884echo "#include <signal.h>
885ucatch (isig) { }
886main () { int i = fork ();
887 if (i == 0) { sleep (3); kill (getppid (), SIGINT); sleep (3); exit (0); }
888 signal (SIGINT, ucatch);
889 exit (wait (&i) == -1); }" > conftest.c
890eval $compile
891echo 1>&6 "
892/* If slow system calls are restarted after interrupts, set
893   HAVE_RESTARTABLE_SYSCALLS to 1.  This is ignored if HAVE_SIGACTION
894   is 1 or if HAVE_SIGVEC is 1 and SV_INTERRUPT is defined in
895   <signal.h>.  In both of these cases system calls can be prevented
896   from restarting.  */
897#define HAVE_RESTARTABLE_SYSCALLS `(if test -s conftest && ./conftest 2>/dev/null; then echo 1; else echo 0; fi) 2>/dev/null`"
898rm -f conftest conftest.c
899
900trap 'for dir in .; do rm -f $dir/Makefile; done; rm -f config.status conf.h; exit 1' 1 3 15
901
902for dir in .; do
903  test -d $dir || mkdir $dir
904  echo creating $dir/Makefile
905  echo '# Generated automatically from Makefile.in by configure.' > $dir/Makefile
906  sed -e "
907$vpsub
908s,@srcdir@,$srcdir,
909s,@VPATH@,$VPATH,
910s,@DEFS@,$DEFS,
911s,@LIBS@,$LIBS,
912s,@INSTALL@,$INSTALL,
913s,@INSTALLDATA@,$INSTALLDATA,
914s,@CC@,$CC,
915s,@CFLAGS@,$CFLAGS,
916s,@LDFLAGS@,$LDFLAGS,
917s,@LN_S@,$LN_S,
918s,@ALLOCA@,$ALLOCA,
919s,@UUDIR@,$UUDIR,
920" $srcdir/$dir/Makefile.in >> $dir/Makefile
921done
922
923echo creating config.status
924echo "\
925DEFS=\"$DEFS\"
926LIBS=\"$LIBS\"
927INSTALL=\"$INSTALL\"
928INSTALLDATA=\"$INSTALLDATA\"
929CC=\"$CC\"
930CFLAGS=\"$CFLAGS\"
931LDFLAGS=\"$LDFLAGS\"
932LN_S=\"$LN_S\"
933ALLOCA=\"$ALLOCA\"
934UUDIR=\"$UUDIR\"
935" > config.status
936
937