File: configure.in

package info (click to toggle)
zsh 3.1.2-8
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 3,628 kB
  • ctags: 3,582
  • sloc: ansic: 39,480; sh: 2,393; makefile: 1,189; perl: 329; awk: 257; sed: 25
file content (1024 lines) | stat: -rw-r--r-- 30,888 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
dnl
dnl  $Id: configure.in,v 3.1.2.10 1997/05/29 04:49:53 hzoli Exp $
dnl
dnl  Configure template for zsh.
dnl  Process this file with autoconf to produce a configure script.
dnl
dnl  Copyright (c) 1995-1997 Richard Coleman
dnl  All rights reserved.
dnl
dnl  Permission is hereby granted, without written agreement and without
dnl  license or royalty fees, to use, copy, modify, and distribute this
dnl  software and to distribute modified versions of this software for any
dnl  purpose, provided that the above copyright notice and the following
dnl  two paragraphs appear in all copies of this software.
dnl
dnl  In no event shall Richard Coleman or the Zsh Development Group be liable
dnl  to any party for direct, indirect, special, incidental, or consequential
dnl  damages arising out of the use of this software and its documentation,
dnl  even if Richard Coleman and the Zsh Development Group have been advised of
dnl  the possibility of such damage.
dnl
dnl  Richard Coleman and the Zsh Development Group specifically disclaim any
dnl  warranties, including, but not limited to, the implied warranties of
dnl  merchantability and fitness for a particular purpose.  The software
dnl  provided hereunder is on an "as is" basis, and Richard Coleman and the
dnl  Zsh Development Group have no obligation to provide maintenance,
dnl  support, updates, enhancements, or modifications.

AC_INIT(Src/zsh.h)
AC_CONFIG_HEADER(config.h)

dnl What version of zsh are we building ?
VERSION=`sed -e 's/^.*"\(.*\)"$/\1/' ${srcdir}/Src/version.h`
echo "configuring for zsh $VERSION"
AC_SUBST(VERSION)dnl

dnl ----------------------------------------------
dnl CHECK FOR MACHINE/VENDOR/OPERATING SYSTEM TYPE
dnl ----------------------------------------------
dnl Find out machine type, vendor, and operating system
dnl What type of host is this?
AC_CANONICAL_HOST
AC_DEFINE_UNQUOTED(OSTYPE,   "$host_os")
AC_DEFINE_UNQUOTED(MACHTYPE, "$host_cpu")
AC_DEFINE_UNQUOTED(VENDOR,   "$host_vendor")

dnl -----------------------------
dnl CHECKING COMMAND LINE OPTIONS
dnl -----------------------------
dnl Do you want to debug zsh?
undefine([zsh-debug])dnl
AC_ARG_ENABLE(zsh-debug,
[  --enable-zsh-debug         use it if you want to debug zsh],
[if test x$enableval = xyes; then
  AC_DEFINE(DEBUG)
fi])

dnl Do you want zsh memory allocation routines.
undefine([zsh-mem])dnl
AC_ARG_ENABLE(zsh-mem,
[  --enable-zsh-mem           use zsh memory allocation routines],
[if test x$enableval = xyes; then
  AC_DEFINE(ZSH_MEM)
fi])

dnl Do you want to debug zsh memory allocation routines.
undefine([zsh-mem-debug])dnl
AC_ARG_ENABLE(zsh-mem-debug,
[  --enable-zsh-mem-debug     debug zsh memory allocation routines],
[if test x$enableval = xyes; then
  AC_DEFINE(ZSH_MEM_DEBUG)
fi])

dnl Do you want to print warnings when errors in memory allocation.
undefine([zsh-mem-warning])dnl
AC_ARG_ENABLE(zsh-mem-warning,
[  --enable-zsh-mem-warning   print warnings when error in memory allocation],
[if test x$enableval = xyes; then
  AC_DEFINE(ZSH_MEM_WARNING)
fi])

dnl Do you want to turn on error checking for free().
undefine([zsh-secure-free])dnl
AC_ARG_ENABLE(zsh-secure-free,
[  --enable-zsh-secure-free   turn on error checking for free()],
[if test x$enableval = xyes; then
  AC_DEFINE(ZSH_SECURE_FREE)
fi])

