File: configure.in

package info (click to toggle)
vile 9.5-i1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 8,248 kB
  • ctags: 8,023
  • sloc: ansic: 86,640; lex: 8,291; sh: 3,073; perl: 2,926; cpp: 2,891; makefile: 779; awk: 276
file content (980 lines) | stat: -rw-r--r-- 24,586 bytes parent folder | download
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
dnl Process this file with autoconf to produce a configure script.
AC_REVISION($Revision: 1.222 $)
AC_PREREQ(2.13.20030927)
rm -f config.cache

### Use "configure -with-screen" to override the default configuration, which is
### termcap-based on unix systems.

dnl $Header: /usr/build/vile/vile/RCS/configure.in,v 1.222 2006/04/05 13:49:06 tom Exp $

define(MAKELIST, sh $srcdir/filters/makelist.sh $srcdir/filters/genmake.mak)

dnl
AC_INIT(mktbls.c)
AC_CONFIG_HEADER(config.h:config_h.in)

CF_CHECK_CACHE

###	checks for compiler
AC_PROG_CC
AC_PROG_CPP
AC_GCC_TRADITIONAL

###	checks for UNIX variants that set C preprocessor variables
AC_AIX
AC_ISC_POSIX
AC_MINIX

###	checks for compiler characteristics
CF_INTEL_COMPILER
CF_PROG_EXT
CF_ANSI_CC_REQD
AC_CONST
CF_CC_INIT_UNIONS
CF_XOPEN_SOURCE

case $host_os in hpux*) CPPFLAGS="-DYYCHAR_ARRAY $CPPFLAGS";; esac; AC_DECL_YYTEXT

###	checks for alternative programs
CF_MAKEFLAGS
AC_PROG_INSTALL

AC_PROG_MAKE_SET
AC_PROG_AWK
AC_PROG_RANLIB

CF_SUBST(archiver,AR,ar)
CF_SUBST(archiver options,AR_OPTS,rv)

CF_DISABLE_ECHO
CF_PATHSEP
CF_LIB_PREFIX

###	options to control how much we build
BUILTHDRS="nebind.h neproto.h neexec.h nefunc.h nemode.h nename.h nevars.h nefkeys.h nefsms.h"
BUILTLIBS=
BUILTSRCS=

AC_MSG_CHECKING(if you wish to build only core functions)
CF_ARG_DISABLE(extensions,
	[  --disable-extensions    test: build only core functions],
	[DISABLE_EXTS=yes],
	[DISABLE_EXTS=no])
AC_MSG_RESULT($DISABLE_EXTS)
if test "$DISABLE_EXTS" = yes ; then
	AC_DEFINE(SMALLER)
	AC_DEFINE(FEWNAMES)
	cf_extensions=no
else
	EXTRAOBJS="$EXTRAOBJS api\$o btree\$o history\$o isearch\$o select\$o statevar\$o ucrypt\$o xterm\$o"
	cf_extensions=yes
fi

AC_MSG_CHECKING(if you wish to disable shell/external commands)
CF_ARG_DISABLE(shell,
	[  --disable-shell         test: disable shell/external commands],
	[DISABLE_SHELL=yes],
	[DISABLE_SHELL=no])
AC_MSG_RESULT($DISABLE_SHELL)
if test "$DISABLE_SHELL" = yes ; then
	AC_DEFINE(OPT_SHELL,0)
else
	EXTRAOBJS="$EXTRAOBJS npopen\$o spawn\$o"
fi

###	use option --with-cflags to set default CFLAGS
AC_MSG_CHECKING(for CFLAGS options)
AC_ARG_WITH(CFLAGS,
	[  --with-CFLAGS=value     set default for $CFLAGS],
	[cflags="$withval"])
if test -z "$cflags"; then
	AC_ARG_WITH(cflags,
		[  --with-cflags=value     (same as --with-CFLAGS)],
		[cflags="$withval"])
fi

# if the user specified nothing else, set -O.  user can override
# with --with-cflags=" "
if test -n "$cflags"; then
	CFLAGS="$cflags"
elif test -z "$CFLAGS" ; then
	CFLAGS="-O"
fi
AC_MSG_RESULT($cflags)

AC_MSG_CHECKING(if you want to compile-in plugin support)
CF_ARG_ENABLE(plugins,
	[  --enable-plugins        compile-in plugin support],
	[with_plugins=yes],
	[with_plugins=no])
AC_MSG_RESULT($with_plugins)

AC_MSG_CHECKING(if you want to build syntax filters)
CF_ARG_DISABLE(filters,
	[  --disable-filters       do not build syntax filters],
	[with_filters=no],
	[with_filters=yes])
