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