dnl Do you want debugging information on internal hash tables.
dnl This turns on the `hashinfo' builtin command.
undefine([zsh-hash-debug])dnl
AC_ARG_ENABLE(zsh-hash-debug,
[  --enable-zsh-hash-debug    turn on debugging of internal hash tables],
[if test x$enableval = xyes; then
  AC_DEFINE(ZSH_HASH_DEBUG)
fi])

dnl Pathnames for global zsh scripts
undefine([zshenv])dnl
AC_ARG_ENABLE(etcdir,
[  --enable-etcdir=directory  default directory for global zsh scripts],
[etcdir="$enableval"], [etcdir=/etc])

undefine([zshenv])dnl
AC_ARG_ENABLE(zshenv,
[  --enable-zshenv=pathname   the full pathname of the global zshenv script],
[zshenv="$enableval"],
[if test "x$etcdir" = xno; then
  zshenv=no
else
  zshenv="$etcdir/zshenv"
fi])
if test "x$zshenv" != xno; then
  AC_DEFINE_UNQUOTED(GLOBAL_ZSHENV, "$zshenv")
fi

undefine([zshrc])dnl
AC_ARG_ENABLE(zshrc,
[  --enable-zshrc=pathname    the full pathname of the global zshrc script],
[zshrc="$enableval"],
[if test "x$etcdir" = xno; then
  zshrc=no
else
  zshrc="$etcdir/zshrc"
fi])
if test "x$zshrc" != xno; then
  AC_DEFINE_UNQUOTED(GLOBAL_ZSHRC, "$zshrc")
fi

undefine([zprofile])dnl
AC_ARG_ENABLE(zprofile,
[  --enable-zprofile=pathname the full pathname of the global zprofile script],
[zprofile="$enableval"],
[if test "x$etcdir" = xno; then
  zprofile=no
else
  zprofile="$etcdir/zprofile"
fi])
if test "x$zprofile" != xno; then
  AC_DEFINE_UNQUOTED(GLOBAL_ZPROFILE, "$zprofile")
fi

undefine([zlogin])dnl
AC_ARG_ENABLE(zlogin,
[  --enable-zlogin=pathname   the full pathname of the global zlogin script],
[zlogin="$enableval"],
[if test "x$etcdir" = xno; then
  zlogin=no
else
  zlogin="$etcdir/zlogin"
fi])
if test "x$zlogin" != xno; then
  AC_DEFINE_UNQUOTED(GLOBAL_ZLOGIN, "$zlogin")
fi

undefine([zlogout])dnl
AC_ARG_ENABLE(zlogout,
[  --enable-zlogout=pathname  the full pathname of the global zlogout script],
[zlogout="$enableval"],
[if test "x$etcdir" = xno; then
  zlogout=no
else
  zlogout="$etcdir/zlogout"
fi])
if test "x$zlogout" != xno; then
  AC_DEFINE_UNQUOTED(GLOBAL_ZLOGOUT, "$zlogout")
fi

AC_SUBST(zshenv)dnl
AC_SUBST(zshrc)dnl
AC_SUBST(zprofile)dnl
AC_SUBST(zlogin)dnl
AC_SUBST(zlogout)dnl

dnl Do you want dynamically loaded binary modules.
undefine([dynamic])dnl
AC_ARG_ENABLE(dynamic,
[  --enable-dynamic           allow dynamically loaded binary modules],
[dynamic="$enableval"], [dynamic=no])

dnl Do you want to compile as K&R C.
AC_ARG_ENABLE(ansi2knr,
[  --enable-ansi2knr          translate source to K&R C before compiling],
[ansi2knr="$enableval"], [ansi2knr=default])

dnl ------------------
dnl CHECK THE COMPILER
dnl ------------------
dnl We want these before the checks, so the checks can modify their values.
test -z "${CFLAGS+set}"  && CFLAGS=  auto_cflags=1
test -z "${LDFLAGS+set}" && LDFLAGS= auto_ldflags=1

AC_PROG_CC

dnl if the user hasn't specified CFLAGS, then
dnl   if compiler is gcc, then use -O2 and some warning flags
dnl   else use -O
if test -n "$auto_cflags"; then
  if test "${enable_zsh_debug}" = yes; then
    if test -n "$GCC"; then
      CFLAGS="$CFLAGS -Wall -Wno-implicit -Wmissing-prototypes -pedantic -ggdb"
    else
      CFLAGS="$CFLAGS -g"
    fi
  else
    if test -n "$GCC"; then
      CFLAGS="$CFLAGS -Wall -Wno-implicit -Wmissing-prototypes -O2"
    else
      CFLAGS="$CFLAGS -O"
    fi
  fi
fi
if test -n "$auto_ldflags"; then
  if test "${enable_zsh_debug}" = yes; then
    LDFLAGS=-g
  else
    LDFLAGS=-s
  fi
fi

dnl ----------
dnl SCO KLUDGE
dnl ----------
dnl Sco doesn't define any useful compiler symbol,
dnl so we will check for sco and define __sco if
dnl found.
if test `echo $host_os | sed 's/^\(...\).*/\1/'` = sco; then
  CFLAGS="-D__sco $CFLAGS"
fi

sed=':1
     s/ -s / /g
     t1
     s/^ *//
     s/ *$//'

case " $LDFLAGS " in
  *" -s "*) strip_exeldflags=true strip_libldflags=true
    LDFLAGS=`echo " $LDFLAGS " | sed "$sed"` ;;
  *) strip_exeldflags=false strip_libldflags=false ;;
esac

case " ${EXELDFLAGS+$EXELDFLAGS }" in
  " ") ;;
  *" -s "*) strip_exeldflags=true
    EXELDFLAGS=`echo " $EXELDFLAGS " | sed "$sed"` ;;
  *) strip_exeldflags=false ;;
esac

case " ${LIBLDFLAGS+$LIBLDFLAGS }" in
  " ") ;;
  *" -s "*) strip_libldflags=true
    LIBLDFLAGS=`echo " $LIBLDFLAGS " | sed "$sed"` ;;
  *) strip_libldflags=false ;;
esac

AC_SUBST(CFLAGS)dnl
AC_SUBST(LDFLAGS)dnl
AC_SUBST(EXELDFLAGS)dnl
AC_SUBST(LIBLDFLAGS)dnl

AC_PROG_CPP                 dnl Figure out how to run C preprocessor.
AC_PROG_GCC_TRADITIONAL     dnl Do we need -traditional flag for gcc.
AC_C_CONST                  dnl Does compiler support `const'.

fp_PROG_CC_STDC
AC_MSG_CHECKING([whether to use prototypes])
if test ."$ansi2knr" = .yes || test ."$ansi2knr" = .no; then
  msg="(overridden) "
