configure.in revision 131962
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.13)dnl Minimum Autoconf version required.
12AC_INIT(tc.vers.c)
13
14AC_CANONICAL_HOST
15
16dnl We don't use AC_VALIDATE_CACHED_SYSTEM_TUPLE here because we only
17dnl care about the HOST value, not the HOST/BUILD/TARGET triplet.
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* )
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-posix)
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  ## Cygnus GNU Win32
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
242
243AC_CONFIG_HEADER(config.h:config/${tcsh_config_file}:config.h.in)
244AC_PROG_CC
245AC_PROG_CPP
246AC_PROG_GCC_TRADITIONAL
247
248if test $ac_cv_prog_gcc = no ; then
249  DFLAGS="$DFLAGS $NON_GNU_DFLAGS"
250  CFLAGS="$CFLAGS $NON_GNU_CFLAGS"
251fi
252
253case "${host}" in
254  ## Cygnus GNU Win32
255  *-cygwin)
256    CFLAGS="$CFLAGS -mno-win32"
257  ;;
258esac
259
260AC_SEARCH_LIBS(crypt, crypt)
261AC_SEARCH_LIBS(tgetent, termlib curses termcap)
262AC_SEARCH_LIBS(gethostbyname, nsl)
263AC_SEARCH_LIBS(connect, socket)
264
265dnl This is not good enough; we need sockaddr_storage too.
266dnl See whether we can use IPv6 related functions
267dnl AC_DEFUN(IPv6_CHECK_FUNC, [
268dnl changequote(, )dnl
269dnl ac_tr_lib=HAVE_`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
270dnl   -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
271dnl changequote([, ])dnl
272dnl AC_CHECK_FUNC($1, [dnl
273dnl   AC_DEFINE_UNQUOTED($ac_tr_lib)
274dnl   ac_cv_lib_inet6_$1=no], [dnl
275dnl   AC_MSG_CHECKING([whether your system has IPv6 directory])
276dnl   AC_CACHE_VAL(ipv6_cv_dir, [dnl
277dnl     for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
278dnl       if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
279dnl 	break
280dnl       fi
281dnl     done])dnl
282dnl   AC_MSG_RESULT($ipv6_cv_dir)
283dnl   if test $ipv6_cv_dir = no; then
284dnl     ac_cv_lib_inet6_$1=no
285dnl   else
286dnl     if test x$ipv6_libinet6 = x; then
287dnl       ipv6_libinet6=no
288dnl       SAVELDFLAGS="$LDFLAGS"
289dnl       LDFLAGS="-L$ipv6_cv_dir/lib"
290dnl     fi
291dnl     AC_CHECK_LIB(inet6, $1, [dnl
292dnl       AC_DEFINE_UNQUOTED($ac_tr_lib)
293dnl       if test $ipv6_libinet6 = no; then
294dnl 	ipv6_libinet6=yes
295dnl 	LIBS="$LIBS -linet6"
296dnl       fi],)dnl
297dnl     if test $ipv6_libinet6 = no; then
298dnl       LDFLAGS="$SAVELDFLAGS"
299dnl     fi
300dnl   fi])dnl
301dnl if test $ac_cv_func_$1 = yes -o $ac_cv_lib_inet6_$1 = yes
302dnl then
303dnl   ipv6_cv_$1=yes
304dnl   ifelse([$2], , :, [$2])
305dnl else
306dnl   ipv6_cv_$1=no
307dnl   ifelse([$3], , :, [$3])
308dnl fi])
309dnl IPv6_CHECK_FUNC(getnameinfo, DFLAGS="$DFLAGS -DINET6")
310
311AC_CACHE_CHECK([ss_family in sockaddr_storage], ac_cv_ss_family,
312[AC_TRY_COMPILE([#include <sys/types.h>
313#include <sys/socket.h>], [struct sockaddr_storage ss; ss.ss_family;],
314  ac_cv_ss_family=yes, ac_cv_ss_family=no)]
315if test "$ac_cv_ss_family" = no; then
316  DFLAGS="$DFLAGS -DNO_SS_FAMILY"
317fi
318)
319
320AC_SUBST(DFLAGS)
321
322AC_ARG_WITH(hesiod,
323  [  --with-hesiod=PREFIX    Use Hesiod lookup for ~ expansion],
324  [hesiod="$withval"], [hesiod=no])
325if test "$hesiod" != no; then
326  HESLIB="-lhesiod"
327  AC_CHECK_FUNC(res_send, :,
328    AC_CHECK_LIB(resolv, res_send, HESLIB="$HESLIB -lresolv"))
329  HESDEF=-DHESIOD
330  if test "$hesiod" != yes; then
331    HESDEF="$HESDEF -I$hesiod/include"
332    HESLIB="-L$hesiod/lib $HESLIB"
333  fi
334fi
335AC_SUBST(HESDEF)
336AC_SUBST(HESLIB)
337
338AC_EXEEXT
339
340AC_OUTPUT(Makefile)
341