AC_MSG_RESULT($with_filters)

MAKE_FILTERS=
AC_SUBST(MAKE_FILTERS)

if test "$with_filters" = yes ; then

# allow user to preset these environment variables:
: ${VILE_BUILT_IN_FILTERS=none}
: ${VILE_LOADABLE_FILTERS=none}
: ${VILE_EXTERNAL_FILTERS=all}

AC_MSG_CHECKING(if you want built-in syntax filters)
AC_ARG_WITH(builtin-filters,
[  --with-builtin-filters=XX specify filters to compile built-in vs external.
                          Give an option value to specify only certain filters,
			  i.e., a comma-separated list of filter-names.
                          The default, if no value is given is 'all'.
                          The default if the option is not given is 'none'],
[test "$withval" = yes && withval=all; VILE_BUILT_IN_FILTERS="$withval"],

[VILE_BUILT_IN_FILTERS=none])
test "$VILE_BUILT_IN_FILTERS" = no && VILE_BUILT_IN_FILTERS=none
AC_MSG_RESULT($VILE_BUILT_IN_FILTERS)

AC_MSG_CHECKING(if you want loadable syntax filters)
AC_ARG_WITH(loadable-filters,
[  --with-loadable-filters=XX specify filters to dynamially load at runtime.
                          Give an option value to specify only certain filters,
			  i.e., a comma-separated list of filter-names.
                          The default, if no value is given is 'all'.
                          The default if the option is not given is 'none'],
[test "$withval" = yes && withval=all; VILE_LOADABLE_FILTERS="$withval"],

[VILE_LOADABLE_FILTERS=none])
test "$VILE_LOADABLE_FILTERS" = no && VILE_LOADABLE_FILTERS=none
AC_MSG_RESULT($VILE_LOADABLE_FILTERS)

# If both "--with-builtin-filters" and "--with-loadable-filters" were given,
# the user must provide an explicit list since we cannot build both at once.
if test "$VILE_BUILT_IN_FILTERS" != none && test "$VILE_LOADABLE_FILTERS" != none
then
	builtins=`MAKELIST lc "$VILE_BUILT_IN_FILTERS"`
	test "$builtins" = "." && exit 1
	loadable=`MAKELIST lc "$VILE_LOADABLE_FILTERS"`
	test "$loadable" = "." && exit 1

	for cf_b in $builtins
	do
		for cf_l in $loadable
		do
			if test "$cf_b" = "$cf_l"
			then
				AC_MSG_ERROR(Cannot overlap built-in and loadable filter lists)
			fi
		done
	done
fi

# Anything that is neither a built-in or a loadable filter is an external
# filter.  We could have 3 options, but resolving inconsistencies would be
# a lot more work.
if test "$VILE_BUILT_IN_FILTERS" = none && test "$VILE_LOADABLE_FILTERS" = none
then
	VILE_EXTERNAL_FILTERS=all
elif test "$VILE_BUILT_IN_FILTERS" = all || test "$VILE_LOADABLE_FILTERS" = all
then
	VILE_EXTERNAL_FILTERS=none
else
	complete=`MAKELIST lc all`
	builtins=`MAKELIST lc "$VILE_BUILT_IN_FILTERS"`
	loadable=`MAKELIST lc "$VILE_LOADABLE_FILTERS"`
	VILE_EXTERNAL_FILTERS=
	for cf_a in $complete
	do
		found=no
		for cf_b in $builtins $loadable
		do
			if test $cf_b = $cf_a ; then
				found=yes
				break
			fi
		done
		if test $found = no ; then
			if test -z "$VILE_EXTERNAL_FILTERS" ; then
				VILE_EXTERNAL_FILTERS=$cf_a
			else
				VILE_EXTERNAL_FILTERS="$VILE_EXTERNAL_FILTERS,$cf_a"
			fi
		fi
	done
	test -z "$VILE_EXTERNAL_FILTERS" && VILE_EXTERNAL_FILTERS=none
fi

AC_MSG_CHECKING(if any filters require flex)

builtins=`MAKELIST l "$VILE_BUILT_IN_FILTERS"`
loadable=`MAKELIST l "$VILE_LOADABLE_FILTERS"`

if test -n "$builtins" ; then
	cf_needflex=yes
elif test -n "$loadable" ; then
	cf_needflex=yes
else
	cf_needflex=no
fi
AC_MSG_RESULT($cf_needflex)

