Merge from vendor branch LESS:
[dragonfly.git] / contrib / bc / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(doc/bc.1)
3 AM_INIT_AUTOMAKE("bc", "1.06")
4 AM_CONFIG_HEADER(config.h)
5
6 AC_DEFINE(DC_VERSION,"1.3")
7 AC_DEFINE_UNQUOTED(BC_COPYRIGHT, dnl
8  ["Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc."])
9 AC_DEFINE_UNQUOTED(DC_COPYRIGHT, dnl
10  ["Copyright 1994, 1997, 1998, 2000 Free Software Foundation, Inc."])
11
12 AC_PROG_CC
13 AC_MINIX
14 dnl AC_ISC_POSIX
15
16 AM_PROG_LEX
17 AC_PROG_YACC
18 AC_PROG_INSTALL
19 AC_PROG_RANLIB
20 AC_PROG_MAKE_SET
21
22 AC_CHECK_HEADERS(stdarg.h stddef.h stdlib.h string.h limits.h unistd.h lib.h)
23 AC_C_CONST
24 AC_TYPE_SIZE_T
25 AC_CHECK_TYPE(ptrdiff_t, size_t)
26
27 AC_FUNC_VPRINTF
28 AC_CHECK_FUNCS(isgraph setvbuf)
29
30 AC_ARG_WITH(pkg,[  --with-pkg              use software installed in /usr/pkg tree], [
31    CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
32    LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
33    echo Using /usr/pkg/include and /usr/pkg/lib
34 ])
35
36 bcle=n
37 AC_ARG_WITH(libedit,[  --with-libedit          support fancy BSD command input 
38 editing], [
39    AC_CHECK_LIB(termcap,tgetent,TERMLIB=-ltermcap)
40    LDSAVE=$LDFLAGS
41    LDFLAGS="$LDFLAGS $TERMLIB"
42    AC_CHECK_LIB(edit,el_gets,
43       [AC_CHECK_HEADER(histedit.h,
44       READLINELIB="-ledit $TERMLIB";bcle=y)],
45       READLINELIB="")
46    if test "$bcle" = "y"; then
47      echo Using the libedit library.
48      AC_DEFINE(LIBEDIT,1)
49    fi
50    LDFLAGS=$LDSAVE
51 ])
52  
53 bcrl=n
54 AC_ARG_WITH(readline,[  --with-readline         support fancy command input editing], [
55    AC_CHECK_LIB(ncurses,tparm,TERMLIB=-lncurses,
56      AC_CHECK_LIB(termcap,tgetent,TERMLIB=-ltermcap))
57    LDSAVE=$LDFLAGS
58    LDFLAGS="$LDFLAGS $TERMLIB"
59    AC_CHECK_LIB(readline,readline,
60       [AC_CHECK_HEADER(readline/readline.h,
61       READLINELIB="-lreadline $TERMLIB";bcrl=y)],
62       READLINELIB="")
63    if test "$bcrl" = "y" ; then
64      echo Using the readline library.
65      AC_DEFINE(READLINE,1)
66    fi
67    LDFLAGS=$LDSAVE
68 ])
69
70 if test "$LEX" = "flex" ; then
71  LEX="flex -I8"
72 else
73  if test "$bcrl" = "y" ; then
74   AC_MSG_WARN(readline works only with flex.)
75  fi
76 fi
77
78 if test "$bcrl" = "y" -a "$bcle" = "y" ; then
79   AC_MSG_ERROR(Can not use both readline and libedit.  Aborting.)
80 fi
81
82 if test "$LEX" = "lex" -a `uname -s` = "SunOS" ; then
83   LEXLIB=""
84   echo "SunOS using lex does not have a -ll."
85 fi
86
87 AC_SUBST(READLINELIB)
88 AC_ARG_PROGRAM
89 AC_OUTPUT(Makefile bc/Makefile dc/Makefile doc/Makefile lib/Makefile)