configure.in revision 167465
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.15.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  ## OpenBSD systems
105  *-*-openbsd*)
106    tcsh_config_file=bsd4.4
107  ;;
108
109  ## BSDI systems
110  *-*-bsdi*)
111    tcsh_config_file=bsd4.4
112  ;;
113
114  ## Mac OS X Server
115  *-*-rhapsody* )
116    tcsh_config_file=bsd4.4
117  ;;
118
119  ## Mac OS X Server
120  *-*-darwin* )
121    tcsh_config_file=bsd4.4
122  ;;
123
124  ## DragonFly systems
125  *-*-dragonfly*)
126    tcsh_config_file=bsd4.4
127  ;;
128
129  ## Silicon Graphics machines
130  *-sgi-iri* )
131    tcsh_config_file=irix
132    case "${host_os}" in
133      irix[34]*) # Irix-3.x - Irix 4.x
134        NON_GNU_DFLAGS='-D__STDC__'
135        LIBS='-lsun -lbsd -lc_s'
136      ;;
137      irix5* | irix6.[01]*) # Irix 5.x, Irix 6.0 - 6.1
138        LIBS='-lbsd'
139      ;;
140      irix6.[2-9]*) # Irix 6.2 and later
141	tcsh_config_file=irix62
142      ;;
143    esac
144  ;;
145
146  ## Suns
147  *-sun-sunos3* )
148    tcsh_config_file=sunos35
149  ;;
150  *-sun-sunos4.0* )
151    tcsh_config_file=sunos40
152  ;;
153  *-sun-sunos4.1.[12]* )
154    tcsh_config_file=sunos41
155  ;;
156  *-sun-sunos4.1.[3456]* )
157    tcsh_config_file=sunos413
158  ;;
159  *-*-solaris2.[01] ) # Should handle sparc or x86
160    tcsh_config_file=sol2
161  ;;
162  *-sun-solaris2.2 ) # Sparc only release
163    tcsh_config_file=sol22
164  ;;
165  *-sun-solaris2.3 ) # Sparc only release
166    tcsh_config_file=sol23
167  ;;
168  *-*-solaris2.[45] ) # Should handle sparc, x86 and powerpc
169    tcsh_config_file=sol24
170  ;;
171  *-*-solaris2.* ) # Should handle sparc, x86 and powerpc
172    tcsh_config_file=sol26
173  ;;
174
175  ## Dell SVR4
176  *-dell-sysv4* )
177    tcsh_config_file=sysv4
178    DFLAGS="$DFLAGS -DDELL"
179  ;;
180
181  ## SVR4 (Generic and otherwise)
182  *-*-sysv4* )
183    tcsh_config_file=sysv4
184  ;;
185
186  ## Tektronix systems
187  m68k-tektronix-bsd* )
188    tcsh_config_file=bsd
189    NON_GNU_DFLAGS='-DBSD -DUTek'
190  ;;
191  m88k-tektronix-sysv3* )
192    tcsh_config_file=tekXD88
193  ;;
194
195  ## SCO
196  *-sco3.2v5*) 
197    tcsh_config_file=sco32v5
198  ;;
199  *-sco3.2v4*)
200    tcsh_config_file=sco32v4
201  ;;
202  *-sco3.2v2*)
203    tcsh_config_file=sco32v2
204  ;;
205
206  ## Siemens BS2000 Mainframe
207  bs2000-siemens-*)
208    tcsh_config_file=bs2000
209  ;;
210
211  ## Convex
212  *-convex*)
213    tcsh_config_file=convex
214  ;;
215
216  ## Cray
217  *-cray-unicos*)
218    tcsh_config_file=cray
219  ;;
220
221  ## Red Hat Cygwin
222  *-cygwin)
223    tcsh_config_file=cygwin32
224  ;;
225
226  ## mips-compaq-nonstopux
227  *-*-nonstopux)
228    tcsh_config_file=sysv4
229  ;;
230
231  ## Apollo Domain/OS
232  *-apollo-*)
233    tcsh_config_file=apollo
234  ;;
235
236  * )
237  changequote([, ])dnl
238  AC_MSG_ERROR([Tcsh can't guess the configuration file name
239for `${host}' systems.
240Check tcsh's `Ported' file for manual configuration instructions.])
241  changequote(, )dnl
242  ;;
243
244esac
245
246echo "Tcsh will use configuration file \`$tcsh_config_file'."
247changequote([, ])dnl
248cp ${srcdir}/config/${tcsh_config_file} config_p.h
249AH_BOTTOM(
250[#include "config_p.h"
251#include "config_f.h"])
252
253dnl Checks for programs
254AC_PROG_CC
255AC_PROG_CPP
256AC_PROG_GCC_TRADITIONAL
257
258if test "x$GCC" != xyes ; then
259  DFLAGS="$DFLAGS $NON_GNU_DFLAGS"
260  CFLAGS="$CFLAGS $NON_GNU_CFLAGS"
261fi
262
263dnl Checks for libraries
264AC_SEARCH_LIBS(crypt, crypt)
265AC_SEARCH_LIBS(getspnam, sec)
266AC_SEARCH_LIBS(tgetent, termlib termcap curses ncurses)
267AC_SEARCH_LIBS(gethostbyname, nsl)
268AC_SEARCH_LIBS(connect, socket)
269AM_ICONV
270
271dnl Checks for header files
272AC_CHECK_HEADERS([auth.h crypt.h inttypes.h shadow.h stdint.h utmp.h utmpx.h])
273AC_CHECK_HEADERS([wchar.h],
274	[AC_CHECK_SIZEOF([wchar_t], [], [dnl
275#include <stdio.h>
276#include <wchar.h>])
277	AC_CHECK_HEADERS([wctype.h])])
278AC_HEADER_DIRENT
279AC_HEADER_STAT
280AC_HEADER_STDC
281
282dnl Checks for types
283AC_CHECK_TYPES([long long])
284AC_TYPE_GETGROUPS
285AC_TYPE_MODE_T
286AC_TYPE_SIZE_T
287AC_TYPE_UID_T
288
289AC_DEFUN([AC_TYPE_SSIZE_T], [
290AC_CHECK_TYPE(ssize_t,,
291AC_DEFINE(ssize_t, int, [Define to `int' not defined in <sys/types.h>.]),
292[
293#include <sys/types.h>
294])
295])
296AC_TYPE_SSIZE_T
297
298AC_DEFUN([AC_TYPE_SOCKLEN_T], [
299AC_CHECK_TYPE(socklen_t,,
300AC_DEFINE(socklen_t, int, [Define to `int' if neither <sys/types.h> nor <sys/socket.h> define.]),
301[
302#include <sys/types.h>
303#include <sys/socket.h>
304])
305])
306AC_TYPE_SOCKLEN_T
307
308
309dnl Checks for structures
310AC_CHECK_MEMBERS([struct dirent.d_ino], , ,
311[#ifdef HAVE_DIRENT_H
312# include <dirent.h>
313#else
314# ifdef HAVE_NDIR_H
315#  include <ndir.h>
316# else
317#  include <sys/dir.h>
318# endif
319# define dirent direct
320#endif])
321AC_CHECK_MEMBERS([struct utmp.ut_host, struct utmp.ut_user, struct utmp.ut_tv,
322		  struct utmp.ut_xtime], , ,
323[#include <sys/types.h>
324#ifdef HAVE_UTMPX_H
325#include <utmpx.h>
326#define utmp utmpx
327#elif defined HAVE_UTMP_H
328#include <utmp.h>
329#endif])
330AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], , ,
331[#include <sys/types.h>
332#include <sys/socket.h>])
333
334dnl Checks for compiler characteristics
335AC_C_CONST
336AC_C_VOLATILE
337
338dnl checks for library functions
339AC_CHECK_DECLS([crypt, environ, gethostname, getpgrp], , ,
340[#include "config_p.h"
341AC_INCLUDES_DEFAULT([])
342#ifdef HAVE_CRYPT_H
343#include <crypt.h>
344#endif
345])
346AC_CHECK_FUNC([setlocale], [have_setlocale=yes], [have_setlocale=no])
347AC_CHECK_FUNCS([catgets dup2 getauthid getcwd gethostname getpwent] dnl
348	[getutent memmove memset nice nl_langinfo sbrk setpgid setpriority] dnl
349	[strerror strstr sysconf wcwidth])
350AC_FUNC_GETPGRP
351AC_FUNC_MBRTOWC
352AC_FUNC_SETPGRP
353AC_FUNC_STRCOLL
354
355dnl This is not good enough; we need sockaddr_storage too.
356dnl See whether we can use IPv6 related functions
357dnl AC_DEFUN([IPv6_CHECK_FUNC], [
358dnl changequote(, )dnl
359dnl ac_tr_lib=HAVE_`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
360dnl   -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
361dnl changequote([, ])dnl
362dnl AC_CHECK_FUNC($1, [dnl
363dnl   AC_DEFINE_UNQUOTED($ac_tr_lib)
364dnl   ac_cv_lib_inet6_$1=no], [dnl
365dnl   AC_MSG_CHECKING([whether your system has IPv6 directory])
366dnl   AC_CACHE_VAL(ipv6_cv_dir, [dnl
367dnl     for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
368dnl       if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
369dnl 	break
370dnl       fi
371dnl     done])dnl
372dnl   AC_MSG_RESULT($ipv6_cv_dir)
373dnl   if test $ipv6_cv_dir = no; then
374dnl     ac_cv_lib_inet6_$1=no
375dnl   else
376dnl     if test x$ipv6_libinet6 = x; then
377dnl       ipv6_libinet6=no
378dnl       SAVELDFLAGS="$LDFLAGS"
379dnl       LDFLAGS="-L$ipv6_cv_dir/lib"
380dnl     fi
381dnl     AC_CHECK_LIB(inet6, $1, [dnl
382dnl       AC_DEFINE_UNQUOTED($ac_tr_lib)
383dnl       if test $ipv6_libinet6 = no; then
384dnl 	ipv6_libinet6=yes
385dnl 	LIBS="$LIBS -linet6"
386dnl       fi],)dnl
387dnl     if test $ipv6_libinet6 = no; then
388dnl       LDFLAGS="$SAVELDFLAGS"
389dnl     fi
390dnl   fi])dnl
391dnl if test $ac_cv_func_$1 = yes -o $ac_cv_lib_inet6_$1 = yes
392dnl then
393dnl   ipv6_cv_$1=yes
394dnl   ifelse([$2], , :, [$2])
395dnl else
396dnl   ipv6_cv_$1=no
397dnl   ifelse([$3], , :, [$3])
398dnl fi])
399dnl IPv6_CHECK_FUNC(getnameinfo, DFLAGS="$DFLAGS -DINET6")
400
401AC_SUBST(DFLAGS)
402
403dnl Checks for system services
404if test "$have_setlocale" != no; then
405  AC_ARG_ENABLE([nls], AS_HELP_STRING([--disable-nls], [Disable NLS support]),
406	        [], [enable_nls=yes])
407  if test "x$enable_nls" != xno; then
408    AC_DEFINE([NLS], [1], [Support NLS.])
409  fi
410fi
411
412AC_ARG_WITH(hesiod,
413  [  --with-hesiod=PREFIX    Use Hesiod lookup for ~ expansion],
414  [hesiod="$withval"], [hesiod=no])
415if test "$hesiod" != no; then
416  HESLIB="-lhesiod"
417  AC_CHECK_FUNC(res_send, :,
418    AC_CHECK_LIB(resolv, res_send, HESLIB="$HESLIB -lresolv"))
419  HESDEF=-DHESIOD
420  if test "$hesiod" != yes; then
421    HESDEF="$HESDEF -I$hesiod/include"
422    HESLIB="-L$hesiod/lib $HESLIB"
423  fi
424fi
425AC_SUBST(HESDEF)
426AC_SUBST(HESLIB)
427
428AC_CONFIG_FILES([Makefile])
429AC_OUTPUT
430