summaryrefslogtreecommitdiff
path: root/configure.in
blob: 68d23ce506c3e62aa147bf2b29e8009e4df77c2a (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
dnl Process this file with autoconf to produce a configure script.

dnl Copyright (C) 2006 Free Software Foundation, Inc.
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2, or (at your option)
dnl any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software Foundation,
dnl Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

m4_define([bc_version], 1.06.95)
m4_define([dc_version], 1.3.95)

AC_INIT(bc, bc_version)
AC_CONFIG_SRCDIR(doc/bc.1)
AM_INIT_AUTOMAKE([dist-bzip2])
AM_CONFIG_HEADER(config.h)

AC_DEFINE([DC_VERSION], "dc_version",
	  [Define the dc version number.])

AC_DEFINE([BC_COPYRIGHT],
	  ["Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc."],
	  [Define the bc copyright line.])

AC_DEFINE([DC_COPYRIGHT], 
          ["Copyright 1994, 1997, 1998, 2000, 2001, 2004, 2005, 2006 Free Software Foundation, Inc."],
	  [Define the dc copyright line.])

AC_PROG_CC
AC_MINIX

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 errno.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 fstat strtol)

AC_ARG_WITH(pkg,
   AC_HELP_STRING([--with-pkg],
      [use software installed in /usr/pkg tree]),
   [case $withval in no) ;;
      *) CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
	 LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
	 echo Using /usr/pkg/include and /usr/pkg/lib ;;
    esac])

bcle=n
AC_ARG_WITH(libedit,
   AC_HELP_STRING([--with-libedit],
      [support fancy BSD command input editing]),
   [case $withval in no) ;;
      *) LDSAVE=$LDFLAGS
	 AC_CHECK_LIB(termcap,tgetent,TERMLIB=-ltermcap)
	 LDFLAGS="$LDFLAGS $TERMLIB"
	 AC_CHECK_LIB(edit,el_gets,
	    [AC_CHECK_HEADER(histedit.h,
	     READLINELIB="-ledit $TERMLIB";bcle=y)],
	    READLINELIB="")
	 case $bcle in
	   y) AC_DEFINE(LIBEDIT,1, [Define if libedit is used])
	      echo Using the libedit library. ;;
	 esac
	 LDFLAGS=$LDSAVE
	 ;;
    esac])
 
bcrl=n
AC_ARG_WITH(readline,
   AC_HELP_STRING([--with-readline],
      [support fancy command input editing]),
   [case $withval in no) ;;
      *) LDSAVE=$LDFLAGS
	 AC_CHECK_LIB(ncurses,tparm,TERMLIB=-lncurses,
	    AC_CHECK_LIB(termcap,tgetent,TERMLIB=-ltermcap))
	 LDFLAGS="$LDFLAGS $TERMLIB"
	 AC_CHECK_LIB(readline,readline,
	    [AC_CHECK_HEADER(readline/readline.h,
	     READLINELIB="-lreadline $TERMLIB";bcrl=y)],
	    READLINELIB="")
	 case $bcrl in
	   y) AC_DEFINE(READLINE,1, [Define if readline is used])
	      echo Using the readline library. ;;
	 esac
	 LDFLAGS=$LDSAVE
	 ;;
    esac])

case $bcle-$bcrl-$LEX in
   y-y-*)
	AC_MSG_ERROR(Can not use both readline and libedit.  Aborting.) ;;
   ?-?-flex)
	LEX="flex -I -8"
	case $bcrl in
	  n) AC_MSG_WARN(readline works only with flex.) ;;
	esac ;;
esac

case $LEX-`uname -s` in
  lex-SunOS) LEXLIB=""; echo "SunOS using lex does not have a -ll." ;;
esac

case $GCC in
  yes) CFLAGS="$CFLAGS -Wall -funsigned-char"
       echo "Adding GCC specific compile flags." ;;
esac

AC_SUBST(READLINELIB)
AC_SUBST(BC_VERSION, bc_version)
AC_SUBST(DC_VERSION, dc_version)
AC_OUTPUT(Makefile bc/Makefile dc/Makefile doc/Makefile doc/texi-ver.incl lib/Makefile)