File: configure.ac

package info (click to toggle)
wcalc 2.5-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,284 kB
  • sloc: ansic: 8,379; sh: 2,250; objc: 1,776; lex: 852; yacc: 603; makefile: 127
file content (161 lines) | stat: -rw-r--r-- 5,679 bytes parent folder | download | duplicates (2)
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# Process this file with autoconf to produce a configure script.

## --------------------- ##
## Autoconf Requirements ##
## --------------------- ##
AC_PREREQ(2.59)

## ---------------------------------- ##
## Autoconf / Automake Initialization ##
## ---------------------------------- ##
AC_INIT([wcalc], [2.5], [kyle-wcalc@memoryhole.net])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([config])
AC_CONFIG_SRCDIR([src/cli/main.c])

dnl Require at least AM 1.7.  Prior versions require AM_CONFIG_HEADER
dnl and have no equivalent to AC_CONFIG_HEADERS (the plural version),
dnl which is a pain.  AM 1.7 also added support for putting target
dnl information in AM_CONDITIONAL blocks and using the += modifier.
dnl ... removed "check-news" because of automatic version generation
# Automake's silent rules were implemented in the same version that
# color-tests was implemented, so we can use one to detect the other.
# This nasty, dirty, unreliable trick is strongly discouraged by its author:
# http://blog.flameeyes.eu/trackbacks?article_id=5155
m4_ifdef([AM_SILENT_RULES],
		 [m4_define([wc_color_tests], [color-tests])],
		 [m4_define([wc_color_tests], [])])
AM_INIT_AUTOMAKE([foreign subdir-objects dist-bzip2 no-define 1.7 ]wc_color_tests)
# If Automake supports silent rules, enable them
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])


AC_ARG_ENABLE([rpath],
			  [AS_HELP_STRING([--enable-rpath],
							  [Add -rpath arguments to LDFLAGS])])
AC_ARG_ENABLE([picky],
              [AS_HELP_STRING([--enable-picky],
                              [turns on extra compiler warnings (for developers)])])
AS_IF([test "x$enable_picky" = x],
      [AS_IF([test -d "${srcdir}/.svn"],
             [AC_MSG_NOTICE([--> developer override: enable picky compiler by default <--])
             enable_picky=yes])])

# Checks for programs.
AC_PROG_CC
AC_PROG_CC_C99
AC_PROG_RANLIB
AC_PROG_YACC
AM_PROG_LEX
AS_IF([test "x$LEX" == x],
	  [AC_MSG_ERROR([A Lex/Flex program is required in order to compile wcalc.])],
	  [AS_IF([test "x$LEX" != xflex],
			 [LEX="$SHELL $missing_dir/missing flex"
			  AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
			  AC_SUBST([LEXLIB], [''])]
			 )]
	  )
AC_PROG_CPP
AC_PROG_INSTALL

AS_IF([test "x$enable_picky" = xyes],
	  [CFLAGS="$CFLAGS -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wmissing-prototypes -Wstrict-prototypes"])

CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200112L"

AC_CHECK_HEADERS([limits.h])
AC_CHECK_DECL([PATH_MAX],
			  [AC_DEFINE([HAVE_PATH_MAX], [1], [Have PATH_MAX])],
			  [],
			  [#ifdef HAVE_LIMITS_H
			   #include <limits.h>
			   #endif
			   ])

# Checks for libraries.
AC_CHECK_LIB([m], [acos])
AC_ARG_WITH([readline],
			[AS_HELP_STRING([--without-readline],
							[do not try to find and use the readline library])],
			[nc_cv_readline=$withval],
			[nc_cv_readline=yes])
AS_IF([test "x$nc_cv_readline" = xyes],
	  [VL_LIB_READLINE])

#==========================================================================================
# GMP
#==========================================================================================
AC_ARG_WITH([gmp],
			[AS_HELP_STRING([--with-gmp=[[PATH]]],
							[specify the path to the gmp library])],
			[AS_IF([test "x$enable_rpath" = xyes],
				   [GMP_CPPFLAGS="-I$with_gmp/include"
					GMP_LDFLAGS="-L$with_gmp/lib -Wl,-rpath,$with_gmp/lib"],
				   [GMP_CPPFLAGS="-I$with_gmp/include"
					GMP_LDFLAGS="-L$with_gmp/lib"])])
saved_CPPFLAGS="$CPPFLAGS"
saved_LDFLAGS="$LDFLAGS"
CPPFLAGS="$GMP_CPPFLAGS $CPPFLAGS"
LDFLAGS="$GMP_LDFLAGS $LDFLAGS"
AC_CHECK_LIB([gmp], [__gmpz_init], [],
			 [AC_CHECK_LIB([gmp], [mpz_init], [],
						   [AC_CHECK_LIB([gmp2], [mpz_init])])])
CPPFLAGS="$saved_CPPFLAGS"
LDFFLAGS="$saved_LDFLAGS"
AC_SUBST(GMP_CPPFLAGS)
AC_SUBST(GMP_LDFLAGS)

#==========================================================================================
# MPFR
#==========================================================================================
AC_ARG_WITH([mpfr],
			[AS_HELP_STRING([--with-mpfr=[[PATH]]],
							[specify the path to the mpfr library])],
			[AS_IF([test "x$enable_rpath" = xyes],
				   [MPFR_CPPFLAGS="-I$with_mpfr/include"
					MPFR_LDFLAGS="-L$with_mpfr/lib -Wl,-rpath,$with_mpfr/lib"],
				   [MPFR_CPPFLAGS="-I$with_mpfr/include"
					MPFR_LDFLAGS="-L$with_mpfr/lib"])])
saved_CPPFLAGS="$CPPFLAGS"
saved_LDFLAGS="$LDFLAGS"
CPPFLAGS="$MPFR_CPPFLAGS $GMP_CPPFLAGS $CPPFLAGS"
LDFLAGS="$MPFR_LDFLAGS $GMP_LDFLAGS $LDFLAGS"
AC_SEARCH_LIBS([mpfr_free_str], [mpfr],
			   [AC_DEFINE([HAVE_LIBMPFR], [1], [Have libmpfr])],
			   [AC_MSG_ERROR([Need MPFR 2.1.x or better. see http://www.mpfr.org])])
AC_CHECK_FUNC([mpfr_sec],
			  [AC_DEFINE([HAVE_MPFR_22], [1], [MPFR version 2.2 or better])])
AC_SUBST(MPFR_CPPFLAGS)
AC_SUBST(MPFR_LDFLAGS)
CPPFLAGS="$saved_CPPFLAGS"
LDFFLAGS="$saved_LDFLAGS"
# what version of mpfr
#==========================================================================================

# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_CHECK_HEADERS([fcntl.h float.h inttypes.h limits.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h stdio.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_C_CONST
AC_TYPE_SIZE_T

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([gettimeofday memset modf pow stpcpy strchr strdup strerror strrchr strtoul])

AC_CONFIG_HEADER([src/common/includes/config.h])
AC_CONFIG_FILES([Makefile
				 src/Makefile
				 src/common/Makefile
				 src/common/includes/Makefile
				 src/gui/Makefile
                 test/Makefile
				 English.lproj/Makefile])
AC_OUTPUT