else
  msg=
  if test ."$fp_cv_prog_cc_stdc" = .no; then
    ansi2knr=yes
  else
    ansi2knr=no
  fi
fi
if test "$ansi2knr" = yes; then
  AC_MSG_RESULT(${msg}no)
  U=_
else
  AC_MSG_RESULT(${msg}yes)
  AC_DEFINE(PROTOTYPES)
  U=
fi
AC_SUBST(U)

AC_CHECK_SIZEOF(long, 8)    dnl Number of bytes in a long.
AC_FUNC_ALLOCA              dnl Check how to get `alloca'.

dnl If the compiler supports union initialisation
AC_CACHE_CHECK(if the compiler supports union initialisation,
zsh_cv_c_have_union_init,
[AC_TRY_COMPILE([union{void *p;long l;}u={0};], [u.l=1;],
  zsh_cv_c_have_union_init=yes,
  zsh_cv_c_have_union_init=no)])
if test $zsh_cv_c_have_union_init = yes; then
  AC_DEFINE(HAVE_UNION_INIT)
fi

dnl  Checking if compiler correctly cast signed to unsigned.
AC_CACHE_CHECK(if signed to unsigned casting is broken,
zsh_cv_c_broken_signed_to_unsigned_casting,
[AC_TRY_RUN([main(){return((int)(unsigned char)((char) -1) == 255);}],
  zsh_cv_c_broken_signed_to_unsigned_casting=yes,
  zsh_cv_c_broken_signed_to_unsigned_casting=no,
  zsh_cv_c_broken_signed_to_unsigned_casting=no)])
if test $zsh_cv_c_broken_signed_to_unsigned_casting = yes; then
  AC_DEFINE(BROKEN_SIGNED_TO_UNSIGNED_CASTING)
fi

dnl Checking if the compiler supports variable-length arrays
AC_CACHE_CHECK(if the compiler supports variable-lenth arrays,
zsh_cv_c_variable_length_arrays,
[AC_TRY_COMPILE([int foo();], [int i[foo()];],
  zsh_cv_c_variable_length_arrays=yes,
  zsh_cv_c_variable_length_arrays=no)])
if test $zsh_cv_c_variable_length_arrays = yes; then
  AC_DEFINE(HAVE_VARIABLE_LENGTH_ARRAYS)
fi

dnl ------------------
dnl CHECK FOR PROGRAMS
dnl ------------------
AC_PROG_MAKE_SET            dnl Does make define $MAKE
AC_PROG_INSTALL             dnl Check for BSD compatible `install'
AC_PROG_AWK                 dnl Check for mawk,gawk,nawk, then awk.
AC_CHECK_PROGS([YODL], [yodl], [:])

dnl ------------------
dnl CHECK HEADER FILES
dnl ------------------
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_TIME
AC_HEADER_STAT
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(sys/time.h sys/times.h sys/select.h termcap.h termio.h \
		 termios.h sys/param.h sys/filio.h string.h memory.h \
		 limits.h fcntl.h libc.h sys/utsname.h sys/resource.h \
		 locale.h errno.h stdlib.h unistd.h sys/capability.h)
if test $dynamic = yes; then
  AC_CHECK_HEADERS(dlfcn.h)
fi

