-
Notifications
You must be signed in to change notification settings - Fork 84
/
configure.ac
696 lines (606 loc) · 22.9 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
# Process this file with autoconf to produce a configure script.
# Copyright (C) 1984-2023 Mark Nudelman
#
# You may distribute under the terms of either the GNU General Public
# License or the Less License, as specified in the README file.
#
# For more information about less, or for information on how to
# contact the author, see the README file.
# Autoconf initialization.
AC_INIT([less],[1])
AC_CONFIG_SRCDIR([forwback.c])
AC_CONFIG_HEADERS([defines.h])
# Checks for programs.
AC_PROG_CC
AC_SEARCH_LIBS([strerror],[cposix])
AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
# Checks for compilation model.
AC_SYS_LARGEFILE
# Checks for general libraries.
AC_CHECK_LIB(tinfo, tgoto, [have_tinfo=yes], [have_tinfo=no])
AC_CHECK_LIB(tinfow, tgoto, [have_tinfow=yes], [have_tinfow=no])
AC_CHECK_LIB(xcurses, initscr, [have_xcurses=yes], [have_xcurses=no])
AC_CHECK_LIB(ncursesw, initscr, [have_ncursesw=yes], [have_ncursesw=no])
AC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no])
AC_CHECK_LIB(curses, initscr, [have_curses=yes], [have_curses=no])
AC_CHECK_LIB(termcap, tgetent, [have_termcap=yes], [have_termcap=no])
AC_CHECK_LIB(termlib, tgetent, [have_termlib=yes], [have_termlib=no])
# Regular expressions (regcmp) are in -lgen on Solaris 2, (but in libc
# at least on Solaris 10 (2.10)) and in -lintl on SCO Unix.
AC_SEARCH_LIBS([regcmp], [gen intl PW])
# Checks for header files.
AC_CHECK_HEADERS_ONCE([ctype.h errno.h fcntl.h inttypes.h limits.h stdckdint.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h linux/magic.h sys/ioctl.h sys/stream.h sys/types.h sys/wait.h time.h wctype.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STAT
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
# Checks for terminal libraries
AC_MSG_CHECKING([for working terminal libraries])
TERMLIBS=
include_termcap_h=
if test "x$ac_cv_header_termcap_h" = xyes; then include_termcap_h="#include <termcap.h>"; fi
# Check for systems where curses is broken.
curses_broken=0
if test x`uname -s` = "xHP-UX" >/dev/null 2>&1; then
if test x`uname -r` = "xB.11.00" >/dev/null 2>&1; then
curses_broken=1
fi
if test x`uname -r` = "xB.11.11" >/dev/null 2>&1; then
curses_broken=1
fi
fi
if test $curses_broken = 0; then
# -- Try tinfo.
if test "x$TERMLIBS" = x; then
if test $have_tinfo = yes; then
TERMLIBS="-ltinfo"
SAVE_LIBS=$LIBS
LIBS="$LIBS $TERMLIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
LIBS=$SAVE_LIBS
if test $termok = no; then TERMLIBS=""; fi
fi
fi
# -- Try tinfow.
if test "x$TERMLIBS" = x; then
if test $have_tinfow = yes; then
TERMLIBS="-ltinfow"
SAVE_LIBS=$LIBS
LIBS="$LIBS $TERMLIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
LIBS=$SAVE_LIBS
if test $termok = no; then TERMLIBS=""; fi
fi
fi
# -- Try xcurses.
if test "x$TERMLIBS" = x; then
if test $have_xcurses = yes; then
TERMLIBS="-lxcurses"
SAVE_LIBS=$LIBS
LIBS="$LIBS $TERMLIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
LIBS=$SAVE_LIBS
if test $termok = no; then TERMLIBS=""; fi
fi
fi
# -- Try ncursesw.
if test "x$TERMLIBS" = x; then
if test $have_ncursesw = yes; then
TERMLIBS="-lncursesw"
SAVE_LIBS=$LIBS
LIBS="$LIBS $TERMLIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
LIBS=$SAVE_LIBS
if test $termok = no; then TERMLIBS=""; fi
fi
fi
# -- Try ncurses.
if test "x$TERMLIBS" = x; then
if test $have_ncurses = yes; then
TERMLIBS="-lncurses"
SAVE_LIBS=$LIBS
LIBS="$LIBS $TERMLIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
LIBS=$SAVE_LIBS
if test $termok = no; then TERMLIBS=""; fi
fi
fi
# -- Try curses.
if test "x$TERMLIBS" = x; then
if test $have_curses = yes; then
TERMLIBS="-lcurses"
SAVE_LIBS=$LIBS
LIBS="$LIBS $TERMLIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
LIBS=$SAVE_LIBS
if test $termok = no; then TERMLIBS=""; fi
fi
fi
# -- Try curses & termcap.
if test "x$TERMLIBS" = x; then
if test $have_curses = yes; then
if test $have_termcap = yes; then
TERMLIBS="-lcurses -ltermcap"
SAVE_LIBS=$LIBS
LIBS="$LIBS $TERMLIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
LIBS=$SAVE_LIBS
if test $termok = no; then TERMLIBS=""; fi
fi
fi
fi
fi
# -- Try termcap.
if test "x$TERMLIBS" = x; then
if test $have_termcap = yes; then
TERMLIBS="-ltermcap"
SAVE_LIBS=$LIBS
LIBS="$LIBS $TERMLIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
LIBS=$SAVE_LIBS
if test $termok = no; then TERMLIBS=""; fi
fi
fi
# -- Try termlib.
if test "x$TERMLIBS" = x; then
if test $have_termlib = yes; then
TERMLIBS="-lcurses -ltermlib"
SAVE_LIBS=$LIBS
LIBS="$LIBS $TERMLIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
LIBS=$SAVE_LIBS
if test $termok = no; then TERMLIBS=""; fi
fi
fi
if test "x$TERMLIBS" = x; then
AC_MSG_RESULT(Cannot find terminal libraries - configure failed)
exit 1
fi
AC_MSG_RESULT(using $TERMLIBS)
LIBS="$LIBS $TERMLIBS"
# Autoheader templates for symbols defined later by AC_DEFINE.
AH_TEMPLATE([HAVE_GNU_REGEX],
[GNU regex library])
AH_TEMPLATE([HAVE_POSIX_REGCOMP],
[POSIX regcomp() and regex.h])
AH_TEMPLATE([HAVE_PCRE],
[PCRE (Perl-compatible regular expression) library])
AH_TEMPLATE([HAVE_PCRE2],
[PCRE2 (Perl-compatible regular expression) library])
AH_TEMPLATE([HAVE_RE_COMP],
[BSD re_comp()])
AH_TEMPLATE([HAVE_REGCMP],
[System V regcmp()])
AH_TEMPLATE([HAVE_V8_REGCOMP],
[Henry Spencer V8 regcomp() and regexp.h])
AH_TEMPLATE([NO_REGEX],
[pattern matching is supported, but without metacharacters.])
AH_TEMPLATE([HAVE_REGEXEC2],
[])
AH_TEMPLATE([HAVE_VOID],
[Define HAVE_VOID if your compiler supports the "void" type.])
AH_TEMPLATE([HAVE_CONST],
[Define HAVE_CONST if your compiler supports the "const" modifier.])
AH_TEMPLATE([HAVE_STAT_INO],
[Define HAVE_STAT_INO if your struct stat has st_ino and st_dev.])
AH_TEMPLATE([HAVE_PROCFS],
[Define HAVE_PROCFS if have have fstatfs with f_type and PROC_SUPER_MAGIC.])
AH_TEMPLATE([HAVE_TIME_T],
[Define HAVE_TIME_T if your system supports the "time_t" type.])
AH_TEMPLATE([HAVE_STRERROR],
[Define HAVE_STRERROR if you have the strerror() function.])
AH_TEMPLATE([HAVE_FILENO],
[Define HAVE_FILENO if you have the fileno() macro.])
AH_TEMPLATE([HAVE_ERRNO],
[Define HAVE_ERRNO if you have the errno variable.])
AH_TEMPLATE([MUST_DEFINE_ERRNO],
[Define MUST_DEFINE_ERRNO if you have errno but it is not define in errno.h.])
AH_TEMPLATE([HAVE_SYS_ERRLIST],
[Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable.])
AH_TEMPLATE([HAVE_OSPEED],
[Define HAVE_OSPEED if your termcap library has the ospeed variable.])
AH_TEMPLATE([MUST_DEFINE_OSPEED],
[Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined in termcap.h.])
AH_TEMPLATE([HAVE_LOCALE],
[Define HAVE_LOCALE if you have locale.h and setlocale.])
AH_TEMPLATE([HAVE_TERMIOS_FUNCS],
[Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr.])
AH_TEMPLATE([HAVE_UPPER_LOWER],
[Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower.])
AH_TEMPLATE([HAVE_WCTYPE],
[Define HAVE_WCTYPE if you have iswupper, iswlower, towupper, towlower.])
AH_TEMPLATE([HAVE_SIGSET_T],
[Define HAVE_SIGSET_T you have the sigset_t type.])
AH_TEMPLATE([HAVE_SIGEMPTYSET],
[Define HAVE_SIGEMPTYSET if you have the sigemptyset macro.])
AH_TEMPLATE([EDIT_PGM],
[Define EDIT_PGM to your editor.])
AH_TEMPLATE([SECURE_COMPILE],
[Define SECURE_COMPILE=1 to build a secure version of less.])
# Checks for identifiers.
AC_MSG_CHECKING(for void)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[void *foo = 0;]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_VOID)],[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for const)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[const int foo = 0;]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_CONST)],[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for time_t)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[time_t t = 0;]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIME_T)],[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for st_ino in struct stat)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/stat.h>]], [[struct stat s; dev_t dev = s.st_dev; ino_t ino = s.st_ino;]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STAT_INO)],[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for procfs)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/statfs.h>
#if HAVE_LINUX_MAGIC_H
#include <linux/magic.h>
#endif]], [[struct statfs s; s.f_type = PROC_SUPER_MAGIC; (void) fstatfs(0,&s); ]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_PROCFS)],[AC_MSG_RESULT(no)])
# Checks for ANSI function prototypes.
AC_MSG_CHECKING(for ANSI function prototypes)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int f(int a) { return a; }]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ANSI_PROTOS)],[AC_MSG_RESULT(no)])
# Checks for library functions.
AC_CHECK_FUNCS([fchmod fsync nanosleep poll popen realpath _setjmp sigprocmask sigsetmask snprintf stat strsignal system ttyname usleep])
# AC_CHECK_FUNCS may not work for inline functions, so test these separately.
AC_MSG_CHECKING(for memcpy)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_STRING_H
#include <string.h>
#endif]], [[memcpy(0,0,0);]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MEMCPY)],[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for strchr)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_STRING_H
#include <string.h>
#endif]], [[strchr("x",'x');]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRCHR)],[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for strstr)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_STRING_H
#include <string.h>
#endif]], [[strstr("x","x");]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRSTR)],[AC_MSG_RESULT(no)])
# Some systems have termios.h but not the corresponding functions.
AC_CHECK_FUNC(tcgetattr, AC_DEFINE(HAVE_TERMIOS_FUNCS))
AC_MSG_CHECKING(for fileno)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_STDIO_H
#include <stdio.h>
#endif]], [[static int x; x = fileno(stdin);]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FILENO)],[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for strerror)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_STDIO_H
#include <stdio.h>
#endif
#if HAVE_STRING_H
#include <string.h>
#endif
#if HAVE_ERRNO_H
#include <errno.h>
#endif]], [[static char *x; x = strerror(0);]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRERROR)],[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for sys_errlist)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern char *sys_errlist[]; static char **x; x = sys_errlist;]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYS_ERRLIST)],[AC_MSG_RESULT(no)])
AC_CHECK_TYPES([sigset_t],,,[#include <signal.h>])
AC_MSG_CHECKING(for sigemptyset)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h>
]], [[sigset_t s; sigemptyset(&s);]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SIGEMPTYSET)],[AC_MSG_RESULT(no)])
have_errno=no
AC_MSG_CHECKING(for errno)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_ERRNO_H
#include <errno.h>
#endif]], [[static int x; x = errno;]])],[AC_MSG_RESULT(yes - in errno.h); AC_DEFINE(HAVE_ERRNO) have_errno=yes],[])
if test $have_errno = no; then
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_ERRNO_H
#include <errno.h>
#endif]], [[extern int errno; static int x; x = errno;]])],[AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_ERRNO) AC_DEFINE(MUST_DEFINE_ERRNO)],[AC_MSG_RESULT(no)])
fi
AC_MSG_CHECKING(for locale)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <locale.h>
#include <ctype.h>
#include <langinfo.h>]], [[setlocale(LC_CTYPE,""); isprint(0); iscntrl(0);]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_LOCALE)],[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for ctype functions)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_CTYPE_H
#include <ctype.h>
#endif]], [[static int x; x = isupper(x); x = tolower(x); x = toupper(x);]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UPPER_LOWER)],[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for wctype functions)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <wctype.h>]], [[iswlower(0); iswupper(0); towlower(0); towupper(0);]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_WCTYPE)],[AC_MSG_RESULT(no)])
# Checks for external variable ospeed in the termcap library.
have_ospeed=no
AC_MSG_CHECKING(termcap for ospeed)
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;]])],[AC_MSG_RESULT(yes - in termcap.h); AC_DEFINE(HAVE_OSPEED) have_ospeed=yes],[])
if test $have_ospeed = no; then
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern short ospeed; ospeed = 0;]])],[AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_OSPEED) AC_DEFINE(MUST_DEFINE_OSPEED)],[AC_MSG_RESULT(no)])
fi
# Compile in secure mode?
AC_ARG_WITH(secure,
[ --with-secure Compile in secure mode],
AC_DEFINE(SECURE_COMPILE, 1)
AC_SUBST(SECURE_COMPILE,1), AC_DEFINE(SECURE_COMPILE, 0)
AC_SUBST(SECURE_COMPILE,0))
# Checks for regular expression functions.
have_regex=no
have_posix_regex=unknown
supported_regex=""
# Select a regular expression library.
WANT_REGEX=auto
AC_ARG_WITH(regex,
[ --with-regex=LIB select regular expression library (LIB is one of auto,none,gnu,pcre,pcre2,posix,regcmp,re_comp,regcomp,regcomp-local) [[auto]]],
WANT_REGEX="$withval")
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = posix; then
# Some versions of Solaris have a regcomp() function, but it doesn't work!
# So we run a test program. If we're cross-compiling, do it the old way.
AC_MSG_CHECKING(for POSIX regcomp)
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <sys/types.h>
#include <regex.h>
int main() { regex_t r; regmatch_t rm; char *text = "xabcy";
if (regcomp(&r, "abc", 0)) return (1);
if (regexec(&r, text, 1, &rm, 0)) return (1);
#ifndef __WATCOMC__
if (rm.rm_so != 1) return (1); /* check for correct offset */
#else
if (rm.rm_sp != text + 1) return (1); /* check for correct offset */
#endif
return (0); }]])],[have_posix_regex=yes],[have_posix_regex=no],[have_posix_regex=unknown])
if test $have_posix_regex = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_POSIX_REGCOMP) supported_regex="$supported_regex posix"
have_regex=yes
elif test $have_posix_regex = unknown; then
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <regex.h>]], [[regex_t *r; regfree(r);]])],[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_POSIX_REGCOMP) have_regex=yes; supported_regex="$supported_regex posix"],[])
else
AC_MSG_RESULT(no)
fi
fi
fi
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = pcre2; then
AC_CHECK_LIB(pcre2-8, pcre2_compile_8,
[AC_DEFINE(HAVE_PCRE2) LIBS="$LIBS -lpcre2-8" have_regex=yes; supported_regex="$supported_regex pcre2"], [])
fi
fi
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = pcre; then
AC_CHECK_LIB(pcre, pcre_compile,
[AC_DEFINE(HAVE_PCRE) LIBS="$LIBS -lpcre" have_regex=yes; supported_regex="$supported_regex pcre"], [])
fi
fi
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = gnu; then
AC_CHECK_LIB(c, re_compile_pattern,
[AC_DEFINE(HAVE_GNU_REGEX) have_regex=yes; supported_regex="$supported_regex gnu"], [])
fi
fi
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = regcmp; then
AC_CHECK_FUNC(regcmp,
[AC_DEFINE(HAVE_REGCMP) have_regex=yes; supported_regex="$supported_regex regcmp"],[])
fi
fi
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp; then
AC_MSG_CHECKING(for V8 regcomp)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include "regexp.h"]], [[regcomp("");]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_V8_REGCOMP) have_regex=yes; supported_regex="$supported_regex regcomp"],[AC_MSG_RESULT(no)])
fi
fi
if test $have_regex = no && test -f ${srcdir}/regexp.c; then
if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp-local; then
AC_MSG_RESULT(using V8 regcomp -- local source); AC_DEFINE(HAVE_V8_REGCOMP)
supported_regex="$supported_regex regcomp-local"
AC_DEFINE(HAVE_REGEXEC2) REGEX_O='regexp.$(O)' AC_SUBST(REGEX_O) have_regex=yes
fi
fi
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = re_comp; then
AC_MSG_CHECKING(for re_comp)
AC_CHECK_FUNC(re_comp,
[AC_DEFINE(HAVE_RE_COMP) have_regex=yes; supported_regex="$supported_regex re_comp"],[])
fi
fi
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = none; then
AC_MSG_RESULT(using no regex)
else
AC_MSG_WARN(cannot find regular expression library)
fi
AC_DEFINE(NO_REGEX) supported_regex="$supported_regex none"
fi
AC_MSG_RESULT(regular expression library: $supported_regex)
AC_ARG_WITH(editor,
[ --with-editor=PROGRAM use PROGRAM as the default editor [[vi]]],
AC_DEFINE_UNQUOTED(EDIT_PGM, "$withval"), AC_DEFINE(EDIT_PGM, "vi"))
AH_TOP([
/* Unix definition file for less. -*- C -*-
*
* This file has 3 sections:
* User preferences.
* Settings always true on Unix.
* Settings automatically determined by configure.
*
* * * * * * WARNING * * * * * *
* If you edit defines.h by hand, do "touch stamp-h" before you run make
* so config.status doesn't overwrite your changes.
*/
/* User preferences. */
/*
* SECURE is 1 if you wish to disable a bunch of features in order to
* be safe to run by unprivileged users.
* SECURE_COMPILE is set by the --with-secure configure option.
*/
#define SECURE SECURE_COMPILE
/*
* SHELL_ESCAPE is 1 if you wish to allow shell escapes.
* (This is possible only if your system supplies the system() function.)
*/
#define SHELL_ESCAPE (!SECURE)
/*
* EXAMINE is 1 if you wish to allow examining files by name from within less.
*/
#define EXAMINE (!SECURE)
/*
* TAB_COMPLETE_FILENAME is 1 if you wish to allow the TAB key
* to complete filenames at prompts.
*/
#define TAB_COMPLETE_FILENAME (!SECURE)
/*
* CMD_HISTORY is 1 if you wish to allow keys to cycle through
* previous commands at prompts.
*/
#define CMD_HISTORY 1
/*
* HILITE_SEARCH is 1 if you wish to have search targets to be
* displayed in standout mode.
*/
#define HILITE_SEARCH 1
/*
* EDITOR is 1 if you wish to allow editor invocation (the "v" command).
* (This is possible only if your system supplies the system() function.)
* EDIT_PGM is the name of the (default) editor to be invoked.
*/
#define EDITOR (!SECURE)
/*
* TAGS is 1 if you wish to support tag files.
*/
#define TAGS (!SECURE)
/*
* USERFILE is 1 if you wish to allow a .less file to specify
* user-defined key bindings.
*/
#define USERFILE (!SECURE)
/*
* GLOB is 1 if you wish to have shell metacharacters expanded in filenames.
* This will generally work if your system provides the "popen" function
* and the "echo" shell command.
*/
#define GLOB (!SECURE)
/*
* PIPEC is 1 if you wish to have the "|" command
* which allows the user to pipe data into a shell command.
*/
#define PIPEC (!SECURE && HAVE_POPEN)
/*
* LOGFILE is 1 if you wish to allow the -o option (to create log files).
*/
#define LOGFILE (!SECURE)
/*
* GNU_OPTIONS is 1 if you wish to support the GNU-style command
* line options --help and --version.
*/
#define GNU_OPTIONS 1
/*
* ONLY_RETURN is 1 if you want RETURN to be the only input which
* will continue past an error message.
* Otherwise, any key will continue past an error message.
*/
#define ONLY_RETURN 0
/*
* LESSKEYFILE is the filename of the default lesskey output file
* (in the HOME directory).
* LESSKEYFILE_SYS is the filename of the system-wide lesskey output file.
* DEF_LESSKEYINFILE is the filename of the default lesskey input
* (in the HOME directory).
* LESSHISTFILE is the filename of the history file
* (in the HOME directory).
*/
#define LESSKEYFILE ".less"
#define LESSKEYFILE_SYS SYSDIR "/sysless"
#define DEF_LESSKEYINFILE ".lesskey"
#define LESSKEYINFILE_SYS SYSDIR "/syslesskey"
#define LESSHISTFILE ".lesshst"
/* Settings always true on Unix. */
/*
* Define MSDOS_COMPILER if compiling under Microsoft C.
*/
#define MSDOS_COMPILER 0
/*
* Pathname separator character.
*/
#define PATHNAME_SEP "/"
/*
* The value returned from tgetent on success.
* Some HP-UX systems return 0 on success.
*/
#define TGETENT_OK 1
/*
* HAVE_ANSI_PROTOS is 1 if your compiler supports ANSI function prototypes.
*/
#define HAVE_ANSI_PROTOS 1
/*
* HAVE_SYS_TYPES_H is 1 if your system has <sys/types.h>.
*/
#define HAVE_SYS_TYPES_H 1
/*
* Define if you have the <sgstat.h> header file.
*/
#undef HAVE_SGSTAT_H
/*
* HAVE_PERROR is 1 if your system has the perror() call.
* (Actually, if it has sys_errlist, sys_nerr and errno.)
*/
#define HAVE_PERROR 1
/*
* HAVE_TIME is 1 if your system has the time() call.
*/
#define HAVE_TIME 1
/*
* HAVE_SHELL is 1 if your system supports a SHELL command interpreter.
*/
#define HAVE_SHELL 1
/*
* Default shell metacharacters and meta-escape character.
*/
#define DEF_METACHARS "; *?\t\n'\"()<>[]|&^`#\\$%=~{},"
#define DEF_METAESCAPE "\\"
/*
* HAVE_DUP is 1 if your system has the dup() call.
*/
#define HAVE_DUP 1
/* Define to 1 if you have the memcpy() function. */
#define HAVE_MEMCPY 1
/* Define to 1 if you have the strchr() function. */
#define HAVE_STRCHR 1
/* Define to 1 if you have the strstr() function. */
#define HAVE_STRSTR 1
/* Define to 1 to support reading lesskey source files (not just binary). */
#define HAVE_LESSKEYSRC 1
/*
* Sizes of various buffers.
*/
#if 0 /* old sizes for small memory machines */
#define CMDBUF_SIZE 512 /* Buffer for multichar commands */
#define UNGOT_SIZE 100 /* Max chars to unget() */
#define LINEBUF_SIZE 1024 /* Max size of line in input file */
#define OUTBUF_SIZE 1024 /* Output buffer */
#define PROMPT_SIZE 200 /* Max size of prompt string */
#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */
#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
#define TAGLINE_SIZE 512 /* Max size of line in tags file */
#define TABSTOP_MAX 32 /* Max number of custom tab stops */
#else /* more reasonable sizes for modern machines */
#define CMDBUF_SIZE 2048 /* Buffer for multichar commands */
#define UNGOT_SIZE 200 /* Max chars to unget() */
#define LINEBUF_SIZE 1024 /* Initial max size of line in input file */
#define OUTBUF_SIZE 1024 /* Output buffer */
#define PROMPT_SIZE 2048 /* Max size of prompt string */
#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */
#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
#define TAGLINE_SIZE 1024 /* Max size of line in tags file */
#define TABSTOP_MAX 128 /* Max number of custom tab stops */
#endif
/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void
/* Settings automatically determined by configure. */
])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT