-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.ac
3279 lines (3030 loc) · 107 KB
/
configure.ac
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
dnl
dnl configure.ac: 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.
dnl
AC_INIT
AC_CONFIG_SRCDIR([Src/zsh.h])
AC_PREREQ([2.69])
AC_CONFIG_HEADERS([config.h])
dnl What version of zsh are we building ?
. ${srcdir}/Config/version.mk
echo "configuring for zsh $VERSION"
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(MACHTYPE, "$host_cpu",
[Define to be the machine type (microprocessor class or machine model).])
AC_DEFINE_UNQUOTED(VENDOR, "$host_vendor",
[Define to be a string corresponding the vendor of the machine.])
AC_DEFINE_UNQUOTED(OSTYPE, "$host_os",
[Define to be the name of the operating system.])
dnl -----------------------------
dnl CHECKING COMMAND LINE OPTIONS
dnl -----------------------------
dnl Handle --program-prefix, --program-suffix, etc.
zsh_ARG_PROGRAM
dnl Handle setting of compile flags (CPPFLAGS, CFLAGS, LDFLAGS, LIBS).
zsh_COMPILE_FLAGS($CPPFLAGS, $CFLAGS, $LDFLAGS, $LIBS)
dnl Do you want to debug zsh?
ifdef([zsh-debug],[undefine([zsh-debug])])dnl
AH_TEMPLATE([DEBUG],
[Define to 1 if you want to debug zsh.])
AC_ARG_ENABLE(zsh-debug,
AS_HELP_STRING([--enable-zsh-debug],[compile with debug code and debugger symbols]),
[if test x$enableval = xyes; then
AC_DEFINE(DEBUG)
fi])
dnl Do you want zsh memory allocation routines.
ifdef([zsh-mem],[undefine([zsh-mem])])dnl
AH_TEMPLATE([ZSH_MEM],
[Define to 1 if you want to use zsh's own memory allocation routines])
AC_ARG_ENABLE(zsh-mem,
AS_HELP_STRING([--enable-zsh-mem],[compile with 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.
ifdef([zsh-mem-debug],[undefine([zsh-mem-debug])])dnl
AH_TEMPLATE([ZSH_MEM_DEBUG],
[Define to 1 if you want to debug zsh memory allocation routines.])
AC_ARG_ENABLE(zsh-mem-debug,
AS_HELP_STRING([--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.
AH_TEMPLATE([ZSH_MEM_WARNING],
[Define to 1 if you want to turn on warnings of memory allocation errors])
ifdef([zsh-mem-warning],[undefine([zsh-mem-warning])])dnl
AC_ARG_ENABLE(zsh-mem-warning,
AS_HELP_STRING([--enable-zsh-mem-warning],[print warnings for errors 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().
ifdef([zsh-secure-free],[undefine([zsh-secure-free])])dnl
AH_TEMPLATE([ZSH_SECURE_FREE],
[Define to 1 if you want to turn on memory checking for free().])
AC_ARG_ENABLE(zsh-secure-free,
AS_HELP_STRING([--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 to debug zsh heap allocation?
dnl Does not depend on zsh-mem.
ifdef([zsh-heap-debug],[undefine([zsh-heap-debug])])dnl
AH_TEMPLATE([ZSH_HEAP_DEBUG],
[Define to 1 if you want to turn on error checking for heap allocation.])
AC_ARG_ENABLE(zsh-heap-debug,
AS_HELP_STRING([--enable-zsh-heap-debug],[turn on error checking for heap allocation]),
[if test x$enableval = xyes; then
AC_DEFINE(ZSH_HEAP_DEBUG)
fi])
dnl Do you want to allow Valgrind to debug heap allocation?
ifdef([zsh-valgrind],[undefine([zsh-valgrind])])dnl
AH_TEMPLATE([ZSH_VALGRIND],
[Define to 1 if you want to add code for valgrind to debug heap memory.])
AC_ARG_ENABLE(zsh-valgrind,
AS_HELP_STRING([--enable-zsh-valgrind],[turn on support for valgrind debugging of heap memory]),
[if test x$enableval = xyes; then
AC_DEFINE(ZSH_VALGRIND)
fi])
dnl Do you want debugging information on internal hash tables.
dnl This turns on the `hashinfo' builtin command.
ifdef([zsh-hash-debug],[undefine([zsh-hash-debug])])dnl
AH_TEMPLATE([ZSH_HASH_DEBUG],
[Define to 1 if you want to get debugging information on internal
hash tables. This turns on the `hashinfo' builtin.])
AC_ARG_ENABLE(zsh-hash-debug,
AS_HELP_STRING([--enable-zsh-hash-debug],[turn on debugging of internal hash tables]),
[if test x$enableval = xyes; then
AC_DEFINE(ZSH_HASH_DEBUG)
fi])
dnl Do you want to dynamically allocate memory on the stack where possible?
ifdef([stack-allocation],[undefine([stack-allocation])])dnl
AH_TEMPLATE([USE_STACK_ALLOCATION],
[Define to 1 if you want to allocate stack memory e.g. with `alloca'.])
AC_ARG_ENABLE(stack-allocation,
AS_HELP_STRING([--enable-stack-allocation],[allocate stack memory e.g. with `alloca']),
[if test x$enableval = xyes; then
AC_DEFINE(USE_STACK_ALLOCATION)
fi])
dnl Pathnames for global zsh scripts
ifdef([etcdir],[undefine([etcdir])])dnl
AC_ARG_ENABLE(etcdir,
AS_HELP_STRING([--enable-etcdir=DIR],[the default directory for global zsh scripts]),
[etcdir="$enableval"], [etcdir=/etc])
ifdef([zshenv],[undefine([zshenv])])dnl
AC_ARG_ENABLE(zshenv,
AS_HELP_STRING([--enable-zshenv=FILE],[the full pathname of the global zshenv script]),
[zshenv="$enableval"],
[if test "x$etcdir" = xno; then
zshenv=no
else
zshenv="$etcdir/zshenv"
fi])
AH_TEMPLATE([GLOBAL_ZSHENV],
[The global file to source absolutely first whenever zsh is run;
if undefined, don't source anything.])
if test "x$zshenv" != xno; then
AC_DEFINE_UNQUOTED(GLOBAL_ZSHENV, "$zshenv")
fi
ifdef([zshrc],[undefine([zshrc])])dnl
AC_ARG_ENABLE(zshrc,
AS_HELP_STRING([--enable-zshrc=FILE],[the full pathname of the global zshrc script]),
[zshrc="$enableval"],
[if test "x$etcdir" = xno; then
zshrc=no
else
zshrc="$etcdir/zshrc"
fi])
AH_TEMPLATE([GLOBAL_ZSHRC],
[The global file to source whenever zsh is run;
if undefined, don't source anything])
if test "x$zshrc" != xno; then
AC_DEFINE_UNQUOTED(GLOBAL_ZSHRC, "$zshrc")
fi
ifdef([zprofile],[undefine([zprofile])])dnl
AC_ARG_ENABLE(zprofile,
AS_HELP_STRING([--enable-zprofile=FILE],[the full pathname of the global zprofile script]),
[zprofile="$enableval"],
[if test "x$etcdir" = xno; then
zprofile=no
else
zprofile="$etcdir/zprofile"
fi])
AH_TEMPLATE([GLOBAL_ZPROFILE],
[The global file to source whenever zsh is run as a login shell,
before zshrc is read; if undefined, don't source anything.])
if test "x$zprofile" != xno; then
AC_DEFINE_UNQUOTED(GLOBAL_ZPROFILE, "$zprofile")
fi
ifdef([zlogin],[undefine([zlogin])])dnl
AC_ARG_ENABLE(zlogin,
AS_HELP_STRING([--enable-zlogin=FILE],[the full pathname of the global zlogin script]),
[zlogin="$enableval"],
[if test "x$etcdir" = xno; then
zlogin=no
else
zlogin="$etcdir/zlogin"
fi])
AH_TEMPLATE([GLOBAL_ZLOGIN],
[The global file to source whenever zsh is run as a login shell;
if undefined, don't source anything])
if test "x$zlogin" != xno; then
AC_DEFINE_UNQUOTED(GLOBAL_ZLOGIN, "$zlogin")
fi
ifdef([zlogout],[undefine([zlogout])])dnl
AC_ARG_ENABLE(zlogout,
AS_HELP_STRING([--enable-zlogout=FILE],[the full pathname of the global zlogout script]),
[zlogout="$enableval"],
[if test "x$etcdir" = xno; then
zlogout=no
else
zlogout="$etcdir/zlogout"
fi])
AH_TEMPLATE([GLOBAL_ZLOGOUT],
[The global file to source whenever zsh was run as a login shell.
This is sourced right before exiting. If undefined, don't source
anything.])
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.
ifdef([dynamic],[undefine([dynamic])])dnl
AC_ARG_ENABLE(dynamic,
AS_HELP_STRING([--disable-dynamic],[turn off dynamically loaded binary modules]),
[dynamic="$enableval"], [dynamic=yes])
dnl Do you want to disable restricted on r* commands
ifdef([restricted-r],[undefine([restricted-r])])dnl
AH_TEMPLATE([RESTRICTED_R],
[Undefine this if you don't want to get a restricted shell
when zsh is exec'd with basename that starts with r.
By default this is defined.])
AC_ARG_ENABLE(restricted-r,
AS_HELP_STRING([--disable-restricted-r],[turn off r* invocation for restricted shell]),
[if test x$enableval = xyes; then
AC_DEFINE(RESTRICTED_R)
fi],
AC_DEFINE(RESTRICTED_R)
)
dnl Do you want to disable use of locale functions
AH_TEMPLATE([CONFIG_LOCALE],
[Undefine if you don't want local features. By default this is defined.])
AC_ARG_ENABLE([locale],
AS_HELP_STRING([--disable-locale],[turn off locale features]),
[if test x$enableval = xyes; then
AC_DEFINE(CONFIG_LOCALE)
fi],
AC_DEFINE(CONFIG_LOCALE)
)
dnl Do you want to compile as K&R C.
AC_ARG_ENABLE(ansi2knr,
AS_HELP_STRING([--enable-ansi2knr],[translate source to K&R C before compiling]),
[ansi2knr="$enableval"], [ansi2knr=default])
ifdef([runhelpdir],[undefine([runhelpdir])])dnl
AC_ARG_ENABLE(runhelpdir,
AS_HELP_STRING([--enable-runhelpdir=DIR],[the directory in which to install run-help files]),
[if test x"$enableval" = xno; then
runhelpdir=
else
runhelpdir="$enableval"
fi], [runhelpdir=yes])
if test x"$runhelpdir" = xyes; then
runhelpdir=${datadir}/${tzsh_name}/'${VERSION}'/help
fi
if test x"$runhelpdir" = x; then
runhelp=
else
runhelp=runhelp
fi
ifdef([fndir],[undefine([fndir])])dnl
AC_ARG_ENABLE(fndir,
AS_HELP_STRING([--enable-fndir=DIR],[the directory in which to install functions]),
dnl ${VERSION} to be determined at compile time.
[if test x$enableval = xyes; then
fndir=${datadir}/${tzsh_name}/'${VERSION}'/functions
else
fndir="$enableval"
fi], [fndir=${datadir}/${tzsh_name}/'${VERSION}'/functions])
ifdef([sitefndir],[undefine([sitefndir])])dnl
AC_ARG_ENABLE(site-fndir,
AS_HELP_STRING([--enable-site-fndir=DIR],[same for site functions (not version specific)]),
[if test x$enableval = xyes; then
sitefndir=${datadir}/${tzsh_name}/site-functions
else
sitefndir="$enableval"
fi], [sitefndir=${datadir}/${tzsh_name}/site-functions])
dnl Add /usr/local/share/zsh/site-functions if not yet present
dnl owing to $sitefndir, whether or not explicitly given.
dnl If not explicitly given, it hasn't been expanded yet.
if test X$sitefndir = X/usr/local/share/zsh/site-functions || \
test X$sitefndir = Xno
then fixed_sitefndir=''
elif test X$prefix != X/usr/local; then
if test X$prefix = XNONE && test X$ac_default_prefix = X/usr/local; then
if test X$tzsh_name != Xzsh
then fixed_sitefndir=/usr/local/share/zsh/site-functions
else fixed_sitefndir=''
fi
else fixed_sitefndir=/usr/local/share/zsh/site-functions
fi
elif test X$tzsh_name != Xzsh
then fixed_sitefndir=/usr/local/share/zsh/site-functions
else fixed_sitefndir=''
fi
ifdef([function_subdirs],[undefine([function_subdirs])])
AC_ARG_ENABLE(function-subdirs,
AS_HELP_STRING([--enable-function-subdirs],[install functions in subdirectories]))
if test "x${enable_function_subdirs}" != x &&
test "x${enable_function_subdirs}" != xno; then
FUNCTIONS_SUBDIRS=yes
else
FUNCTIONS_SUBDIRS=no
fi
ifdef([additionalfpath],[undefine([additionalfpath])])dnl
AC_ARG_ENABLE(additional-fpath,
AS_HELP_STRING([--enable-additional-fpath=DIR],[add directories to default function path]),
[if test x$enableval = xyes; then
additionalfpath=""
else
additionalfpath="${enableval}"
fi], [additionalfpath=""])
AC_SUBST(runhelpdir)dnl
AC_SUBST(runhelp)dnl
AC_SUBST(additionalfpath)dnl
AC_SUBST(fndir)dnl
AC_SUBST(sitefndir)dnl
AC_SUBST(fixed_sitefndir)dnl
AC_SUBST(FUNCTIONS_SUBDIRS)dnl
dnl Directories for scripts such as newuser.
ifdef([scriptdir],[undefine([scriptdir])])dnl
AC_ARG_ENABLE(scriptdir,
AS_HELP_STRING([--enable-scriptdir=DIR],[the directory in which to install scripts]),
dnl ${VERSION} to be determined at compile time.
[if test x$enableval = xyes; then
scriptdir=${datadir}/${tzsh_name}/'${VERSION}'/scripts
else
scriptdir="$enableval"
fi], [scriptdir=${datadir}/${tzsh_name}/'${VERSION}'/scripts])
ifdef([sitescriptdir],[undefine([sitescriptdir])])dnl
AC_ARG_ENABLE(site-scriptdir,
AS_HELP_STRING([--enable-site-scriptdir=DIR],[same for site scripts (not version specific)]),
[if test x$enableval = xyes; then
sitescriptdir=${datadir}/${tzsh_name}/scripts
else
sitescriptdir="$enableval"
fi], [sitescriptdir=${datadir}/${tzsh_name}/scripts])
AC_SUBST(scriptdir)dnl
AC_SUBST(sitescriptdir)dnl
dnl htmldir is already handled, but if it wasn't set, use
dnl the standard zsh default.
if test x$htmldir = x'${docdir}' || test x$htmldir = x; then
htmldir='$(datadir)/$(tzsh)/htmldoc'
fi
AH_TEMPLATE([CUSTOM_PATCHLEVEL],
[Define to a custom value for the ZSH_PATCHLEVEL parameter])
AC_ARG_ENABLE(custom-patchlevel,
AS_HELP_STRING([--enable-custom-patchlevel],[set a custom ZSH_PATCHLEVEL value]),
[if test x$enableval != x && test x$enableval != xno; then
AC_DEFINE_UNQUOTED([CUSTOM_PATCHLEVEL], ["$enableval"])
fi])
dnl Do you want maildir support?
ifdef([maildir_support],[undefine([maildir_support])])dnl
AH_TEMPLATE([MAILDIR_SUPPORT],
[Define for Maildir support])
AC_ARG_ENABLE(maildir-support,
AS_HELP_STRING([--enable-maildir-support],[enable maildir support in MAIL and MAILPATH]),
[if test x$enableval = xyes; then
AC_DEFINE(MAILDIR_SUPPORT)
fi])
dnl Do you want to set a maximum function depth?
ifdef([max_function_depth],[undefine([max_function_depth])])dnl
AH_TEMPLATE([MAX_FUNCTION_DEPTH],
[Define for function depth limits])
AC_ARG_ENABLE(max-function-depth,
AS_HELP_STRING([--enable-max-function-depth=MAX],[limit function depth to MAX, default 500]),
[if test x$enableval = xyes; then
AC_DEFINE(MAX_FUNCTION_DEPTH, 500)
elif test x$enableval != xno; then
AC_DEFINE_UNQUOTED(MAX_FUNCTION_DEPTH, $enableval)
fi],
[AC_DEFINE(MAX_FUNCTION_DEPTH, 500)]
)
ifdef([default_readnullcmd],[undefine([default_readnullcmd])])dnl
AH_TEMPLATE([DEFAULT_READNULLCMD],
[Define default pager used by readnullcmd])
AC_ARG_ENABLE(readnullcmd,
AS_HELP_STRING([--enable-readnullcmd=PAGER],[pager used when READNULLCMD is not set]),
[if test x$enableval = xyes; then
AC_DEFINE(DEFAULT_READNULLCMD,"more")
elif test x$enableval != xno; then
AC_DEFINE_UNQUOTED(DEFAULT_READNULLCMD,"$enableval")
fi],
[AC_DEFINE(DEFAULT_READNULLCMD,"more")]
)
dnl Do you want to look for pcre support?
AC_ARG_ENABLE(pcre,
AS_HELP_STRING([--enable-pcre],[enable the search for the pcre library (may create run-time library dependencies)]))
dnl Do you want to look for capability support?
AC_ARG_ENABLE(cap,
AS_HELP_STRING([--enable-cap],[enable the search for POSIX capabilities (may require additional headers to be added by hand)]))
# Default off for licensing reasons
AC_ARG_ENABLE(gdbm,
AS_HELP_STRING([--enable-gdbm],[enable the search for the GDBM library (see the zsh/db/gdbm module)]),
[gdbm="$enableval"], [gdbm=no])
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 Check for large file support.
dnl Gross hack for ReliantUNIX - GCC does not understand getconf options
dnl For now just disable LFS in this case
dnl Any takers?
if test "$host" = mips-sni-sysv4 && test -n "$GCC"; then
:
else
AC_SYS_LARGEFILE
fi
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" && test ."$ansi2knr" != .yes; then
if test "${enable_zsh_debug}" = yes; then
if test -n "$GCC"; then
CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -ggdb"
else
CFLAGS="$CFLAGS -g"
fi
else
if test -n "$GCC"; then
CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -O2"
else
CFLAGS="$CFLAGS -O"
fi
fi
fi
if test -n "$auto_ldflags"; then
case "${enable_zsh_debug}$host_os" in
yesaix*|yeshpux*|yesnetbsd*|yesopenbsd*) ;; # "ld -g" is not valid on these systems
darwin*) LDFLAGS=-Wl,-x ;;
yes*) LDFLAGS=-g ;;
*) LDFLAGS=-s ;;
esac
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.
case "$host_os" in
sco*) CFLAGS="-D__sco $CFLAGS" ;;
esac
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_C_CONST dnl Does compiler support `const'.
dnl Default preprocessing on Mac OS X produces warnings
dnl Mac OS X 10.6 (darwin10.x.x) does not need this.
case "$host_os" in
darwin[[0-9]].*) CPP="$CPP -traditional-cpp" ;;
esac
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
AH_TEMPLATE([PROTOTYPES],
[Define to 1 if ANSI function prototypes are usable.])
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_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_COMPILE_IFELSE([AC_LANG_PROGRAM([[union{void *p;long l;}u={0};]], [[u.l=1;]])],[zsh_cv_c_have_union_init=yes],[zsh_cv_c_have_union_init=no])])
AH_TEMPLATE([HAVE_UNION_INIT],
[Define to 1 if the compiler can initialise a union.])
if test x$zsh_cv_c_have_union_init = xyes; then
AC_DEFINE(HAVE_UNION_INIT)
fi
dnl Checking if the compiler supports variable-length arrays
AC_CACHE_CHECK(if the compiler supports variable-length arrays,
zsh_cv_c_variable_length_arrays,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(), n;]], [[int i[foo()], a[n+1];]])],[zsh_cv_c_variable_length_arrays=yes],[zsh_cv_c_variable_length_arrays=no])])
AH_TEMPLATE([HAVE_VARIABLE_LENGTH_ARRAYS],
[Define to 1 if compiler supports variable-length arrays])
if test x$zsh_cv_c_variable_length_arrays = xyes; 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_PROG_LN dnl Check for working ln, for "make install"
AC_PROG_LN_S dnl Use ln -s/ln/cp for "make install.runhelp"
AC_PROG_EGREP dnl sets $EGREP to grep -E or egrep
AC_CHECK_PROGS([YODL], [yodl], [: yodl])
YODL_OPTIONS=''
if test "x$ac_cv_prog_YODL" = xyodl; then
case `yodl --version` in
*"version 2."*) YODL_OPTIONS='-k' ;;
*"version 3."*) YODL_OPTIONS='-k -L' ;;
*"version 4."*) YODL_OPTIONS='-k -L' ;;
esac
fi
AC_SUBST(YODL_OPTIONS)
AC_CHECK_PROGS([TEXI2DVI], [texi2dvi], [: texi2dvi])
AC_CHECK_PROGS([TEXI2PDF], [texi2pdf], [: texi2pdf])
AC_CHECK_PROGS([TEXI2HTML], [texi2any texi2html], [: texi2html])
if test x"$TEXI2PDF" != xtexi2pdf && test x"$TEXI2DVI" = xtexi2dvi; then
TEXI2PDF='texi2dvi --pdf'
fi
if test x"$TEXI2HTML" = xtexi2any; then
TEXI2HTML='texi2any -c TEXI2HTML=1'
fi
case "$LC_PAPER" in
??_US*) PAPERSIZE=us ;;
*) PAPERSIZE=a4 ;;
esac
AC_SUBST(PAPERSIZE)
AC_CHECK_PROGS([ANSI2KNR], [ansi2knr], [: ansi2knr])
if test x"$ansi2knr" = xyes && test x"$ANSI2KNR" = x": ansi2knr"; then
echo "----------"
echo "configure fatal error:"
echo "ansi2knr was specified (--enable-ansi2knr) but the program could not be found."
echo "Either remove the configure option if it is not required or build the ansi2knr"
echo "program before reconfiguring Zsh. The source code for ansi2knr is also"
echo "available in the GPL directory on Zsh distribution sites."
exit 1
fi
dnl ------------------
dnl CHECK HEADER FILES
dnl ------------------
AC_HEADER_DIRENT
AC_HEADER_STAT
AC_HEADER_SYS_WAIT
oldcflags="$CFLAGS"
if test x$enable_pcre = xyes; then
AC_CHECK_PROG([PCRECONF], pcre-config, pcre-config)
dnl Typically (meaning on this single RedHat 9 box in front of me)
dnl pcre-config --cflags produces a -I output which needs to go into
dnl CPPFLAGS else configure's preprocessor tests don't pick it up,
dnl producing a warning.
if test "x$ac_cv_prog_PCRECONF" = xpcre-config; then
CPPFLAGS="$CPPFLAGS `pcre-config --cflags`"
fi
fi
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 stdio.h stdarg.h varargs.h stdlib.h \
unistd.h sys/capability.h \
utmp.h utmpx.h sys/types.h pwd.h grp.h poll.h sys/mman.h \
netinet/in_systm.h pcre.h langinfo.h wchar.h stddef.h \
sys/stropts.h iconv.h ncurses.h ncursesw/ncurses.h \
ncurses/ncurses.h)
if test x$dynamic = xyes; then
AC_CHECK_HEADERS(dlfcn.h)
AC_CHECK_HEADERS(dl.h)
fi
dnl Some SCO systems cannot include both sys/time.h and sys/select.h
AH_TEMPLATE([TIME_H_SELECT_H_CONFLICTS],
[Define if sys/time.h and sys/select.h cannot be both included.])
if test x$ac_cv_header_sys_time_h = xyes && test x$ac_cv_header_sys_select_h = xyes; then
AC_CACHE_CHECK(for conflicts in sys/time.h and sys/select.h,
zsh_cv_header_time_h_select_h_conflicts,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#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 x$zsh_cv_header_time_h_select_h_conflicts = xyes; then
AC_DEFINE(TIME_H_SELECT_H_CONFLICTS)
fi
fi
AH_TEMPLATE([GWINSZ_IN_SYS_IOCTL],
[Define if TIOCGWINSZ is defined in sys/ioctl.h but not in termios.h.])
if test x$ac_cv_header_termios_h = xyes; then
AC_CACHE_CHECK(TIOCGWINSZ in termios.h,
zsh_cv_header_termios_h_tiocgwinsz,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#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 x$zsh_cv_header_termios_h_tiocgwinsz = xno; then
AC_CACHE_CHECK(TIOCGWINSZ in sys/ioctl.h,
zsh_cv_header_sys_ioctl_h_tiocgwinsz,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#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 x$zsh_cv_header_sys_ioctl_h_tiocgwinsz = xyes; then
AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
fi
fi
AH_TEMPLATE([WINSIZE_IN_PTEM],
[Define if your should include sys/stream.h and sys/ptem.h.])
AC_CACHE_CHECK(for streams headers including struct winsize,
ac_cv_winsize_in_ptem,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stream.h>
#include <sys/ptem.h>]], [[struct winsize wsz]])],[ac_cv_winsize_in_ptem=yes],[ac_cv_winsize_in_ptem=no])])
if test x$ac_cv_winsize_in_ptem = xyes; then
AC_DEFINE(WINSIZE_IN_PTEM)
fi
dnl -------------------
dnl CHECK FOR LIBRARIES
dnl -------------------
dnl On some systems, modules need to be linked against libc explicitly,
dnl in case they require objects that exist only in the static version
dnl and might not be compiled into the zsh executable.
dnl On ReliantUNIX -lc better be the last library, else funny things
dnl may happen.
AC_CHECK_LIB(c, printf, [LIBS="$LIBS -lc"])
AC_CHECK_LIB(m, pow)
AC_CHECK_LIB(rt, clock_gettime)
dnl Various features of ncurses depend on having the right header
dnl (the system's own curses.h may well not be good enough).
dnl So don't search for ncurses unless we found the header.
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
ncursesw_test=ncursesw
ncurses_test=ncurses
else
ncursesw_test=
ncurses_test=
fi
dnl Prefer BSD termcap library to SysV curses library, except on certain
dnl SYSV-derived systems. However, if we find terminfo and termcap
dnl stuff in the same library we will use that; typically this
dnl is ncurses or curses.
dnl On pre-11.11 HPUX, Hcurses is reported to work better than curses.
dnl Prefer ncurses to curses on all systems. tinfo isn't very common now.
AC_ARG_WITH(term-lib,
AS_HELP_STRING([--with-term-lib=LIBS],[search space-separated LIBS for terminal handling]),
[if test "x$withval" != xno && test "x$withval" != x ; then
termcap_curses_order="$withval"
AC_SEARCH_LIBS(tigetstr, [$termcap_curses_order])
else
termcap_curses_order="$ncursesw_test $ncurses_test tinfow tinfo termcap curses"
fi],
[case "$host_os" in
solaris*)
termcap_curses_order="$ncursesw_test $ncurses_test curses termcap" ;;
hpux10.*|hpux11.*)
DL_EXT="${DL_EXT=sl}"
termcap_curses_order="Hcurses $ncursesw_test $ncurses_test curses termcap" ;;
*)
termcap_curses_order="$ncursesw_test $ncurses_test tinfow tinfo termcap curses" ;;
esac])dnl
AH_TEMPLATE([ZSH_NO_XOPEN],
[Define if _XOPEN_SOURCE_EXTENDED should not be defined to avoid clashes])
AC_CACHE_CHECK(if _XOPEN_SOURCE_EXTENDED should not be defined,
zsh_cv_no_xopen,
[[case "$host_os" in
*freebsd5*|*freebsd6.[012]*|*aix*)
zsh_cv_no_xopen=yes
;;
*)
zsh_cv_no_xopen=no
;;
esac]])
if test x$zsh_cv_no_xopen = xyes; then
AC_DEFINE(ZSH_NO_XOPEN)
fi
dnl Check for tigetflag (terminfo) before tgetent (termcap).
dnl That's so that on systems where termcap and [n]curses are
dnl both available and both contain termcap functions, while
dnl only [n]curses contains terminfo functions, we only link against
dnl [n]curses.
LIBS_save_pre_term="$LIBS"
AC_SEARCH_LIBS(tigetstr, [$termcap_curses_order])
AC_SEARCH_LIBS(tigetflag, [$termcap_curses_order])
AC_SEARCH_LIBS(tgetent, [$termcap_curses_order],
true,
AC_MSG_FAILURE(["No terminal handling library was found on your system.
This is probably a library called 'curses' or 'ncurses'. You may
need to install a package called 'curses-devel' or 'ncurses-devel' on your
system."], 255))
AC_CHECK_HEADERS(curses.h, [],
[AC_CACHE_CHECK(for Solaris 8 curses.h mistake, ac_cv_header_curses_solaris,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[]])],[ac_cv_header_curses_h=yes
ac_cv_header_curses_solaris=yes],[ac_cv_header_curses_h=no
ac_cv_header_curses_solaris=no]))
if test x$ac_cv_header_curses_solaris = xyes; then
AC_DEFINE(HAVE_CURSES_H)
fi])
dnl If our terminal library is not ncurses, don't try including
dnl any ncurses headers.
AC_CACHE_CHECK(if we need to ignore ncurses, zsh_cv_ignore_ncurses,
[case $LIBS in
*-lncurses*)
zsh_cv_ignore_ncurses=no
;;
*)
dnl The lack of -lncurses in the $LIBS might be the result of passing
dnl --with-term-lib=^ncurses option. To address this, a test for the tgetent
dnl and other functions is ran here, possibly for the second time, just to
dnl ensure that the ncurses library doesn't have them.
LIBS_save="$LIBS"
dnl Remember (the values are used later, around line 3005) and remove the cache
ac_cv_search_tigetstr_SAVE="$ac_cv_search_tigetstr"
ac_cv_search_tigetnum_SAVE="$ac_cv_search_tigetnum"
ac_cv_search_tigetflag_SAVE="$ac_cv_search_tigetflag"
ac_cv_search_tgetent_SAVE="$ac_cv_search_tgetent"
unset ac_cv_search_tigetstr ac_cv_search_tigetnum ac_cv_search_tigetflag ac_cv_search_tgetent
LIBS="$LIBS_save_pre_term"
dnl Run the checks for all four used terminal functions
AC_SEARCH_LIBS(tigetstr, [ncursesw ncurses curses])
AC_SEARCH_LIBS(tigetnum, [ncursesw ncurses curses])
AC_SEARCH_LIBS(tigetflag, [ncursesw ncurses curses])
AC_SEARCH_LIBS(tgetent, [ncursesw ncurses curses])
LIBS_result="$LIBS"
LIBS="$LIBS_save"
dnl Restore the cache
ac_cv_search_tigetstr="$ac_cv_search_tigetstr_SAVE"
ac_cv_search_tigetnum="$ac_cv_search_tigetnum_SAVE"
ac_cv_search_tigetflag="$ac_cv_search_tigetflag_SAVE"
ac_cv_search_tgetent="$ac_cv_search_tgetent_SAVE"
case $LIBS_result in
*-lncurses*|*-lcurses*)
dnl Yes we need to ignore ncurses, its tgetent or tigetflag might
dnl conflict with the one from the selected terminal library
zsh_cv_ignore_ncurses=yes
;;
*)
dnl If the tgetent nor tigetflag weren't found in the libncurses*.so, then
dnl there will be no conflict with the other terminal library selected (e.g.
dnl libtinfo) and it's possible to link ncurses provided that it is working
dnl - it is here verified that it has initscr() function to check that
AC_SEARCH_LIBS(initscr, [ncursesw ncurses curses])
case $LIBS in
*-lncurses*|*-lcurses*)
dnl No need to ignore curses - it is working and it doesn't
dnl have tgetent nor tigetflag
zsh_cv_ignore_ncurses=no
;;
*)
zsh_cv_ignore_ncurses=yes
;;
esac
esac
;;
esac])
AC_SEARCH_LIBS(getpwnam, nsl)
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
if test x$enable_cap = xyes; then
AC_CHECK_LIB(cap, cap_get_proc)
fi
AC_CHECK_LIB(socket, socket)
AC_SEARCH_LIBS(gethostbyname2, bind)
case $LIBS in
*-lbind*)
AC_CHECK_HEADERS(bind/netdb.h)
;;
esac
dnl ---------------
dnl CHECK FOR ICONV
dnl ---------------
dnl Find iconv. It may be in libiconv and may be iconv() or libiconv()
if test "x$ac_cv_header_iconv_h" = "xyes"; then
AC_CHECK_FUNC(iconv, ac_found_iconv=yes, ac_found_iconv=no)
if test "x$ac_found_iconv" = "xno"; then
AC_CHECK_LIB(iconv, iconv, ac_found_iconv=yes)
if test "x$ac_found_iconv" = "xno"; then
AC_CHECK_LIB(iconv, libiconv, ac_found_iconv=yes)
fi
if test "x$ac_found_iconv" != "xno"; then
LIBS="-liconv $LIBS"
fi
else
dnl Handle case where there is a native iconv but iconv.h is from libiconv
AC_CHECK_DECL(_libiconv_version,
[ AC_CHECK_LIB(iconv, libiconv, LIBS="-liconv $LIBS") ],,
[ #include <iconv.h> ])
fi
fi
AH_TEMPLATE([ICONV_FROM_LIBICONV],
[Define to 1 if iconv() is linked from libiconv])
if test "x$ac_found_iconv" = xyes; then
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iconv.h>]], [[int myversion = _libiconv_version]])],[AC_DEFINE(ICONV_FROM_LIBICONV)],[])
fi
dnl Check if iconv uses const in prototype declaration
if test "x$ac_found_iconv" = "xyes"; then
AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
#include <iconv.h>]],
[[#ifdef __cplusplus
"C"
#endif
#if defined(__STDC__) || defined(__cplusplus)
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
#else
size_t iconv();
#endif]])],
[ac_cv_iconv_const=],
[ac_cv_iconv_const=const])])
AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
[Define as const if the declaration of iconv() needs const.])
fi
if test x$enable_pcre = xyes; then
dnl pcre-config should probably be employed here
dnl AC_SEARCH_LIBS(pcre_compile, pcre)
LIBS="`$ac_cv_prog_PCRECONF --libs` $LIBS"
fi
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_LINK_IFELSE([AC_LANG_PROGRAM([[#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 x$zsh_cv_decl_ospeed_include_defines = xno; then
AC_CACHE_CHECK(if you must define ospeed,
zsh_cv_decl_ospeed_must_define,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern short ospeed; ospeed = 0;]])],[zsh_cv_decl_ospeed_must_define=yes],[zsh_cv_decl_ospeed_must_define=no])])
fi
AH_TEMPLATE([HAVE_OSPEED],
[Define to 1 if your termcap library has the ospeed variable])
AH_TEMPLATE([MUST_DEFINE_OSPEED],
[Define to 1 if you have ospeed, but it is not defined in termcap.h])
if test x$zsh_cv_decl_ospeed_include_defines = xyes; then
AC_DEFINE(HAVE_OSPEED)
elif test x$zsh_cv_decl_ospeed_must_define = xyes; then
AC_DEFINE(HAVE_OSPEED)
AC_DEFINE(MUST_DEFINE_OSPEED)
fi
if test x$gdbm != xno; then
AC_CHECK_HEADERS(gdbm.h)
AC_CHECK_LIB(gdbm, gdbm_open)
fi
AC_CHECK_HEADERS(sys/xattr.h)
dnl --------------
dnl CHECK TYPEDEFS
dnl --------------
AC_TYPE_PID_T
AC_TYPE_OFF_T
AC_CHECK_TYPE(ino_t, unsigned long)