home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / less-321-src.tgz / tar.out / fsf / less / configure.in < prev    next >
Text File  |  1996-09-28  |  6KB  |  184 lines

  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_INIT(forwback.c)
  3. AC_CONFIG_HEADER(defines.h)
  4.  
  5. dnl Checks for programs.
  6. AC_PROG_CC
  7. AC_ISC_POSIX
  8. AC_PROG_GCC_TRADITIONAL
  9. AC_PROG_INSTALL
  10.  
  11. dnl Checks for libraries.
  12. TERMLIBS=
  13. AC_CHECK_LIB(ncurses, initscr, [TERMLIBS="$TERMLIBS -lncurses"])
  14. AC_CHECK_LIB(curses, initscr, [TERMLIBS="$TERMLIBS -lcurses"])
  15. AC_CHECK_LIB(termcap, tgetent, [TERMLIBS="$TERMLIBS -ltermcap"])
  16. AC_CHECK_LIB(termlib, tgetent, [have_termlib=yes], [have_termlib=no])
  17. dnl Regular expressions (regcmp) are in -lgen on Solaris 2,
  18. dnl and in -lintl on SCO Unix.
  19. AC_CHECK_LIB(gen, regcmp)
  20. AC_CHECK_LIB(intl, regcmp)
  21. AC_CHECK_LIB(PW, regcmp)
  22.  
  23. dnl Solaris has curses & termcap, but they don't work without libucb
  24. dnl which is broken, so we use termlib.
  25. AC_MSG_CHECKING(for working terminal libraries)
  26. SAVE_LIBS=$LIBS
  27. LIBS="$LIBS $TERMLIBS"
  28. AC_TRY_LINK(, [tgetent(0); tgetflag(0); tgetnum(0); tgetstr(0);],
  29.   [termok=yes], [termok=no])
  30. if test $termok = yes; then
  31.   AC_MSG_RESULT(using $TERMLIBS)
  32. else
  33.   LIBS="$SAVE_LIBS"
  34.   if test $have_termlib = yes; then
  35.     LIBS="$LIBS -ltermlib"
  36.     AC_MSG_RESULT(using -ltermlib)
  37.   else
  38.     AC_MSG_RESULT(TERMINAL LIBRARY BROKEN - configure failed)
  39.     exit 1
  40.   fi
  41. fi
  42.  
  43. dnl Checks for header files.
  44. AC_HEADER_STDC
  45. AC_CHECK_HEADERS(ctype.h errno.h fcntl.h limits.h stdio.h string.h termcap.h termio.h termios.h time.h unistd.h values.h sys/ioctl.h sys/stream.h sys/ptem.h)
  46.  
  47. dnl Checks for identifiers.
  48. AC_TYPE_OFF_T
  49. AC_MSG_CHECKING(for void)
  50. AC_TRY_COMPILE(, [void *foo = 0;], 
  51.   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_VOID)], [AC_MSG_RESULT(no)])
  52. AC_MSG_CHECKING(for const)
  53. AC_TRY_COMPILE(, [const int foo = 0;], 
  54.   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_CONST)], [AC_MSG_RESULT(no)])
  55. AC_MSG_CHECKING(for time_t)
  56. AC_TRY_COMPILE([#include <time.h>], [time_t t = 0;],
  57.   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIME_T)], [AC_MSG_RESULT(no)])
  58.  
  59. dnl Checks for functions and external variables.
  60. AC_TYPE_SIGNAL
  61. AC_CHECK_FUNCS(_setjmp system sigsetmask memcpy strchr)
  62.  
  63. dnl Some systems have termios.h but not the corresponding functions.
  64. AC_CHECK_FUNC(tcgetattr, AC_DEFINE(HAVE_TERMIOS_FUNCS))
  65.  
  66. AC_MSG_CHECKING(for fileno)
  67. AC_TRY_LINK([
  68. #if HAVE_STDIO_H
  69. #include <stdio.h>
  70. #endif], [static int x; x = fileno(stdin);],
  71.   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FILENO)], [AC_MSG_RESULT(no)])
  72.  
  73. AC_MSG_CHECKING(for strerror)
  74. AC_TRY_LINK([
  75. #if HAVE_STDIO_H
  76. #include <stdio.h>
  77. #endif
  78. #if HAVE_STRING_H
  79. #include <string.h>
  80. #endif
  81. #if HAVE_ERRNO_H
  82. #include <errno.h>
  83. #endif], [static char *x; x = strerror(0);],
  84.   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRERROR)], [AC_MSG_RESULT(no)])
  85.  
  86. AC_MSG_CHECKING(for sys_errlist)
  87. AC_TRY_LINK(, [extern char *sys_errlist[]; static char **x; x = sys_errlist;], 
  88.   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYS_ERRLIST)], [AC_MSG_RESULT(no)])
  89.  
  90. have_errno=no
  91. AC_MSG_CHECKING(for errno)
  92. AC_TRY_LINK([
  93. #if HAVE_ERRNO_H
  94. #include <errno.h>
  95. #endif], [static int x; x = errno;], 
  96.   [AC_MSG_RESULT(yes - in errno.h); AC_DEFINE(HAVE_ERRNO) have_errno=yes])
  97. if test $have_errno = no; then
  98. AC_TRY_LINK([
  99. #if HAVE_ERRNO_H
  100. #include <errno.h>
  101. #endif], [extern int errno; static int x; x = errno;], 
  102.   [AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_ERRNO) AC_DEFINE(MUST_DEFINE_ERRNO)],
  103.   [AC_MSG_RESULT(no)])
  104. fi
  105.  
  106. AC_MSG_CHECKING(for locale)
  107. AC_TRY_LINK([#include <locale.h>
  108. #include <ctype.h>], [setlocale(LC_CTYPE,""); isprint(0); iscntrl(0);],
  109.   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_LOCALE)], [AC_MSG_RESULT(no)])
  110. AC_MSG_CHECKING(for ctype functions)
  111. AC_TRY_LINK([
  112. #if HAVE_CTYPE_H
  113. #include <ctype.h>
  114. #endif], [static int x; x = isupper(x); x = tolower(x); x = toupper(x);],
  115.   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UPPER_LOWER)], [AC_MSG_RESULT(no)])
  116.  
  117. dnl Checks for external variable ospeed in the termcap library.
  118. have_ospeed=no
  119. AC_MSG_CHECKING(termcap for ospeed)
  120. AC_TRY_LINK([
  121. #include <sys/types.h>
  122. #if HAVE_TERMIOS_H
  123. #include <termios.h>
  124. #endif
  125. #if HAVE_TERMCAP_H
  126. #include <termcap.h>
  127. #endif], [ospeed = 0;],
  128. [AC_MSG_RESULT(yes - in termcap.h); AC_DEFINE(HAVE_OSPEED) have_ospeed=yes])
  129. if test $have_ospeed = no; then
  130. AC_TRY_LINK(, [extern short ospeed; ospeed = 0;], 
  131.   [AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_OSPEED) AC_DEFINE(MUST_DEFINE_OSPEED)],
  132.   [AC_MSG_RESULT(no)])
  133. fi
  134.  
  135. dnl Checks for regular expression functions.
  136. have_regex=no
  137. have_posix_regex=unknown
  138. AC_CHECKING(for regular expression library)
  139. dnl Some versions of Solaris have a regcomp() function, but it doesn't work!
  140. dnl So we run a test program.  If we're cross-compiling, do it the old way.
  141. AC_TRY_RUN([
  142. #include <sys/types.h>
  143. #include <regex.h>
  144. main() { regex_t r; regmatch_t rm;
  145. if (regcomp(&r, "abc", 0)) exit(1);
  146. if (regexec(&r, "xabcy", 1, &rm, 0)) exit(1);
  147. exit(0); }],
  148.   have_posix_regex=yes, have_posix_regex=no, have_posix_regex=unknown)
  149. if test $have_posix_regex = yes; then
  150.   AC_MSG_RESULT(using POSIX regcomp)
  151.   AC_DEFINE(HAVE_POSIX_REGCOMP)
  152.   have_regex=yes
  153. elif test $have_posix_regex = unknown; then
  154.   AC_TRY_LINK([
  155. #include <sys/types.h>
  156. #include <regex.h>],
  157.   [regex_t *r; regfree(r);],
  158.   AC_MSG_RESULT(using POSIX regcomp)
  159.   AC_DEFINE(HAVE_POSIX_REGCOMP) have_regex=yes)
  160. fi
  161. if test $have_regex = no; then
  162. AC_CHECK_FUNC(regcmp, 
  163. AC_MSG_RESULT(using regcmp); AC_DEFINE(HAVE_REGCMP) have_regex=yes)
  164. fi
  165. if test $have_regex = no; then
  166. AC_TRY_LINK([
  167. #include "regexp.h"], [regcomp("");],
  168. AC_MSG_RESULT(using V8 regcomp); AC_DEFINE(HAVE_V8_REGCOMP) have_regex=yes)
  169. fi
  170. if test $have_regex = no && test -f ${srcdir}/regex.c; then
  171. AC_MSG_RESULT(using POSIX regcomp -- local source); AC_DEFINE(HAVE_POSIX_REGCOMP) REGEX_O='regex.$(O)' AC_SUBST(REGEX_O) have_regex=yes
  172. fi
  173. if test $have_regex = no && test -f ${srcdir}/regexp.c; then
  174. AC_MSG_RESULT(using V8 regcomp -- local source); AC_DEFINE(HAVE_V8_REGCOMP) REGEX_O='regexp.$(O)' AC_SUBST(REGEX_O) have_regex=yes
  175. fi
  176. if test $have_regex = no; then
  177. AC_MSG_RESULT(using re_comp); AC_CHECK_FUNC(re_comp, AC_DEFINE(HAVE_RE_COMP) have_regex=yes)
  178. fi
  179. if test $have_regex = no; then
  180. AC_MSG_RESULT(cannot find regular expression library); AC_DEFINE(NO_REGEX)
  181. fi
  182.  
  183. AC_OUTPUT(Makefile)
  184.