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