]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/tcsh/configure.in
MFC r314686: sh: Fix crash if a -T trap is taken during command substitution.
[FreeBSD/stable/10.git] / contrib / tcsh / configure.in
1 dnl Autoconf script for tcsh
2 dnl To rebuild the `configure' script from this, execute the command
3 dnl     autoconf
4 dnl in the directory containing this script.
5 dnl
6 dnl You'll also need a version of config.guess from a gnu package
7 dnl
8 dnl Written by Kaveh Ghazi (ghazi@caip.rutgers.edu) 5/11/96.
9 dnl
10 dnl $tcsh: configure.in,v 3.99 2012/02/13 16:33:50 christos Exp $
11
12 AC_PREREQ([2.59])dnl Minimum Autoconf version required.
13 AC_INIT([tcsh], [6.18.01], [http://bugs.gw.com/])
14 AC_CONFIG_MACRO_DIR([m4])
15 AC_CONFIG_SRCDIR([tc.vers.c])
16 AC_CONFIG_HEADERS([config.h])
17 AC_CONFIG_TESTDIR([.], [.])
18
19 AC_PROG_INSTALL
20 AC_CANONICAL_HOST
21
22 AC_MSG_CHECKING([cached host tuple])
23 if { 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])
27 else
28   AC_MSG_RESULT(ok)
29 fi
30 ac_cv_host_system_type="$host"
31
32
33 changequote(, )dnl
34
35 case "${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
265 for `${host}' systems.
266 Check tcsh's `Ported' file for manual configuration instructions.])
267   changequote(, )dnl
268   ;;
269
270 esac
271
272 echo "Tcsh will use configuration file \`$tcsh_config_file'."
273 changequote([, ])dnl
274 cp ${srcdir}/config/${tcsh_config_file} config_p.h
275 AH_BOTTOM(
276 [#include "config_p.h"
277 #include "config_f.h"])
278
279 dnl Checks for programs
280 AC_PROG_CC
281 AC_PROG_CPP
282 AC_PROG_GCC_TRADITIONAL
283
284 AC_PATH_PROG([GENCAT], [gencat]) 
285
286 dnl Require build CC to create gethost helper when cross building
287 if test "x${cross_compiling}" = xyes ; then
288   CC_FOR_GETHOST="cc"
289 else
290   CC_FOR_GETHOST="\$(CC)"
291 fi
292 AC_SUBST(CC_FOR_GETHOST)
293
294 if test "x$GCC" != xyes ; then
295   DFLAGS="$DFLAGS $NON_GNU_DFLAGS"
296   CFLAGS="$CFLAGS $NON_GNU_CFLAGS"
297 fi
298
299 dnl Checks for libraries
300 AC_SEARCH_LIBS(crypt, crypt)
301 AC_SEARCH_LIBS(getspnam, sec)
302 AC_SEARCH_LIBS(tgetent, termlib termcap curses ncurses)
303 AC_SEARCH_LIBS(gethostbyname, nsl)
304 AC_SEARCH_LIBS(connect, socket)
305 AC_SEARCH_LIBS(catgets, catgets)
306 AM_ICONV
307
308 dnl Checks for header files
309 AC_CHECK_HEADERS([auth.h crypt.h features.h inttypes.h paths.h] dnl
310                  [shadow.h stdint.h utmp.h utmpx.h])
311 AC_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])])
316 AC_HEADER_DIRENT
317 AC_HEADER_STAT
318 AC_HEADER_STDC
319
320 dnl Checks for types
321 AC_CHECK_TYPES([long long])
322 AC_TYPE_GETGROUPS
323 AC_TYPE_MODE_T
324 AC_TYPE_SIZE_T
325 AC_TYPE_UID_T
326 AC_TYPE_UINT32_T
327
328 AC_DEFUN([AC_TYPE_SSIZE_T], [
329 AC_CHECK_TYPE(ssize_t,,
330 AC_DEFINE(ssize_t, int, [Define to `int' not defined in <sys/types.h>.]),
331 [
332 #include <sys/types.h>
333 ])
334 ])
335 AC_TYPE_SSIZE_T
336
337 AC_DEFUN([AC_TYPE_SOCKLEN_T], [
338 AC_CHECK_TYPE(socklen_t,,
339 AC_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 ])
345 AC_TYPE_SOCKLEN_T
346
347
348 dnl Checks for structures
349 AC_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])
360 AC_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])
371 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], , ,
372 [#include <sys/types.h>
373 #include <sys/socket.h>])
374
375 dnl Checks for compiler characteristics
376 AC_C_CONST
377 AC_C_VOLATILE
378
379 dnl checks for library functions
380 AC_CHECK_DECLS([crypt, environ, gethostname, getpgrp], , ,
381 [#include "config_p.h"
382 AC_INCLUDES_DEFAULT([])
383 #ifdef HAVE_CRYPT_H
384 #include <crypt.h>
385 #endif
386 ])
387 AC_CHECK_FUNC([setlocale], [have_setlocale=yes], [have_setlocale=no])
388 AC_CHECK_FUNC([catgets], [have_catgets=yes], [have_catgets=no])
389 AC_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])
392 AC_FUNC_GETPGRP
393 AC_FUNC_MBRTOWC
394 if test "x${cross_compiling}" != xyes ; then
395   AC_FUNC_SETPGRP
396 else
397   ac_cv_func_setpgrp_void=yes
398 fi
399 AC_FUNC_STRCOLL
400
401 dnl This is not good enough; we need sockaddr_storage too.
402 dnl See whether we can use IPv6 related functions
403 dnl AC_DEFUN([IPv6_CHECK_FUNC], [
404 dnl changequote(, )dnl
405 dnl ac_tr_lib=HAVE_`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
406 dnl   -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
407 dnl changequote([, ])dnl
408 dnl AC_CHECK_FUNC($1, [dnl
409 dnl   AC_DEFINE_UNQUOTED($ac_tr_lib)
410 dnl   ac_cv_lib_inet6_$1=no], [dnl
411 dnl   AC_MSG_CHECKING([whether your system has IPv6 directory])
412 dnl   AC_CACHE_VAL(ipv6_cv_dir, [dnl
413 dnl     for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
414 dnl       if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
415 dnl     break
416 dnl       fi
417 dnl     done])dnl
418 dnl   AC_MSG_RESULT($ipv6_cv_dir)
419 dnl   if test $ipv6_cv_dir = no; then
420 dnl     ac_cv_lib_inet6_$1=no
421 dnl   else
422 dnl     if test x$ipv6_libinet6 = x; then
423 dnl       ipv6_libinet6=no
424 dnl       SAVELDFLAGS="$LDFLAGS"
425 dnl       LDFLAGS="-L$ipv6_cv_dir/lib"
426 dnl     fi
427 dnl     AC_CHECK_LIB(inet6, $1, [dnl
428 dnl       AC_DEFINE_UNQUOTED($ac_tr_lib)
429 dnl       if test $ipv6_libinet6 = no; then
430 dnl     ipv6_libinet6=yes
431 dnl     LIBS="$LIBS -linet6"
432 dnl       fi],)dnl
433 dnl     if test $ipv6_libinet6 = no; then
434 dnl       LDFLAGS="$SAVELDFLAGS"
435 dnl     fi
436 dnl   fi])dnl
437 dnl if test $ac_cv_func_$1 = yes -o $ac_cv_lib_inet6_$1 = yes
438 dnl then
439 dnl   ipv6_cv_$1=yes
440 dnl   ifelse([$2], , :, [$2])
441 dnl else
442 dnl   ipv6_cv_$1=no
443 dnl   ifelse([$3], , :, [$3])
444 dnl fi])
445 dnl IPv6_CHECK_FUNC(getnameinfo, DFLAGS="$DFLAGS -DINET6")
446
447 AC_SUBST(DFLAGS)
448
449 dnl Checks for system services
450 if 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
456 fi
457
458 if 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
465 fi
466
467 AC_ARG_WITH(hesiod,
468   [  --with-hesiod=PREFIX    Use Hesiod lookup for ~ expansion],
469   [hesiod="$withval"], [hesiod=no])
470 if 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
479 fi
480 AC_SUBST(HESDEF)
481 AC_SUBST(HESLIB)
482 AC_SUBST(BUILD_CATALOGS)
483
484 AC_CONFIG_FILES([Makefile nls/Makefile])
485 AC_OUTPUT