if test "$cf_needflex" = yes ; then
	CF_LEX_VERSION
	if test -z "$LEX_VERSION"
	then
		AC_MSG_ERROR(You need flex to compile builtin filters)
	elif ( expr $LEX_VERSION \< 2.5 >/dev/null )
	then
		AC_MSG_ERROR(Sorry - your version of flex is too old: $LEX_VERSION)
	elif ( expr $LEX_VERSION \>= 2.6 >/dev/null )
	then
		AC_MSG_ERROR(Sorry - your version of flex is too unstable: $LEX_VERSION)
	else
		LEX_SUBVERSION=`echo "$LEX_VERSION" | sed -e 's/^2.5.//'`
		if test -z "$LEX_SUBVERSION"
		then
			AC_MSG_ERROR(This version of flex cannot compile builtin filters)
		elif test $LEX_SUBVERSION = 4a
		then
			CF_VERBOSE(good)
		elif ( expr $LEX_SUBVERSION \> 4 >/dev/null )
		then
			AC_MSG_ERROR(This version of flex cannot compile builtin filters)
		fi
	fi
fi

# "--disable-filters" was given.
else
	VILE_BUILT_IN_FILTERS=none
	VILE_LOADABLE_FILTERS=none
	VILE_EXTERNAL_FILTERS=none
	MAKE_FILTERS="#"
fi

dnl These substitutions are used in makefile.in to build builtflt.h
AC_SUBST(VILE_BUILT_IN_FILTERS)
AC_SUBST(VILE_LOADABLE_FILTERS)

AC_MSG_CHECKING(for library path)
CF_WITH_PATHLIST(libdir-path,
[  --with-libdir-path=LIST specify locations to search for filters, etc.],
VILE_LIBDIR_PATH,
"\[$](libdir)/vile",[],[define])
AC_MSG_RESULT($VILE_LIBDIR_PATH)

AC_MSG_CHECKING(for startup path)
CF_WITH_PATHLIST(startup-path,
[  --with-startup-path=LIST specify locations to search for vile.hlp, etc.],
VILE_STARTUP_PATH,
"\[$](datadir)",[],[define])
AC_MSG_RESULT($VILE_STARTUP_PATH)

CF_LEX_CHAR_CLASSES
CF_LEX_STATES

if test "$LEX_CHAR_CLASSES" = yes ; then
	LEX_CHAR_CLASSES=
else
	LEX_CHAR_CLASSES='sh $(srcdir)/noclass.sh '
fi

AC_MSG_CHECKING(if you want to use perl as an extension language)
AC_ARG_WITH(perl,
	[  --with-perl             enable use of Perl as an extension language],
	[with_perl="$withval"],
	[with_perl=no])
AC_MSG_RESULT($with_perl)
if test "$with_perl" = yes ; then
	CF_PROG_PERL(5.004)
	if test "$PERL" = no; then
	    AC_ERROR([perl not found])
	fi
	perl_lib_path=`$PERL -MConfig -e 'print $Config{privlib}'`
	AC_DEFINE(OPT_PERL)
	EXTRAOBJS="$EXTRAOBJS perl\$o"
	BUILTSRCS="$BUILTSRCS perl.c"
	LINK_PREFIX=`$PERL -MConfig -e 'print $Config{shrpenv}'`
	ac_link="$LINK_PREFIX $ac_link"
	CF_CHECK_CFLAGS(`$PERL -MExtUtils::Embed -e ccopts`)
	LIBS="$LIBS `$PERL -MExtUtils::Embed -e ldopts`"
	EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(INSTALL_PERL_DIRS)"
	EXTRA_INSTALL_FILES="$EXTRA_INSTALL_FILES \$(INSTALL_PERL_FILES)"
fi
AC_SUBST(perl_lib_path)
AC_SUBST(PERL)
AC_SUBST(EXTRA_INSTALL_DIRS)
AC_SUBST(EXTRA_INSTALL_FILES)

# X11 checks will sometimes add to CFLAGS.  We want the state of CFLAGS
# prior to these checks

dnl: why this? AC_DYNIX_SEQ
AC_CHECK_FUNC(getpwnam,,AC_CHECK_LIB(sun,getpwnam))

# check for a lint program.
AC_CHECK_PROGS(LINT, lint alint splint lclint, [])
if test -n "$LINT"
then
	AC_DEFINE(SYSTEM_HAS_LINT_PROG)
fi

###	checks for header files
AC_STDC_HEADERS
AC_HEADER_DIRENT
AM_LANGINFO_CODESET
AC_CHECK_HEADERS( \
fcntl.h \
ioctl.h \
limits.h \
memory.h \
poll.h \
pwd.h \
select.h \
setjmp.h \
sgtty.h \
signal.h \
stdarg.h \
stddef.h \
stdlib.h \
string.h \
sys/filio.h \
sys/ioctl.h \
sys/itimer.h \
sys/param.h \
sys/resource.h \
sys/select.h \
sys/socket.h \
sys/time.h \
sys/wait.h \
termio.h \
termios.h \
unistd.h \
utime.h \
varargs.h \
)

