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
10232633Smpdnl $tcsh: configure.in,v 3.99 2012/02/13 16:33:50 christos Exp $
1169408Sache
12145479SmpAC_PREREQ([2.59])dnl Minimum Autoconf version required.
13232633SmpAC_INIT([tcsh], [6.18.01], [http://bugs.gw.com/])
14232633SmpAC_CONFIG_MACRO_DIR([m4])
15145479SmpAC_CONFIG_SRCDIR([tc.vers.c])
16145479SmpAC_CONFIG_HEADERS([config.h])
17167465SmpAC_CONFIG_TESTDIR([.], [.])
1869408Sache
19232633SmpAC_PROG_INSTALL
2069408SacheAC_CANONICAL_HOST
2169408Sache
2269408SacheAC_MSG_CHECKING([cached host tuple])
2369408Sacheif { test x"${ac_cv_host_system_type+set}" = x"set" &&
2469408Sache     test x"$ac_cv_host_system_type" != x"$host"; }; then
2569408Sache  AC_MSG_RESULT([different])
2669408Sache  AC_MSG_ERROR([remove config.cache and re-run configure])
2769408Sacheelse
2869408Sache  AC_MSG_RESULT(ok)
2969408Sachefi
3069408Sacheac_cv_host_system_type="$host"
3169408Sache
3269408Sache
3369408Sachechangequote(, )dnl
3469408Sache
3569408Sachecase "${host}" in
3669408Sache
3769408Sache  ## Alpha (DEC) machines.
3869408Sache  alpha*-dec-osf* )
3969408Sache    tcsh_config_file=decosf1
4069408Sache  ;;
4169408Sache
4269408Sache  ## Ultrix
4369408Sache  *-dec-ultrix* )
4469408Sache    tcsh_config_file=ultrix
4569408Sache  ;;
4669408Sache
4769408Sache  ## DGUX
4869408Sache  *-dg-dguxR4* )
4969408Sache    tcsh_config_file=dgux5.4
5069408Sache  ;;
5169408Sache  m88k-dg-dgux5.4R* )
5269408Sache    tcsh_config_file=dgux5.4
5369408Sache  ;;
5469408Sache
5569408Sache  ## HP/UX
5669408Sache  *-hp-hpux7* )
5769408Sache    tcsh_config_file=hpux7
5869408Sache  ;;
5969408Sache  *-hp-hpux[89]* )
6069408Sache    tcsh_config_file=hpux8
6169408Sache  ;;
6269408Sache  *-hp-hpux1[0-9]* )
6383098Smp    tcsh_config_file=hpux11
6469408Sache  ;;
6569408Sache
6669408Sache  ## IBM AIX systems
6769408Sache  *-ibm-aix*)
6869408Sache    tcsh_config_file=aix
6969408Sache  ;;
7069408Sache
7169408Sache  ## SX-4
7269408Sache  sx4-nec-*)
7369408Sache    CC='cc -h0,ansi,novector,float0'
7469408Sache    LDFLAGS='-Gsmall'
7569408Sache    tcsh_config_file=superux8
7669408Sache  ;;
7769408Sache
7869408Sache  ## IBM OS/390 systems
7969408Sache  *-ibm-os390*)
8069408Sache    CC='c89'
8169408Sache    tcsh_config_file=os390
8269408Sache  ;;
8369408Sache
84232633Smp  ## Android
85232633Smp  *-*-android*)
86232633Smp    tcsh_config_file=android
87232633Smp  ;;
88232633Smp
8969408Sache  ## Linux
90145479Smp  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
9169408Sache    tcsh_config_file=linux
9269408Sache  ;;
9369408Sache
9469408Sache  ## Motorola systems
9569408Sache  m68k-motorola-sysv* )
9669408Sache    tcsh_config_file=sysV68
9769408Sache  ;;
9869408Sache  m88k-motorola-sysv3* )
9969408Sache    tcsh_config_file=sysV88
10069408Sache  ;;
10169408Sache
10269408Sache  ## NetBSD systems
10369408Sache  *-*-netbsd*)
10469408Sache    tcsh_config_file=bsd4.4
10569408Sache  ;;
10669408Sache
10769408Sache  ## FreeBSD systems
10869408Sache  *-*-freebsd*)
10969408Sache    tcsh_config_file=bsd4.4
11069408Sache  ;;
11169408Sache
112195609Smp  ## MidnightBSD systems
113195609Smp  *-*-midnightbsd*)
114195609Smp    tcsh_config_file=bsd4.4
115195609Smp  ;;
116195609Smp  
117195609Smp  ## DragonFlyBSD systems
118195609Smp  *-*-dragonfly*)
119195609Smp    tcsh_config_file=bsd4.4
120195609Smp  ;;
121195609Smp
12269408Sache  ## OpenBSD systems
12369408Sache  *-*-openbsd*)
12469408Sache    tcsh_config_file=bsd4.4
12569408Sache  ;;
12669408Sache
12769408Sache  ## BSDI systems
12869408Sache  *-*-bsdi*)
12969408Sache    tcsh_config_file=bsd4.4
13069408Sache  ;;
13169408Sache
13269408Sache  ## Mac OS X Server
13369408Sache  *-*-rhapsody* )
13469408Sache    tcsh_config_file=bsd4.4
13569408Sache  ;;
13669408Sache
137100616Smp  ## Mac OS X Server
138100616Smp  *-*-darwin* )
139100616Smp    tcsh_config_file=bsd4.4
140100616Smp  ;;
141100616Smp
142167465Smp  ## DragonFly systems
143167465Smp  *-*-dragonfly*)
144167465Smp    tcsh_config_file=bsd4.4
145167465Smp  ;;
146167465Smp
14769408Sache  ## Silicon Graphics machines
14869408Sache  *-sgi-iri* )
14969408Sache    tcsh_config_file=irix
15069408Sache    case "${host_os}" in
15169408Sache      irix[34]*) # Irix-3.x - Irix 4.x
15269408Sache        NON_GNU_DFLAGS='-D__STDC__'
15369408Sache        LIBS='-lsun -lbsd -lc_s'
15469408Sache      ;;
15569408Sache      irix5* | irix6.[01]*) # Irix 5.x, Irix 6.0 - 6.1
15669408Sache        LIBS='-lbsd'
15769408Sache      ;;
15869408Sache      irix6.[2-9]*) # Irix 6.2 and later
15969408Sache	tcsh_config_file=irix62
16069408Sache      ;;
16169408Sache    esac
16269408Sache  ;;
16369408Sache
16469408Sache  ## Suns
16569408Sache  *-sun-sunos3* )
16669408Sache    tcsh_config_file=sunos35
16769408Sache  ;;
16869408Sache  *-sun-sunos4.0* )
16969408Sache    tcsh_config_file=sunos40
17069408Sache  ;;
17169408Sache  *-sun-sunos4.1.[12]* )
17269408Sache    tcsh_config_file=sunos41
17369408Sache  ;;
17469408Sache  *-sun-sunos4.1.[3456]* )
17569408Sache    tcsh_config_file=sunos413
17669408Sache  ;;
177167465Smp  *-*-solaris2.[01] ) # Should handle sparc or x86
17869408Sache    tcsh_config_file=sol2
17969408Sache  ;;
180167465Smp  *-sun-solaris2.2 ) # Sparc only release
18169408Sache    tcsh_config_file=sol22
18269408Sache  ;;
183167465Smp  *-sun-solaris2.3 ) # Sparc only release
18469408Sache    tcsh_config_file=sol23
18569408Sache  ;;
186167465Smp  *-*-solaris2.[45] ) # Should handle sparc, x86 and powerpc
18769408Sache    tcsh_config_file=sol24
18869408Sache  ;;
189232633Smp  *-*-solaris2.[678] ) # Should handle sparc, x86 and powerpc
19069408Sache    tcsh_config_file=sol26
19169408Sache  ;;
192232633Smp  *-*-solaris2.* ) # Should handle sparc, x86 and powerpc
193232633Smp    tcsh_config_file=sol29
194232633Smp  ;;
19569408Sache
19669408Sache  ## Dell SVR4
19769408Sache  *-dell-sysv4* )
19869408Sache    tcsh_config_file=sysv4
19969408Sache    DFLAGS="$DFLAGS -DDELL"
20069408Sache  ;;
20169408Sache
20269408Sache  ## SVR4 (Generic and otherwise)
20369408Sache  *-*-sysv4* )
20469408Sache    tcsh_config_file=sysv4
20569408Sache  ;;
20669408Sache
20769408Sache  ## Tektronix systems
20869408Sache  m68k-tektronix-bsd* )
20969408Sache    tcsh_config_file=bsd
21069408Sache    NON_GNU_DFLAGS='-DBSD -DUTek'
21169408Sache  ;;
21269408Sache  m88k-tektronix-sysv3* )
21369408Sache    tcsh_config_file=tekXD88
21469408Sache  ;;
21569408Sache
21669408Sache  ## SCO
21769408Sache  *-sco3.2v5*) 
21869408Sache    tcsh_config_file=sco32v5
21969408Sache  ;;
22069408Sache  *-sco3.2v4*)
22169408Sache    tcsh_config_file=sco32v4
22269408Sache  ;;
22369408Sache  *-sco3.2v2*)
22469408Sache    tcsh_config_file=sco32v2
22569408Sache  ;;
22669408Sache
22769408Sache  ## Siemens BS2000 Mainframe
228145479Smp  bs2000-siemens-*)
22969408Sache    tcsh_config_file=bs2000
23069408Sache  ;;
23169408Sache
23269408Sache  ## Convex
23369408Sache  *-convex*)
23469408Sache    tcsh_config_file=convex
23569408Sache  ;;
23669408Sache
23769408Sache  ## Cray
23869408Sache  *-cray-unicos*)
23969408Sache    tcsh_config_file=cray
24069408Sache  ;;
24169408Sache
242145479Smp  ## Red Hat Cygwin
24369408Sache  *-cygwin)
244232633Smp    tcsh_config_file=cygwin
24569408Sache  ;;
24669408Sache
24769408Sache  ## mips-compaq-nonstopux
24869408Sache  *-*-nonstopux)
24969408Sache    tcsh_config_file=sysv4
25069408Sache  ;;
25169408Sache
25283098Smp  ## Apollo Domain/OS
25383098Smp  *-apollo-*)
25483098Smp    tcsh_config_file=apollo
25583098Smp  ;;
25683098Smp
257195609Smp  ## QNX6
258195609Smp  *-qnx6*)
259195609Smp    tcsh_config_file=qnx6
260195609Smp  ;;
261195609Smp
26269408Sache  * )
26369408Sache  changequote([, ])dnl
26469408Sache  AC_MSG_ERROR([Tcsh can't guess the configuration file name
265145479Smpfor `${host}' systems.
266145479SmpCheck tcsh's `Ported' file for manual configuration instructions.])
26769408Sache  changequote(, )dnl
26869408Sache  ;;
26969408Sache
27069408Sacheesac
27169408Sache
27269408Sacheecho "Tcsh will use configuration file \`$tcsh_config_file'."
27369408Sachechangequote([, ])dnl
274145479Smpcp ${srcdir}/config/${tcsh_config_file} config_p.h
275145479SmpAH_BOTTOM(
276145479Smp[#include "config_p.h"
277145479Smp#include "config_f.h"])
27869408Sache
279145479Smpdnl Checks for programs
28069408SacheAC_PROG_CC
28169408SacheAC_PROG_CPP
28269408SacheAC_PROG_GCC_TRADITIONAL
28369408Sache
284232633SmpAC_PATH_PROG([GENCAT], [gencat]) 
285232633Smp
286232633Smpdnl Require build CC to create gethost helper when cross building
287232633Smpif test "x${cross_compiling}" = xyes ; then
288232633Smp  CC_FOR_GETHOST="cc"
289232633Smpelse
290232633Smp  CC_FOR_GETHOST="\$(CC)"
291232633Smpfi
292232633SmpAC_SUBST(CC_FOR_GETHOST)
293232633Smp
294145479Smpif test "x$GCC" != xyes ; then
29569408Sache  DFLAGS="$DFLAGS $NON_GNU_DFLAGS"
29669408Sache  CFLAGS="$CFLAGS $NON_GNU_CFLAGS"
29769408Sachefi
29869408Sache
299145479Smpdnl Checks for libraries
30069408SacheAC_SEARCH_LIBS(crypt, crypt)
301145479SmpAC_SEARCH_LIBS(getspnam, sec)
302145479SmpAC_SEARCH_LIBS(tgetent, termlib termcap curses ncurses)
30369408SacheAC_SEARCH_LIBS(gethostbyname, nsl)
30469408SacheAC_SEARCH_LIBS(connect, socket)
305232633SmpAC_SEARCH_LIBS(catgets, catgets)
306167465SmpAM_ICONV
30769408Sache
308145479Smpdnl Checks for header files
309232633SmpAC_CHECK_HEADERS([auth.h crypt.h features.h inttypes.h paths.h] dnl
310232633Smp		 [shadow.h stdint.h utmp.h utmpx.h])
311145479SmpAC_CHECK_HEADERS([wchar.h],
312145479Smp	[AC_CHECK_SIZEOF([wchar_t], [], [dnl
313145479Smp#include <stdio.h>
314145479Smp#include <wchar.h>])
315145479Smp	AC_CHECK_HEADERS([wctype.h])])
316145479SmpAC_HEADER_DIRENT
317145479SmpAC_HEADER_STAT
318145479SmpAC_HEADER_STDC
319145479Smp
320145479Smpdnl Checks for types
321145479SmpAC_CHECK_TYPES([long long])
322145479SmpAC_TYPE_GETGROUPS
323145479SmpAC_TYPE_MODE_T
324145479SmpAC_TYPE_SIZE_T
325145479SmpAC_TYPE_UID_T
326232633SmpAC_TYPE_UINT32_T
327145479Smp
328167465SmpAC_DEFUN([AC_TYPE_SSIZE_T], [
329167465SmpAC_CHECK_TYPE(ssize_t,,
330167465SmpAC_DEFINE(ssize_t, int, [Define to `int' not defined in <sys/types.h>.]),
331167465Smp[
332167465Smp#include <sys/types.h>
333167465Smp])
334167465Smp])
335167465SmpAC_TYPE_SSIZE_T
336167465Smp
337145479SmpAC_DEFUN([AC_TYPE_SOCKLEN_T], [
338145479SmpAC_CHECK_TYPE(socklen_t,,
339145479SmpAC_DEFINE(socklen_t, int, [Define to `int' if neither <sys/types.h> nor <sys/socket.h> define.]),
340145479Smp[
341145479Smp#include <sys/types.h>
342145479Smp#include <sys/socket.h>
343145479Smp])
344145479Smp])
345145479SmpAC_TYPE_SOCKLEN_T
346145479Smp
347145479Smp
348145479Smpdnl Checks for structures
349145479SmpAC_CHECK_MEMBERS([struct dirent.d_ino], , ,
350145479Smp[#ifdef HAVE_DIRENT_H
351145479Smp# include <dirent.h>
352145479Smp#else
353145479Smp# ifdef HAVE_NDIR_H
354145479Smp#  include <ndir.h>
355145479Smp# else
356145479Smp#  include <sys/dir.h>
357145479Smp# endif
358145479Smp# define dirent direct
359145479Smp#endif])
360145479SmpAC_CHECK_MEMBERS([struct utmp.ut_host, struct utmp.ut_user, struct utmp.ut_tv,
361232633Smp		  struct utmp.ut_xtime, struct utmpx.ut_host,
362232633Smp		  struct utmpx.ut_user, struct utmpx.ut_tv,
363232633Smp		  struct utmpx.ut_xtime], , ,
364167465Smp[#include <sys/types.h>
365167465Smp#ifdef HAVE_UTMPX_H
366145479Smp#include <utmpx.h>
367145479Smp#define utmp utmpx
368145479Smp#elif defined HAVE_UTMP_H
369145479Smp#include <utmp.h>
370145479Smp#endif])
371145479SmpAC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], , ,
372145479Smp[#include <sys/types.h>
373145479Smp#include <sys/socket.h>])
374145479Smp
375145479Smpdnl Checks for compiler characteristics
376145479SmpAC_C_CONST
377145479SmpAC_C_VOLATILE
378145479Smp
379145479Smpdnl checks for library functions
380167465SmpAC_CHECK_DECLS([crypt, environ, gethostname, getpgrp], , ,
381167465Smp[#include "config_p.h"
382167465SmpAC_INCLUDES_DEFAULT([])
383167465Smp#ifdef HAVE_CRYPT_H
384167465Smp#include <crypt.h>
385167465Smp#endif
386167465Smp])
387167465SmpAC_CHECK_FUNC([setlocale], [have_setlocale=yes], [have_setlocale=no])
388232633SmpAC_CHECK_FUNC([catgets], [have_catgets=yes], [have_catgets=no])
389232633SmpAC_CHECK_FUNCS([dup2 getauthid getcwd gethostname getpwent] dnl
390232633Smp	[getutent getutxent mallinfo memmove memset mkstemp nice] dnl
391232633Smp	[nl_langinfo sbrk setpgid setpriority strerror strstr sysconf wcwidth])
392145479SmpAC_FUNC_GETPGRP
393167465SmpAC_FUNC_MBRTOWC
394232633Smpif test "x${cross_compiling}" != xyes ; then
395232633Smp  AC_FUNC_SETPGRP
396232633Smpelse
397232633Smp  ac_cv_func_setpgrp_void=yes
398232633Smpfi
399167465SmpAC_FUNC_STRCOLL
400145479Smp
40169408Sachednl This is not good enough; we need sockaddr_storage too.
40269408Sachednl See whether we can use IPv6 related functions
403145479Smpdnl AC_DEFUN([IPv6_CHECK_FUNC], [
40469408Sachednl changequote(, )dnl
40569408Sachednl ac_tr_lib=HAVE_`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
40669408Sachednl   -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
40769408Sachednl changequote([, ])dnl
40869408Sachednl AC_CHECK_FUNC($1, [dnl
40969408Sachednl   AC_DEFINE_UNQUOTED($ac_tr_lib)
41069408Sachednl   ac_cv_lib_inet6_$1=no], [dnl
41169408Sachednl   AC_MSG_CHECKING([whether your system has IPv6 directory])
41269408Sachednl   AC_CACHE_VAL(ipv6_cv_dir, [dnl
41369408Sachednl     for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
41469408Sachednl       if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
41569408Sachednl 	break
41669408Sachednl       fi
41769408Sachednl     done])dnl
41869408Sachednl   AC_MSG_RESULT($ipv6_cv_dir)
41969408Sachednl   if test $ipv6_cv_dir = no; then
42069408Sachednl     ac_cv_lib_inet6_$1=no
42169408Sachednl   else
42269408Sachednl     if test x$ipv6_libinet6 = x; then
42369408Sachednl       ipv6_libinet6=no
42469408Sachednl       SAVELDFLAGS="$LDFLAGS"
42569408Sachednl       LDFLAGS="-L$ipv6_cv_dir/lib"
42669408Sachednl     fi
42769408Sachednl     AC_CHECK_LIB(inet6, $1, [dnl
42869408Sachednl       AC_DEFINE_UNQUOTED($ac_tr_lib)
42969408Sachednl       if test $ipv6_libinet6 = no; then
43069408Sachednl 	ipv6_libinet6=yes
43169408Sachednl 	LIBS="$LIBS -linet6"
43269408Sachednl       fi],)dnl
43369408Sachednl     if test $ipv6_libinet6 = no; then
43469408Sachednl       LDFLAGS="$SAVELDFLAGS"
43569408Sachednl     fi
43669408Sachednl   fi])dnl
43769408Sachednl if test $ac_cv_func_$1 = yes -o $ac_cv_lib_inet6_$1 = yes
43869408Sachednl then
43969408Sachednl   ipv6_cv_$1=yes
44069408Sachednl   ifelse([$2], , :, [$2])
44169408Sachednl else
44269408Sachednl   ipv6_cv_$1=no
44369408Sachednl   ifelse([$3], , :, [$3])
44469408Sachednl fi])
445100616Smpdnl IPv6_CHECK_FUNC(getnameinfo, DFLAGS="$DFLAGS -DINET6")
44669408Sache
44769408SacheAC_SUBST(DFLAGS)
44869408Sache
449167465Smpdnl Checks for system services
450167465Smpif test "$have_setlocale" != no; then
451167465Smp  AC_ARG_ENABLE([nls], AS_HELP_STRING([--disable-nls], [Disable NLS support]),
452167465Smp	        [], [enable_nls=yes])
453167465Smp  if test "x$enable_nls" != xno; then
454167465Smp    AC_DEFINE([NLS], [1], [Support NLS.])
455167465Smp  fi
456167465Smpfi
457167465Smp
458232633Smpif test "x$enable_nls" != xno -a "$have_catgets" != no -a -n "$GENCAT" ; then
459232633Smp  AC_ARG_ENABLE([nls-catalogs], AS_HELP_STRING([--disable-nls-catalogs], [Disable NLS catalog support]),
460232633Smp	        [], [enable_nls_catalogs=yes])
461232633Smp  if test "x$enable_nls_catalogs" != xno; then
462232633Smp    BUILD_CATALOGS="yes"
463232633Smp    AC_DEFINE([NLS_CATALOGS], [1], [Support NLS catalogs.])
464232633Smp  fi
465232633Smpfi
466232633Smp
46769408SacheAC_ARG_WITH(hesiod,
46869408Sache  [  --with-hesiod=PREFIX    Use Hesiod lookup for ~ expansion],
46969408Sache  [hesiod="$withval"], [hesiod=no])
47069408Sacheif test "$hesiod" != no; then
47169408Sache  HESLIB="-lhesiod"
47269408Sache  AC_CHECK_FUNC(res_send, :,
47369408Sache    AC_CHECK_LIB(resolv, res_send, HESLIB="$HESLIB -lresolv"))
47469408Sache  HESDEF=-DHESIOD
47569408Sache  if test "$hesiod" != yes; then
47669408Sache    HESDEF="$HESDEF -I$hesiod/include"
47769408Sache    HESLIB="-L$hesiod/lib $HESLIB"
47869408Sache  fi
47969408Sachefi
48069408SacheAC_SUBST(HESDEF)
48169408SacheAC_SUBST(HESLIB)
482232633SmpAC_SUBST(BUILD_CATALOGS)
48369408Sache
484232633SmpAC_CONFIG_FILES([Makefile nls/Makefile])
485145479SmpAC_OUTPUT
486