summaryrefslogtreecommitdiffstats
path: root/contrib/bc/configure.in
blob: 0068e31a6a691568195dc10f59b4d69aabc0a617 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
dnl Process this file with autoconf to produce a configure script.
AC_INIT(doc/bc.1)
AM_INIT_AUTOMAKE(bc, 1.05)
AM_CONFIG_HEADER(config.h)

AC_PROG_CC
AC_MINIX
dnl AC_ISC_POSIX

AM_PROG_LEX
AC_PROG_YACC
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_MAKE_SET


AC_CHECK_HEADERS(stdarg.h stddef.h stdlib.h string.h limits.h unistd.h lib.h)
AC_C_CONST
AC_TYPE_SIZE_T
AC_CHECK_TYPE(ptrdiff_t, size_t)

AC_FUNC_VPRINTF
AC_CHECK_FUNCS(isgraph setvbuf)

SaveCFLAGS="$CFLAGS"
CFLAGS="-g -O -I. -I$srcdir"
AC_MSG_CHECKING(if long strings are accepted by the C compiler)
AC_TRY_COMPILE([
char libmath[] = 
#include "bc/libmath.h"
;
],[],AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
AC_MSG_WARN(libmath.b will not be preloaded into the executable)
if test "${prefix}" = "NONE" ; then 
AC_DEFINE_UNQUOTED(BC_MATH_FILE,"/usr/local/lib/libmath.b")
else
AC_DEFINE_UNQUOTED(BC_MATH_FILE,"${prefix}/lib/libmath.b")
fi)
CFLAGS="$SaveCFLAGS"

echo $LIBS
bcrl=nA
AC_ARG_WITH(readline,[  --with-readline         support fancy command input editing], [
   AC_CHECK_LIB(ncurses,tparm,TERMLIB=-lncurses,
   AC_CHECK_LIB(termcap,tgetent,TERMLIB=-ltermcap))
   saved_LIBS="$LIBS"
   LIBS="$LIBS $TERMLIB"
   AC_CHECK_LIB(readline,readline,
      [AC_CHECK_HEADER(readline/readline.h,
      LIBS="$saved_LIBS -lreadline $TERMLIB";bcrl=y)],
      LIBS="$saved_LIBS")
   if test "$bcrl" = "y" ; then
     echo Using the readline library.
     AC_DEFINE(READLINE,1)
   fi
])
echo $LIBS

dnl AC_ARG_WITH(readline,[  --with-readline         support fancy command input editing], [
dnl if test "$with_readline" = "yes" ; then
dnl  echo Using the readline library.
dnl  AC_DEFINE(READLINE,1)
dnl  LIBS="$LIBS -lreadline -ltermcap"
dnl  bcrl=y
dnl else
dnl  bcrl=n
dnl fi
dnl ], [
dnl bcrl=n
dnl ])

if test "$LEX" = "flex" ; then
 LEX="flex -I8"
else
 if test "$bcrl" = "y" ; then
  AC_MSG_WARN(readline works only with flex.)
 fi
fi

if test "$LEX" = "lex" -a `uname -s` = "SunOS" ; then
  LEXLIB=""
  echo "SunOS using lex does not have a -ll."
fi

AC_ARG_PROGRAM
AC_OUTPUT(Makefile bc/Makefile dc/Makefile doc/Makefile lib/Makefile)
OpenPOWER on IntegriCloud