dnl Some SCO systems cannot include both sys/time.h and sys/select.h
if test $ac_cv_header_sys_time_h = yes -a $ac_cv_header_sys_select_h = yes; then
  AC_CACHE_CHECK(for conflicts in sys/time.h and sys/select.h,
  zsh_cv_header_time_h_select_h_conflicts,
  [AC_TRY_COMPILE([#include <sys/time.h>
#include <sys/select.h>], [int i;],
  zsh_cv_header_time_h_select_h_conflicts=no,
  zsh_cv_header_time_h_select_h_conflicts=yes)])
  if test $zsh_cv_header_time_h_select_h_conflicts = yes; then
    AC_DEFINE(TIME_H_SELECT_H_CONFLICTS)
  fi
fi

AC_CACHE_CHECK(ut_host in struct utmp, zsh_cv_struct_utmp_ut_host,
[AC_TRY_COMPILE(
[#include <sys/types.h>
#include <utmp.h>], [struct utmp ut; ut.ut_host;],
zsh_cv_struct_utmp_ut_host=yes, zsh_cv_struct_utmp_ut_host=no)])
if test $zsh_cv_struct_utmp_ut_host = yes; then
  have_ut_host=1
  AC_DEFINE(HAVE_UT_HOST)
fi

if test -z "$have_ut_host"; then
  AC_CACHE_CHECK(ut_host in struct utmpx, zsh_cv_struct_utmpx_ut_host,
  [AC_TRY_COMPILE([#include <sys/types.h>
#include <utmpx.h>], [struct utmpx ut; ut.ut_host;],
  zsh_cv_struct_utmpx_ut_host=yes, zsh_cv_struct_utmpx_ut_host=no)])
  if test $zsh_cv_struct_utmpx_ut_host = yes; then
    AC_DEFINE(HAVE_UTMPX_H)
    AC_DEFINE(HAVE_UT_HOST)
  fi
fi

AC_CACHE_CHECK(POSIX termios, zsh_cv_sys_posix_termios,
[AC_TRY_LINK([#include <sys/types.h>
#include <unistd.h>
#include <termios.h>],
[/* SunOS 4.0.3 has termios.h but not the library calls.  */
tcgetattr(0, 0);],
  zsh_cv_sys_posix_termios=yes, zsh_cv_sys_posix_termios=no)])

if test $zsh_cv_sys_posix_termios = yes; then
  AC_CACHE_CHECK(TIOCGWINSZ in termios.h,
  zsh_cv_header_termios_h_tiocgwinsz,
  [AC_TRY_LINK([#include <sys/types.h>
#include <termios.h>],
  [int x = TIOCGWINSZ;],
  zsh_cv_header_termios_h_tiocgwinsz=yes,
  zsh_cv_header_termios_h_tiocgwinsz=no)])
else
  zsh_cv_header_termios_h_tiocgwinsz=no
fi
 
if test $zsh_cv_header_termios_h_tiocgwinsz = no; then
  AC_CACHE_CHECK(TIOCGWINSZ in sys/ioctl.h,
  zsh_cv_header_sys_ioctl_h_tiocgwinsz,
  [AC_TRY_LINK([#include <sys/types.h>
#include <sys/ioctl.h>],
  [int x = TIOCGWINSZ;],
  zsh_cv_header_sys_ioctl_h_tiocgwinsz=yes,
  zsh_cv_header_sys_ioctl_h_tiocgwinsz=no)])
  if test $zsh_cv_header_sys_ioctl_h_tiocgwinsz = yes; then
    AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
  fi
fi
 
AC_CHECK_HEADER([sys/ptem.h], AC_DEFINE(WINSIZE_IN_PTEM))

dnl -------------------
dnl CHECK FOR LIBRARIES
dnl -------------------
dnl Prefer BSD termcap library to SysV curses library, except on certain
dnl versions of AIX and HP-UX.
if test `echo $host_os | sed 's/^.*\(aix\)[[1-9]]\.[[0-9]].*$/\1/'` = aix ||
    test `echo $host_os | sed 's/^.*\(hpux\)10\..*$/\1/'` = hpux; then
  termcap_curses_order="curses ncurses termcap"
else
  termcap_curses_order="termcap curses ncurses"
fi

for lib in $termcap_curses_order; do
  AC_CHECK_LIB(${lib}, tgetent, [LIBS="$LIBS -l$lib"; break])
done

dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
dnl to find getdomainname and yp_all
AC_CHECK_FUNCS(getdomainname)
if test $ac_cv_func_getdomainname = no; then
  AC_CHECK_LIB(nsl, getdomainname)
fi

dnl I am told that told that unicos reqire these for nis_list
if test `echo $host_os | sed 's/^\(unicos\).*/\1/'` = unicos; then
  LIBS="-lcraylm -lkrb -lnisdb -lnsl -lrpcsvc $LIBS"
fi

if test "x$dynamic" = xyes; then
  AC_CHECK_LIB(dl, dlopen)
fi

AC_CHECK_LIB(cap, cap_init)

dnl ---------------------
dnl CHECK TERMCAP LIBRARY
dnl ---------------------
dnl Checks for external variable ospeed in the termcap library.
AC_CACHE_CHECK(if an include file defines ospeed,
zsh_cv_decl_ospeed_include_defines,
[AC_TRY_LINK(
[#include <sys/types.h>
#if HAVE_TERMIOS_H
#include <termios.h>
#endif
#if HAVE_TERMCAP_H
#include <termcap.h>
#endif], [ospeed = 0;],
zsh_cv_decl_ospeed_include_defines=yes,
zsh_cv_decl_ospeed_include_defines=no)])

if test $zsh_cv_decl_ospeed_include_defines = no; then
  AC_CACHE_CHECK(if you must define ospeed,
  zsh_cv_decl_ospeed_must_define,
  [AC_TRY_LINK( ,[extern short ospeed; ospeed = 0;],
  zsh_cv_decl_ospeed_must_define=yes,
  zsh_cv_decl_ospeed_must_define=no)])
fi

if test $zsh_cv_decl_ospeed_include_defines = yes; then
  AC_DEFINE(HAVE_OSPEED)
elif test $zsh_cv_decl_ospeed_must_define = yes; then
  AC_DEFINE(HAVE_OSPEED)
  AC_DEFINE(MUST_DEFINE_OSPEED)
fi

dnl  Check if tgetent accepts NULL (and will allocate its own termcap buffer)
AC_CACHE_CHECK(if tgetent accepts NULL,
zsh_cv_func_tgetent_accepts_null,
[AC_TRY_RUN([main(){int i = tgetent((char*)0,"vt100");exit(!i || i == -1);}],
  zsh_cv_func_tgetent_accepts_null=yes,
  zsh_cv_func_tgetent_accepts_null=no,
  zsh_cv_func_tgetent_accepts_null=no)])
if test $zsh_cv_func_tgetent_accepts_null = yes; then
  AC_DEFINE(TGETENT_ACCEPTS_NULL)
fi

dnl --------------
dnl CHECK TYPEDEFS
dnl --------------
AC_TYPE_SIGNAL
AC_TYPE_PID_T
AC_TYPE_OFF_T
AC_TYPE_MODE_T
AC_TYPE_UID_T
AC_TYPE_SIZE_T

dnl Check for sigset_t.  Currently I'm looking in
dnl <sys/types.h> and <signal.h>.  Others might need
dnl to be added.
AC_CACHE_CHECK(for sigset_t, zsh_cv_type_sigset_t,
[AC_TRY_COMPILE(
[#include <sys/types.h>
#include <signal.h>], [sigset_t tempsigset;],
  zsh_cv_type_sigset_t=yes, zsh_cv_type_sigset_t=no)])
if test $zsh_cv_type_sigset_t = no; then
  AC_DEFINE(sigset_t, unsigned int)
fi

dnl Check for struct timezone since some old SCO versions do not define it
AC_CACHE_CHECK(for struct timezone, zsh_cv_struct_timezone,
[AC_TRY_COMPILE(
[#include <sys/time.h>], [struct timezone dummy_tz;],
  zsh_cv_struct_timezone=yes, zsh_cv_struct_timezone=no)])
if test $zsh_cv_struct_timezone = yes; then
  AC_DEFINE(HAVE_STRUCT_TIMEZONE)
fi

dnl ---------------
dnl CHECK FUNCTIONS
dnl ---------------
AC_FUNC_GETPGRP
AC_FUNC_STRCOLL

dnl need to integrate this function
dnl AC_FUNC_STRFTIME

AC_CHECK_FUNCS(memcpy memmove \
              strftime waitpid select tcsetpgrp tcgetattr strstr lstat \
              getlogin setpgid gettimeofday gethostname mkfifo wait3 difftime \
              sigblock sigsetmask sigrelse sighold killpg sigaction getrlimit \
              sigprocmask setuid seteuid setreuid setresuid setsid strerror \
              nis_list initgroups fchdir cap_init)
if test $dynamic = yes; then
  AC_CHECK_FUNCS(dlopen dlerror dlsym dlclose)
fi


dnl -------------
dnl CHECK SIGNALS
dnl -------------
dnl What style of signal do you have (POSIX, BSD, or SYSV)?
AC_MSG_CHECKING(what style of signals to use)
if test $ac_cv_func_sigaction = yes -a $ac_cv_func_sigprocmask = yes; then
  signals_style=POSIX_SIGNALS
  AC_DEFINE(POSIX_SIGNALS)
elif test $ac_cv_func_sigblock = yes -a $ac_cv_func_sigsetmask = yes; then
  signals_style=BSD_SIGNALS
  AC_DEFINE(BSD_SIGNALS)
elif test $ac_cv_func_sighold = yes -a $ac_cv_func_sigrelse = yes; then
  signals_style=SYSV_SIGNALS
  AC_DEFINE(SYSV_SIGNALS)
else
  signals_style=NO_SIGNAL_BLOCKING
  AC_DEFINE(NO_SIGNAL_BLOCKING)
fi
AC_DEFINE_UNQUOTED($signals_style)
AC_MSG_RESULT($signals_style)

dnl Where is <signal.h> located?  Needed as input for signals.awk
AC_CACHE_CHECK(where signal.h is located, zsh_cv_path_signal_h,
[for SIGNAL_H in /usr/include/bsd/sys/signal.h  dnl Next
                 /usr/include/asm/signum.h      dnl alpha-Linux
                 /usr/include/asm/signal.h      dnl Linux 1.3.0 and above
                 /usr/include/linux/signal.h    dnl Linux up to 1.2.11
                 /usr/include/sys/signal.h      dnl Almost everybody else
                 /dev/null;                     dnl Just in case we fall through
do
  test -f $SIGNAL_H && \
  grep '#[ 	]*define[ 	][ 	]*SIG[0-9A-Z]*[ 	]*[0-9][0-9]*' $SIGNAL_H > /dev/null && \
  break
done
zsh_cv_path_signal_h=$SIGNAL_H
])
SIGNAL_H=$zsh_cv_path_signal_h
AC_SUBST(SIGNAL_H)dnl

dnl -----------------------------------------------------
dnl Look for the file containing the RLIMIT_* definitions
dnl -----------------------------------------------------
dnl CALL FOR MORE (FEWER?) LOCATIONS:  I've just copied the signal checking.
AC_CACHE_CHECK(where the RLIMIT macros are located,zsh_cv_path_rlimit_h,
[for RESOURCE_H in /usr/include/bsd/sys/resource.h   dnl
                   /usr/include/asm/resource.h	     dnl
                   /usr/include/linux/resource.h     dnl
                   /usr/include/sys/resource.h       dnl
                   /usr/include/resourcebits.h       dnl
                   /dev/null;
do
  test -f $RESOURCE_H && \
  grep '#[ 	]*define[ 	][ 	]*RLIMIT_[A-Z]*[ 	]*[0-9A-Z][0-9]*' $RESOURCE_H > /dev/null && \
  break
done
zsh_cv_path_rlimit_h=$RESOURCE_H
if test $RESOURCE_H = "/dev/null" -a $ac_cv_func_getrlimit = yes; then
  echo "RLIMIT MACROS NOT FOUND:  please report to developers"
fi])
RLIMITS_INC_H=$zsh_cv_path_rlimit_h
dnl rlimits.h only appears in dependencies if we are actually using it.
dnl We are using it any time we have getrlimit, though if the macros were
dnl not found we simply awk through /dev/null and fail to find them.
dnl Thus, limit won't work, but at least the shell will compile.
AC_SUBST(RLIMITS_INC_H)dnl

dnl ------------------
dnl rlimit type checks
dnl ------------------
DEFAULT_RLIM_T=long
AC_CACHE_CHECK(if rlim_t is quad_t,
zsh_cv_rlim_t_is_quad_t,
[AC_TRY_RUN([
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <sys/resource.h>
main(){struct rlimit r;exit(sizeof(r.rlim_cur) <= sizeof(long));}],
zsh_cv_rlim_t_is_quad_t=yes,
zsh_cv_rlim_t_is_quad_t=no,
zsh_cv_rlim_t_is_quad_t=yes)])
if test $zsh_cv_rlim_t_is_quad_t = yes; then
  AC_DEFINE(RLIM_T_IS_QUAD_T)
  DEFAULT_RLIM_T=quad_t
else
  AC_CACHE_CHECK(if the rlim_t is unsigned,
  zsh_cv_type_rlim_t_is_unsigned,
  [AC_TRY_RUN([
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <sys/resource.h>
  main(){struct rlimit r;r.rlim_cur=-1;exit(r.rlim_cur<0);}],
  zsh_cv_type_rlim_t_is_unsigned=yes,
  zsh_cv_type_rlim_t_is_unsigned=no,
  zsh_cv_type_rlim_t_is_unsigned=no)])
  if test $zsh_cv_type_rlim_t_is_unsigned = yes; then
    AC_DEFINE(RLIM_T_IS_UNSIGNED)
    DEFAULT_RLIM_T="unsigned $DEFAULT_RLIM_T"
  fi
fi

AC_CACHE_CHECK(for rlim_t, zsh_cv_type_rlim_t,
[AC_TRY_COMPILE([
#include <sys/types.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <sys/resource.h>],
[rlim_t l;],
zsh_cv_type_rlim_t=yes,
zsh_cv_type_rlim_t=no)])
if test $zsh_cv_type_rlim_t = no; then
  AC_DEFINE_UNQUOTED(rlim_t, $DEFAULT_RLIM_T)
fi

dnl ----------------------------
dnl CHECK FOR /dev/fd FILESYSTEM
dnl ----------------------------
AC_CACHE_CHECK(for /dev/fd filesystem, zsh_cv_sys_path_dev_fd,
[for zsh_cv_sys_path_dev_fd in /proc/self/fd /dev/fd no; do
   test x`echo ok|cat $zsh_cv_sys_path_dev_fd/0 2>/dev/null` = xok && break
 done])
if test $zsh_cv_sys_path_dev_fd != no; then
  AC_DEFINE_UNQUOTED(PATH_DEV_FD, "$zsh_cv_sys_path_dev_fd")
fi

dnl ---------------------------------
dnl CHECK FOR RFS SUPERROOT DIRECTORY
dnl ---------------------------------
AC_CACHE_CHECK(for RFS superroot directory, zsh_cv_sys_superroot,
[test -d /../.LOCALROOT && zsh_cv_sys_superroot=yes || zsh_cv_sys_superroot=no])
if test $zsh_cv_sys_superroot = yes; then
  AC_DEFINE(HAVE_SUPERROOT)
fi

dnl -------------
dnl CHECK FOR NIS
dnl -------------
AC_CACHE_CHECK(for NIS, zsh_cv_sys_nis,
[test -f /usr/bin/ypcat && /usr/bin/ypcat passwd.byname > /dev/null 2>&1 && \
zsh_cv_sys_nis=yes || zsh_cv_sys_nis=no])
if test $zsh_cv_sys_nis = yes; then
  AC_DEFINE(HAVE_NIS)
fi

dnl -----------------
dnl CHECK FOR NISPLUS
dnl -----------------
AC_CACHE_CHECK(for NIS+, zsh_cv_sys_nis_plus,
[test $ac_cv_func_nis_list = yes && test -f /usr/bin/nisls && \
 /usr/bin/nisls > /dev/null 2>&1 && \
zsh_cv_sys_nis_plus=yes || zsh_cv_sys_nis_plus=no])
if test $zsh_cv_sys_nis_plus = yes; then
  AC_DEFINE(HAVE_NIS_PLUS)
fi

dnl -------------------------------
dnl CHECK FOR LOCATION OF UTMP FILE
dnl -------------------------------
AC_CACHE_CHECK(where utmp is located, zsh_cv_path_utmp,
[for utmp_file in /etc/utmp      dnl
                 /usr/etc/utmp   dnl
                 /var/adm/utmp   dnl
                 /usr/adm/utmp   dnl
                 /var/run/utmp   dnl
                 /dev/null;      dnl Just in case we fall through
do
  test -f $utmp_file && break
done
zsh_cv_path_utmp=$utmp_file
])
AC_DEFINE_UNQUOTED(UTMP_FILE_CONFIG, "$zsh_cv_path_utmp")

dnl -------------------------------
dnl CHECK FOR LOCATION OF WTMP FILE
dnl -------------------------------
AC_CACHE_CHECK(where wtmp is located, zsh_cv_path_wtmp,
[for wtmp_file in /etc/wtmp     dnl
                 /usr/etc/wtmp  dnl
                 /var/adm/wtmp  dnl
                 /usr/adm/wtmp  dnl
                 /var/log/wtmp  dnl
                 /dev/null;     dnl Just in case we fall through
do
  test -f $wtmp_file && break
done
zsh_cv_path_wtmp=$wtmp_file
])
AC_DEFINE_UNQUOTED(WTMP_FILE_CONFIG, "$zsh_cv_path_wtmp")

dnl ----------------
dnl TYPEAHEAD KLUDGE
dnl ----------------
dnl Some systems clobber typeahead when you go from canonical input
dnl processing to non-canonical, so we need a FIONREAD ioctl.
dnl I don't know how to check this with configure, so I am using the
dnl system names directly.
dnl The doubled square brackets are necessary because autoconf uses m4.
AC_CACHE_CHECK(if typeahead needs FIONREAD, zsh_cv_sys_clobbers_typeahead,
[case x-$host_os in
    x-ultrix* | x-dgux*)
	zsh_cv_sys_clobbers_typeahead=yes;;
    *)
	zsh_cv_sys_clobbers_typeahead=no;;
esac])
if test $zsh_cv_sys_clobbers_typeahead = yes; then
  AC_DEFINE(CLOBBERS_TYPEAHEAD)
fi

dnl -------------------
dnl brk/sbrk PROTOTYPES
dnl -------------------
AC_CACHE_CHECK(for brk() prototype in <unistd.h>,
zsh_cv_header_unistd_h_brk_proto,
[AC_TRY_COMPILE([#include <unistd.h>
double brk();], [int i;],
zsh_cv_header_unistd_h_brk_proto=no, zsh_cv_header_unistd_h_brk_proto=yes)])
if test $zsh_cv_header_unistd_h_brk_proto = yes; then
  AC_DEFINE(HAVE_BRK_PROTO)
fi

AC_CACHE_CHECK(for sbrk() prototype in <unistd.h>,
zsh_cv_header_unistd_h_sbrk_proto,
[AC_TRY_COMPILE([#include <unistd.h>
double sbrk();], [int i;],
zsh_cv_header_unistd_h_sbrk_proto=no, zsh_cv_header_unistd_h_sbrk_proto=yes)])
if test $zsh_cv_header_unistd_h_sbrk_proto = yes; then
  AC_DEFINE(HAVE_SBRK_PROTO)
fi

dnl ------------------------
dnl ioctl prototypes for OSF
dnl ------------------------

if test "$ac_cv_prog_cc_stdc" != no; then
  AC_CACHE_CHECK(for ioctl prototype in <sys/ioctl.h>,
  zsh_cv_header_sys_ioctl_h_ioctl_proto,
  [AC_TRY_COMPILE([#include <sys/ioctl.h>
   int ioctl(double x);], [int i;],
  zsh_cv_header_sys_ioctl_h_ioctl_proto=no,
  zsh_cv_header_sys_ioctl_h_ioctl_proto=yes)])
  if test $zsh_cv_header_sys_ioctl_h_ioctl_proto = yes; then
    AC_DEFINE(HAVE_IOCTL_PROTO)
  fi
fi

dnl -----------
dnl named FIFOs
dnl -----------
AC_CACHE_CHECK(if named FIFOs work,
zsh_cv_sys_fifo,
[AC_TRY_RUN([
#include <fcntl.h>
#include <signal.h>
main()
{
    char c;
    int fd;
    int pid, ret;
    unlink("/tmp/fifo$$");
#ifdef HAVE_MKFIFO
    if(mkfifo("/tmp/fifo$$", 0600) < 0)
#else
    if(mknod("/tmp/fifo$$", 0010600, 0) < 0)
#endif
	exit(1);
    pid = fork();
    if(pid < 0)
	exit(1);
    if(pid) {
	fd = open("/tmp/fifo$$", O_RDONLY);
	exit(fd < 0 || read(fd, &c, 1) != 1 || c != 'x');
    }
    fd = open("/tmp/fifo$$", O_WRONLY);
    ret = (fd < 0 || write(fd, "x", 1) < 1);
    unlink("/tmp/fifo$$");
    exit(ret);
}
],
  zsh_cv_sys_fifo=yes,
  zsh_cv_sys_fifo=no,
  zsh_cv_sys_fifo=yes)])
if test $zsh_cv_sys_fifo = yes; then
  AC_DEFINE(HAVE_FIFOS)
fi
dnl ---------------------
dnl echo style of /bin/sh
dnl ---------------------
AC_CACHE_CHECK(if echo in /bin/sh interprets escape sequences,
zsh_cv_prog_sh_echo_escape,
[if test "`/bin/sh -c \"echo '\\n'\"`" = "\\n"; then
  zsh_cv_prog_sh_echo_escape=no
else
  zsh_cv_prog_sh_echo_escape=yes
fi])
if test $zsh_cv_prog_sh_echo_escape = no; then
  AC_DEFINE(SH_USE_BSD_ECHO)
fi

dnl ---------------
dnl dynamic loading
dnl ---------------
L=N
if test "$ac_cv_func_dlopen" != yes; then
  dynamic=no
elif test "$ac_cv_func_dlsym" != yes; then
  dynamic=no
elif test "$ac_cv_func_dlerror" != yes; then
  dynamic=no
fi
if test "x$dynamic" = xyes; then
  AC_CACHE_CHECK(if your system use ELF binaries,
   zsh_cv_sys_elf,
   [AC_TRY_RUN([/* Test for whether ELF binaries are produced */
#include <fcntl.h>
#include <stdlib.h>
main(argc, argv)
int argc;
char *argv[];
{
	char b[4];
	int i = open(argv[0],O_RDONLY);
	if(i == -1) 
		exit(1); /* fail */
	if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
		exit(0); /* succeed (yes, it's ELF) */
	else
		exit(1); /* fail */
}],
  zsh_cv_sys_elf=yes,
  zsh_cv_sys_elf=no,
  zsh_cv_sys_elf=yes)])
  DL_EXT="${DL_EXT=so}"
  if test $zsh_cv_sys_elf = yes; then
    DLLD="${DLLD=$CC}"
  else
    DLLD="${DLLD=ld}"
  fi
  if test -n "$GCC"; then
    DLCFLAGS="${DLCFLAGS=-fpic}"
  else
    case "$host_os" in
      hpux*)                 DLCFLAGS="${DLCFLAGS=+z}" ;;
      sunos*)                DLCFLAGS="${DLCFLAGS=-pic}" ;;
      solaris*|sysv4*|esix*) DLCFLAGS="${DLCFLAGS=-Kpic}" ;;
    esac
  fi
  case "$host_os" in
    hpux*)        DLLDFLAGS="${DLLDFLAGS=-b}" ;;
    linux*|irix*) DLLDFLAGS="${DLLDFLAGS=-shared}" ;;
    solaris*)     DLLDFLAGS="${DLLDFLAGS=-G}" ;;
    sunos*)       DLLDFLAGS="${DLLDFLAGS=-assert nodefinitions}" ;;
    sysv4*|esix*) DLLDFLAGS="${DLLDFLAGS=-G $ldflags}" ;;
  esac
  case "$host_os" in
    hpux*)  EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-Wl,-E}" ;;
    linux*) EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-rdynamic}" ;;
  esac
  AC_CACHE_CHECK(if your dlsym() needs a leading underscore,
   zsh_cv_func_dlsym_needs_underscore,
   [cat >conftest.c <<EOM
fred () { }
EOM
    $CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest.c 1>&5 2>&5 &&
    $DLLD -o conftest.$DL_EXT $LDFLAGS $DLLDFLAGS conftest.o 1>&5 2>&5 &&
    AC_TRY_RUN([
#include <stdio.h>
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#else
#include <sys/types.h>
#include <nlist.h>
#include <link.h>
#endif
#ifndef RTLD_LAZY
#define RTLD_LAZY 1
#endif

extern int fred() ;

main()
{
    void * handle ;
    void * symbol ;
    FILE *f=fopen("conftestval", "w");
    if (!f) exit(1);
    handle = dlopen("./conftest.$DL_EXT", RTLD_LAZY) ;
    if (handle == NULL) {
        fprintf (f, "dlopen failed") ;
            exit(1);
    }
    symbol = dlsym(handle, "fred") ;
    if (symbol == NULL) {
                /* try putting a leading underscore */
        symbol = dlsym(handle, "_fred") ;
        if (symbol == NULL) {
            fprintf (f, "dlsym failed") ;
                exit(1);
                }
        fprintf (f, "yes") ;
    }
    else
        fprintf (f, "no") ;
    exit(0);
}], zsh_cv_func_dlsym_needs_underscore=`cat conftestval`,
    zsh_cv_func_dlsym_needs_underscore=failed
    dynamic=no,
    zsh_cv_func_dlsym_needs_underscore=no)])
  if test "$zsh_cv_func_dlsym_needs_underscore" = yes; then
    AC_DEFINE(DLSYM_NEEDS_UNDERSCORE)
  fi