###	checks for typedefs
AC_TYPE_SIGNAL
AC_DEFINE(SIGT,RETSIGTYPE)
if test $ac_cv_type_signal = void; then
	AC_DEFINE(SIGRET,[/*do nothing*/])
else
	AC_DEFINE(SIGRET,[return 0])
fi

AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_TYPE_PID_T
AC_CHECK_TYPE(time_t, long)

###	checks for library functions
if test "$cross_compiling" = no; then
	AC_FUNC_SETVBUF_REVERSED
fi

###	checks for structures
AC_STAT_MACROS_BROKEN
AC_ST_BLKSIZE
AC_ST_BLOCKS
AC_ST_RDEV
AC_STRUCT_TM
CF_HEADER_RESOURCE
CF_SIZECHANGE
CF_FP_ISREADY
CF_WCTYPE

###	checks for system services and user specified options
AC_LONG_FILE_NAMES
CF_RESTARTABLE_PIPEREAD		# is a read() of a pipe restartable?

AC_SUBST(CFLAGS)
AC_SUBST(LIBS)
AC_SUBST(X_CFLAGS)
AC_SUBST(X_LIBS)
AC_SUBST(X_EXTRA_LIBS)
AC_SUBST(SCREEN)
AC_SUBST(TARGET)
AC_SUBST(LINK_PREFIX)
dnl
dnl The killpg test and the tests for the presence of certain functions on
dnl a particular operating system are done prior to the checks for existence
dnl of screen libraries due to a problem with -lXt on certain SunOS systems.
dnl The nature of this problem is described in the FAQ on X.  Look for the
dnl following subject: ``What are these problems with "_XtInherit not found"
dnl on the Sun? ...''  The long and the short of it is that AC_HAVE_FUNCS will
dnl not work properly (without being rewritten) if placed after adding -lXt to
dnl LIBS on SunOS (and perhaps some others as well).
dnl
AC_FUNC_SETPGRP
AC_FUNC_GETPGRP
CF_KILLPG
CF_ERRNO
CF_SYS_ERRLIST
AC_DEFINE(SYS_UNIX)
AC_DEFINE(scrn_chosen)
# Try to eventually eliminate the following
AC_DEFINE(os_chosen)

AC_MSG_CHECKING(for screen type)
AC_ARG_WITH(screen,
[  --with-screen=value     specify terminal driver.  The default is tcap, for
                          the termcap/terminfo driver.  Other values include
                          curses, ncurses, ncursesw, X11, OpenLook, Motif,
			  Athena, Xaw, Xaw3d, neXtaw and ansi.],
[screen=$withval])

if test -z "$screen"; then
	AC_ARG_WITH(scr,
		[  --with-scr=value        (same as --with-screen)],
		[screen=$withval])
fi
test -z "$screen" && test "$with_x" = yes && screen=x11
if test -z "$screen"; then
	screen=termcap;
fi
AC_MSG_RESULT($screen)

: See if this is any type of xvile configuration:
case "$screen" in
	[[Oo]]pen[[Ll]]ook | [[Mm]]otif* | [[xX]] | [[Aa]]thena | [[xX]][[atTmMoO]]* | [[xX]]11 | neXtaw | XawPlus )
		EXTRA_INSTALL_FILES="$EXTRA_INSTALL_FILES \$(INSTALL_X_FILES)"
		CF_X_TOOLKIT
		CF_WITH_IMAKE_CFLAGS
		X_CFLAGS="$X_CFLAGS $IMAKE_CFLAGS"
		LDFLAGS="$LDFLAGS $X_LIBS"
		CF_CHECK_CFLAGS($X_CFLAGS)
		SCREEN=x11
		TARGET=xvile
		AC_DEFINE(DISP_X11)
		AC_DEFINE(XTOOLKIT)
		AC_CHECK_HEADERS(X11/IntrinsicI.h X11/Xpoll.h)
	;;
esac

