~ubuntu-branches/ubuntu/precise/zsh/precise

« back to all changes in this revision

Viewing changes to .pc/debian-changes-4.3.11-4ubuntu1/configure.ac

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Hahler
  • Date: 2011-04-16 00:47:30 UTC
  • mfrom: (2.1.28 sid)
  • Revision ID: james.westby@ubuntu.com-20110416004730-tv8l1pnx9hiz0n1g
Tags: 4.3.11-4ubuntu1
* Merge from debian unstable. (LP: #762286) Remaining changes:
  - debian/zshrc: Enable completions by default, unless
    skip_global_compinit is set

Show diffs side-by-side

added added

removed removed

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