configure.ac revision 221715
11558Srgrimes# Process this file with autoconf to produce a configure script. 21558Srgrimes 31558Srgrimes# Copyright (C) 1984-2011 Mark Nudelman 41558Srgrimes# 51558Srgrimes# You may distribute under the terms of either the GNU General Public 61558Srgrimes# License or the Less License, as specified in the README file. 71558Srgrimes# 81558Srgrimes# For more information about less, or for information on how to 91558Srgrimes# contact the author, see the README file. 101558Srgrimes 111558Srgrimes# Autoconf initialization. 121558SrgrimesAC_INIT(less, 1) 131558SrgrimesAC_CONFIG_SRCDIR([forwback.c]) 141558SrgrimesAC_CONFIG_HEADER([defines.h]) 151558Srgrimes 161558Srgrimes# Checks for programs. 171558SrgrimesAC_PROG_CC 181558SrgrimesAC_ISC_POSIX 191558SrgrimesAC_PROG_GCC_TRADITIONAL 201558SrgrimesAC_PROG_INSTALL 211558Srgrimes 221558Srgrimes# Checks for compilation model. 231558SrgrimesAC_SYS_LARGEFILE 241558Srgrimes 251558Srgrimes# Checks for general libraries. 261558SrgrimesAC_CHECK_LIB(tinfo, tgoto, [have_tinfo=yes], [have_tinfo=no]) 271558SrgrimesAC_CHECK_LIB(xcurses, initscr, [have_xcurses=yes], [have_xcurses=no]) 281558SrgrimesAC_CHECK_LIB(ncursesw, initscr, [have_ncursesw=yes], [have_ncursesw=no]) 291558SrgrimesAC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no]) 30114589SobrienAC_CHECK_LIB(curses, initscr, [have_curses=yes], [have_curses=no]) 311558SrgrimesAC_CHECK_LIB(termcap, tgetent, [have_termcap=yes], [have_termcap=no]) 3238036ScharnierAC_CHECK_LIB(termlib, tgetent, [have_termlib=yes], [have_termlib=no]) 331558Srgrimes# Regular expressions (regcmp) are in -lgen on Solaris 2, 341558Srgrimes# and in -lintl on SCO Unix. 351558SrgrimesAC_CHECK_LIB(gen, regcmp) 361558SrgrimesAC_CHECK_LIB(intl, regcmp) 371558SrgrimesAC_CHECK_LIB(PW, regcmp) 3841684Sbde 39114589Sobrien# Checks for terminal libraries 4038036ScharnierAC_MSG_CHECKING([for working terminal libraries]) 41114589SobrienTERMLIBS= 42114589Sobrien 431558Srgrimes# Check for systems where curses is broken. 441558Srgrimescurses_broken=0 451558Srgrimesif test x`uname -s` = "xHP-UX" >/dev/null 2>&1; then 461558Srgrimesif test x`uname -r` = "xB.11.00" >/dev/null 2>&1; then 471558Srgrimes curses_broken=1 481558Srgrimesfi 491558Srgrimesif test x`uname -r` = "xB.11.11" >/dev/null 2>&1; then 5038036Scharnier curses_broken=1 511558Srgrimesfi 52114763Sobrienfi 531558Srgrimes 541558Srgrimesif test $curses_broken = 0; then 551558Srgrimes 561558Srgrimes# -- Try tinfo. 571558Srgrimesif test "x$TERMLIBS" = x; then 581558Srgrimes if test $have_tinfo = yes; then 591558Srgrimes TERMLIBS="-ltinfo" 601558Srgrimes SAVE_LIBS=$LIBS 611558Srgrimes LIBS="$LIBS $TERMLIBS" 621558Srgrimes AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], 631558Srgrimes [termok=yes], [termok=no]) 641558Srgrimes LIBS=$SAVE_LIBS 651558Srgrimes if test $termok = no; then TERMLIBS=""; fi 661558Srgrimes fi 671558Srgrimesfi 681558Srgrimes 691558Srgrimes# -- Try xcurses. 701558Srgrimesif test "x$TERMLIBS" = x; then 711558Srgrimes if test $have_xcurses = yes; then 721558Srgrimes TERMLIBS="-lxcurses" 7332399Salex SAVE_LIBS=$LIBS 7432399Salex LIBS="$LIBS $TERMLIBS" 7532399Salex AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], 7632399Salex [termok=yes], [termok=no]) 7732399Salex LIBS=$SAVE_LIBS 7832399Salex if test $termok = no; then TERMLIBS=""; fi 7932399Salex fi 8032399Salexfi 8132399Salex 8232399Salex# -- Try ncursesw. 8332399Salexif test "x$TERMLIBS" = x; then 8432399Salex if test $have_ncursesw = yes; then 851558Srgrimes TERMLIBS="-lncursesw" 861558Srgrimes SAVE_LIBS=$LIBS 871558Srgrimes LIBS="$LIBS $TERMLIBS" 881558Srgrimes AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], 891558Srgrimes [termok=yes], [termok=no]) 901558Srgrimes LIBS=$SAVE_LIBS 9148078Sru if test $termok = no; then TERMLIBS=""; fi 9279749Sdd fi 9379749Sddfi 941558Srgrimes 95197560Sdelphij# -- Try ncurses. 96201180Sedif test "x$TERMLIBS" = x; then 97197560Sdelphij if test $have_ncurses = yes; then 98197560Sdelphij TERMLIBS="-lncurses" 99197560Sdelphij SAVE_LIBS=$LIBS 100197560Sdelphij LIBS="$LIBS $TERMLIBS" 101197560Sdelphij AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], 102197560Sdelphij [termok=yes], [termok=no]) 103197560Sdelphij LIBS=$SAVE_LIBS 1041558Srgrimes if test $termok = no; then TERMLIBS=""; fi 105140796Sdelphij fi 106140796Sdelphijfi 1071558Srgrimes 108140796Sdelphij# -- Try curses. 1091558Srgrimesif test "x$TERMLIBS" = x; then 11079749Sdd if test $have_curses = yes; then 1111558Srgrimes TERMLIBS="-lcurses" 1121558Srgrimes SAVE_LIBS=$LIBS 1131558Srgrimes LIBS="$LIBS $TERMLIBS" 1141558Srgrimes AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], 11526737Scharnier [termok=yes], [termok=no]) 11626737Scharnier LIBS=$SAVE_LIBS 1171558Srgrimes if test $termok = no; then TERMLIBS=""; fi 118216823Spjd fi 1191558Srgrimesfi 1201558Srgrimes 121216823Spjd# -- Try curses & termcap. 122216823Spjdif test "x$TERMLIBS" = x; then 123216823Spjd if test $have_curses = yes; then 124216823Spjd if test $have_termcap = yes; then 125216823Spjd TERMLIBS="-lcurses -ltermcap" 126216823Spjd SAVE_LIBS=$LIBS 127216823Spjd LIBS="$LIBS $TERMLIBS" 128216823Spjd AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], 129216823Spjd [termok=yes], [termok=no]) 130216823Spjd LIBS=$SAVE_LIBS 131216823Spjd if test $termok = no; then TERMLIBS=""; fi 132216823Spjd fi 133216823Spjd fi 134216823Spjdfi 135216823Spjdfi 136216823Spjd 137216823Spjd# -- Try termcap. 138216823Spjdif test "x$TERMLIBS" = x; then 139216823Spjd if test $have_termcap = yes; then 140216823Spjd TERMLIBS="-ltermcap" 141216823Spjd SAVE_LIBS=$LIBS 142216823Spjd LIBS="$LIBS $TERMLIBS" 14348078Sru AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], 1441558Srgrimes [termok=yes], [termok=no]) 1451558Srgrimes LIBS=$SAVE_LIBS 1461558Srgrimes if test $termok = no; then TERMLIBS=""; fi 1471558Srgrimes fi 1481558Srgrimesfi 1491558Srgrimes 1501558Srgrimes# -- Try termlib. 1511558Srgrimesif test "x$TERMLIBS" = x; then 1521558Srgrimes if test $have_termlib = yes; then 1531558Srgrimes TERMLIBS="-lcurses -ltermlib" 1541558Srgrimes SAVE_LIBS=$LIBS 1551558Srgrimes LIBS="$LIBS $TERMLIBS" 1561558Srgrimes AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], 15748078Sru [termok=yes], [termok=no]) 15848078Sru LIBS=$SAVE_LIBS 15948078Sru if test $termok = no; then TERMLIBS=""; fi 16041666Smsmith fi 16141666Smsmithfi 16241666Smsmith 1631558Srgrimesif test "x$TERMLIBS" = x; then 1641558Srgrimes AC_MSG_RESULT(Cannot find terminal libraries - configure failed) 1651558Srgrimes exit 1 1661558Srgrimesfi 1671558SrgrimesAC_MSG_RESULT(using $TERMLIBS) 16848078SruLIBS="$LIBS $TERMLIBS" 1691558Srgrimes 1701558Srgrimes# Checks for header files. 1711558SrgrimesAC_HEADER_STDC 1721558SrgrimesAC_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]) 1731558Srgrimes 17448078Sru# Checks for typedefs, structures, and compiler characteristics. 1751558SrgrimesAC_HEADER_STAT 17648078SruAC_C_CONST 17748078SruAC_TYPE_OFF_T 17848062SjkoshyAC_TYPE_SIZE_T 17948078SruAC_HEADER_TIME 18048078Sru 18148062Sjkoshy# Autoheader templates for symbols defined later by AC_DEFINE. 18248078SruAH_TEMPLATE([HAVE_POSIX_REGCOMP], 18348078Sru [POSIX regcomp() and regex.h]) 18448078SruAH_TEMPLATE([HAVE_PCRE], 1851558Srgrimes [PCRE (Perl-compatible regular expression) library]) 1861558SrgrimesAH_TEMPLATE([HAVE_RE_COMP], 187216823Spjd [BSD re_comp()]) 1881558SrgrimesAH_TEMPLATE([HAVE_REGCMP], 1891558Srgrimes [System V regcmp()]) 1901558SrgrimesAH_TEMPLATE([HAVE_V8_REGCOMP], 1911558Srgrimes [Henry Spencer V8 regcomp() and regexp.h]) 1921558SrgrimesAH_TEMPLATE([NO_REGEX], 1931558Srgrimes [pattern matching is supported, but without metacharacters.]) 1941558SrgrimesAH_TEMPLATE([HAVE_REGEXEC2], 19541684Sbde []) 1961558SrgrimesAH_TEMPLATE([HAVE_VOID], 1971558Srgrimes [Define HAVE_VOID if your compiler supports the "void" type.]) 1981558SrgrimesAH_TEMPLATE([HAVE_FLOAT], 1991558Srgrimes [Define HAVE_FLOAT if your compiler supports the "double" type.]) 2001558SrgrimesAH_TEMPLATE([HAVE_CONST], 2011558Srgrimes [Define HAVE_CONST if your compiler supports the "const" modifier.]) 2021558SrgrimesAH_TEMPLATE([HAVE_STAT_INO], 2031558Srgrimes [Define HAVE_STAT_INO if your struct stat has st_ino and st_dev.]) 2041558SrgrimesAH_TEMPLATE([HAVE_TIME_T], 2051558Srgrimes [Define HAVE_TIME_T if your system supports the "time_t" type.]) 2061558SrgrimesAH_TEMPLATE([HAVE_STRERROR], 2071558Srgrimes [Define HAVE_STRERROR if you have the strerror() function.]) 2081558SrgrimesAH_TEMPLATE([HAVE_FILENO], 2091558Srgrimes [Define HAVE_FILENO if you have the fileno() macro.]) 2101558SrgrimesAH_TEMPLATE([HAVE_ERRNO], 2111558Srgrimes [Define HAVE_ERRNO if you have the errno variable.]) 2121558SrgrimesAH_TEMPLATE([MUST_DEFINE_ERRNO], 2131558Srgrimes [Define MUST_DEFINE_ERRNO if you have errno but it is not define in errno.h.]) 2141558SrgrimesAH_TEMPLATE([HAVE_SYS_ERRLIST], 2151558Srgrimes [Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable.]) 2161558SrgrimesAH_TEMPLATE([HAVE_OSPEED], 2171558Srgrimes [Define HAVE_OSPEED if your termcap library has the ospeed variable.]) 2181558SrgrimesAH_TEMPLATE([MUST_DEFINE_OSPEED], 2191558Srgrimes [Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined in termcap.h.]) 2201558SrgrimesAH_TEMPLATE([HAVE_LOCALE], 2211558Srgrimes [Define HAVE_LOCALE if you have locale.h and setlocale.]) 2221558SrgrimesAH_TEMPLATE([HAVE_TERMIOS_FUNCS], 2231558Srgrimes [Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr.]) 2241558SrgrimesAH_TEMPLATE([HAVE_UPPER_LOWER], 2251558Srgrimes [Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower.]) 2261558SrgrimesAH_TEMPLATE([HAVE_WCTYPE], 2271558Srgrimes [Define HAVE_WCTYPE if you have iswupper, iswlower, towupper, towlower.]) 2281558SrgrimesAH_TEMPLATE([HAVE_SIGSET_T], 2291558Srgrimes [Define HAVE_SIGSET_T you have the sigset_t type.]) 2301558SrgrimesAH_TEMPLATE([HAVE_SIGEMPTYSET], 2311558Srgrimes [Define HAVE_SIGEMPTYSET if you have the sigemptyset macro.]) 2321558SrgrimesAH_TEMPLATE([EDIT_PGM], 2331558Srgrimes [Define EDIT_PGM to your editor.]) 23426737ScharnierAH_TEMPLATE([SECURE_COMPILE], 23526737Scharnier [Define SECURE_COMPILE=1 to build a secure version of less.]) 23626737Scharnier 23726737Scharnier# Checks for identifiers. 2381558SrgrimesAC_TYPE_OFF_T 23928613SjoergAC_MSG_CHECKING(for void) 2401558SrgrimesAC_TRY_COMPILE(, [void *foo = 0;], 2411558Srgrimes [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_VOID)], [AC_MSG_RESULT(no)]) 2421558SrgrimesAC_MSG_CHECKING(for const) 24338036ScharnierAC_TRY_COMPILE(, [const int foo = 0;], 2441558Srgrimes [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_CONST)], [AC_MSG_RESULT(no)]) 2451558SrgrimesAC_MSG_CHECKING(for time_t) 246197560SdelphijAC_TRY_COMPILE([#include <time.h>], [time_t t = 0;], 247197560Sdelphij [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIME_T)], [AC_MSG_RESULT(no)]) 2481558SrgrimesAC_MSG_CHECKING(for st_ino in struct stat) 2491558SrgrimesAC_TRY_COMPILE([#include <sys/types.h> 2501558Srgrimes#include <sys/stat.h>], 2511558Srgrimes [struct stat s; dev_t dev = s.st_dev; ino_t ino = s.st_ino;], 2521558Srgrimes [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STAT_INO)], [AC_MSG_RESULT(no)]) 2531558Srgrimes 2541558Srgrimes# Checks for library functions. 2551558SrgrimesAC_TYPE_SIGNAL 2561558SrgrimesAC_CHECK_FUNCS([fsync popen _setjmp sigprocmask sigsetmask snprintf stat system fchmod]) 2571558Srgrimes 2581558Srgrimes# AC_CHECK_FUNCS may not work for inline functions, so test these separately. 2591558SrgrimesAC_MSG_CHECKING(for memcpy) 2601558SrgrimesAC_TRY_LINK([ 2611558Srgrimes#if HAVE_STRING_H 2621558Srgrimes#include <string.h> 26348004Sru#endif], [memcpy(0,0,0);], 2641558Srgrimes [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MEMCPY)], [AC_MSG_RESULT(no)]) 2651558Srgrimes 2661558SrgrimesAC_MSG_CHECKING(for strchr) 2671558SrgrimesAC_TRY_LINK([ 2681558Srgrimes#if HAVE_STRING_H 26932399Salex#include <string.h> 27079749Sdd#endif], [strchr("x",'x');], 2711558Srgrimes [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRCHR)], [AC_MSG_RESULT(no)]) 2721558Srgrimes 2731558SrgrimesAC_MSG_CHECKING(for strstr) 2741558SrgrimesAC_TRY_LINK([ 2751558Srgrimes#if HAVE_STRING_H 2761558Srgrimes#include <string.h> 2771558Srgrimes#endif], [strstr("x","x");], 2781558Srgrimes [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRSTR)], [AC_MSG_RESULT(no)]) 2791558Srgrimes 2801558Srgrimes# Some systems have termios.h but not the corresponding functions. 2811558SrgrimesAC_CHECK_FUNC(tcgetattr, AC_DEFINE(HAVE_TERMIOS_FUNCS)) 2821558Srgrimes 2831558SrgrimesAC_MSG_CHECKING(for fileno) 2841558SrgrimesAC_TRY_LINK([ 285201180Sed#if HAVE_STDIO_H 2861558Srgrimes#include <stdio.h> 2871558Srgrimes#endif], [static int x; x = fileno(stdin);], 2881558Srgrimes [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FILENO)], [AC_MSG_RESULT(no)]) 2891558Srgrimes 29079749SddAC_MSG_CHECKING(for strerror) 29132399SalexAC_TRY_LINK([ 29232399Salex#if HAVE_STDIO_H 29332399Salex#include <stdio.h> 29432399Salex#endif 295197560Sdelphij#if HAVE_STRING_H 296140797Sdelphij#include <string.h> 2971558Srgrimes#endif 2981558Srgrimes#if HAVE_ERRNO_H 2991558Srgrimes#include <errno.h> 3001558Srgrimes#endif], [static char *x; x = strerror(0);], 3011558Srgrimes [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRERROR)], [AC_MSG_RESULT(no)]) 3021558Srgrimes 3031558SrgrimesAC_MSG_CHECKING(for sys_errlist) 3041558SrgrimesAC_TRY_LINK(, [extern char *sys_errlist[]; static char **x; x = sys_errlist;], 3051558Srgrimes [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYS_ERRLIST)], [AC_MSG_RESULT(no)]) 3061558Srgrimes 3071558SrgrimesAC_CHECK_TYPES([sigset_t],,,[#include <signal.h>]) 30832399Salex 3091558SrgrimesAC_MSG_CHECKING(for sigemptyset) 3101558SrgrimesAC_TRY_LINK([ 3111558Srgrimes#include <signal.h> 3121558Srgrimes], [sigset_t s; sigemptyset(&s);], 3131558Srgrimes [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SIGEMPTYSET)], [AC_MSG_RESULT(no)]) 3141558Srgrimes 3151558Srgrimeshave_errno=no 3161558SrgrimesAC_MSG_CHECKING(for errno) 3171558SrgrimesAC_TRY_LINK([ 3181558Srgrimes#if HAVE_ERRNO_H 3191558Srgrimes#include <errno.h> 3201558Srgrimes#endif], [static int x; x = errno;], 3211558Srgrimes [AC_MSG_RESULT(yes - in errno.h); AC_DEFINE(HAVE_ERRNO) have_errno=yes]) 3221558Srgrimesif test $have_errno = no; then 3231558SrgrimesAC_TRY_LINK([ 3241558Srgrimes#if HAVE_ERRNO_H 3251558Srgrimes#include <errno.h> 3261558Srgrimes#endif], [extern int errno; static int x; x = errno;], 3271558Srgrimes [AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_ERRNO) AC_DEFINE(MUST_DEFINE_ERRNO)], 3281558Srgrimes [AC_MSG_RESULT(no)]) 3291558Srgrimesfi 3301558Srgrimes 3311558SrgrimesAC_MSG_CHECKING(for locale) 3321558SrgrimesAC_TRY_LINK([#include <locale.h> 3331558Srgrimes#include <ctype.h> 33438036Scharnier#include <langinfo.h>], [setlocale(LC_CTYPE,""); isprint(0); iscntrl(0);], 3351558Srgrimes [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_LOCALE)], [AC_MSG_RESULT(no)]) 3361558Srgrimes 3371558SrgrimesAC_MSG_CHECKING(for ctype functions) 3381558SrgrimesAC_TRY_LINK([ 3391558Srgrimes#if HAVE_CTYPE_H 3401558Srgrimes#include <ctype.h> 3411558Srgrimes#endif], [static int x; x = isupper(x); x = tolower(x); x = toupper(x);], 3421558Srgrimes [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UPPER_LOWER)], [AC_MSG_RESULT(no)]) 3431558Srgrimes 3441558SrgrimesAC_MSG_CHECKING(for wctype functions) 345197560SdelphijAC_TRY_LINK([#include <wctype.h>], [iswlower(0); iswupper(0); towlower(0); towupper(0);], 346140797Sdelphij [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_WCTYPE)], [AC_MSG_RESULT(no)]) 3471558Srgrimes 3481558Srgrimes# Checks for external variable ospeed in the termcap library. 3491558Srgrimeshave_ospeed=no 3501558SrgrimesAC_MSG_CHECKING(termcap for ospeed) 351197560SdelphijAC_TRY_LINK([ 352201180Sed#include <sys/types.h> 3531558Srgrimes#if HAVE_TERMIOS_H 35432399Salex#include <termios.h> 3551558Srgrimes#endif 3561558Srgrimes#if HAVE_TERMCAP_H 35741666Smsmith#include <termcap.h> 35841666Smsmith#endif], [ospeed = 0;], 3591558Srgrimes[AC_MSG_RESULT(yes - in termcap.h); AC_DEFINE(HAVE_OSPEED) have_ospeed=yes]) 3601558Srgrimesif test $have_ospeed = no; then 3611558SrgrimesAC_TRY_LINK(, [extern short ospeed; ospeed = 0;], 3621558Srgrimes [AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_OSPEED) AC_DEFINE(MUST_DEFINE_OSPEED)], 3631558Srgrimes [AC_MSG_RESULT(no)]) 3644844Satsfi 3651558Srgrimes 3661558Srgrimes# Compile in secure mode? 3671558SrgrimesAC_ARG_WITH(secure, 3681558Srgrimes [ --with-secure Compile in secure mode], 3691558Srgrimes AC_DEFINE(SECURE_COMPILE, 1), AC_DEFINE(SECURE_COMPILE, 0)) 3701558Srgrimes 37141666Smsmith# Should we use floating point? 37241666SmsmithAC_MSG_CHECKING(for floating point) 37348078SruAC_ARG_WITH(no-float, 3741558Srgrimes [ --with-no-float Do not use floating point], 3751558Srgrimes WANT_NO_FLOAT=1, WANT_NO_FLOAT=0) 3761558Srgrimesif test $WANT_NO_FLOAT = 0; then 37748078Sru AC_TRY_LINK(, [double f1 = 12.5; double f2 = f1*f1/2.5;], 37848078Sru [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT)], [AC_MSG_RESULT(no)]) 37948078Sruelse 38048078Sru AC_MSG_RESULT(disabled by user) 38148078Srufi 38248078Sru 38348078Sru# Checks for regular expression functions. 38448078Sruhave_regex=no 38548078Sruhave_posix_regex=unknown 38648078SruAC_MSG_CHECKING(for regcomp) 38748078Sru 38848078Sru# Select a regular expression library. 38948078SruWANT_REGEX=auto 39048078SruAC_ARG_WITH(regex, 39148078Sru [ --with-regex={auto,pcre,posix,regcmp,re_comp,regcomp,regcomp-local} Select a regular expression library [auto]], 39248078Sru WANT_REGEX="$withval") 39348078Sru 39448078Sruif test $have_regex = no; then 39548078Sruif test $WANT_REGEX = auto -o $WANT_REGEX = posix; then 39648078Sru# Some versions of Solaris have a regcomp() function, but it doesn't work! 39748078Sru# So we run a test program. If we're cross-compiling, do it the old way. 39848078SruAC_TRY_RUN([ 39948078Sru#include <sys/types.h> 40048078Sru#include <regex.h> 40148078Srumain() { regex_t r; regmatch_t rm; char *text = "xabcy"; 40248078Sruif (regcomp(&r, "abc", 0)) exit(1); 40348078Sruif (regexec(&r, text, 1, &rm, 0)) exit(1); 40448078Sru#ifndef __WATCOMC__ 4051558Srgrimesif (rm.rm_so != 1) exit(1); /* check for correct offset */ 4061558Srgrimes#else 4071558Srgrimesif (rm.rm_sp != text + 1) exit(1); /* check for correct offset */ 4081558Srgrimes#endif 4091558Srgrimesexit(0); }], 4101558Srgrimes have_posix_regex=yes, have_posix_regex=no, have_posix_regex=unknown) 4111558Srgrimesif test $have_posix_regex = yes; then 412197560Sdelphij AC_MSG_RESULT(using POSIX regcomp) 413140797Sdelphij AC_DEFINE(HAVE_POSIX_REGCOMP) 4141558Srgrimes have_regex=yes 41579749Sddelif test $have_posix_regex = unknown; then 41679749Sdd AC_TRY_LINK([ 4171558Srgrimes#include <sys/types.h> 41832328Salex#include <regex.h>], 4191558Srgrimes [regex_t *r; regfree(r);], 42048062Sjkoshy AC_MSG_RESULT(using POSIX regcomp) 42148062Sjkoshy AC_DEFINE(HAVE_POSIX_REGCOMP) have_regex=yes) 4221558Srgrimeselse 4231558Srgrimes AC_MSG_RESULT(no) 42448062Sjkoshyfi 4251558Srgrimesfi 4261558Srgrimesfi 4271558Srgrimes 4281558Srgrimesif test $have_regex = no; then 4291558Srgrimesif test $WANT_REGEX = auto -o $WANT_REGEX = pcre; then 4301558SrgrimesAC_CHECK_LIB(pcre, pcre_compile, 43148004Sru[AC_MSG_RESULT(using pcre); AC_DEFINE(HAVE_PCRE) LIBS="$LIBS -lpcre" have_regex=yes], []) 43248004Srufi 4331558Srgrimesfi 4341558Srgrimes 4351558Srgrimesif test $have_regex = no; then 4361558Srgrimesif test $WANT_REGEX = auto -o $WANT_REGEX = regcmp; then 4371558SrgrimesAC_CHECK_FUNC(regcmp, 4381558SrgrimesAC_MSG_RESULT(using regcmp); AC_DEFINE(HAVE_REGCMP) have_regex=yes) 43948956Sbillffi 4401558Srgrimesfi 4411558Srgrimes 4421558Srgrimesif test $have_regex = no; then 4431558Srgrimesif test $WANT_REGEX = auto -o $WANT_REGEX = regcomp; then 4441558SrgrimesAC_TRY_LINK([ 4451558Srgrimes#include "regexp.h"], [regcomp("");], 4461558SrgrimesAC_MSG_RESULT(using V8 regcomp); AC_DEFINE(HAVE_V8_REGCOMP) have_regex=yes) 44748956Sbillffi 4481558Srgrimesfi 4491558Srgrimes 4501558Srgrimesif test $have_regex = no && test -f ${srcdir}/regexp.c; then 4511558Srgrimesif test $WANT_REGEX = auto -o $WANT_REGEX = regcomp-local; then 4521558SrgrimesAC_MSG_RESULT(using V8 regcomp -- local source); AC_DEFINE(HAVE_V8_REGCOMP) AC_DEFINE(HAVE_REGEXEC2) REGEX_O='regexp.$(O)' AC_SUBST(REGEX_O) have_regex=yes 4531558Srgrimesfi 45432328Salexfi 4551558Srgrimes 45632328Salexif test $have_regex = no; then 45732328Salexif test $WANT_REGEX = auto -o $WANT_REGEX = re_comp; then 45832328SalexAC_MSG_RESULT(using re_comp); AC_CHECK_FUNC(re_comp, AC_DEFINE(HAVE_RE_COMP) have_regex=yes) 45932328Salexfi 46032328Salexfi 46132328Salex 46232328Salexif test $have_regex = no; then 46332329SalexAC_MSG_RESULT(cannot find regular expression library); AC_DEFINE(NO_REGEX) 46432328Salexfi 4651558Srgrimes 4661558SrgrimesAC_ARG_WITH(editor, 4671558Srgrimes [ --with-editor=PROGRAM use PROGRAM as the default editor [vi]], 4681558Srgrimes AC_DEFINE_UNQUOTED(EDIT_PGM, "$withval"), AC_DEFINE(EDIT_PGM, "vi")) 4691558Srgrimes 4701558SrgrimesAH_TOP([ 4711558Srgrimes/* Unix definition file for less. -*- C -*- 4721558Srgrimes * 4731558Srgrimes * This file has 3 sections: 4741558Srgrimes * User preferences. 4751558Srgrimes * Settings always true on Unix. 4761558Srgrimes * Settings automatically determined by configure. 4771558Srgrimes * 4781558Srgrimes * * * * * * WARNING * * * * * * 4791558Srgrimes * If you edit defines.h by hand, do "touch stamp-h" before you run make 4801558Srgrimes * so config.status doesn't overwrite your changes. 4811558Srgrimes */ 4821558Srgrimes 4831558Srgrimes/* User preferences. */ 4841558Srgrimes 4851558Srgrimes/* 48626737Scharnier * SECURE is 1 if you wish to disable a bunch of features in order to 48726737Scharnier * be safe to run by unprivileged users. 4881558Srgrimes * SECURE_COMPILE is set by the --with-secure configure option. 4891558Srgrimes */ 4901558Srgrimes#define SECURE SECURE_COMPILE 4911558Srgrimes 4921558Srgrimes/* 4931558Srgrimes * SHELL_ESCAPE is 1 if you wish to allow shell escapes. 4941558Srgrimes * (This is possible only if your system supplies the system() function.) 495197560Sdelphij */ 496197560Sdelphij#define SHELL_ESCAPE (!SECURE) 4971558Srgrimes 4981558Srgrimes/* 4991558Srgrimes * EXAMINE is 1 if you wish to allow examining files by name from within less. 5001558Srgrimes */ 5011558Srgrimes#define EXAMINE (!SECURE) 5021558Srgrimes 5031558Srgrimes/* 5041558Srgrimes * TAB_COMPLETE_FILENAME is 1 if you wish to allow the TAB key 5051558Srgrimes * to complete filenames at prompts. 5061558Srgrimes */ 5071558Srgrimes#define TAB_COMPLETE_FILENAME (!SECURE) 5081558Srgrimes 5091558Srgrimes/* 5101558Srgrimes * CMD_HISTORY is 1 if you wish to allow keys to cycle through 5111558Srgrimes * previous commands at prompts. 5121558Srgrimes */ 5131558Srgrimes#define CMD_HISTORY 1 5141558Srgrimes 5151558Srgrimes/* 5161558Srgrimes * HILITE_SEARCH is 1 if you wish to have search targets to be 517197560Sdelphij * displayed in standout mode. 518140797Sdelphij */ 5191558Srgrimes#define HILITE_SEARCH 1 52041684Sbde 52141684Sbde/* 5221558Srgrimes * EDITOR is 1 if you wish to allow editor invocation (the "v" command). 5231558Srgrimes * (This is possible only if your system supplies the system() function.) 5241558Srgrimes * EDIT_PGM is the name of the (default) editor to be invoked. 525197560Sdelphij */ 526201180Sed#define EDITOR (!SECURE) 5271558Srgrimes 52838036Scharnier/* 5291558Srgrimes * TAGS is 1 if you wish to support tag files. 5301558Srgrimes */ 531197560Sdelphij#define TAGS (!SECURE) 532140797Sdelphij 5331558Srgrimes/* 53448078Sru * USERFILE is 1 if you wish to allow a .less file to specify 53548078Sru * user-defined key bindings. 53648078Sru */ 537216823Spjd#define USERFILE (!SECURE) 538216823Spjd 5391558Srgrimes/* 5401558Srgrimes * GLOB is 1 if you wish to have shell metacharacters expanded in filenames. 541 * This will generally work if your system provides the "popen" function 542 * and the "echo" shell command. 543 */ 544#define GLOB (!SECURE) 545 546/* 547 * PIPEC is 1 if you wish to have the "|" command 548 * which allows the user to pipe data into a shell command. 549 */ 550#define PIPEC (!SECURE) 551 552/* 553 * LOGFILE is 1 if you wish to allow the -l option (to create log files). 554 */ 555#define LOGFILE (!SECURE) 556 557/* 558 * GNU_OPTIONS is 1 if you wish to support the GNU-style command 559 * line options --help and --version. 560 */ 561#define GNU_OPTIONS 1 562 563/* 564 * ONLY_RETURN is 1 if you want RETURN to be the only input which 565 * will continue past an error message. 566 * Otherwise, any key will continue past an error message. 567 */ 568#define ONLY_RETURN 0 569 570/* 571 * LESSKEYFILE is the filename of the default lesskey output file 572 * (in the HOME directory). 573 * LESSKEYFILE_SYS is the filename of the system-wide lesskey output file. 574 * DEF_LESSKEYINFILE is the filename of the default lesskey input 575 * (in the HOME directory). 576 * LESSHISTFILE is the filename of the history file 577 * (in the HOME directory). 578 */ 579#define LESSKEYFILE ".less" 580#define LESSKEYFILE_SYS SYSDIR "/sysless" 581#define DEF_LESSKEYINFILE ".lesskey" 582#define LESSHISTFILE ".lesshst" 583 584 585/* Settings always true on Unix. */ 586 587/* 588 * Define MSDOS_COMPILER if compiling under Microsoft C. 589 */ 590#define MSDOS_COMPILER 0 591 592/* 593 * Pathname separator character. 594 */ 595#define PATHNAME_SEP "/" 596 597/* 598 * The value returned from tgetent on success. 599 * Some HP-UX systems return 0 on success. 600 */ 601#define TGETENT_OK 1 602 603/* 604 * HAVE_SYS_TYPES_H is 1 if your system has <sys/types.h>. 605 */ 606#define HAVE_SYS_TYPES_H 1 607 608/* 609 * Define if you have the <sgstat.h> header file. 610 */ 611#undef HAVE_SGSTAT_H 612 613/* 614 * HAVE_PERROR is 1 if your system has the perror() call. 615 * (Actually, if it has sys_errlist, sys_nerr and errno.) 616 */ 617#define HAVE_PERROR 1 618 619/* 620 * HAVE_TIME is 1 if your system has the time() call. 621 */ 622#define HAVE_TIME 1 623 624/* 625 * HAVE_SHELL is 1 if your system supports a SHELL command interpreter. 626 */ 627#define HAVE_SHELL 1 628 629/* 630 * Default shell metacharacters and meta-escape character. 631 */ 632#define DEF_METACHARS "; *?\t\n'\"()<>[]|&^`#\\$%=~" 633#define DEF_METAESCAPE "\\" 634 635/* 636 * HAVE_DUP is 1 if your system has the dup() call. 637 */ 638#define HAVE_DUP 1 639 640/* Define to 1 if you have the memcpy() function. */ 641#define HAVE_MEMCPY 1 642 643/* Define to 1 if you have the strchr() function. */ 644#define HAVE_STRCHR 1 645 646/* Define to 1 if you have the strstr() function. */ 647#define HAVE_STRSTR 1 648 649/* 650 * Sizes of various buffers. 651 */ 652#define CMDBUF_SIZE 512 /* Buffer for multichar commands */ 653#define UNGOT_SIZE 100 /* Max chars to unget() */ 654#define LINEBUF_SIZE 1024 /* Max size of line in input file */ 655#define OUTBUF_SIZE 1024 /* Output buffer */ 656#define PROMPT_SIZE 200 /* Max size of prompt string */ 657#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */ 658#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */ 659#define TAGLINE_SIZE 512 /* Max size of line in tags file */ 660#define TABSTOP_MAX 32 /* Max number of custom tab stops */ 661 662/* Settings automatically determined by configure. */ 663]) 664 665AC_CONFIG_FILES([Makefile]) 666AC_OUTPUT 667