: Find the libraries that apply to the selected screen-type:
case "$screen" in
	[[Oo]]pen* | [[Xx]]ol )
		AC_DEFINE(OL_WIDGETS)
		CF_X_OPENLOOK
	 	test "$cf_extensions" = no && EXTRAOBJS="$EXTRAOBJS select\$o"
	;;
	[[mM]]otif* | [[Xx]]m )
		AC_DEFINE(MOTIF_WIDGETS)
		CF_X_MOTIF
	 	test "$cf_extensions" = yes && EXTRAOBJS="$EXTRAOBJS x11menu\$o menu\$o"
	 	test "$cf_extensions" = no && EXTRAOBJS="$EXTRAOBJS select\$o"
	;;
	[[Aa]]thena* | [[Xx]]aw* | neXtaw | XawPlus )
		AC_DEFINE(ATHENA_WIDGETS)
		case $screen in #(vi
		*aw*)
			cf_x_athena=`echo $screen | sed -e s/x/X/`
			;;
		esac
		CF_X_ATHENA
	 	test "$cf_extensions" = yes && EXTRAOBJS="$EXTRAOBJS x11menu\$o menu\$o"
	 	test "$cf_extensions" = no && EXTRAOBJS="$EXTRAOBJS select\$o"
	;;
	x | X | [[Xx]][[Tt]]* | [[Xx]]11 )
		AC_DEFINE(NO_WIDGETS)
	 	test "$cf_extensions" = no && EXTRAOBJS="$EXTRAOBJS select\$o"
	;;
	ansi)
		SCREEN=ansi
		TARGET=vile
		AC_DEFINE(DISP_ANSI)
	;;
	curses)
		SCREEN=curses
		TARGET=vile
		AC_DEFINE(DISP_CURSES)
		CF_CURSES_CPPFLAGS
		CF_NCURSES_VERSION
		CF_CURSES_LIBS
	;;
	ncurses)
		SCREEN=curses
		TARGET=vile
		AC_DEFINE(DISP_CURSES)
		CF_NCURSES_CPPFLAGS
		CF_NCURSES_LIBS
	;;
	ncursesw)
		SCREEN=curses
		TARGET=vile
		AC_DEFINE(DISP_CURSES)
		CF_NCURSES_CPPFLAGS(ncursesw)
		CF_NCURSES_LIBS(ncursesw)
	;;
	* )
		SCREEN=tcap
		TARGET=vile
		AC_DEFINE(DISP_TERMCAP)
		AC_MSG_CHECKING(if you want to use ncurses)
		AC_ARG_WITH(ncurses,
			[  --with-ncurses          use ncurses rather than termcap/terminfo],
			[screen=ncurses],
			[withval=no])
		AC_MSG_RESULT($withval)
		CF_TERMCAP_LIBS($screen)
	;;
esac

: Check for termcap vs terminfo:
cf_tc_funcs=""
cf_tc_externs=""
if test "$SCREEN" = curses ; then
	CF_TERMCAP_LIBS
	cf_tc_funcs="use_default_colors"
	AC_DEFINE(NEED_CURSES_H)
fi
if test ".$cf_cv_termlib" = .terminfo ; then
	AC_DEFINE(USE_TERMINFO)
	cf_tc_funcs="$cf_tc_funcs tigetint tigetnum tparam tparm"
	cf_tc_externs="$cf_tc_funcs tgoto tigetstr tputs tigetflag"
elif test ".$cf_cv_termlib" = .termcap ; then
	# BSD 'tputs()' may need 'PC' to be set.
	AC_TRY_LINK([],[extern char PC; PC = 0],
		[AC_DEFINE(HAVE_EXTERN_TCAP_PC)])
	cf_tc_funcs="$cf_tc_funcs tgetint tgetnum tparam tparm"
	cf_tc_externs="$cf_tc_funcs tgoto tgetstr tputs tgetent tgetflag"
else
	cf_cv_termlib=none
fi

LIBS="$LIBS $X_EXTRA_LIBS"

CF_CHAR_DEVICE(/dev/tty)

CF_CRYPT_FUNC
CF_CHECK_FD_SET

AC_HAVE_FUNCS( \
access \
alarm \
crypt \
getcwd \
getegid \
geteuid \
gethostname \
getpass \
getwd \
killpg \
mkdir \
mkdtemp \
poll \
popen \
putenv \
realpath \
select \
setbuffer \
setgid \
setitimer \
setsid \
setuid \
setvbuf \
sigaction \
sigprocmask \
strchr \
strerror \
strftime \
strrchr \
strtoul \
symlink \
tcgetattr \
ttyname \
umask \
utime \
utimes \
waitpid $cf_tc_funcs \
)

CF_ANSI_QSORT
CF_MKSTEMP

###	Miscellaneous options

ICON_SUFFIX=.xbm
AC_SUBST(ICON_SUFFIX)
if test "$TARGET" = xvile ; then

dnl test for Xpm library
cf_save_cppflags="${CPPFLAGS}"
cf_save_ldflags="${LDFLAGS}"

AC_MSG_CHECKING(if you want to use the Xpm library for colored icon)
AC_ARG_WITH(xpm,
[  --with-xpm=DIR          use Xpm library for colored icon, may specify path],
	[cf_Xpm_library="$withval"],
	[cf_Xpm_library=no])
