configure.in revision 232633
133965Sjdpdnl Autoconf script for tcsh
233965Sjdpdnl To rebuild the `configure' script from this, execute the command
333965Sjdpdnl 	autoconf
433965Sjdpdnl in the directory containing this script.
533965Sjdpdnl
633965Sjdpdnl You'll also need a version of config.guess from a gnu package
733965Sjdpdnl
833965Sjdpdnl Written by Kaveh Ghazi (ghazi@caip.rutgers.edu) 5/11/96.
933965Sjdpdnl
1033965Sjdpdnl $tcsh: configure.in,v 3.99 2012/02/13 16:33:50 christos Exp $
1133965Sjdp
1233965SjdpAC_PREREQ([2.59])dnl Minimum Autoconf version required.
1333965SjdpAC_INIT([tcsh], [6.18.01], [http://bugs.gw.com/])
1433965SjdpAC_CONFIG_MACRO_DIR([m4])
1533965SjdpAC_CONFIG_SRCDIR([tc.vers.c])
1633965SjdpAC_CONFIG_HEADERS([config.h])
1733965SjdpAC_CONFIG_TESTDIR([.], [.])
1833965Sjdp
1933965SjdpAC_PROG_INSTALL
2033965SjdpAC_CANONICAL_HOST
2133965Sjdp
2233965SjdpAC_MSG_CHECKING([cached host tuple])
2333965Sjdpif { test x"${ac_cv_host_system_type+set}" = x"set" &&
2433965Sjdp     test x"$ac_cv_host_system_type" != x"$host"; }; then
2533965Sjdp  AC_MSG_RESULT([different])
2633965Sjdp  AC_MSG_ERROR([remove config.cache and re-run configure])
2733965Sjdpelse
2833965Sjdp  AC_MSG_RESULT(ok)
2933965Sjdpfi
3033965Sjdpac_cv_host_system_type="$host"
3133965Sjdp
3233965Sjdp
3333965Sjdpchangequote(, )dnl
3433965Sjdp
3533965Sjdpcase "${host}" in
3633965Sjdp
3733965Sjdp  ## Alpha (DEC) machines.
3833965Sjdp  alpha*-dec-osf* )
3933965Sjdp    tcsh_config_file=decosf1
4033965Sjdp  ;;
4133965Sjdp
4233965Sjdp  ## Ultrix
4333965Sjdp  *-dec-ultrix* )
4433965Sjdp    tcsh_config_file=ultrix
4533965Sjdp  ;;
4633965Sjdp
4733965Sjdp  ## DGUX
4833965Sjdp  *-dg-dguxR4* )
4933965Sjdp    tcsh_config_file=dgux5.4
5033965Sjdp  ;;
5133965Sjdp  m88k-dg-dgux5.4R* )
5233965Sjdp    tcsh_config_file=dgux5.4
5333965Sjdp  ;;
5433965Sjdp
5538889Sjdp  ## HP/UX
5638889Sjdp  *-hp-hpux7* )
5738889Sjdp    tcsh_config_file=hpux7
5838889Sjdp  ;;
5933965Sjdp  *-hp-hpux[89]* )
6033965Sjdp    tcsh_config_file=hpux8
6133965Sjdp  ;;
6233965Sjdp  *-hp-hpux1[0-9]* )
6333965Sjdp    tcsh_config_file=hpux11
6433965Sjdp  ;;
6533965Sjdp
6633965Sjdp  ## IBM AIX systems
6733965Sjdp  *-ibm-aix*)
6838889Sjdp    tcsh_config_file=aix
6933965Sjdp  ;;
7033965Sjdp
7133965Sjdp  ## SX-4
7260484Sobrien  sx4-nec-*)
7360484Sobrien    CC='cc -h0,ansi,novector,float0'
7433965Sjdp    LDFLAGS='-Gsmall'
7533965Sjdp    tcsh_config_file=superux8
7633965Sjdp  ;;
7733965Sjdp
7833965Sjdp  ## IBM OS/390 systems
7933965Sjdp  *-ibm-os390*)
8033965Sjdp    CC='c89'
8133965Sjdp    tcsh_config_file=os390
8238889Sjdp  ;;
8338889Sjdp
8438889Sjdp  ## Android
8538889Sjdp  *-*-android*)
8633965Sjdp    tcsh_config_file=android
8738889Sjdp  ;;
8838889Sjdp
8933965Sjdp  ## Linux
9033965Sjdp  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
9133965Sjdp    tcsh_config_file=linux
9238889Sjdp  ;;
9333965Sjdp
9433965Sjdp  ## Motorola systems
9533965Sjdp  m68k-motorola-sysv* )
9633965Sjdp    tcsh_config_file=sysV68
9733965Sjdp  ;;
9833965Sjdp  m88k-motorola-sysv3* )
9938889Sjdp    tcsh_config_file=sysV88
10038889Sjdp  ;;
10138889Sjdp
10260484Sobrien  ## NetBSD systems
10360484Sobrien  *-*-netbsd*)
10460484Sobrien    tcsh_config_file=bsd4.4
10560484Sobrien  ;;
10660484Sobrien
10760484Sobrien  ## FreeBSD systems
10833965Sjdp  *-*-freebsd*)
10933965Sjdp    tcsh_config_file=bsd4.4
11033965Sjdp  ;;
11133965Sjdp
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