1128345Stjr# Process this file with autoconf to produce a configure script. 2128345Stjr 3221715Sdelphij# Copyright (C) 1984-2011 Mark Nudelman 4128345Stjr# 5128345Stjr# You may distribute under the terms of either the GNU General Public 6128345Stjr# License or the Less License, as specified in the README file. 7128345Stjr# 8128345Stjr# For more information about less, or for information on how to 9128345Stjr# contact the author, see the README file. 10128345Stjr 11128345Stjr# Autoconf initialization. 12128345StjrAC_INIT(less, 1) 13128345StjrAC_CONFIG_SRCDIR([forwback.c]) 14128345StjrAC_CONFIG_HEADER([defines.h]) 15128345Stjr 16128345Stjr# Checks for programs. 17128345StjrAC_PROG_CC 18128345StjrAC_ISC_POSIX 19128345StjrAC_PROG_GCC_TRADITIONAL 20128345StjrAC_PROG_INSTALL 21128345Stjr 22128345Stjr# Checks for compilation model. 23128345StjrAC_SYS_LARGEFILE 24128345Stjr 25128345Stjr# Checks for general libraries. 26173682SdelphijAC_CHECK_LIB(tinfo, tgoto, [have_tinfo=yes], [have_tinfo=no]) 27128345StjrAC_CHECK_LIB(xcurses, initscr, [have_xcurses=yes], [have_xcurses=no]) 28161475SdelphijAC_CHECK_LIB(ncursesw, initscr, [have_ncursesw=yes], [have_ncursesw=no]) 29128345StjrAC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no]) 30128345StjrAC_CHECK_LIB(curses, initscr, [have_curses=yes], [have_curses=no]) 31128345StjrAC_CHECK_LIB(termcap, tgetent, [have_termcap=yes], [have_termcap=no]) 32128345StjrAC_CHECK_LIB(termlib, tgetent, [have_termlib=yes], [have_termlib=no]) 33240121Sdelphij# Regular expressions (regcmp) are in -lgen on Solaris 2, (but in libc 34240121Sdelphij# at least on Solaris 10 (2.10)) and in -lintl on SCO Unix. 35240121SdelphijAC_SEARCH_LIBS([regcmp], [gen intl PW]) 36128345Stjr 37128345Stjr# Checks for terminal libraries 38128345StjrAC_MSG_CHECKING([for working terminal libraries]) 39128345StjrTERMLIBS= 40128345Stjr 41128345Stjr# Check for systems where curses is broken. 42128345Stjrcurses_broken=0 43128345Stjrif test x`uname -s` = "xHP-UX" >/dev/null 2>&1; then 44128345Stjrif test x`uname -r` = "xB.11.00" >/dev/null 2>&1; then 45128345Stjr curses_broken=1 46128345Stjrfi 47128345Stjrif test x`uname -r` = "xB.11.11" >/dev/null 2>&1; then 48128345Stjr curses_broken=1 49128345Stjrfi 50128345Stjrfi 51128345Stjr 52128345Stjrif test $curses_broken = 0; then 53173682Sdelphij 54173682Sdelphij# -- Try tinfo. 55173682Sdelphijif test "x$TERMLIBS" = x; then 56173682Sdelphij if test $have_tinfo = yes; then 57173682Sdelphij TERMLIBS="-ltinfo" 58173682Sdelphij SAVE_LIBS=$LIBS 59173682Sdelphij LIBS="$LIBS $TERMLIBS" 60173682Sdelphij AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], 61173682Sdelphij [termok=yes], [termok=no]) 62173682Sdelphij LIBS=$SAVE_LIBS 63173682Sdelphij if test $termok = no; then TERMLIBS=""; fi 64173682Sdelphij fi 65173682Sdelphijfi 66173682Sdelphij 67128345Stjr# -- Try xcurses. 68128345Stjrif test "x$TERMLIBS" = x; then 69128345Stjr if test $have_xcurses = yes; then 70128345Stjr TERMLIBS="-lxcurses" 71128345Stjr SAVE_LIBS=$LIBS 72128345Stjr LIBS="$LIBS $TERMLIBS" 73128345Stjr AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], 74128345Stjr [termok=yes], [termok=no]) 75128345Stjr LIBS=$SAVE_LIBS 76128345Stjr if test $termok = no; then TERMLIBS=""; fi 77128345Stjr fi 78128345Stjrfi 79128345Stjr 80170256Sdelphij# -- Try ncursesw. 81161475Sdelphijif test "x$TERMLIBS" = x; then 82161475Sdelphij if test $have_ncursesw = yes; then 83161475Sdelphij TERMLIBS="-lncursesw" 84161475Sdelphij SAVE_LIBS=$LIBS 85161475Sdelphij LIBS="$LIBS $TERMLIBS" 86161475Sdelphij AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], 87161475Sdelphij [termok=yes], [termok=no]) 88161475Sdelphij LIBS=$SAVE_LIBS 89161475Sdelphij if test $termok = no; then TERMLIBS=""; fi 90161475Sdelphij fi 91161475Sdelphijfi 92161475Sdelphij 93128345Stjr# -- Try ncurses. 94128345Stjrif test "x$TERMLIBS" = x; then 95128345Stjr if test $have_ncurses = yes; then 96128345Stjr TERMLIBS="-lncurses" 97128345Stjr SAVE_LIBS=$LIBS 98128345Stjr LIBS="$LIBS $TERMLIBS" 99128345Stjr AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], 100128345Stjr [termok=yes], [termok=no]) 101128345Stjr LIBS=$SAVE_LIBS 102128345Stjr if test $termok = no; then TERMLIBS=""; fi 103128345Stjr fi 104128345Stjrfi 105128345Stjr 106128345Stjr# -- Try curses. 107128345Stjrif test "x$TERMLIBS" = x; then 108128345Stjr if test $have_curses = yes; then 109128345Stjr TERMLIBS="-lcurses" 110128345Stjr SAVE_LIBS=$LIBS 111128345Stjr LIBS="$LIBS $TERMLIBS" 112128345Stjr AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], 113128345Stjr [termok=yes], [termok=no]) 114128345Stjr LIBS=$SAVE_LIBS 115128345Stjr if test $termok = no; then TERMLIBS=""; fi 116128345Stjr fi 117128345Stjrfi 118128345Stjr 119128345Stjr# -- Try curses & termcap. 120128345Stjrif test "x$TERMLIBS" = x; then 121128345Stjr if test $have_curses = yes; then 122128345Stjr if test $have_termcap = yes; then 123128345Stjr TERMLIBS="-lcurses -ltermcap" 124128345Stjr SAVE_LIBS=$LIBS 125128345Stjr LIBS="$LIBS $TERMLIBS" 126128345Stjr AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], 127128345Stjr [termok=yes], [termok=no]) 128128345Stjr LIBS=$SAVE_LIBS 129128345Stjr if test $termok = no; then TERMLIBS=""; fi 130128345Stjr fi 131128345Stjr fi 132128345Stjrfi 133128345Stjrfi 134128345Stjr 135128345Stjr# -- Try termcap. 136128345Stjrif test "x$TERMLIBS" = x; then 137128345Stjr if test $have_termcap = yes; then 138128345Stjr TERMLIBS="-ltermcap" 139128345Stjr SAVE_LIBS=$LIBS 140128345Stjr LIBS="$LIBS $TERMLIBS" 141128345Stjr AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], 142128345Stjr [termok=yes], [termok=no]) 143128345Stjr LIBS=$SAVE_LIBS 144128345Stjr if test $termok = no; then TERMLIBS=""; fi 145128345Stjr fi 146128345Stjrfi 147128345Stjr 148128345Stjr# -- Try termlib. 149128345Stjrif test "x$TERMLIBS" = x; then 150128345Stjr if test $have_termlib = yes; then 151128345Stjr TERMLIBS="-lcurses -ltermlib" 152128345Stjr SAVE_LIBS=$LIBS 153128345Stjr LIBS="$LIBS $TERMLIBS" 154128345Stjr AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], 155128345Stjr [termok=yes], [termok=no]) 156128345Stjr LIBS=$SAVE_LIBS 157128345Stjr if test $termok = no; then TERMLIBS=""; fi 158128345Stjr fi 159128345Stjrfi 160128345Stjr 161128345Stjrif test "x$TERMLIBS" = x; then 162128345Stjr AC_MSG_RESULT(Cannot find terminal libraries - configure failed) 163128345Stjr exit 1 164128345Stjrfi 165128345StjrAC_MSG_RESULT(using $TERMLIBS) 166128345StjrLIBS="$LIBS $TERMLIBS" 167128345Stjr 168128345Stjr# Checks for header files. 169128345StjrAC_HEADER_STDC 170173682SdelphijAC_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]) 171128345Stjr 172128345Stjr# Checks for typedefs, structures, and compiler characteristics. 173128345StjrAC_HEADER_STAT 174128345StjrAC_C_CONST 175128345StjrAC_TYPE_OFF_T 176128345StjrAC_TYPE_SIZE_T 177128345StjrAC_HEADER_TIME 178128345Stjr 179128345Stjr# Autoheader templates for symbols defined later by AC_DEFINE. 180240121SdelphijAH_TEMPLATE([HAVE_GNU_REGEX], 181240121Sdelphij [GNU regex library]) 182128345StjrAH_TEMPLATE([HAVE_POSIX_REGCOMP], 183128345Stjr [POSIX regcomp() and regex.h]) 184128345StjrAH_TEMPLATE([HAVE_PCRE], 185128345Stjr [PCRE (Perl-compatible regular expression) library]) 186128345StjrAH_TEMPLATE([HAVE_RE_COMP], 187128345Stjr [BSD re_comp()]) 188128345StjrAH_TEMPLATE([HAVE_REGCMP], 189128345Stjr [System V regcmp()]) 190128345StjrAH_TEMPLATE([HAVE_V8_REGCOMP], 191128345Stjr [Henry Spencer V8 regcomp() and regexp.h]) 192128345StjrAH_TEMPLATE([NO_REGEX], 193128345Stjr [pattern matching is supported, but without metacharacters.]) 194128345StjrAH_TEMPLATE([HAVE_REGEXEC2], 195128345Stjr []) 196128345StjrAH_TEMPLATE([HAVE_VOID], 197128345Stjr [Define HAVE_VOID if your compiler supports the "void" type.]) 198221715SdelphijAH_TEMPLATE([HAVE_FLOAT], 199221715Sdelphij [Define HAVE_FLOAT if your compiler supports the "double" type.]) 200128345StjrAH_TEMPLATE([HAVE_CONST], 201128345Stjr [Define HAVE_CONST if your compiler supports the "const" modifier.]) 202173682SdelphijAH_TEMPLATE([HAVE_STAT_INO], 203173682Sdelphij [Define HAVE_STAT_INO if your struct stat has st_ino and st_dev.]) 204128345StjrAH_TEMPLATE([HAVE_TIME_T], 205128345Stjr [Define HAVE_TIME_T if your system supports the "time_t" type.]) 206128345StjrAH_TEMPLATE([HAVE_STRERROR], 207128345Stjr [Define HAVE_STRERROR if you have the strerror() function.]) 208128345StjrAH_TEMPLATE([HAVE_FILENO], 209128345Stjr [Define HAVE_FILENO if you have the fileno() macro.]) 210128345StjrAH_TEMPLATE([HAVE_ERRNO], 211128345Stjr [Define HAVE_ERRNO if you have the errno variable.]) 212128345StjrAH_TEMPLATE([MUST_DEFINE_ERRNO], 213128345Stjr [Define MUST_DEFINE_ERRNO if you have errno but it is not define in errno.h.]) 214128345StjrAH_TEMPLATE([HAVE_SYS_ERRLIST], 215128345Stjr [Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable.]) 216128345StjrAH_TEMPLATE([HAVE_OSPEED], 217128345Stjr [Define HAVE_OSPEED if your termcap library has the ospeed variable.]) 218128345StjrAH_TEMPLATE([MUST_DEFINE_OSPEED], 219128345Stjr [Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined in termcap.h.]) 220128345StjrAH_TEMPLATE([HAVE_LOCALE], 221128345Stjr [Define HAVE_LOCALE if you have locale.h and setlocale.]) 222128345StjrAH_TEMPLATE([HAVE_TERMIOS_FUNCS], 223128345Stjr [Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr.]) 224128345StjrAH_TEMPLATE([HAVE_UPPER_LOWER], 225128345Stjr [Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower.]) 226173682SdelphijAH_TEMPLATE([HAVE_WCTYPE], 227173682Sdelphij [Define HAVE_WCTYPE if you have iswupper, iswlower, towupper, towlower.]) 228128345StjrAH_TEMPLATE([HAVE_SIGSET_T], 229128345Stjr [Define HAVE_SIGSET_T you have the sigset_t type.]) 230128345StjrAH_TEMPLATE([HAVE_SIGEMPTYSET], 231128345Stjr [Define HAVE_SIGEMPTYSET if you have the sigemptyset macro.]) 232128345StjrAH_TEMPLATE([EDIT_PGM], 233128345Stjr [Define EDIT_PGM to your editor.]) 234161475SdelphijAH_TEMPLATE([SECURE_COMPILE], 235161475Sdelphij [Define SECURE_COMPILE=1 to build a secure version of less.]) 236128345Stjr 237128345Stjr# Checks for identifiers. 238128345StjrAC_TYPE_OFF_T 239128345StjrAC_MSG_CHECKING(for void) 240128345StjrAC_TRY_COMPILE(, [void *foo = 0;], 241128345Stjr [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_VOID)], [AC_MSG_RESULT(no)]) 242128345StjrAC_MSG_CHECKING(for const) 243128345StjrAC_TRY_COMPILE(, [const int foo = 0;], 244128345Stjr [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_CONST)], [AC_MSG_RESULT(no)]) 245128345StjrAC_MSG_CHECKING(for time_t) 246128345StjrAC_TRY_COMPILE([#include <time.h>], [time_t t = 0;], 247128345Stjr [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIME_T)], [AC_MSG_RESULT(no)]) 248173682SdelphijAC_MSG_CHECKING(for st_ino in struct stat) 249173682SdelphijAC_TRY_COMPILE([#include <sys/types.h> 250173682Sdelphij#include <sys/stat.h>], 251173682Sdelphij [struct stat s; dev_t dev = s.st_dev; ino_t ino = s.st_ino;], 252173682Sdelphij [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STAT_INO)], [AC_MSG_RESULT(no)]) 253128345Stjr 254128345Stjr# Checks for library functions. 255128345StjrAC_TYPE_SIGNAL 256170256SdelphijAC_CHECK_FUNCS([fsync popen _setjmp sigprocmask sigsetmask snprintf stat system fchmod]) 257128345Stjr 258170256Sdelphij# AC_CHECK_FUNCS may not work for inline functions, so test these separately. 259170256SdelphijAC_MSG_CHECKING(for memcpy) 260170256SdelphijAC_TRY_LINK([ 261170256Sdelphij#if HAVE_STRING_H 262170256Sdelphij#include <string.h> 263170256Sdelphij#endif], [memcpy(0,0,0);], 264170256Sdelphij [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MEMCPY)], [AC_MSG_RESULT(no)]) 265170256Sdelphij 266170256SdelphijAC_MSG_CHECKING(for strchr) 267170256SdelphijAC_TRY_LINK([ 268170256Sdelphij#if HAVE_STRING_H 269170256Sdelphij#include <string.h> 270170256Sdelphij#endif], [strchr("x",'x');], 271170256Sdelphij [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRCHR)], [AC_MSG_RESULT(no)]) 272170256Sdelphij 273170256SdelphijAC_MSG_CHECKING(for strstr) 274170256SdelphijAC_TRY_LINK([ 275170256Sdelphij#if HAVE_STRING_H 276170256Sdelphij#include <string.h> 277170256Sdelphij#endif], [strstr("x","x");], 278170256Sdelphij [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRSTR)], [AC_MSG_RESULT(no)]) 279170256Sdelphij 280128345Stjr# Some systems have termios.h but not the corresponding functions. 281128345StjrAC_CHECK_FUNC(tcgetattr, AC_DEFINE(HAVE_TERMIOS_FUNCS)) 282128345Stjr 283128345StjrAC_MSG_CHECKING(for fileno) 284128345StjrAC_TRY_LINK([ 285128345Stjr#if HAVE_STDIO_H 286128345Stjr#include <stdio.h> 287128345Stjr#endif], [static int x; x = fileno(stdin);], 288128345Stjr [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FILENO)], [AC_MSG_RESULT(no)]) 289128345Stjr 290128345StjrAC_MSG_CHECKING(for strerror) 291128345StjrAC_TRY_LINK([ 292128345Stjr#if HAVE_STDIO_H 293128345Stjr#include <stdio.h> 294128345Stjr#endif 295128345Stjr#if HAVE_STRING_H 296128345Stjr#include <string.h> 297128345Stjr#endif 298128345Stjr#if HAVE_ERRNO_H 299128345Stjr#include <errno.h> 300128345Stjr#endif], [static char *x; x = strerror(0);], 301128345Stjr [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRERROR)], [AC_MSG_RESULT(no)]) 302128345Stjr 303128345StjrAC_MSG_CHECKING(for sys_errlist) 304128345StjrAC_TRY_LINK(, [extern char *sys_errlist[]; static char **x; x = sys_errlist;], 305128345Stjr [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYS_ERRLIST)], [AC_MSG_RESULT(no)]) 306128345Stjr 307170256SdelphijAC_CHECK_TYPES([sigset_t],,,[#include <signal.h>]) 308128345Stjr 309128345StjrAC_MSG_CHECKING(for sigemptyset) 310128345StjrAC_TRY_LINK([ 311128345Stjr#include <signal.h> 312128345Stjr], [sigset_t s; sigemptyset(&s);], 313128345Stjr [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SIGEMPTYSET)], [AC_MSG_RESULT(no)]) 314128345Stjr 315128345Stjrhave_errno=no 316128345StjrAC_MSG_CHECKING(for errno) 317128345StjrAC_TRY_LINK([ 318128345Stjr#if HAVE_ERRNO_H 319128345Stjr#include <errno.h> 320128345Stjr#endif], [static int x; x = errno;], 321128345Stjr [AC_MSG_RESULT(yes - in errno.h); AC_DEFINE(HAVE_ERRNO) have_errno=yes]) 322128345Stjrif test $have_errno = no; then 323128345StjrAC_TRY_LINK([ 324128345Stjr#if HAVE_ERRNO_H 325128345Stjr#include <errno.h> 326128345Stjr#endif], [extern int errno; static int x; x = errno;], 327128345Stjr [AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_ERRNO) AC_DEFINE(MUST_DEFINE_ERRNO)], 328128345Stjr [AC_MSG_RESULT(no)]) 329128345Stjrfi 330128345Stjr 331128345StjrAC_MSG_CHECKING(for locale) 332128345StjrAC_TRY_LINK([#include <locale.h> 333172468Sdelphij#include <ctype.h> 334172468Sdelphij#include <langinfo.h>], [setlocale(LC_CTYPE,""); isprint(0); iscntrl(0);], 335128345Stjr [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_LOCALE)], [AC_MSG_RESULT(no)]) 336173682Sdelphij 337128345StjrAC_MSG_CHECKING(for ctype functions) 338128345StjrAC_TRY_LINK([ 339128345Stjr#if HAVE_CTYPE_H 340128345Stjr#include <ctype.h> 341128345Stjr#endif], [static int x; x = isupper(x); x = tolower(x); x = toupper(x);], 342128345Stjr [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UPPER_LOWER)], [AC_MSG_RESULT(no)]) 343128345Stjr 344173682SdelphijAC_MSG_CHECKING(for wctype functions) 345173682SdelphijAC_TRY_LINK([#include <wctype.h>], [iswlower(0); iswupper(0); towlower(0); towupper(0);], 346173682Sdelphij [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_WCTYPE)], [AC_MSG_RESULT(no)]) 347173682Sdelphij 348128345Stjr# Checks for external variable ospeed in the termcap library. 349128345Stjrhave_ospeed=no 350128345StjrAC_MSG_CHECKING(termcap for ospeed) 351128345StjrAC_TRY_LINK([ 352128345Stjr#include <sys/types.h> 353128345Stjr#if HAVE_TERMIOS_H 354128345Stjr#include <termios.h> 355128345Stjr#endif 356128345Stjr#if HAVE_TERMCAP_H 357128345Stjr#include <termcap.h> 358128345Stjr#endif], [ospeed = 0;], 359128345Stjr[AC_MSG_RESULT(yes - in termcap.h); AC_DEFINE(HAVE_OSPEED) have_ospeed=yes]) 360128345Stjrif test $have_ospeed = no; then 361128345StjrAC_TRY_LINK(, [extern short ospeed; ospeed = 0;], 362128345Stjr [AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_OSPEED) AC_DEFINE(MUST_DEFINE_OSPEED)], 363128345Stjr [AC_MSG_RESULT(no)]) 364128345Stjrfi 365128345Stjr 366161475Sdelphij# Compile in secure mode? 367161475SdelphijAC_ARG_WITH(secure, 368161475Sdelphij [ --with-secure Compile in secure mode], 369161475Sdelphij AC_DEFINE(SECURE_COMPILE, 1), AC_DEFINE(SECURE_COMPILE, 0)) 370161475Sdelphij 371221715Sdelphij# Should we use floating point? 372221715SdelphijAC_MSG_CHECKING(for floating point) 373221715SdelphijAC_ARG_WITH(no-float, 374221715Sdelphij [ --with-no-float Do not use floating point], 375221715Sdelphij WANT_NO_FLOAT=1, WANT_NO_FLOAT=0) 376221715Sdelphijif test $WANT_NO_FLOAT = 0; then 377221715Sdelphij AC_TRY_LINK(, [double f1 = 12.5; double f2 = f1*f1/2.5;], 378221715Sdelphij [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT)], [AC_MSG_RESULT(no)]) 379221715Sdelphijelse 380221715Sdelphij AC_MSG_RESULT(disabled by user) 381221715Sdelphijfi 382221715Sdelphij 383128345Stjr# Checks for regular expression functions. 384128345Stjrhave_regex=no 385128345Stjrhave_posix_regex=unknown 386251154Sdelphijsupported_regex="" 387128345Stjr 388161475Sdelphij# Select a regular expression library. 389128345StjrWANT_REGEX=auto 390128345StjrAC_ARG_WITH(regex, 391240121Sdelphij [ --with-regex={auto,gnu,pcre,posix,regcmp,re_comp,regcomp,regcomp-local,none} Select a regular expression library [auto]], 392128345Stjr WANT_REGEX="$withval") 393128345Stjr 394128345Stjrif test $have_regex = no; then 395128345Stjrif test $WANT_REGEX = auto -o $WANT_REGEX = posix; then 396128345Stjr# Some versions of Solaris have a regcomp() function, but it doesn't work! 397128345Stjr# So we run a test program. If we're cross-compiling, do it the old way. 398251154SdelphijAC_MSG_CHECKING(for POSIX regcomp) 399128345StjrAC_TRY_RUN([ 400128345Stjr#include <sys/types.h> 401128345Stjr#include <regex.h> 402128345Stjrmain() { regex_t r; regmatch_t rm; char *text = "xabcy"; 403128345Stjrif (regcomp(&r, "abc", 0)) exit(1); 404128345Stjrif (regexec(&r, text, 1, &rm, 0)) exit(1); 405128345Stjr#ifndef __WATCOMC__ 406128345Stjrif (rm.rm_so != 1) exit(1); /* check for correct offset */ 407128345Stjr#else 408128345Stjrif (rm.rm_sp != text + 1) exit(1); /* check for correct offset */ 409128345Stjr#endif 410128345Stjrexit(0); }], 411128345Stjr have_posix_regex=yes, have_posix_regex=no, have_posix_regex=unknown) 412128345Stjrif test $have_posix_regex = yes; then 413251154Sdelphij AC_MSG_RESULT(yes) 414251154Sdelphij AC_DEFINE(HAVE_POSIX_REGCOMP) supported_regex="$supported_regex posix" 415128345Stjr have_regex=yes 416128345Stjrelif test $have_posix_regex = unknown; then 417128345Stjr AC_TRY_LINK([ 418128345Stjr#include <sys/types.h> 419128345Stjr#include <regex.h>], 420128345Stjr [regex_t *r; regfree(r);], 421251154Sdelphij AC_MSG_RESULT(yes) 422251154Sdelphij AC_DEFINE(HAVE_POSIX_REGCOMP) have_regex=yes; supported_regex="$supported_regex posix") 423128345Stjrelse 424128345Stjr AC_MSG_RESULT(no) 425128345Stjrfi 426128345Stjrfi 427128345Stjrfi 428128345Stjr 429128345Stjrif test $have_regex = no; then 430251154Sdelphijif test $WANT_REGEX = auto -o $WANT_REGEX = pcre; then 431251154SdelphijAC_CHECK_LIB(pcre, pcre_compile, 432251154Sdelphij[AC_DEFINE(HAVE_PCRE) LIBS="$LIBS -lpcre" have_regex=yes; supported_regex="$supported_regex pcre"], []) 433240121Sdelphijfi 434240121Sdelphijfi 435240121Sdelphij 436240121Sdelphijif test $have_regex = no; then 437251154Sdelphijif test $WANT_REGEX = auto -o $WANT_REGEX = gnu; then 438251154SdelphijAC_CHECK_LIB(c, re_compile_pattern, 439251154Sdelphij[AC_DEFINE(HAVE_GNU_REGEX) have_regex=yes; supported_regex="$supported_regex gnu"], []) 440128345Stjrfi 441128345Stjrfi 442128345Stjr 443128345Stjrif test $have_regex = no; then 444128345Stjrif test $WANT_REGEX = auto -o $WANT_REGEX = regcmp; then 445128345StjrAC_CHECK_FUNC(regcmp, 446251154Sdelphij[AC_DEFINE(HAVE_REGCMP) have_regex=yes; supported_regex="$supported_regex regcmp"],[]) 447128345Stjrfi 448128345Stjrfi 449128345Stjr 450128345Stjrif test $have_regex = no; then 451128345Stjrif test $WANT_REGEX = auto -o $WANT_REGEX = regcomp; then 452251154SdelphijAC_MSG_CHECKING(for V8 regcomp) 453128345StjrAC_TRY_LINK([ 454128345Stjr#include "regexp.h"], [regcomp("");], 455251154Sdelphij[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_V8_REGCOMP) have_regex=yes; supported_regex="$supported_regex regcomp"],[AC_MSG_RESULT(no)]) 456128345Stjrfi 457128345Stjrfi 458128345Stjr 459128345Stjrif test $have_regex = no && test -f ${srcdir}/regexp.c; then 460128345Stjrif test $WANT_REGEX = auto -o $WANT_REGEX = regcomp-local; then 461251154SdelphijAC_MSG_RESULT(using V8 regcomp -- local source); AC_DEFINE(HAVE_V8_REGCOMP) 462251154Sdelphijsupported_regex="$supported_regex regcomp-local" 463251154SdelphijAC_DEFINE(HAVE_REGEXEC2) REGEX_O='regexp.$(O)' AC_SUBST(REGEX_O) have_regex=yes 464128345Stjrfi 465128345Stjrfi 466128345Stjr 467128345Stjrif test $have_regex = no; then 468128345Stjrif test $WANT_REGEX = auto -o $WANT_REGEX = re_comp; then 469251154SdelphijAC_MSG_CHECKING(for re_comp) 470251154SdelphijAC_CHECK_FUNC(re_comp, 471251154Sdelphij[AC_DEFINE(HAVE_RE_COMP) have_regex=yes; supported_regex="$supported_regex re_comp"],[]) 472128345Stjrfi 473128345Stjrfi 474128345Stjr 475128345Stjrif test $have_regex = no; then 476240121Sdelphijif test $WANT_REGEX = auto -o $WANT_REGEX = none; then 477251154SdelphijAC_MSG_RESULT(using no regex) 478251154Sdelphijelse 479251154SdelphijAC_MSG_WARN(cannot find regular expression library) 480240121Sdelphijfi 481251154SdelphijAC_DEFINE(NO_REGEX) supported_regex="$supported_regex none" 482240121Sdelphijfi 483240121Sdelphij 484251154SdelphijAC_MSG_RESULT(regular expression library: $supported_regex) 485128345Stjr 486128345StjrAC_ARG_WITH(editor, 487128345Stjr [ --with-editor=PROGRAM use PROGRAM as the default editor [vi]], 488128345Stjr AC_DEFINE_UNQUOTED(EDIT_PGM, "$withval"), AC_DEFINE(EDIT_PGM, "vi")) 489128345Stjr 490128345StjrAH_TOP([ 491128345Stjr/* Unix definition file for less. -*- C -*- 492128345Stjr * 493128345Stjr * This file has 3 sections: 494128345Stjr * User preferences. 495128345Stjr * Settings always true on Unix. 496128345Stjr * Settings automatically determined by configure. 497128345Stjr * 498128345Stjr * * * * * * WARNING * * * * * * 499128345Stjr * If you edit defines.h by hand, do "touch stamp-h" before you run make 500128345Stjr * so config.status doesn't overwrite your changes. 501128345Stjr */ 502128345Stjr 503128345Stjr/* User preferences. */ 504128345Stjr 505128345Stjr/* 506128345Stjr * SECURE is 1 if you wish to disable a bunch of features in order to 507128345Stjr * be safe to run by unprivileged users. 508161475Sdelphij * SECURE_COMPILE is set by the --with-secure configure option. 509128345Stjr */ 510161475Sdelphij#define SECURE SECURE_COMPILE 511128345Stjr 512128345Stjr/* 513128345Stjr * SHELL_ESCAPE is 1 if you wish to allow shell escapes. 514128345Stjr * (This is possible only if your system supplies the system() function.) 515128345Stjr */ 516128345Stjr#define SHELL_ESCAPE (!SECURE) 517128345Stjr 518128345Stjr/* 519128345Stjr * EXAMINE is 1 if you wish to allow examining files by name from within less. 520128345Stjr */ 521128345Stjr#define EXAMINE (!SECURE) 522128345Stjr 523128345Stjr/* 524128345Stjr * TAB_COMPLETE_FILENAME is 1 if you wish to allow the TAB key 525128345Stjr * to complete filenames at prompts. 526128345Stjr */ 527128345Stjr#define TAB_COMPLETE_FILENAME (!SECURE) 528128345Stjr 529128345Stjr/* 530128345Stjr * CMD_HISTORY is 1 if you wish to allow keys to cycle through 531128345Stjr * previous commands at prompts. 532128345Stjr */ 533128345Stjr#define CMD_HISTORY 1 534128345Stjr 535128345Stjr/* 536128345Stjr * HILITE_SEARCH is 1 if you wish to have search targets to be 537128345Stjr * displayed in standout mode. 538128345Stjr */ 539128345Stjr#define HILITE_SEARCH 1 540128345Stjr 541128345Stjr/* 542128345Stjr * EDITOR is 1 if you wish to allow editor invocation (the "v" command). 543128345Stjr * (This is possible only if your system supplies the system() function.) 544128345Stjr * EDIT_PGM is the name of the (default) editor to be invoked. 545128345Stjr */ 546128345Stjr#define EDITOR (!SECURE) 547128345Stjr 548128345Stjr/* 549128345Stjr * TAGS is 1 if you wish to support tag files. 550128345Stjr */ 551128345Stjr#define TAGS (!SECURE) 552128345Stjr 553128345Stjr/* 554128345Stjr * USERFILE is 1 if you wish to allow a .less file to specify 555128345Stjr * user-defined key bindings. 556128345Stjr */ 557128345Stjr#define USERFILE (!SECURE) 558128345Stjr 559128345Stjr/* 560128345Stjr * GLOB is 1 if you wish to have shell metacharacters expanded in filenames. 561128345Stjr * This will generally work if your system provides the "popen" function 562128345Stjr * and the "echo" shell command. 563128345Stjr */ 564128345Stjr#define GLOB (!SECURE) 565128345Stjr 566128345Stjr/* 567128345Stjr * PIPEC is 1 if you wish to have the "|" command 568128345Stjr * which allows the user to pipe data into a shell command. 569128345Stjr */ 570128345Stjr#define PIPEC (!SECURE) 571128345Stjr 572128345Stjr/* 573128345Stjr * LOGFILE is 1 if you wish to allow the -l option (to create log files). 574128345Stjr */ 575128345Stjr#define LOGFILE (!SECURE) 576128345Stjr 577128345Stjr/* 578128345Stjr * GNU_OPTIONS is 1 if you wish to support the GNU-style command 579128345Stjr * line options --help and --version. 580128345Stjr */ 581128345Stjr#define GNU_OPTIONS 1 582128345Stjr 583128345Stjr/* 584128345Stjr * ONLY_RETURN is 1 if you want RETURN to be the only input which 585128345Stjr * will continue past an error message. 586128345Stjr * Otherwise, any key will continue past an error message. 587128345Stjr */ 588128345Stjr#define ONLY_RETURN 0 589128345Stjr 590128345Stjr/* 591128345Stjr * LESSKEYFILE is the filename of the default lesskey output file 592128345Stjr * (in the HOME directory). 593128345Stjr * LESSKEYFILE_SYS is the filename of the system-wide lesskey output file. 594128345Stjr * DEF_LESSKEYINFILE is the filename of the default lesskey input 595128345Stjr * (in the HOME directory). 596161475Sdelphij * LESSHISTFILE is the filename of the history file 597161475Sdelphij * (in the HOME directory). 598128345Stjr */ 599128345Stjr#define LESSKEYFILE ".less" 600128345Stjr#define LESSKEYFILE_SYS SYSDIR "/sysless" 601128345Stjr#define DEF_LESSKEYINFILE ".lesskey" 602161475Sdelphij#define LESSHISTFILE ".lesshst" 603128345Stjr 604128345Stjr 605128345Stjr/* Settings always true on Unix. */ 606128345Stjr 607128345Stjr/* 608128345Stjr * Define MSDOS_COMPILER if compiling under Microsoft C. 609128345Stjr */ 610128345Stjr#define MSDOS_COMPILER 0 611128345Stjr 612128345Stjr/* 613128345Stjr * Pathname separator character. 614128345Stjr */ 615128345Stjr#define PATHNAME_SEP "/" 616128345Stjr 617128345Stjr/* 618170256Sdelphij * The value returned from tgetent on success. 619170256Sdelphij * Some HP-UX systems return 0 on success. 620170256Sdelphij */ 621170256Sdelphij#define TGETENT_OK 1 622170256Sdelphij 623170256Sdelphij/* 624128345Stjr * HAVE_SYS_TYPES_H is 1 if your system has <sys/types.h>. 625128345Stjr */ 626128345Stjr#define HAVE_SYS_TYPES_H 1 627128345Stjr 628128345Stjr/* 629128345Stjr * Define if you have the <sgstat.h> header file. 630128345Stjr */ 631128345Stjr#undef HAVE_SGSTAT_H 632128345Stjr 633128345Stjr/* 634128345Stjr * HAVE_PERROR is 1 if your system has the perror() call. 635128345Stjr * (Actually, if it has sys_errlist, sys_nerr and errno.) 636128345Stjr */ 637128345Stjr#define HAVE_PERROR 1 638128345Stjr 639128345Stjr/* 640128345Stjr * HAVE_TIME is 1 if your system has the time() call. 641128345Stjr */ 642128345Stjr#define HAVE_TIME 1 643128345Stjr 644128345Stjr/* 645128345Stjr * HAVE_SHELL is 1 if your system supports a SHELL command interpreter. 646128345Stjr */ 647128345Stjr#define HAVE_SHELL 1 648128345Stjr 649128345Stjr/* 650128345Stjr * Default shell metacharacters and meta-escape character. 651128345Stjr */ 652170256Sdelphij#define DEF_METACHARS "; *?\t\n'\"()<>[]|&^`#\\$%=~" 653128345Stjr#define DEF_METAESCAPE "\\" 654128345Stjr 655128345Stjr/* 656128345Stjr * HAVE_DUP is 1 if your system has the dup() call. 657128345Stjr */ 658128345Stjr#define HAVE_DUP 1 659128345Stjr 660170256Sdelphij/* Define to 1 if you have the memcpy() function. */ 661170256Sdelphij#define HAVE_MEMCPY 1 662170256Sdelphij 663170256Sdelphij/* Define to 1 if you have the strchr() function. */ 664170256Sdelphij#define HAVE_STRCHR 1 665170256Sdelphij 666170256Sdelphij/* Define to 1 if you have the strstr() function. */ 667170256Sdelphij#define HAVE_STRSTR 1 668170256Sdelphij 669128345Stjr/* 670128345Stjr * Sizes of various buffers. 671128345Stjr */ 672251154Sdelphij#if 0 /* old sizes for small memory machines */ 673128345Stjr#define CMDBUF_SIZE 512 /* Buffer for multichar commands */ 674128345Stjr#define UNGOT_SIZE 100 /* Max chars to unget() */ 675128345Stjr#define LINEBUF_SIZE 1024 /* Max size of line in input file */ 676128345Stjr#define OUTBUF_SIZE 1024 /* Output buffer */ 677128345Stjr#define PROMPT_SIZE 200 /* Max size of prompt string */ 678128345Stjr#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */ 679128345Stjr#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */ 680128345Stjr#define TAGLINE_SIZE 512 /* Max size of line in tags file */ 681128345Stjr#define TABSTOP_MAX 32 /* Max number of custom tab stops */ 682251154Sdelphij#else /* more reasonable sizes for modern machines */ 683251154Sdelphij#define CMDBUF_SIZE 2048 /* Buffer for multichar commands */ 684251154Sdelphij#define UNGOT_SIZE 200 /* Max chars to unget() */ 685251154Sdelphij#define LINEBUF_SIZE 1024 /* Initial max size of line in input file */ 686251154Sdelphij#define OUTBUF_SIZE 1024 /* Output buffer */ 687251154Sdelphij#define PROMPT_SIZE 2048 /* Max size of prompt string */ 688251154Sdelphij#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */ 689251154Sdelphij#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */ 690251154Sdelphij#define TAGLINE_SIZE 1024 /* Max size of line in tags file */ 691251154Sdelphij#define TABSTOP_MAX 128 /* Max number of custom tab stops */ 692251154Sdelphij#endif 693128345Stjr 694128345Stjr/* Settings automatically determined by configure. */ 695128345Stjr]) 696128345Stjr 697128345StjrAC_CONFIG_FILES([Makefile]) 698128345StjrAC_OUTPUT 699