configure.in revision 145479
1dnl Autoconf script for tcsh
2dnl To rebuild the `configure' script from this, execute the command
3dnl 	autoconf
4dnl in the directory containing this script.
5dnl
6dnl You'll also need a version of config.guess from a gnu package
7dnl
8dnl Written by Kaveh Ghazi (ghazi@caip.rutgers.edu) 5/11/96.
9dnl
10
11AC_PREREQ([2.59])dnl Minimum Autoconf version required.
12AC_INIT
13AC_CONFIG_SRCDIR([tc.vers.c])
14AC_CONFIG_HEADERS([config.h])
15
16AC_CANONICAL_HOST
17
18AC_MSG_CHECKING([cached host tuple])
19if { test x"${ac_cv_host_system_type+set}" = x"set" &&
20     test x"$ac_cv_host_system_type" != x"$host"; }; then
21  AC_MSG_RESULT([different])
22  AC_MSG_ERROR([remove config.cache and re-run configure])
23else
24  AC_MSG_RESULT(ok)
25fi
26ac_cv_host_system_type="$host"
27
28
29changequote(, )dnl
30
31case "${host}" in
32
33  ## Alpha (DEC) machines.
34  alpha*-dec-osf* )
35    tcsh_config_file=decosf1
36  ;;
37
38  ## Ultrix
39  *-dec-ultrix* )
40    tcsh_config_file=ultrix
41  ;;
42
43  ## DGUX
44  *-dg-dguxR4* )
45    tcsh_config_file=dgux5.4
46  ;;
47  m88k-dg-dgux5.4R* )
48    tcsh_config_file=dgux5.4
49  ;;
50
51  ## HP/UX
52  *-hp-hpux7* )
53    tcsh_config_file=hpux7
54  ;;
55  *-hp-hpux[89]* )
56    tcsh_config_file=hpux8
57  ;;
58  *-hp-hpux1[0-9]* )
59    tcsh_config_file=hpux11
60  ;;
61
62  ## IBM AIX systems
63  *-ibm-aix*)
64    tcsh_config_file=aix
65  ;;
66
67  ## SX-4
68  sx4-nec-*)
69    CC='cc -h0,ansi,novector,float0'
70    LDFLAGS='-Gsmall'
71    tcsh_config_file=superux8
72  ;;
73
74  ## IBM OS/390 systems
75  *-ibm-os390*)
76    CC='c89'
77    tcsh_config_file=os390
78  ;;
79
80  ## Linux
81  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
82    tcsh_config_file=linux
83  ;;
84
85  ## Motorola systems
86  m68k-motorola-sysv* )
87    tcsh_config_file=sysV68
88  ;;
89  m88k-motorola-sysv3* )
90    tcsh_config_file=sysV88
91  ;;
92
93  ## NetBSD systems
94  *-*-netbsd*)
95    tcsh_config_file=bsd4.4
96  ;;
97
98  ## FreeBSD systems
99  *-*-freebsd*)
100    tcsh_config_file=bsd4.4
101  ;;
102
103  ## OpenBSD systems
104  *-*-openbsd*)
105    tcsh_config_file=bsd4.4
106  ;;
107
108  ## BSDI systems
109  *-*-bsdi*)
110    tcsh_config_file=bsd4.4
111  ;;
112
113  ## Mac OS X Server
114  *-*-rhapsody* )
115    tcsh_config_file=bsd4.4
116  ;;
117
118  ## Mac OS X Server
119  *-*-darwin* )
120    tcsh_config_file=bsd4.4
121  ;;
122
123  ## Silicon Graphics machines
124  *-sgi-iri* )
125    tcsh_config_file=irix
126    case "${host_os}" in
127      irix[34]*) # Irix-3.x - Irix 4.x
128        NON_GNU_DFLAGS='-D__STDC__'
129        LIBS='-lsun -lbsd -lc_s'
130      ;;
131      irix5* | irix6.[01]*) # Irix 5.x, Irix 6.0 - 6.1
132        LIBS='-lbsd'
133      ;;
134      irix6.[2-9]*) # Irix 6.2 and later
135	tcsh_config_file=irix62
136      ;;
137    esac
138  ;;
139
140  ## Suns
141  *-sun-sunos3* )
142    tcsh_config_file=sunos35
143  ;;
144  *-sun-sunos4.0* )
145    tcsh_config_file=sunos40
146  ;;
147  *-sun-sunos4.1.[12]* )
148    tcsh_config_file=sunos41
149  ;;
150  *-sun-sunos4.1.[3456]* )
151    tcsh_config_file=sunos413
152  ;;
153  *-*-solaris2.[01]* ) # Should handle sparc or x86
154    tcsh_config_file=sol2
155  ;;
156  *-sun-solaris2.2* ) # Sparc only release
157    tcsh_config_file=sol22
158  ;;
159  *-sun-solaris2.3* ) # Sparc only release
160    tcsh_config_file=sol23
161  ;;
162  *-*-solaris2.[45]* ) # Should handle sparc, x86 and powerpc
163    tcsh_config_file=sol24
164  ;;
165  *-*-solaris2.* ) # Should handle sparc, x86 and powerpc
166    tcsh_config_file=sol26
167  ;;
168
169  ## Dell SVR4
170  *-dell-sysv4* )
171    tcsh_config_file=sysv4
172    DFLAGS="$DFLAGS -DDELL"
173  ;;
174
175  ## SVR4 (Generic and otherwise)
176  *-*-sysv4* )
177    tcsh_config_file=sysv4
178  ;;
179
180  ## Tektronix systems
181  m68k-tektronix-bsd* )
182    tcsh_config_file=bsd
183    NON_GNU_DFLAGS='-DBSD -DUTek'
184  ;;
185  m88k-tektronix-sysv3* )
186    tcsh_config_file=tekXD88
187  ;;
188
189  ## SCO
190  *-sco3.2v5*) 
191    tcsh_config_file=sco32v5
192  ;;
193  *-sco3.2v4*)
194    tcsh_config_file=sco32v4
195  ;;
196  *-sco3.2v2*)
197    tcsh_config_file=sco32v2
198  ;;
199
200  ## Siemens BS2000 Mainframe
201  bs2000-siemens-*)
202    tcsh_config_file=bs2000
203  ;;
204
205  ## Convex
206  *-convex*)
207    tcsh_config_file=convex
208  ;;
209
210  ## Cray
211  *-cray-unicos*)
212    tcsh_config_file=cray
213  ;;
214
215  ## Red Hat Cygwin
216  *-cygwin)
217    tcsh_config_file=cygwin32
218  ;;
219
220  ## mips-compaq-nonstopux
221  *-*-nonstopux)
222    tcsh_config_file=sysv4
223  ;;
224
225  ## Apollo Domain/OS
226  *-apollo-*)
227    tcsh_config_file=apollo
228  ;;
229
230  * )
231  changequote([, ])dnl
232  AC_MSG_ERROR([Tcsh can't guess the configuration file name
233for `${host}' systems.
234Check tcsh's `Ported' file for manual configuration instructions.])
235  changequote(, )dnl
236  ;;
237
238esac
239
240echo "Tcsh will use configuration file \`$tcsh_config_file'."
241changequote([, ])dnl
242cp ${srcdir}/config/${tcsh_config_file} config_p.h
243AH_BOTTOM(
244[#include "config_p.h"
245#include "config_f.h"])
246
247dnl Checks for programs
248AC_PROG_CC
249AC_PROG_CPP
250AC_PROG_GCC_TRADITIONAL
251
252if test "x$GCC" != xyes ; then
253  DFLAGS="$DFLAGS $NON_GNU_DFLAGS"
254  CFLAGS="$CFLAGS $NON_GNU_CFLAGS"
255fi
256
257dnl Checks for libraries
258AC_SEARCH_LIBS(crypt, crypt)
259AC_SEARCH_LIBS(getspnam, sec)
260AC_SEARCH_LIBS(tgetent, termlib termcap curses ncurses)
261AC_SEARCH_LIBS(gethostbyname, nsl)
262AC_SEARCH_LIBS(connect, socket)
263AC_SEARCH_LIBS([iconv], [iconv], [AC_DEFINE([HAVE_ICONV], [1],
264	[Define to 1 if you have the iconv () interface])])
265
266dnl Checks for header files
267AC_CHECK_HEADERS([auth.h inttypes.h shadow.h stdint.h])
268AC_CHECK_HEADERS([utmpx.h utmp.h])
269AC_CHECK_HEADERS([wchar.h],
270	[AC_CHECK_SIZEOF([wchar_t], [], [dnl
271#include <stdio.h>
272#include <wchar.h>])
273	AC_CHECK_HEADERS([wctype.h])])
274AC_HEADER_DIRENT
275AC_HEADER_STAT
276AC_HEADER_STDC
277
278dnl Checks for types
279AC_CHECK_TYPES([long long])
280AC_TYPE_GETGROUPS
281AC_TYPE_MODE_T
282AC_TYPE_SIGNAL
283AC_TYPE_SIZE_T
284AC_TYPE_UID_T
285
286AC_DEFUN([AC_TYPE_SOCKLEN_T], [
287AC_CHECK_TYPE(socklen_t,,
288AC_DEFINE(socklen_t, int, [Define to `int' if neither <sys/types.h> nor <sys/socket.h> define.]),
289[
290#include <sys/types.h>
291#include <sys/socket.h>
292])
293])
294AC_TYPE_SOCKLEN_T
295
296
297dnl Checks for structures
298AC_CHECK_MEMBERS([struct dirent.d_ino], , ,
299[#ifdef HAVE_DIRENT_H
300# include <dirent.h>
301#else
302# ifdef HAVE_NDIR_H
303#  include <ndir.h>
304# else
305#  include <sys/dir.h>
306# endif
307# define dirent direct
308#endif])
309AC_CHECK_MEMBERS([struct utmp.ut_host, struct utmp.ut_user, struct utmp.ut_tv,
310		  struct utmp.ut_xtime], , ,
311[#ifdef HAVE_UTMPX_H
312#include <utmpx.h>
313#define utmp utmpx
314#elif defined HAVE_UTMP_H
315#include <utmp.h>
316#endif])
317AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], , ,
318[#include <sys/types.h>
319#include <sys/socket.h>])
320
321dnl Checks for compiler characteristics
322AC_C_CONST
323AC_C_PROTOTYPES
324AC_C_VOLATILE
325
326dnl checks for library functions
327AC_CHECK_DECLS([gethostname])
328AC_CHECK_FUNCS([dup2 getcwd gethostname getpwent getutent memmove memset] dnl
329	[nice nl_langinfo sbrk setpgid setpriority strerror strstr sysconf] dnl
330	[wcwidth])
331AC_FUNC_GETPGRP
332AC_FUNC_SETPGRP
333
334dnl This is not good enough; we need sockaddr_storage too.
335dnl See whether we can use IPv6 related functions
336dnl AC_DEFUN([IPv6_CHECK_FUNC], [
337dnl changequote(, )dnl
338dnl ac_tr_lib=HAVE_`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
339dnl   -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
340dnl changequote([, ])dnl
341dnl AC_CHECK_FUNC($1, [dnl
342dnl   AC_DEFINE_UNQUOTED($ac_tr_lib)
343dnl   ac_cv_lib_inet6_$1=no], [dnl
344dnl   AC_MSG_CHECKING([whether your system has IPv6 directory])
345dnl   AC_CACHE_VAL(ipv6_cv_dir, [dnl
346dnl     for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
347dnl       if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
348dnl 	break
349dnl       fi
350dnl     done])dnl
351dnl   AC_MSG_RESULT($ipv6_cv_dir)
352dnl   if test $ipv6_cv_dir = no; then
353dnl     ac_cv_lib_inet6_$1=no
354dnl   else
355dnl     if test x$ipv6_libinet6 = x; then
356dnl       ipv6_libinet6=no
357dnl       SAVELDFLAGS="$LDFLAGS"
358dnl       LDFLAGS="-L$ipv6_cv_dir/lib"
359dnl     fi
360dnl     AC_CHECK_LIB(inet6, $1, [dnl
361dnl       AC_DEFINE_UNQUOTED($ac_tr_lib)
362dnl       if test $ipv6_libinet6 = no; then
363dnl 	ipv6_libinet6=yes
364dnl 	LIBS="$LIBS -linet6"
365dnl       fi],)dnl
366dnl     if test $ipv6_libinet6 = no; then
367dnl       LDFLAGS="$SAVELDFLAGS"
368dnl     fi
369dnl   fi])dnl
370dnl if test $ac_cv_func_$1 = yes -o $ac_cv_lib_inet6_$1 = yes
371dnl then
372dnl   ipv6_cv_$1=yes
373dnl   ifelse([$2], , :, [$2])
374dnl else
375dnl   ipv6_cv_$1=no
376dnl   ifelse([$3], , :, [$3])
377dnl fi])
378dnl IPv6_CHECK_FUNC(getnameinfo, DFLAGS="$DFLAGS -DINET6")
379
380AC_SUBST(DFLAGS)
381
382AC_ARG_WITH(hesiod,
383  [  --with-hesiod=PREFIX    Use Hesiod lookup for ~ expansion],
384  [hesiod="$withval"], [hesiod=no])
385if test "$hesiod" != no; then
386  HESLIB="-lhesiod"
387  AC_CHECK_FUNC(res_send, :,
388    AC_CHECK_LIB(resolv, res_send, HESLIB="$HESLIB -lresolv"))
389  HESDEF=-DHESIOD
390  if test "$hesiod" != yes; then
391    HESDEF="$HESDEF -I$hesiod/include"
392    HESLIB="-L$hesiod/lib $HESLIB"
393  fi
394fi
395AC_SUBST(HESDEF)
396AC_SUBST(HESLIB)
397
398AC_CONFIG_FILES([Makefile])
399AC_OUTPUT
400