1dnl Taylor UUCP configuration file
2dnl This should be processed with autoconf to produce a configure script.
3dnl Copyright (c) 1992, 1993, 1994, 1995, 2002 Ian Lance Taylor
4dnl
5AC_REVISION([$Id: configure.in,v 1.99 2002/03/07 17:56:41 ian Rel $])
6AC_INIT(policy.h)
7AM_INIT_AUTOMAKE(uucp, 1.07)
8AM_CONFIG_HEADER(config.h)
9AM_MAINTAINER_MODE
10dnl
11AC_ARG_WITH(user,
12[  --with-user=USERNAME    user ID for programs; default uucp],
13[OWNER=${withval}],
14[OWNER="uucp"])
15AC_DEFINE_UNQUOTED(OWNER, "$OWNER", [user ID for programs; normally uucp])
16AC_SUBST(OWNER)
17dnl
18AC_ARG_WITH(newconfigdir,
19[  --with-newconfigdir=DIRNAME  new config file directory; default PREFIX/conf/uucp],
20[NEWCONFIGDIR=${withval}],
21[NEWCONFIGDIR='${prefix}/conf/uucp'])
22AC_SUBST(NEWCONFIGDIR)
23dnl
24AC_ARG_WITH(oldconfigdir,
25[  --with-oldconfigdir=DIRNAME  old config file directory; default /usr/lib/uucp],
26[OLDCONFIGDIR=${withval}],
27[OLDCONFIGDIR="/usr/lib/uucp"])
28AC_SUBST(OLDCONFIGDIR)
29dnl
30AC_PREFIX_PROGRAM(gcc)
31AC_PROG_CC
32AC_PROG_GCC_TRADITIONAL
33dnl
34build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
35AC_ARG_ENABLE(build-warnings,
36[  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
37[case "${enableval}" in
38  yes)	;;
39  no)	build_warnings="-w";;
40  ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
41        build_warnings="${build_warnings} ${t}";;
42  *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
43        build_warnings="${t} ${build_warnings}";;
44  *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
45esac
46if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
47  echo "Setting warning flags = $build_warnings" 6>&1
48fi])dnl
49WARN_CFLAGS=""
50if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
51    WARN_CFLAGS="${build_warnings}"
52fi
53AC_SUBST(WARN_CFLAGS)
54dnl
55dnl AR was added to the Makefiles to allow building on funny systems.
56dnl Adding it here allows the environment value of AR at configure time to
57dnl be cached in config.status and in the Makefiles.
58AR=${AR-ar}
59AC_SUBST(AR)
60AC_PROG_RANLIB
61AC_ISC_POSIX
62AC_MINIX
63AC_AIX
64AC_CHECK_LIB(sun, getpwnam)
65AC_C_CONST
66AC_MSG_CHECKING([for prototypes])
67AC_CACHE_VAL(uucp_cv_c_prototypes,
68[AC_TRY_COMPILE([extern int foo (short);
69int foo(short i) { return i; }],
70[int i;],
71uucp_cv_c_prototypes=yes, uucp_cv_c_prototypes=no)])
72AC_MSG_RESULT($uucp_cv_c_prototypes)
73if test $uucp_cv_c_prototypes = yes; then
74  AC_DEFINE(HAVE_PROTOTYPES, 1, [Whether the compiler supports prototypes])
75fi
76dnl
77AC_SYS_INTERPRETER
78POUNDBANG=$ac_cv_sys_interpreter
79AC_SUBST(POUNDBANG)
80dnl
81AC_MSG_CHECKING(for echo)
82if (PATH= echo test) 2>/dev/null | grep test >/dev/null 2>&1; then
83 echo_program='"echo"'
84 AC_MSG_RESULT(shell builtin)
85elif test -s /bin/echo; then
86 echo_program="/bin/echo"
87 AC_MSG_RESULT(/bin/echo)
88else
89 AC_MSG_RESULT(not found)
90fi
91AC_DEFINE_UNQUOTED([ECHO_PROGRAM], $echo_program,
92                   [echo program--if shell builtin, use "echo"])
93AC_PROG_LN_S
94dnl
95AC_CHECK_HEADERS(stddef.h stdarg.h string.h strings.h unistd.h stdlib.h)
96AC_CHECK_HEADERS(limits.h time.h sys/wait.h sys/ioctl.h memory.h termios.h)
97AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h sys/times.h libc.h)
98AC_CHECK_HEADERS(sysexits.h poll.h tiuser.h xti.h sys/tli.h stropts.h ftw.h)
99AC_CHECK_HEADERS(glob.h sys/param.h sys/types.tcp.h sys/mount.h sys/vfs.h)
100AC_CHECK_HEADERS(sys/filsys.h sys/statfs.h sys/dustat.h sys/fs_types.h ustat.h)
101AC_CHECK_HEADERS(sys/statvfs.h sys/termiox.h)
102dnl
103# Under Next 3.2 <dirent.h> apparently does not define struct dirent
104# by default.
105AC_MSG_CHECKING([for dirent.h])
106AC_CACHE_VAL(uucp_cv_header_dirent_h,
107[AC_TRY_COMPILE([#include <dirent.h>],
108[struct dirent s;],
109uucp_cv_header_dirent_h=yes, uucp_cv_header_dirent_h=no)])
110AC_MSG_RESULT($uucp_cv_header_dirent_h)
111if test $uucp_cv_header_dirent_h = yes; then
112  AC_DEFINE(HAVE_DIRENT_H, 1,
113            [Whether you have a <dirent.h> which defines struct direct])
114fi
115dnl
116# Under Next 3.2 <utime.h> apparently does not define struct utimbuf
117# by default.
118AC_MSG_CHECKING([for utime.h])
119AC_CACHE_VAL(uucp_cv_header_utime_h,
120[AC_TRY_COMPILE([#include <sys/types.h>
121#if HAVE_TIME_H
122#include <time.h>
123#endif
124#include <utime.h>],
125[struct utimbuf s;],
126uucp_cv_header_utime_h=yes, uucp_cv_header_utime_h=no)])
127AC_MSG_RESULT($uucp_cv_header_utime_h)
128if test $uucp_cv_header_utime_h = yes; then
129  AC_DEFINE(HAVE_UTIME_H, 1,
130            [Whether you have a <utime.h> which defines struct utimbuf])
131fi
132dnl
133AC_MSG_CHECKING([for sys/select.h])
134AC_CACHE_VAL(uucp_cv_header_sys_select_h,
135[AC_TRY_COMPILE([#include <sys/select.h>
136#if HAVE_SYS_TIME_H
137#include <sys/time.h>
138#endif],
139[int i;],
140uucp_cv_header_sys_select_h=yes, uucp_cv_header_sys_select_h=no)])
141AC_MSG_RESULT($uucp_cv_header_sys_select_h)
142if test $uucp_cv_header_sys_select_h = yes; then
143  AC_DEFINE(HAVE_SYS_SELECT_H, 1,
144            [Whether you have <sys/select.h>])
145fi
146dnl
147AC_HEADER_MAJOR
148dnl
149AC_TYPE_SIGNAL
150dnl
151AC_HEADER_STAT
152dnl
153AC_HEADER_TIME
154AC_STRUCT_TM
155dnl
156AC_MSG_CHECKING([whether termios.h and sys/ioctl.h may both be included])
157AC_CACHE_VAL(uucp_cv_header_termios_and_ioctl,
158[AC_TRY_COMPILE([#include <termios.h>
159#include <sys/ioctl.h>],
160[int i;],
161uucp_cv_header_termios_and_ioctl=yes, uucp_cv_header_termios_and_ioctl=no)])
162AC_MSG_RESULT($uucp_cv_header_termios_and_ioctl)
163if test $uucp_cv_header_termios_and_ioctl = yes; then
164  AC_DEFINE(HAVE_TERMIOS_AND_SYS_IOCTL_H, 1,
165            [Whether <termios.h> and <sys/ioctl.h> may both be included])
166fi
167dnl
168AC_MSG_CHECKING(for CBREAK)
169AC_CACHE_VAL(uucp_cv_decl_cbreak,
170[AC_TRY_COMPILE([#include <sgtty.h>], [int i = CBREAK;],
171uucp_cv_decl_cbreak=yes, uucp_cv_decl_cbreak=no)])
172AC_MSG_RESULT($uucp_cv_decl_cbreak)
173if test $uucp_cv_decl_cbreak = yes; then
174  AC_DEFINE(HAVE_CBREAK, 1, [Whether CBREAK is defined])
175fi
176dnl
177AC_MSG_CHECKING(for pid_t in sys/types.h)
178AC_CACHE_VAL(uucp_cv_decl_pid_t,
179[AC_TRY_COMPILE([#include <sys/types.h>], [pid_t x;],
180uucp_cv_decl_pid_t=yes, uucp_cv_decl_pid_t=no)])
181AC_MSG_RESULT($uucp_cv_decl_pid_t)
182if test $uucp_cv_decl_pid_t = no; then
183  AC_DEFINE(PID_T, int, [Type to use for pid_t if not defined--typically int])
184fi
185dnl
186AC_MSG_CHECKING(for uid_t in sys/types.h)
187AC_CACHE_VAL(uucp_cv_decl_uid_t,
188[AC_TRY_COMPILE([#include <sys/types.h>], [uid_t x;],
189uucp_cv_decl_uid_t=yes, uucp_cv_decl_uid_t=no)])
190AC_MSG_RESULT($uucp_cv_decl_uid_t)
191if test $uucp_cv_decl_uid_t = no; then
192  AC_DEFINE(UID_T, int, [Type to use for uid_t if not defined--typically int])
193fi
194dnl
195AC_MSG_CHECKING(for gid_t in sys/types.h)
196AC_CACHE_VAL(uucp_cv_decl_gid_t,
197[AC_TRY_COMPILE([#include <sys/types.h>], [gid_t x;],
198uucp_cv_decl_gid_t=yes, uucp_cv_decl_gid_t=no)])
199AC_MSG_RESULT($uucp_cv_decl_gid_t)
200if test $uucp_cv_decl_gid_t = no; then
201  AC_DEFINE(GID_T, int, [Type to use for gid_t if not defined--typically int])
202fi
203dnl
204AC_MSG_CHECKING(for off_t in sys/types.h)
205AC_CACHE_VAL(uucp_cv_decl_off_t,
206[AC_TRY_COMPILE([#include <sys/types.h>], [off_t x;],
207uucp_cv_decl_off_t=yes, uucp_cv_decl_off_t=no)])
208AC_MSG_RESULT($uucp_cv_decl_off_t)
209if test $uucp_cv_decl_off_t = no; then
210  AC_DEFINE(OFF_T, long,
211            [Type to use for off_t if not defined--typically long])
212fi
213dnl
214dnl On SCO 3.2.2 sig_atomic_t is in <sys/types.h> but not <signal.h>.
215AC_MSG_CHECKING(for sig_atomic_t in signal.h)
216AC_CACHE_VAL(uucp_cv_decl_sig_atomic_t_signal_h,
217[AC_TRY_COMPILE([#include <signal.h>], [sig_atomic_t x;],
218uucp_cv_decl_sig_atomic_t_signal_h=yes,
219uucp_cv_decl_sig_atomic_t_signal_h=no)])
220AC_MSG_RESULT($uucp_cv_decl_sig_atomic_t_signal_h)
221if test $uucp_cv_decl_sig_atomic_t_signal_h = yes; then
222  AC_DEFINE([HAVE_SIG_ATOMIC_T_IN_SIGNAL_H], 1,
223            [Whether sig_atomic_t is defined in <signal.h>])
224fi
225dnl
226AC_MSG_CHECKING(for sig_atomic_t in sys/types.h)
227AC_CACHE_VAL(uucp_cv_decl_sig_atomic_t_types_h,
228[AC_TRY_COMPILE([#include <sys/types.h>], [sig_atomic_t x;],
229uucp_cv_decl_sig_atomic_t_types_h=yes,
230uucp_cv_decl_sig_atomic_t_types_h=no)])
231AC_MSG_RESULT($uucp_cv_decl_sig_atomic_t_types_h)
232if test $uucp_cv_decl_sig_atomic_t_types_h = yes; then
233  AC_DEFINE([HAVE_SIG_ATOMIC_T_IN_TYPES_H], 1,
234            [Whether sig_atomic_t is defined in <types.h>])
235fi
236dnl
237if test $ac_cv_header_stddef_h = yes; then
238  AC_MSG_CHECKING(for size_t in stddef.h)
239  AC_CACHE_VAL(uucp_cv_decl_size_t_stddef_h,
240  [AC_TRY_COMPILE([#include <stddef.h>], [size_t x;],
241  uucp_cv_decl_size_t_stddef_h=yes, uucp_cv_decl_size_t_stddef_h=no)])
242  AC_MSG_RESULT($uucp_cv_decl_size_t_stddef_h)
243  if test $uucp_cv_decl_size_t_stddef_h = yes; then
244    AC_DEFINE([HAVE_SIZE_T_IN_STDDEF_H], 1,
245              [Whether size_t is defined in <stddef.h>])
246  fi
247fi
248dnl
249AC_MSG_CHECKING(for size_t in sys/types.h)
250AC_CACHE_VAL(uucp_cv_decl_size_t_types_h,
251[AC_TRY_COMPILE([#include <sys/types.h>], [size_t x;],
252uucp_cv_decl_size_t_types_h=yes, uucp_cv_decl_size_t_types_h=no)])
253AC_MSG_RESULT($uucp_cv_decl_size_t_types_h)
254if test $uucp_cv_decl_size_t_types_h = yes; then
255  AC_DEFINE([HAVE_SIZE_T_IN_TYPES_H], 1,
256            [Whether size_t is defined in <types.h>])
257fi
258dnl
259AC_MSG_CHECKING(for time_t in time.h)
260AC_CACHE_VAL(uucp_cv_decl_time_t_time_h,
261[AC_TRY_COMPILE([#include <time.h>], [time_t i;],
262uucp_cv_decl_time_t_time_h=yes, uucp_cv_decl_time_t_time_h=no)])
263AC_MSG_RESULT($uucp_cv_decl_time_t_time_h)
264if test $uucp_cv_decl_time_t_time_h = yes; then
265  AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
266            [Whether time_t is defined in <time.h>])
267fi
268dnl
269AC_MSG_CHECKING(time_t in sys/types.h)
270AC_CACHE_VAL(uucp_cv_decl_time_t_types_h,
271[AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
272uucp_cv_decl_time_t_types_h=yes, uucp_cv_decl_time_t_types_h=no)])
273AC_MSG_RESULT($uucp_cv_decl_time_t_types_h)
274if test $uucp_cv_decl_time_t_types_h = yes; then
275  AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
276            [Whether time_t is defined in <types.h>])
277fi
278dnl
279AC_MSG_CHECKING(for void)
280AC_CACHE_VAL(uucp_cv_c_void,
281[AC_TRY_COMPILE([], [extern void foo (); (void) exit (0);],
282uucp_cv_c_void=yes, uucp_cv_c_void=no)])
283AC_MSG_RESULT($uucp_cv_c_void)
284if test $uucp_cv_c_void = yes; then
285  AC_DEFINE([HAVE_VOID], 1, [Whether the compiler supports void])
286fi
287dnl
288AC_MSG_CHECKING(for unsigned char)
289AC_CACHE_VAL(uucp_cv_c_unsigned_char,
290[AC_TRY_COMPILE([], [unsigned char i = (unsigned char) -1;],
291uucp_cv_c_unsigned_char=yes, uucp_cv_c_unsigned_char=no)])
292AC_MSG_RESULT($uucp_cv_c_unsigned_char)
293if test $uucp_cv_c_unsigned_char = yes; then
294  AC_DEFINE([HAVE_UNSIGNED_CHAR], 1,
295            [Whether the compiler supports unsigned char])
296fi
297dnl
298AC_MSG_CHECKING(for errno declaration)
299AC_CACHE_VAL(uucp_cv_decl_errno,
300[AC_TRY_COMPILE([#include <errno.h>], [int i = errno; errno = 1;],
301uucp_cv_decl_errno=yes, uucp_cv_decl_errno=no)])
302AC_MSG_RESULT($uucp_cv_decl_errno)
303if test $uucp_cv_decl_errno = yes; then
304  AC_DEFINE([HAVE_ERRNO_DECLARATION], 1,
305            [Whether errno is declared in <errno.h>])
306fi
307dnl
308AC_MSG_CHECKING(for TXADDCD)
309AC_CACHE_VAL(uucp_cv_txaddcd,
310[AC_TRY_COMPILE([#include <sys/ioctl.h>], [int i = (int) TXADDCD;],
311uucp_cv_txaddcd=yes, uucp_cv_txaddcd=no)])
312AC_MSG_RESULT($uucp_cv_txaddcd)
313if test $uucp_cv_txaddcd = yes; then
314  AC_DEFINE([HAVE_TXADDCD], 1, [Whether TXADDCD is defined])
315fi
316dnl
317dnl On some systems, memset, memcmp, and memcpy must be called with
318dnl the right number of arguments.
319AC_MSG_CHECKING(for memset)
320AC_CACHE_VAL(ac_cv_func_memset,
321[AC_TRY_LINK([], [ char *i; int j, k; memset(i, j, k); ],
322ac_cv_func_memset=yes, ac_cv_func_memset=no)])
323AC_MSG_RESULT($ac_cv_func_memset)
324if test $ac_cv_func_memset = yes; then
325  AC_DEFINE([HAVE_MEMSET], 1, [Whether you have memset])
326fi
327dnl
328AC_MSG_CHECKING(for memcmp)
329AC_CACHE_VAL(ac_cv_func_memcmp,
330[AC_TRY_LINK([], [ char *i, *j; int k; memcmp(i, j, k); ],
331ac_cv_func_memcmp=yes, ac_cv_func_memcmp=no)])
332AC_MSG_RESULT($ac_cv_func_memcmp)
333if test $ac_cv_func_memcmp = yes; then
334  AC_DEFINE([HAVE_MEMCMP], 1, [Whether you have memcmp])
335fi
336dnl
337AC_MSG_CHECKING(for memcpy)
338AC_CACHE_VAL(ac_cv_func_memcpy,
339[AC_TRY_LINK([], [ char *i, *j; int k; memcpy(i, j, k); ],
340ac_cv_func_memcpy=yes, ac_cv_func_memcpy=no)])
341AC_MSG_RESULT($ac_cv_func_memcpy)
342if test $ac_cv_func_memcpy = yes; then
343  AC_DEFINE([HAVE_MEMCPY], 1, [Whether you have memcpy])
344fi
345dnl
346undefine([index])
347AC_CHECK_FUNCS(memchr bcopy bcmp bzero)
348AC_CHECK_FUNCS(strchr strrchr index rindex strerror strtol strtoul strstr)
349AC_CHECK_FUNCS(strdup strcasecmp strncasecmp stricmp strnicmp)
350AC_CHECK_FUNCS(bsearch vfprintf)
351AC_CHECK_FUNCS(remove ftruncate ltrunc rename opendir dup2 waitpid wait4)
352AC_CHECK_FUNCS(sigsetjmp setret sigaction sigvec sigset)
353AC_CHECK_FUNCS(sigprocmask sigblock sighold getdtablesize sysconf)
354AC_CHECK_FUNCS(setpgrp setsid setreuid seteuid gethostname uname)
355AC_CHECK_FUNCS(gettimeofday ftw glob dev_info getaddrinfo)
356dnl
357dnl Check for getline, but try to avoid inappropriate getline
358dnl functions found on ISC and HP/UX by also checking for getdelim;
359dnl the version of getline we want is normally implemented by calling
360dnl getdelim.
361AC_CHECK_FUNC(getdelim,
362[AC_CHECK_FUNC(getline,
363[AC_DEFINE(HAVE_GETLINE, 1, [Define if you have the getline function.])],
364[LIBOBJS="$LIBOBJS getlin.o"])],
365[LIBOBJS="$LIBOBJS getlin.o"])
366dnl
367dnl Check for the SCO buggy ftime; the code can cope with the bug,
368dnl though it would prefer not to, so if we're cross-configuring we
369dnl accept that ftime exists.
370AC_CHECK_FUNC(ftime,
371[AC_MSG_CHECKING(that ftime works correctly)
372AC_CACHE_VAL(uucp_cv_sys_ftime_ok,
373[AC_TRY_RUN([
374#include <sys/types.h>
375#include <sys/timeb.h>
376main ()
377{
378  struct timeb s, slast;
379  int c = 0;
380  ftime (&slast);
381  while (c < 10)
382    {
383      ftime (&s);
384      if (s.time < slast.time
385	  || (s.time == slast.time && s.millitm < slast.millitm))
386	exit (1);
387      if (s.time != slast.time)
388	++c;
389      slast.time = s.time;
390      slast.millitm = s.millitm;
391    }
392  exit (0);
393}
394],
395uucp_cv_sys_ftime_ok=yes,
396uucp_cv_sys_ftime_ok=no,
397uucp_cv_sys_ftime_ok=runtime)])
398case $uucp_cv_sys_ftime_ok in
399yes) AC_MSG_RESULT(yes) ;;
400no)  AC_MSG_RESULT(no)
401     AC_MSG_WARN(ftime seems to be buggy) ;;
402runtime) AC_MSG_RESULT(will check at run time) ;;
403esac
404])
405if test $uucp_cv_sys_ftime_ok = yes || test $uucp_cv_sys_ftime_ok = runtime; then
406  AC_DEFINE(HAVE_FTIME, 1, [Whether you have ftime])
407fi
408dnl
409AC_CHECK_FUNCS(times)
410AC_CHECK_FUNCS(napms nap usleep poll select)
411if test $ac_cv_func_napms != yes \
412   && test $ac_cv_func_nap != yes \
413   && test $ac_cv_func_usleep != yes \
414   && test $ac_cv_func_poll != yes \
415   && test $ac_cv_func_select != yes; then
416  AC_MSG_WARN(No way to sleep for less than one second)
417  AC_MSG_WARN(\p in chat scripts will sleep for a full second)
418fi
419dnl
420AC_CHECK_FUNCS(getgrent)
421dnl
422case $LIBS in
423*-lnsl*) ;;
424*) AC_CHECK_LIB(nsl_s, main) ;;
425esac
426case $LIBS in
427*-lnsl*) ;;
428*) AC_CHECK_LIB(nsl, main) ;;
429esac
430case $LIBS in
431*-lsocket*) ;;
432*) AC_CHECK_LIB(socket, socket) ;;
433esac
434case $LIBS in
435*-lxti*) ;;
436*) AC_CHECK_LIB(xti, t_open);;
437esac
438AC_CHECK_FUNCS(socket t_open)
439dnl
440AC_CHECK_FUNCS(getcwd getwd)
441if test $ac_cv_func_getcwd != yes \
442   && test $ac_cv_func_getwd != yes; then
443  UNIXOBJS="$UNIXOBJS getcwd.o"
444  if test -s /bin/pwd; then
445    AC_DEFINE([PWD_PROGRAM], "/bin/pwd", [Program to print working directory])
446  fi
447fi
448dnl
449AC_CHECK_FUNCS(mkdir)
450AM_CONDITIONAL(HAVE_MKDIR, [test $ac_cv_func_mkdir = yes])
451if test $ac_cv_func_mkdir != yes; then
452  UNIXOBJS="$UNIXOBJS mkdir.o"
453  if test -s /bin/mkdir; then
454    AC_DEFINE([MKDIR_PROGRAM], "/bin/mkdir", [Program to make a directory])
455  fi
456fi
457dnl
458AC_CHECK_FUNCS(rmdir)
459if test $ac_cv_func_rmdir != yes; then
460  UNIXOBJS="$UNIXOBJS rmdir.o"
461  if test -s /bin/rmdir; then
462    AC_DEFINE([RMDIR_PROGRAM], "/bin/rmdir", [Program to remove a directory])
463  fi
464fi
465dnl
466dnl Figure out which functions we need from lib subdirectory
467if test $ac_cv_func_bsearch != yes; then
468  LIBOBJS="$LIBOBJS bsrch.o"
469fi
470if test $ac_cv_func_bzero != yes \
471   && test $ac_cv_func_memset != yes; then
472  LIBOBJS="$LIBOBJS bzero.o"
473fi
474if test $ac_cv_func_memchr != yes; then
475  LIBOBJS="$LIBOBJS memchr.o"
476fi
477if test $ac_cv_func_memcmp != yes \
478   && test $ac_cv_func_bcmp != yes; then
479  LIBOBJS="$LIBOBJS memcmp.o"
480fi
481if test $ac_cv_func_memcpy != yes \
482   && test $ac_cv_func_bcopy != yes; then
483  LIBOBJS="$LIBOBJS memcpy.o"
484fi
485if test $ac_cv_func_strcasecmp != yes \
486   && test $ac_cv_func_stricmp != yes; then
487  LIBOBJS="$LIBOBJS strcas.o"
488fi
489if test $ac_cv_func_strchr != yes \
490   && test $ac_cv_func_index != yes; then
491  LIBOBJS="$LIBOBJS strchr.o"
492fi
493if test $ac_cv_func_strdup != yes; then
494  LIBOBJS="$LIBOBJS strdup.o"
495fi
496if test $ac_cv_func_strncasecmp != yes \
497   && test $ac_cv_func_strnicmp != yes; then
498  LIBOBJS="$LIBOBJS strncs.o"
499fi
500if test $ac_cv_func_strrchr != yes \
501   && test $ac_cv_func_rindex != yes; then
502  LIBOBJS="$LIBOBJS strrch.o"
503fi
504if test $ac_cv_func_strstr != yes; then
505  LIBOBJS="$LIBOBJS strstr.o"
506fi
507if test $ac_cv_func_strtol != yes; then
508  LIBOBJS="$LIBOBJS strtol.o"
509fi
510if test $ac_cv_func_strtoul != yes; then
511  LIBOBJS="$LIBOBJS strtou.o"
512fi
513AC_SUBST(LIBOBJS)dnl
514dnl Figure out which functions we need from unix subdirectory
515if test $ac_cv_func_opendir != yes; then
516  UNIXOBJS="$UNIXOBJS dirent.o"
517fi
518if test $ac_cv_func_dup2 != yes; then
519  UNIXOBJS="$UNIXOBJS dup2.o"
520fi
521if test $ac_cv_func_ftw != yes; then
522  UNIXOBJS="$UNIXOBJS ftw.o"
523fi
524if test $ac_cv_func_remove != yes; then
525  UNIXOBJS="$UNIXOBJS remove.o"
526fi
527if test $ac_cv_func_rename != yes; then
528  UNIXOBJS="$UNIXOBJS rename.o"
529fi
530if test $ac_cv_func_strerror != yes; then
531  UNIXOBJS="$UNIXOBJS strerr.o"
532fi
533AC_SUBST(UNIXOBJS)
534dnl
535if test $ac_cv_func_sigvec = yes; then
536  AC_MSG_CHECKING(for sv_flags)
537  AC_CACHE_VAL(uucp_cv_struct_sv_flags,
538  [AC_TRY_COMPILE([#include <signal.h>], [struct sigvec s; s.sv_flags = 0;],
539  uucp_cv_struct_sv_flags=yes, uucp_cv_struct_sv_flags=no)])
540  AC_MSG_RESULT($uucp_cv_struct_sv_flags)
541  if test $uucp_cv_struct_sv_flags = yes; then
542    AC_DEFINE([HAVE_SIGVEC_SV_FLAGS], 1,
543              [Whether struct sigvec has sv_flags member])
544  fi
545fi
546
547dnl The filesystem info code is from the GNU fileutils 3.12 package.
548AC_CHECKING(how to get filesystem space usage)
549space=no
550
551# Here we'll compromise a little (and perform only the link test)
552# since it seems there are no variants of the statvfs function.
553if test $space = no; then
554  # SVR4
555  AC_CHECK_FUNCS(statvfs)
556  if test $ac_cv_func_statvfs = yes; then
557    space=yes
558    AC_DEFINE(STAT_STATVFS, 1, [Whether you have statvfs])
559  fi
560fi
561
562if test $space = no; then
563  # DEC Alpha running OSF/1
564  AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
565  AC_CACHE_VAL(uucp_cv_sys_stat_statfs3_osf1,
566  [AC_TRY_RUN([
567#include <sys/param.h>
568#include <sys/types.h>
569#include <sys/mount.h>
570  main ()
571  {
572    struct statfs fsd;
573    fsd.f_fsize = 0;
574    exit (statfs (".", &fsd, sizeof (struct statfs)));
575  }],
576  uucp_cv_sys_stat_statfs3_osf1=yes,
577  uucp_cv_sys_stat_statfs3_osf1=no,
578  uucp_cv_sys_stat_statfs3_osf1=no)])
579  AC_MSG_RESULT($uucp_cv_sys_stat_statfs3_osf1)
580  if test $uucp_cv_sys_stat_statfs3_osf1 = yes; then
581    space=yes
582    AC_DEFINE(STAT_STATFS3_OSF1, 1, [Whether you have 3 argument statfs])
583  fi
584fi
585
586if test $space = no; then
587# AIX
588  AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
589member (AIX, 4.3BSD)])
590  AC_CACHE_VAL(uucp_cv_sys_stat_statfs2_bsize,
591  [AC_TRY_RUN([
592#ifdef HAVE_SYS_PARAM_H
593#include <sys/param.h>
594#endif
595#ifdef HAVE_SYS_MOUNT_H
596#include <sys/mount.h>
597#endif
598#ifdef HAVE_SYS_VFS_H
599#include <sys/vfs.h>
600#endif
601  main ()
602  {
603  struct statfs fsd;
604  fsd.f_bsize = 0;
605  exit (statfs (".", &fsd));
606  }],
607  uucp_cv_sys_stat_statfs2_bsize=yes,
608  uucp_cv_sys_stat_statfs2_bsize=no,
609  uucp_cv_sys_stat_statfs2_bsize=no)])
610  AC_MSG_RESULT($uucp_cv_sys_stat_statfs2_bsize)
611  if test $uucp_cv_sys_stat_statfs2_bsize = yes; then
612    space=yes
613    AC_DEFINE(STAT_STATFS2_BSIZE, 1,
614              [Whether you have two argument statfs with bsize])
615  fi
616fi
617
618if test $space = no; then
619# SVR3
620  AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
621  AC_CACHE_VAL(uucp_cv_sys_stat_statfs4,
622  [AC_TRY_RUN([#include <sys/types.h>
623#include <sys/statfs.h>
624  main ()
625  {
626  struct statfs fsd;
627  exit (statfs (".", &fsd, sizeof fsd, 0));
628  }],
629    uucp_cv_sys_stat_statfs4=yes,
630    uucp_cv_sys_stat_statfs4=no,
631    uucp_cv_sys_stat_statfs4=no)])
632  AC_MSG_RESULT($uucp_cv_sys_stat_statfs4)
633  if test $uucp_cv_sys_stat_statfs4 = yes; then
634    space=yes
635    AC_DEFINE(STAT_STATFS4, 1, [Whether you have four argument statfs])
636  fi
637fi
638
639if test $space = no; then
640# 4.4BSD and NetBSD
641  AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
642member (4.4BSD and NetBSD)])
643  AC_CACHE_VAL(uucp_cv_sys_stat_statfs2_fsize,
644  [AC_TRY_RUN([#include <sys/types.h>
645#ifdef HAVE_SYS_PARAM_H
646#include <sys/param.h>
647#endif
648#ifdef HAVE_SYS_MOUNT_H
649#include <sys/mount.h>
650#endif
651  main ()
652  {
653  struct statfs fsd;
654  fsd.f_fsize = 0;
655  exit (statfs (".", &fsd));
656  }],
657  uucp_cv_sys_stat_statfs2_fsize=yes,
658  uucp_cv_sys_stat_statfs2_fsize=no,
659  uucp_cv_sys_stat_statfs2_fsize=no)])
660  AC_MSG_RESULT($uucp_cv_sys_stat_statfs2_fsize)
661  if test $uucp_cv_sys_stat_statfs2_fsize = yes; then
662    space=yes
663    AC_DEFINE(STAT_STATFS2_FSIZE, 1,
664              [Whether you have two argument statfs with fsize])
665  fi
666fi
667
668if test $space = no; then
669  # Ultrix
670  AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
671  AC_CACHE_VAL(uucp_cv_sys_stat_fs_data,
672  [AC_TRY_RUN([#include <sys/types.h>
673#ifdef HAVE_SYS_PARAM_H
674#include <sys/param.h>
675#endif
676#ifdef HAVE_SYS_MOUNT_H
677#include <sys/mount.h>
678#endif
679#ifdef HAVE_SYS_FS_TYPES_H
680#include <sys/fs_types.h>
681#endif
682  main ()
683  {
684  struct fs_data fsd;
685  /* Ultrix's statfs returns 1 for success,
686     0 for not mounted, -1 for failure.  */
687  exit (statfs (".", &fsd) != 1);
688  }],
689  uucp_cv_sys_stat_fs_data=yes,
690  uucp_cv_sys_stat_fs_data=no,
691  uucp_cv_sys_stat_fs_data=no)])
692  AC_MSG_RESULT($uucp_cv_sys_stat_fs_data)
693  if test $uucp_cv_sys_stat_fs_data = yes; then
694    space=yes
695    AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
696              [Whether you have two argument statfs with fd_req])
697  fi
698fi
699
700if test $space = no; then
701  AC_CHECK_FUNCS(ustat)
702  if test $ac_cv_func_ustat = yes; then
703    space=yes
704    AC_DEFINE(STAT_USTAT, 1, [Whether you have ustat])
705  fi
706fi
707
708if test $space = no; then
709  # QNX
710  AC_CHECK_FUNCS(disk_space)
711  if test $ac_cv_func_disk_space = yes; then
712    space=yes
713    AC_DEFINE(STAT_DISK_SPACE, 1, [Whether you have disk_space])
714  fi
715fi
716
717dnl See whether we can make an extern declaration
718AC_DEFUN(UUCP_CHECK_DECLARATION,
719[AC_MSG_CHECKING(for $1 declared as $2)
720AC_CACHE_VAL(uucp_cv_decl_$1,
721[AC_TRY_COMPILE([#include <sys/types.h>
722#include <pwd.h>
723#include <grp.h>
724#ifdef HAVE_LIBC_H
725#include <libc.h>
726#endif
727#ifdef HAVE_SYS_TIMES_H
728#include <sys/times.h>
729#endif
730extern $2 $1 ();], [int i = 0;],
731eval "uucp_cv_decl_$1=yes", eval "uucp_cv_decl_$1=no")])
732if eval "test \"`echo '$uucp_cv_decl_'$1`\" = yes"; then
733  AC_MSG_RESULT(yes)
734  AC_DEFINE_UNQUOTED(translit($1, [a-z], [A-Z])_DECLARATION_OK, 1,
735                     [Whether $1 is declared as $2])
736else
737  AC_MSG_RESULT(no)
738fi
739])
740dnl
741UUCP_CHECK_DECLARATION(times, long)
742UUCP_CHECK_DECLARATION(getpwnam, struct passwd *)
743UUCP_CHECK_DECLARATION(getpwuid, struct passwd *)
744UUCP_CHECK_DECLARATION(getgrent, struct group *)
745dnl
746AC_MSG_CHECKING(for BSD setpgrp)
747AC_CACHE_VAL(uucp_cv_decl_setpgrp,
748[AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H
749#include <unistd.h>
750#endif],
751[getpgrp (0); setpgrp (0, 0);],
752uucp_cv_decl_setpgrp=yes, uucp_cv_decl_setpgrp=no)])
753AC_MSG_RESULT($uucp_cv_decl_setpgrp)
754if test $uucp_cv_decl_setpgrp = yes; then
755  AC_DEFINE([HAVE_BSD_PGRP], 1, [Whether you have BSD style setpgrp])
756fi
757dnl
758AC_MSG_CHECKING(for union wait)
759AC_CACHE_VAL(uucp_cv_struct_wait,
760[AC_TRY_COMPILE([#include <sys/wait.h>
761#ifndef WIFEXITED
762#define WIFEXITED(u) ((u).w_termsig == 0)
763#endif],
764[union wait u; if (WIFEXITED (u)) wait (&u);],
765uucp_cv_struct_wait=yes, uucp_cv_struct_wait=no)])
766AC_MSG_RESULT($uucp_cv_struct_wait)
767if test $uucp_cv_struct_wait = yes; then
768  AC_DEFINE([HAVE_UNION_WAIT], 1, [Whether you have union wait])
769fi
770dnl
771AC_MSG_CHECKING(for struct sockaddr_storage)
772AC_CACHE_VAL(uucp_cv_struct_sockaddrstorage,
773[AC_TRY_COMPILE([#include <sys/socket.h>],
774[struct sockaddr_storage s;],
775uucp_cv_struct_sockaddrstorage=yes, uucp_cv_struct_sockaddrstorage=no)])
776AC_MSG_RESULT($uucp_cv_struct_sockaddrstorage)
777if test $uucp_cv_struct_sockaddrstorage = yes; then
778  AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], 1,
779            [Whether you have struct sockaddr_storage])
780fi
781dnl
782if test "$cross_compiling" = yes; then
783 AC_DEFINE([HAVE_LONG_FILE_NAMES], [0])
784 AC_DEFINE([HAVE_RESTARTABLE_SYSCALLS], [-1])
785else
786 AC_SYS_RESTARTABLE_SYSCALLS
787 AC_SYS_LONG_FILE_NAMES
788fi
789dnl
790AC_OUTPUT(Makefile uuconf/Makefile lib/Makefile unix/Makefile)
791