configure.in revision 195609
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.
12195609SmpAC_INIT([tcsh], [6.17.00], [http://bugs.gw.com/])
13145479SmpAC_CONFIG_SRCDIR([tc.vers.c])
14145479SmpAC_CONFIG_HEADERS([config.h])
15167465SmpAC_CONFIG_TESTDIR([.], [.])
1669408Sache
1769408SacheAC_CANONICAL_HOST
1869408Sache
1969408SacheAC_MSG_CHECKING([cached host tuple])
2069408Sacheif { test x"${ac_cv_host_system_type+set}" = x"set" &&
2169408Sache     test x"$ac_cv_host_system_type" != x"$host"; }; then
2269408Sache  AC_MSG_RESULT([different])
2369408Sache  AC_MSG_ERROR([remove config.cache and re-run configure])
2469408Sacheelse
2569408Sache  AC_MSG_RESULT(ok)
2669408Sachefi
2769408Sacheac_cv_host_system_type="$host"
2869408Sache
2969408Sache
3069408Sachechangequote(, )dnl
3169408Sache
3269408Sachecase "${host}" in
3369408Sache
3469408Sache  ## Alpha (DEC) machines.
3569408Sache  alpha*-dec-osf* )
3669408Sache    tcsh_config_file=decosf1
3769408Sache  ;;
3869408Sache
3969408Sache  ## Ultrix
4069408Sache  *-dec-ultrix* )
4169408Sache    tcsh_config_file=ultrix
4269408Sache  ;;
4369408Sache
4469408Sache  ## DGUX
4569408Sache  *-dg-dguxR4* )
4669408Sache    tcsh_config_file=dgux5.4
4769408Sache  ;;
4869408Sache  m88k-dg-dgux5.4R* )
4969408Sache    tcsh_config_file=dgux5.4
5069408Sache  ;;
5169408Sache
5269408Sache  ## HP/UX
5369408Sache  *-hp-hpux7* )
5469408Sache    tcsh_config_file=hpux7
5569408Sache  ;;
5669408Sache  *-hp-hpux[89]* )
5769408Sache    tcsh_config_file=hpux8
5869408Sache  ;;
5969408Sache  *-hp-hpux1[0-9]* )
6083098Smp    tcsh_config_file=hpux11
6169408Sache  ;;
6269408Sache
6369408Sache  ## IBM AIX systems
6469408Sache  *-ibm-aix*)
6569408Sache    tcsh_config_file=aix
6669408Sache  ;;
6769408Sache
6869408Sache  ## SX-4
6969408Sache  sx4-nec-*)
7069408Sache    CC='cc -h0,ansi,novector,float0'
7169408Sache    LDFLAGS='-Gsmall'
7269408Sache    tcsh_config_file=superux8
7369408Sache  ;;
7469408Sache
7569408Sache  ## IBM OS/390 systems
7669408Sache  *-ibm-os390*)
7769408Sache    CC='c89'
7869408Sache    tcsh_config_file=os390
7969408Sache  ;;
8069408Sache
8169408Sache  ## Linux
82145479Smp  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
8369408Sache    tcsh_config_file=linux
8469408Sache  ;;
8569408Sache
8669408Sache  ## Motorola systems
8769408Sache  m68k-motorola-sysv* )
8869408Sache    tcsh_config_file=sysV68
8969408Sache  ;;
9069408Sache  m88k-motorola-sysv3* )
9169408Sache    tcsh_config_file=sysV88
9269408Sache  ;;
9369408Sache
9469408Sache  ## NetBSD systems
9569408Sache  *-*-netbsd*)
9669408Sache    tcsh_config_file=bsd4.4
9769408Sache  ;;
9869408Sache
9969408Sache  ## FreeBSD systems
10069408Sache  *-*-freebsd*)
10169408Sache    tcsh_config_file=bsd4.4
10269408Sache  ;;
10369408Sache
104195609Smp  ## MidnightBSD systems
105195609Smp  *-*-midnightbsd*)
106195609Smp    tcsh_config_file=bsd4.4
107195609Smp  ;;
108195609Smp  
109195609Smp  ## DragonFlyBSD systems
110195609Smp  *-*-dragonfly*)
111195609Smp    tcsh_config_file=bsd4.4
112195609Smp  ;;
113195609Smp
11469408Sache  ## OpenBSD systems
11569408Sache  *-*-openbsd*)
11669408Sache    tcsh_config_file=bsd4.4
11769408Sache  ;;
11869408Sache
11969408Sache  ## BSDI systems
12069408Sache  *-*-bsdi*)
12169408Sache    tcsh_config_file=bsd4.4
12269408Sache  ;;
12369408Sache
12469408Sache  ## Mac OS X Server
12569408Sache  *-*-rhapsody* )
12669408Sache    tcsh_config_file=bsd4.4
12769408Sache  ;;
12869408Sache
129100616Smp  ## Mac OS X Server
130100616Smp  *-*-darwin* )
131100616Smp    tcsh_config_file=bsd4.4
132100616Smp  ;;
133100616Smp
134167465Smp  ## DragonFly systems
135167465Smp  *-*-dragonfly*)
136167465Smp    tcsh_config_file=bsd4.4
137167465Smp  ;;
138167465Smp
13969408Sache  ## Silicon Graphics machines
14069408Sache  *-sgi-iri* )
14169408Sache    tcsh_config_file=irix
14269408Sache    case "${host_os}" in
14369408Sache      irix[34]*) # Irix-3.x - Irix 4.x
14469408Sache        NON_GNU_DFLAGS='-D__STDC__'
14569408Sache        LIBS='-lsun -lbsd -lc_s'
14669408Sache      ;;
14769408Sache      irix5* | irix6.[01]*) # Irix 5.x, Irix 6.0 - 6.1
14869408Sache        LIBS='-lbsd'
14969408Sache      ;;
15069408Sache      irix6.[2-9]*) # Irix 6.2 and later
15169408Sache	tcsh_config_file=irix62
15269408Sache      ;;
15369408Sache    esac
15469408Sache  ;;
15569408Sache
15669408Sache  ## Suns
15769408Sache  *-sun-sunos3* )
15869408Sache    tcsh_config_file=sunos35
15969408Sache  ;;
16069408Sache  *-sun-sunos4.0* )
16169408Sache    tcsh_config_file=sunos40
16269408Sache  ;;
16369408Sache  *-sun-sunos4.1.[12]* )
16469408Sache    tcsh_config_file=sunos41
16569408Sache  ;;
16669408Sache  *-sun-sunos4.1.[3456]* )
16769408Sache    tcsh_config_file=sunos413
16869408Sache  ;;
169167465Smp  *-*-solaris2.[01] ) # Should handle sparc or x86
17069408Sache    tcsh_config_file=sol2
17169408Sache  ;;
172167465Smp  *-sun-solaris2.2 ) # Sparc only release
17369408Sache    tcsh_config_file=sol22
17469408Sache  ;;
175167465Smp  *-sun-solaris2.3 ) # Sparc only release
17669408Sache    tcsh_config_file=sol23
17769408Sache  ;;
178167465Smp  *-*-solaris2.[45] ) # Should handle sparc, x86 and powerpc
17969408Sache    tcsh_config_file=sol24
18069408Sache  ;;
18169408Sache  *-*-solaris2.* ) # Should handle sparc, x86 and powerpc
18269408Sache    tcsh_config_file=sol26
18369408Sache  ;;
18469408Sache
18569408Sache  ## Dell SVR4
18669408Sache  *-dell-sysv4* )
18769408Sache    tcsh_config_file=sysv4
18869408Sache    DFLAGS="$DFLAGS -DDELL"
18969408Sache  ;;
19069408Sache
19169408Sache  ## SVR4 (Generic and otherwise)
19269408Sache  *-*-sysv4* )
19369408Sache    tcsh_config_file=sysv4
19469408Sache  ;;
19569408Sache
19669408Sache  ## Tektronix systems
19769408Sache  m68k-tektronix-bsd* )
19869408Sache    tcsh_config_file=bsd
19969408Sache    NON_GNU_DFLAGS='-DBSD -DUTek'
20069408Sache  ;;
20169408Sache  m88k-tektronix-sysv3* )
20269408Sache    tcsh_config_file=tekXD88
20369408Sache  ;;
20469408Sache
20569408Sache  ## SCO
20669408Sache  *-sco3.2v5*) 
20769408Sache    tcsh_config_file=sco32v5
20869408Sache  ;;
20969408Sache  *-sco3.2v4*)
21069408Sache    tcsh_config_file=sco32v4
21169408Sache  ;;
21269408Sache  *-sco3.2v2*)
21369408Sache    tcsh_config_file=sco32v2
21469408Sache  ;;
21569408Sache
21669408Sache  ## Siemens BS2000 Mainframe
217145479Smp  bs2000-siemens-*)
21869408Sache    tcsh_config_file=bs2000
21969408Sache  ;;
22069408Sache
22169408Sache  ## Convex
22269408Sache  *-convex*)
22369408Sache    tcsh_config_file=convex
22469408Sache  ;;
22569408Sache
22669408Sache  ## Cray
22769408Sache  *-cray-unicos*)
22869408Sache    tcsh_config_file=cray
22969408Sache  ;;
23069408Sache
231145479Smp  ## Red Hat Cygwin
23269408Sache  *-cygwin)
23369408Sache    tcsh_config_file=cygwin32
23469408Sache  ;;
23569408Sache
23669408Sache  ## mips-compaq-nonstopux
23769408Sache  *-*-nonstopux)
23869408Sache    tcsh_config_file=sysv4
23969408Sache  ;;
24069408Sache
24183098Smp  ## Apollo Domain/OS
24283098Smp  *-apollo-*)
24383098Smp    tcsh_config_file=apollo
24483098Smp  ;;
24583098Smp
246195609Smp  ## QNX6
247195609Smp  *-qnx6*)
248195609Smp    tcsh_config_file=qnx6
249195609Smp  ;;
250195609Smp
25169408Sache  * )
25269408Sache  changequote([, ])dnl
25369408Sache  AC_MSG_ERROR([Tcsh can't guess the configuration file name
254145479Smpfor `${host}' systems.
255145479SmpCheck tcsh's `Ported' file for manual configuration instructions.])
25669408Sache  changequote(, )dnl
25769408Sache  ;;
25869408Sache
25969408Sacheesac
26069408Sache
26169408Sacheecho "Tcsh will use configuration file \`$tcsh_config_file'."
26269408Sachechangequote([, ])dnl
263145479Smpcp ${srcdir}/config/${tcsh_config_file} config_p.h
264145479SmpAH_BOTTOM(
265145479Smp[#include "config_p.h"
266145479Smp#include "config_f.h"])
26769408Sache
268145479Smpdnl Checks for programs
26969408SacheAC_PROG_CC
27069408SacheAC_PROG_CPP
27169408SacheAC_PROG_GCC_TRADITIONAL
27269408Sache
273145479Smpif test "x$GCC" != xyes ; then
27469408Sache  DFLAGS="$DFLAGS $NON_GNU_DFLAGS"
27569408Sache  CFLAGS="$CFLAGS $NON_GNU_CFLAGS"
27669408Sachefi
27769408Sache
278145479Smpdnl Checks for libraries
27969408SacheAC_SEARCH_LIBS(crypt, crypt)
280145479SmpAC_SEARCH_LIBS(getspnam, sec)
281145479SmpAC_SEARCH_LIBS(tgetent, termlib termcap curses ncurses)
28269408SacheAC_SEARCH_LIBS(gethostbyname, nsl)
28369408SacheAC_SEARCH_LIBS(connect, socket)
284167465SmpAM_ICONV
28569408Sache
286145479Smpdnl Checks for header files
287167465SmpAC_CHECK_HEADERS([auth.h crypt.h inttypes.h shadow.h stdint.h utmp.h utmpx.h])
288145479SmpAC_CHECK_HEADERS([wchar.h],
289145479Smp	[AC_CHECK_SIZEOF([wchar_t], [], [dnl
290145479Smp#include <stdio.h>
291145479Smp#include <wchar.h>])
292145479Smp	AC_CHECK_HEADERS([wctype.h])])
293145479SmpAC_HEADER_DIRENT
294145479SmpAC_HEADER_STAT
295145479SmpAC_HEADER_STDC
296145479Smp
297145479Smpdnl Checks for types
298145479SmpAC_CHECK_TYPES([long long])
299145479SmpAC_TYPE_GETGROUPS
300145479SmpAC_TYPE_MODE_T
301145479SmpAC_TYPE_SIZE_T
302145479SmpAC_TYPE_UID_T
303145479Smp
304167465SmpAC_DEFUN([AC_TYPE_SSIZE_T], [
305167465SmpAC_CHECK_TYPE(ssize_t,,
306167465SmpAC_DEFINE(ssize_t, int, [Define to `int' not defined in <sys/types.h>.]),
307167465Smp[
308167465Smp#include <sys/types.h>
309167465Smp])
310167465Smp])
311167465SmpAC_TYPE_SSIZE_T
312167465Smp
313145479SmpAC_DEFUN([AC_TYPE_SOCKLEN_T], [
314145479SmpAC_CHECK_TYPE(socklen_t,,
315145479SmpAC_DEFINE(socklen_t, int, [Define to `int' if neither <sys/types.h> nor <sys/socket.h> define.]),
316145479Smp[
317145479Smp#include <sys/types.h>
318145479Smp#include <sys/socket.h>
319145479Smp])
320145479Smp])
321145479SmpAC_TYPE_SOCKLEN_T
322145479Smp
323145479Smp
324145479Smpdnl Checks for structures
325145479SmpAC_CHECK_MEMBERS([struct dirent.d_ino], , ,
326145479Smp[#ifdef HAVE_DIRENT_H
327145479Smp# include <dirent.h>
328145479Smp#else
329145479Smp# ifdef HAVE_NDIR_H
330145479Smp#  include <ndir.h>
331145479Smp# else
332145479Smp#  include <sys/dir.h>
333145479Smp# endif
334145479Smp# define dirent direct
335145479Smp#endif])
336145479SmpAC_CHECK_MEMBERS([struct utmp.ut_host, struct utmp.ut_user, struct utmp.ut_tv,
337145479Smp		  struct utmp.ut_xtime], , ,
338167465Smp[#include <sys/types.h>
339167465Smp#ifdef HAVE_UTMPX_H
340145479Smp#include <utmpx.h>
341145479Smp#define utmp utmpx
342145479Smp#elif defined HAVE_UTMP_H
343145479Smp#include <utmp.h>
344145479Smp#endif])
345145479SmpAC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], , ,
346145479Smp[#include <sys/types.h>
347145479Smp#include <sys/socket.h>])
348145479Smp
349145479Smpdnl Checks for compiler characteristics
350145479SmpAC_C_CONST
351145479SmpAC_C_VOLATILE
352145479Smp
353145479Smpdnl checks for library functions
354167465SmpAC_CHECK_DECLS([crypt, environ, gethostname, getpgrp], , ,
355167465Smp[#include "config_p.h"
356167465SmpAC_INCLUDES_DEFAULT([])
357167465Smp#ifdef HAVE_CRYPT_H
358167465Smp#include <crypt.h>
359167465Smp#endif
360167465Smp])
361167465SmpAC_CHECK_FUNC([setlocale], [have_setlocale=yes], [have_setlocale=no])
362167465SmpAC_CHECK_FUNCS([catgets dup2 getauthid getcwd gethostname getpwent] dnl
363167465Smp	[getutent memmove memset nice nl_langinfo sbrk setpgid setpriority] dnl
364167465Smp	[strerror strstr sysconf wcwidth])
365145479SmpAC_FUNC_GETPGRP
366167465SmpAC_FUNC_MBRTOWC
367145479SmpAC_FUNC_SETPGRP
368167465SmpAC_FUNC_STRCOLL
369145479Smp
37069408Sachednl This is not good enough; we need sockaddr_storage too.
37169408Sachednl See whether we can use IPv6 related functions
372145479Smpdnl AC_DEFUN([IPv6_CHECK_FUNC], [
37369408Sachednl changequote(, )dnl
37469408Sachednl ac_tr_lib=HAVE_`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
37569408Sachednl   -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
37669408Sachednl changequote([, ])dnl
37769408Sachednl AC_CHECK_FUNC($1, [dnl
37869408Sachednl   AC_DEFINE_UNQUOTED($ac_tr_lib)
37969408Sachednl   ac_cv_lib_inet6_$1=no], [dnl
38069408Sachednl   AC_MSG_CHECKING([whether your system has IPv6 directory])
38169408Sachednl   AC_CACHE_VAL(ipv6_cv_dir, [dnl
38269408Sachednl     for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
38369408Sachednl       if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
38469408Sachednl 	break
38569408Sachednl       fi
38669408Sachednl     done])dnl
38769408Sachednl   AC_MSG_RESULT($ipv6_cv_dir)
38869408Sachednl   if test $ipv6_cv_dir = no; then
38969408Sachednl     ac_cv_lib_inet6_$1=no
39069408Sachednl   else
39169408Sachednl     if test x$ipv6_libinet6 = x; then
39269408Sachednl       ipv6_libinet6=no
39369408Sachednl       SAVELDFLAGS="$LDFLAGS"
39469408Sachednl       LDFLAGS="-L$ipv6_cv_dir/lib"
39569408Sachednl     fi
39669408Sachednl     AC_CHECK_LIB(inet6, $1, [dnl
39769408Sachednl       AC_DEFINE_UNQUOTED($ac_tr_lib)
39869408Sachednl       if test $ipv6_libinet6 = no; then
39969408Sachednl 	ipv6_libinet6=yes
40069408Sachednl 	LIBS="$LIBS -linet6"
40169408Sachednl       fi],)dnl
40269408Sachednl     if test $ipv6_libinet6 = no; then
40369408Sachednl       LDFLAGS="$SAVELDFLAGS"
40469408Sachednl     fi
40569408Sachednl   fi])dnl
40669408Sachednl if test $ac_cv_func_$1 = yes -o $ac_cv_lib_inet6_$1 = yes
40769408Sachednl then
40869408Sachednl   ipv6_cv_$1=yes
40969408Sachednl   ifelse([$2], , :, [$2])
41069408Sachednl else
41169408Sachednl   ipv6_cv_$1=no
41269408Sachednl   ifelse([$3], , :, [$3])
41369408Sachednl fi])
414100616Smpdnl IPv6_CHECK_FUNC(getnameinfo, DFLAGS="$DFLAGS -DINET6")
41569408Sache
41669408SacheAC_SUBST(DFLAGS)
41769408Sache
418167465Smpdnl Checks for system services
419167465Smpif test "$have_setlocale" != no; then
420167465Smp  AC_ARG_ENABLE([nls], AS_HELP_STRING([--disable-nls], [Disable NLS support]),
421167465Smp	        [], [enable_nls=yes])
422167465Smp  if test "x$enable_nls" != xno; then
423167465Smp    AC_DEFINE([NLS], [1], [Support NLS.])
424167465Smp  fi
425167465Smpfi
426167465Smp
42769408SacheAC_ARG_WITH(hesiod,
42869408Sache  [  --with-hesiod=PREFIX    Use Hesiod lookup for ~ expansion],
42969408Sache  [hesiod="$withval"], [hesiod=no])
43069408Sacheif test "$hesiod" != no; then
43169408Sache  HESLIB="-lhesiod"
43269408Sache  AC_CHECK_FUNC(res_send, :,
43369408Sache    AC_CHECK_LIB(resolv, res_send, HESLIB="$HESLIB -lresolv"))
43469408Sache  HESDEF=-DHESIOD
43569408Sache  if test "$hesiod" != yes; then
43669408Sache    HESDEF="$HESDEF -I$hesiod/include"
43769408Sache    HESLIB="-L$hesiod/lib $HESLIB"
43869408Sache  fi
43969408Sachefi
44069408SacheAC_SUBST(HESDEF)
44169408SacheAC_SUBST(HESLIB)
44269408Sache
443145479SmpAC_CONFIG_FILES([Makefile])
444145479SmpAC_OUTPUT
445