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