fi

if test "x$dynamic" = xyes; then
  zsh_SYS_DYNAMIC_CLASH
  zsh_SYS_DYNAMIC_GLOBAL
  RTLD_GLOBAL_OK=$zsh_cv_sys_dynamic_rtld_global
  zsh_SYS_DYNAMIC_EXECSYMS
  if test "$zsh_cv_sys_dynamic_execsyms" != yes; then
    L=L LIBS="$LIBS -L. -lzsh"
  fi
  zsh_SYS_DYNAMIC_STRIP_EXE
  zsh_SYS_DYNAMIC_STRIP_LIB
  if $strip_exeldflags && test "$zsh_cv_sys_dynamic_strip_exe" = yes; then
    EXELDFLAGS="$EXELDFLAGS -s"
  fi
  if $strip_libldflags && test "$zsh_cv_sys_dynamic_strip_lib" = yes; then
    LIBLDFLAGS="$LIBLDFLAGS -s"
  fi
else
  $strip_exeldflags && EXELDFLAGS="$EXELDFLAGS -s"
  $strip_libldflags && LIBLDFLAGS="$LIBLDFLAGS -s"
  RTLD_GLOBAL_OK=no
fi

if test "x$dynamic" = xyes; then
  D=D
  AC_DEFINE(DYNAMIC)dnl