AC_MSG_RESULT($cf_Xpm_library)

if test "$cf_Xpm_library" != no ; then
    if test "$cf_Xpm_library" != yes ; then
	CPPFLAGS="$CPPFLAGS -I$withval/include"
	LDFLAGS="$LDFLAGS -L$withval/lib"
    fi
    AC_CHECK_HEADER(X11/xpm.h,[
	AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData,[
	    AC_DEFINE(HAVE_LIBXPM)
	    ICON_SUFFIX=.xpm
	    LIBS="-lXpm $LIBS"],
	    [CPPFLAGS="${cf_save_cppflags}" LDFLAGS="${cf_save_ldflags}"],
	    [-lX11 $X_LIBS])],
	[CPPFLAGS="${cf_save_cppflags}" LDFLAGS="${cf_save_ldflags}"])
fi

if test -n "$cf_x_athena" ; then
    AC_MSG_CHECKING(if you want to use Xaw scrollbars rather than our own)
    AC_ARG_WITH(Xaw-scrollbars,
	[  --with-Xaw-scrollbars   use Xaw scrollbars rather than our own],
	[cf_Xaw_scrollbars="$withval"],
	[cf_Xaw_scrollbars=no])
    AC_MSG_RESULT($cf_Xaw_scrollbars)

    if test "$cf_Xaw_scrollbars" = no ; then
	AC_DEFINE(OPT_KEV_SCROLLBARS)
	AC_DEFINE(OPT_KEV_DRAGGING)
    else
	AC_DEFINE(OPT_XAW_SCROLLBARS)
	AC_MSG_CHECKING(if you want to use the drag/scrolling extension with Xaw)
	AC_ARG_WITH(drag-extension,
	    [  --with-drag-extension   use drag/scrolling extension with Xaw],
	    [cf_drag_extension="$withval"],
	    [cf_drag_extension=no])
	AC_MSG_RESULT($cf_drag_extension)
	if test "$cf_drag_extension" != "no" ; then
	    AC_DEFINE(OPT_KEV_DRAGGING)
	fi
    fi
fi

fi

AC_MSG_CHECKING(if you want to change the number of exec-macros)
AC_ARG_WITH(exec-macros,
	[  --with-exec-macros=N    specify count of numbered macros],
	[cf_exec_macros="$withval"],
	[cf_exec_macros=no])
AC_MSG_RESULT($cf_exec_macros)
test "$cf_exec_macros" != no && AC_DEFINE_UNQUOTED(OPT_EXEC_MACROS,$cf_exec_macros)

CF_LARGEFILE

# I don't know of a reliable test for working locale, but we can at least check
# that it is available before offering it as an option.
CF_LOCALE
if test $cf_cv_locale = yes ; then
AC_MSG_CHECKING(if you want to use i18n locale support)
AC_ARG_WITH(locale,
	[  --with-locale           use i18n support for character-types],
	[cf_locale="$withval"],
	[cf_locale=yes])
AC_MSG_RESULT($cf_locale)
if test "$cf_locale" != no ; then
	AC_DEFINE(OPT_LOCALE)

CF_FUNC_ICONV
if test "$cf_cv_func_iconv" != no ; then
AC_MSG_CHECKING(if you want to use iconv() for locale support)
AC_ARG_WITH(iconv,
	[  --with-iconv            use iconv() support for character-types],
	[cf_func_iconv="$withval"],
	[cf_func_iconv=yes])
AC_MSG_RESULT($cf_func_iconv)
if test "$cf_func_iconv" = yes ; then
	AC_DEFINE(OPT_ICONV_FUNCS)
	test "$cf_cv_func_iconv" != yes && LIBS="$cf_cv_func_iconv $LIBS"
fi # test $cf_func_iconv" = yes
fi # test $cf_cv_func_iconv != no
fi # test $cf_locale != no
fi # test $cf_cv_locale = yes

###	Debugging/development options
CF_WITH_DBMALLOC
CF_WITH_DMALLOC

AC_ARG_WITH(purify,
	[  --with-purify           test: use Purify],
	[AC_DEFINE(USE_PURIFY)
	 LINK_PREFIX="$LINK_PREFIX purify"
	 with_purify=yes],
	[with_purify=])

AC_ARG_WITH(fakevms,
	[  --with-fakevms          test: use fake VMS I/O module],
	[AC_DEFINE(OPT_VMS_PATH)
	 EXTRAOBJS="$EXTRAOBJS fakevms\$o vms2unix\$o"])

