1dnl
2dnl  configure.ac: Configure template for zsh.
3dnl  Process this file with autoconf to produce a configure script.
4dnl
5dnl  Copyright (c) 1995-1997 Richard Coleman
6dnl  All rights reserved.
7dnl
8dnl  Permission is hereby granted, without written agreement and without
9dnl  license or royalty fees, to use, copy, modify, and distribute this
10dnl  software and to distribute modified versions of this software for any
11dnl  purpose, provided that the above copyright notice and the following
12dnl  two paragraphs appear in all copies of this software.
13dnl
14dnl  In no event shall Richard Coleman or the Zsh Development Group be liable
15dnl  to any party for direct, indirect, special, incidental, or consequential
16dnl  damages arising out of the use of this software and its documentation,
17dnl  even if Richard Coleman and the Zsh Development Group have been advised of
18dnl  the possibility of such damage.
19dnl
20dnl  Richard Coleman and the Zsh Development Group specifically disclaim any
21dnl  warranties, including, but not limited to, the implied warranties of
22dnl  merchantability and fitness for a particular purpose.  The software
23dnl  provided hereunder is on an "as is" basis, and Richard Coleman and the
24dnl  Zsh Development Group have no obligation to provide maintenance,
25dnl  support, updates, enhancements, or modifications.
26dnl
27
28AC_INIT(Src/zsh.h)
29AC_PREREQ(2.59c)
30AC_CONFIG_HEADER(config.h)
31
32dnl What version of zsh are we building ?
33. ${srcdir}/Config/version.mk
34echo "configuring for zsh $VERSION"
35
36dnl ----------------------------------------------
37dnl CHECK FOR MACHINE/VENDOR/OPERATING SYSTEM TYPE
38dnl ----------------------------------------------
39dnl Find out machine type, vendor, and operating system
40dnl What type of host is this?
41AC_CANONICAL_HOST
42AC_DEFINE_UNQUOTED(MACHTYPE, "$host_cpu",
43[Define to be the machine type (microprocessor class or machine model).])
44AC_DEFINE_UNQUOTED(VENDOR,   "$host_vendor",
45[Define to be a string corresponding the vendor of the machine.])
46AC_DEFINE_UNQUOTED(OSTYPE,   "$host_os",
47[Define to be the name of the operating system.])
48
49dnl -----------------------------
50dnl CHECKING COMMAND LINE OPTIONS
51dnl -----------------------------
52dnl Handle --program-prefix, --program-suffix, etc.
53zsh_ARG_PROGRAM
54
55dnl Handle setting of compile flags (CPPFLAGS, CFLAGS, LDFLAGS, LIBS).
56zsh_COMPILE_FLAGS($CPPFLAGS, $CFLAGS, $LDFLAGS, $LIBS)
57
58dnl Do you want to debug zsh?
59ifdef([zsh-debug],[undefine([zsh-debug])])dnl
60AH_TEMPLATE([DEBUG],
61[Define to 1 if you want to debug zsh.])
62AC_ARG_ENABLE(zsh-debug,
63AC_HELP_STRING([--enable-zsh-debug], [compile with debug code and debugger symbols]),
64[if test x$enableval = xyes; then
65  AC_DEFINE(DEBUG)
66fi])
67
68dnl Do you want zsh memory allocation routines.
69ifdef([zsh-mem],[undefine([zsh-mem])])dnl
70AH_TEMPLATE([ZSH_MEM],
71[Define to 1 if you want to use zsh's own memory allocation routines])
72AC_ARG_ENABLE(zsh-mem,
73AC_HELP_STRING([--enable-zsh-mem], [compile with zsh memory allocation routines]),
74[if test x$enableval = xyes; then
75  AC_DEFINE(ZSH_MEM)
76fi])
77
78dnl Do you want to debug zsh memory allocation routines.
79ifdef([zsh-mem-debug],[undefine([zsh-mem-debug])])dnl
80AH_TEMPLATE([ZSH_MEM_DEBUG],
81[Define to 1 if you want to debug zsh memory allocation routines.])
82AC_ARG_ENABLE(zsh-mem-debug,
83AC_HELP_STRING([--enable-zsh-mem-debug], [debug zsh memory allocation routines]),
84[if test x$enableval = xyes; then
85  AC_DEFINE(ZSH_MEM_DEBUG)
86fi])
87
88dnl Do you want to print warnings when errors in memory allocation.
89AH_TEMPLATE([ZSH_MEM_WARNING],
90[Define to 1 if you want to turn on warnings of memory allocation errors])
91ifdef([zsh-mem-warning],[undefine([zsh-mem-warning])])dnl
92AC_ARG_ENABLE(zsh-mem-warning,
93AC_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)
96fi])
97
98dnl Do you want to turn on error checking for free().
99ifdef([zsh-secure-free],[undefine([zsh-secure-free])])dnl
100AH_TEMPLATE([ZSH_SECURE_FREE],
101[Define to 1 if you want to turn on memory checking for free().])
102AC_ARG_ENABLE(zsh-secure-free,
103AC_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)
106fi])
107
108dnl Do you want to debug zsh heap allocation?
109dnl Does not depend on zsh-mem.
110ifdef([zsh-heap-debug],[undefine([zsh-heap-debug])])dnl
111AH_TEMPLATE([ZSH_HEAP_DEBUG],
112[Define to 1 if you want to turn on error checking for heap allocation.])
113AC_ARG_ENABLE(zsh-heap-debug,
114AC_HELP_STRING([--enable-zsh-heap-debug],
115[turn on error checking for heap allocation]),
116[if test x$enableval = xyes; then
117  AC_DEFINE(ZSH_HEAP_DEBUG)
118fi])
119
120dnl Do you want debugging information on internal hash tables.
121dnl This turns on the `hashinfo' builtin command.
122ifdef([zsh-hash-debug],[undefine([zsh-hash-debug])])dnl
123AH_TEMPLATE([ZSH_HASH_DEBUG],
124[Define to 1 if you want to get debugging information on internal
125 hash tables.  This turns on the `hashinfo' builtin.])
126AC_ARG_ENABLE(zsh-hash-debug,
127AC_HELP_STRING([--enable-zsh-hash-debug], [turn on debugging of internal hash tables]),
128[if test x$enableval = xyes; then
129  AC_DEFINE(ZSH_HASH_DEBUG)
130fi])
131
132dnl Pathnames for global zsh scripts
133ifdef([etcdir],[undefine([etcdir])])dnl
134AC_ARG_ENABLE(etcdir,
135AC_HELP_STRING([--enable-etcdir=DIR], [the default directory for global zsh scripts]),
136[etcdir="$enableval"], [etcdir=/etc])
137
138ifdef([zshenv],[undefine([zshenv])])dnl
139AC_ARG_ENABLE(zshenv,
140AC_HELP_STRING([--enable-zshenv=FILE], [the full pathname of the global zshenv script]),
141[zshenv="$enableval"],
142[if test "x$etcdir" = xno; then
143  zshenv=no
144else
145  zshenv="$etcdir/zshenv"
146fi])
147AH_TEMPLATE([GLOBAL_ZSHENV],
148[The global file to source absolutely first whenever zsh is run;
149 if undefined, don't source anything.])
150if test "x$zshenv" != xno; then
151  AC_DEFINE_UNQUOTED(GLOBAL_ZSHENV, "$zshenv")
152fi
153
154ifdef([zshrc],[undefine([zshrc])])dnl
155AC_ARG_ENABLE(zshrc,
156AC_HELP_STRING([--enable-zshrc=FILE], [the full pathname of the global zshrc script]),
157[zshrc="$enableval"],
158[if test "x$etcdir" = xno; then
159  zshrc=no
160else
161  zshrc="$etcdir/zshrc"
162fi])
163AH_TEMPLATE([GLOBAL_ZSHRC],
164[The global file to source whenever zsh is run;
165 if undefined, don't source anything])
166if test "x$zshrc" != xno; then
167  AC_DEFINE_UNQUOTED(GLOBAL_ZSHRC, "$zshrc")
168fi
169
170ifdef([zprofile],[undefine([zprofile])])dnl
171AC_ARG_ENABLE(zprofile,
172AC_HELP_STRING([--enable-zprofile=FILE], [the full pathname of the global zprofile script]),
173[zprofile="$enableval"],
174[if test "x$etcdir" = xno; then
175  zprofile=no
176else
177  zprofile="$etcdir/zprofile"
178fi])
179AH_TEMPLATE([GLOBAL_ZPROFILE],
180[The global file to source whenever zsh is run as a login shell,
181 before zshrc is read; if undefined, don't source anything.])
182if test "x$zprofile" != xno; then
183  AC_DEFINE_UNQUOTED(GLOBAL_ZPROFILE, "$zprofile")
184fi
185
186ifdef([zlogin],[undefine([zlogin])])dnl
187AC_ARG_ENABLE(zlogin,
188AC_HELP_STRING([--enable-zlogin=FILE], [the full pathname of the global zlogin script]),
189[zlogin="$enableval"],
190[if test "x$etcdir" = xno; then
191  zlogin=no
192else
193  zlogin="$etcdir/zlogin"
194fi])
195AH_TEMPLATE([GLOBAL_ZLOGIN],
196[The global file to source whenever zsh is run as a login shell;
197 if undefined, don't source anything])
198if test "x$zlogin" != xno; then
199  AC_DEFINE_UNQUOTED(GLOBAL_ZLOGIN, "$zlogin")
200fi
201
202ifdef([zlogout],[undefine([zlogout])])dnl
203AC_ARG_ENABLE(zlogout,
204AC_HELP_STRING([--enable-zlogout=FILE], [the full pathname of the global zlogout script]),
205[zlogout="$enableval"],
206[if test "x$etcdir" = xno; then
207  zlogout=no
208else
209  zlogout="$etcdir/zlogout"
210fi])
211AH_TEMPLATE([GLOBAL_ZLOGOUT],
212[The global file to source whenever zsh was run as a login shell.
213 This is sourced right before exiting.  If undefined, don't source
214 anything.])
215if test "x$zlogout" != xno; then
216  AC_DEFINE_UNQUOTED(GLOBAL_ZLOGOUT, "$zlogout")
217fi
218
219AC_SUBST(zshenv)dnl
220AC_SUBST(zshrc)dnl
221AC_SUBST(zprofile)dnl
222AC_SUBST(zlogin)dnl
223AC_SUBST(zlogout)dnl
224
225dnl Do you want dynamically loaded binary modules.
226ifdef([dynamic],[undefine([dynamic])])dnl
227AC_ARG_ENABLE(dynamic,
228AC_HELP_STRING([--disable-dynamic], [turn off dynamically loaded binary modules]),
229[dynamic="$enableval"], [dynamic=yes])
230
231dnl Do you want to disable restricted on r* commands
232ifdef([restricted-r],[undefine([restricted-r])])dnl
233AH_TEMPLATE([RESTRICTED_R],
234[Undefine this if you don't want to get a restricted shell
235 when zsh is exec'd with basename that starts with r.
236 By default this is defined.])
237AC_ARG_ENABLE(restricted-r,
238AC_HELP_STRING([--disable-restricted-r], [turn off r* invocation for restricted shell]),
239[if test x$enableval = xyes; then
240  AC_DEFINE(RESTRICTED_R)
241fi],
242AC_DEFINE(RESTRICTED_R)
243)
244
245dnl Do you want to disable use of locale functions
246AH_TEMPLATE([CONFIG_LOCALE],
247[Undefine if you don't want local features.  By default this is defined.])
248AC_ARG_ENABLE([locale],
249AC_HELP_STRING([--disable-locale], [turn off locale features]),
250[if test x$enableval = xyes; then
251  AC_DEFINE(CONFIG_LOCALE)
252fi],
253AC_DEFINE(CONFIG_LOCALE)
254)
255
256dnl Do you want to compile as K&R C.
257AC_ARG_ENABLE(ansi2knr,
258AC_HELP_STRING([--enable-ansi2knr], [translate source to K&R C before compiling]),
259[ansi2knr="$enableval"], [ansi2knr=default])
260
261ifdef([fndir],[undefine([fndir])])dnl
262AC_ARG_ENABLE(fndir,
263AC_HELP_STRING([--enable-fndir=DIR], [the directory in which to install functions]),
264dnl ${VERSION} to be determined at compile time.
265[if test x$enableval = xyes; then
266  fndir=${datadir}/${tzsh_name}/'${VERSION}'/functions
267else
268  fndir="$enableval"
269fi], [fndir=${datadir}/${tzsh_name}/'${VERSION}'/functions])
270
271ifdef([sitefndir],[undefine([sitefndir])])dnl
272AC_ARG_ENABLE(site-fndir,
273AC_HELP_STRING([--enable-site-fndir=DIR], [same for site functions (not version specific)]),
274[if test x$enableval = xyes; then
275  sitefndir=${datadir}/${tzsh_name}/site-functions
276else
277  sitefndir="$enableval"
278fi], [sitefndir=${datadir}/${tzsh_name}/site-functions])
279
280ifdef([function_subdirs],[undefine([function_subdirs])])
281AC_ARG_ENABLE(function-subdirs,
282AC_HELP_STRING([--enable-function-subdirs], [install functions in subdirectories]))
283
284if test "x${enable_function_subdirs}" != x &&
285  test "x${enable_function_subdirs}" != xno; then
286  FUNCTIONS_SUBDIRS=yes
287else
288  FUNCTIONS_SUBDIRS=no
289fi
290
291ifdef([additionalfpath],[undefine([additionalfpath])])dnl
292AC_ARG_ENABLE(additional-fpath,
293AC_HELP_STRING([--enable-additional-fpath=DIR], [add directories to default function path]),
294[if test x$enableval = xyes; then
295  additionalfpath=""
296else
297  additionalfpath="${enableval}"
298fi], [additionalfpath=""])
299
300AC_SUBST(additionalfpath)dnl
301AC_SUBST(fndir)dnl
302AC_SUBST(sitefndir)dnl
303AC_SUBST(FUNCTIONS_SUBDIRS)dnl
304
305dnl Directories for scripts such as newuser.
306
307ifdef([scriptdir],[undefine([scriptdir])])dnl
308AC_ARG_ENABLE(scriptdir,
309AC_HELP_STRING([--enable-scriptdir=DIR], [the directory in which to install scripts]),
310dnl ${VERSION} to be determined at compile time.
311[if test x$enableval = xyes; then
312  scriptdir=${datadir}/${tzsh_name}/'${VERSION}'/scripts
313else
314  scriptdir="$enableval"
315fi], [scriptdir=${datadir}/${tzsh_name}/'${VERSION}'/scripts])
316
317ifdef([sitescriptdir],[undefine([sitescriptdir])])dnl
318AC_ARG_ENABLE(site-scriptdir,
319AC_HELP_STRING([--enable-site-scriptdir=DIR], [same for site scripts (not version specific)]),
320[if test x$enableval = xyes; then
321  sitescriptdir=${datadir}/${tzsh_name}/scripts
322else
323  sitescriptdir="$enableval"
324fi], [sitescriptdir=${datadir}/${tzsh_name}/scripts])
325
326AC_SUBST(scriptdir)dnl
327AC_SUBST(sitescriptdir)dnl
328
329dnl htmldir is already handled, but if it wasn't set, use
330dnl the standard zsh default.
331if test x$htmldir = x'${docdir}' || test x$htmldir = x; then
332  htmldir='$(datadir)/$(tzsh)/htmldoc'
333fi
334
335AH_TEMPLATE([CUSTOM_PATCHLEVEL],
336[Define to a custom value for the ZSH_PATCHLEVEL parameter])
337AC_ARG_ENABLE(custom-patchlevel,
338AC_HELP_STRING([--enable-custom-patchlevel], [set a custom ZSH_PATCHLEVEL value]),
339[if test x$enableval != x && test x$enableval != xno; then
340  AC_DEFINE_UNQUOTED([CUSTOM_PATCHLEVEL], ["$enableval"])
341fi])
342
343dnl Do you want maildir support?
344ifdef([maildir_support],[undefine([maildir_support])])dnl
345AH_TEMPLATE([MAILDIR_SUPPORT],
346[Define for Maildir support])
347AC_ARG_ENABLE(maildir-support,
348AC_HELP_STRING([--enable-maildir-support], [enable maildir support in MAIL and MAILPATH]),
349[if test x$enableval = xyes; then
350  AC_DEFINE(MAILDIR_SUPPORT)
351fi])
352
353dnl Do you want to set a maximum function depth?
354ifdef([max_function_depth],[undefine([max_function_depth])])dnl
355AH_TEMPLATE([MAX_FUNCTION_DEPTH],
356[Define for function depth limits])
357AC_ARG_ENABLE(max-function-depth,
358AC_HELP_STRING([--enable-max-function-depth=MAX], [limit function depth to MAX, default 1000]),
359[if test x$enableval = xyes; then
360  AC_DEFINE(MAX_FUNCTION_DEPTH, 1000)
361elif test x$enableval != xno; then
362  AC_DEFINE_UNQUOTED(MAX_FUNCTION_DEPTH, $enableval)
363fi],
364[AC_DEFINE(MAX_FUNCTION_DEPTH, 1000)]
365)
366
367ifdef([default_readnullcmd],[undefine([default_readnullcmd])])dnl
368AH_TEMPLATE([DEFAULT_READNULLCMD],
369[Define default pager used by readnullcmd])
370AC_ARG_ENABLE(readnullcmd,
371AC_HELP_STRING([--enable-readnullcmd=PAGER], [pager used when READNULLCMD is not set]),
372[if test x$enableval = xyes; then
373  AC_DEFINE(DEFAULT_READNULLCMD,"more")
374elif test x$enableval != xno; then
375  AC_DEFINE_UNQUOTED(DEFAULT_READNULLCMD,"$enableval")
376fi],
377[AC_DEFINE(DEFAULT_READNULLCMD,"more")]
378)
379
380dnl Do you want to look for pcre support?
381AC_ARG_ENABLE(pcre,
382AC_HELP_STRING([--enable-pcre],
383[enable the search for the pcre library (may create run-time library dependencies)]))
384
385dnl Do you want to look for capability support?
386AC_ARG_ENABLE(cap,
387AC_HELP_STRING([--enable-cap],
388[enable the search for POSIX capabilities (may require additional headers to be added by hand)]))
389
390AC_ARG_ENABLE(gdbm,
391AC_HELP_STRING([--disable-gdbm], [turn off search for gdbm library]),
392[gdbm="$enableval"], [gdbm=yes])
393
394dnl ------------------
395dnl CHECK THE COMPILER
396dnl ------------------
397dnl We want these before the checks, so the checks can modify their values.
398test -z "${CFLAGS+set}"  && CFLAGS=  auto_cflags=1
399test -z "${LDFLAGS+set}" && LDFLAGS= auto_ldflags=1
400
401AC_PROG_CC
402
403dnl Check for large file support.
404
405dnl Gross hack for ReliantUNIX - GCC does not understand getconf options
406dnl For now just disable LFS in this case
407dnl Any takers?
408if test "$host" = mips-sni-sysv4 && test -n "$GCC"; then
409  : 
410else
411  AC_SYS_LARGEFILE
412fi
413
414dnl if the user hasn't specified CFLAGS, then
415dnl   if compiler is gcc, then use -O2 and some warning flags
416dnl   else use -O
417if test -n "$auto_cflags" && test ."$ansi2knr" != .yes; then
418  if test "${enable_zsh_debug}" = yes; then
419    if test -n "$GCC"; then
420      CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -ggdb"
421    else
422      CFLAGS="$CFLAGS -g"
423    fi
424  else
425    if test -n "$GCC"; then
426      CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -O2"
427    else
428      CFLAGS="$CFLAGS -O"
429    fi
430  fi
431fi
432if test -n "$auto_ldflags"; then
433  case "${enable_zsh_debug}$host_os" in
434    yesaix*|yeshpux*|yesnetbsd*|yesopenbsd*) ;;  # "ld -g" is not valid on these systems
435    darwin*) LDFLAGS=-Wl,-x ;;
436    yes*)    LDFLAGS=-g ;;
437    *)       LDFLAGS=-s ;;
438  esac
439fi
440
441dnl ----------
442dnl SCO KLUDGE
443dnl ----------
444dnl Sco doesn't define any useful compiler symbol,
445dnl so we will check for sco and define __sco if
446dnl found.
447case "$host_os" in
448  sco*) CFLAGS="-D__sco $CFLAGS" ;;
449esac
450
451sed=':1
452     s/ -s / /g
453     t1
454     s/^ *//
455     s/ *$//'
456
457case " $LDFLAGS " in
458  *" -s "*) strip_exeldflags=true strip_libldflags=true
459    LDFLAGS=`echo " $LDFLAGS " | sed "$sed"` ;;
460  *) strip_exeldflags=false strip_libldflags=false ;;
461esac
462
463case " ${EXELDFLAGS+$EXELDFLAGS }" in
464  " ") ;;
465  *" -s "*) strip_exeldflags=true
466    EXELDFLAGS=`echo " $EXELDFLAGS " | sed "$sed"` ;;
467  *) strip_exeldflags=false ;;
468esac
469
470case " ${LIBLDFLAGS+$LIBLDFLAGS }" in
471  " ") ;;
472  *" -s "*) strip_libldflags=true
473    LIBLDFLAGS=`echo " $LIBLDFLAGS " | sed "$sed"` ;;
474  *) strip_libldflags=false ;;
475esac
476
477AC_SUBST(CFLAGS)dnl
478AC_SUBST(LDFLAGS)dnl
479AC_SUBST(EXELDFLAGS)dnl
480AC_SUBST(LIBLDFLAGS)dnl
481
482AC_PROG_CPP                 dnl Figure out how to run C preprocessor.
483AC_PROG_GCC_TRADITIONAL     dnl Do we need -traditional flag for gcc.
484AC_C_CONST                  dnl Does compiler support `const'.
485
486dnl Default preprocessing on Mac OS X produces warnings
487dnl Mac OS X 10.6 (darwin10.x.x) does not need this.
488case "$host_os" in
489  darwin[[0-9]].*) CPP="$CPP -traditional-cpp" ;;
490esac
491
492fp_PROG_CC_STDC
493AC_MSG_CHECKING([whether to use prototypes])
494if test ."$ansi2knr" = .yes || test ."$ansi2knr" = .no; then
495  msg="(overridden) "
496else
497  msg=
498  if test ."$fp_cv_prog_cc_stdc" = .no; then
499    ansi2knr=yes
500  else
501    ansi2knr=no
502  fi
503fi
504AH_TEMPLATE([PROTOTYPES],
505[Define to 1 if ANSI function prototypes are usable.])
506if test "$ansi2knr" = yes; then
507  AC_MSG_RESULT(${msg}no)
508  U=_
509else
510  AC_MSG_RESULT(${msg}yes)
511  AC_DEFINE(PROTOTYPES)
512  U=
513fi
514AC_SUBST(U)
515
516AC_FUNC_ALLOCA              dnl Check how to get `alloca'.
517
518dnl If the compiler supports union initialisation
519AC_CACHE_CHECK(if the compiler supports union initialisation,
520zsh_cv_c_have_union_init,
521[AC_TRY_COMPILE([union{void *p;long l;}u={0};], [u.l=1;],
522  zsh_cv_c_have_union_init=yes,
523  zsh_cv_c_have_union_init=no)])
524AH_TEMPLATE([HAVE_UNION_INIT],
525[Define to 1 if the compiler can initialise a union.])
526if test x$zsh_cv_c_have_union_init = xyes; then
527  AC_DEFINE(HAVE_UNION_INIT)
528fi
529
530dnl  Checking if compiler correctly cast signed to unsigned.
531AC_CACHE_CHECK(if signed to unsigned casting is broken,
532zsh_cv_c_broken_signed_to_unsigned_casting,
533[AC_TRY_RUN([main(){return((int)(unsigned char)((char) -1) == 255);}],
534  zsh_cv_c_broken_signed_to_unsigned_casting=yes,
535  zsh_cv_c_broken_signed_to_unsigned_casting=no,
536  zsh_cv_c_broken_signed_to_unsigned_casting=no)])
537AH_TEMPLATE([BROKEN_SIGNED_TO_UNSIGNED_CASTING],
538[Define to 1 if compiler incorrectly cast signed to unsigned.])
539if test x$zsh_cv_c_broken_signed_to_unsigned_casting = xyes; then
540  AC_DEFINE(BROKEN_SIGNED_TO_UNSIGNED_CASTING)
541fi
542
543dnl Checking if the compiler supports variable-length arrays
544AC_CACHE_CHECK(if the compiler supports variable-length arrays,
545zsh_cv_c_variable_length_arrays,
546[AC_TRY_COMPILE([int foo(), n;], [int i[foo()], a[n+1];],
547  zsh_cv_c_variable_length_arrays=yes,
548  zsh_cv_c_variable_length_arrays=no)])
549AH_TEMPLATE([HAVE_VARIABLE_LENGTH_ARRAYS],
550[Define to 1 if compiler supports variable-length arrays])
551if test x$zsh_cv_c_variable_length_arrays = xyes; then
552  AC_DEFINE(HAVE_VARIABLE_LENGTH_ARRAYS)
553fi
554
555dnl ------------------
556dnl CHECK FOR PROGRAMS
557dnl ------------------
558AC_PROG_MAKE_SET            dnl Does make define $MAKE
559AC_PROG_INSTALL             dnl Check for BSD compatible `install'
560AC_PROG_AWK                 dnl Check for mawk,gawk,nawk, then awk.
561AC_PROG_LN                  dnl Check for working ln, for "make install"
562AC_PROG_EGREP               dnl sets $EGREP to grep -E or egrep
563AC_CHECK_PROGS([YODL], [yodl], [: yodl])
564
565YODL_OPTIONS=''
566if test "x$ac_cv_prog_YODL" = xyodl; then
567    case `yodl --version` in
568      *"version 2."*) YODL_OPTIONS='-k' ;;
569      *"version 3."*) YODL_OPTIONS='-k -L' ;;
570    esac
571fi
572AC_SUBST(YODL_OPTIONS)
573
574AC_CHECK_PROGS([PDFETEX], [pdfetex], [: pdfetex])
575AC_CHECK_PROGS([TEXI2PDF], [texi2pdf], [])
576AC_CHECK_PROGS([TEXI2HTML], [texi2html], [])
577AC_CHECK_PROGS([ANSI2KNR], [ansi2knr], [: ansi2knr])
578
579if test x"$ansi2knr" = xyes && test x"$ANSI2KNR" = x": ansi2knr"; then
580    echo "----------"
581    echo "configure fatal error:"
582    echo "ansi2knr was specified (--enable-ansi2knr) but the program could not be found."
583    echo "Either remove the configure option if it is not required or build the ansi2knr"
584    echo "program before reconfiguring Zsh.  The source code for ansi2knr is also"
585    echo "available in the GPL directory on Zsh distribution sites."
586    exit 1
587fi
588
589dnl ------------------
590dnl CHECK HEADER FILES
591dnl ------------------
592AC_HEADER_DIRENT
593AC_HEADER_STDC
594AC_HEADER_TIME
595AC_HEADER_STAT
596AC_HEADER_SYS_WAIT
597
598oldcflags="$CFLAGS"
599if test x$enable_pcre = xyes; then
600AC_CHECK_PROG([PCRECONF], pcre-config, pcre-config)
601dnl Typically (meaning on this single RedHat 9 box in front of me)
602dnl pcre-config --cflags produces a -I output which needs to go into
603dnl CPPFLAGS else configure's preprocessor tests don't pick it up,
604dnl producing a warning.
605if test "x$ac_cv_prog_PCRECONF" = xpcre-config; then
606  CPPFLAGS="$CPPFLAGS `pcre-config --cflags`"
607fi
608fi
609
610AC_CHECK_HEADERS(sys/time.h sys/times.h sys/select.h termcap.h termio.h \
611		 termios.h sys/param.h sys/filio.h string.h memory.h \
612		 limits.h fcntl.h libc.h sys/utsname.h sys/resource.h \
613		 locale.h errno.h stdio.h stdarg.h varargs.h stdlib.h \
614		 unistd.h sys/capability.h \
615		 utmp.h utmpx.h sys/types.h pwd.h grp.h poll.h sys/mman.h \
616		 netinet/in_systm.h pcre.h langinfo.h wchar.h stddef.h \
617		 sys/stropts.h iconv.h ncurses.h ncursesw/ncurses.h \
618		 ncurses/ncurses.h)
619if test x$dynamic = xyes; then
620  AC_CHECK_HEADERS(dlfcn.h)
621  AC_CHECK_HEADERS(dl.h)
622fi
623
624dnl Some SCO systems cannot include both sys/time.h and sys/select.h
625AH_TEMPLATE([TIME_H_SELECT_H_CONFLICTS],
626[Define if sys/time.h and sys/select.h cannot be both included.])
627if test x$ac_cv_header_sys_time_h = xyes && test x$ac_cv_header_sys_select_h = xyes; then
628  AC_CACHE_CHECK(for conflicts in sys/time.h and sys/select.h,
629  zsh_cv_header_time_h_select_h_conflicts,
630  [AC_TRY_COMPILE([#include <sys/time.h>
631#include <sys/select.h>], [int i;],
632  zsh_cv_header_time_h_select_h_conflicts=no,
633  zsh_cv_header_time_h_select_h_conflicts=yes)])
634  if test x$zsh_cv_header_time_h_select_h_conflicts = xyes; then
635    AC_DEFINE(TIME_H_SELECT_H_CONFLICTS)
636  fi
637fi
638
639AH_TEMPLATE([GWINSZ_IN_SYS_IOCTL],
640[Define if TIOCGWINSZ is defined in sys/ioctl.h but not in termios.h.])
641if test x$ac_cv_header_termios_h = xyes; then
642  AC_CACHE_CHECK(TIOCGWINSZ in termios.h,
643  zsh_cv_header_termios_h_tiocgwinsz,
644  [AC_TRY_LINK([
645#ifdef HAVE_SYS_TYPES_H
646# include <sys/types.h>
647#endif
648#include <termios.h>],
649  [int x = TIOCGWINSZ;],
650  zsh_cv_header_termios_h_tiocgwinsz=yes,
651  zsh_cv_header_termios_h_tiocgwinsz=no)])
652else
653  zsh_cv_header_termios_h_tiocgwinsz=no
654fi
655if test x$zsh_cv_header_termios_h_tiocgwinsz = xno; then
656  AC_CACHE_CHECK(TIOCGWINSZ in sys/ioctl.h,
657  zsh_cv_header_sys_ioctl_h_tiocgwinsz,
658  [AC_TRY_LINK([
659#ifdef HAVE_SYS_TYPES_H
660# include <sys/types.h>
661#endif
662#include <sys/ioctl.h>],
663  [int x = TIOCGWINSZ;],
664  zsh_cv_header_sys_ioctl_h_tiocgwinsz=yes,
665  zsh_cv_header_sys_ioctl_h_tiocgwinsz=no)])
666  if test x$zsh_cv_header_sys_ioctl_h_tiocgwinsz = xyes; then
667    AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
668  fi
669fi
670 
671AH_TEMPLATE([WINSIZE_IN_PTEM],
672[Define if your should include sys/stream.h and sys/ptem.h.])
673AC_CACHE_CHECK(for streams headers including struct winsize,
674ac_cv_winsize_in_ptem,
675[AC_TRY_COMPILE([#include <sys/stream.h>
676#include <sys/ptem.h>],
677[struct winsize wsz],
678ac_cv_winsize_in_ptem=yes,
679ac_cv_winsize_in_ptem=no)])
680if test x$ac_cv_winsize_in_ptem = xyes; then
681  AC_DEFINE(WINSIZE_IN_PTEM)
682fi
683
684dnl -------------------
685dnl CHECK FOR LIBRARIES
686dnl -------------------
687
688dnl On some systems, modules need to be linked against libc explicitly,
689dnl in case they require objects that exist only in the static version
690dnl and might not be compiled into the zsh executable.
691dnl On ReliantUNIX -lc better be the last library, else funny things
692dnl may happen.
693AC_CHECK_LIB(c, printf, [LIBS="$LIBS -lc"])
694
695AC_CHECK_LIB(m, pow)
696
697AC_CHECK_LIB(rt, clock_gettime)
698
699dnl Various features of ncurses depend on having the right header
700dnl (the system's own curses.h may well not be good enough).
701dnl So don't search for ncurses unless we found the header.
702if 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
703  ncursesw_test=ncursesw
704  ncurses_test=ncurses
705else
706  ncursesw_test=
707  ncurses_test=
708fi
709
710dnl Prefer BSD termcap library to SysV curses library, except on certain
711dnl SYSV-derived systems.  However, if we find terminfo and termcap
712dnl stuff in the same library we will use that; typically this
713dnl is ncurses or curses.
714dnl On pre-11.11 HPUX, Hcurses is reported to work better than curses.
715dnl Prefer ncurses to curses on all systems.  tinfo isn't very common now.
716AC_ARG_WITH(term-lib,
717AC_HELP_STRING([--with-term-lib=LIBS], [search space-separated LIBS for terminal handling]),
718[if test "x$withval" != xno && test "x$withval" != x ; then
719  termcap_curses_order="$withval"
720  AC_SEARCH_LIBS(tigetstr, [$termcap_curses_order])
721else
722  termcap_curses_order="$ncursesw_test tinfo termcap $ncurses_test curses"
723fi],
724[case "$host_os" in
725  solaris*)
726   termcap_curses_order="$ncursesw_test $ncurses_test curses termcap" ;;
727  hpux10.*|hpux11.*)
728   DL_EXT="${DL_EXT=sl}"
729   termcap_curses_order="Hcurses $ncursesw_test $ncurses_test curses termcap" ;;
730  *)
731   termcap_curses_order="$ncursesw_test tinfo termcap $ncurses_test curses" ;;
732esac])dnl
733
734AH_TEMPLATE([ZSH_NO_XOPEN],
735[Define if _XOPEN_SOURCE_EXTENDED should not be defined to avoid clashes])
736AC_CACHE_CHECK(if _XOPEN_SOURCE_EXTENDED should not be defined,
737zsh_cv_no_xopen,
738[[case "$host_os" in
739  *openbsd*|*freebsd5*|*freebsd6.[012]*|*aix*)
740  zsh_cv_no_xopen=yes
741  ;;
742  *)
743  zsh_cv_no_xopen=no
744  ;;
745esac]])
746if test x$zsh_cv_no_xopen = xyes; then
747  AC_DEFINE(ZSH_NO_XOPEN)
748fi
749
750dnl Check for tigetflag (terminfo) before tgetent (termcap).
751dnl That's so that on systems where termcap and [n]curses are
752dnl both available and both contain termcap functions, while
753dnl only [n]curses contains terminfo functions, we only link against
754dnl [n]curses.
755AC_SEARCH_LIBS(tigetflag, [$termcap_curses_order])
756AC_SEARCH_LIBS(tgetent, [$termcap_curses_order],
757  true,
758  AC_MSG_FAILURE(["No terminal handling library was found on your system.
759This is probably a library called 'curses' or 'ncurses'.  You may
760need to install a package called 'curses-devel' or 'ncurses-devel' on your
761system."], 255))
762AC_CHECK_HEADERS(curses.h, [],
763[AC_CACHE_CHECK(for Solaris 8 curses.h mistake, ac_cv_header_curses_solaris,
764AC_TRY_COMPILE([#include <curses.h>], [],
765[ac_cv_header_curses_h=yes
766ac_cv_header_curses_solaris=yes],
767ac_cv_header_curses_h=no
768ac_cv_header_curses_solaris=no))
769if test x$ac_cv_header_curses_solaris = xyes; then
770AC_DEFINE(HAVE_CURSES_H)
771fi])
772
773dnl If our terminal library is not ncurses, don't try including
774dnl any ncurses headers.
775AC_CACHE_CHECK(if we need to ignore ncurses, zsh_cv_ignore_ncurses,
776[case $LIBS in
777  *-lncurses*)
778  zsh_cv_ignore_ncurses=no
779  ;;
780  *)
781  zsh_cv_ignore_ncurses=yes
782  ;;
783esac])
784
785AC_SEARCH_LIBS(getpwnam, nsl)
786
787dnl I am told that told that unicos reqire these for nis_list
788if test `echo $host_os | sed 's/^\(unicos\).*/\1/'` = unicos; then
789  LIBS="-lcraylm -lkrb -lnisdb -lnsl -lrpcsvc $LIBS"
790fi
791
792if test "x$dynamic" = xyes; then
793  AC_CHECK_LIB(dl, dlopen)
794fi
795
796if test x$enable_cap = xyes; then
797  AC_CHECK_LIB(cap, cap_get_proc)
798fi
799
800AC_CHECK_LIB(socket, socket)
801AC_SEARCH_LIBS(gethostbyname2, bind)
802
803case $LIBS in
804  *-lbind*)
805  AC_CHECK_HEADERS(bind/netdb.h)
806  ;;
807esac
808
809dnl ---------------
810dnl CHECK FOR ICONV
811dnl ---------------
812
813dnl Find iconv. It may be in libiconv and may be iconv() or libiconv()
814if test "x$ac_cv_header_iconv_h" = "xyes"; then
815  AC_CHECK_FUNC(iconv, ac_found_iconv=yes, ac_found_iconv=no)
816  if test "x$ac_found_iconv" = "xno"; then
817    AC_CHECK_LIB(iconv, iconv, ac_found_iconv=yes)
818    if test "x$ac_found_iconv" = "xno"; then
819      AC_CHECK_LIB(iconv, libiconv, ac_found_iconv=yes)
820    fi
821    if test "x$ac_found_iconv" != "xno"; then
822      LIBS="-liconv $LIBS"
823    fi
824  else
825    dnl Handle case where there is a native iconv but iconv.h is from libiconv
826    AC_CHECK_DECL(_libiconv_version,
827      [ AC_CHECK_LIB(iconv, libiconv, LIBS="-liconv $LIBS") ],,
828      [ #include <iconv.h> ])
829  fi
830fi
831AH_TEMPLATE([ICONV_FROM_LIBICONV],
832[Define to 1 if iconv() is linked from libiconv])
833if test "x$ac_found_iconv" = xyes; then
834  AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
835  AC_TRY_LINK([#include <iconv.h>],
836    [int myversion = _libiconv_version],
837    AC_DEFINE(ICONV_FROM_LIBICONV), )
838fi
839
840dnl Check if iconv uses const in prototype declaration
841if test "x$ac_found_iconv" = "xyes"; then
842  AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
843    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
844        #include <iconv.h>]],
845        [[#ifdef __cplusplus
846          "C"
847          #endif
848          #if defined(__STDC__) || defined(__cplusplus)
849          size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
850          #else
851          size_t iconv();
852          #endif]])],
853      [ac_cv_iconv_const=],
854      [ac_cv_iconv_const=const])])
855  AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
856    [Define as const if the declaration of iconv() needs const.])
857fi
858
859if test x$enable_pcre = xyes; then
860dnl pcre-config should probably be employed here
861dnl AC_SEARCH_LIBS(pcre_compile, pcre)
862  LIBS="`pcre-config --libs` $LIBS"
863fi
864
865dnl ---------------------
866dnl CHECK TERMCAP LIBRARY
867dnl ---------------------
868dnl Checks for external variable ospeed in the termcap library.
869AC_CACHE_CHECK(if an include file defines ospeed,
870zsh_cv_decl_ospeed_include_defines,
871[AC_TRY_LINK(
872[#include <sys/types.h>
873#if HAVE_TERMIOS_H
874#include <termios.h>
875#endif
876#if HAVE_TERMCAP_H
877#include <termcap.h>
878#endif], [ospeed = 0;],
879zsh_cv_decl_ospeed_include_defines=yes,
880zsh_cv_decl_ospeed_include_defines=no)])
881
882if test x$zsh_cv_decl_ospeed_include_defines = xno; then
883  AC_CACHE_CHECK(if you must define ospeed,
884  zsh_cv_decl_ospeed_must_define,
885  [AC_TRY_LINK( ,[extern short ospeed; ospeed = 0;],
886  zsh_cv_decl_ospeed_must_define=yes,
887  zsh_cv_decl_ospeed_must_define=no)])
888fi
889
890AH_TEMPLATE([HAVE_OSPEED],
891[Define to 1 if your termcap library has the ospeed variable])
892AH_TEMPLATE([MUST_DEFINE_OSPEED],
893[Define to 1 if you have ospeed, but it is not defined in termcap.h])
894if test x$zsh_cv_decl_ospeed_include_defines = xyes; then
895  AC_DEFINE(HAVE_OSPEED)
896elif test x$zsh_cv_decl_ospeed_must_define = xyes; then
897  AC_DEFINE(HAVE_OSPEED)
898  AC_DEFINE(MUST_DEFINE_OSPEED)
899fi
900
901if test x$gdbm != xno; then
902  AC_CHECK_HEADERS(gdbm.h)
903  AC_CHECK_LIB(gdbm, gdbm_open)
904fi
905
906AC_CHECK_HEADERS(sys/xattr.h)
907
908dnl --------------
909dnl CHECK TYPEDEFS
910dnl --------------
911
912AC_TYPE_SIGNAL
913AC_TYPE_PID_T
914AC_TYPE_OFF_T
915AC_CHECK_TYPE(ino_t, unsigned long)
916AC_TYPE_MODE_T
917AC_TYPE_UID_T
918AC_TYPE_SIZE_T
919
920dnl ------------------------------------------------
921dnl Check size of long and try to find a 64-bit type
922dnl ------------------------------------------------
923dnl AC_CHECK_SIZEOF is no good, because we need the result here,
924dnl and that doesn't seem to define a shell parameter.
925AC_CACHE_CHECK(if long is 64 bits, zsh_cv_long_is_64_bit,
926[AC_TRY_RUN([int main() { return sizeof(long) < 8; }],
927zsh_cv_long_is_64_bit=yes,
928zsh_cv_long_is_64_bit=no,
929zsh_cv_long_is_64_bit=no)])
930
931AH_TEMPLATE([ino_t],
932[Define to `unsigned long' if <sys/types.h> doesn't define.])
933AH_TEMPLATE([LONG_IS_64_BIT],
934[Definitions used when a long is less than eight byte, to try to
935 provide some support for eight byte operations.
936
937 Note that ZSH_64_BIT_TYPE, OFF_T_IS_64_BIT, INO_T_IS_64_BIT do *not* get
938 defined if long is already 64 bits, since in that case no special handling
939 is required.
940
941 Define to 1 if long is 64 bits])
942AH_TEMPLATE([ZSH_64_BIT_TYPE],
943[Define to a 64 bit integer type if there is one, but long is shorter.])
944AH_TEMPLATE([ZSH_64_BIT_UTYPE],
945[Define to an unsigned variant of ZSH_64_BIT_TYPE if that is defined.])
946AH_TEMPLATE([OFF_T_IS_64_BIT],
947[Define to 1 if off_t is 64 bit (for large file support)])
948AH_TEMPLATE([INO_T_IS_64_BIT],
949[Define to 1 if ino_t is 64 bit (for large file support).])
950if test x$zsh_cv_long_is_64_bit = xyes; then
951  AC_DEFINE(LONG_IS_64_BIT)
952else
953  AC_CACHE_CHECK(if off_t is 64 bit, zsh_cv_off_t_is_64_bit,
954  [AC_TRY_RUN([
955#include <sys/types.h>
956
957main() { return sizeof(off_t) < 8; }
958],
959  zsh_cv_off_t_is_64_bit=yes,
960  zsh_cv_off_t_is_64_bit=no,
961  zsh_cv_off_t_is_64_bit=no)])
962  if test x$zsh_cv_off_t_is_64_bit = xyes; then
963    AC_DEFINE(OFF_T_IS_64_BIT)
964  fi
965
966  AC_CACHE_CHECK(if ino_t is 64 bit, zsh_cv_ino_t_is_64_bit,
967  [AC_TRY_RUN([
968#include <sys/types.h>
969
970main() { return sizeof(ino_t) < 8; }
971],
972  zsh_cv_ino_t_is_64_bit=yes,
973  zsh_cv_ino_t_is_64_bit=no,
974  zsh_cv_ino_t_is_64_bit=no)])
975  if test x$zsh_cv_ino_t_is_64_bit = xyes; then
976    AC_DEFINE(INO_T_IS_64_BIT)
977  fi
978
979  if test x$enable_largefile != xno -o x$zsh_cv_off_t_is_64_bit = xyes \
980  -o $zsh_cv_ino_t_is_64_bit = yes; then
981    AC_CACHE_CHECK(if compiler has a 64 bit type, zsh_cv_64_bit_type,
982    [zsh_64_BIT_TYPE(long long, zsh_cv_64_bit_type)
983     if test "$zsh_cv_64_bit_type" = no; then
984       zsh_64_BIT_TYPE(quad_t, zsh_cv_64_bit_type)
985     fi
986     if test "$zsh_cv_64_bit_type" = no; then
987       zsh_64_BIT_TYPE(__int64_t, zsh_cv_64_bit_type)
988     fi
989     dnl As a last resort, if we know off_t has 64 bits, use that as
990     dnl the 64-bit integer type.  I don't dare try ino_t since there's
991     dnl probably nothing to stop that being unsigned.
992     if test "$zsh_cv_64_bit_type" = no &&
993        test "$zsh_cv_off_t_is_64_bit" = yes; then
994       zsh_64_BIT_TYPE(off_t, zsh_cv_64_bit_type)
995     fi])
996    if test "$zsh_cv_64_bit_type" != no; then
997      AC_DEFINE_UNQUOTED(ZSH_64_BIT_TYPE, $zsh_cv_64_bit_type)
998
999      dnl Handle cases where unsigned type cannot be simply
1000      dnl `unsigned ZSH_64_BIT_TYPE'.  More tests may be required.
1001      AC_CACHE_CHECK(for a corresponding unsigned 64 bit type,
1002      zsh_cv_64_bit_utype,
1003      [zsh_64_BIT_TYPE(unsigned $zsh_cv_64_bit_type, zsh_cv_64_bit_utype,
1004       force)
1005       if test "$zsh_cv_64_bit_utype" = no; then
1006         zsh_64_BIT_TYPE(__uint64_t, zsh_cv_64_bit_utype)
1007       fi])
1008      if test "$zsh_cv_64_bit_utype" != no; then
1009        AC_DEFINE_UNQUOTED(ZSH_64_BIT_UTYPE, $zsh_cv_64_bit_utype)
1010      fi
1011    fi
1012  fi
1013fi
1014AH_TEMPLATE([ZLONG_IS_LONG_LONG],
1015[Define to 1 if the zlong type uses long long int.])
1016if test "$zsh_cv_64_bit_type" = "long long"; then
1017  dnl Remember this so we can get (s)printf output right.
1018  AC_DEFINE(ZLONG_IS_LONG_LONG)
1019fi
1020
1021dnl We'll blithely assume (f)printf supports the same types as sprintf.
1022AC_CACHE_CHECK(for %lld printf support, zsh_cv_printf_has_lld,
1023[AC_TRY_RUN(
1024[#include <stdio.h>
1025#include <string.h>
1026int main(int argc, char **argv)
1027{
1028   long long foo = ((long long)0xdead << 40) | 0xf00d;
1029   char buf[80];
1030   sprintf(buf, "before%lldafter", foo);
1031   if (!strcmp(buf, "before62677660341432333after")) {
1032      return 0;
1033   }
1034   return 1;
1035}
1036],
1037zsh_cv_printf_has_lld=yes,
1038zsh_cv_printf_has_lld=no,
1039zsh_cv_printf_has_lld=no)])
1040AH_TEMPLATE(PRINTF_HAS_LLD,
1041[Define to 1 if printf and sprintf support %lld for long long.])
1042if test x$zsh_cv_printf_has_lld = xyes; then
1043  AC_DEFINE(PRINTF_HAS_LLD)
1044fi
1045
1046dnl Check for sigset_t.  Currently I'm looking in
1047dnl <sys/types.h> and <signal.h>.  Others might need
1048dnl to be added.
1049AC_CACHE_CHECK(for sigset_t, zsh_cv_type_sigset_t,
1050[AC_TRY_COMPILE(
1051[#define _POSIX_C_SOURCE 200809L
1052#include <sys/types.h>
1053#include <signal.h>], [sigset_t tempsigset;],
1054  zsh_cv_type_sigset_t=yes, zsh_cv_type_sigset_t=no)])
1055AH_TEMPLATE([sigset_t],
1056[Define to `unsigned int' if <sys/types.h> or <signal.h> doesn't define])
1057if test x$zsh_cv_type_sigset_t = xno; then
1058  AC_DEFINE(sigset_t, unsigned int)
1059fi
1060
1061dnl check structures for high resolution timestamps
1062AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec,
1063                  struct stat.st_atimespec.tv_nsec,
1064                  struct stat.st_atimensec,
1065                  struct stat.st_mtim.tv_nsec,
1066                  struct stat.st_mtimespec.tv_nsec,
1067                  struct stat.st_mtimensec,
1068                  struct stat.st_ctim.tv_nsec,
1069                  struct stat.st_ctimespec.tv_nsec,
1070                  struct stat.st_ctimensec])
1071
1072dnl Check for struct timezone since some old SCO versions do not define it
1073zsh_TYPE_EXISTS([
1074#define _GNU_SOURCE 1
1075#ifdef HAVE_SYS_TIME_H
1076# include <sys/time.h>
1077#endif
1078], struct timezone)
1079
1080dnl Check for utmp structures, for watch
1081zsh_TYPE_EXISTS([
1082#ifdef HAVE_SYS_TYPES_H
1083# include <sys/types.h>
1084#endif
1085#ifdef HAVE_UTMP_H
1086# include <utmp.h>
1087#endif
1088], struct utmp)
1089zsh_TYPE_EXISTS([
1090#ifdef HAVE_SYS_TYPES_H
1091# include <sys/types.h>
1092#endif
1093#ifdef HAVE_UTMPX_H
1094# include <utmpx.h>
1095#endif
1096], struct utmpx)
1097
1098dnl Check contents of utmp structures
1099zsh_STRUCT_MEMBER([
1100#ifdef HAVE_SYS_TYPES_H
1101# include <sys/types.h>
1102#endif
1103#ifdef HAVE_UTMP_H
1104# include <utmp.h>
1105#endif
1106], struct utmp, ut_host)
1107zsh_STRUCT_MEMBER([
1108#ifdef HAVE_SYS_TYPES_H
1109# include <sys/types.h>
1110#endif
1111#ifdef HAVE_UTMPX_H
1112# include <utmpx.h>
1113#endif
1114], struct utmpx, ut_host)
1115zsh_STRUCT_MEMBER([
1116#ifdef HAVE_SYS_TYPES_H
1117# include <sys/types.h>
1118#endif
1119#ifdef HAVE_UTMPX_H
1120# include <utmpx.h>
1121#endif
1122], struct utmpx, ut_xtime)
1123zsh_STRUCT_MEMBER([
1124#ifdef HAVE_SYS_TYPES_H
1125# include <sys/types.h>
1126#endif
1127#ifdef HAVE_UTMPX_H
1128# include <utmpx.h>
1129#endif
1130], struct utmpx, ut_tv)
1131
1132dnl Check for inode numbers in directory entry structures
1133zsh_STRUCT_MEMBER([
1134#ifdef HAVE_SYS_TYPES_H
1135# include <sys/types.h>
1136#endif
1137#ifdef HAVE_DIRENT_H
1138# include <dirent.h>
1139#endif
1140], struct dirent, d_ino)
1141zsh_STRUCT_MEMBER([
1142#ifdef HAVE_SYS_TYPES_H
1143# include <sys/types.h>
1144#endif
1145#ifdef HAVE_DIRENT_H
1146# include <dirent.h>
1147#endif
1148], struct dirent, d_stat)
1149zsh_STRUCT_MEMBER([
1150#ifdef HAVE_SYS_TYPES_H
1151# include <sys/types.h>
1152#endif
1153#ifdef HAVE_SYS_NDIR_H
1154# include <sys/ndir.h>
1155#endif
1156#ifdef HAVE_SYS_DIR_H
1157# include <sys/dir.h>
1158#endif
1159#ifdef HAVE_NDIR_H
1160# include <ndir.h>
1161#endif
1162], struct direct, d_ino)
1163zsh_STRUCT_MEMBER([
1164#ifdef HAVE_SYS_TYPES_H
1165# include <sys/types.h>
1166#endif
1167#ifdef HAVE_SYS_NDIR_H
1168# include <sys/ndir.h>
1169#endif
1170#ifdef HAVE_SYS_DIR_H
1171# include <sys/dir.h>
1172#endif
1173#ifdef HAVE_NDIR_H
1174# include <ndir.h>
1175#endif
1176], struct direct, d_stat)
1177
1178dnl Check IPv6 socket address structure type
1179zsh_STRUCT_MEMBER([
1180#ifdef HAVE_SYS_TYPES_H
1181# include <sys/types.h>
1182#endif
1183#include <netinet/in.h>
1184], struct sockaddr_in6, sin6_scope_id)
1185
1186dnl Check for h_errno external variable
1187AH_TEMPLATE([USE_LOCAL_H_ERRNO],
1188[Define to 1 if h_errno is not defined by the system.])
1189AC_CACHE_CHECK(if we need our own h_errno,
1190  zsh_cv_decl_h_errno_use_local,
1191  [AC_TRY_LINK( ,[extern int h_errno; h_errno = 0;],
1192  zsh_cv_decl_h_errno_use_local=no,
1193  zsh_cv_decl_h_errno_use_local=yes)])
1194
1195if test x$zsh_cv_decl_h_errno_use_local = xyes; then
1196  AC_DEFINE(USE_LOCAL_H_ERRNO)
1197fi
1198
1199dnl ---------------
1200dnl CHECK FUNCTIONS
1201dnl ---------------
1202
1203dnl need to integrate this function
1204dnl AC_FUNC_STRFTIME
1205
1206AC_CHECK_FUNCS(strftime strptime mktime timelocal \
1207	       difftime gettimeofday clock_gettime \
1208	       select poll \
1209	       readlink faccessx fchdir ftruncate \
1210	       fstat lstat lchown fchown fchmod \
1211	       fseeko ftello \
1212	       mkfifo _mktemp mkstemp \
1213	       waitpid wait3 \
1214	       sigaction sigblock sighold sigrelse sigsetmask sigprocmask \
1215	       killpg setpgid setpgrp tcsetpgrp tcgetattr nice \
1216	       gethostname gethostbyname2 getipnodebyname \
1217	       inet_aton inet_pton inet_ntop \
1218	       getlogin getpwent getpwnam getpwuid getgrgid getgrnam \
1219	       initgroups nis_list \
1220	       setuid seteuid setreuid setresuid setsid \
1221	       memcpy memmove strstr strerror strtoul \
1222	       getrlimit getrusage \
1223	       setlocale \
1224	       uname \
1225	       signgam \
1226	       putenv getenv setenv unsetenv xw\
1227	       brk sbrk \
1228	       pathconf sysconf \
1229	       tgetent tigetflag tigetnum tigetstr setupterm initscr \
1230	       getcchar setcchar waddwstr wget_wch win_wch use_default_colors \
1231	       pcre_compile pcre_study pcre_exec \
1232	       nl_langinfo \
1233	       erand48 open_memstream \
1234	       wctomb iconv \
1235	       grantpt unlockpt ptsname \
1236	       htons ntohs \
1237	       regcomp regexec regerror regfree \
1238	       gdbm_open getxattr \
1239	       realpath canonicalize_file_name \
1240	       symlink getcwd)
1241AC_FUNC_STRCOLL
1242
1243if test x$enable_cap = xyes; then
1244  AC_CHECK_FUNCS(cap_get_proc)
1245fi
1246
1247dnl  Check if tgetent accepts NULL (and will allocate its own termcap buffer)
1248dnl  Some termcaps reportedly accept a zero buffer, but then dump core
1249dnl  in tgetstr().
1250dnl  Under Cygwin test program crashes but exit code is still 0. So,
1251dnl  we test for a file that porgram should create
1252AH_TEMPLATE([TGETENT_ACCEPTS_NULL],
1253[Define to 1 if tgetent() accepts NULL as a buffer.])
1254AC_CACHE_CHECK(if tgetent accepts NULL,
1255zsh_cv_func_tgetent_accepts_null,
1256[AC_TRY_RUN([
1257main()
1258{
1259    char buf[4096];
1260    int r1 = tgetent(buf, "vt100");
1261    int r2 = tgetent((char*)0,"vt100");
1262    if (r1 >= 0 && r1 == r2) {
1263        char tbuf[1024], *u;
1264        u = tbuf;
1265    	tgetstr("cl", &u);
1266	creat("conftest.tgetent", 0640);
1267    }
1268    exit((r1 != r2) || r2 == -1);
1269}
1270],
1271  if test -f conftest.tgetent; then
1272    zsh_cv_func_tgetent_accepts_null=yes
1273  else
1274    zsh_cv_func_tgetent_accepts_null=no
1275  fi,
1276  zsh_cv_func_tgetent_accepts_null=no,
1277  zsh_cv_func_tgetent_accepts_null=no)])
1278if test x$zsh_cv_func_tgetent_accepts_null = xyes; then
1279  AC_DEFINE(TGETENT_ACCEPTS_NULL)
1280fi
1281AC_CACHE_CHECK(if tgetent returns 0 on success,
1282zsh_cv_func_tgetent_zero_success,
1283[AC_TRY_RUN([
1284main()
1285{
1286    char buf[4096];
1287    int r1 = tgetent(buf, "!@#$%^&*");
1288    int r2 = tgetent(buf, "vt100");
1289    if (r1 < 0 && r2 == 0) {
1290        char tbuf[1024], *u;
1291        u = tbuf;
1292    	tgetstr("cl", &u);
1293	creat("conftest.tgetent0", 0640);
1294    }
1295    exit(r1 == r2);
1296}
1297],
1298  if test -f conftest.tgetent0; then
1299    zsh_cv_func_tgetent_zero_success=yes
1300  else
1301    zsh_cv_func_tgetent_zero_success=no
1302  fi,
1303  zsh_cv_func_tgetent_zero_success=no,
1304  zsh_cv_func_tgetent_zero_success=no)])
1305AH_TEMPLATE([TGETENT_SUCCESS],
1306[Define to what tgetent() returns on success (0 on HP-UX X/Open curses).])
1307if test x$zsh_cv_func_tgetent_zero_success = xyes; then
1308  AC_DEFINE(TGETENT_SUCCESS, 0)
1309else
1310  AC_DEFINE(TGETENT_SUCCESS, 1)
1311fi
1312
1313AC_FUNC_MMAP
1314if test x$ac_cv_func_mmap_fixed_mapped = xyes; then
1315  AC_CHECK_FUNCS(munmap msync)
1316fi
1317
1318if test x$ac_cv_func_setpgrp = xyes; then
1319  AC_FUNC_GETPGRP
1320else
1321  dnl If there is no setpgrp, the test for getpgrp(void) will fail
1322  dnl because the program will not compile.  However, in that case
1323  dnl we can be reasonably confident we are not dealing with a
1324  dnl Berkeleyesque system, so assume getpgrp does take void.
1325  ac_cv_func_getpgrp_void=yes
1326  AC_DEFINE(GETPGRP_VOID)
1327fi
1328
1329if test x$dynamic = xyes; then
1330  AC_CHECK_FUNCS(dlopen dlerror dlsym dlclose load loadquery loadbind unload \
1331		shl_load shl_unload shl_findsym)
1332fi
1333
1334AH_TEMPLATE([XATTR_EXTRA_ARGS],
1335Define if getxattr() etc. require additional MacOS-style arguments)
1336if test x$ac_cv_func_getxattr = xyes && test x$ac_cv_header_sys_xattr_h = xyes
1337then
1338  AC_CACHE_CHECK(if getxattr etc. are Linux-like,
1339  zsh_cv_getxattr_linux,
1340  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1341#include <sys/xattr.h>]],
1342  [[
1343  (void)listxattr("", 0, 0);
1344  (void)getxattr("", "", 0, 0);
1345  (void)setxattr("", "", "", 0, 0);
1346  (void)removexattr("", "");
1347  ]])],
1348  [zsh_cv_getxattr_linux=yes],
1349  [zsh_cv_getxattr_linux=no])])
1350
1351  if test x$zsh_cv_getxattr_linux != xyes; then
1352    AC_CACHE_CHECK(if getxattr etc. are MAC-like,
1353    zsh_cv_getxattr_mac,
1354    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1355#include <sys/xattr.h>]],
1356    [[(void)listxattr("", 0, 0, 0);
1357    (void)getxattr("", "", 0, 0, 0, 0);
1358    (void)setxattr("", "", "", 0, 0, 0);
1359    (void)removexattr("", "", 0);]])],
1360    [zsh_cv_getxattr_mac=yes],
1361    [zsh_cv_getxattr_mac=no])])
1362
1363    if test x$zsh_cv_getxattr_mac = xyes; then
1364      AC_DEFINE(XATTR_EXTRA_ARGS)
1365    fi
1366  fi
1367fi
1368
1369AC_CACHE_CHECK(if getxattr etc. are usable,
1370zsh_cv_use_xattr,
1371[if test x$zsh_cv_getxattr_linux = xyes || test x$zsh_cv_getxattr_mac = xyes
1372then
1373zsh_cv_use_xattr=yes
1374else
1375zsh_cv_use_xattr=no
1376fi])
1377
1378dnl -------------
1379dnl CHECK SIGNALS
1380dnl -------------
1381dnl What style of signal do you have (POSIX, BSD, or SYSV)?
1382AH_TEMPLATE([POSIX_SIGNALS],
1383[Define to 1 if you use POSIX style signal handling.])
1384AH_TEMPLATE([BSD_SIGNALS],
1385[Define to 1 if you use BSD style signal handling (and can block signals).])
1386AH_TEMPLATE([SYSV_SIGNALS],
1387[Define to 1 if you use SYS style signal handling (and can block signals).])
1388AH_TEMPLATE([NO_SIGNAL_BLOCKING],
1389[Define to 1 if you have no signal blocking at all (bummer).])
1390AC_MSG_CHECKING(what style of signals to use)
1391if test x$ac_cv_func_sigaction = xyes && test x$ac_cv_func_sigprocmask = xyes; then
1392  signals_style=POSIX_SIGNALS
1393  AC_DEFINE(POSIX_SIGNALS)
1394elif test x$ac_cv_func_sigblock = xyes && test x$ac_cv_func_sigsetmask = xyes; then
1395  signals_style=BSD_SIGNALS
1396  AC_DEFINE(BSD_SIGNALS)
1397elif test x$ac_cv_func_sighold = xyes && test x$ac_cv_func_sigrelse = xyes; then
1398  signals_style=SYSV_SIGNALS
1399  AC_DEFINE(SYSV_SIGNALS)
1400else
1401  signals_style=NO_SIGNAL_BLOCKING
1402  AC_DEFINE(NO_SIGNAL_BLOCKING)
1403fi
1404AC_DEFINE_UNQUOTED($signals_style)
1405AC_MSG_RESULT($signals_style)
1406
1407dnl Where is <signal.h> located?  Needed as input for signals.awk
1408AC_CACHE_CHECK(where signal.h is located, zsh_cv_path_signal_h,
1409[dnl Look at the output from the preprocessor.
1410dnl We should get lines of the form `# 1 "/usr/include/signal.h"'
1411dnl The following assumes the real definitions are in a file which
1412dnl contains the name `sig'; we could relax this if necessary,
1413dnl but then you can get a rather long list of files to test.
1414dnl The backslash substitution is to persuade cygwin to cough up
1415dnl slashes rather than doubled backslashes in the path.
1416echo "#include <signal.h>" > nametmp.c
1417sigfile_list="`$CPP $CPPFLAGS nametmp.c |
1418sed -n -e 's/^#line[ 	].*\"\(.*\)\"/\1/p' \
1419       -e 's/^#[ 	].*\"\(.*\)\"/\1/p' |
1420sed 's/\\\\\\\\/\//g' |
1421$AWK '{ if ($1 ~ /sig/) files[[$1]] = $1 }
1422  END { for (var in files) print var }'`"
1423rm -f nametmp.c
1424if test -z "$sigfile_list"; then
1425  dnl In case we don't get the stuff from the preprocesor, use the old
1426  dnl list of standard places.
1427  sigfile_list="/usr/include/sys/iso/signal_iso.h
1428/usr/include/bsd/sys/signal.h
1429/usr/include/signum.h
1430/usr/include/asm/signum.h
1431/usr/include/asm/signal.h
1432/usr/include/linux/signal.h
1433/usr/include/sys/signal.h
1434/usr/include/bits/signum.h
1435/dev/null"
1436fi
1437for SIGNAL_H in $sigfile_list
1438do
1439  dnl Try to make sure it doesn't get confused by files that don't
1440  dnl have real signal definitions in, but do #define SIG* by counting
1441  dnl the number of signals.  Maybe we could even check for e.g. SIGHUP?
1442  nsigs=`test -f $SIGNAL_H && \
1443  grep '#[ 	]*define[ 	][ 	]*SIG[0-9A-Z]*[ 	]*[0-9][0-9]*' $SIGNAL_H | \
1444  wc -l | sed 's/[ 	]//g'`
1445  test "x$nsigs" != x && test "$nsigs" -ge 7 && break
1446done
1447if test x$SIGNAL_H = x"/dev/null"; then
1448  AC_MSG_ERROR(SIGNAL MACROS NOT FOUND:  please report to developers)
1449fi
1450zsh_cv_path_signal_h=$SIGNAL_H
1451])
1452SIGNAL_H=$zsh_cv_path_signal_h
1453AC_SUBST(SIGNAL_H)dnl
1454
1455dnl Where are error names located?  Needed as input for errnames1.awk
1456AC_CACHE_CHECK(where error names are located, zsh_cv_path_errno_h,
1457[dnl Look at the output from the preprocessor.
1458dnl We should get lines of the form `# 1 "/usr/include/errno.h"'
1459dnl The following assumes the real definitions are in a file which
1460dnl contains the name `err'; we could relax this if necessary,
1461dnl but then you can get a rather long list of files to test.
1462dnl The backslash substitution is to persuade cygwin to cough up
1463dnl slashes rather than doubled backslashes in the path.
1464echo "#include <errno.h>" > nametmp.c
1465errfile_list="`$CPP $CPPFLAGS nametmp.c |
1466sed -n -e 's/^#line[ 	].*\"\(.*\)\"/\1/p' \
1467       -e 's/^#[ 	0-9].*\"\(.*\)\"/\1/p' |
1468sed 's/\\\\\\\\/\//g' |
1469$AWK '{ if ($1 ~ /err/) files[[$1]] = $1 }
1470  END { for (var in files) print var }'`"
1471rm -f nametmp.c
1472for ERRNO_TRY_H in $errfile_list /dev/null
1473do
1474  dnl Try to make sure it doesn't get confused by files that don't
1475  dnl have real error definitions in.  Count definitions to make sure.
1476  dnl Definitions of error numbers have become more and more general, so
1477  dnl make a list of files containing any definitions in and keep them all.
1478  dnl Careful with cut and paste in the pattern: the square brackets
1479  dnl must contain a space and a tab.
1480  nerrs=`test -f $ERRNO_TRY_H && \
1481  $EGREP '#[ 	]*define[ 	][ 	]*E[0-9A-Z]*[ 	]*(_HURD_ERRNO )?\(?[_A-Z0-9]' $ERRNO_TRY_H | \
1482  wc -l | sed 's/[ 	]//g'`
1483  if test "x$nerrs" != x && test "$nerrs" -ge 1
1484  then
1485    ERRNO_H="$ERRNO_H $ERRNO_TRY_H"
1486  fi
1487done
1488if test x"$ERRNO_H" = x; then
1489  AC_MSG_ERROR(ERROR MACROS NOT FOUND:  please report to developers)
1490fi
1491zsh_cv_path_errno_h="$ERRNO_H"
1492])
1493ERRNO_H="$zsh_cv_path_errno_h"
1494AC_SUBST(ERRNO_H)dnl
1495
1496AC_CACHE_CHECK(location of curses header, zsh_cv_path_curses_header,
1497[if test x$zsh_cv_ignore_ncurses = xyes; then
1498  if test x$ac_cv_header_curses_h = xyes; then
1499    zsh_cv_path_curses_header=curses.h
1500  else
1501    zsh_cv_path_curses_header=none
1502  fi
1503elif test x$ac_cv_header_ncursesw_ncurses_h = xyes; then
1504  zsh_cv_path_curses_header=ncursesw/ncurses.h
1505elif test x$ac_cv_header_ncurses_ncurses_h = xyes; then
1506  zsh_cv_path_curses_header=ncurses/ncurses.h
1507elif test x$ac_cv_header_ncurses_h = xyes; then
1508  zsh_cv_path_curses_header=ncurses.h
1509elif test x$ac_cv_header_curses_h = xyes; then
1510  zsh_cv_path_curses_header=curses.h
1511else
1512  zsh_cv_path_curses_header=none
1513fi])
1514AH_TEMPLATE([ZSH_HAVE_CURSES_H],
1515[Define to 1 if some variant of a curses header can be included])
1516if test x$zsh_cv_path_curses_header != xnone; then
1517  AC_DEFINE(ZSH_HAVE_CURSES_H)
1518  ZSH_CURSES_H=$zsh_cv_path_curses_header
1519else
1520  ZSH_CURSES_H=
1521fi
1522AC_SUBST(ZSH_CURSES_H)
1523
1524dnl Where are curses key definitions located?  Need for keypad() mode.
1525AC_CACHE_CHECK(where curses key definitions are located, zsh_cv_path_curses_keys_h,
1526[dnl This is an identical trick to errno.h, except we use ncurses.h
1527dnl if we can.
1528if test x$zsh_cv_path_curses_header = xnone; then
1529  echo >nametmp.c
1530else
1531  echo "#include <$zsh_cv_path_curses_header>" >nametmp.c
1532fi
1533
1534curses_list="`$CPP $CPPFLAGS nametmp.c |
1535sed -n -e 's/^#line[ 	].*\"\(.*\)\"/\1/p' \
1536       -e 's/^#[ 	0-9].*\"\(.*\)\"/\1/p' |
1537sed 's/\\\\\\\\/\//g' |
1538$AWK '{ if ($1 ~ /\.h/) files[[$1]] = $1 }
1539  END { for (var in files) print var }'`"
1540rm -f nametmp.c
1541for CURSES_TRY_H in $curses_list /dev/null
1542do
1543  nkeys=`test -f $CURSES_TRY_H && \
1544  $EGREP '#[ 	]*define[ 	][ 	]*KEY_' $CURSES_TRY_H | \
1545  wc -l | sed 's/[ 	]//g'`
1546  if test "x$nkeys" != x && test "$nkeys" -ge 10
1547  then
1548    CURSES_KEYS_H=$CURSES_TRY_H
1549    break
1550  fi
1551done
1552zsh_cv_path_curses_keys_h="$CURSES_KEYS_H"
1553])
1554CURSES_KEYS_H="$zsh_cv_path_curses_keys_h"
1555AC_SUBST(CURSES_KEYS_H)dnl
1556
1557dnl See if there are variants of term.h.  For testing each one
1558dnl we include the most likely variant of the curses header.
1559AC_CHECK_HEADERS(ncursesw/term.h,
1560true, true,
1561[#include <ncursesw/ncurses.h>])
1562AC_CHECK_HEADERS(ncurses/term.h,
1563true, true,
1564[#include <ncurses/ncurses.h>])
1565AC_CHECK_HEADERS(term.h,
1566true, true,
1567[#include <curses.h>])
1568
1569dnl See if term.h is bundled along with the curses library we
1570dnl are using.  If this isn't the default system curses, compilation
1571dnl could barf unless we include from the right subdirectory.
1572AC_CACHE_CHECK(where term.h is located, zsh_cv_path_term_header,
1573[case x$zsh_cv_path_curses_header in
1574  xncursesw/*)
1575  if test x$ac_cv_header_ncursesw_term_h = xyes; then
1576    zsh_cv_path_term_header=ncursesw/term.h
1577  fi
1578  ;;
1579  xncurses/*)
1580  if test x$ac_cv_header_ncurses_term_h = xyes; then
1581    zsh_cv_path_term_header=ncurses/term.h
1582  fi
1583  ;;
1584esac
1585if test x$zsh_cv_path_term_header = x; then
1586  if test x$ac_cv_header_term_h = xyes; then
1587    zsh_cv_path_term_header=term.h
1588  else
1589    zsh_cv_path_term_header=none
1590  fi
1591fi])
1592
1593AH_TEMPLATE([ZSH_HAVE_TERM_H],
1594[Define to 1 if some variant of term.h can be included])
1595AH_TEMPLATE([HAVE_BOOLCODES],
1596[Define if you have the termcap boolcodes symbol.])
1597AH_TEMPLATE([HAVE_NUMCODES],
1598[Define if you have the termcap numcodes symbol.])
1599AH_TEMPLATE([HAVE_STRCODES],
1600[Define if you have the termcap strcodes symbol.])
1601AH_TEMPLATE([HAVE_BOOLNAMES],
1602[Define if you have the terminfo boolnames symbol.])
1603AH_TEMPLATE([HAVE_NUMNAMES],
1604[Define if you have the terminfo numnames symbol.])
1605AH_TEMPLATE([HAVE_STRNAMES],
1606[Define if you have the terminfo strnames symbol.])
1607AH_TEMPLATE([TGOTO_PROTO_MISSING],
1608[Define if there is no prototype for the tgoto() terminal function.])
1609
1610if test x$zsh_cv_path_term_header != xnone; then
1611  AC_DEFINE(ZSH_HAVE_TERM_H)
1612  ZSH_TERM_H=$zsh_cv_path_term_header
1613  if test x$zsh_cv_path_curses_header != xnone; then
1614    term_includes="#include <$zsh_cv_path_curses_header>
1615#include <$zsh_cv_path_term_header>"
1616  else
1617    term_includes="#include <$zsh_cv_path_term_header>"
1618  fi
1619
1620  AC_MSG_CHECKING(if boolcodes is available)
1621  AC_TRY_LINK($term_includes, [char **test = boolcodes; puts(*test);],
1622  AC_DEFINE(HAVE_BOOLCODES) boolcodes=yes, boolcodes=no)
1623  AC_MSG_RESULT($boolcodes)
1624
1625  AC_MSG_CHECKING(if numcodes is available)
1626  AC_TRY_LINK($term_includes, [char **test = numcodes; puts(*test);],
1627  AC_DEFINE(HAVE_NUMCODES) numcodes=yes, numcodes=no)
1628  AC_MSG_RESULT($numcodes)
1629
1630  AC_MSG_CHECKING(if strcodes is available)
1631  AC_TRY_LINK($term_includes, [char **test = strcodes; puts(*test);],
1632  AC_DEFINE(HAVE_STRCODES) strcodes=yes, strcodes=no)
1633  AC_MSG_RESULT($strcodes)
1634
1635  AC_MSG_CHECKING(if boolnames is available)
1636  AC_TRY_LINK($term_includes, [char **test = boolnames; puts(*test);],
1637  AC_DEFINE(HAVE_BOOLNAMES) boolnames=yes, boolnames=no)
1638  AC_MSG_RESULT($boolnames)
1639
1640  AC_MSG_CHECKING(if numnames is available)
1641  AC_TRY_LINK($term_includes, [char **test = numnames; puts(*test);],
1642  AC_DEFINE(HAVE_NUMNAMES) numnames=yes, numnames=no)
1643  AC_MSG_RESULT($numnames)
1644
1645  AC_MSG_CHECKING(if strnames is available)
1646  AC_TRY_LINK($term_includes, [char **test = strnames; puts(*test);],
1647  AC_DEFINE(HAVE_STRNAMES) strnames=yes, strnames=no)
1648  AC_MSG_RESULT($strnames)
1649
1650  dnl There are apparently defective terminal library headers on some
1651  dnl versions of Solaris before 11.
1652  AC_MSG_CHECKING(if tgoto prototype is missing)
1653  tgoto_includes="$term_includes
1654/* guaranteed to clash with any valid tgoto prototype */
1655extern void tgoto(int **stuff, float **more_stuff);"
1656  AC_TRY_LINK($tgoto_includes,
1657  [int *stuff; float *more_stuff; tgoto(&stuff, &more_stuff);],
1658  AC_DEFINE(TGOTO_PROTO_MISSING) tgotoprotomissing=yes, tgotoprotomissing=no)
1659  AC_MSG_RESULT($tgotoprotomissing)
1660else
1661  ZSH_TERM_H=
1662fi
1663AC_SUBST(ZSH_TERM_H)
1664
1665
1666dnl -----------------------------------------------------
1667dnl Look for the file containing the RLIMIT_* definitions
1668dnl -----------------------------------------------------
1669dnl CALL FOR MORE (FEWER?) LOCATIONS:  I've just copied the signal checking.
1670AC_CACHE_CHECK(where the RLIMIT macros are located,zsh_cv_path_rlimit_h,
1671[dnl Look at the output from the preprocessor.
1672dnl Copied from the search for the signal names above.
1673echo "#include <sys/resource.h>" >restmp.c
1674resourcefile_list="`$CPP $CPPFLAGS restmp.c |
1675sed -n -e 's/^#line[ 	].*\"\(.*\)\"/\1/p' \
1676       -e 's/^#[ 	].*\"\(.*\)\"/\1/p' |
1677sed 's/\\\\\\\\/\//g' |
1678$AWK '{ if ($1 ~ /resource/) files[[$1]] = $1 }
1679  END { for (var in files) print var }'`"
1680rm -f restmp.c
1681if test -z "$resourcefile_list"; then
1682  dnl No list: look at standard places.
1683  resourcefile_list="/usr/include/bsd/sys/resource.h
1684/usr/include/asm/resource.h
1685/usr/include/linux/resource.h
1686/usr/include/sys/resource.h
1687/usr/include/bits/resource.h
1688/usr/include/resourcebits.h"
1689fi
1690for RESOURCE_H in $resourcefile_list /dev/null;
1691do
1692  test -f $RESOURCE_H && \
1693  grep '#[ 	]*define[ 	][ 	]*RLIMIT_[A-Z]*[ 	]*[0-9A-Z][0-9]*' $RESOURCE_H > /dev/null && \
1694  break
1695done
1696zsh_cv_path_rlimit_h=$RESOURCE_H
1697if test x$RESOURCE_H = x"/dev/null" && test x$ac_cv_func_getrlimit = xyes; then
1698  AC_MSG_WARN(RLIMIT MACROS NOT FOUND:  please report to developers)
1699fi])
1700RLIMITS_INC_H=$zsh_cv_path_rlimit_h
1701if test "$RLIMITS_INC_H" = "/dev/null"; then
1702  RLIMITS_INC_H=''
1703fi
1704dnl rlimits.h only appears in dependencies if we are actually using it.
1705dnl We are using it any time we have getrlimit, though if the macros were
1706dnl not found we simply awk through /dev/null and fail to find them.
1707dnl Thus, limit won't work, but at least the shell will compile.
1708AC_SUBST(RLIMITS_INC_H)dnl
1709
1710dnl ------------------
1711dnl rlimit type checks
1712dnl ------------------
1713AH_TEMPLATE([RLIM_T_IS_QUAD_T],
1714[Define to 1 if struct rlimit uses quad_t.])
1715AH_TEMPLATE([RLIM_T_IS_LONG_LONG],
1716[Define to 1 if struct rlimit uses long long])
1717AH_TEMPLATE([RLIM_T_IS_UNSIGNED],
1718[Define to 1 if struct rlimit uses unsigned.])
1719AH_TEMPLATE([rlim_t],
1720[Define to the type used in struct rlimit.])
1721DEFAULT_RLIM_T=long
1722AC_CACHE_CHECK(if rlim_t is longer than a long,
1723zsh_cv_rlim_t_is_longer,
1724[AC_TRY_RUN([
1725#ifdef HAVE_SYS_TIME_H
1726#include <sys/time.h>
1727#endif
1728#include <sys/resource.h>
1729main(){struct rlimit r;exit(sizeof(r.rlim_cur) <= sizeof(long));}],
1730zsh_cv_rlim_t_is_longer=yes,
1731zsh_cv_rlim_t_is_longer=no,
1732zsh_cv_rlim_t_is_longer=yes)])
1733if test x$zsh_cv_rlim_t_is_longer = xyes; then
1734  AC_CACHE_CHECK(if rlim_t is a quad,
1735  zsh_cv_rlim_t_is_quad_t,
1736  [AC_TRY_RUN([
1737#ifdef HAVE_SYS_TIME_H
1738#include <sys/time.h>
1739#endif
1740#include <stdio.h>
1741#include <sys/resource.h>
1742main() { 
1743  struct rlimit r;
1744  char buf[20];
1745  r.rlim_cur = 0;
1746  sprintf(buf, "%qd", r.rlim_cur);
1747  exit(strcmp(buf, "0"));
1748}],
1749  zsh_cv_rlim_t_is_quad_t=yes,
1750  zsh_cv_rlim_t_is_quad_t=no,
1751  zsh_cv_rlim_t_is_quad_t=no)])
1752  if test x$zsh_cv_rlim_t_is_quad_t = xyes; then
1753    AC_DEFINE(RLIM_T_IS_QUAD_T)
1754    DEFAULT_RLIM_T=quad_t
1755  else
1756    AC_DEFINE(RLIM_T_IS_LONG_LONG)
1757    DEFAULT_RLIM_T='long long'
1758  fi
1759else
1760  AC_CACHE_CHECK(if the rlim_t is unsigned,
1761  zsh_cv_type_rlim_t_is_unsigned,
1762  [AC_TRY_RUN([
1763#ifdef HAVE_SYS_TIME_H
1764#include <sys/time.h>
1765#endif
1766#include <sys/resource.h>
1767  main(){struct rlimit r;r.rlim_cur=-1;exit(r.rlim_cur<0);}],
1768  zsh_cv_type_rlim_t_is_unsigned=yes,
1769  zsh_cv_type_rlim_t_is_unsigned=no,
1770  zsh_cv_type_rlim_t_is_unsigned=no)])
1771  if test x$zsh_cv_type_rlim_t_is_unsigned = xyes; then
1772    AC_DEFINE(RLIM_T_IS_UNSIGNED)
1773    DEFAULT_RLIM_T="unsigned $DEFAULT_RLIM_T"
1774  fi
1775fi
1776
1777AC_CACHE_CHECK(for rlim_t, zsh_cv_type_rlim_t,
1778[AC_TRY_COMPILE([
1779#include <sys/types.h>
1780#ifdef HAVE_SYS_TIME_H
1781#include <sys/time.h>
1782#endif
1783#include <sys/resource.h>],
1784[rlim_t l;],
1785zsh_cv_type_rlim_t=yes,
1786zsh_cv_type_rlim_t=no)])
1787if test x$zsh_cv_type_rlim_t = xno; then
1788  AC_DEFINE_UNQUOTED(rlim_t, $DEFAULT_RLIM_T)
1789fi
1790
1791
1792dnl On some systems the RLIMIT_* don't evaluate to integers at compile time
1793dnl (they may be enums).  In this case we are not able to do preprocessor
1794dnl comparisons and need our tests to determine what values exist and
1795dnl if there are clashing definitions.
1796
1797zsh_LIMIT_PRESENT(RLIMIT_AIO_MEM)
1798zsh_LIMIT_PRESENT(RLIMIT_AIO_OPS)
1799zsh_LIMIT_PRESENT(RLIMIT_AS)
1800zsh_LIMIT_PRESENT(RLIMIT_LOCKS)
1801zsh_LIMIT_PRESENT(RLIMIT_MEMLOCK)
1802zsh_LIMIT_PRESENT(RLIMIT_NPROC)
1803zsh_LIMIT_PRESENT(RLIMIT_NTHR)
1804zsh_LIMIT_PRESENT(RLIMIT_NOFILE)
1805zsh_LIMIT_PRESENT(RLIMIT_PTHREAD)
1806zsh_LIMIT_PRESENT(RLIMIT_RSS)
1807zsh_LIMIT_PRESENT(RLIMIT_SBSIZE)
1808zsh_LIMIT_PRESENT(RLIMIT_TCACHE)
1809zsh_LIMIT_PRESENT(RLIMIT_VMEM)
1810zsh_LIMIT_PRESENT(RLIMIT_SIGPENDING)
1811zsh_LIMIT_PRESENT(RLIMIT_MSGQUEUE)
1812zsh_LIMIT_PRESENT(RLIMIT_NICE)
1813zsh_LIMIT_PRESENT(RLIMIT_RTPRIO)
1814
1815AH_TEMPLATE([RLIMIT_VMEM_IS_RSS],
1816[Define to 1 if RLIMIT_VMEM and RLIMIT_RSS both exist and are equal.])
1817AC_CACHE_CHECK(if RLIMIT_VMEM and RLIMIT_RSS are the same,
1818zsh_cv_rlimit_vmem_is_rss,
1819[AC_TRY_RUN([
1820#include <sys/types.h>
1821#ifdef HAVE_SYS_TIME_H
1822#include <sys/time.h>
1823#endif
1824#include <sys/resource.h>
1825int main()
1826{
1827int ret = 1;
1828#if defined(HAVE_RLIMIT_VMEM) && defined(HAVE_RLIMIT_RSS)
1829if (RLIMIT_RSS == RLIMIT_VMEM) ret = 0;
1830#endif
1831return ret;
1832}],
1833  zsh_cv_rlimit_vmem_is_rss=yes,
1834  zsh_cv_rlimit_vmem_is_rss=no,
1835  zsh_cv_rlimit_vmem_is_rss=no)])
1836
1837if test x$zsh_cv_rlimit_vmem_is_rss = xyes; then
1838  AC_DEFINE(RLIMIT_VMEM_IS_RSS)
1839fi
1840
1841
1842AH_TEMPLATE([RLIMIT_VMEM_IS_AS],
1843[Define to 1 if RLIMIT_VMEM and RLIMIT_AS both exist and are equal.])
1844AC_CACHE_CHECK(if RLIMIT_VMEM and RLIMIT_AS are the same,
1845zsh_cv_rlimit_vmem_is_as,
1846[AC_TRY_RUN([
1847#include <sys/types.h>
1848#ifdef HAVE_SYS_TIME_H
1849#include <sys/time.h>
1850#endif
1851#include <sys/resource.h>
1852int main()
1853{
1854int ret = 1;
1855#if defined(HAVE_RLIMIT_VMEM) && defined(HAVE_RLIMIT_AS)
1856if (RLIMIT_AS == RLIMIT_VMEM) ret = 0;
1857#endif
1858return ret;
1859}],
1860  zsh_cv_rlimit_vmem_is_as=yes,
1861  zsh_cv_rlimit_vmem_is_as=no,
1862  zsh_cv_rlimit_vmem_is_as=no)])
1863
1864if test x$zsh_cv_rlimit_vmem_is_as = xyes; then
1865  AC_DEFINE(RLIMIT_VMEM_IS_AS)
1866fi
1867
1868
1869AH_TEMPLATE([RLIMIT_RSS_IS_AS],
1870[Define to 1 if RLIMIT_RSS and RLIMIT_AS both exist and are equal.])
1871AC_CACHE_CHECK(if RLIMIT_RSS and RLIMIT_AS are the same,
1872zsh_cv_rlimit_rss_is_as,
1873[AC_TRY_RUN([
1874#include <sys/types.h>
1875#ifdef HAVE_SYS_TIME_H
1876#include <sys/time.h>
1877#endif
1878#include <sys/resource.h>
1879int main()
1880{
1881int ret = 1;
1882#if defined(HAVE_RLIMIT_RSS) && defined(HAVE_RLIMIT_AS)
1883if (RLIMIT_AS == RLIMIT_RSS) ret = 0;
1884#endif
1885return ret;
1886}],
1887  zsh_cv_rlimit_rss_is_as=yes,
1888  zsh_cv_rlimit_rss_is_as=no,
1889  zsh_cv_rlimit_rss_is_as=no)])
1890
1891if test x$zsh_cv_rlimit_rss_is_as = xyes; then
1892  AC_DEFINE(RLIMIT_RSS_IS_AS)
1893fi
1894
1895
1896dnl --------------------------------------------
1897dnl Check for members of struct rusage
1898dnl --------------------------------------------
1899if test x$ac_cv_func_getrusage = xyes; then
1900  AC_CHECK_MEMBERS([struct rusage.ru_maxrss,
1901		    struct rusage.ru_ixrss,
1902		    struct rusage.ru_idrss,
1903		    struct rusage.ru_isrss,
1904		    struct rusage.ru_minflt,
1905		    struct rusage.ru_majflt,
1906		    struct rusage.ru_nswap,
1907		    struct rusage.ru_inblock,
1908		    struct rusage.ru_oublock,
1909		    struct rusage.ru_msgsnd,
1910		    struct rusage.ru_msgrcv,
1911		    struct rusage.ru_nsignals,
1912		    struct rusage.ru_nvcsw,
1913		    struct rusage.ru_nivcsw],,,
1914[#include <sys/types.h>
1915#ifdef HAVE_SYS_TIME_H
1916#include <sys/time.h>
1917#endif
1918#include <sys/resource.h>])
1919fi
1920
1921
1922dnl --------------------------------------------
1923dnl CHECK FOR DEFAULT PATH (used for command -p)
1924dnl --------------------------------------------
1925AC_CACHE_VAL(zsh_cv_cs_path,
1926[if getconf _CS_PATH >/dev/null 2>&1; then
1927  zsh_cv_cs_path=`getconf _CS_PATH`
1928elif getconf CS_PATH >/dev/null 2>&1; then
1929  zsh_cv_cs_path=`getconf CS_PATH`
1930else
1931  zsh_cv_cs_path="/bin:/usr/bin"
1932fi])
1933AC_DEFINE_UNQUOTED(DEFAULT_PATH, "$zsh_cv_cs_path",
1934[The default path; used when running commands with command -p])
1935
1936
1937dnl ----------------------------
1938dnl CHECK FOR /dev/fd FILESYSTEM
1939dnl ----------------------------
1940dnl FreeBSD 5 only supports /dev/fd/0 to /dev/fd/2 without mounting
1941dnl a special file system.  As zsh needs arbitrary /dev/fd (typically
1942dnl >10) for its own use, we need to make sure higher fd's are available.
1943dnl Since we're using the shell, we're restricted to 0 to 9 but 3 should
1944dnl be good enough.
1945AH_TEMPLATE([PATH_DEV_FD],
1946[Define to the path of the /dev/fd filesystem.])
1947AC_CACHE_CHECK(for /dev/fd filesystem, zsh_cv_sys_path_dev_fd,
1948[if test "$host_os" = cygwin; then
1949dnl In current (2008/12/01) versions of Cygwin these are present but don't
1950dnl seem to work smoothly for process substitution; no great surprise
1951dnl since getting processes to work at all on Cygwin is a big challenge.
1952dnl We'll rely on FIFOs, since they do what we need.
1953zsh_cv_sys_path_dev_fd=no
1954else
1955[for zsh_cv_sys_path_dev_fd in /proc/self/fd /dev/fd no; do
1956   test x`echo ok|(exec 3<&0; cat $zsh_cv_sys_path_dev_fd/3 2>/dev/null;)` = xok && break
1957 done]
1958fi])
1959if test x$zsh_cv_sys_path_dev_fd != xno; then
1960  AC_DEFINE_UNQUOTED(PATH_DEV_FD, "$zsh_cv_sys_path_dev_fd")
1961fi
1962
1963dnl ---------------------------------
1964dnl CHECK FOR RFS SUPERROOT DIRECTORY
1965dnl ---------------------------------
1966AC_CACHE_CHECK(for RFS superroot directory, zsh_cv_sys_superroot,
1967[test -d /../.LOCALROOT && zsh_cv_sys_superroot=yes || zsh_cv_sys_superroot=no])
1968AH_TEMPLATE([HAVE_SUPERROOT],
1969[Define to 1 if you have RFS superroot directory.])
1970if test x$zsh_cv_sys_superroot = xyes; then
1971  AC_DEFINE(HAVE_SUPERROOT)
1972fi
1973
1974dnl CHECK FOR SYSTEMS REQUIRING GETCWD
1975AC_CACHE_CHECK(whether we should use the native getcwd,
1976zsh_cv_use_getcwd,
1977[case "${host_cpu}-${host_vendor}-${host_os}" in
1978    *QNX*) zsh_cv_use_getcwd=yes ;;
1979    *) zsh_cv_use_getcwd=no ;;
1980 esac])
1981AH_TEMPLATE([USE_GETCWD],
1982[Define to 1 if you need to use the native getcwd.])
1983if test x$zsh_cv_use_getcwd = xyes; then
1984  AC_DEFINE(USE_GETCWD)
1985fi
1986
1987dnl GNU getcwd() can allocate as much space as necessary for a
1988dnl directory name, preventing guessing games.
1989AH_TEMPLATE([GETCWD_CALLS_MALLOC],
1990[Define to 1 if getcwd() calls malloc to allocate memory.])
1991if test x$ac_cv_func_getcwd = xyes; then
1992  AC_CACHE_CHECK(whether getcwd calls malloc to allocate memory,
1993  zsh_cv_getcwd_malloc,
1994  [AC_TRY_RUN([
1995#include <unistd.h>
1996#include <string.h>
1997int main() {
1998    char buf[1024], *ptr1, *ptr2;
1999    ptr1 = getcwd(buf, 1024);
2000    ptr2 = getcwd(NULL, 0);
2001    if (ptr1 && ptr2 && !strcmp(ptr1, ptr2)) {
2002      return 0;
2003    }
2004    return 1;
2005}
2006],
2007  zsh_cv_getcwd_malloc=yes,
2008  zsh_cv_getcwd_malloc=no,
2009  zsh_cv_getcwd_malloc=no)])
2010  if test x$zsh_cv_getcwd_malloc = xyes; then
2011    AC_DEFINE(GETCWD_CALLS_MALLOC)
2012  fi
2013fi
2014
2015dnl CHECK FOR setproctitle() FOR jobs -Z / ARGV0
2016AH_TEMPLATE([HAVE_SETPROCTITLE],
2017[Define to 1 if the system supports `setproctitle' to change process name])
2018AC_CHECK_FUNC(setproctitle,AC_DEFINE(HAVE_SETPROCTITLE),
2019AC_SEARCH_LIBS(setproctitle,util,AC_DEFINE(HAVE_SETPROCTITLE)))
2020
2021dnl -------------
2022dnl CHECK FOR NIS
2023dnl -------------
2024AH_TEMPLATE([HAVE_NIS],
2025[Define to 1 if you have NIS.])
2026AC_CACHE_CHECK(for NIS, zsh_cv_sys_nis,
2027[test -f /usr/bin/ypcat && /usr/bin/ypcat passwd.byname > /dev/null 2>&1 && \
2028zsh_cv_sys_nis=yes || zsh_cv_sys_nis=no])
2029if test x$zsh_cv_sys_nis = xyes; then
2030  AC_DEFINE(HAVE_NIS)
2031dnl Some systems (Solaris 2.x, Linux Redhat 5.x) require
2032dnl libnsl (Network Services Library) to find yp_all
2033  AC_SEARCH_LIBS(yp_all, nsl)
2034fi
2035
2036dnl -----------------
2037dnl CHECK FOR NISPLUS
2038dnl -----------------
2039AH_TEMPLATE([HAVE_NIS_PLUS],
2040[Define to 1 if you have NISPLUS.])
2041AC_CACHE_CHECK(for NIS+, zsh_cv_sys_nis_plus,
2042[test x$ac_cv_func_nis_list = xyes && test -f /usr/bin/nisls && \
2043 /usr/bin/nisls > /dev/null 2>&1 && \
2044zsh_cv_sys_nis_plus=yes || zsh_cv_sys_nis_plus=no])
2045if test x$zsh_cv_sys_nis_plus = xyes; then
2046  AC_DEFINE(HAVE_NIS_PLUS)
2047fi
2048
2049dnl ----------------------------------------
2050dnl CHECK FOR LOCATION OF {U,W}TMP{,X} FILES
2051dnl ----------------------------------------
2052zsh_PATH_UTMP(utmp)
2053zsh_PATH_UTMP(wtmp)
2054zsh_PATH_UTMP(utmpx)
2055zsh_PATH_UTMP(wtmpx)
2056
2057dnl -------------------
2058dnl brk/sbrk PROTOTYPES
2059dnl -------------------
2060AC_CACHE_CHECK(for brk() prototype in <unistd.h>,
2061zsh_cv_header_unistd_h_brk_proto,
2062[AC_TRY_COMPILE([#include <unistd.h>
2063double brk();], [int i;],
2064zsh_cv_header_unistd_h_brk_proto=no, zsh_cv_header_unistd_h_brk_proto=yes)])
2065AH_TEMPLATE([HAVE_BRK_PROTO],
2066[Define to 1 if there is a prototype defined for brk() on your system.])
2067if test x$zsh_cv_header_unistd_h_brk_proto = xyes; then
2068  AC_DEFINE(HAVE_BRK_PROTO)
2069fi
2070
2071AC_CACHE_CHECK(for sbrk() prototype in <unistd.h>,
2072zsh_cv_header_unistd_h_sbrk_proto,
2073[AC_TRY_COMPILE([#include <unistd.h>
2074double sbrk();], [int i;],
2075zsh_cv_header_unistd_h_sbrk_proto=no, zsh_cv_header_unistd_h_sbrk_proto=yes)])
2076AH_TEMPLATE([HAVE_SBRK_PROTO],
2077[Define to 1 if there is a prototype defined for sbrk() on your system.])
2078if test x$zsh_cv_header_unistd_h_sbrk_proto = xyes; then
2079  AC_DEFINE(HAVE_SBRK_PROTO)
2080fi
2081
2082dnl -----------------------
2083dnl mknod prototype for OSF
2084dnl -----------------------
2085AH_TEMPLATE([HAVE_MKNOD_PROTO],
2086[Define to 1 if there is a prototype defined for mknod() on your system.])
2087if test "$ac_cv_prog_cc_stdc" != no; then
2088  AC_CACHE_CHECK(for mknod prototype in <sys/stat.h>,
2089  zsh_cv_header_sys_stat_h_mknod_proto,
2090  [AC_TRY_COMPILE([#include <sys/stat.h>
2091   int mknod(double x);], [int i;],
2092  zsh_cv_header_sys_stat_h_mknod_proto=no,
2093  zsh_cv_header_sys_stat_h_mknod_proto=yes)])
2094  if test x$zsh_cv_header_sys_stat_h_mknod_proto = xyes; then
2095    AC_DEFINE(HAVE_MKNOD_PROTO)
2096  fi
2097fi
2098
2099dnl ----------------------------------------
2100dnl presence and location of ioctl prototype
2101dnl ----------------------------------------
2102AC_CACHE_CHECK(for ioctl prototype in <unistd.h> or <termios.h>,
2103zsh_cv_header_unistd_h_termios_h_ioctl_proto,
2104[AC_TRY_COMPILE([
2105#ifdef HAVE_UNISTD_H
2106# include <unistd.h>
2107#endif
2108#ifdef HAVE_TERMIOS_H
2109# include <termios.h>
2110#endif
2111double ioctl();], [int i;],
2112zsh_cv_header_unistd_h_termios_h_ioctl_proto=no,
2113zsh_cv_header_unistd_h_termios_h_ioctl_proto=yes)])
2114
2115if test x$zsh_cv_header_unistd_h_termios_h_ioctl_proto = xno; then
2116  AC_CACHE_CHECK(for ioctl prototype in <sys/ioctl.h>,
2117  zsh_cv_header_sys_ioctl_h_ioctl_proto,
2118  [AC_TRY_COMPILE([#include <sys/ioctl.h>
2119  double ioctl();], [int i;],
2120  zsh_cv_header_sys_ioctl_h_ioctl_proto=no,
2121  zsh_cv_header_sys_ioctl_h_ioctl_proto=yes)])
2122else
2123  zsh_cv_header_sys_ioctl_h_ioctl_proto=no
2124fi
2125
2126AH_TEMPLATE([HAVE_IOCTL_PROTO],
2127[Define to 1 if there is a prototype defined for ioctl() on your system.])
2128if test x$zsh_cv_header_unistd_h_termios_h_ioctl_proto = xyes || \
2129   test x$zsh_cv_header_sys_ioctl_h_ioctl_proto = xyes; then
2130  AC_DEFINE(HAVE_IOCTL_PROTO)
2131fi
2132AH_TEMPLATE([IOCTL_IN_SYS_IOCTL],
2133[Define to 1 if we must include <sys/ioctl.h> to get a prototype for ioctl().])
2134if test x$zsh_cv_header_sys_ioctl_h_ioctl_proto = xyes; then
2135  AC_DEFINE(IOCTL_IN_SYS_IOCTL)
2136fi
2137
2138dnl -------------------
2139dnl select() defined in <sys/socket.h>, ie BeOS R4.51
2140dnl -------------------
2141AH_TEMPLATE([SELECT_IN_SYS_SOCKET_H],
2142[Define to 1 if select() is defined in <sys/socket.h>, ie BeOS R4.51])
2143if test x$ac_cv_header_sys_select_h != xyes; then
2144  AC_CACHE_CHECK(for select() in <sys/socket.h>,
2145  zsh_cv_header_socket_h_select_proto,
2146  [AC_TRY_COMPILE([#include <sys/socket.h>], [fd_set fd;],
2147  zsh_cv_header_socket_h_select_proto=yes, 
2148  zsh_cv_header_socket_h_select_proto=no)])
2149  if test x$zsh_cv_header_socket_h_select_proto = xyes; then
2150    AC_DEFINE(SELECT_IN_SYS_SOCKET_H)
2151  fi
2152fi
2153
2154dnl -----------
2155dnl named FIFOs
2156dnl -----------
2157dnl
2158dnl Named FIFOs work well enough on recent versions of Cygwin
2159dnl to provide what we want.  Simply enable them.
2160AC_CACHE_CHECK(if named FIFOs work,
2161zsh_cv_sys_fifo,
2162[if test "$host_os" = cygwin; then
2163zsh_cv_sys_fifo=yes
2164else
2165AC_TRY_RUN([
2166#include <fcntl.h>
2167#include <signal.h>
2168main()
2169{
2170    char c;
2171    int fd;
2172    int pid, ret;
2173    unlink("/tmp/fifo$$");
2174#ifdef HAVE_MKFIFO
2175    if(mkfifo("/tmp/fifo$$", 0600) < 0)
2176#else
2177    if(mknod("/tmp/fifo$$", 0010600, 0) < 0)
2178#endif
2179	exit(1);
2180    pid = fork();
2181    if(pid < 0)
2182	exit(1);
2183    if(pid) {
2184	fd = open("/tmp/fifo$$", O_RDONLY);
2185	exit(fd < 0 || read(fd, &c, 1) != 1 || c != 'x');
2186    }
2187    fd = open("/tmp/fifo$$", O_WRONLY);
2188    ret = (fd < 0 || write(fd, "x", 1) < 1);
2189    unlink("/tmp/fifo$$");
2190    exit(ret);
2191}
2192],
2193  zsh_cv_sys_fifo=yes,
2194  zsh_cv_sys_fifo=no,
2195  zsh_cv_sys_fifo=yes)
2196fi])
2197AH_TEMPLATE([HAVE_FIFOS],
2198[Define to 1 if system has working FIFOs.])
2199if test x$zsh_cv_sys_fifo = xyes; then
2200  AC_DEFINE(HAVE_FIFOS)
2201fi
2202dnl ---------------------
2203dnl echo style of /bin/sh
2204dnl ---------------------
2205AC_CACHE_CHECK(if echo in /bin/sh interprets escape sequences,
2206zsh_cv_prog_sh_echo_escape,
2207[if test "`/bin/sh -c \"echo '\\n'\"`" = "\\n"; then
2208  zsh_cv_prog_sh_echo_escape=no
2209else
2210  zsh_cv_prog_sh_echo_escape=yes
2211fi])
2212AH_TEMPLATE([SH_USE_BSD_ECHO],
2213[Define to 1 if /bin/sh does not interpret \ escape sequences.])
2214if test x$zsh_cv_prog_sh_echo_escape = xno; then
2215  AC_DEFINE(SH_USE_BSD_ECHO)
2216fi
2217
2218dnl -----------
2219dnl test for whether link() works
2220dnl for instance, BeOS R4.51 doesn't support hard links yet
2221dnl -----------
2222AC_CACHE_CHECK(if link() works,
2223zsh_cv_sys_link,
2224[AC_TRY_RUN([
2225#include <unistd.h>
2226#include <fcntl.h>
2227main()
2228{
2229    int ret;
2230    char *tmpfile, *newfile;
2231    tmpfile="/tmp/zsh.linktest$$";
2232    newfile="/tmp/zsh.linktest2$$";
2233    unlink(tmpfile);
2234    unlink(newfile);
2235    if(creat(tmpfile, 0644) < 0)
2236	exit(1);
2237    ret = link(tmpfile, newfile);
2238    unlink(tmpfile);
2239    unlink(newfile);
2240    exit(ret<0);
2241}
2242],
2243  zsh_cv_sys_link=yes,
2244  zsh_cv_sys_link=no,
2245  zsh_cv_sys_link=yes)])
2246AH_TEMPLATE([HAVE_LINK],
2247[Define to 1 if system has working link().])
2248if test x$zsh_cv_sys_link = xyes; then
2249  AC_DEFINE(HAVE_LINK)
2250fi
2251
2252dnl -----------
2253dnl test for whether kill(pid, 0) where pid doesn't exit
2254dnl should set errno to ESRCH, but some like BeOS R4.51 set to EINVAL
2255dnl -----------
2256AC_CACHE_CHECK(if kill(pid, 0) returns ESRCH correctly,
2257zsh_cv_sys_killesrch,
2258[AC_TRY_RUN([
2259#include <unistd.h>
2260#include <signal.h>
2261#include <errno.h>
2262main()
2263{
2264    int pid = (getpid() + 10000) & 0xffffff;
2265    while (pid && (kill(pid, 0) == 0 || errno != ESRCH)) pid >>= 1;
2266    exit(errno!=ESRCH);
2267}
2268],
2269  zsh_cv_sys_killesrch=yes,
2270  zsh_cv_sys_killesrch=no,
2271  zsh_cv_sys_killesrch=yes)])
2272AH_TEMPLATE([BROKEN_KILL_ESRCH],
2273[Define to 1 if kill(pid, 0) doesn't return ESRCH, ie BeOS R4.51.])
2274if test x$zsh_cv_sys_killesrch = xno; then
2275  AC_DEFINE(BROKEN_KILL_ESRCH)
2276fi
2277
2278dnl -----------
2279dnl if POSIX, test for working sigsuspend().
2280dnl for instance, BeOS R4.51 is broken.
2281dnl -----------
2282AH_TEMPLATE([BROKEN_POSIX_SIGSUSPEND],
2283Define to 1 if sigsuspend() is broken, ie BeOS R4.51.])
2284if test x$signals_style = xPOSIX_SIGNALS; then
2285    AC_CACHE_CHECK(if POSIX sigsuspend() works,
2286    zsh_cv_sys_sigsuspend,
2287    [AC_TRY_RUN([
2288#include <signal.h>
2289#include <unistd.h>
2290int child=0;
2291void handler(sig)
2292    int sig;
2293{if(sig==SIGCHLD) child=1;}
2294main() {
2295    struct sigaction act;
2296    sigset_t set;
2297    int pid, ret;
2298    act.sa_handler = &handler;
2299    sigfillset(&act.sa_mask);
2300    act.sa_flags = 0;
2301    sigaction(SIGCHLD, &act, 0);
2302    sigfillset(&set);
2303    sigprocmask(SIG_SETMASK, &set, 0);
2304    pid=fork();
2305    if(pid==0) return 0;
2306    if(pid>0) {
2307    sigemptyset(&set);
2308        ret=sigsuspend(&set);
2309        exit(child==0);
2310    }
2311}
2312],
2313      zsh_cv_sys_sigsuspend=yes,
2314      zsh_cv_sys_sigsuspend=no,
2315      zsh_cv_sys_sigsuspend=yes)])
2316    if test x$zsh_cv_sys_sigsuspend = xno; then
2317      AC_DEFINE(BROKEN_POSIX_SIGSUSPEND)
2318    fi
2319fi
2320
2321dnl -----------
2322dnl if found tcsetpgrp, test to see if it actually works
2323dnl for instance, BeOS R4.51 does not support it yet
2324dnl -----------
2325AH_TEMPLATE([BROKEN_TCSETPGRP],
2326[Define to 1 if tcsetpgrp() doesn't work, ie BeOS R4.51.])
2327AC_ARG_WITH(tcsetpgrp,
2328AC_HELP_STRING([--with-tcsetpgrp], [assumes that tcsetpgrp() exists and works correctly]),[
2329case "x$withval" in
2330    xyes) zsh_working_tcsetpgrp=yes;;
2331    xno)  zsh_working_tcsetpgrp=no;;
2332    *)    AC_ERROR([please use --with-tcsetpgrp=yes or --with-tcsetpgrp=no]);;
2333esac],[zsh_working_tcsetpgrp=check])
2334if test "x$ac_cv_func_tcsetpgrp" = xyes; then
2335case "x$zsh_working_tcsetpgrp" in
2336  xcheck)
2337    trap "" TTOU > /dev/null 2>&1 || :
2338    AC_CACHE_CHECK(if tcsetpgrp() actually works,
2339    zsh_cv_sys_tcsetpgrp,
2340    [AC_TRY_RUN([
2341#include <sys/types.h>
2342#include <unistd.h>
2343#include <fcntl.h>
2344main() {
2345    int fd;
2346    int ret;
2347    fd=open("/dev/tty", O_RDWR);
2348    if (fd < 0) exit(2);
2349    ret=tcsetpgrp(fd, tcgetpgrp(fd));
2350    if (ret < 0) exit(1);
2351    exit(0);
2352}
2353],
2354      zsh_cv_sys_tcsetpgrp=yes, [
2355case $? in
2356    1) zsh_cv_sys_tcsetpgrp=no;;
2357    2) zsh_cv_sys_tcsetpgrp=notty;;
2358    *) zsh_cv_sys_tcsetpgrp=error;;
2359esac
2360      ], zsh_cv_sys_tcsetpgrp=yes)])
2361    case "x$zsh_cv_sys_tcsetpgrp" in
2362      xno)    AC_DEFINE(BROKEN_TCSETPGRP);;
2363      xyes)   :;;
2364      xnotty) AC_MSG_ERROR([no controlling tty
2365Try running configure with --with-tcsetpgrp or --without-tcsetpgrp]);;
2366      *)      AC_MSG_ERROR([unexpected return status]);;
2367    esac
2368    trap - TTOU > /dev/null 2>&1 || :
2369    ;;
2370  xyes) :;;
2371  xno)  AC_DEFINE(BROKEN_TCSETPGRP);;
2372  *)    AC_MSG_ERROR([unexpected value zsh_working_tcsetpgrp=$zsh_working_tcsetpgrp]);;
2373esac
2374fi
2375
2376dnl -----------
2377dnl test for faked getpwnam() entry, ie a single entry returned for any username
2378dnl for instance, BeOS R4.51 is not multiuser yet, and fakes getpwnam()
2379dnl test by looking up two usernames that shouldn't succeed, and compare entry
2380dnl -----------
2381AH_TEMPLATE([GETPWNAM_FAKED],
2382[Define to 1 if getpwnam() is faked, ie BeOS R4.51.])
2383if test x$ac_cv_func_getpwnam = xyes; then
2384    AC_CACHE_CHECK(if getpwnam() is faked,
2385    zsh_cv_sys_getpwnam_faked,
2386    [AC_TRY_RUN([
2387#include <pwd.h>
2388main() {
2389    struct passwd *pw1, *pw2;
2390    char buf[1024], name[1024];
2391    sprintf(buf, "%d:%d", getpid(), rand());
2392    pw1=getpwnam(buf);
2393    if (pw1) strcpy(name, pw1->pw_name);
2394    sprintf(buf, "%d:%d", rand(), getpid());
2395    pw2=getpwnam(buf);
2396    exit(pw1!=0 && pw2!=0 && !strcmp(name, pw2->pw_name));
2397}
2398],
2399      zsh_cv_sys_getpwnam_faked=no,
2400      zsh_cv_sys_getpwnam_faked=yes,
2401      zsh_cv_sys_getpwnam_faked=no)])
2402    if test x$zsh_cv_sys_getpwnam_faked = xyes; then
2403      AC_DEFINE(GETPWNAM_FAKED)
2404    fi
2405fi
2406
2407
2408dnl ---------------
2409dnl check for the type of third argument of accept
2410dnl ---------------
2411
2412zsh_CHECK_SOCKLEN_T
2413
2414dnl ---------------
2415dnl Check for pty multiplexer for use in pty module.
2416dnl We need to open it read/write, so make sure it is writeable.
2417dnl Yet another test which won't work when cross-compiling.
2418dnl ---------------
2419AC_CACHE_CHECK(if your system has /dev/ptmx,
2420ac_cv_have_dev_ptmx,
2421[if test -w /dev/ptmx; then
2422  ac_cv_have_dev_ptmx=yes
2423else
2424  ac_cv_have_dev_ptmx=no
2425fi])
2426
2427dnl --------
2428dnl Check if the ptmx functions are usable.
2429dnl We need to be able to find the prototypes, which may
2430dnl require non-POSIX source definitions.  So test to see
2431dnl if ptsname is correctly recognised as returning a char *.
2432dnl We do this by making sure a program where ptsname() is declared
2433dnl as returning int does *not* compile.
2434dnl On Linux we need the XOPEN extensions.  The easiest way to get
2435dnl these is by defining _GNU_SOURCE.
2436dnl -------
2437AH_TEMPLATE([USE_DEV_PTMX],
2438[Define to 1 if all the kit for using /dev/ptmx for ptys is available.])
2439if test x$ac_cv_have_dev_ptmx = xyes && \
2440   test x$ac_cv_func_grantpt = xyes && \
2441   test x$ac_cv_func_unlockpt = xyes && \
2442   test x$ac_cv_func_ptsname = xyes; then
2443   AC_CACHE_CHECK([if /dev/ptmx is usable],
2444   ac_cv_use_dev_ptmx,
2445   [AC_TRY_COMPILE([#ifdef __linux
2446#define _GNU_SOURCE 1
2447#endif
2448#include <stdlib.h>
2449int ptsname();], ,
2450   ac_cv_use_dev_ptmx=no,
2451   ac_cv_use_dev_ptmx=yes)])
2452   if test x$ac_cv_use_dev_ptmx = xyes; then
2453     AC_DEFINE(USE_DEV_PTMX)
2454   fi
2455fi
2456
2457dnl -----------------
2458dnl multibyte support
2459dnl -----------------
2460AC_ARG_ENABLE(multibyte,
2461AC_HELP_STRING([--enable-multibyte], [support multibyte characters]),
2462[zsh_cv_c_unicode_support=$enableval],
2463[AC_CACHE_VAL(zsh_cv_c_unicode_support,
2464  AC_MSG_NOTICE([checking for functions supporting multibyte characters])
2465  [zfuncs_absent=
2466   for zfunc in iswalnum iswcntrl iswdigit iswgraph iswlower iswprint \
2467iswpunct iswspace iswupper iswxdigit mbrlen mbrtowc towupper towlower \
2468wcschr wcscpy wcslen wcsncmp wcsncpy wcrtomb wcwidth wmemchr wmemcmp \
2469wmemcpy wmemmove wmemset; do
2470     AC_CHECK_FUNC($zfunc,
2471     [:], [zfuncs_absent="$zfuncs_absent $zfunc"])
2472    done
2473    if test x"$zfuncs_absent" = x; then
2474      AC_MSG_NOTICE([all functions found, multibyte support enabled])
2475      zsh_cv_c_unicode_support=yes
2476    else
2477      AC_MSG_NOTICE([missing functions, multibyte support disabled])
2478      zsh_cv_c_unicode_support=no
2479    fi
2480  ])
2481])
2482AH_TEMPLATE([MULTIBYTE_SUPPORT],
2483[Define to 1 if you want support for multibyte character sets.])
2484AH_TEMPLATE([BROKEN_WCWIDTH],
2485[Define to 1 if the wcwidth() function is present but broken.])
2486if test x$zsh_cv_c_unicode_support = xyes; then
2487  AC_DEFINE(MULTIBYTE_SUPPORT)
2488
2489  dnl Test for a wcwidth() implementation that gives the wrong width for
2490  dnl zero-width combining characters.
2491  dnl For the test we use a combining acute accent (\u0301).
2492  dnl We input it as UTF-8 since that is the standard we can rely
2493  dnl upon most:  we can't rely on a wchar_t being stored as a
2494  dnl Unicode code point on all systems.
2495  dnl The programme returns 0 only if all the conditions for brokenness
2496  dnl are met:
2497  dnl - the programme compiled, linked and ran
2498  dnl - we successfully set a UTF-8 locale
2499  dnl - the locale we set plausibly converted the UTF-8 string
2500  dnl   for a zero-width combining character (the only way to be
2501  dnl   100% sure would be to output it and ask if it looked right)
2502  dnl - the converted wide character gave a non-zero width.
2503  dnl locale -a is a fallback; on most systems we should find en_US.UTF-8.
2504  [locale_prog='char *my_locales[] = {
2505  "en_US.UTF-8", "en_GB.UTF-8", "en.UTF-8", '
2506  locale_prog="$locale_prog"`locale -a 2>/dev/null | \
2507    sed -e 's/utf8/UTF-8/' | grep UTF-8 | \
2508    while read line; do echo " \"$line\","; done;`
2509  locale_prog="$locale_prog 0 };
2510  #define _XOPEN_SOURCE
2511  #include <stdlib.h>
2512  #include <locale.h>
2513  #include <wchar.h>
2514
2515  int main() {
2516    char **localep;
2517    char comb_acute_mb[] = { (char)0xcc, (char)0x81 };
2518    wchar_t wc;
2519
2520    for (localep = my_locales; *localep; localep++)
2521      if (setlocale(LC_ALL, *localep) &&
2522          mbtowc(&wc, comb_acute_mb, 2) == 2)
2523	  break;
2524    if (!*localep)
2525      return 1;
2526    if (wcwidth(wc) == 0)
2527      return 1;
2528    return 0;
2529  }
2530  "]
2531
2532  AC_CACHE_CHECK(if the wcwidth() function is broken,
2533  zsh_cv_c_broken_wcwidth,
2534  [AC_TRY_RUN([$locale_prog],
2535  zsh_cv_c_broken_wcwidth=yes,
2536  zsh_cv_c_broken_wcwidth=no,
2537  zsh_cv_c_broken_wcwidth=no)])
2538  if test x$zsh_cv_c_broken_wcwidth = xyes; then
2539    AC_DEFINE(BROKEN_WCWIDTH)
2540  fi
2541fi
2542
2543dnl
2544dnl musl support
2545dnl
2546AH_TEMPLATE([LIBC_MUSL],
2547[Define to 1 if musl is being used as the C library])
2548AC_ARG_ENABLE(libc-musl,
2549AC_HELP_STRING([--enable-libc-musl], [compile with musl as the C library]),
2550[if test x$enableval = xyes; then
2551  AC_DEFINE(LIBC_MUSL)
2552fi])
2553
2554dnl
2555dnl static user lookup
2556dnl
2557AC_ARG_ENABLE(dynamic-nss,
2558	      AC_HELP_STRING([--disable-dynamic-nss], [do not call
2559			      functions that will require dynamic NSS
2560			      modules]),
2561[zsh_cv_c_dynamic_nss=$enableval],
2562[])
2563
2564AH_TEMPLATE([DISABLE_DYNAMIC_NSS],
2565[Define to 1 if you want to avoid calling functions that will require
2566 dynamic NSS modules.])
2567if test x$zsh_cv_c_dynamic_nss = xno; then
2568  AC_DEFINE(DISABLE_DYNAMIC_NSS)
2569fi
2570
2571dnl ---------------
2572dnl dynamic loading
2573dnl ---------------
2574AH_TEMPLATE([HPUX10DYNAMIC],
2575[Define to 1 if you want to use dynamically loaded modules on HPUX 10.])
2576L=N
2577INSTLIB="install.bin-\$(L)"
2578UNINSTLIB="uninstall.bin-\$(L)"
2579LINKMODS=NOLINKMODS
2580MOD_EXPORT=
2581MOD_IMPORT_VARIABLE=
2582MOD_IMPORT_FUNCTION=
2583aixdynamic=no
2584hpuxdynamic=no
2585if test "$ac_cv_func_load"      = yes &&
2586   test "$ac_cv_func_unload"    = yes &&
2587   test "$ac_cv_func_loadbind"  = yes &&
2588   test "$ac_cv_func_loadquery" = yes; then
2589  dnl Force AIXDYNAMIC even on newer versions that have dl family
2590  if test "x$dynamic" = xyes; then
2591    aixdynamic=yes
2592  fi
2593elif test "$ac_cv_func_dlopen"  != yes ||
2594     test "$ac_cv_func_dlsym"   != yes ||
2595     test "$ac_cv_func_dlerror" != yes; then
2596  if test "$ac_cv_func_shl_load" != yes ||
2597     test "$ac_cv_func_shl_unload" != yes ||
2598     test "$ac_cv_func_shl_findsym" != yes; then
2599    dynamic=no
2600  elif test "x$dynamic" = xyes; then
2601    hpuxdynamic=yes
2602    DL_EXT="${DL_EXT=sl}"
2603    dnl autoheader won't allow us to define anything which isn't
2604    dnl going into a header, and we can't undefine anything, so
2605    dnl just define this anyway and rely on the later tests to
2606    dnl define DYNAMIC or not.
2607    AC_DEFINE(HPUX10DYNAMIC)dnl
2608  fi
2609fi
2610
2611test -n "$GCC" && LDARG=-Wl,
2612
2613AH_TEMPLATE([DLSYM_NEEDS_UNDERSCORE],
2614[Define to 1 if an underscore has to be prepended to dlsym() argument.])
2615AH_TEMPLATE([DYNAMIC_NAME_CLASH_OK],
2616[Define to 1 if multiple modules defining the same symbol are OK.])
2617if test "x$aixdynamic" = xyes; then
2618  DL_EXT="${DL_EXT=so}"
2619  DLLD="${DLLD=$CC}"
2620  zsh_cv_func_dlsym_needs_underscore=no
2621  if test -n "$GCC"; then
2622    DLLDFLAGS=${DLLDFLAGS=-shared}
2623  else
2624    DLLDFLAGS=${DLLDFLAGS=-bM:SRE}
2625  fi
2626  DLLDFLAGS=${DLLDFLAGS=}
2627  EXTRA_LDFLAGS=${EXTRA_LDFLAGS=}
2628  EXPOPT=${LDARG}-bE:
2629  IMPOPT=${LDARG}-bI:
2630  zsh_cv_sys_dynamic_clash_ok="${zsh_cv_sys_dynamic_clash_ok=yes}"
2631  zsh_cv_sys_dynamic_rtld_global="${zsh_cv_sys_dynamic_rtld_global=yes}"
2632  zsh_cv_sys_dynamic_execsyms="${zsh_cv_sys_dynamic_execsyms=yes}"
2633  zsh_cv_sys_dynamic_strip_exe="${zsh_cv_sys_dynamic_strip_exe=yes}"
2634  zsh_cv_sys_dynamic_strip_lib="${zsh_cv_sys_dynamic_strip_lib=yes}"
2635  zsh_cv_shared_environ="${zsh_cv_shared_environ=yes}"
2636elif test "$host_os" = cygwin; then
2637  DL_EXT="${DL_EXT=dll}"
2638##DLLD="${DLLD=dllwrap}"
2639  DLLD="${DLLD=$CC}"
2640##DLLDFLAGS="${DLLDFLAGS=--export-all-symbols}"
2641  DLLDFLAGS=${DLLDFLAGS=-shared -Wl,--export-all-symbols}
2642  zsh_cv_func_dlsym_needs_underscore=no
2643  DLLDFLAGS=${DLLDFLAGS=}
2644  EXTRA_LDFLAGS=${EXTRA_LDFLAGS=}
2645  zsh_cv_sys_dynamic_clash_ok="${zsh_cv_sys_dynamic_clash_ok=no}"
2646  zsh_cv_sys_dynamic_rtld_global="${zsh_cv_sys_dynamic_rtld_global=yes}"
2647  zsh_cv_sys_dynamic_execsyms="${zsh_cv_sys_dynamic_execsyms=no}"
2648  zsh_cv_sys_dynamic_strip_exe="${zsh_cv_sys_dynamic_strip_exe=yes}"
2649  zsh_cv_sys_dynamic_strip_lib="${zsh_cv_sys_dynamic_strip_lib=yes}"
2650  #
2651  # THAT SUCKS! and must be changed
2652  #
2653  zsh_cv_shared_environ="${zsh_cv_shared_environ=yes}"
2654  LINKMODS=LINKMODS
2655  MOD_EXPORT="__attribute__((__dllexport__))"
2656  MOD_IMPORT_VARIABLE="__attribute__((__dllimport__))"
2657  MOD_IMPORT_FUNCTION=
2658elif test "x$dynamic" = xyes; then
2659  AC_CACHE_CHECK(if your system uses ELF binaries,
2660   zsh_cv_sys_elf,
2661   [AC_TRY_RUN([/* Test for whether ELF binaries are produced */
2662#include <fcntl.h>
2663#include <stdlib.h>
2664main(argc, argv)
2665int argc;
2666char *argv[];
2667{
2668	char b[4];
2669	int i = open(argv[0],O_RDONLY);
2670	if(i == -1) 
2671		exit(1); /* fail */
2672	if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
2673		exit(0); /* succeed (yes, it's ELF) */
2674	else
2675		exit(1); /* fail */
2676}],
2677  zsh_cv_sys_elf=yes,
2678  zsh_cv_sys_elf=no,
2679  zsh_cv_sys_elf=yes)])
2680
2681  # We use [0-9]* in case statements, so need to change quoting
2682  changequote(, )
2683
2684  DL_EXT="${DL_EXT=so}"
2685  if test x$zsh_cv_sys_elf = xyes; then
2686    case "$host" in
2687      mips-sni-sysv4*)
2688        # Forcibly set ld to native compiler to avoid obscure GCC problems
2689	DLLD="${DLLD=/usr/ccs/bin/cc}"
2690	DLLDARG="${LDARG}"
2691      ;;
2692      * )
2693	DLLD="${DLLD=$CC}"
2694	DLLDARG="${LDARG}"
2695      ;;
2696    esac
2697  else
2698    case "$host" in
2699      *openbsd*)
2700	case "$host_os" in
2701	  openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
2702	    DLLD="${DLLD=ld}"
2703	  ;;
2704	  *)
2705	    DLLD="${DLLD=$CC}"
2706	  ;;
2707	esac
2708	DLLDARG="${LDARG}"
2709      ;;
2710      *darwin*)
2711        DLLD="${DLLD=$CC}"
2712        DLLDARG=""
2713      ;;
2714      *interix*)
2715        DLLD="${DLLD=$CC}"
2716        DLLDARG=""
2717      ;;
2718      * )
2719	DLLD="${DLLD=ld}"
2720	DLLDARG=""
2721      ;;
2722    esac
2723  fi
2724  if test -n "$GCC"; then
2725    case "$host_os" in
2726      hpux*)   DLLDFLAGS="${DLLDFLAGS=-shared}" ;;
2727      darwin*) DLCFLAGS="${DLCFLAGS=-fno-common}" ;;
2728      interix*) DLCFLAGS="${DLCFLAGS=}" ;;
2729      *)       DLCFLAGS="${DLCFLAGS=-fPIC}" ;;
2730    esac
2731  else
2732    case "$host_os" in
2733      hpux*)
2734        DLCFLAGS="${DLCFLAGS=+z}"
2735        DLLDFLAGS="${DLLDFLAGS=-b}"
2736      ;;
2737      sunos*)                DLCFLAGS="${DLCFLAGS=-pic}" ;;
2738      solaris*|sysv4*|esix*) DLCFLAGS="${DLCFLAGS=-KPIC}" ;;
2739    esac
2740  fi
2741  case "$host_os" in
2742    osf*) DLLDFLAGS="${DLLDFLAGS=-shared -expect_unresolved '*'}" ;;
2743    *freebsd*|*netbsd*|linux*|irix*|gnu*|interix*|dragonfly*) DLLDFLAGS="${DLLDFLAGS=-shared}" ;;
2744    sunos*)       DLLDFLAGS="${DLLDFLAGS=-assert nodefinitions}" ;;
2745    sysv4*|esix*) DLLDFLAGS="${DLLDFLAGS=-G $ldflags}" ;;
2746    aix*)         DLLDFLAGS="${DLLDFLAGS=-G -bexpall -lc}" ;;
2747    solaris*|sysv4*|esix*) DLLDFLAGS="${DLLDFLAGS=-G}" ;;
2748    darwin*)      DLLDFLAGS="${DLLDFLAGS=-bundle -flat_namespace -undefined suppress}" ;;
2749    beos*|haiku*) DLLDFLAGS="${DLLDFLAGS=-nostart}" ;;
2750    openbsd*)
2751      if test x$zsh_cv_sys_elf = xyes; then
2752	DLLDFLAGS="${DLLDFLAGS=-shared -fPIC}"
2753      else
2754	case "$host_os" in
2755	  openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
2756	   DLLDFLAGS="${DLLDFLAGS=-Bshareable}"
2757	  ;;
2758	  *)
2759	    DLLDFLAGS="${DLLDFLAGS=-shared -fPIC}"
2760	  ;;
2761	esac
2762      fi
2763    ;;
2764  esac
2765  case "$host" in
2766    *-hpux*)  EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-Wl,-E}" ;;
2767    *openbsd*)
2768       if test x$zsh_cv_sys_elf = xyes; then
2769	 EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-Wl,-E}"
2770       fi
2771    ;;
2772    mips-sni-sysv4)
2773      #
2774      # unfortunately, we have different compilers
2775      # that need different flags
2776      #
2777      if test -n "$GCC"; then
2778        sni_cc_version=GCC
2779      else
2780        sni_cc_version=`$CC -V 2>&1 | head -1`
2781      fi
2782      case "$sni_cc_version" in
2783        *CDS*|GCC )
2784         EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-Wl,-Blargedynsym}"
2785       ;;
2786       * )
2787         EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-LD-Blargedynsym}"
2788       ;;
2789      esac
2790    ;;
2791    *-beos*)
2792      # gcc on BeOS doesn't like -rdynamic...
2793      EXTRA_LDFLAGS="${EXTRA_LDFLAGS= }"
2794      # also, dlopen() at least in Zeta respects $LIBRARY_PATH, so needs %A added to it.
2795      export LIBRARY_PATH="$LIBRARY_PATH:%A/"
2796    ;;
2797    *-haiku*)
2798      # 
2799    ;;
2800  esac
2801
2802  # Done with our shell code, so restore autotools quoting
2803  changequote([, ])
2804
2805AC_CACHE_CHECK(if we can use -rdynamic, zsh_cv_rdynamic_available,
2806old_LDFLAGS="$LDFLAGS"
2807LDFLAGS="$LDFLAGS -rdynamic"
2808AC_TRY_LINK([], [], [zsh_cv_rdynamic_available=yes
2809EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-rdynamic}"],
2810[zsh_cvs_rdynamic_available=no])
2811LDFLAGS="$old_LDFLAGS")
2812  AC_CACHE_CHECK(if your dlsym() needs a leading underscore,
2813   zsh_cv_func_dlsym_needs_underscore,
2814   [echo failed >conftestval && cat >conftest.c <<EOM
2815fred () { }
2816EOM
2817    AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest.c 1>&AC_FD_CC) &&
2818    AC_TRY_COMMAND($DLLD $LDFLAGS $DLLDFLAGS -o conftest.$DL_EXT conftest.o 1>&AC_FD_CC) &&
2819    AC_TRY_RUN([
2820#include <stdio.h>
2821#ifdef HPUX10DYNAMIC
2822#include <dl.h>
2823#define RTLD_LAZY BIND_DEFERRED
2824#define RTLD_GLOBAL DYNAMIC_PATH
2825
2826char *zsh_gl_sym_addr ;
2827
2828#define dlopen(file,mode) (void *)shl_load((file), (mode), (long) 0)
2829#define dlclose(handle) shl_unload((shl_t)(handle))
2830#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)
2831#define dlerror() 0
2832#else
2833#ifdef HAVE_DLFCN_H
2834#include <dlfcn.h>
2835#else
2836#include <sys/types.h>
2837#include <nlist.h>
2838#include <link.h>
2839#endif
2840#endif
2841#ifndef RTLD_LAZY
2842#define RTLD_LAZY 1
2843#endif
2844
2845extern int fred() ;
2846
2847main()
2848{
2849    void * handle ;
2850    void * symbol ;
2851    FILE *f=fopen("conftestval", "w");
2852    if (!f) exit(1);
2853    handle = dlopen("./conftest.$DL_EXT", RTLD_LAZY) ;
2854    if (handle == NULL) {
2855        fprintf (f, "dlopen failed") ;
2856            exit(1);
2857    }
2858    symbol = dlsym(handle, "fred") ;
2859    if (symbol == NULL) {
2860                /* try putting a leading underscore */
2861        symbol = dlsym(handle, "_fred") ;
2862        if (symbol == NULL) {
2863            fprintf (f, "dlsym failed") ;
2864                exit(1);
2865                }
2866        fprintf (f, "yes") ;
2867    }
2868    else
2869        fprintf (f, "no") ;
2870    exit(0);
2871}], zsh_cv_func_dlsym_needs_underscore=`cat conftestval`,
2872    zsh_cv_func_dlsym_needs_underscore=failed
2873    dynamic=no,
2874    zsh_cv_func_dlsym_needs_underscore=no)])
2875  if test "x$zsh_cv_func_dlsym_needs_underscore" = xyes; then
2876    AC_DEFINE(DLSYM_NEEDS_UNDERSCORE)
2877  elif test "x$zsh_cv_func_dlsym_needs_underscore" != xno; then
2878    dnl Do not cache failed value
2879    unset zsh_cv_func_dlsym_needs_underscore
2880  fi
2881fi
2882
2883if test "x$dynamic" = xyes; then
2884  zsh_SHARED_VARIABLE([environ], [char **])
2885  test "$zsh_cv_shared_environ" = yes || dynamic=no
2886  if test "$ac_cv_func_tgetent" = yes; then
2887    zsh_SHARED_FUNCTION([tgetent])
2888  fi
2889  if test "$ac_cv_func_tigetstr" = yes; then
2890    zsh_SHARED_FUNCTION([tigetstr])
2891  fi
2892fi
2893
2894if test "x$dynamic" = xyes; then
2895  zsh_SYS_DYNAMIC_CLASH
2896  zsh_SYS_DYNAMIC_GLOBAL
2897  RTLD_GLOBAL_OK=$zsh_cv_sys_dynamic_rtld_global
2898  zsh_SYS_DYNAMIC_EXECSYMS
2899  if test "$zsh_cv_sys_dynamic_execsyms" != yes; then
2900    L=L
2901  fi
2902  zsh_SYS_DYNAMIC_STRIP_EXE
2903  zsh_SYS_DYNAMIC_STRIP_LIB
2904  if $strip_exeldflags && test "$zsh_cv_sys_dynamic_strip_exe" = yes; then
2905    EXELDFLAGS="$EXELDFLAGS -s"
2906  fi
2907  if $strip_libldflags && test "$zsh_cv_sys_dynamic_strip_lib" = yes; then
2908    LIBLDFLAGS="$LIBLDFLAGS -s"
2909  fi
2910  if test "$host_os" = cygwin; then
2911    INSTLIB="install.cygwin-lib"
2912    UNINSTLIB="uninstall.cygwin-lib"
2913  fi
2914else
2915  $strip_exeldflags && EXELDFLAGS="$EXELDFLAGS -s"
2916  $strip_libldflags && LIBLDFLAGS="$LIBLDFLAGS -s"
2917  RTLD_GLOBAL_OK=no
2918fi
2919
2920AH_TEMPLATE([DYNAMIC],
2921[Define to 1 if you want to use dynamically loaded modules.])
2922if test "x$dynamic" = xyes; then
2923  D=D
2924  AC_DEFINE(DYNAMIC)dnl
2925else
2926  D=N
2927fi
2928
2929AH_TEMPLATE([AIXDYNAMIC],
2930[Define to 1 if you want to use dynamically loaded modules on AIX.])
2931if test "x$aixdynamic" = xyes; then
2932  E=E
2933  AC_DEFINE(AIXDYNAMIC)dnl
2934else
2935  E=N
2936fi
2937
2938if test "x$zsh_cv_sys_dynamic_clash_ok" = xyes; then
2939  SHORTBOOTNAMES=yes
2940else
2941  SHORTBOOTNAMES=no
2942fi
2943AC_SUBST(SHORTBOOTNAMES)
2944
2945AC_SUBST(INSTLIB)dnl
2946AC_SUBST(UNINSTLIB)dnl
2947
2948if test "$host_os" = cygwin; then
2949  EXTRAZSHOBJS="$EXTRAZSHOBJS zsh.res.o"
2950fi
2951
2952AC_DEFINE_UNQUOTED(DL_EXT, "$DL_EXT",
2953[The extension used for dynamically loaded modules.])dnl
2954AC_SUBST(D)dnl
2955AC_SUBST(DL_EXT)dnl
2956AC_SUBST(DLLD)dnl
2957AC_SUBST(DLCFLAGS)dnl
2958AC_SUBST(DLLDFLAGS)dnl
2959AC_SUBST(E)dnl
2960AC_SUBST(EXTRA_LDFLAGS)dnl
2961AC_SUBST(EXPOPT)dnl
2962AC_SUBST(IMPOPT)dnl
2963AC_SUBST(L)dnl
2964AC_SUBST(LINKMODS)dnl
2965AC_SUBST(MOD_EXPORT)dnl
2966AC_SUBST(MOD_IMPORT_VARIABLE)dnl
2967AC_SUBST(MOD_IMPORT_FUNCTION)dnl
2968AC_SUBST(EXTRAZSHOBJS)dnl
2969
2970# Generate config.modules.  We look for *.mdd files in first and second
2971# level subdirectories.  Any existing line not containing 'auto=y' will be
2972# retained, provided the .mdd file itself was found.
2973CONFIG_MODULES=./config.modules
2974cat <<EOM > ${CONFIG_MODULES}.sh
2975srcdir="$srcdir"
2976dynamic="$dynamic"
2977CONFIG_MODULES="${CONFIG_MODULES}"
2978EOM
2979cat <<\EOM >> ${CONFIG_MODULES}.sh
2980echo "creating ${CONFIG_MODULES}"
2981userlist=" "
2982if test -f ${CONFIG_MODULES}; then
2983  userlist="`sed -e '/^#/d' -e '/auto=y/d' -e 's/ .*/ /' -e 's/^name=/ /' \
2984        ${CONFIG_MODULES}`"
2985  mv ${CONFIG_MODULES} ${CONFIG_MODULES}.old
2986else
2987  # Save testing for existence each time.
2988  echo > ${CONFIG_MODULES}.old
2989fi
2990(echo "# Edit this file to change the way modules are loaded."
2991echo "# The format is strict; do not break lines or add extra spaces."
2992echo "# Run \`make prep' if you change anything here after compiling"
2993echo "# (there is no need if you change this just after the first time"
2994echo "# you run \`configure')."
2995echo "#"
2996echo "# Values of \`link' are \`static', \`dynamic' or \`no' to compile the"
2997echo "# module into the shell, link it in at run time, or not use it at all."
2998echo "# In the final case, no attempt will be made to compile it."
2999echo "# Use \`static' or \`no' if you do not have dynamic loading."
3000echo "#"
3001echo "# Values of \`load' are \`yes' or \`no'; if yes, any builtins etc."
3002echo "# provided by the module will be autoloaded by the main shell"
3003echo "# (so long as \`link' is not set to \`no')."
3004echo "#"
3005echo "# Values of \`auto' are \`yes' or \`no'. configure sets the value to"
3006echo "# \`yes'.  If you set it by hand to \`no', the line will be retained"
3007echo "# when the file is regenerated in future."
3008echo "#"
3009echo "# Note that the \`functions' entry extends to the end of the line."
3010echo "# It should not be quoted; it is used verbatim to find files to install."
3011echo "#"
3012echo "# You will need to run \`config.status --recheck' if you add a new"
3013echo "# module."
3014echo "#"
3015echo "# You should not change the values for the pseudo-module zsh/main,"
3016echo "# which is the main shell (apart from the functions entry)."
3017EOM
3018dnl The autoconf macros are only available in configure, not
3019dnl config.status, and only change when configure is rerun.
3020dnl So we need to run the autoconf tests here and store the results.
3021dnl We then generate config.modules, preserving any user-generated
3022dnl information, from config.status.
3023for modfile in `cd ${srcdir}; echo */*.mdd */*/*.mdd`; do
3024  name=
3025  link=
3026  load=
3027  functions=
3028  result=
3029  . ${srcdir}/$modfile
3030  if test x$name != x && test x"$link" != x; then
3031    case "$link" in
3032      *\ *) eval "link=\`$link\`"
3033	    ;;
3034    esac
3035    case "${load}" in
3036      y*) load=" load=yes"
3037	  ;;
3038      *) load=" load=no"
3039	 ;;
3040    esac
3041    if test "x$functions" != x; then
3042      # N.B. no additional quotes
3043      f=" functions=$functions"
3044    else
3045      f=
3046    fi
3047    case "$link" in
3048      static) result="name=$name modfile=$modfile link=static auto=yes${load}$f"
3049	      ;;
3050      dynamic) if test x$dynamic != xno; then
3051		  result="name=$name modfile=$modfile link=dynamic\
3052 auto=yes${load}$f"
3053	       else
3054		 result="name=$name modfile=$modfile link=no\
3055 auto=yes load=no$f"
3056	       fi
3057	       ;;
3058      either) if test x$dynamic != xno; then
3059		result="name=$name modfile=$modfile link=dynamic\
3060 auto=yes${load}$f"
3061	      else
3062		result="name=$name modfile=$modfile link=static\
3063 auto=yes${load}$f"
3064	      fi
3065	      ;;
3066       *) result="name=$name modfile=$modfile link=no auto=yes load=no$f"
3067	  ;;
3068    esac
3069dnl $result is the default output for config.modules.  We generate
3070dnl code to check if we should use this.
3071cat <<EOM >> ${CONFIG_MODULES}.sh
3072case "\$userlist" in
3073  *" $name "*) grep "^name=$name " \${CONFIG_MODULES}.old;;
3074  *) echo "$result";;
3075esac
3076EOM
3077  fi
3078done
3079cat <<\EOM >> ${CONFIG_MODULES}.sh
3080) >${CONFIG_MODULES}
3081rm -f ${CONFIG_MODULES}.old
3082EOM
3083
3084dnl AH_TOP replaces the code which used to appear at the top
3085dnl of acconfig.h.
3086AH_TOP([/***** begin user configuration section *****/
3087
3088/* Define this to be the location of your password file */
3089#define PASSWD_FILE "/etc/passwd"
3090
3091/* Define this to be the name of your NIS/YP password *
3092 * map (if applicable)                                */
3093#define PASSWD_MAP "passwd.byname"
3094
3095/* Define to 1 if you want user names to be cached */
3096#define CACHE_USERNAMES 1
3097
3098/* Define to 1 if system supports job control */
3099#define JOB_CONTROL 1
3100
3101/* Define this if you use "suspended" instead of "stopped" */
3102#define USE_SUSPENDED 1
3103 
3104/* The default history buffer size in lines */
3105#define DEFAULT_HISTSIZE 30
3106
3107/* The default editor for the fc builtin */
3108#define DEFAULT_FCEDIT "vi"
3109
3110/* The default prefix for temporary files */
3111#define DEFAULT_TMPPREFIX "/tmp/zsh"
3112
3113/***** end of user configuration section            *****/
3114/***** shouldn't have to change anything below here *****/
3115
3116])
3117
3118CLEAN_MK="${srcdir}/Config/clean.mk"
3119CONFIG_MK="${srcdir}/Config/config.mk"
3120dnl defs.mk is in the build tree, not the source tree
3121DEFS_MK="Config/defs.mk"
3122VERSION_MK="${srcdir}/Config/version.mk"
3123
3124AC_SUBST_FILE(CLEAN_MK)dnl
3125AC_SUBST_FILE(CONFIG_MK)dnl
3126AC_SUBST_FILE(DEFS_MK)dnl
3127AC_SUBST_FILE(VERSION_MK)dnl
3128
3129AC_CONFIG_FILES(Config/defs.mk Makefile Doc/Makefile Etc/Makefile \
3130Src/Makefile Test/Makefile)
3131AC_CONFIG_COMMANDS([config.modules], [. ./config.modules.sh])
3132AC_CONFIG_COMMANDS([stamp-h], [echo >stamp-h])
3133
3134AC_OUTPUT
3135
3136eval "zshbin1=${bindir}"
3137eval "zshbin2=${zshbin1}"
3138eval "zshman=${mandir}"
3139eval "zshinfo=${infodir}"
3140eval "zshfndir=${fndir}"
3141
3142echo "
3143zsh configuration
3144-----------------
3145zsh version               : ${VERSION}
3146host operating system     : ${host_cpu}-${host_vendor}-${host_os}
3147source code location      : ${srcdir}
3148compiler                  : ${CC}
3149preprocessor flags        : ${CPPFLAGS}
3150executable compiler flags : ${CFLAGS}"
3151if test "x$dynamic" = xyes; then
3152  echo "\
3153module compiler flags     : ${CFLAGS} ${DLCFLAGS}"
3154fi
3155echo "\
3156executable linker flags   : ${LDFLAGS} ${EXELDFLAGS} ${EXTRA_LDFLAGS}"
3157if test "x$dynamic" = xyes; then
3158  echo "\
3159module linker flags       : ${LDFLAGS} ${LIBLDFLAGS} ${DLLDFLAGS}"
3160fi
3161echo "\
3162library flags             : ${LIBS}
3163installation basename     : ${tzsh_name}
3164binary install path       : ${zshbin2}
3165man page install path     : ${zshman}
3166info install path         : ${zshinfo}"
3167if test "$zshfndir" != no; then
3168  echo "functions install path    : ${zshfndir}"
3169fi
3170if test "x$additionalfpath" != x; then
3171  echo "additional fpath entries  : ${additionalfpath}"
3172fi
3173echo "See config.modules for installed modules and functions.
3174"
3175
3176case x$LIBS in
3177  *-lgdbm*)
3178  echo "WARNING: zsh will be linked against libgdbm.
3179This means the binary is covered by the GNU General Public License.
3180This does not affect the source code.
3181Run configure with --disable-gdbm if required."
3182  ;;
3183esac
3184
3185exit 0
3186