2 dnl configure.ac: Configure template for zsh.
3 dnl Process this file with autoconf to produce a configure script.
5 dnl Copyright (c) 1995-1997 Richard Coleman
6 dnl All rights reserved.
8 dnl Permission is hereby granted, without written agreement and without
9 dnl license or royalty fees, to use, copy, modify, and distribute this
10 dnl software and to distribute modified versions of this software for any
11 dnl purpose, provided that the above copyright notice and the following
12 dnl two paragraphs appear in all copies of this software.
14 dnl In no event shall Richard Coleman or the Zsh Development Group be liable
15 dnl to any party for direct, indirect, special, incidental, or consequential
16 dnl damages arising out of the use of this software and its documentation,
17 dnl even if Richard Coleman and the Zsh Development Group have been advised of
18 dnl the possibility of such damage.
20 dnl Richard Coleman and the Zsh Development Group specifically disclaim any
21 dnl warranties, including, but not limited to, the implied warranties of
22 dnl merchantability and fitness for a particular purpose. The software
23 dnl provided hereunder is on an "as is" basis, and Richard Coleman and the
24 dnl Zsh Development Group have no obligation to provide maintenance,
25 dnl support, updates, enhancements, or modifications.
30 AC_CONFIG_HEADER(config.h)
32 dnl What version of zsh are we building ?
33 . ${srcdir}/Config/version.mk
34 echo "configuring for zsh $VERSION"
36 dnl ----------------------------------------------
37 dnl CHECK FOR MACHINE/VENDOR/OPERATING SYSTEM TYPE
38 dnl ----------------------------------------------
39 dnl Find out machine type, vendor, and operating system
40 dnl What type of host is this?
42 AC_DEFINE_UNQUOTED(MACHTYPE, "$host_cpu",
43 [Define to be the machine type (microprocessor class or machine model).])
44 AC_DEFINE_UNQUOTED(VENDOR, "$host_vendor",
45 [Define to be a string corresponding the vendor of the machine.])
46 AC_DEFINE_UNQUOTED(OSTYPE, "$host_os",
47 [Define to be the name of the operating system.])
49 dnl -----------------------------
50 dnl CHECKING COMMAND LINE OPTIONS
51 dnl -----------------------------
52 dnl Handle --program-prefix, --program-suffix, etc.
55 dnl Handle setting of compile flags (CPPFLAGS, CFLAGS, LDFLAGS, LIBS).
56 zsh_COMPILE_FLAGS($CPPFLAGS, $CFLAGS, $LDFLAGS, $LIBS)
58 dnl Do you want to debug zsh?
59 ifdef([zsh-debug],[undefine([zsh-debug])])dnl
61 [Define to 1 if you want to debug zsh.])
62 AC_ARG_ENABLE(zsh-debug,
63 AC_HELP_STRING([--enable-zsh-debug], [compile with debug code and debugger symbols]),
64 [if test x$enableval = xyes; then
68 dnl Do you want zsh memory allocation routines.
69 ifdef([zsh-mem],[undefine([zsh-mem])])dnl
70 AH_TEMPLATE([ZSH_MEM],
71 [Define to 1 if you want to use zsh's own memory allocation routines])
72 AC_ARG_ENABLE(zsh-mem,
73 AC_HELP_STRING([--enable-zsh-mem], [compile with zsh memory allocation routines]),
74 [if test x$enableval = xyes; then
78 dnl Do you want to debug zsh memory allocation routines.
79 ifdef([zsh-mem-debug],[undefine([zsh-mem-debug])])dnl
80 AH_TEMPLATE([ZSH_MEM_DEBUG],
81 [Define to 1 if you want to debug zsh memory allocation routines.])
82 AC_ARG_ENABLE(zsh-mem-debug,
83 AC_HELP_STRING([--enable-zsh-mem-debug], [debug zsh memory allocation routines]),
84 [if test x$enableval = xyes; then
85 AC_DEFINE(ZSH_MEM_DEBUG)
88 dnl Do you want to print warnings when errors in memory allocation.
89 AH_TEMPLATE([ZSH_MEM_WARNING],
90 [Define to 1 if you want to turn on warnings of memory allocation errors])
91 ifdef([zsh-mem-warning],[undefine([zsh-mem-warning])])dnl
92 AC_ARG_ENABLE(zsh-mem-warning,
93 AC_HELP_STRING([--enable-zsh-mem-warning], [print warnings for errors in memory allocation]),
94 [if test x$enableval = xyes; then
95 AC_DEFINE(ZSH_MEM_WARNING)
98 dnl Do you want to turn on error checking for free().
99 ifdef([zsh-secure-free],[undefine([zsh-secure-free])])dnl
100 AH_TEMPLATE([ZSH_SECURE_FREE],
101 [Define to 1 if you want to turn on memory checking for free().])
102 AC_ARG_ENABLE(zsh-secure-free,
103 AC_HELP_STRING([--enable-zsh-secure-free], [turn on error checking for free()]),
104 [if test x$enableval = xyes; then
105 AC_DEFINE(ZSH_SECURE_FREE)
108 dnl Do you want debugging information on internal hash tables.
109 dnl This turns on the `hashinfo' builtin command.
110 ifdef([zsh-hash-debug],[undefine([zsh-hash-debug])])dnl
111 AH_TEMPLATE([ZSH_HASH_DEBUG],
112 [Define to 1 if you want to get debugging information on internal
113 hash tables. This turns on the `hashinfo' builtin.])
114 AC_ARG_ENABLE(zsh-hash-debug,
115 AC_HELP_STRING([--enable-zsh-hash-debug], [turn on debugging of internal hash tables]),
116 [if test x$enableval = xyes; then
117 AC_DEFINE(ZSH_HASH_DEBUG)
120 dnl Pathnames for global zsh scripts
121 ifdef([etcdir],[undefine([etcdir])])dnl
122 AC_ARG_ENABLE(etcdir,
123 AC_HELP_STRING([--enable-etcdir=DIR], [the default directory for global zsh scripts]),
124 [etcdir="$enableval"], [etcdir=/etc])
126 ifdef([zshenv],[undefine([zshenv])])dnl
127 AC_ARG_ENABLE(zshenv,
128 AC_HELP_STRING([--enable-zshenv=FILE], [the full pathname of the global zshenv script]),
129 [zshenv="$enableval"],
130 [if test "x$etcdir" = xno; then
133 zshenv="$etcdir/zshenv"
135 AH_TEMPLATE([GLOBAL_ZSHENV],
136 [The global file to source absolutely first whenever zsh is run;
137 if undefined, don't source anything.])
138 if test "x$zshenv" != xno; then
139 AC_DEFINE_UNQUOTED(GLOBAL_ZSHENV, "$zshenv")
142 ifdef([zshrc],[undefine([zshrc])])dnl
144 AC_HELP_STRING([--enable-zshrc=FILE], [the full pathname of the global zshrc script]),
145 [zshrc="$enableval"],
146 [if test "x$etcdir" = xno; then
149 zshrc="$etcdir/zshrc"
151 AH_TEMPLATE([GLOBAL_ZSHRC],
152 [The global file to source whenever zsh is run;
153 if undefined, don't source anything])
154 if test "x$zshrc" != xno; then
155 AC_DEFINE_UNQUOTED(GLOBAL_ZSHRC, "$zshrc")
158 ifdef([zprofile],[undefine([zprofile])])dnl
159 AC_ARG_ENABLE(zprofile,
160 AC_HELP_STRING([--enable-zprofile=FILE], [the full pathname of the global zprofile script]),
161 [zprofile="$enableval"],
162 [if test "x$etcdir" = xno; then
165 zprofile="$etcdir/zprofile"
167 AH_TEMPLATE([GLOBAL_ZPROFILE],
168 [The global file to source whenever zsh is run as a login shell,
169 before zshrc is read; if undefined, don't source anything.])
170 if test "x$zprofile" != xno; then
171 AC_DEFINE_UNQUOTED(GLOBAL_ZPROFILE, "$zprofile")
174 ifdef([zlogin],[undefine([zlogin])])dnl
175 AC_ARG_ENABLE(zlogin,
176 AC_HELP_STRING([--enable-zlogin=FILE], [the full pathname of the global zlogin script]),
177 [zlogin="$enableval"],
178 [if test "x$etcdir" = xno; then
181 zlogin="$etcdir/zlogin"
183 AH_TEMPLATE([GLOBAL_ZLOGIN],
184 [The global file to source whenever zsh is run as a login shell;
185 if undefined, don't source anything])
186 if test "x$zlogin" != xno; then
187 AC_DEFINE_UNQUOTED(GLOBAL_ZLOGIN, "$zlogin")
190 ifdef([zlogout],[undefine([zlogout])])dnl
191 AC_ARG_ENABLE(zlogout,
192 AC_HELP_STRING([--enable-zlogout=FILE], [the full pathname of the global zlogout script]),
193 [zlogout="$enableval"],
194 [if test "x$etcdir" = xno; then
197 zlogout="$etcdir/zlogout"
199 AH_TEMPLATE([GLOBAL_ZLOGOUT],
200 [The global file to source whenever zsh was run as a login shell.
201 This is sourced right before exiting. If undefined, don't source
203 if test "x$zlogout" != xno; then
204 AC_DEFINE_UNQUOTED(GLOBAL_ZLOGOUT, "$zlogout")
209 AC_SUBST(zprofile)dnl
213 dnl Do you want dynamically loaded binary modules.
214 ifdef([dynamic],[undefine([dynamic])])dnl
215 AC_ARG_ENABLE(dynamic,
216 AC_HELP_STRING([--disable-dynamic], [turn off dynamically loaded binary modules]),
217 [dynamic="$enableval"], [dynamic=yes])
219 dnl Do you want to disable restricted on r* commands
220 ifdef([restricted-r],[undefine([restricted-r])])dnl
221 AH_TEMPLATE([RESTRICTED_R],
222 [Undefine this if you don't want to get a restricted shell
223 when zsh is exec'd with basename that starts with r.
224 By default this is defined.])
225 AC_ARG_ENABLE(restricted-r,
226 AC_HELP_STRING([--disable-restricted-r], [turn off r* invocation for restricted shell]),
227 [if test x$enableval = xyes; then
228 AC_DEFINE(RESTRICTED_R)
230 AC_DEFINE(RESTRICTED_R)
233 dnl Do you want to disable use of locale functions
234 AH_TEMPLATE([CONFIG_LOCALE],
235 [Undefine if you don't want local features. By default this is defined.])
236 AC_ARG_ENABLE([locale],
237 AC_HELP_STRING([--disable-locale], [turn off locale features]),
238 [if test x$enableval = xyes; then
239 AC_DEFINE(CONFIG_LOCALE)
241 AC_DEFINE(CONFIG_LOCALE)
244 dnl Do you want to compile as K&R C.
245 AC_ARG_ENABLE(ansi2knr,
246 AC_HELP_STRING([--enable-ansi2knr], [translate source to K&R C before compiling]),
247 [ansi2knr="$enableval"], [ansi2knr=default])
249 ifdef([fndir],[undefine([fndir])])dnl
251 AC_HELP_STRING([--enable-fndir=DIR], [the directory in which to install functions]),
252 dnl ${VERSION} to be determined at compile time.
253 [if test x$enableval = xyes; then
254 fndir=${datadir}/${tzsh_name}/'${VERSION}'/functions
257 fi], [fndir=${datadir}/${tzsh_name}/'${VERSION}'/functions])
259 ifdef([sitefndir],[undefine([sitefndir])])dnl
260 AC_ARG_ENABLE(site-fndir,
261 AC_HELP_STRING([--enable-site-fndir=DIR], [same for site functions (not version specific)]),
262 [if test x$enableval = xyes; then
263 sitefndir=${datadir}/${tzsh_name}/site-functions
265 sitefndir="$enableval"
266 fi], [sitefndir=${datadir}/${tzsh_name}/site-functions])
268 ifdef([function_subdirs],[undefine([function_subdirs])])
269 AC_ARG_ENABLE(function-subdirs,
270 AC_HELP_STRING([--enable-function-subdirs], [install functions in subdirectories]))
272 if test "x${enable_function_subdirs}" != x &&
273 test "x${enable_function_subdirs}" != xno; then
274 FUNCTIONS_SUBDIRS=yes
280 AC_SUBST(sitefndir)dnl
281 AC_SUBST(FUNCTIONS_SUBDIRS)dnl
283 dnl Directories for scripts such as newuser.
285 ifdef([scriptdir],[undefine([scriptdir])])dnl
286 AC_ARG_ENABLE(scriptdir,
287 AC_HELP_STRING([--enable-scriptdir=DIR], [the directory in which to install scripts]),
288 dnl ${VERSION} to be determined at compile time.
289 [if test x$enableval = xyes; then
290 scriptdir=${datadir}/${tzsh_name}/'${VERSION}'/scripts
292 scriptdir="$enableval"
293 fi], [scriptdir=${datadir}/${tzsh_name}/'${VERSION}'/scripts])
295 ifdef([sitescriptdir],[undefine([sitescriptdir])])dnl
296 AC_ARG_ENABLE(site-scriptdir,
297 AC_HELP_STRING([--enable-site-scriptdir=DIR], [same for site scripts (not version specific)]),
298 [if test x$enableval = xyes; then
299 sitescriptdir=${datadir}/${tzsh_name}/scripts
301 sitescriptdir="$enableval"
302 fi], [sitescriptdir=${datadir}/${tzsh_name}/scripts])
304 AC_SUBST(scriptdir)dnl
305 AC_SUBST(sitescriptdir)dnl
307 AH_TEMPLATE([CUSTOM_PATCHLEVEL],
308 [Define to a custom value for the ZSH_PATCHLEVEL parameter])
309 AC_ARG_ENABLE(custom-patchlevel,
310 AC_HELP_STRING([--enable-custom-patchlevel], [set a custom ZSH_PATCHLEVEL value]),
311 [if test x$enableval != x && test x$enableval != xno; then
312 AC_DEFINE_UNQUOTED([CUSTOM_PATCHLEVEL], ["$enableval"])
315 dnl Do you want maildir support?
316 ifdef([maildir_support],[undefine([maildir_support])])dnl
317 AH_TEMPLATE([MAILDIR_SUPPORT],
318 [Define for Maildir support])
319 AC_ARG_ENABLE(maildir-support,
320 AC_HELP_STRING([--enable-maildir-support], [enable maildir support in MAIL and MAILPATH]),
321 [if test x$enableval = xyes; then
322 AC_DEFINE(MAILDIR_SUPPORT)
325 dnl Do you want to set a maximum function depth?
326 ifdef([max_function_depth],[undefine([max_function_depth])])dnl
327 AH_TEMPLATE([MAX_FUNCTION_DEPTH],
328 [Define for function depth limits])
329 AC_ARG_ENABLE(max-function-depth,
330 AC_HELP_STRING([--enable-max-function-depth=MAX], [limit function depth to MAX, default 1000]),
331 [if test x$enableval = xyes; then
332 AC_DEFINE(MAX_FUNCTION_DEPTH, 1000)
333 elif test x$enableval != xno; then
334 AC_DEFINE_UNQUOTED(MAX_FUNCTION_DEPTH, $enableval)
336 [AC_DEFINE(MAX_FUNCTION_DEPTH, 1000)]
339 ifdef([default_readnullcmd],[undefine([default_readnullcmd])])dnl
340 AH_TEMPLATE([DEFAULT_READNULLCMD],
341 [Define default pager used by readnullcmd])
342 AC_ARG_ENABLE(readnullcmd,
343 AC_HELP_STRING([--enable-readnullcmd=PAGER], [pager used when READNULLCMD is not set]),
344 [if test x$enableval = xyes; then
345 AC_DEFINE(DEFAULT_READNULLCMD,"more")
346 elif test x$enableval != xno; then
347 AC_DEFINE_UNQUOTED(DEFAULT_READNULLCMD,"$enableval")
349 [AC_DEFINE(DEFAULT_READNULLCMD,"more")]
352 dnl Do you want to look for pcre support?
354 AC_HELP_STRING([--enable-pcre],
355 [enable the search for the pcre library (may create run-time library dependencies)]))
357 dnl Do you want to look for capability support?
359 AC_HELP_STRING([--enable-cap],
360 [enable the search for POSIX capabilities (may require additional headers to be added by hand)]))
363 AC_HELP_STRING([--disable-gdbm], [turn off search for gdbm library]),
364 [gdbm="$enableval"], [gdbm=yes])
366 dnl ------------------
367 dnl CHECK THE COMPILER
368 dnl ------------------
369 dnl We want these before the checks, so the checks can modify their values.
370 test -z "${CFLAGS+set}" && CFLAGS= auto_cflags=1
371 test -z "${LDFLAGS+set}" && LDFLAGS= auto_ldflags=1
375 dnl Check for large file support.
377 dnl Gross hack for ReliantUNIX - GCC does not understand getconf options
378 dnl For now just disable LFS in this case
380 if test "$host" = mips-sni-sysv4 && test -n "$GCC"; then
386 dnl if the user hasn't specified CFLAGS, then
387 dnl if compiler is gcc, then use -O2 and some warning flags
389 if test -n "$auto_cflags" && test ."$ansi2knr" != .yes; then
390 if test "${enable_zsh_debug}" = yes; then
391 if test -n "$GCC"; then
392 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -ggdb"
397 if test -n "$GCC"; then
398 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -O2"
404 if test -n "$auto_ldflags"; then
405 case "${enable_zsh_debug}$host_os" in
406 yesaix*|yeshpux*|yesnetbsd*|yesopenbsd*) ;; # "ld -g" is not valid on these systems
407 darwin*) LDFLAGS=-Wl,-x ;;
416 dnl Sco doesn't define any useful compiler symbol,
417 dnl so we will check for sco and define __sco if
420 sco*) CFLAGS="-D__sco $CFLAGS" ;;
430 *" -s "*) strip_exeldflags=true strip_libldflags=true
431 LDFLAGS=`echo " $LDFLAGS " | sed "$sed"` ;;
432 *) strip_exeldflags=false strip_libldflags=false ;;
435 case " ${EXELDFLAGS+$EXELDFLAGS }" in
437 *" -s "*) strip_exeldflags=true
438 EXELDFLAGS=`echo " $EXELDFLAGS " | sed "$sed"` ;;
439 *) strip_exeldflags=false ;;
442 case " ${LIBLDFLAGS+$LIBLDFLAGS }" in
444 *" -s "*) strip_libldflags=true
445 LIBLDFLAGS=`echo " $LIBLDFLAGS " | sed "$sed"` ;;
446 *) strip_libldflags=false ;;
451 AC_SUBST(EXELDFLAGS)dnl
452 AC_SUBST(LIBLDFLAGS)dnl
454 AC_PROG_CPP dnl Figure out how to run C preprocessor.
455 AC_PROG_GCC_TRADITIONAL dnl Do we need -traditional flag for gcc.
456 AC_C_CONST dnl Does compiler support `const'.
458 dnl Default preprocessing on Mac OS X produces warnings
460 darwin*) CPP="$CPP -traditional-cpp" ;;
464 AC_MSG_CHECKING([whether to use prototypes])
465 if test ."$ansi2knr" = .yes || test ."$ansi2knr" = .no; then
469 if test ."$fp_cv_prog_cc_stdc" = .no; then
475 AH_TEMPLATE([PROTOTYPES],
476 [Define to 1 if ANSI function prototypes are usable.])
477 if test "$ansi2knr" = yes; then
478 AC_MSG_RESULT(${msg}no)
481 AC_MSG_RESULT(${msg}yes)
482 AC_DEFINE(PROTOTYPES)
487 AC_FUNC_ALLOCA dnl Check how to get `alloca'.
489 dnl If the compiler supports union initialisation
490 AC_CACHE_CHECK(if the compiler supports union initialisation,
491 zsh_cv_c_have_union_init,
492 [AC_TRY_COMPILE([union{void *p;long l;}u={0};], [u.l=1;],
493 zsh_cv_c_have_union_init=yes,
494 zsh_cv_c_have_union_init=no)])
495 AH_TEMPLATE([HAVE_UNION_INIT],
496 [Define to 1 if the compiler can initialise a union.])
497 if test x$zsh_cv_c_have_union_init = xyes; then
498 AC_DEFINE(HAVE_UNION_INIT)
501 dnl Checking if compiler correctly cast signed to unsigned.
502 AC_CACHE_CHECK(if signed to unsigned casting is broken,
503 zsh_cv_c_broken_signed_to_unsigned_casting,
504 [AC_TRY_RUN([main(){return((int)(unsigned char)((char) -1) == 255);}],
505 zsh_cv_c_broken_signed_to_unsigned_casting=yes,
506 zsh_cv_c_broken_signed_to_unsigned_casting=no,
507 zsh_cv_c_broken_signed_to_unsigned_casting=no)])
508 AH_TEMPLATE([BROKEN_SIGNED_TO_UNSIGNED_CASTING],
509 [Define to 1 if compiler incorrectly cast signed to unsigned.])
510 if test x$zsh_cv_c_broken_signed_to_unsigned_casting = xyes; then
511 AC_DEFINE(BROKEN_SIGNED_TO_UNSIGNED_CASTING)
514 dnl Checking if the compiler supports variable-length arrays
515 AC_CACHE_CHECK(if the compiler supports variable-length arrays,
516 zsh_cv_c_variable_length_arrays,
517 [AC_TRY_COMPILE([int foo(), n;], [int i[foo()], a[n+1];],
518 zsh_cv_c_variable_length_arrays=yes,
519 zsh_cv_c_variable_length_arrays=no)])
520 AH_TEMPLATE([HAVE_VARIABLE_LENGTH_ARRAYS],
521 [Define to 1 if compiler supports variable-length arrays])
522 if test x$zsh_cv_c_variable_length_arrays = xyes; then
523 AC_DEFINE(HAVE_VARIABLE_LENGTH_ARRAYS)
526 dnl ------------------
527 dnl CHECK FOR PROGRAMS
528 dnl ------------------
529 AC_PROG_MAKE_SET dnl Does make define $MAKE
530 AC_PROG_INSTALL dnl Check for BSD compatible `install'
531 AC_PROG_AWK dnl Check for mawk,gawk,nawk, then awk.
532 AC_PROG_LN dnl Check for working ln, for "make install"
533 AC_PROG_EGREP dnl sets $EGREP to grep -E or egrep
534 AC_CHECK_PROGS([YODL], [yodl], [: yodl])
535 AC_CHECK_PROGS([PDFETEX], [pdfetex], [: pdfetex])
536 AC_CHECK_PROGS([TEXI2PDF], [texi2pdf], [])
537 AC_CHECK_PROGS([ANSI2KNR], [ansi2knr], [: ansi2knr])
539 if test x"$ansi2knr" = xyes && test x"$ANSI2KNR" = x": ansi2knr"; then
541 echo "configure fatal error:"
542 echo "ansi2knr was specified (--enable-ansi2knr) but the program could not be found."
543 echo "Either remove the configure option if it is not required or build the ansi2knr"
544 echo "program before reconfiguring Zsh. The source code for ansi2knr is also"
545 echo "available in the GPL directory on Zsh distribution sites."
549 dnl ------------------
550 dnl CHECK HEADER FILES
551 dnl ------------------
559 if test x$enable_pcre = xyes; then
560 AC_CHECK_PROG([PCRECONF], pcre-config, pcre-config)
561 dnl Typically (meaning on this single RedHat 9 box in front of me)
562 dnl pcre-config --cflags produces a -I output which needs to go into
563 dnl CPPFLAGS else configure's preprocessor tests don't pick it up,
564 dnl producing a warning.
565 if test "x$ac_cv_prog_PCRECONF" = xpcre-config; then
566 CPPFLAGS="$CPPFLAGS `pcre-config --cflags`"
570 AC_CHECK_HEADERS(sys/time.h sys/times.h sys/select.h termcap.h termio.h \
571 termios.h sys/param.h sys/filio.h string.h memory.h \
572 limits.h fcntl.h libc.h sys/utsname.h sys/resource.h \
573 locale.h errno.h stdio.h stdarg.h varargs.h stdlib.h \
574 unistd.h sys/capability.h \
575 utmp.h utmpx.h sys/types.h pwd.h grp.h poll.h sys/mman.h \
576 netinet/in_systm.h pcre.h langinfo.h wchar.h stddef.h \
577 sys/stropts.h iconv.h ncurses.h ncursesw/ncurses.h \
579 if test x$dynamic = xyes; then
580 AC_CHECK_HEADERS(dlfcn.h)
581 AC_CHECK_HEADERS(dl.h)
584 dnl Some SCO systems cannot include both sys/time.h and sys/select.h
585 AH_TEMPLATE([TIME_H_SELECT_H_CONFLICTS],
586 [Define if sys/time.h and sys/select.h cannot be both included.])
587 if test x$ac_cv_header_sys_time_h = xyes && test x$ac_cv_header_sys_select_h = xyes; then
588 AC_CACHE_CHECK(for conflicts in sys/time.h and sys/select.h,
589 zsh_cv_header_time_h_select_h_conflicts,
590 [AC_TRY_COMPILE([#include <sys/time.h>
591 #include <sys/select.h>], [int i;],
592 zsh_cv_header_time_h_select_h_conflicts=no,
593 zsh_cv_header_time_h_select_h_conflicts=yes)])
594 if test x$zsh_cv_header_time_h_select_h_conflicts = xyes; then
595 AC_DEFINE(TIME_H_SELECT_H_CONFLICTS)
599 AH_TEMPLATE([GWINSZ_IN_SYS_IOCTL],
600 [Define if TIOCGWINSZ is defined in sys/ioctl.h but not in termios.h.])
601 if test x$ac_cv_header_termios_h = xyes; then
602 AC_CACHE_CHECK(TIOCGWINSZ in termios.h,
603 zsh_cv_header_termios_h_tiocgwinsz,
605 #ifdef HAVE_SYS_TYPES_H
606 # include <sys/types.h>
608 #include <termios.h>],
609 [int x = TIOCGWINSZ;],
610 zsh_cv_header_termios_h_tiocgwinsz=yes,
611 zsh_cv_header_termios_h_tiocgwinsz=no)])
613 zsh_cv_header_termios_h_tiocgwinsz=no
615 if test x$zsh_cv_header_termios_h_tiocgwinsz = xno; then
616 AC_CACHE_CHECK(TIOCGWINSZ in sys/ioctl.h,
617 zsh_cv_header_sys_ioctl_h_tiocgwinsz,
619 #ifdef HAVE_SYS_TYPES_H
620 # include <sys/types.h>
622 #include <sys/ioctl.h>],
623 [int x = TIOCGWINSZ;],
624 zsh_cv_header_sys_ioctl_h_tiocgwinsz=yes,
625 zsh_cv_header_sys_ioctl_h_tiocgwinsz=no)])
626 if test x$zsh_cv_header_sys_ioctl_h_tiocgwinsz = xyes; then
627 AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
631 AH_TEMPLATE([WINSIZE_IN_PTEM],
632 [Define if your should include sys/stream.h and sys/ptem.h.])
633 AC_CACHE_CHECK(for streams headers including struct winsize,
634 ac_cv_winsize_in_ptem,
635 [AC_TRY_COMPILE([#include <sys/stream.h>
636 #include <sys/ptem.h>],
637 [struct winsize wsz],
638 ac_cv_winsize_in_ptem=yes,
639 ac_cv_winsize_in_ptem=no)])
640 if test x$ac_cv_winsize_in_ptem = xyes; then
641 AC_DEFINE(WINSIZE_IN_PTEM)
644 dnl -------------------
645 dnl CHECK FOR LIBRARIES
646 dnl -------------------
648 dnl On some systems, modules need to be linked against libc explicitly,
649 dnl in case they require objects that exist only in the static version
650 dnl and might not be compiled into the zsh executable.
651 dnl On ReliantUNIX -lc better be the last library, else funny things
653 AC_CHECK_LIB(c, printf, [LIBS="$LIBS -lc"])
657 dnl Various features of ncurses depend on having the right header
658 dnl (the system's own curses.h may well not be good enough).
659 dnl So don't search for ncurses unless we found the header.
660 if test x$ac_cv_header_ncurses_h = xyes || test x$ac_cv_header_ncurses_ncurses_h = xyes || test x$ac_cv_header_ncursesw_ncurses_h = xyes; then
661 ncursesw_test=ncursesw
668 dnl Prefer BSD termcap library to SysV curses library, except on certain
669 dnl SYSV-derived systems. However, if we find terminfo and termcap
670 dnl stuff in the same library we will use that; typically this
671 dnl is ncurses or curses.
672 dnl On HPUX, Hcurses is reported to work better than curses.
673 dnl Prefer ncurses to curses on all systems. tinfo isn't very common now.
674 AC_ARG_WITH(term-lib,
675 AC_HELP_STRING([--with-term-lib=LIBS], [search space-separated LIBS for terminal handling]),
676 [if test "x$withval" != xno && test "x$withval" != x ; then
677 termcap_curses_order="$withval"
678 AC_SEARCH_LIBS(tigetstr, [$termcap_curses_order])
680 termcap_curses_order="$ncursesw_test tinfo termcap $ncurses_test curses"
683 hpux10.*|hpux11.*|solaris*)
684 termcap_curses_order="Hcurses $ncursesw_test $ncurses_test curses termcap" ;;
686 termcap_curses_order="$ncursesw_test tinfo termcap $ncurses_test curses" ;;
689 AH_TEMPLATE([ZSH_NO_XOPEN],
690 [Define if _XOPEN_SOURCE_EXTENDED should not be defined to avoid clashes])
691 AC_CACHE_CHECK(if _XOPEN_SOURCE_EXTENDED should not be defined,
694 *openbsd*|*freebsd5*|*freebsd6.[012]*|*aix*)
701 if test x$zsh_cv_no_xopen = xyes; then
702 AC_DEFINE(ZSH_NO_XOPEN)
705 dnl Check for tigetflag (terminfo) before tgetent (termcap).
706 dnl That's so that on systems where termcap and [n]curses are
707 dnl both available and both contain termcap functions, while
708 dnl only [n]curses contains terminfo functions, we only link against
710 AC_SEARCH_LIBS(tigetflag, [$termcap_curses_order])
711 AC_SEARCH_LIBS(tgetent, [$termcap_curses_order],
713 AC_MSG_FAILURE(["No terminal handling library was found on your system.
714 This is probably a library called 'curses' or 'ncurses'. You may
715 need to install a package called 'curses-devel' or 'ncurses-devel' on your
717 AC_CHECK_HEADERS(curses.h, [],
718 [AC_CACHE_CHECK(for Solaris 8 curses.h mistake, ac_cv_header_curses_solaris,
719 AC_TRY_COMPILE([#include <curses.h>], [],
720 [ac_cv_header_curses_h=yes
721 ac_cv_header_curses_solaris=yes],
722 ac_cv_header_curses_h=no
723 ac_cv_header_curses_solaris=no))
724 if test x$ac_cv_header_curses_solaris = xyes; then
725 AC_DEFINE(HAVE_CURSES_H)
728 dnl If our terminal library is not ncurses, don't try including
729 dnl any ncurses headers.
730 AC_CACHE_CHECK(if we need to ignore ncurses, zsh_cv_ignore_ncurses,
733 zsh_cv_ignore_ncurses=no
736 zsh_cv_ignore_ncurses=yes
740 AC_SEARCH_LIBS(getpwnam, nsl)
742 dnl I am told that told that unicos reqire these for nis_list
743 if test `echo $host_os | sed 's/^\(unicos\).*/\1/'` = unicos; then
744 LIBS="-lcraylm -lkrb -lnisdb -lnsl -lrpcsvc $LIBS"
747 if test "x$dynamic" = xyes; then
748 AC_CHECK_LIB(dl, dlopen)
751 if test x$enable_cap = xyes; then
752 AC_CHECK_LIB(cap, cap_get_proc)
755 AC_CHECK_LIB(socket, socket)
756 AC_CHECK_LIB(bind, gethostbyname2)
760 AC_CHECK_HEADERS(bind/netdb.h)
768 dnl Find iconv. It may be in libiconv and may be iconv() or libiconv()
769 if test "x$ac_cv_header_iconv_h" = "xyes"; then
770 AC_CHECK_FUNC(iconv, ac_found_iconv=yes, ac_found_iconv=no)
771 if test "x$ac_found_iconv" = "xno"; then
772 AC_CHECK_LIB(iconv, iconv, ac_found_iconv=yes)
773 if test "x$ac_found_iconv" = "xno"; then
774 AC_CHECK_LIB(iconv, libiconv, ac_found_iconv=yes)
776 if test "x$ac_found_iconv" != "xno"; then
780 dnl Handle case where there is a native iconv but iconv.h is from libiconv
781 AC_CHECK_DECL(_libiconv_version,
782 [ AC_CHECK_LIB(iconv, libiconv, LIBS="-liconv $LIBS") ],,
783 [ #include <iconv.h> ])
786 AH_TEMPLATE([ICONV_FROM_LIBICONV],
787 [Define to 1 if iconv() is linked from libiconv])
788 if test "x$ac_found_iconv" = xyes; then
789 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
790 AC_TRY_LINK([#include <iconv.h>],
791 [int myversion = _libiconv_version],
792 AC_DEFINE(ICONV_FROM_LIBICONV), )
795 dnl Check if iconv uses const in prototype declaration
796 if test "x$ac_found_iconv" = "xyes"; then
797 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
798 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
799 #include <iconv.h>]],
803 #if defined(__STDC__) || defined(__cplusplus)
804 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
808 [ac_cv_iconv_const=],
809 [ac_cv_iconv_const=const])])
810 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
811 [Define as const if the declaration of iconv() needs const.])
814 if test x$enable_pcre = xyes; then
815 dnl pcre-config should probably be employed here
816 dnl AC_SEARCH_LIBS(pcre_compile, pcre)
817 LIBS="`pcre-config --libs` $LIBS"
820 dnl ---------------------
821 dnl CHECK TERMCAP LIBRARY
822 dnl ---------------------
823 dnl Checks for external variable ospeed in the termcap library.
824 AC_CACHE_CHECK(if an include file defines ospeed,
825 zsh_cv_decl_ospeed_include_defines,
827 [#include <sys/types.h>
833 #endif], [ospeed = 0;],
834 zsh_cv_decl_ospeed_include_defines=yes,
835 zsh_cv_decl_ospeed_include_defines=no)])
837 if test x$zsh_cv_decl_ospeed_include_defines = xno; then
838 AC_CACHE_CHECK(if you must define ospeed,
839 zsh_cv_decl_ospeed_must_define,
840 [AC_TRY_LINK( ,[extern short ospeed; ospeed = 0;],
841 zsh_cv_decl_ospeed_must_define=yes,
842 zsh_cv_decl_ospeed_must_define=no)])
845 AH_TEMPLATE([HAVE_OSPEED],
846 [Define to 1 if your termcap library has the ospeed variable])
847 AH_TEMPLATE([MUST_DEFINE_OSPEED],
848 [Define to 1 if you have ospeed, but it is not defined in termcap.h])
849 if test x$zsh_cv_decl_ospeed_include_defines = xyes; then
850 AC_DEFINE(HAVE_OSPEED)
851 elif test x$zsh_cv_decl_ospeed_must_define = xyes; then
852 AC_DEFINE(HAVE_OSPEED)
853 AC_DEFINE(MUST_DEFINE_OSPEED)
856 if test x$gdbm != xno; then
857 AC_CHECK_HEADERS(gdbm.h)
858 AC_CHECK_LIB(gdbm, gdbm_open)
861 AC_CHECK_HEADERS(sys/xattr.h)
870 AC_CHECK_TYPE(ino_t, unsigned long)
875 dnl ------------------------------------------------
876 dnl Check size of long and try to find a 64-bit type
877 dnl ------------------------------------------------
878 dnl AC_CHECK_SIZEOF is no good, because we need the result here,
879 dnl and that doesn't seem to define a shell parameter.
880 AC_CACHE_CHECK(if long is 64 bits, zsh_cv_long_is_64_bit,
881 [AC_TRY_RUN([int main() { return sizeof(long) < 8; }],
882 zsh_cv_long_is_64_bit=yes,
883 zsh_cv_long_is_64_bit=no,
884 zsh_cv_long_is_64_bit=no)])
887 [Define to `unsigned long' if <sys/types.h> doesn't define.])
888 AH_TEMPLATE([LONG_IS_64_BIT],
889 [Definitions used when a long is less than eight byte, to try to
890 provide some support for eight byte operations.
892 Note that ZSH_64_BIT_TYPE, OFF_T_IS_64_BIT, INO_T_IS_64_BIT do *not* get
893 defined if long is already 64 bits, since in that case no special handling
896 Define to 1 if long is 64 bits])
897 AH_TEMPLATE([ZSH_64_BIT_TYPE],
898 [Define to a 64 bit integer type if there is one, but long is shorter.])
899 AH_TEMPLATE([ZSH_64_BIT_UTYPE],
900 [Define to an unsigned variant of ZSH_64_BIT_TYPE if that is defined.])
901 AH_TEMPLATE([OFF_T_IS_64_BIT],
902 [Define to 1 if off_t is 64 bit (for large file support)])
903 AH_TEMPLATE([INO_T_IS_64_BIT],
904 [Define to 1 if ino_t is 64 bit (for large file support).])
905 if test x$zsh_cv_long_is_64_bit = xyes; then
906 AC_DEFINE(LONG_IS_64_BIT)
908 AC_CACHE_CHECK(if off_t is 64 bit, zsh_cv_off_t_is_64_bit,
910 #include <sys/types.h>
912 main() { return sizeof(off_t) < 8; }
914 zsh_cv_off_t_is_64_bit=yes,
915 zsh_cv_off_t_is_64_bit=no,
916 zsh_cv_off_t_is_64_bit=no)])
917 if test x$zsh_cv_off_t_is_64_bit = xyes; then
918 AC_DEFINE(OFF_T_IS_64_BIT)
921 AC_CACHE_CHECK(if ino_t is 64 bit, zsh_cv_ino_t_is_64_bit,
923 #include <sys/types.h>
925 main() { return sizeof(ino_t) < 8; }
927 zsh_cv_ino_t_is_64_bit=yes,
928 zsh_cv_ino_t_is_64_bit=no,
929 zsh_cv_ino_t_is_64_bit=no)])
930 if test x$zsh_cv_ino_t_is_64_bit = xyes; then
931 AC_DEFINE(INO_T_IS_64_BIT)
934 if test x$enable_largefile != xno -o x$zsh_cv_off_t_is_64_bit = xyes \
935 -o $zsh_cv_ino_t_is_64_bit = yes; then
936 AC_CACHE_CHECK(if compiler has a 64 bit type, zsh_cv_64_bit_type,
937 [zsh_64_BIT_TYPE(long long, zsh_cv_64_bit_type)
938 if test "$zsh_cv_64_bit_type" = no; then
939 zsh_64_BIT_TYPE(quad_t, zsh_cv_64_bit_type)
941 if test "$zsh_cv_64_bit_type" = no; then
942 zsh_64_BIT_TYPE(__int64_t, zsh_cv_64_bit_type)
944 dnl As a last resort, if we know off_t has 64 bits, use that as
945 dnl the 64-bit integer type. I don't dare try ino_t since there's
946 dnl probably nothing to stop that being unsigned.
947 if test "$zsh_cv_64_bit_type" = no &&
948 test "$zsh_cv_off_t_is_64_bit" = yes; then
949 zsh_64_BIT_TYPE(off_t, zsh_cv_64_bit_type)
951 if test "$zsh_cv_64_bit_type" != no; then
952 AC_DEFINE_UNQUOTED(ZSH_64_BIT_TYPE, $zsh_cv_64_bit_type)
954 dnl Handle cases where unsigned type cannot be simply
955 dnl `unsigned ZSH_64_BIT_TYPE'. More tests may be required.
956 AC_CACHE_CHECK(for a corresponding unsigned 64 bit type,
958 [zsh_64_BIT_TYPE(unsigned $zsh_cv_64_bit_type, zsh_cv_64_bit_utype,
960 if test "$zsh_cv_64_bit_utype" = no; then
961 zsh_64_BIT_TYPE(__uint64_t, zsh_cv_64_bit_utype)
963 if test "$zsh_cv_64_bit_utype" != no; then
964 AC_DEFINE_UNQUOTED(ZSH_64_BIT_UTYPE, $zsh_cv_64_bit_utype)
970 dnl Check for sigset_t. Currently I'm looking in
971 dnl <sys/types.h> and <signal.h>. Others might need
973 AC_CACHE_CHECK(for sigset_t, zsh_cv_type_sigset_t,
975 [#include <sys/types.h>
976 #include <signal.h>], [sigset_t tempsigset;],
977 zsh_cv_type_sigset_t=yes, zsh_cv_type_sigset_t=no)])
978 AH_TEMPLATE([sigset_t],
979 [Define to `unsigned int' if <sys/types.h> or <signal.h> doesn't define])
980 if test x$zsh_cv_type_sigset_t = xno; then
981 AC_DEFINE(sigset_t, unsigned int)
984 dnl check structures for high resolution timestamps
985 AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec,
986 struct stat.st_atimespec.tv_nsec,
987 struct stat.st_atimensec,
988 struct stat.st_mtim.tv_nsec,
989 struct stat.st_mtimespec.tv_nsec,
990 struct stat.st_mtimensec,
991 struct stat.st_ctim.tv_nsec,
992 struct stat.st_ctimespec.tv_nsec,
993 struct stat.st_ctimensec])
995 dnl Check for struct timezone since some old SCO versions do not define it
997 #ifdef HAVE_SYS_TIME_H
998 # include <sys/time.h>
1002 dnl Check for utmp structures, for watch
1004 #ifdef HAVE_SYS_TYPES_H
1005 # include <sys/types.h>
1012 #ifdef HAVE_SYS_TYPES_H
1013 # include <sys/types.h>
1020 dnl Check contents of utmp structures
1022 #ifdef HAVE_SYS_TYPES_H
1023 # include <sys/types.h>
1028 ], struct utmp, ut_host)
1030 #ifdef HAVE_SYS_TYPES_H
1031 # include <sys/types.h>
1036 ], struct utmpx, ut_host)
1038 #ifdef HAVE_SYS_TYPES_H
1039 # include <sys/types.h>
1044 ], struct utmpx, ut_xtime)
1046 #ifdef HAVE_SYS_TYPES_H
1047 # include <sys/types.h>
1052 ], struct utmpx, ut_tv)
1054 dnl Check for inode numbers in directory entry structures
1056 #ifdef HAVE_SYS_TYPES_H
1057 # include <sys/types.h>
1059 #ifdef HAVE_DIRENT_H
1060 # include <dirent.h>
1062 ], struct dirent, d_ino)
1064 #ifdef HAVE_SYS_TYPES_H
1065 # include <sys/types.h>
1067 #ifdef HAVE_DIRENT_H
1068 # include <dirent.h>
1070 ], struct dirent, d_stat)
1072 #ifdef HAVE_SYS_TYPES_H
1073 # include <sys/types.h>
1075 #ifdef HAVE_SYS_NDIR_H
1076 # include <sys/ndir.h>
1078 #ifdef HAVE_SYS_DIR_H
1079 # include <sys/dir.h>
1084 ], struct direct, d_ino)
1086 #ifdef HAVE_SYS_TYPES_H
1087 # include <sys/types.h>
1089 #ifdef HAVE_SYS_NDIR_H
1090 # include <sys/ndir.h>
1092 #ifdef HAVE_SYS_DIR_H
1093 # include <sys/dir.h>
1098 ], struct direct, d_stat)
1100 dnl Check IPv6 socket address structure type
1102 #ifdef HAVE_SYS_TYPES_H
1103 # include <sys/types.h>
1105 #include <netinet/in.h>
1106 ], struct sockaddr_in6, sin6_scope_id)
1108 dnl Check for h_errno external variable
1109 AH_TEMPLATE([USE_LOCAL_H_ERRNO],
1110 [Define to 1 if h_errno is not defined by the system.])
1111 AC_CACHE_CHECK(if we need our own h_errno,
1112 zsh_cv_decl_h_errno_use_local,
1113 [AC_TRY_LINK( ,[extern int h_errno; h_errno = 0;],
1114 zsh_cv_decl_h_errno_use_local=no,
1115 zsh_cv_decl_h_errno_use_local=yes)])
1117 if test x$zsh_cv_decl_h_errno_use_local = xyes; then
1118 AC_DEFINE(USE_LOCAL_H_ERRNO)
1125 dnl need to integrate this function
1126 dnl AC_FUNC_STRFTIME
1128 AC_CHECK_FUNCS(strftime strptime mktime timelocal \
1129 difftime gettimeofday \
1131 readlink faccessx fchdir ftruncate \
1132 fstat lstat lchown fchown fchmod \
1134 mkfifo _mktemp mkstemp \
1136 sigaction sigblock sighold sigrelse sigsetmask sigprocmask \
1137 killpg setpgid setpgrp tcsetpgrp tcgetattr nice \
1138 gethostname gethostbyname2 getipnodebyname \
1139 inet_aton inet_pton inet_ntop \
1140 getlogin getpwent getpwnam getpwuid getgrgid getgrnam \
1141 initgroups nis_list \
1142 setuid seteuid setreuid setresuid setsid \
1143 memcpy memmove strstr strerror strtoul \
1144 getrlimit getrusage \
1148 putenv getenv setenv unsetenv xw\
1151 tgetent tigetflag tigetnum tigetstr setupterm initscr \
1152 getcchar setcchar waddwstr wget_wch win_wch use_default_colors \
1153 pcre_compile pcre_study pcre_exec \
1155 erand48 open_memstream \
1157 grantpt unlockpt ptsname \
1159 regcomp regexec regerror regfree \
1160 gdbm_open getxattr \
1161 realpath canonicalize_file_name)
1164 if test x$enable_cap = xyes; then
1165 AC_CHECK_FUNCS(cap_get_proc)
1168 dnl Check if tgetent accepts NULL (and will allocate its own termcap buffer)
1169 dnl Some termcaps reportedly accept a zero buffer, but then dump core
1171 dnl Under Cygwin test program crashes but exit code is still 0. So,
1172 dnl we test for a file that porgram should create
1173 AH_TEMPLATE([TGETENT_ACCEPTS_NULL],
1174 [Define to 1 if tgetent() accepts NULL as a buffer.])
1175 AC_CACHE_CHECK(if tgetent accepts NULL,
1176 zsh_cv_func_tgetent_accepts_null,
1181 int r1 = tgetent(buf, "vt100");
1182 int r2 = tgetent((char*)0,"vt100");
1183 if (r1 >= 0 && r1 == r2) {
1184 char tbuf[1024], *u;
1187 creat("conftest.tgetent", 0640);
1189 exit((r1 != r2) || r2 == -1);
1192 if test -f conftest.tgetent; then
1193 zsh_cv_func_tgetent_accepts_null=yes
1195 zsh_cv_func_tgetent_accepts_null=no
1197 zsh_cv_func_tgetent_accepts_null=no,
1198 zsh_cv_func_tgetent_accepts_null=no)])
1199 if test x$zsh_cv_func_tgetent_accepts_null = xyes; then
1200 AC_DEFINE(TGETENT_ACCEPTS_NULL)
1202 AC_CACHE_CHECK(if tgetent returns 0 on success,
1203 zsh_cv_func_tgetent_zero_success,
1208 int r1 = tgetent(buf, "!@#$%^&*");
1209 int r2 = tgetent(buf, "vt100");
1210 if (r1 < 0 && r2 == 0) {
1211 char tbuf[1024], *u;
1214 creat("conftest.tgetent0", 0640);
1219 if test -f conftest.tgetent0; then
1220 zsh_cv_func_tgetent_zero_success=yes
1222 zsh_cv_func_tgetent_zero_success=no
1224 zsh_cv_func_tgetent_zero_success=no,
1225 zsh_cv_func_tgetent_zero_success=no)])
1226 AH_TEMPLATE([TGETENT_SUCCESS],
1227 [Define to what tgetent() returns on success (0 on HP-UX X/Open curses).])
1228 if test x$zsh_cv_func_tgetent_zero_success = xyes; then
1229 AC_DEFINE(TGETENT_SUCCESS, 0)
1231 AC_DEFINE(TGETENT_SUCCESS, 1)
1235 if test x$ac_cv_func_mmap_fixed_mapped = xyes; then
1236 AC_CHECK_FUNCS(munmap msync)
1239 if test x$ac_cv_func_setpgrp = xyes; then
1242 dnl If there is no setpgrp, the test for getpgrp(void) will fail
1243 dnl because the program will not compile. However, in that case
1244 dnl we can be reasonably confident we are not dealing with a
1245 dnl Berkeleyesque system, so assume getpgrp does take void.
1246 ac_cv_func_getpgrp_void=yes
1247 AC_DEFINE(GETPGRP_VOID)
1250 if test x$dynamic = xyes; then
1251 AC_CHECK_FUNCS(dlopen dlerror dlsym dlclose load loadquery loadbind unload \
1252 shl_load shl_unload shl_findsym)
1255 AH_TEMPLATE([XATTR_EXTRA_ARGS],
1256 Define if getxattr() etc. require additional MacOS-style arguments)
1257 if test x$ac_cv_func_getxattr = xyes && test x$ac_cv_header_sys_xattr_h = xyes
1259 AC_CACHE_CHECK(if getxattr etc. are Linux-like,
1260 zsh_cv_getxattr_linux,
1261 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1262 #include <sys/xattr.h>]],
1264 (void)listxattr("", 0, 0);
1265 (void)getxattr("", "", 0, 0);
1266 (void)setxattr("", "", "", 0, 0);
1267 (void)removexattr("", "");
1269 [zsh_cv_getxattr_linux=yes],
1270 [zsh_cv_getxattr_linux=no])])
1272 if test x$zsh_cv_getxattr_linux != xyes; then
1273 AC_CACHE_CHECK(if getxattr etc. are MAC-like,
1274 zsh_cv_getxattr_mac,
1275 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1276 #include <sys/xattr.h>]],
1277 [[(void)listxattr("", 0, 0, 0);
1278 (void)getxattr("", "", 0, 0, 0, 0);
1279 (void)setxattr("", "", "", 0, 0, 0);
1280 (void)removexattr("", "", 0);]])],
1281 [zsh_cv_getxattr_mac=yes],
1282 [zsh_cv_getxattr_mac=no])])
1284 if test x$zsh_cv_getxattr_mac = xyes; then
1285 AC_DEFINE(XATTR_EXTRA_ARGS)
1290 AC_CACHE_CHECK(if getxattr etc. are usable,
1292 [if test x$zsh_cv_getxattr_linux = xyes || test x$zsh_cv_getxattr_mac = xyes
1294 zsh_cv_use_xattr=yes
1302 dnl What style of signal do you have (POSIX, BSD, or SYSV)?
1303 AH_TEMPLATE([POSIX_SIGNALS],
1304 [Define to 1 if you use POSIX style signal handling.])
1305 AH_TEMPLATE([BSD_SIGNALS],
1306 [Define to 1 if you use BSD style signal handling (and can block signals).])
1307 AH_TEMPLATE([SYSV_SIGNALS],
1308 [Define to 1 if you use SYS style signal handling (and can block signals).])
1309 AH_TEMPLATE([NO_SIGNAL_BLOCKING],
1310 [Define to 1 if you have no signal blocking at all (bummer).])
1311 AC_MSG_CHECKING(what style of signals to use)
1312 if test x$ac_cv_func_sigaction = xyes && test x$ac_cv_func_sigprocmask = xyes; then
1313 signals_style=POSIX_SIGNALS
1314 AC_DEFINE(POSIX_SIGNALS)
1315 elif test x$ac_cv_func_sigblock = xyes && test x$ac_cv_func_sigsetmask = xyes; then
1316 signals_style=BSD_SIGNALS
1317 AC_DEFINE(BSD_SIGNALS)
1318 elif test x$ac_cv_func_sighold = xyes && test x$ac_cv_func_sigrelse = xyes; then
1319 signals_style=SYSV_SIGNALS
1320 AC_DEFINE(SYSV_SIGNALS)
1322 signals_style=NO_SIGNAL_BLOCKING
1323 AC_DEFINE(NO_SIGNAL_BLOCKING)
1325 AC_DEFINE_UNQUOTED($signals_style)
1326 AC_MSG_RESULT($signals_style)
1328 dnl Where is <signal.h> located? Needed as input for signals.awk
1329 AC_CACHE_CHECK(where signal.h is located, zsh_cv_path_signal_h,
1330 [dnl Look at the output from the preprocessor.
1331 dnl We should get lines of the form `# 1 "/usr/include/signal.h"'
1332 dnl The following assumes the real definitions are in a file which
1333 dnl contains the name `sig'; we could relax this if necessary,
1334 dnl but then you can get a rather long list of files to test.
1335 dnl The backslash substitution is to persuade cygwin to cough up
1336 dnl slashes rather than doubled backslashes in the path.
1337 echo "#include <signal.h>" > nametmp.c
1338 sigfile_list="`$CPP nametmp.c |
1339 sed -n -e 's/^#line[ ].*\"\(.*\)\"/\1/p' \
1340 -e 's/^#[ ].*\"\(.*\)\"/\1/p' |
1341 sed 's/\\\\\\\\/\//g' |
1342 $AWK '{ if ($1 ~ /sig/) files[[$1]] = $1 }
1343 END { for (var in files) print var }'`"
1345 if test -z "$sigfile_list"; then
1346 dnl In case we don't get the stuff from the preprocesor, use the old
1347 dnl list of standard places.
1348 sigfile_list="/usr/include/sys/iso/signal_iso.h
1349 /usr/include/bsd/sys/signal.h
1350 /usr/include/signum.h
1351 /usr/include/asm/signum.h
1352 /usr/include/asm/signal.h
1353 /usr/include/linux/signal.h
1354 /usr/include/sys/signal.h
1355 /usr/include/bits/signum.h
1358 for SIGNAL_H in $sigfile_list
1360 dnl Try to make sure it doesn't get confused by files that don't
1361 dnl have real signal definitions in, but do #define SIG* by counting
1362 dnl the number of signals. Maybe we could even check for e.g. SIGHUP?
1363 nsigs=`test -f $SIGNAL_H && \
1364 grep '#[ ]*define[ ][ ]*SIG[0-9A-Z]*[ ]*[0-9][0-9]*' $SIGNAL_H | \
1365 wc -l | sed 's/[ ]//g'`
1366 test "x$nsigs" != x && test "$nsigs" -ge 7 && break
1368 if test x$SIGNAL_H = x"/dev/null"; then
1369 AC_MSG_ERROR(SIGNAL MACROS NOT FOUND: please report to developers)
1371 zsh_cv_path_signal_h=$SIGNAL_H
1373 SIGNAL_H=$zsh_cv_path_signal_h
1374 AC_SUBST(SIGNAL_H)dnl
1376 dnl Where are error names located? Needed as input for errnames1.awk
1377 AC_CACHE_CHECK(where error names are located, zsh_cv_path_errno_h,
1378 [dnl Look at the output from the preprocessor.
1379 dnl We should get lines of the form `# 1 "/usr/include/errno.h"'
1380 dnl The following assumes the real definitions are in a file which
1381 dnl contains the name `err'; we could relax this if necessary,
1382 dnl but then you can get a rather long list of files to test.
1383 dnl The backslash substitution is to persuade cygwin to cough up
1384 dnl slashes rather than doubled backslashes in the path.
1385 echo "#include <errno.h>" > nametmp.c
1386 errfile_list="`$CPP nametmp.c |
1387 sed -n -e 's/^#line[ ].*\"\(.*\)\"/\1/p' \
1388 -e 's/^#[ 0-9].*\"\(.*\)\"/\1/p' |
1389 sed 's/\\\\\\\\/\//g' |
1390 $AWK '{ if ($1 ~ /err/) files[[$1]] = $1 }
1391 END { for (var in files) print var }'`"
1393 for ERRNO_TRY_H in $errfile_list /dev/null
1395 dnl Try to make sure it doesn't get confused by files that don't
1396 dnl have real error definitions in. Count definitions to make sure.
1397 dnl Definitions of error numbers have become more and more general, so
1398 dnl make a list of files containing any definitions in and keep them all.
1399 dnl Careful with cut and paste in the pattern: the square brackets
1400 dnl must contain a space and a tab.
1401 nerrs=`test -f $ERRNO_TRY_H && \
1402 $EGREP '#[ ]*define[ ][ ]*E[0-9A-Z]*[ ]*(_HURD_ERRNO )?\(?[_A-Z0-9]' $ERRNO_TRY_H | \
1403 wc -l | sed 's/[ ]//g'`
1404 if test "x$nerrs" != x && test "$nerrs" -ge 1
1406 ERRNO_H="$ERRNO_H $ERRNO_TRY_H"
1409 if test x"$ERRNO_H" = x; then
1410 AC_MSG_ERROR(ERROR MACROS NOT FOUND: please report to developers)
1412 zsh_cv_path_errno_h="$ERRNO_H"
1414 ERRNO_H="$zsh_cv_path_errno_h"
1415 AC_SUBST(ERRNO_H)dnl
1417 AC_CACHE_CHECK(location of curses header, zsh_cv_path_curses_header,
1418 [if test x$zsh_cv_ignore_ncurses = xyes; then
1419 if test x$ac_cv_header_curses_h = xyes; then
1420 zsh_cv_path_curses_header=curses.h
1422 zsh_cv_path_curses_header=none
1424 elif test x$ac_cv_header_ncursesw_ncurses_h = xyes; then
1425 zsh_cv_path_curses_header=ncursesw/ncurses.h
1426 elif test x$ac_cv_header_ncurses_ncurses_h = xyes; then
1427 zsh_cv_path_curses_header=ncurses/ncurses.h
1428 elif test x$ac_cv_header_ncurses_h = xyes; then
1429 zsh_cv_path_curses_header=ncurses.h
1430 elif test x$ac_cv_header_curses_h = xyes; then
1431 zsh_cv_path_curses_header=curses.h
1433 zsh_cv_path_curses_header=none
1435 AH_TEMPLATE([ZSH_HAVE_CURSES_H],
1436 [Define to 1 if some variant of a curses header can be included])
1437 if test x$zsh_cv_path_curses_header != xnone; then
1438 AC_DEFINE(ZSH_HAVE_CURSES_H)
1439 ZSH_CURSES_H=$zsh_cv_path_curses_header
1443 AC_SUBST(ZSH_CURSES_H)
1445 dnl Where are curses key definitions located? Need for keypad() mode.
1446 AC_CACHE_CHECK(where curses key definitions are located, zsh_cv_path_curses_keys_h,
1447 [dnl This is an identical trick to errno.h, except we use ncurses.h
1449 if test x$zsh_cv_path_curses_header = xnone; then
1452 echo "#include <$zsh_cv_path_curses_header>" >nametmp.c
1455 curses_list="`$CPP nametmp.c |
1456 sed -n -e 's/^#line[ ].*\"\(.*\)\"/\1/p' \
1457 -e 's/^#[ 0-9].*\"\(.*\)\"/\1/p' |
1458 sed 's/\\\\\\\\/\//g' |
1459 $AWK '{ if ($1 ~ /\.h/) files[[$1]] = $1 }
1460 END { for (var in files) print var }'`"
1462 for CURSES_TRY_H in $curses_list /dev/null
1464 nkeys=`test -f $CURSES_TRY_H && \
1465 $EGREP '#[ ]*define[ ][ ]*KEY_' $CURSES_TRY_H | \
1466 wc -l | sed 's/[ ]//g'`
1467 if test "x$nkeys" != x && test "$nkeys" -ge 10
1469 CURSES_KEYS_H=$CURSES_TRY_H
1473 zsh_cv_path_curses_keys_h="$CURSES_KEYS_H"
1475 CURSES_KEYS_H="$zsh_cv_path_curses_keys_h"
1476 AC_SUBST(CURSES_KEYS_H)dnl
1478 dnl See if there are variants of term.h. For testing each one
1479 dnl we include the most likely variant of the curses header.
1480 AC_CHECK_HEADERS(ncursesw/term.h,
1482 [#include <ncursesw/ncurses.h>])
1483 AC_CHECK_HEADERS(ncurses/term.h,
1485 [#include <ncurses/ncurses.h>])
1486 AC_CHECK_HEADERS(term.h,
1488 [#include <curses.h>])
1490 dnl See if term.h is bundled along with the curses library we
1491 dnl are using. If this isn't the default system curses, compilation
1492 dnl could barf unless we include from the right subdirectory.
1493 AC_CACHE_CHECK(where term.h is located, zsh_cv_path_term_header,
1494 [case x$zsh_cv_path_curses_header in
1496 if test x$ac_cv_header_ncursesw_term_h = xyes; then
1497 zsh_cv_path_term_header=ncursesw/term.h
1501 if test x$ac_cv_header_ncurses_term_h = xyes; then
1502 zsh_cv_path_term_header=ncurses/term.h
1506 if test x$zsh_cv_path_term_header = x; then
1507 if test x$ac_cv_header_term_h = xyes; then
1508 zsh_cv_path_term_header=term.h
1510 zsh_cv_path_term_header=none
1514 AH_TEMPLATE([ZSH_HAVE_TERM_H],
1515 [Define to 1 if some variant of term.h can be included])
1516 AH_TEMPLATE([HAVE_BOOLCODES],
1517 [Define if you have the termcap boolcodes symbol.])
1518 AH_TEMPLATE([HAVE_NUMCODES],
1519 [Define if you have the termcap numcodes symbol.])
1520 AH_TEMPLATE([HAVE_STRCODES],
1521 [Define if you have the termcap strcodes symbol.])
1522 AH_TEMPLATE([HAVE_BOOLNAMES],
1523 [Define if you have the terminfo boolnames symbol.])
1524 AH_TEMPLATE([HAVE_NUMNAMES],
1525 [Define if you have the terminfo numnames symbol.])
1526 AH_TEMPLATE([HAVE_STRNAMES],
1527 [Define if you have the terminfo strnames symbol.])
1529 if test x$zsh_cv_path_term_header != xnone; then
1530 AC_DEFINE(ZSH_HAVE_TERM_H)
1531 ZSH_TERM_H=$zsh_cv_path_term_header
1532 if test x$zsh_cv_path_curses_header != xnone; then
1533 term_includes="#include <$zsh_cv_path_curses_header>
1534 #include <$zsh_cv_path_term_header>"
1536 term_includes="#include <$zsh_cv_path_term_header>"
1539 AC_MSG_CHECKING(if boolcodes is available)
1540 AC_TRY_LINK($term_includes, [char **test = boolcodes; puts(*test);],
1541 AC_DEFINE(HAVE_BOOLCODES) boolcodes=yes, boolcodes=no)
1542 AC_MSG_RESULT($boolcodes)
1543 AC_MSG_CHECKING(if numcodes is available)
1544 AC_TRY_LINK($term_includes, [char **test = numcodes; puts(*test);],
1545 AC_DEFINE(HAVE_NUMCODES) numcodes=yes, numcodes=no)
1546 AC_MSG_RESULT($numcodes)
1547 AC_MSG_CHECKING(if strcodes is available)
1548 AC_TRY_LINK($term_includes, [char **test = strcodes; puts(*test);],
1549 AC_DEFINE(HAVE_STRCODES) strcodes=yes, strcodes=no)
1550 AC_MSG_RESULT($strcodes)
1551 AC_MSG_CHECKING(if boolnames is available)
1552 AC_TRY_LINK($term_includes, [char **test = boolnames; puts(*test);],
1553 AC_DEFINE(HAVE_BOOLNAMES) boolnames=yes, boolnames=no)
1554 AC_MSG_RESULT($boolnames)
1555 AC_MSG_CHECKING(if numnames is available)
1556 AC_TRY_LINK($term_includes, [char **test = numnames; puts(*test);],
1557 AC_DEFINE(HAVE_NUMNAMES) numnames=yes, numnames=no)
1558 AC_MSG_RESULT($numnames)
1559 AC_MSG_CHECKING(if strnames is available)
1560 AC_TRY_LINK($term_includes, [char **test = strnames; puts(*test);],
1561 AC_DEFINE(HAVE_STRNAMES) strnames=yes, strnames=no)
1562 AC_MSG_RESULT($strnames)
1566 AC_SUBST(ZSH_TERM_H)
1569 dnl -----------------------------------------------------
1570 dnl Look for the file containing the RLIMIT_* definitions
1571 dnl -----------------------------------------------------
1572 dnl CALL FOR MORE (FEWER?) LOCATIONS: I've just copied the signal checking.
1573 AC_CACHE_CHECK(where the RLIMIT macros are located,zsh_cv_path_rlimit_h,
1574 [dnl Look at the output from the preprocessor.
1575 dnl Copied from the search for the signal names above.
1576 echo "#include <sys/resource.h>" >restmp.c
1577 resourcefile_list="`$CPP restmp.c |
1578 sed -n -e 's/^#line[ ].*\"\(.*\)\"/\1/p' \
1579 -e 's/^#[ ].*\"\(.*\)\"/\1/p' |
1580 sed 's/\\\\\\\\/\//g' |
1581 $AWK '{ if ($1 ~ /resource/) files[[$1]] = $1 }
1582 END { for (var in files) print var }'`"
1584 if test -z "$resourcefile_list"; then
1585 dnl No list: look at standard places.
1586 resourcefile_list="/usr/include/bsd/sys/resource.h
1587 /usr/include/asm/resource.h
1588 /usr/include/linux/resource.h
1589 /usr/include/sys/resource.h
1590 /usr/include/bits/resource.h
1591 /usr/include/resourcebits.h"
1593 for RESOURCE_H in $resourcefile_list /dev/null;
1595 test -f $RESOURCE_H && \
1596 grep '#[ ]*define[ ][ ]*RLIMIT_[A-Z]*[ ]*[0-9A-Z][0-9]*' $RESOURCE_H > /dev/null && \
1599 zsh_cv_path_rlimit_h=$RESOURCE_H
1600 if test x$RESOURCE_H = x"/dev/null" && test x$ac_cv_func_getrlimit = xyes; then
1601 AC_MSG_WARN(RLIMIT MACROS NOT FOUND: please report to developers)
1603 RLIMITS_INC_H=$zsh_cv_path_rlimit_h
1604 if test "$RLIMITS_INC_H" = "/dev/null"; then
1607 dnl rlimits.h only appears in dependencies if we are actually using it.
1608 dnl We are using it any time we have getrlimit, though if the macros were
1609 dnl not found we simply awk through /dev/null and fail to find them.
1610 dnl Thus, limit won't work, but at least the shell will compile.
1611 AC_SUBST(RLIMITS_INC_H)dnl
1613 dnl ------------------
1614 dnl rlimit type checks
1615 dnl ------------------
1616 AH_TEMPLATE([RLIM_T_IS_QUAD_T],
1617 [Define to 1 if struct rlimit uses quad_t.])
1618 AH_TEMPLATE([RLIM_T_IS_LONG_LONG],
1619 [Define to 1 if struct rlimit uses long long])
1620 AH_TEMPLATE([RLIM_T_IS_UNSIGNED],
1621 [Define to 1 if struct rlimit uses unsigned.])
1622 AH_TEMPLATE([rlim_t],
1623 [Define to the type used in struct rlimit.])
1625 AC_CACHE_CHECK(if rlim_t is longer than a long,
1626 zsh_cv_rlim_t_is_longer,
1628 #ifdef HAVE_SYS_TIME_H
1629 #include <sys/time.h>
1631 #include <sys/resource.h>
1632 main(){struct rlimit r;exit(sizeof(r.rlim_cur) <= sizeof(long));}],
1633 zsh_cv_rlim_t_is_longer=yes,
1634 zsh_cv_rlim_t_is_longer=no,
1635 zsh_cv_rlim_t_is_longer=yes)])
1636 if test x$zsh_cv_rlim_t_is_longer = xyes; then
1637 AC_CACHE_CHECK(if rlim_t is a quad,
1638 zsh_cv_rlim_t_is_quad_t,
1640 #ifdef HAVE_SYS_TIME_H
1641 #include <sys/time.h>
1644 #include <sys/resource.h>
1649 sprintf(buf, "%qd", r.rlim_cur);
1650 exit(strcmp(buf, "0"));
1652 zsh_cv_rlim_t_is_quad_t=yes,
1653 zsh_cv_rlim_t_is_quad_t=no,
1654 zsh_cv_rlim_t_is_quad_t=no)])
1655 if test x$zsh_cv_rlim_t_is_quad_t = xyes; then
1656 AC_DEFINE(RLIM_T_IS_QUAD_T)
1657 DEFAULT_RLIM_T=quad_t
1659 AC_DEFINE(RLIM_T_IS_LONG_LONG)
1660 DEFAULT_RLIM_T='long long'
1663 AC_CACHE_CHECK(if the rlim_t is unsigned,
1664 zsh_cv_type_rlim_t_is_unsigned,
1666 #ifdef HAVE_SYS_TIME_H
1667 #include <sys/time.h>
1669 #include <sys/resource.h>
1670 main(){struct rlimit r;r.rlim_cur=-1;exit(r.rlim_cur<0);}],
1671 zsh_cv_type_rlim_t_is_unsigned=yes,
1672 zsh_cv_type_rlim_t_is_unsigned=no,
1673 zsh_cv_type_rlim_t_is_unsigned=no)])
1674 if test x$zsh_cv_type_rlim_t_is_unsigned = xyes; then
1675 AC_DEFINE(RLIM_T_IS_UNSIGNED)
1676 DEFAULT_RLIM_T="unsigned $DEFAULT_RLIM_T"
1680 AC_CACHE_CHECK(for rlim_t, zsh_cv_type_rlim_t,
1682 #include <sys/types.h>
1683 #ifdef HAVE_SYS_TIME_H
1684 #include <sys/time.h>
1686 #include <sys/resource.h>],
1688 zsh_cv_type_rlim_t=yes,
1689 zsh_cv_type_rlim_t=no)])
1690 if test x$zsh_cv_type_rlim_t = xno; then
1691 AC_DEFINE_UNQUOTED(rlim_t, $DEFAULT_RLIM_T)
1695 dnl On some systems the RLIMIT_* don't evaluate to integers at compile time
1696 dnl (they may be enums). In this case we are not able to do preprocessor
1697 dnl comparisons and need our tests to determine what values exist and
1698 dnl if there are clashing definitions.
1700 zsh_LIMIT_PRESENT(RLIMIT_AIO_MEM)
1701 zsh_LIMIT_PRESENT(RLIMIT_AIO_OPS)
1702 zsh_LIMIT_PRESENT(RLIMIT_AS)
1703 zsh_LIMIT_PRESENT(RLIMIT_LOCKS)
1704 zsh_LIMIT_PRESENT(RLIMIT_MEMLOCK)
1705 zsh_LIMIT_PRESENT(RLIMIT_NPROC)
1706 zsh_LIMIT_PRESENT(RLIMIT_NOFILE)
1707 zsh_LIMIT_PRESENT(RLIMIT_PTHREAD)
1708 zsh_LIMIT_PRESENT(RLIMIT_RSS)
1709 zsh_LIMIT_PRESENT(RLIMIT_SBSIZE)
1710 zsh_LIMIT_PRESENT(RLIMIT_TCACHE)
1711 zsh_LIMIT_PRESENT(RLIMIT_VMEM)
1712 zsh_LIMIT_PRESENT(RLIMIT_SIGPENDING)
1713 zsh_LIMIT_PRESENT(RLIMIT_MSGQUEUE)
1714 zsh_LIMIT_PRESENT(RLIMIT_NICE)
1715 zsh_LIMIT_PRESENT(RLIMIT_RTPRIO)
1717 AH_TEMPLATE([RLIMIT_VMEM_IS_RSS],
1718 [Define to 1 if RLIMIT_VMEM and RLIMIT_RSS both exist and are equal.])
1719 AC_CACHE_CHECK(if RLIMIT_VMEM and RLIMIT_RSS are the same,
1720 zsh_cv_rlimit_vmem_is_rss,
1722 #include <sys/types.h>
1723 #ifdef HAVE_SYS_TIME_H
1724 #include <sys/time.h>
1726 #include <sys/resource.h>
1730 #if defined(HAVE_RLIMIT_VMEM) && defined(HAVE_RLIMIT_RSS)
1731 if (RLIMIT_RSS == RLIMIT_VMEM) ret = 0;
1735 zsh_cv_rlimit_vmem_is_rss=yes,
1736 zsh_cv_rlimit_vmem_is_rss=no,
1737 zsh_cv_rlimit_vmem_is_rss=no)])
1739 if test x$zsh_cv_rlimit_vmem_is_rss = xyes; then
1740 AC_DEFINE(RLIMIT_VMEM_IS_RSS)
1744 AH_TEMPLATE([RLIMIT_VMEM_IS_AS],
1745 [Define to 1 if RLIMIT_VMEM and RLIMIT_AS both exist and are equal.])
1746 AC_CACHE_CHECK(if RLIMIT_VMEM and RLIMIT_AS are the same,
1747 zsh_cv_rlimit_vmem_is_as,
1749 #include <sys/types.h>
1750 #ifdef HAVE_SYS_TIME_H
1751 #include <sys/time.h>
1753 #include <sys/resource.h>
1757 #if defined(HAVE_RLIMIT_VMEM) && defined(HAVE_RLIMIT_AS)
1758 if (RLIMIT_AS == RLIMIT_VMEM) ret = 0;
1762 zsh_cv_rlimit_vmem_is_as=yes,
1763 zsh_cv_rlimit_vmem_is_as=no,
1764 zsh_cv_rlimit_vmem_is_as=no)])
1766 if test x$zsh_cv_rlimit_vmem_is_as = xyes; then
1767 AC_DEFINE(RLIMIT_VMEM_IS_AS)
1771 AH_TEMPLATE([RLIMIT_RSS_IS_AS],
1772 [Define to 1 if RLIMIT_RSS and RLIMIT_AS both exist and are equal.])
1773 AC_CACHE_CHECK(if RLIMIT_RSS and RLIMIT_AS are the same,
1774 zsh_cv_rlimit_rss_is_as,
1776 #include <sys/types.h>
1777 #ifdef HAVE_SYS_TIME_H
1778 #include <sys/time.h>
1780 #include <sys/resource.h>
1784 #if defined(HAVE_RLIMIT_RSS) && defined(HAVE_RLIMIT_AS)
1785 if (RLIMIT_AS == RLIMIT_RSS) ret = 0;
1789 zsh_cv_rlimit_rss_is_as=yes,
1790 zsh_cv_rlimit_rss_is_as=no,
1791 zsh_cv_rlimit_rss_is_as=no)])
1793 if test x$zsh_cv_rlimit_rss_is_as = xyes; then
1794 AC_DEFINE(RLIMIT_RSS_IS_AS)
1798 dnl --------------------------------------------
1799 dnl Check for members of struct rusage
1800 dnl --------------------------------------------
1801 if test x$ac_cv_func_getrusage = xyes; then
1802 AC_CHECK_MEMBERS([struct rusage.ru_maxrss,
1803 struct rusage.ru_ixrss,
1804 struct rusage.ru_idrss,
1805 struct rusage.ru_isrss,
1806 struct rusage.ru_minflt,
1807 struct rusage.ru_majflt,
1808 struct rusage.ru_nswap,
1809 struct rusage.ru_inblock,
1810 struct rusage.ru_oublock,
1811 struct rusage.ru_msgsnd,
1812 struct rusage.ru_msgrcv,
1813 struct rusage.ru_nsignals,
1814 struct rusage.ru_nvcsw,
1815 struct rusage.ru_nivcsw],,,
1816 [#include <sys/types.h>
1817 #ifdef HAVE_SYS_TIME_H
1818 #include <sys/time.h>
1820 #include <sys/resource.h>])
1824 dnl --------------------------------------------
1825 dnl CHECK FOR DEFAULT PATH (used for command -p)
1826 dnl --------------------------------------------
1827 AC_CACHE_VAL(zsh_cv_cs_path,
1828 [if getconf _CS_PATH >/dev/null 2>&1; then
1829 zsh_cv_cs_path=`getconf _CS_PATH`
1830 elif getconf CS_PATH >/dev/null 2>&1; then
1831 zsh_cv_cs_path=`getconf CS_PATH`
1833 zsh_cv_cs_path="/bin:/usr/bin"
1835 AC_DEFINE_UNQUOTED(DEFAULT_PATH, "$zsh_cv_cs_path",
1836 [The default path; used when running commands with command -p])
1839 dnl ----------------------------
1840 dnl CHECK FOR /dev/fd FILESYSTEM
1841 dnl ----------------------------
1842 dnl FreeBSD 5 only supports /dev/fd/0 to /dev/fd/2 without mounting
1843 dnl a special file system. As zsh needs arbitrary /dev/fd (typically
1844 dnl >10) for its own use, we need to make sure higher fd's are available.
1845 dnl Since we're using the shell, we're restricted to 0 to 9 but 3 should
1847 AH_TEMPLATE([PATH_DEV_FD],
1848 [Define to the path of the /dev/fd filesystem.])
1849 AC_CACHE_CHECK(for /dev/fd filesystem, zsh_cv_sys_path_dev_fd,
1850 [if test "$host_os" = cygwin; then
1851 dnl In current (2008/12/01) versions of Cygwin these are present but don't
1852 dnl seem to work smoothly for process substitution; no great surprise
1853 dnl since getting processes to work at all on Cygwin is a big challenge.
1854 dnl We'll rely on FIFOs, since they do what we need.
1855 zsh_cv_sys_path_dev_fd=no
1857 [for zsh_cv_sys_path_dev_fd in /proc/self/fd /dev/fd no; do
1858 test x`echo ok|(exec 3<&0; cat $zsh_cv_sys_path_dev_fd/3 2>/dev/null;)` = xok && break
1861 if test x$zsh_cv_sys_path_dev_fd != xno; then
1862 AC_DEFINE_UNQUOTED(PATH_DEV_FD, "$zsh_cv_sys_path_dev_fd")
1865 dnl ---------------------------------
1866 dnl CHECK FOR RFS SUPERROOT DIRECTORY
1867 dnl ---------------------------------
1868 AC_CACHE_CHECK(for RFS superroot directory, zsh_cv_sys_superroot,
1869 [test -d /../.LOCALROOT && zsh_cv_sys_superroot=yes || zsh_cv_sys_superroot=no])
1870 AH_TEMPLATE([HAVE_SUPERROOT],
1871 [Define to 1 if you have RFS superroot directory.])
1872 if test x$zsh_cv_sys_superroot = xyes; then
1873 AC_DEFINE(HAVE_SUPERROOT)
1876 dnl CHECK FOR SYSTEMS REQUIRING GETCWD
1877 AC_CACHE_CHECK(whether we should use the native getcwd,
1879 [case "${host_cpu}-${host_vendor}-${host_os}" in
1880 *QNX*) zsh_cv_use_getcwd=yes ;;
1881 *) zsh_cv_use_getcwd=no ;;
1883 AH_TEMPLATE([USE_GETCWD],
1884 [Define to 1 if you need to use the native getcwd.])
1885 if test x$zsh_cv_use_getcwd = xyes; then
1886 AC_DEFINE(USE_GETCWD)
1889 dnl CHECK FOR setproctitle() FOR jobs -Z / ARGV0
1890 AH_TEMPLATE([HAVE_SETPROCTITLE],
1891 [Define to 1 if the system supports `setproctitle' to change process name])
1892 AC_CHECK_FUNC(setproctitle,AC_DEFINE(HAVE_SETPROCTITLE),
1893 AC_SEARCH_LIBS(setproctitle,util,AC_DEFINE(HAVE_SETPROCTITLE)))
1898 AH_TEMPLATE([HAVE_NIS],
1899 [Define to 1 if you have NIS.])
1900 AC_CACHE_CHECK(for NIS, zsh_cv_sys_nis,
1901 [test -f /usr/bin/ypcat && /usr/bin/ypcat passwd.byname > /dev/null 2>&1 && \
1902 zsh_cv_sys_nis=yes || zsh_cv_sys_nis=no])
1903 if test x$zsh_cv_sys_nis = xyes; then
1905 dnl Some systems (Solaris 2.x, Linux Redhat 5.x) require
1906 dnl libnsl (Network Services Library) to find yp_all
1907 AC_SEARCH_LIBS(yp_all, nsl)
1910 dnl -----------------
1911 dnl CHECK FOR NISPLUS
1912 dnl -----------------
1913 AH_TEMPLATE([HAVE_NIS_PLUS],
1914 [Define to 1 if you have NISPLUS.])
1915 AC_CACHE_CHECK(for NIS+, zsh_cv_sys_nis_plus,
1916 [test x$ac_cv_func_nis_list = xyes && test -f /usr/bin/nisls && \
1917 /usr/bin/nisls > /dev/null 2>&1 && \
1918 zsh_cv_sys_nis_plus=yes || zsh_cv_sys_nis_plus=no])
1919 if test x$zsh_cv_sys_nis_plus = xyes; then
1920 AC_DEFINE(HAVE_NIS_PLUS)
1923 dnl ----------------------------------------
1924 dnl CHECK FOR LOCATION OF {U,W}TMP{,X} FILES
1925 dnl ----------------------------------------
1928 zsh_PATH_UTMP(utmpx)
1929 zsh_PATH_UTMP(wtmpx)
1931 dnl -------------------
1932 dnl brk/sbrk PROTOTYPES
1933 dnl -------------------
1934 AC_CACHE_CHECK(for brk() prototype in <unistd.h>,
1935 zsh_cv_header_unistd_h_brk_proto,
1936 [AC_TRY_COMPILE([#include <unistd.h>
1937 double brk();], [int i;],
1938 zsh_cv_header_unistd_h_brk_proto=no, zsh_cv_header_unistd_h_brk_proto=yes)])
1939 AH_TEMPLATE([HAVE_BRK_PROTO],
1940 [Define to 1 if there is a prototype defined for brk() on your system.])
1941 if test x$zsh_cv_header_unistd_h_brk_proto = xyes; then
1942 AC_DEFINE(HAVE_BRK_PROTO)
1945 AC_CACHE_CHECK(for sbrk() prototype in <unistd.h>,
1946 zsh_cv_header_unistd_h_sbrk_proto,
1947 [AC_TRY_COMPILE([#include <unistd.h>
1948 double sbrk();], [int i;],
1949 zsh_cv_header_unistd_h_sbrk_proto=no, zsh_cv_header_unistd_h_sbrk_proto=yes)])
1950 AH_TEMPLATE([HAVE_SBRK_PROTO],
1951 [Define to 1 if there is a prototype defined for sbrk() on your system.])
1952 if test x$zsh_cv_header_unistd_h_sbrk_proto = xyes; then
1953 AC_DEFINE(HAVE_SBRK_PROTO)
1956 dnl -----------------------
1957 dnl mknod prototype for OSF
1958 dnl -----------------------
1959 AH_TEMPLATE([HAVE_MKNOD_PROTO],
1960 [Define to 1 if there is a prototype defined for mknod() on your system.])
1961 if test "$ac_cv_prog_cc_stdc" != no; then
1962 AC_CACHE_CHECK(for mknod prototype in <sys/stat.h>,
1963 zsh_cv_header_sys_stat_h_mknod_proto,
1964 [AC_TRY_COMPILE([#include <sys/stat.h>
1965 int mknod(double x);], [int i;],
1966 zsh_cv_header_sys_stat_h_mknod_proto=no,
1967 zsh_cv_header_sys_stat_h_mknod_proto=yes)])
1968 if test x$zsh_cv_header_sys_stat_h_mknod_proto = xyes; then
1969 AC_DEFINE(HAVE_MKNOD_PROTO)
1973 dnl ----------------------------------------
1974 dnl presence and location of ioctl prototype
1975 dnl ----------------------------------------
1976 AC_CACHE_CHECK(for ioctl prototype in <unistd.h> or <termios.h>,
1977 zsh_cv_header_unistd_h_termios_h_ioctl_proto,
1979 #ifdef HAVE_UNISTD_H
1980 # include <unistd.h>
1982 #ifdef HAVE_TERMIOS_H
1983 # include <termios.h>
1985 double ioctl();], [int i;],
1986 zsh_cv_header_unistd_h_termios_h_ioctl_proto=no,
1987 zsh_cv_header_unistd_h_termios_h_ioctl_proto=yes)])
1989 if test x$zsh_cv_header_unistd_h_termios_h_ioctl_proto = xno; then
1990 AC_CACHE_CHECK(for ioctl prototype in <sys/ioctl.h>,
1991 zsh_cv_header_sys_ioctl_h_ioctl_proto,
1992 [AC_TRY_COMPILE([#include <sys/ioctl.h>
1993 double ioctl();], [int i;],
1994 zsh_cv_header_sys_ioctl_h_ioctl_proto=no,
1995 zsh_cv_header_sys_ioctl_h_ioctl_proto=yes)])
1997 zsh_cv_header_sys_ioctl_h_ioctl_proto=no
2000 AH_TEMPLATE([HAVE_IOCTL_PROTO],
2001 [Define to 1 if there is a prototype defined for ioctl() on your system.])
2002 if test x$zsh_cv_header_unistd_h_termios_h_ioctl_proto = xyes || \
2003 test x$zsh_cv_header_sys_ioctl_h_ioctl_proto = xyes; then
2004 AC_DEFINE(HAVE_IOCTL_PROTO)
2006 AH_TEMPLATE([IOCTL_IN_SYS_IOCTL],
2007 [Define to 1 if we must include <sys/ioctl.h> to get a prototype for ioctl().])
2008 if test x$zsh_cv_header_sys_ioctl_h_ioctl_proto = xyes; then
2009 AC_DEFINE(IOCTL_IN_SYS_IOCTL)
2012 dnl -------------------
2013 dnl select() defined in <sys/socket.h>, ie BeOS R4.51
2014 dnl -------------------
2015 AH_TEMPLATE([SELECT_IN_SYS_SOCKET_H],
2016 [Define to 1 if select() is defined in <sys/socket.h>, ie BeOS R4.51])
2017 if test x$ac_cv_header_sys_select_h != xyes; then
2018 AC_CACHE_CHECK(for select() in <sys/socket.h>,
2019 zsh_cv_header_socket_h_select_proto,
2020 [AC_TRY_COMPILE([#include <sys/socket.h>], [fd_set fd;],
2021 zsh_cv_header_socket_h_select_proto=yes,
2022 zsh_cv_header_socket_h_select_proto=no)])
2023 if test x$zsh_cv_header_socket_h_select_proto = xyes; then
2024 AC_DEFINE(SELECT_IN_SYS_SOCKET_H)
2032 dnl Named FIFOs work well enough on recent versions of Cygwin
2033 dnl to provide what we want. Simply enable them.
2034 AC_CACHE_CHECK(if named FIFOs work,
2036 [if test "$host_os" = cygwin; then
2047 unlink("/tmp/fifo$$");
2049 if(mkfifo("/tmp/fifo$$", 0600) < 0)
2051 if(mknod("/tmp/fifo$$", 0010600, 0) < 0)
2058 fd = open("/tmp/fifo$$", O_RDONLY);
2059 exit(fd < 0 || read(fd, &c, 1) != 1 || c != 'x');
2061 fd = open("/tmp/fifo$$", O_WRONLY);
2062 ret = (fd < 0 || write(fd, "x", 1) < 1);
2063 unlink("/tmp/fifo$$");
2067 zsh_cv_sys_fifo=yes,
2069 zsh_cv_sys_fifo=yes)
2071 AH_TEMPLATE([HAVE_FIFOS],
2072 [Define to 1 if system has working FIFOs.])
2073 if test x$zsh_cv_sys_fifo = xyes; then
2074 AC_DEFINE(HAVE_FIFOS)
2076 dnl ---------------------
2077 dnl echo style of /bin/sh
2078 dnl ---------------------
2079 AC_CACHE_CHECK(if echo in /bin/sh interprets escape sequences,
2080 zsh_cv_prog_sh_echo_escape,
2081 [if test "`/bin/sh -c \"echo '\\n'\"`" = "\\n"; then
2082 zsh_cv_prog_sh_echo_escape=no
2084 zsh_cv_prog_sh_echo_escape=yes
2086 AH_TEMPLATE([SH_USE_BSD_ECHO],
2087 [Define to 1 if /bin/sh does not interpret \ escape sequences.])
2088 if test x$zsh_cv_prog_sh_echo_escape = xno; then
2089 AC_DEFINE(SH_USE_BSD_ECHO)
2093 dnl test for whether link() works
2094 dnl for instance, BeOS R4.51 doesn't support hard links yet
2096 AC_CACHE_CHECK(if link() works,
2104 char *tmpfile, *newfile;
2105 tmpfile="/tmp/zsh.linktest$$";
2106 newfile="/tmp/zsh.linktest2$$";
2109 if(creat(tmpfile, 0644) < 0)
2111 ret = link(tmpfile, newfile);
2117 zsh_cv_sys_link=yes,
2119 zsh_cv_sys_link=yes)])
2120 AH_TEMPLATE([HAVE_LINK],
2121 [Define to 1 if system has working link().])
2122 if test x$zsh_cv_sys_link = xyes; then
2123 AC_DEFINE(HAVE_LINK)
2127 dnl test for whether kill(pid, 0) where pid doesn't exit
2128 dnl should set errno to ESRCH, but some like BeOS R4.51 set to EINVAL
2130 AC_CACHE_CHECK(if kill(pid, 0) returns ESRCH correctly,
2131 zsh_cv_sys_killesrch,
2138 int pid = (getpid() + 10000) & 0xffffff;
2139 while (pid && (kill(pid, 0) == 0 || errno != ESRCH)) pid >>= 1;
2143 zsh_cv_sys_killesrch=yes,
2144 zsh_cv_sys_killesrch=no,
2145 zsh_cv_sys_killesrch=yes)])
2146 AH_TEMPLATE([BROKEN_KILL_ESRCH],
2147 [Define to 1 if kill(pid, 0) doesn't return ESRCH, ie BeOS R4.51.])
2148 if test x$zsh_cv_sys_killesrch = xno; then
2149 AC_DEFINE(BROKEN_KILL_ESRCH)
2153 dnl if POSIX, test for working sigsuspend().
2154 dnl for instance, BeOS R4.51 is broken.
2156 AH_TEMPLATE([BROKEN_POSIX_SIGSUSPEND],
2157 Define to 1 if sigsuspend() is broken, ie BeOS R4.51.])
2158 if test x$signals_style = xPOSIX_SIGNALS; then
2159 AC_CACHE_CHECK(if POSIX sigsuspend() works,
2160 zsh_cv_sys_sigsuspend,
2167 {if(sig==SIGCHLD) child=1;}
2169 struct sigaction act;
2172 act.sa_handler = &handler;
2173 sigfillset(&act.sa_mask);
2175 sigaction(SIGCHLD, &act, 0);
2177 sigprocmask(SIG_SETMASK, &set, 0);
2179 if(pid==0) return 0;
2182 ret=sigsuspend(&set);
2187 zsh_cv_sys_sigsuspend=yes,
2188 zsh_cv_sys_sigsuspend=no,
2189 zsh_cv_sys_sigsuspend=yes)])
2190 if test x$zsh_cv_sys_sigsuspend = xno; then
2191 AC_DEFINE(BROKEN_POSIX_SIGSUSPEND)
2196 dnl if found tcsetpgrp, test to see if it actually works
2197 dnl for instance, BeOS R4.51 does not support it yet
2199 AH_TEMPLATE([BROKEN_TCSETPGRP],
2200 [Define to 1 if tcsetpgrp() doesn't work, ie BeOS R4.51.])
2201 AC_ARG_WITH(tcsetpgrp,
2202 AC_HELP_STRING([--with-tcsetpgrp], [assumes that tcsetpgrp() exists and works correctly]),[
2204 xyes) zsh_working_tcsetpgrp=yes;;
2205 xno) zsh_working_tcsetpgrp=no;;
2206 *) AC_ERROR([please use --with-tcsetpgrp=yes or --with-tcsetpgrp=no]);;
2207 esac],[zsh_working_tcsetpgrp=check])
2208 if test "x$ac_cv_func_tcsetpgrp" = xyes; then
2209 case "x$zsh_working_tcsetpgrp" in
2211 trap "" TTOU > /dev/null 2>&1 || :
2212 AC_CACHE_CHECK(if tcsetpgrp() actually works,
2213 zsh_cv_sys_tcsetpgrp,
2215 #include <sys/types.h>
2221 fd=open("/dev/tty", O_RDWR);
2222 if (fd < 0) exit(2);
2223 ret=tcsetpgrp(fd, tcgetpgrp(fd));
2224 if (ret < 0) exit(1);
2228 zsh_cv_sys_tcsetpgrp=yes, [
2230 1) zsh_cv_sys_tcsetpgrp=no;;
2231 2) zsh_cv_sys_tcsetpgrp=notty;;
2232 *) zsh_cv_sys_tcsetpgrp=error;;
2234 ], zsh_cv_sys_tcsetpgrp=yes)])
2235 case "x$zsh_cv_sys_tcsetpgrp" in
2236 xno) AC_DEFINE(BROKEN_TCSETPGRP);;
2238 xnotty) AC_MSG_ERROR([no controlling tty
2239 Try running configure with --with-tcsetpgrp or --without-tcsetpgrp]);;
2240 *) AC_MSG_ERROR([unexpected return status]);;
2242 trap - TTOU > /dev/null 2>&1 || :
2245 xno) AC_DEFINE(BROKEN_TCSETPGRP);;
2246 *) AC_MSG_ERROR([unexpected value zsh_working_tcsetpgrp=$zsh_working_tcsetpgrp]);;
2251 dnl test for faked getpwnam() entry, ie a single entry returned for any username
2252 dnl for instance, BeOS R4.51 is not multiuser yet, and fakes getpwnam()
2253 dnl test by looking up two usernames that shouldn't succeed, and compare entry
2255 AH_TEMPLATE([GETPWNAM_FAKED],
2256 [Define to 1 if getpwnam() is faked, ie BeOS R4.51.])
2257 if test x$ac_cv_func_getpwnam = xyes; then
2258 AC_CACHE_CHECK(if getpwnam() is faked,
2259 zsh_cv_sys_getpwnam_faked,
2263 struct passwd *pw1, *pw2;
2264 char buf[1024], name[1024];
2265 sprintf(buf, "%d:%d", getpid(), rand());
2267 if (pw1) strcpy(name, pw1->pw_name);
2268 sprintf(buf, "%d:%d", rand(), getpid());
2270 exit(pw1!=0 && pw2!=0 && !strcmp(name, pw2->pw_name));
2273 zsh_cv_sys_getpwnam_faked=no,
2274 zsh_cv_sys_getpwnam_faked=yes,
2275 zsh_cv_sys_getpwnam_faked=no)])
2276 if test x$zsh_cv_sys_getpwnam_faked = xyes; then
2277 AC_DEFINE(GETPWNAM_FAKED)
2283 dnl check for the type of third argument of accept
2289 dnl Check for pty multiplexer for use in pty module.
2290 dnl We need to open it read/write, so make sure it is writeable.
2291 dnl Yet another test which won't work when cross-compiling.
2293 AC_CACHE_CHECK(if your system has /dev/ptmx,
2294 ac_cv_have_dev_ptmx,
2295 [if test -w /dev/ptmx; then
2296 ac_cv_have_dev_ptmx=yes
2298 ac_cv_have_dev_ptmx=no
2302 dnl Check if the ptmx functions are usable.
2303 dnl We need to be able to find the prototypes, which may
2304 dnl require non-POSIX source definitions. So test to see
2305 dnl if ptsname is correctly recognised as returning a char *.
2306 dnl We do this by making sure a program where ptsname() is declared
2307 dnl as returning int does *not* compile.
2308 dnl On Linux we need the XOPEN extensions. The easiest way to get
2309 dnl these is by defining _GNU_SOURCE.
2311 AH_TEMPLATE([USE_DEV_PTMX],
2312 [Define to 1 if all the kit for using /dev/ptmx for ptys is available.])
2313 if test x$ac_cv_have_dev_ptmx = xyes && \
2314 test x$ac_cv_func_grantpt = xyes && \
2315 test x$ac_cv_func_unlockpt = xyes && \
2316 test x$ac_cv_func_ptsname = xyes; then
2317 AC_CACHE_CHECK([if /dev/ptmx is usable],
2319 [AC_TRY_COMPILE([#ifdef __linux
2320 #define _GNU_SOURCE 1
2324 ac_cv_use_dev_ptmx=no,
2325 ac_cv_use_dev_ptmx=yes)])
2326 if test x$ac_cv_use_dev_ptmx = xyes; then
2327 AC_DEFINE(USE_DEV_PTMX)
2331 dnl -----------------
2332 dnl multibyte support
2333 dnl -----------------
2334 AC_ARG_ENABLE(multibyte,
2335 AC_HELP_STRING([--enable-multibyte], [support multibyte characters]),
2336 [zsh_cv_c_unicode_support=$enableval],
2337 [AC_CACHE_VAL(zsh_cv_c_unicode_support,
2338 AC_MSG_NOTICE([checking for functions supporting multibyte characters])
2340 for zfunc in iswalnum iswcntrl iswdigit iswgraph iswlower iswprint \
2341 iswpunct iswspace iswupper iswxdigit mbrlen mbrtowc towupper towlower \
2342 wcschr wcscpy wcslen wcsncmp wcsncpy wcrtomb wcwidth wmemchr wmemcmp \
2343 wmemcpy wmemmove wmemset; do
2344 AC_CHECK_FUNC($zfunc,
2345 [:], [zfuncs_absent="$zfuncs_absent $zfunc"])
2347 if test x"$zfuncs_absent" = x; then
2348 AC_MSG_NOTICE([all functions found, multibyte support enabled])
2349 zsh_cv_c_unicode_support=yes
2351 AC_MSG_NOTICE([missing functions, multibyte support disabled])
2352 zsh_cv_c_unicode_support=no
2356 AH_TEMPLATE([MULTIBYTE_SUPPORT],
2357 [Define to 1 if you want support for multibyte character sets.])
2358 AH_TEMPLATE([BROKEN_WCWIDTH],
2359 [Define to 1 if the wcwidth() function is present but broken.])
2360 if test x$zsh_cv_c_unicode_support = xyes; then
2361 AC_DEFINE(MULTIBYTE_SUPPORT)
2363 dnl Test for a wcwidth() implementation that gives the wrong width for
2364 dnl zero-width combining characters.
2365 dnl For the test we use a combining acute accent (\u0301).
2366 dnl We input it as UTF-8 since that is the standard we can rely
2367 dnl upon most: we can't rely on a wchar_t being stored as a
2368 dnl Unicode code point on all systems.
2369 dnl The programme returns 0 only if all the conditions for brokenness
2371 dnl - the programme compiled, linked and ran
2372 dnl - we successfully set a UTF-8 locale
2373 dnl - the locale we set plausibly converted the UTF-8 string
2374 dnl for a zero-width combining character (the only way to be
2375 dnl 100% sure would be to output it and ask if it looked right)
2376 dnl - the converted wide character gave a non-zero width.
2377 dnl locale -a is a fallback; on most systems we should find en_US.UTF-8.
2378 [locale_prog='char *my_locales[] = {
2379 "en_US.UTF-8", "en_GB.UTF-8", "en.UTF-8", '
2380 locale_prog="$locale_prog"`locale -a 2>/dev/null | \
2381 sed -e 's/utf8/UTF-8/' | grep UTF-8 | \
2382 while read line; do echo " \"$line\","; done;`
2383 locale_prog="$locale_prog 0 };
2384 #define _XOPEN_SOURCE
2391 char comb_acute_mb[] = { (char)0xcc, (char)0x81 };
2394 for (localep = my_locales; *localep; localep++)
2395 if (setlocale(LC_ALL, *localep) &&
2396 mbtowc(&wc, comb_acute_mb, 2) == 2)
2400 if (wcwidth(wc) == 0)
2406 AC_CACHE_CHECK(if the wcwidth() function is broken,
2407 zsh_cv_c_broken_wcwidth,
2408 [AC_TRY_RUN([$locale_prog],
2409 zsh_cv_c_broken_wcwidth=yes,
2410 zsh_cv_c_broken_wcwidth=no,
2411 zsh_cv_c_broken_wcwidth=no)])
2412 if test x$zsh_cv_c_broken_wcwidth = xyes; then
2413 AC_DEFINE(BROKEN_WCWIDTH)
2418 dnl static user lookup
2420 AC_ARG_ENABLE(dynamic-nss,
2421 AC_HELP_STRING([--disable-dynamic-nss], [do not call
2422 functions that will require dynamic NSS
2424 [zsh_cv_c_dynamic_nss=$enableval],
2427 AH_TEMPLATE([DISABLE_DYNAMIC_NSS],
2428 [Define to 1 if you want to avoid calling functions that will require
2429 dynamic NSS modules.])
2430 if test x$zsh_cv_c_dynamic_nss = xno; then
2431 AC_DEFINE(DISABLE_DYNAMIC_NSS)
2437 AH_TEMPLATE([HPUXDYNAMIC],
2438 [Define to 1 if you want to use dynamically loaded modules on HPUX 10.])
2440 INSTLIB="install.bin-\$(L)"
2441 UNINSTLIB="uninstall.bin-\$(L)"
2444 MOD_IMPORT_VARIABLE=
2445 MOD_IMPORT_FUNCTION=
2448 if test "$ac_cv_func_load" = yes &&
2449 test "$ac_cv_func_unload" = yes &&
2450 test "$ac_cv_func_loadbind" = yes &&
2451 test "$ac_cv_func_loadquery" = yes; then
2452 dnl Force AIXDYNAMIC even on newer versions that have dl family
2453 if test "x$dynamic" = xyes; then
2456 elif test "$ac_cv_func_dlopen" != yes ||
2457 test "$ac_cv_func_dlsym" != yes ||
2458 test "$ac_cv_func_dlerror" != yes; then
2459 if test "$ac_cv_func_shl_load" != yes ||
2460 test "$ac_cv_func_shl_unload" != yes ||
2461 test "$ac_cv_func_shl_findsym" != yes; then
2463 elif test "x$dynamic" = xyes; then
2465 DL_EXT="${DL_EXT=sl}"
2466 dnl autoheader won't allow us to define anything which isn't
2467 dnl going into a header, and we can't undefine anything, so
2468 dnl just define this anyway and rely on the later tests to
2469 dnl define DYNAMIC or not.
2470 AC_DEFINE(HPUXDYNAMIC)dnl
2474 test -n "$GCC" && LDARG=-Wl,
2476 AH_TEMPLATE([DLSYM_NEEDS_UNDERSCORE],
2477 [Define to 1 if an underscore has to be prepended to dlsym() argument.])
2478 AH_TEMPLATE([DYNAMIC_NAME_CLASH_OK],
2479 [Define to 1 if multiple modules defining the same symbol are OK.])
2480 if test "x$aixdynamic" = xyes; then
2481 DL_EXT="${DL_EXT=so}"
2483 zsh_cv_func_dlsym_needs_underscore=no
2484 if test -n "$GCC"; then
2485 DLLDFLAGS=${DLLDFLAGS=-shared}
2487 DLLDFLAGS=${DLLDFLAGS=-bM:SRE}
2489 DLLDFLAGS=${DLLDFLAGS=}
2490 EXTRA_LDFLAGS=${EXTRA_LDFLAGS=}
2493 zsh_cv_sys_dynamic_clash_ok="${zsh_cv_sys_dynamic_clash_ok=yes}"
2494 zsh_cv_sys_dynamic_rtld_global="${zsh_cv_sys_dynamic_rtld_global=yes}"
2495 zsh_cv_sys_dynamic_execsyms="${zsh_cv_sys_dynamic_execsyms=yes}"
2496 zsh_cv_sys_dynamic_strip_exe="${zsh_cv_sys_dynamic_strip_exe=yes}"
2497 zsh_cv_sys_dynamic_strip_lib="${zsh_cv_sys_dynamic_strip_lib=yes}"
2498 zsh_cv_shared_environ="${zsh_cv_shared_environ=yes}"
2499 elif test "$host_os" = cygwin; then
2500 DL_EXT="${DL_EXT=dll}"
2501 ##DLLD="${DLLD=dllwrap}"
2503 ##DLLDFLAGS="${DLLDFLAGS=--export-all-symbols}"
2504 DLLDFLAGS=${DLLDFLAGS=-shared -Wl,--export-all-symbols}
2505 zsh_cv_func_dlsym_needs_underscore=no
2506 DLLDFLAGS=${DLLDFLAGS=}
2507 EXTRA_LDFLAGS=${EXTRA_LDFLAGS=}
2508 zsh_cv_sys_dynamic_clash_ok="${zsh_cv_sys_dynamic_clash_ok=no}"
2509 zsh_cv_sys_dynamic_rtld_global="${zsh_cv_sys_dynamic_rtld_global=yes}"
2510 zsh_cv_sys_dynamic_execsyms="${zsh_cv_sys_dynamic_execsyms=no}"
2511 zsh_cv_sys_dynamic_strip_exe="${zsh_cv_sys_dynamic_strip_exe=yes}"
2512 zsh_cv_sys_dynamic_strip_lib="${zsh_cv_sys_dynamic_strip_lib=yes}"
2514 # THAT SUCKS! and must be changed
2516 zsh_cv_shared_environ="${zsh_cv_shared_environ=yes}"
2518 MOD_EXPORT="__attribute__((__dllexport__))"
2519 MOD_IMPORT_VARIABLE="__attribute__((__dllimport__))"
2520 MOD_IMPORT_FUNCTION=
2521 elif test "x$dynamic" = xyes; then
2522 AC_CACHE_CHECK(if your system uses ELF binaries,
2524 [AC_TRY_RUN([/* Test for whether ELF binaries are produced */
2532 int i = open(argv[0],O_RDONLY);
2535 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
2536 exit(0); /* succeed (yes, it's ELF) */
2542 zsh_cv_sys_elf=yes)])
2544 # We use [0-9]* in case statements, so need to change quoting
2547 DL_EXT="${DL_EXT=so}"
2548 if test x$zsh_cv_sys_elf = xyes; then
2551 # Forcibly set ld to native compiler to avoid obscure GCC problems
2552 DLLD="${DLLD=/usr/ccs/bin/cc}"
2564 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
2583 if test -n "$GCC"; then
2585 hpux*) DLLDFLAGS="${DLLDFLAGS=-shared}" ;;
2586 darwin*) DLCFLAGS="${DLCFLAGS=-fno-common}" ;;
2587 *) DLCFLAGS="${DLCFLAGS=-fPIC}" ;;
2592 DLCFLAGS="${DLCFLAGS=+z}"
2593 DLLDFLAGS="${DLLDFLAGS=-b}"
2595 sunos*) DLCFLAGS="${DLCFLAGS=-pic}" ;;
2596 solaris*|sysv4*|esix*) DLCFLAGS="${DLCFLAGS=-KPIC}" ;;
2600 osf*) DLLDFLAGS="${DLLDFLAGS=-shared -expect_unresolved '*'}" ;;
2601 *freebsd*|linux*|irix*|gnu*|dragonfly*) DLLDFLAGS="${DLLDFLAGS=-shared}" ;;
2602 sunos*) DLLDFLAGS="${DLLDFLAGS=-assert nodefinitions}" ;;
2603 sysv4*|esix*) DLLDFLAGS="${DLLDFLAGS=-G $ldflags}" ;;
2604 netbsd*) DLLDFLAGS="${DLLDFLAGS=${DLLDARG}-x -shared --whole-archive}" ;;
2605 aix*) DLLDFLAGS="${DLLDFLAGS=-G -bexpall -lc}" ;;
2606 solaris*|sysv4*|esix*) DLLDFLAGS="${DLLDFLAGS=-G}" ;;
2607 darwin*) DLLDFLAGS="${DLLDFLAGS=-bundle -flat_namespace -undefined suppress}" ;;
2608 beos*|haiku*) DLLDFLAGS="${DLLDFLAGS=-nostart}" ;;
2610 if test x$zsh_cv_sys_elf = xyes; then
2611 DLLDFLAGS="${DLLDFLAGS=-shared -fPIC}"
2614 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
2615 DLLDFLAGS="${DLLDFLAGS=-Bshareable}"
2618 DLLDFLAGS="${DLLDFLAGS=-shared -fPIC}"
2625 *-hpux*) EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-Wl,-E}" ;;
2627 if test x$zsh_cv_sys_elf = xyes; then
2628 EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-Wl,-E}"
2633 # unfortunately, we have different compilers
2634 # that need different flags
2636 if test -n "$GCC"; then
2639 sni_cc_version=`$CC -V 2>&1 | head -1`
2641 case "$sni_cc_version" in
2643 EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-Wl,-Blargedynsym}"
2646 EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-LD-Blargedynsym}"
2651 # gcc on BeOS doesn't like -rdynamic...
2652 EXTRA_LDFLAGS="${EXTRA_LDFLAGS= }"
2653 # also, dlopen() at least in Zeta respects $LIBRARY_PATH, so needs %A added to it.
2654 export LIBRARY_PATH="$LIBRARY_PATH:%A/"
2661 # Done with our shell code, so restore autotools quoting
2664 AC_CACHE_CHECK(if we can use -rdynamic, zsh_cv_rdynamic_available,
2665 old_LDFLAGS="$LDFLAGS"
2666 LDFLAGS="$LDFLAGS -rdynamic"
2667 AC_TRY_LINK([], [], [zsh_cv_rdynamic_available=yes
2668 EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-rdynamic}"],
2669 [zsh_cvs_rdynamic_available=no])
2670 LDFLAGS="$old_LDFLAGS")
2671 AC_CACHE_CHECK(if your dlsym() needs a leading underscore,
2672 zsh_cv_func_dlsym_needs_underscore,
2673 [echo failed >conftestval && cat >conftest.c <<EOM
2676 AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest.c 1>&AC_FD_CC) &&
2677 AC_TRY_COMMAND($DLLD $LDFLAGS $DLLDFLAGS -o conftest.$DL_EXT conftest.o 1>&AC_FD_CC) &&
2682 #define RTLD_LAZY BIND_DEFERRED
2683 #define RTLD_GLOBAL DYNAMIC_PATH
2685 char *zsh_gl_sym_addr ;
2687 #define dlopen(file,mode) (void *)shl_load((file), (mode), (long) 0)
2688 #define dlclose(handle) shl_unload((shl_t)(handle))
2689 #define dlsym(handle,name) (zsh_gl_sym_addr=0,shl_findsym((shl_t *)&(handle),name,TYPE_UNDEFINED,&zsh_gl_sym_addr), (void *)zsh_gl_sym_addr)
2695 #include <sys/types.h>
2710 FILE *f=fopen("conftestval", "w");
2712 handle = dlopen("./conftest.$DL_EXT", RTLD_LAZY) ;
2713 if (handle == NULL) {
2714 fprintf (f, "dlopen failed") ;
2717 symbol = dlsym(handle, "fred") ;
2718 if (symbol == NULL) {
2719 /* try putting a leading underscore */
2720 symbol = dlsym(handle, "_fred") ;
2721 if (symbol == NULL) {
2722 fprintf (f, "dlsym failed") ;
2725 fprintf (f, "yes") ;
2730 }], zsh_cv_func_dlsym_needs_underscore=`cat conftestval`,
2731 zsh_cv_func_dlsym_needs_underscore=failed
2733 zsh_cv_func_dlsym_needs_underscore=no)])
2734 if test "x$zsh_cv_func_dlsym_needs_underscore" = xyes; then
2735 AC_DEFINE(DLSYM_NEEDS_UNDERSCORE)
2736 elif test "x$zsh_cv_func_dlsym_needs_underscore" != xno; then
2737 dnl Do not cache failed value
2738 unset zsh_cv_func_dlsym_needs_underscore
2742 if test "x$dynamic" = xyes; then
2743 zsh_SHARED_VARIABLE([environ], [char **])
2744 test "$zsh_cv_shared_environ" = yes || dynamic=no
2745 if test "$ac_cv_func_tgetent" = yes; then
2746 zsh_SHARED_FUNCTION([tgetent])
2748 if test "$ac_cv_func_tigetstr" = yes; then
2749 zsh_SHARED_FUNCTION([tigetstr])
2753 if test "x$dynamic" = xyes; then
2754 zsh_SYS_DYNAMIC_CLASH
2755 zsh_SYS_DYNAMIC_GLOBAL
2756 RTLD_GLOBAL_OK=$zsh_cv_sys_dynamic_rtld_global
2757 zsh_SYS_DYNAMIC_EXECSYMS
2758 if test "$zsh_cv_sys_dynamic_execsyms" != yes; then
2761 zsh_SYS_DYNAMIC_STRIP_EXE
2762 zsh_SYS_DYNAMIC_STRIP_LIB
2763 if $strip_exeldflags && test "$zsh_cv_sys_dynamic_strip_exe" = yes; then
2764 EXELDFLAGS="$EXELDFLAGS -s"
2766 if $strip_libldflags && test "$zsh_cv_sys_dynamic_strip_lib" = yes; then
2767 LIBLDFLAGS="$LIBLDFLAGS -s"
2769 if test "$host_os" = cygwin; then
2770 INSTLIB="install.cygwin-lib"
2771 UNINSTLIB="uninstall.cygwin-lib"
2774 $strip_exeldflags && EXELDFLAGS="$EXELDFLAGS -s"
2775 $strip_libldflags && LIBLDFLAGS="$LIBLDFLAGS -s"
2779 AH_TEMPLATE([DYNAMIC],
2780 [Define to 1 if you want to use dynamically loaded modules.])
2781 if test "x$dynamic" = xyes; then
2783 AC_DEFINE(DYNAMIC)dnl
2788 AH_TEMPLATE([AIXDYNAMIC],
2789 [Define to 1 if you want to use dynamically loaded modules on AIX.])
2790 if test "x$aixdynamic" = xyes; then
2792 AC_DEFINE(AIXDYNAMIC)dnl
2797 if test "x$zsh_cv_sys_dynamic_clash_ok" = xyes; then
2802 AC_SUBST(SHORTBOOTNAMES)
2804 AC_SUBST(INSTLIB)dnl
2805 AC_SUBST(UNINSTLIB)dnl
2807 if test "$host_os" = cygwin; then
2808 EXTRAZSHOBJS="$EXTRAZSHOBJS zsh.res.o"
2811 AC_DEFINE_UNQUOTED(DL_EXT, "$DL_EXT",
2812 [The extension used for dynamically loaded modules.])dnl
2816 AC_SUBST(DLCFLAGS)dnl
2817 AC_SUBST(DLLDFLAGS)dnl
2819 AC_SUBST(EXTRA_LDFLAGS)dnl
2823 AC_SUBST(LINKMODS)dnl
2824 AC_SUBST(MOD_EXPORT)dnl
2825 AC_SUBST(MOD_IMPORT_VARIABLE)dnl
2826 AC_SUBST(MOD_IMPORT_FUNCTION)dnl
2827 AC_SUBST(EXTRAZSHOBJS)dnl
2829 # Generate config.modules. We look for *.mdd files in first and second
2830 # level subdirectories. Any existing line not containing 'auto=y' will be
2831 # retained, provided the .mdd file itself was found.
2832 CONFIG_MODULES=./config.modules
2833 cat <<EOM > ${CONFIG_MODULES}.sh
2836 CONFIG_MODULES="${CONFIG_MODULES}"
2838 cat <<\EOM >> ${CONFIG_MODULES}.sh
2839 echo "creating ${CONFIG_MODULES}"
2841 if test -f ${CONFIG_MODULES}; then
2842 userlist="`sed -e '/^#/d' -e '/auto=y/d' -e 's/ .*/ /' -e 's/^name=/ /' \
2844 mv ${CONFIG_MODULES} ${CONFIG_MODULES}.old
2846 # Save testing for existence each time.
2847 echo > ${CONFIG_MODULES}.old
2849 (echo "# Edit this file to change the way modules are loaded."
2850 echo "# The format is strict; do not break lines or add extra spaces."
2851 echo "# Run \`make prep' if you change anything here after compiling"
2852 echo "# (there is no need if you change this just after the first time"
2853 echo "# you run \`configure')."
2855 echo "# Values of \`link' are \`static', \`dynamic' or \`no' to compile the"
2856 echo "# module into the shell, link it in at run time, or not use it at all."
2857 echo "# In the final case, no attempt will be made to compile it."
2858 echo "# Use \`static' or \`no' if you do not have dynamic loading."
2860 echo "# Values of \`load' are \`yes' or \`no'; if yes, any builtins etc."
2861 echo "# provided by the module will be autoloaded by the main shell"
2862 echo "# (so long as \`link' is not set to \`no')."
2864 echo "# Values of \`auto' are \`yes' or \`no'. configure sets the value to"
2865 echo "# \`yes'. If you set it by hand to \`no', the line will be retained"
2866 echo "# when the file is regenerated in future."
2868 echo "# Note that the \`functions' entry extends to the end of the line."
2869 echo "# It should not be quoted; it is used verbatim to find files to install."
2871 echo "# You will need to run \`config.status --recheck' if you add a new"
2874 echo "# You should not change the values for the pseudo-module zsh/main,"
2875 echo "# which is the main shell (apart from the functions entry)."
2877 dnl The autoconf macros are only available in configure, not
2878 dnl config.status, and only change when configure is rerun.
2879 dnl So we need to run the autoconf tests here and store the results.
2880 dnl We then generate config.modules, preserving any user-generated
2881 dnl information, from config.status.
2882 for modfile in `cd ${srcdir}; echo */*.mdd */*/*.mdd`; do
2888 . ${srcdir}/$modfile
2889 if test x$name != x && test x"$link" != x; then
2891 *\ *) eval "link=\`$link\`"
2895 y*) load=" load=yes"
2900 if test "x$functions" != x; then
2901 # N.B. no additional quotes
2902 f=" functions=$functions"
2907 static) result="name=$name modfile=$modfile link=static auto=yes${load}$f"
2909 dynamic) if test x$dynamic != xno; then
2910 result="name=$name modfile=$modfile link=dynamic\
2913 result="name=$name modfile=$modfile link=no\
2917 either) if test x$dynamic != xno; then
2918 result="name=$name modfile=$modfile link=dynamic\
2921 result="name=$name modfile=$modfile link=static\
2925 *) result="name=$name modfile=$modfile link=no auto=yes load=no$f"
2928 dnl $result is the default output for config.modules. We generate
2929 dnl code to check if we should use this.
2930 cat <<EOM >> ${CONFIG_MODULES}.sh
2931 case "\$userlist" in
2932 *" $name "*) grep "^name=$name " \${CONFIG_MODULES}.old;;
2938 cat <<\EOM >> ${CONFIG_MODULES}.sh
2939 ) >${CONFIG_MODULES}
2940 rm -f ${CONFIG_MODULES}.old
2943 dnl AH_TOP replaces the code which used to appear at the top
2945 AH_TOP([/***** begin user configuration section *****/
2947 /* Define this to be the location of your password file */
2948 #define PASSWD_FILE "/etc/passwd"
2950 /* Define this to be the name of your NIS/YP password *
2951 * map (if applicable) */
2952 #define PASSWD_MAP "passwd.byname"
2954 /* Define to 1 if you want user names to be cached */
2955 #define CACHE_USERNAMES 1
2957 /* Define to 1 if system supports job control */
2958 #define JOB_CONTROL 1
2960 /* Define this if you use "suspended" instead of "stopped" */
2961 #define USE_SUSPENDED 1
2963 /* The default history buffer size in lines */
2964 #define DEFAULT_HISTSIZE 30
2966 /* The default editor for the fc builtin */
2967 #define DEFAULT_FCEDIT "vi"
2969 /* The default prefix for temporary files */
2970 #define DEFAULT_TMPPREFIX "/tmp/zsh"
2972 /***** end of user configuration section *****/
2973 /***** shouldn't have to change anything below here *****/
2977 CLEAN_MK="${srcdir}/Config/clean.mk"
2978 CONFIG_MK="${srcdir}/Config/config.mk"
2979 dnl defs.mk is in the build tree, not the source tree
2980 DEFS_MK="Config/defs.mk"
2981 VERSION_MK="${srcdir}/Config/version.mk"
2983 AC_SUBST_FILE(CLEAN_MK)dnl
2984 AC_SUBST_FILE(CONFIG_MK)dnl
2985 AC_SUBST_FILE(DEFS_MK)dnl
2986 AC_SUBST_FILE(VERSION_MK)dnl
2988 AC_CONFIG_FILES(Config/defs.mk Makefile Doc/Makefile Etc/Makefile \
2989 Src/Makefile Test/Makefile)
2990 AC_CONFIG_COMMANDS([config.modules], [. ./config.modules.sh])
2991 AC_CONFIG_COMMANDS([stamp-h], [echo >stamp-h])
2995 eval "zshbin1=${bindir}"
2996 eval "zshbin2=${zshbin1}"
2997 eval "zshman=${mandir}"
2998 eval "zshinfo=${infodir}"
2999 eval "zshfndir=${fndir}"
3004 zsh version : ${VERSION}
3005 host operating system : ${host_cpu}-${host_vendor}-${host_os}
3006 source code location : ${srcdir}
3008 preprocessor flags : ${CPPFLAGS}
3009 executable compiler flags : ${CFLAGS}"
3010 if test "x$dynamic" = xyes; then
3012 module compiler flags : ${CFLAGS} ${DLCFLAGS}"
3015 executable linker flags : ${LDFLAGS} ${EXELDFLAGS} ${EXTRA_LDFLAGS}"
3016 if test "x$dynamic" = xyes; then
3018 module linker flags : ${LDFLAGS} ${LIBLDFLAGS} ${DLLDFLAGS}"
3021 library flags : ${LIBS}
3022 installation basename : ${tzsh_name}
3023 binary install path : ${zshbin2}
3024 man page install path : ${zshman}
3025 info install path : ${zshinfo}"
3026 if test "$zshfndir" != no; then
3027 echo "functions install path : ${zshfndir}"
3029 echo "See config.modules for installed modules and functions.
3034 echo "WARNING: zsh will be linked against libgdbm.
3035 This means the binary is covered by the GNU General Public License.
3036 This does not affect the source code.
3037 Run configure with --disable-gdbm if required."