]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - configure.ac
Vendor import of less v581.
[FreeBSD/FreeBSD.git] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2
3 # Copyright (C) 1984-2011  Mark Nudelman
4 #
5 # You may distribute under the terms of either the GNU General Public
6 # License or the Less License, as specified in the README file.
7 #
8 # For more information about less, or for information on how to 
9 # contact the author, see the README file.
10
11 # Autoconf initialization.
12 AC_INIT(less, 1)
13 AC_CONFIG_SRCDIR([forwback.c])
14 AC_CONFIG_HEADER([defines.h])
15
16 # Checks for programs.
17 AC_PROG_CC
18 AC_ISC_POSIX
19 AC_PROG_GCC_TRADITIONAL
20 AC_PROG_INSTALL
21
22 # Checks for compilation model.
23 AC_SYS_LARGEFILE
24
25 # Checks for general libraries.
26 AC_CHECK_LIB(tinfo, tgoto, [have_tinfo=yes], [have_tinfo=no])
27 AC_CHECK_LIB(tinfow, tgoto, [have_tinfow=yes], [have_tinfow=no])
28 AC_CHECK_LIB(xcurses, initscr, [have_xcurses=yes], [have_xcurses=no])
29 AC_CHECK_LIB(ncursesw, initscr, [have_ncursesw=yes], [have_ncursesw=no])
30 AC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no])
31 AC_CHECK_LIB(curses, initscr, [have_curses=yes], [have_curses=no])
32 AC_CHECK_LIB(termcap, tgetent, [have_termcap=yes], [have_termcap=no])
33 AC_CHECK_LIB(termlib, tgetent, [have_termlib=yes], [have_termlib=no])
34 # Regular expressions (regcmp) are in -lgen on Solaris 2, (but in libc
35 # at least on Solaris 10 (2.10)) and in -lintl on SCO Unix.
36 AC_SEARCH_LIBS([regcmp], [gen intl PW])
37
38 # Checks for terminal libraries
39 AC_MSG_CHECKING([for working terminal libraries])
40 TERMLIBS=
41
42 # Check for systems where curses is broken.
43 curses_broken=0
44 if test x`uname -s` = "xHP-UX" >/dev/null 2>&1; then
45 if test x`uname -r` = "xB.11.00" >/dev/null 2>&1; then
46    curses_broken=1
47 fi
48 if test x`uname -r` = "xB.11.11" >/dev/null 2>&1; then
49    curses_broken=1
50 fi
51 fi
52
53 if test $curses_broken = 0; then
54
55 # -- Try tinfo.
56 if test "x$TERMLIBS" = x; then
57   if test $have_tinfo = yes; then
58     TERMLIBS="-ltinfo"
59     SAVE_LIBS=$LIBS
60     LIBS="$LIBS $TERMLIBS"
61     AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);],
62       [termok=yes], [termok=no])
63     LIBS=$SAVE_LIBS
64     if test $termok = no; then TERMLIBS=""; fi
65   fi
66 fi
67
68 # -- Try tinfow.
69 if test "x$TERMLIBS" = x; then
70   if test $have_tinfow = yes; then
71     TERMLIBS="-ltinfow"
72     SAVE_LIBS=$LIBS
73     LIBS="$LIBS $TERMLIBS"
74     AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);],
75       [termok=yes], [termok=no])
76     LIBS=$SAVE_LIBS
77     if test $termok = no; then TERMLIBS=""; fi
78   fi
79 fi
80
81 # -- Try xcurses.
82 if test "x$TERMLIBS" = x; then
83   if test $have_xcurses = yes; then
84     TERMLIBS="-lxcurses"
85     SAVE_LIBS=$LIBS
86     LIBS="$LIBS $TERMLIBS"
87     AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);],
88       [termok=yes], [termok=no])
89     LIBS=$SAVE_LIBS
90     if test $termok = no; then TERMLIBS=""; fi
91   fi
92 fi
93
94 # -- Try ncursesw.
95 if test "x$TERMLIBS" = x; then
96   if test $have_ncursesw = yes; then
97     TERMLIBS="-lncursesw"
98     SAVE_LIBS=$LIBS
99     LIBS="$LIBS $TERMLIBS"
100     AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);],
101       [termok=yes], [termok=no])
102     LIBS=$SAVE_LIBS
103     if test $termok = no; then TERMLIBS=""; fi
104   fi
105 fi
106
107 # -- Try ncurses.
108 if test "x$TERMLIBS" = x; then
109   if test $have_ncurses = yes; then
110     TERMLIBS="-lncurses"
111     SAVE_LIBS=$LIBS
112     LIBS="$LIBS $TERMLIBS"
113     AC_TRY_LINK([#include <termcap.h>], [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);],
114       [termok=yes], [termok=no])
115     LIBS=$SAVE_LIBS
116     if test $termok = no; then TERMLIBS=""; fi
117   fi
118 fi
119
120 # -- Try curses.
121 if test "x$TERMLIBS" = x; then
122   if test $have_curses = yes; then
123     TERMLIBS="-lcurses"
124     SAVE_LIBS=$LIBS
125     LIBS="$LIBS $TERMLIBS"
126     AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);],
127       [termok=yes], [termok=no])
128     LIBS=$SAVE_LIBS
129     if test $termok = no; then TERMLIBS=""; fi
130   fi
131 fi
132
133 # -- Try curses & termcap.
134 if test "x$TERMLIBS" = x; then
135   if test $have_curses = yes; then
136   if test $have_termcap = yes; then
137     TERMLIBS="-lcurses -ltermcap"
138     SAVE_LIBS=$LIBS
139     LIBS="$LIBS $TERMLIBS"
140     AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);],
141       [termok=yes], [termok=no])
142     LIBS=$SAVE_LIBS
143     if test $termok = no; then TERMLIBS=""; fi
144   fi
145   fi
146 fi
147 fi
148
149 # -- Try termcap.
150 if test "x$TERMLIBS" = x; then
151   if test $have_termcap = yes; then
152     TERMLIBS="-ltermcap"
153     SAVE_LIBS=$LIBS
154     LIBS="$LIBS $TERMLIBS"
155     AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);],
156       [termok=yes], [termok=no])
157     LIBS=$SAVE_LIBS
158     if test $termok = no; then TERMLIBS=""; fi
159   fi
160 fi
161
162 # -- Try termlib.
163 if test "x$TERMLIBS" = x; then
164   if test $have_termlib = yes; then
165     TERMLIBS="-lcurses -ltermlib"
166     SAVE_LIBS=$LIBS
167     LIBS="$LIBS $TERMLIBS"
168     AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);],
169       [termok=yes], [termok=no])
170     LIBS=$SAVE_LIBS
171     if test $termok = no; then TERMLIBS=""; fi
172   fi
173 fi
174
175 if test "x$TERMLIBS" = x; then
176   AC_MSG_RESULT(Cannot find terminal libraries - configure failed)
177   exit 1
178 fi
179 AC_MSG_RESULT(using $TERMLIBS)
180 LIBS="$LIBS $TERMLIBS"
181
182 # Checks for header files.
183 AC_HEADER_STDC
184 AC_CHECK_HEADERS([ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h sys/ioctl.h sys/stream.h wctype.h])
185
186 # Checks for typedefs, structures, and compiler characteristics.
187 AC_HEADER_STAT
188 AC_C_CONST
189 AC_TYPE_OFF_T
190 AC_TYPE_SIZE_T
191 AC_HEADER_TIME
192
193 # Autoheader templates for symbols defined later by AC_DEFINE.
194 AH_TEMPLATE([HAVE_GNU_REGEX],
195         [GNU regex library])
196 AH_TEMPLATE([HAVE_POSIX_REGCOMP],
197         [POSIX regcomp() and regex.h])
198 AH_TEMPLATE([HAVE_PCRE],
199         [PCRE (Perl-compatible regular expression) library])
200 AH_TEMPLATE([HAVE_PCRE2],
201         [PCRE2 (Perl-compatible regular expression) library])
202 AH_TEMPLATE([HAVE_RE_COMP],
203         [BSD re_comp()])
204 AH_TEMPLATE([HAVE_REGCMP],
205         [System V regcmp()])
206 AH_TEMPLATE([HAVE_V8_REGCOMP],
207         [Henry Spencer V8 regcomp() and regexp.h])
208 AH_TEMPLATE([NO_REGEX],
209         [pattern matching is supported, but without metacharacters.])
210 AH_TEMPLATE([HAVE_REGEXEC2],
211         [])
212 AH_TEMPLATE([HAVE_VOID],
213         [Define HAVE_VOID if your compiler supports the "void" type.])
214 AH_TEMPLATE([HAVE_FLOAT],
215         [Define HAVE_FLOAT if your compiler supports the "double" type.])
216 AH_TEMPLATE([HAVE_CONST],
217         [Define HAVE_CONST if your compiler supports the "const" modifier.])
218 AH_TEMPLATE([HAVE_STAT_INO],
219         [Define HAVE_STAT_INO if your struct stat has st_ino and st_dev.])
220 AH_TEMPLATE([HAVE_TIME_T],
221         [Define HAVE_TIME_T if your system supports the "time_t" type.])
222 AH_TEMPLATE([HAVE_STRERROR],
223         [Define HAVE_STRERROR if you have the strerror() function.])
224 AH_TEMPLATE([HAVE_FILENO],
225         [Define HAVE_FILENO if you have the fileno() macro.])
226 AH_TEMPLATE([HAVE_ERRNO],
227         [Define HAVE_ERRNO if you have the errno variable.])
228 AH_TEMPLATE([MUST_DEFINE_ERRNO],
229         [Define MUST_DEFINE_ERRNO if you have errno but it is not define in errno.h.])
230 AH_TEMPLATE([HAVE_SYS_ERRLIST],
231         [Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable.])
232 AH_TEMPLATE([HAVE_OSPEED],
233         [Define HAVE_OSPEED if your termcap library has the ospeed variable.])
234 AH_TEMPLATE([MUST_DEFINE_OSPEED],
235         [Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined in termcap.h.])
236 AH_TEMPLATE([HAVE_LOCALE],
237         [Define HAVE_LOCALE if you have locale.h and setlocale.])
238 AH_TEMPLATE([HAVE_TERMIOS_FUNCS],
239         [Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr.])
240 AH_TEMPLATE([HAVE_UPPER_LOWER],
241         [Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower.])
242 AH_TEMPLATE([HAVE_WCTYPE],
243         [Define HAVE_WCTYPE if you have iswupper, iswlower, towupper, towlower.])
244 AH_TEMPLATE([HAVE_SIGSET_T],
245         [Define HAVE_SIGSET_T you have the sigset_t type.])
246 AH_TEMPLATE([HAVE_SIGEMPTYSET],
247         [Define HAVE_SIGEMPTYSET if you have the sigemptyset macro.])
248 AH_TEMPLATE([EDIT_PGM],
249         [Define EDIT_PGM to your editor.])
250 AH_TEMPLATE([SECURE_COMPILE],
251         [Define SECURE_COMPILE=1 to build a secure version of less.])
252
253 # Checks for identifiers.
254 AC_TYPE_OFF_T
255 AC_MSG_CHECKING(for void)
256 AC_TRY_COMPILE(, [void *foo = 0;], 
257   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_VOID)], [AC_MSG_RESULT(no)])
258 AC_MSG_CHECKING(for const)
259 AC_TRY_COMPILE(, [const int foo = 0;], 
260   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_CONST)], [AC_MSG_RESULT(no)])
261 AC_MSG_CHECKING(for time_t)
262 AC_TRY_COMPILE([#include <time.h>], [time_t t = 0;],
263   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIME_T)], [AC_MSG_RESULT(no)])
264 AC_MSG_CHECKING(for st_ino in struct stat)
265 AC_TRY_COMPILE([#include <sys/types.h>
266 #include <sys/stat.h>],
267   [struct stat s; dev_t dev = s.st_dev; ino_t ino = s.st_ino;],
268   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STAT_INO)], [AC_MSG_RESULT(no)])
269
270 # Checks for ANSI function prototypes.
271 AC_MSG_CHECKING(for ANSI function prototypes)
272 AC_TRY_COMPILE([], [int f(int a) { return a; }],
273   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ANSI_PROTOS)], [AC_MSG_RESULT(no)])
274
275 # Checks for library functions.
276 AC_TYPE_SIGNAL
277 AC_CHECK_FUNCS([fchmod fsync nanosleep poll popen realpath _setjmp sigprocmask sigsetmask snprintf stat system ttyname usleep])
278
279 # AC_CHECK_FUNCS may not work for inline functions, so test these separately.
280 AC_MSG_CHECKING(for memcpy)
281 AC_TRY_LINK([
282 #if HAVE_STRING_H
283 #include <string.h>
284 #endif], [memcpy(0,0,0);],
285   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MEMCPY)], [AC_MSG_RESULT(no)])
286
287 AC_MSG_CHECKING(for strchr)
288 AC_TRY_LINK([
289 #if HAVE_STRING_H
290 #include <string.h>
291 #endif], [strchr("x",'x');],
292   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRCHR)], [AC_MSG_RESULT(no)])
293
294 AC_MSG_CHECKING(for strstr)
295 AC_TRY_LINK([
296 #if HAVE_STRING_H
297 #include <string.h>
298 #endif], [strstr("x","x");],
299   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRSTR)], [AC_MSG_RESULT(no)])
300
301 # Some systems have termios.h but not the corresponding functions.
302 AC_CHECK_FUNC(tcgetattr, AC_DEFINE(HAVE_TERMIOS_FUNCS))
303
304 AC_MSG_CHECKING(for fileno)
305 AC_TRY_LINK([
306 #if HAVE_STDIO_H
307 #include <stdio.h>
308 #endif], [static int x; x = fileno(stdin);],
309   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FILENO)], [AC_MSG_RESULT(no)])
310
311 AC_MSG_CHECKING(for strerror)
312 AC_TRY_LINK([
313 #if HAVE_STDIO_H
314 #include <stdio.h>
315 #endif
316 #if HAVE_STRING_H
317 #include <string.h>
318 #endif
319 #if HAVE_ERRNO_H
320 #include <errno.h>
321 #endif], [static char *x; x = strerror(0);],
322   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRERROR)], [AC_MSG_RESULT(no)])
323
324 AC_MSG_CHECKING(for sys_errlist)
325 AC_TRY_LINK(, [extern char *sys_errlist[]; static char **x; x = sys_errlist;], 
326   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYS_ERRLIST)], [AC_MSG_RESULT(no)])
327
328 AC_CHECK_TYPES([sigset_t],,,[#include <signal.h>])
329
330 AC_MSG_CHECKING(for sigemptyset)
331 AC_TRY_LINK([
332 #include <signal.h>
333 ], [sigset_t s; sigemptyset(&s);],
334   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SIGEMPTYSET)], [AC_MSG_RESULT(no)])
335
336 have_errno=no
337 AC_MSG_CHECKING(for errno)
338 AC_TRY_LINK([
339 #if HAVE_ERRNO_H
340 #include <errno.h>
341 #endif], [static int x; x = errno;], 
342   [AC_MSG_RESULT(yes - in errno.h); AC_DEFINE(HAVE_ERRNO) have_errno=yes])
343 if test $have_errno = no; then
344 AC_TRY_LINK([
345 #if HAVE_ERRNO_H
346 #include <errno.h>
347 #endif], [extern int errno; static int x; x = errno;], 
348   [AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_ERRNO) AC_DEFINE(MUST_DEFINE_ERRNO)],
349   [AC_MSG_RESULT(no)])
350 fi
351
352 AC_MSG_CHECKING(for locale)
353 AC_TRY_LINK([#include <locale.h>
354 #include <ctype.h>
355 #include <langinfo.h>], [setlocale(LC_CTYPE,""); isprint(0); iscntrl(0);],
356   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_LOCALE)], [AC_MSG_RESULT(no)])
357
358 AC_MSG_CHECKING(for ctype functions)
359 AC_TRY_LINK([
360 #if HAVE_CTYPE_H
361 #include <ctype.h>
362 #endif], [static int x; x = isupper(x); x = tolower(x); x = toupper(x);],
363   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UPPER_LOWER)], [AC_MSG_RESULT(no)])
364
365 AC_MSG_CHECKING(for wctype functions)
366 AC_TRY_LINK([#include <wctype.h>], [iswlower(0); iswupper(0); towlower(0); towupper(0);],
367   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_WCTYPE)], [AC_MSG_RESULT(no)])
368
369 # Checks for external variable ospeed in the termcap library.
370 have_ospeed=no
371 AC_MSG_CHECKING(termcap for ospeed)
372 AC_TRY_LINK([
373 #include <sys/types.h>
374 #if HAVE_TERMIOS_H
375 #include <termios.h>
376 #endif
377 #if HAVE_TERMCAP_H
378 #include <termcap.h>
379 #endif], [ospeed = 0;],
380 [AC_MSG_RESULT(yes - in termcap.h); AC_DEFINE(HAVE_OSPEED) have_ospeed=yes])
381 if test $have_ospeed = no; then
382 AC_TRY_LINK(, [extern short ospeed; ospeed = 0;], 
383   [AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_OSPEED) AC_DEFINE(MUST_DEFINE_OSPEED)],
384   [AC_MSG_RESULT(no)])
385 fi
386
387 # Compile in secure mode?
388 AC_ARG_WITH(secure,
389   [  --with-secure           Compile in secure mode],
390   AC_DEFINE(SECURE_COMPILE, 1), AC_DEFINE(SECURE_COMPILE, 0))
391
392 # Should we use floating point?
393 AC_MSG_CHECKING(for floating point)
394 AC_ARG_WITH(no-float,
395   [  --with-no-float         Do not use floating point],
396   WANT_NO_FLOAT=1, WANT_NO_FLOAT=0)
397 if test $WANT_NO_FLOAT = 0; then
398   AC_TRY_LINK(, [double f1 = 12.5; double f2 = f1*f1/2.5;], 
399     [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT)], [AC_MSG_RESULT(no)])
400 else
401   AC_MSG_RESULT(disabled by user)
402 fi
403
404 # Checks for regular expression functions.
405 have_regex=no
406 have_posix_regex=unknown
407 supported_regex=""
408
409 # Select a regular expression library.
410 WANT_REGEX=auto
411 AC_ARG_WITH(regex,
412   [  --with-regex=LIB        select regular expression library (LIB is one of auto,none,gnu,pcre,pcre2,posix,regcmp,re_comp,regcomp,regcomp-local) [[auto]]],
413   WANT_REGEX="$withval")
414
415 if test $have_regex = no; then
416 if test $WANT_REGEX = auto -o $WANT_REGEX = posix; then
417 # Some versions of Solaris have a regcomp() function, but it doesn't work!
418 # So we run a test program.  If we're cross-compiling, do it the old way.
419 AC_MSG_CHECKING(for POSIX regcomp)
420 AC_TRY_RUN([
421 #include <sys/types.h>
422 #include <regex.h>
423 main() { regex_t r; regmatch_t rm; char *text = "xabcy";
424 if (regcomp(&r, "abc", 0)) exit(1);
425 if (regexec(&r, text, 1, &rm, 0)) exit(1);
426 #ifndef __WATCOMC__
427 if (rm.rm_so != 1) exit(1); /* check for correct offset */
428 #else
429 if (rm.rm_sp != text + 1) exit(1); /* check for correct offset */
430 #endif
431 exit(0); }],
432   have_posix_regex=yes, have_posix_regex=no, have_posix_regex=unknown)
433 if test $have_posix_regex = yes; then
434   AC_MSG_RESULT(yes)
435   AC_DEFINE(HAVE_POSIX_REGCOMP) supported_regex="$supported_regex posix"
436   have_regex=yes
437 elif test $have_posix_regex = unknown; then
438   AC_TRY_LINK([
439 #include <sys/types.h>
440 #include <regex.h>],
441   [regex_t *r; regfree(r);],
442   AC_MSG_RESULT(yes)
443   AC_DEFINE(HAVE_POSIX_REGCOMP) have_regex=yes; supported_regex="$supported_regex posix")
444 else
445   AC_MSG_RESULT(no)
446 fi
447 fi
448 fi
449
450 if test $have_regex = no; then
451 if test $WANT_REGEX = auto -o $WANT_REGEX = pcre2; then
452 AC_CHECK_LIB(pcre2-8, pcre2_compile_8, 
453 [AC_DEFINE(HAVE_PCRE2) LIBS="$LIBS -lpcre2-8" have_regex=yes; supported_regex="$supported_regex pcre2"], [])
454 fi
455 fi
456
457 if test $have_regex = no; then
458 if test $WANT_REGEX = auto -o $WANT_REGEX = pcre; then
459 AC_CHECK_LIB(pcre, pcre_compile, 
460 [AC_DEFINE(HAVE_PCRE) LIBS="$LIBS -lpcre" have_regex=yes; supported_regex="$supported_regex pcre"], [])
461 fi
462 fi
463
464 if test $have_regex = no; then
465 if test $WANT_REGEX = auto -o $WANT_REGEX = gnu; then
466 AC_CHECK_LIB(c, re_compile_pattern, 
467 [AC_DEFINE(HAVE_GNU_REGEX) have_regex=yes; supported_regex="$supported_regex gnu"], [])
468 fi
469 fi
470
471 if test $have_regex = no; then
472 if test $WANT_REGEX = auto -o $WANT_REGEX = regcmp; then
473 AC_CHECK_FUNC(regcmp, 
474 [AC_DEFINE(HAVE_REGCMP) have_regex=yes; supported_regex="$supported_regex regcmp"],[])
475 fi
476 fi
477
478 if test $have_regex = no; then
479 if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp; then
480 AC_MSG_CHECKING(for V8 regcomp)
481 AC_TRY_LINK([
482 #include "regexp.h"], [regcomp("");],
483 [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_V8_REGCOMP) have_regex=yes; supported_regex="$supported_regex regcomp"],[AC_MSG_RESULT(no)])
484 fi
485 fi
486
487 if test $have_regex = no && test -f ${srcdir}/regexp.c; then
488 if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp-local; then
489 AC_MSG_RESULT(using V8 regcomp -- local source); AC_DEFINE(HAVE_V8_REGCOMP) 
490 supported_regex="$supported_regex regcomp-local"
491 AC_DEFINE(HAVE_REGEXEC2) REGEX_O='regexp.$(O)' AC_SUBST(REGEX_O) have_regex=yes
492 fi
493 fi
494
495 if test $have_regex = no; then
496 if test $WANT_REGEX = auto -o $WANT_REGEX = re_comp; then
497 AC_MSG_CHECKING(for re_comp)
498 AC_CHECK_FUNC(re_comp,
499 [AC_DEFINE(HAVE_RE_COMP) have_regex=yes; supported_regex="$supported_regex re_comp"],[])
500 fi
501 fi
502
503 if test $have_regex = no; then
504 if test $WANT_REGEX = auto -o $WANT_REGEX = none; then
505 AC_MSG_RESULT(using no regex)
506 else
507 AC_MSG_WARN(cannot find regular expression library)
508 fi
509 AC_DEFINE(NO_REGEX) supported_regex="$supported_regex none"
510 fi
511
512 AC_MSG_RESULT(regular expression library: $supported_regex)
513
514 AC_ARG_WITH(editor,
515   [  --with-editor=PROGRAM   use PROGRAM as the default editor [[vi]]],
516   AC_DEFINE_UNQUOTED(EDIT_PGM, "$withval"), AC_DEFINE(EDIT_PGM, "vi"))
517
518 AH_TOP([
519 /* Unix definition file for less.  -*- C -*-
520  *
521  * This file has 3 sections:
522  * User preferences.
523  * Settings always true on Unix.
524  * Settings automatically determined by configure.
525  *
526  * * * * * *  WARNING  * * * * * *
527  * If you edit defines.h by hand, do "touch stamp-h" before you run make
528  * so config.status doesn't overwrite your changes.
529  */
530
531 /* User preferences.  */
532
533 /*
534  * SECURE is 1 if you wish to disable a bunch of features in order to
535  * be safe to run by unprivileged users.
536  * SECURE_COMPILE is set by the --with-secure configure option.
537  */
538 #define SECURE          SECURE_COMPILE
539
540 /*
541  * SHELL_ESCAPE is 1 if you wish to allow shell escapes.
542  * (This is possible only if your system supplies the system() function.)
543  */
544 #define SHELL_ESCAPE    (!SECURE)
545
546 /*
547  * EXAMINE is 1 if you wish to allow examining files by name from within less.
548  */
549 #define EXAMINE         (!SECURE)
550
551 /*
552  * TAB_COMPLETE_FILENAME is 1 if you wish to allow the TAB key
553  * to complete filenames at prompts.
554  */
555 #define TAB_COMPLETE_FILENAME   (!SECURE)
556
557 /*
558  * CMD_HISTORY is 1 if you wish to allow keys to cycle through
559  * previous commands at prompts.
560  */
561 #define CMD_HISTORY     1
562
563 /*
564  * HILITE_SEARCH is 1 if you wish to have search targets to be 
565  * displayed in standout mode.
566  */
567 #define HILITE_SEARCH   1
568
569 /*
570  * EDITOR is 1 if you wish to allow editor invocation (the "v" command).
571  * (This is possible only if your system supplies the system() function.)
572  * EDIT_PGM is the name of the (default) editor to be invoked.
573  */
574 #define EDITOR          (!SECURE)
575
576 /*
577  * TAGS is 1 if you wish to support tag files.
578  */
579 #define TAGS            (!SECURE)
580
581 /*
582  * USERFILE is 1 if you wish to allow a .less file to specify 
583  * user-defined key bindings.
584  */
585 #define USERFILE        (!SECURE)
586
587 /*
588  * GLOB is 1 if you wish to have shell metacharacters expanded in filenames.
589  * This will generally work if your system provides the "popen" function
590  * and the "echo" shell command.
591  */
592 #define GLOB            (!SECURE)
593
594 /*
595  * PIPEC is 1 if you wish to have the "|" command
596  * which allows the user to pipe data into a shell command.
597  */
598 #define PIPEC           (!SECURE)
599
600 /*
601  * LOGFILE is 1 if you wish to allow the -o option (to create log files).
602  */
603 #define LOGFILE         (!SECURE)
604
605 /*
606  * GNU_OPTIONS is 1 if you wish to support the GNU-style command
607  * line options --help and --version.
608  */
609 #define GNU_OPTIONS     1
610
611 /*
612  * ONLY_RETURN is 1 if you want RETURN to be the only input which
613  * will continue past an error message.
614  * Otherwise, any key will continue past an error message.
615  */
616 #define ONLY_RETURN     0
617
618 /*
619  * LESSKEYFILE is the filename of the default lesskey output file 
620  * (in the HOME directory).
621  * LESSKEYFILE_SYS is the filename of the system-wide lesskey output file.
622  * DEF_LESSKEYINFILE is the filename of the default lesskey input 
623  * (in the HOME directory).
624  * LESSHISTFILE is the filename of the history file
625  * (in the HOME directory).
626  */
627 #define LESSKEYFILE             ".less"
628 #define LESSKEYFILE_SYS         SYSDIR "/sysless"
629 #define DEF_LESSKEYINFILE       ".lesskey"
630 #define LESSHISTFILE            ".lesshst"
631
632
633 /* Settings always true on Unix.  */
634
635 /*
636  * Define MSDOS_COMPILER if compiling under Microsoft C.
637  */
638 #define MSDOS_COMPILER  0
639
640 /*
641  * Pathname separator character.
642  */
643 #define PATHNAME_SEP    "/"
644
645 /*
646  * The value returned from tgetent on success.
647  * Some HP-UX systems return 0 on success.
648  */
649 #define TGETENT_OK  1
650
651 /*
652  * HAVE_ANSI_PROTOS     is 1 if your compiler supports ANSI function prototypes.
653  */
654 #define HAVE_ANSI_PROTOS        1
655
656 /*
657  * HAVE_SYS_TYPES_H is 1 if your system has <sys/types.h>.
658  */
659 #define HAVE_SYS_TYPES_H        1
660
661 /*
662  * Define if you have the <sgstat.h> header file.
663  */
664 #undef HAVE_SGSTAT_H
665
666 /*
667  * HAVE_PERROR is 1 if your system has the perror() call.
668  * (Actually, if it has sys_errlist, sys_nerr and errno.)
669  */
670 #define HAVE_PERROR     1
671
672 /*
673  * HAVE_TIME is 1 if your system has the time() call.
674  */
675 #define HAVE_TIME       1
676
677 /*
678  * HAVE_SHELL is 1 if your system supports a SHELL command interpreter.
679  */
680 #define HAVE_SHELL      1
681
682 /*
683  * Default shell metacharacters and meta-escape character.
684  */
685 #define DEF_METACHARS   "; *?\t\n'\"()<>[]|&^`#\\$%=~{},"
686 #define DEF_METAESCAPE  "\\"
687
688 /* 
689  * HAVE_DUP is 1 if your system has the dup() call.
690  */
691 #define HAVE_DUP        1
692
693 /* Define to 1 if you have the memcpy() function. */
694 #define HAVE_MEMCPY 1
695
696 /* Define to 1 if you have the strchr() function. */
697 #define HAVE_STRCHR 1
698
699 /* Define to 1 if you have the strstr() function. */
700 #define HAVE_STRSTR 1
701
702 /*
703  * Sizes of various buffers.
704  */
705 #if 0 /* old sizes for small memory machines */
706 #define CMDBUF_SIZE     512     /* Buffer for multichar commands */
707 #define UNGOT_SIZE      100     /* Max chars to unget() */
708 #define LINEBUF_SIZE    1024    /* Max size of line in input file */
709 #define OUTBUF_SIZE     1024    /* Output buffer */
710 #define PROMPT_SIZE     200     /* Max size of prompt string */
711 #define TERMBUF_SIZE    2048    /* Termcap buffer for tgetent */
712 #define TERMSBUF_SIZE   1024    /* Buffer to hold termcap strings */
713 #define TAGLINE_SIZE    512     /* Max size of line in tags file */
714 #define TABSTOP_MAX     32      /* Max number of custom tab stops */
715 #else /* more reasonable sizes for modern machines */
716 #define CMDBUF_SIZE     2048    /* Buffer for multichar commands */
717 #define UNGOT_SIZE      200     /* Max chars to unget() */
718 #define LINEBUF_SIZE    1024    /* Initial max size of line in input file */
719 #define OUTBUF_SIZE     1024    /* Output buffer */
720 #define PROMPT_SIZE     2048    /* Max size of prompt string */
721 #define TERMBUF_SIZE    2048    /* Termcap buffer for tgetent */
722 #define TERMSBUF_SIZE   1024    /* Buffer to hold termcap strings */
723 #define TAGLINE_SIZE    1024    /* Max size of line in tags file */
724 #define TABSTOP_MAX     128     /* Max number of custom tab stops */
725 #endif
726
727 /* Settings automatically determined by configure.  */
728 ])
729
730 AC_CONFIG_FILES([Makefile])
731 AC_OUTPUT