configure.in revision 69408
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=hpux8
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  * )
221  changequote([, ])dnl
222  AC_MSG_ERROR([Tcsh can't guess the configuration file name
223for \`${host}' systems.
224Check tcsh's \`Ported' file for manual configuration instructions.])
225  changequote(, )dnl
226  ;;
227
228esac
229
230echo "Tcsh will use configuration file \`$tcsh_config_file'."
231changequote([, ])dnl
232
233AC_CONFIG_HEADER(config.h:config/${tcsh_config_file}:config.h.in)
234AC_PROG_CC
235AC_PROG_CPP
236AC_PROG_GCC_TRADITIONAL
237
238if test $ac_cv_prog_gcc = no ; then
239  DFLAGS="$DFLAGS $NON_GNU_DFLAGS"
240  CFLAGS="$CFLAGS $NON_GNU_CFLAGS"
241fi
242
243case "${host}" in
244  ## Cygnus GNU Win32
245  *-cygwin)
246    CFLAGS="$CFLAGS -mno-win32"
247  ;;
248esac
249
250AC_SEARCH_LIBS(crypt, crypt)
251AC_SEARCH_LIBS(tgetent, termlib curses termcap)
252AC_SEARCH_LIBS(gethostbyname, nsl)
253AC_SEARCH_LIBS(connect, socket)
254
255dnl This is not good enough; we need sockaddr_storage too.
256dnl See whether we can use IPv6 related functions
257dnl AC_DEFUN(IPv6_CHECK_FUNC, [
258dnl changequote(, )dnl
259dnl ac_tr_lib=HAVE_`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
260dnl   -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
261dnl changequote([, ])dnl
262dnl AC_CHECK_FUNC($1, [dnl
263dnl   AC_DEFINE_UNQUOTED($ac_tr_lib)
264dnl   ac_cv_lib_inet6_$1=no], [dnl
265dnl   AC_MSG_CHECKING([whether your system has IPv6 directory])
266dnl   AC_CACHE_VAL(ipv6_cv_dir, [dnl
267dnl     for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
268dnl       if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
269dnl 	break
270dnl       fi
271dnl     done])dnl
272dnl   AC_MSG_RESULT($ipv6_cv_dir)
273dnl   if test $ipv6_cv_dir = no; then
274dnl     ac_cv_lib_inet6_$1=no
275dnl   else
276dnl     if test x$ipv6_libinet6 = x; then
277dnl       ipv6_libinet6=no
278dnl       SAVELDFLAGS="$LDFLAGS"
279dnl       LDFLAGS="-L$ipv6_cv_dir/lib"
280dnl     fi
281dnl     AC_CHECK_LIB(inet6, $1, [dnl
282dnl       AC_DEFINE_UNQUOTED($ac_tr_lib)
283dnl       if test $ipv6_libinet6 = no; then
284dnl 	ipv6_libinet6=yes
285dnl 	LIBS="$LIBS -linet6"
286dnl       fi],)dnl
287dnl     if test $ipv6_libinet6 = no; then
288dnl       LDFLAGS="$SAVELDFLAGS"
289dnl     fi
290dnl   fi])dnl
291dnl if test $ac_cv_func_$1 = yes -o $ac_cv_lib_inet6_$1 = yes
292dnl then
293dnl   ipv6_cv_$1=yes
294dnl   ifelse([$2], , :, [$2])
295dnl else
296dnl   ipv6_cv_$1=no
297dnl   ifelse([$3], , :, [$3])
298dnl fi])
299dnl IPv6_CHECK_FUNC(getaddrinfo, DFLAGS="$DFLAGS -DINET6")
300
301AC_SUBST(DFLAGS)
302
303AC_ARG_WITH(hesiod,
304  [  --with-hesiod=PREFIX    Use Hesiod lookup for ~ expansion],
305  [hesiod="$withval"], [hesiod=no])
306if test "$hesiod" != no; then
307  HESLIB="-lhesiod"
308  AC_CHECK_FUNC(res_send, :,
309    AC_CHECK_LIB(resolv, res_send, HESLIB="$HESLIB -lresolv"))
310  HESDEF=-DHESIOD
311  if test "$hesiod" != yes; then
312    HESDEF="$HESDEF -I$hesiod/include"
313    HESLIB="-L$hesiod/lib $HESLIB"
314  fi
315fi
316AC_SUBST(HESDEF)
317AC_SUBST(HESLIB)
318
319AC_OUTPUT(Makefile)
320