AC_ARG_WITH(no-leaks,
	[  --with-no-leaks         test: free permanent memory, analyze leaks],
	[AC_DEFINE(NO_LEAKS)
	 cf_doalloc=".${with_dmalloc}${with_dbmalloc}${with_purify}"
	 case ${cf_doalloc} in #(vi
	 *yes*) ;;
	 *) AC_DEFINE(DOALLOC,10000) ;;
	 esac
	 with_no_leaks=yes],
	[with_no_leaks=])

AC_ARG_WITH(trace,
	[  --with-trace            test: turn on debug-tracing],
	[AC_DEFINE(OPT_TRACE)
	 with_trace=yes],
	[with_trace=])

test -n "${with_trace}${with_no_leaks}" && EXTRAOBJS="$EXTRAOBJS trace\$o"

CF_WITH_WARNINGS

###	Do these last, since they rely on a properly constructed config.h

###	Mandatory checks for missing prototypes:
CHECK_DECL_FLAG="-I. -I$srcdir -Dscrn_chosen"
VILE_CHECK_HDRS='
#define CHECK_PROTOTYPES 1
#include <estruct.h>
'
CHECK_DECL_HDRS="$VILE_CHECK_HDRS"

CF_MISSING_EXTERN( \
environ \
getenv \
getpass \
getwd \
malloc \
realloc \
rindex \
strerror \
strtol \
)

if test ".$cf_cv_termlib" != ".none"
then
CHECK_DECL_HDRS="$VILE_CHECK_HDRS
#include <tcap.h>
"
	CF_TYPE_OUTCHAR
fi
if test -n "$cf_tc_externs"
then
CF_MISSING_EXTERN( \
$cf_tc_externs \
)
fi

###	Optional checks for missing functions (enabled with --with-warnings)
if test -n "$with_warnings"
then
CHECK_DECL_HDRS="$VILE_CHECK_HDRS"
CF_MISSING_EXTERN( \
access \
alarm \
atoi \
chdir \
close \
crypt \
dup \
execlp \
fclose \
fflush \
fileno \
fork \
fprintf \
fputs \
fread \
free \
fseek \
fwrite \
gethostname \
getpgrp \
getpid \
getuid \
isatty \
kill \
killpg \
longjmp \
lstat \
memset \
mkdir \
open \
pclose \
perror \
pipe \
popen \
printf \
puts \
qsort \
read \
readlink \
select \
setbuf \
setbuffer \
setitimer \
setjmp \
setpgrp \
setsid \
setvbuf \
sleep \
sscanf \
system \
time \
unlink \
utime \
utimes \
wait \
write \
)

CHECK_DECL_HDRS="$VILE_CHECK_HDRS
#if HAVE_SYS_IOCTL_H
#include	<sys/ioctl.h>
#endif
"
CF_MISSING_EXTERN( \
ioctl \
)
fi

if test "$VILE_BUILT_IN_FILTERS" != none ; then
	cf_filter_libs=yes
elif test "$VILE_LOADABLE_FILTERS" != none ; then
	cf_filter_libs=yes
else
	cf_filter_libs=no
fi

if test "$cf_filter_libs" = yes ; then
	EXTRAOBJS="$EXTRAOBJS builtflt\$o"
	CPPFLAGS="-I\$(srcdir)/filters $CPPFLAGS"
	FILTER_LIBS="-Lfilters -lvlflt"
	LIBBUILTFLT="${LIB_PREFIX}vlflt.a"
	BUILTHDRS="$BUILTHDRS builtflt.h"
	BUILTLIBS="$BUILTLIBS filters/$LIBBUILTFLT"
	AC_DEFINE(OPT_FILTER)
else
	BUILTLIBS=
	FILTER_LIBS=
	LIBBUILTFLT=
fi

AC_SUBST(EXTRAOBJS)
AC_SUBST(BUILTHDRS)
AC_SUBST(BUILTLIBS)
AC_SUBST(BUILTSRCS)
AC_SUBST(FILTER_LIBS)
AC_SUBST(LIBBUILTFLT)

# --- check dynamic loading capabilities

cf_need_libdl=no

test "$VILE_LOADABLE_FILTERS" != none && cf_need_libdl=yes
test "$with_plugins"          != no   && cf_need_libdl=yes

if test "$with_plugins" != no ; then
	if test "$GCC" = yes ; then
		LDFLAGS="$LDFLAGS -export-dynamic"
	# TODO: how to do with other compilers ? can libtool help ?
	fi
	AC_DEFINE(OPT_PLUGIN)
	EXTRAOBJS="$EXTRAOBJS plugin\$o"
fi

if test "$cf_need_libdl" = yes ; then
	CF_FUNC_DLSYM
fi

