[BACK]Return to configure.ac CVS log [TXT][DIR] Up to [local] / src / usr.bin / less

Annotation of src/usr.bin/less/configure.ac, Revision 1.1.1.3

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