configure.in revision 145479
169408Sachednl Autoconf script for tcsh
269408Sachednl To rebuild the `configure' script from this, execute the command
369408Sachednl 	autoconf
469408Sachednl in the directory containing this script.
569408Sachednl
669408Sachednl You'll also need a version of config.guess from a gnu package
769408Sachednl
869408Sachednl Written by Kaveh Ghazi (ghazi@caip.rutgers.edu) 5/11/96.
969408Sachednl
1069408Sache
11145479SmpAC_PREREQ([2.59])dnl Minimum Autoconf version required.
12145479SmpAC_INIT
13145479SmpAC_CONFIG_SRCDIR([tc.vers.c])
14145479SmpAC_CONFIG_HEADERS([config.h])
1569408Sache
1669408SacheAC_CANONICAL_HOST
1769408Sache
1869408SacheAC_MSG_CHECKING([cached host tuple])
1969408Sacheif { test x"${ac_cv_host_system_type+set}" = x"set" &&
2069408Sache     test x"$ac_cv_host_system_type" != x"$host"; }; then
2169408Sache  AC_MSG_RESULT([different])
2269408Sache  AC_MSG_ERROR([remove config.cache and re-run configure])
2369408Sacheelse
2469408Sache  AC_MSG_RESULT(ok)
2569408Sachefi
2669408Sacheac_cv_host_system_type="$host"
2769408Sache
2869408Sache
2969408Sachechangequote(, )dnl
3069408Sache
3169408Sachecase "${host}" in
3269408Sache
3369408Sache  ## Alpha (DEC) machines.
3469408Sache  alpha*-dec-osf* )
3569408Sache    tcsh_config_file=decosf1
3669408Sache  ;;
3769408Sache
3869408Sache  ## Ultrix
3969408Sache  *-dec-ultrix* )
4069408Sache    tcsh_config_file=ultrix
4169408Sache  ;;
4269408Sache
4369408Sache  ## DGUX
4469408Sache  *-dg-dguxR4* )
4569408Sache    tcsh_config_file=dgux5.4
4669408Sache  ;;
4769408Sache  m88k-dg-dgux5.4R* )
4869408Sache    tcsh_config_file=dgux5.4
4969408Sache  ;;
5069408Sache
5169408Sache  ## HP/UX
5269408Sache  *-hp-hpux7* )
5369408Sache    tcsh_config_file=hpux7
5469408Sache  ;;
5569408Sache  *-hp-hpux[89]* )
5669408Sache    tcsh_config_file=hpux8
5769408Sache  ;;
5869408Sache  *-hp-hpux1[0-9]* )
5983098Smp    tcsh_config_file=hpux11
6069408Sache  ;;
6169408Sache
6269408Sache  ## IBM AIX systems
6369408Sache  *-ibm-aix*)
6469408Sache    tcsh_config_file=aix
6569408Sache  ;;
6669408Sache
6769408Sache  ## SX-4
6869408Sache  sx4-nec-*)
6969408Sache    CC='cc -h0,ansi,novector,float0'
7069408Sache    LDFLAGS='-Gsmall'
7169408Sache    tcsh_config_file=superux8
7269408Sache  ;;
7369408Sache
7469408Sache  ## IBM OS/390 systems
7569408Sache  *-ibm-os390*)
7669408Sache    CC='c89'
7769408Sache    tcsh_config_file=os390
7869408Sache  ;;
7969408Sache
8069408Sache  ## Linux
81145479Smp  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
8269408Sache    tcsh_config_file=linux
8369408Sache  ;;
8469408Sache
8569408Sache  ## Motorola systems
8669408Sache  m68k-motorola-sysv* )
8769408Sache    tcsh_config_file=sysV68
8869408Sache  ;;
8969408Sache  m88k-motorola-sysv3* )
9069408Sache    tcsh_config_file=sysV88
9169408Sache  ;;
9269408Sache
9369408Sache  ## NetBSD systems
9469408Sache  *-*-netbsd*)
9569408Sache    tcsh_config_file=bsd4.4
9669408Sache  ;;
9769408Sache
9869408Sache  ## FreeBSD systems
9969408Sache  *-*-freebsd*)
10069408Sache    tcsh_config_file=bsd4.4
10169408Sache  ;;
10269408Sache
10369408Sache  ## OpenBSD systems
10469408Sache  *-*-openbsd*)
10569408Sache    tcsh_config_file=bsd4.4
10669408Sache  ;;
10769408Sache
10869408Sache  ## BSDI systems
10969408Sache  *-*-bsdi*)
11069408Sache    tcsh_config_file=bsd4.4
11169408Sache  ;;
11269408Sache
11369408Sache  ## Mac OS X Server
11469408Sache  *-*-rhapsody* )
11569408Sache    tcsh_config_file=bsd4.4
11669408Sache  ;;
11769408Sache
118100616Smp  ## Mac OS X Server
119100616Smp  *-*-darwin* )
120100616Smp    tcsh_config_file=bsd4.4
121100616Smp  ;;
122100616Smp
12369408Sache  ## Silicon Graphics machines
12469408Sache  *-sgi-iri* )
12569408Sache    tcsh_config_file=irix
12669408Sache    case "${host_os}" in
12769408Sache      irix[34]*) # Irix-3.x - Irix 4.x
12869408Sache        NON_GNU_DFLAGS='-D__STDC__'
12969408Sache        LIBS='-lsun -lbsd -lc_s'
13069408Sache      ;;
13169408Sache      irix5* | irix6.[01]*) # Irix 5.x, Irix 6.0 - 6.1
13269408Sache        LIBS='-lbsd'
13369408Sache      ;;
13469408Sache      irix6.[2-9]*) # Irix 6.2 and later
13569408Sache	tcsh_config_file=irix62
13669408Sache      ;;
13769408Sache    esac
13869408Sache  ;;
13969408Sache
14069408Sache  ## Suns
14169408Sache  *-sun-sunos3* )
14269408Sache    tcsh_config_file=sunos35
14369408Sache  ;;
14469408Sache  *-sun-sunos4.0* )
14569408Sache    tcsh_config_file=sunos40
14669408Sache  ;;
14769408Sache  *-sun-sunos4.1.[12]* )
14869408Sache    tcsh_config_file=sunos41
14969408Sache  ;;
15069408Sache  *-sun-sunos4.1.[3456]* )
15169408Sache    tcsh_config_file=sunos413
15269408Sache  ;;
15369408Sache  *-*-solaris2.[01]* ) # Should handle sparc or x86
15469408Sache    tcsh_config_file=sol2
15569408Sache  ;;
15669408Sache  *-sun-solaris2.2* ) # Sparc only release
15769408Sache    tcsh_config_file=sol22
15869408Sache  ;;
15969408Sache  *-sun-solaris2.3* ) # Sparc only release
16069408Sache    tcsh_config_file=sol23
16169408Sache  ;;
16269408Sache  *-*-solaris2.[45]* ) # Should handle sparc, x86 and powerpc
16369408Sache    tcsh_config_file=sol24
16469408Sache  ;;
16569408Sache  *-*-solaris2.* ) # Should handle sparc, x86 and powerpc
16669408Sache    tcsh_config_file=sol26
16769408Sache  ;;
16869408Sache
16969408Sache  ## Dell SVR4
17069408Sache  *-dell-sysv4* )
17169408Sache    tcsh_config_file=sysv4
17269408Sache    DFLAGS="$DFLAGS -DDELL"
17369408Sache  ;;
17469408Sache
17569408Sache  ## SVR4 (Generic and otherwise)
17669408Sache  *-*-sysv4* )
17769408Sache    tcsh_config_file=sysv4
17869408Sache  ;;
17969408Sache
18069408Sache  ## Tektronix systems
18169408Sache  m68k-tektronix-bsd* )
18269408Sache    tcsh_config_file=bsd
18369408Sache    NON_GNU_DFLAGS='-DBSD -DUTek'
18469408Sache  ;;
18569408Sache  m88k-tektronix-sysv3* )
18669408Sache    tcsh_config_file=tekXD88
18769408Sache  ;;
18869408Sache
18969408Sache  ## SCO
19069408Sache  *-sco3.2v5*) 
19169408Sache    tcsh_config_file=sco32v5
19269408Sache  ;;
19369408Sache  *-sco3.2v4*)
19469408Sache    tcsh_config_file=sco32v4
19569408Sache  ;;
19669408Sache  *-sco3.2v2*)
19769408Sache    tcsh_config_file=sco32v2
19869408Sache  ;;
19969408Sache
20069408Sache  ## Siemens BS2000 Mainframe
201145479Smp  bs2000-siemens-*)
20269408Sache    tcsh_config_file=bs2000
20369408Sache  ;;
20469408Sache
20569408Sache  ## Convex
20669408Sache  *-convex*)
20769408Sache    tcsh_config_file=convex
20869408Sache  ;;
20969408Sache
21069408Sache  ## Cray
21169408Sache  *-cray-unicos*)
21269408Sache    tcsh_config_file=cray
21369408Sache  ;;
21469408Sache
215145479Smp  ## Red Hat Cygwin
21669408Sache  *-cygwin)
21769408Sache    tcsh_config_file=cygwin32
21869408Sache  ;;
21969408Sache
22069408Sache  ## mips-compaq-nonstopux
22169408Sache  *-*-nonstopux)
22269408Sache    tcsh_config_file=sysv4
22369408Sache  ;;
22469408Sache
22583098Smp  ## Apollo Domain/OS
22683098Smp  *-apollo-*)
22783098Smp    tcsh_config_file=apollo
22883098Smp  ;;
22983098Smp
23069408Sache  * )
23169408Sache  changequote([, ])dnl
23269408Sache  AC_MSG_ERROR([Tcsh can't guess the configuration file name
233145479Smpfor `${host}' systems.
234145479SmpCheck tcsh's `Ported' file for manual configuration instructions.])
23569408Sache  changequote(, )dnl
23669408Sache  ;;
23769408Sache
23869408Sacheesac
23969408Sache
24069408Sacheecho "Tcsh will use configuration file \`$tcsh_config_file'."
24169408Sachechangequote([, ])dnl
242145479Smpcp ${srcdir}/config/${tcsh_config_file} config_p.h
243145479SmpAH_BOTTOM(
244145479Smp[#include "config_p.h"
245145479Smp#include "config_f.h"])
24669408Sache
247145479Smpdnl Checks for programs
24869408SacheAC_PROG_CC
24969408SacheAC_PROG_CPP
25069408SacheAC_PROG_GCC_TRADITIONAL
25169408Sache
252145479Smpif test "x$GCC" != xyes ; then
25369408Sache  DFLAGS="$DFLAGS $NON_GNU_DFLAGS"
25469408Sache  CFLAGS="$CFLAGS $NON_GNU_CFLAGS"
25569408Sachefi
25669408Sache
257145479Smpdnl Checks for libraries
25869408SacheAC_SEARCH_LIBS(crypt, crypt)
259145479SmpAC_SEARCH_LIBS(getspnam, sec)
260145479SmpAC_SEARCH_LIBS(tgetent, termlib termcap curses ncurses)
26169408SacheAC_SEARCH_LIBS(gethostbyname, nsl)
26269408SacheAC_SEARCH_LIBS(connect, socket)
263145479SmpAC_SEARCH_LIBS([iconv], [iconv], [AC_DEFINE([HAVE_ICONV], [1],
264145479Smp	[Define to 1 if you have the iconv () interface])])
26569408Sache
266145479Smpdnl Checks for header files
267145479SmpAC_CHECK_HEADERS([auth.h inttypes.h shadow.h stdint.h])
268145479SmpAC_CHECK_HEADERS([utmpx.h utmp.h])
269145479SmpAC_CHECK_HEADERS([wchar.h],
270145479Smp	[AC_CHECK_SIZEOF([wchar_t], [], [dnl
271145479Smp#include <stdio.h>
272145479Smp#include <wchar.h>])
273145479Smp	AC_CHECK_HEADERS([wctype.h])])
274145479SmpAC_HEADER_DIRENT
275145479SmpAC_HEADER_STAT
276145479SmpAC_HEADER_STDC
277145479Smp
278145479Smpdnl Checks for types
279145479SmpAC_CHECK_TYPES([long long])
280145479SmpAC_TYPE_GETGROUPS
281145479SmpAC_TYPE_MODE_T
282145479SmpAC_TYPE_SIGNAL
283145479SmpAC_TYPE_SIZE_T
284145479SmpAC_TYPE_UID_T
285145479Smp
286145479SmpAC_DEFUN([AC_TYPE_SOCKLEN_T], [
287145479SmpAC_CHECK_TYPE(socklen_t,,
288145479SmpAC_DEFINE(socklen_t, int, [Define to `int' if neither <sys/types.h> nor <sys/socket.h> define.]),
289145479Smp[
290145479Smp#include <sys/types.h>
291145479Smp#include <sys/socket.h>
292145479Smp])
293145479Smp])
294145479SmpAC_TYPE_SOCKLEN_T
295145479Smp
296145479Smp
297145479Smpdnl Checks for structures
298145479SmpAC_CHECK_MEMBERS([struct dirent.d_ino], , ,
299145479Smp[#ifdef HAVE_DIRENT_H
300145479Smp# include <dirent.h>
301145479Smp#else
302145479Smp# ifdef HAVE_NDIR_H
303145479Smp#  include <ndir.h>
304145479Smp# else
305145479Smp#  include <sys/dir.h>
306145479Smp# endif
307145479Smp# define dirent direct
308145479Smp#endif])
309145479SmpAC_CHECK_MEMBERS([struct utmp.ut_host, struct utmp.ut_user, struct utmp.ut_tv,
310145479Smp		  struct utmp.ut_xtime], , ,
311145479Smp[#ifdef HAVE_UTMPX_H
312145479Smp#include <utmpx.h>
313145479Smp#define utmp utmpx
314145479Smp#elif defined HAVE_UTMP_H
315145479Smp#include <utmp.h>
316145479Smp#endif])
317145479SmpAC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], , ,
318145479Smp[#include <sys/types.h>
319145479Smp#include <sys/socket.h>])
320145479Smp
321145479Smpdnl Checks for compiler characteristics
322145479SmpAC_C_CONST
323145479SmpAC_C_PROTOTYPES
324145479SmpAC_C_VOLATILE
325145479Smp
326145479Smpdnl checks for library functions
327145479SmpAC_CHECK_DECLS([gethostname])
328145479SmpAC_CHECK_FUNCS([dup2 getcwd gethostname getpwent getutent memmove memset] dnl
329145479Smp	[nice nl_langinfo sbrk setpgid setpriority strerror strstr sysconf] dnl
330145479Smp	[wcwidth])
331145479SmpAC_FUNC_GETPGRP
332145479SmpAC_FUNC_SETPGRP
333145479Smp
33469408Sachednl This is not good enough; we need sockaddr_storage too.
33569408Sachednl See whether we can use IPv6 related functions
336145479Smpdnl AC_DEFUN([IPv6_CHECK_FUNC], [
33769408Sachednl changequote(, )dnl
33869408Sachednl ac_tr_lib=HAVE_`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
33969408Sachednl   -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
34069408Sachednl changequote([, ])dnl
34169408Sachednl AC_CHECK_FUNC($1, [dnl
34269408Sachednl   AC_DEFINE_UNQUOTED($ac_tr_lib)
34369408Sachednl   ac_cv_lib_inet6_$1=no], [dnl
34469408Sachednl   AC_MSG_CHECKING([whether your system has IPv6 directory])
34569408Sachednl   AC_CACHE_VAL(ipv6_cv_dir, [dnl
34669408Sachednl     for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
34769408Sachednl       if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
34869408Sachednl 	break
34969408Sachednl       fi
35069408Sachednl     done])dnl
35169408Sachednl   AC_MSG_RESULT($ipv6_cv_dir)
35269408Sachednl   if test $ipv6_cv_dir = no; then
35369408Sachednl     ac_cv_lib_inet6_$1=no
35469408Sachednl   else
35569408Sachednl     if test x$ipv6_libinet6 = x; then
35669408Sachednl       ipv6_libinet6=no
35769408Sachednl       SAVELDFLAGS="$LDFLAGS"
35869408Sachednl       LDFLAGS="-L$ipv6_cv_dir/lib"
35969408Sachednl     fi
36069408Sachednl     AC_CHECK_LIB(inet6, $1, [dnl
36169408Sachednl       AC_DEFINE_UNQUOTED($ac_tr_lib)
36269408Sachednl       if test $ipv6_libinet6 = no; then
36369408Sachednl 	ipv6_libinet6=yes
36469408Sachednl 	LIBS="$LIBS -linet6"
36569408Sachednl       fi],)dnl
36669408Sachednl     if test $ipv6_libinet6 = no; then
36769408Sachednl       LDFLAGS="$SAVELDFLAGS"
36869408Sachednl     fi
36969408Sachednl   fi])dnl
37069408Sachednl if test $ac_cv_func_$1 = yes -o $ac_cv_lib_inet6_$1 = yes
37169408Sachednl then
37269408Sachednl   ipv6_cv_$1=yes
37369408Sachednl   ifelse([$2], , :, [$2])
37469408Sachednl else
37569408Sachednl   ipv6_cv_$1=no
37669408Sachednl   ifelse([$3], , :, [$3])
37769408Sachednl fi])
378100616Smpdnl IPv6_CHECK_FUNC(getnameinfo, DFLAGS="$DFLAGS -DINET6")
37969408Sache
38069408SacheAC_SUBST(DFLAGS)
38169408Sache
38269408SacheAC_ARG_WITH(hesiod,
38369408Sache  [  --with-hesiod=PREFIX    Use Hesiod lookup for ~ expansion],
38469408Sache  [hesiod="$withval"], [hesiod=no])
38569408Sacheif test "$hesiod" != no; then
38669408Sache  HESLIB="-lhesiod"
38769408Sache  AC_CHECK_FUNC(res_send, :,
38869408Sache    AC_CHECK_LIB(resolv, res_send, HESLIB="$HESLIB -lresolv"))
38969408Sache  HESDEF=-DHESIOD
39069408Sache  if test "$hesiod" != yes; then
39169408Sache    HESDEF="$HESDEF -I$hesiod/include"
39269408Sache    HESLIB="-L$hesiod/lib $HESLIB"
39369408Sache  fi
39469408Sachefi
39569408SacheAC_SUBST(HESDEF)
39669408SacheAC_SUBST(HESLIB)
39769408Sache
398145479SmpAC_CONFIG_FILES([Makefile])
399145479SmpAC_OUTPUT
400