if test "$VILE_LOADABLE_FILTERS" != none ; then
	if test "$GCC" = yes ; then

		# FIXME:  this doesn't work (gcc doesn't give an error
		# on an unrecognized option).
		cf_opt_rdynamic=no
		cf_save_CFLAGS="$CFLAGS"
		CFLAGS="-Wall -rdynamic $CFLAGS"
		AC_MSG_CHECKING(if gcc has -rdynamic option)
		AC_TRY_LINK([#include <stdio.h>],
			    [printf("Hello");],
			    [cf_opt_rdynamic=yes],
			    [cf_opt_rdynamic=no])
		AC_MSG_RESULT($cf_opt_rdynamic)
		test "$cf_opt_rdynamic" = no && CFLAGS="$cf_save_CFLAGS"

		SH_CFLAGS="-fPIC"
		SH_LDFLAGS="-shared"
	else
		# this works for Solaris and IRIX64
		SH_CFLAGS="-KPIC"
		SH_LDFLAGS="-G"
	fi
fi

AC_SUBST(SH_CFLAGS)
AC_SUBST(SH_LDFLAGS)

AC_CHECK_PROGS(SPELL_PROG, ispell spell, [])
case .$SPELL_PROG in
.ispell) AC_DEFINE(ISPELL_PROG);;
.spell) AC_DEFINE(SPELL_PROG);;
esac

filters_bindir=`echo "$VILE_LIBDIR_PATH" | sed -e 's%'$PATHSEP'.*%%'`
echo "Computing location to install filter programs: $filters_bindir"
AC_SUBST(filters_bindir)

###	output makefile and config.h
AC_OUTPUT(makefile filters/makefile filters/makefile.tmp:filters/makefile.2nd,
{
test -n "$ac_top_srcdir" && top_srcdir="$ac_top_srcdir"
if test "$top_srcdir" = ".."
then
	cf_srcdir=.
else
	cf_srcdir=`echo $top_srcdir |sed -e 's%^../%%'`
fi

echo "Checking for built-in filters: $VILE_BUILT_IN_FILTERS"
$AWK -f $cf_srcdir/filters/mk-1st.awk <$cf_srcdir/filters/genmake.mak mode=built-in list="$VILE_BUILT_IN_FILTERS" >>filters/makefile

echo "Checking for external filters: $VILE_EXTERNAL_FILTERS"
$AWK -f $cf_srcdir/filters/mk-1st.awk <$cf_srcdir/filters/genmake.mak mode=external list="$VILE_EXTERNAL_FILTERS" >>filters/makefile

echo "Checking for loadable filters: $VILE_LOADABLE_FILTERS"
$AWK -f $cf_srcdir/filters/mk-1st.awk <$cf_srcdir/filters/genmake.mak mode=loadable list="$VILE_LOADABLE_FILTERS" >>filters/makefile

cat   filters/makefile.tmp >>filters/makefile
rm -f filters/makefile.tmp

case $cf_srcdir in #(vi
/*|?:*[)] #(vi
	cf_SRCDIR=$cf_srcdir
	;;
*[)]
	cf_SRCDIR=../$cf_srcdir
	;;
esac

$AWK -f $cf_srcdir/filters/mk-2nd.awk <$cf_srcdir/filters/genmake.mak from=$cf_SRCDIR/filters linking="$ECHO_LD" compiling="$RULE_CC" show="$ECHO_CC" mode=built-in list="$VILE_BUILT_IN_FILTERS" >>filters/makefile
$AWK -f $cf_srcdir/filters/mk-2nd.awk <$cf_srcdir/filters/genmake.mak from=$cf_SRCDIR/filters linking="$ECHO_LD" compiling="$RULE_CC" show="$ECHO_CC" mode=external list="$VILE_EXTERNAL_FILTERS" >>filters/makefile
$AWK -f $cf_srcdir/filters/mk-2nd.awk <$cf_srcdir/filters/genmake.mak from=$cf_SRCDIR/filters linking="$ECHO_LD" compiling="$RULE_CC" show="$ECHO_CC" mode=loadable list="$VILE_LOADABLE_FILTERS" >>filters/makefile

(for i in $cf_srcdir/filters/*.key;do echo $i;done) | $AWK -f $cf_srcdir/filters/mk-key.awk from=$cf_srcdir >>filters/makefile
},
{
RULE_CC='$RULE_CC'
ECHO_LD='$ECHO_LD'
ECHO_CC='$ECHO_CC'
MAKE_LEX='$MAKE_LEX'
AWK="$AWK"
VILE_BUILT_IN_FILTERS='$VILE_BUILT_IN_FILTERS'
VILE_LOADABLE_FILTERS='$VILE_LOADABLE_FILTERS'
VILE_EXTERNAL_FILTERS='$VILE_EXTERNAL_FILTERS'
},
sort)