configure.in revision 83098
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  ## Silicon Graphics machines
119  *-sgi-iri* )
120    tcsh_config_file=irix
121    case "${host_os}" in
122      irix[34]*) # Irix-3.x - Irix 4.x
123        NON_GNU_DFLAGS='-D__STDC__'
124        LIBS='-lsun -lbsd -lc_s'
125      ;;
126      irix5* | irix6.[01]*) # Irix 5.x, Irix 6.0 - 6.1
127        LIBS='-lbsd'
128      ;;
129      irix6.[2-9]*) # Irix 6.2 and later
130	tcsh_config_file=irix62
131      ;;
132    esac
133  ;;
134
135  ## Suns
136  *-sun-sunos3* )
137    tcsh_config_file=sunos35
138  ;;
139  *-sun-sunos4.0* )
140    tcsh_config_file=sunos40
141  ;;
142  *-sun-sunos4.1.[12]* )
143    tcsh_config_file=sunos41
144  ;;
145  *-sun-sunos4.1.[3456]* )
146    tcsh_config_file=sunos413
147  ;;
148  *-*-solaris2.[01]* ) # Should handle sparc or x86
149    tcsh_config_file=sol2
150  ;;
151  *-sun-solaris2.2* ) # Sparc only release
152    tcsh_config_file=sol22
153  ;;
154  *-sun-solaris2.3* ) # Sparc only release
155    tcsh_config_file=sol23
156  ;;
157  *-*-solaris2.[45]* ) # Should handle sparc, x86 and powerpc
158    tcsh_config_file=sol24
159  ;;
160  *-*-solaris2.* ) # Should handle sparc, x86 and powerpc
161    tcsh_config_file=sol26
162  ;;
163
164  ## Dell SVR4
165  *-dell-sysv4* )
166    tcsh_config_file=sysv4
167    DFLAGS="$DFLAGS -DDELL"
168  ;;
169
170  ## SVR4 (Generic and otherwise)
171  *-*-sysv4* )
172    tcsh_config_file=sysv4
173  ;;
174
175  ## Tektronix systems
176  m68k-tektronix-bsd* )
177    tcsh_config_file=bsd
178    NON_GNU_DFLAGS='-DBSD -DUTek'
179  ;;
180  m88k-tektronix-sysv3* )
181    tcsh_config_file=tekXD88
182  ;;
183
184  ## SCO
185  *-sco3.2v5*) 
186    tcsh_config_file=sco32v5
187  ;;
188  *-sco3.2v4*)
189    tcsh_config_file=sco32v4
190  ;;
191  *-sco3.2v2*)
192    tcsh_config_file=sco32v2
193  ;;
194
195  ## Siemens BS2000 Mainframe
196  bs2000-siemens-posix)
197    tcsh_config_file=bs2000
198  ;;
199
200  ## Convex
201  *-convex*)
202    tcsh_config_file=convex
203  ;;
204
205  ## Cray
206  *-cray-unicos*)
207    tcsh_config_file=cray
208  ;;
209
210  ## Cygnus GNU Win32
211  *-cygwin)
212    tcsh_config_file=cygwin32
213  ;;
214
215  ## mips-compaq-nonstopux
216  *-*-nonstopux)
217    tcsh_config_file=sysv4
218  ;;
219
220  ## Apollo Domain/OS
221  *-apollo-*)
222    tcsh_config_file=apollo
223  ;;
224
225  * )
226  changequote([, ])dnl
227  AC_MSG_ERROR([Tcsh can't guess the configuration file name
228for \`${host}' systems.
229Check tcsh's \`Ported' file for manual configuration instructions.])
230  changequote(, )dnl
231  ;;
232
233esac
234
235echo "Tcsh will use configuration file \`$tcsh_config_file'."
236changequote([, ])dnl
237
238AC_CONFIG_HEADER(config.h:config/${tcsh_config_file}:config.h.in)
239AC_PROG_CC
240AC_PROG_CPP
241AC_PROG_GCC_TRADITIONAL
242
243if test $ac_cv_prog_gcc = no ; then
244  DFLAGS="$DFLAGS $NON_GNU_DFLAGS"
245  CFLAGS="$CFLAGS $NON_GNU_CFLAGS"
246fi
247
248case "${host}" in
249  ## Cygnus GNU Win32
250  *-cygwin)
251    CFLAGS="$CFLAGS -mno-win32"
252  ;;
253esac
254
255AC_SEARCH_LIBS(crypt, crypt)
256AC_SEARCH_LIBS(tgetent, termlib curses termcap)
257AC_SEARCH_LIBS(gethostbyname, nsl)
258AC_SEARCH_LIBS(connect, socket)
259
260dnl This is not good enough; we need sockaddr_storage too.
261dnl See whether we can use IPv6 related functions
262dnl AC_DEFUN(IPv6_CHECK_FUNC, [
263dnl changequote(, )dnl
264dnl ac_tr_lib=HAVE_`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
265dnl   -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
266dnl changequote([, ])dnl
267dnl AC_CHECK_FUNC($1, [dnl
268dnl   AC_DEFINE_UNQUOTED($ac_tr_lib)
269dnl   ac_cv_lib_inet6_$1=no], [dnl
270dnl   AC_MSG_CHECKING([whether your system has IPv6 directory])
271dnl   AC_CACHE_VAL(ipv6_cv_dir, [dnl
272dnl     for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
273dnl       if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
274dnl 	break
275dnl       fi
276dnl     done])dnl
277dnl   AC_MSG_RESULT($ipv6_cv_dir)
278dnl   if test $ipv6_cv_dir = no; then
279dnl     ac_cv_lib_inet6_$1=no
280dnl   else
281dnl     if test x$ipv6_libinet6 = x; then
282dnl       ipv6_libinet6=no
283dnl       SAVELDFLAGS="$LDFLAGS"
284dnl       LDFLAGS="-L$ipv6_cv_dir/lib"
285dnl     fi
286dnl     AC_CHECK_LIB(inet6, $1, [dnl
287dnl       AC_DEFINE_UNQUOTED($ac_tr_lib)
288dnl       if test $ipv6_libinet6 = no; then
289dnl 	ipv6_libinet6=yes
290dnl 	LIBS="$LIBS -linet6"
291dnl       fi],)dnl
292dnl     if test $ipv6_libinet6 = no; then
293dnl       LDFLAGS="$SAVELDFLAGS"
294dnl     fi
295dnl   fi])dnl
296dnl if test $ac_cv_func_$1 = yes -o $ac_cv_lib_inet6_$1 = yes
297dnl then
298dnl   ipv6_cv_$1=yes
299dnl   ifelse([$2], , :, [$2])
300dnl else
301dnl   ipv6_cv_$1=no
302dnl   ifelse([$3], , :, [$3])
303dnl fi])
304dnl IPv6_CHECK_FUNC(getaddrinfo, DFLAGS="$DFLAGS -DINET6")
305
306AC_SUBST(DFLAGS)
307
308AC_ARG_WITH(hesiod,
309  [  --with-hesiod=PREFIX    Use Hesiod lookup for ~ expansion],
310  [hesiod="$withval"], [hesiod=no])
311if test "$hesiod" != no; then
312  HESLIB="-lhesiod"
313  AC_CHECK_FUNC(res_send, :,
314    AC_CHECK_LIB(resolv, res_send, HESLIB="$HESLIB -lresolv"))
315  HESDEF=-DHESIOD
316  if test "$hesiod" != yes; then
317    HESDEF="$HESDEF -I$hesiod/include"
318    HESLIB="-L$hesiod/lib $HESLIB"
319  fi
320fi
321AC_SUBST(HESDEF)
322AC_SUBST(HESLIB)
323
324AC_OUTPUT(Makefile)
325