else
  D=N
fi

AC_DEFINE_UNQUOTED(DL_EXT, "$DL_EXT")dnl
AC_SUBST(D)dnl
AC_SUBST(DL_EXT)dnl
AC_SUBST(DLLD)dnl
AC_SUBST(DLCFLAGS)dnl
AC_SUBST(DLLDFLAGS)dnl
AC_SUBST(EXTRA_LDFLAGS)dnl
AC_SUBST(L)dnl
AC_SUBST(RTLD_GLOBAL_OK)dnl

AC_OUTPUT(Makefile Src/Makefile Doc/Makefile Etc/Makefile Misc/Makefile \
Util/Makefile Functions/Makefile StartupFiles/Makefile, \
[test -z "$CONFIG_HEADERS" || echo > stamp-h])

eval "zshbin1=${bindir}"
eval "zshbin2=${zshbin1}"
eval "zshman=${mandir}"
eval "zshinfo=${infodir}"

echo "
zsh configuration
-----------------
zsh version             : ${VERSION}
host operating system   : ${host_os}
source code location    : ${srcdir}
compiler                : ${CC}
compiler flags          : ${CFLAGS}
executable linker flags : ${LDFLAGS} ${EXELDFLAGS} ${EXTRA_LDFLAGS}"
if test "$dynamic" = yes; then
  echo "\
module linker flags     : ${LDFLAGS} ${LIBLDFLAGS} ${DLLDFLAGS}"
fi
echo "\
binary install path     : ${zshbin2}
man page install path   : ${zshman}
info install path       : ${zshinfo}"
echo ""