root/configure.ac

Revision aef58ba6ff1f23f0533a4c896a3f71ac64fff84d, 7.3 kB (checked in by Philip Herron <redbrain@…>, 21 months ago)

cleanup added autoconf check for libpcre3-dev for perl compatible regex semantics

  • Property mode set to 100644
Line 
1dnl configure.ac -> Part of Crules Programming language
2dnl
3dnl Crules is the legal property of its developers. Please refer to the
4dnl COPYRIGHT file distributed with this source distribution.
5dnl
6dnl This program is free software: you can redistribute it and/or modify
7dnl it under the terms of the GNU General Public License as published by
8dnl the Free Software Foundation, either version 3 of the License, or
9dnl (at your option) any later version.
10dnl
11dnl This program is distributed in the hope that it will be useful,
12dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14dnl GNU General Public License for more details.
15dnl
16dnl You should have received a copy of the GNU General Public License
17dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
18dnl
19
20AC_PREREQ(2.59)
21AC_REVISION($Revision$)
22
23AC_INIT(Crules, 0.46, http://crules.org)
24AC_CONFIG_SRCDIR([src/mm_crules.c])
25AC_CONFIG_HEADER([src/config.h])
26dnl keep the autoconf generated stuff neatly in a folder :)
27AC_CONFIG_AUX_DIR([config])
28AC_CONFIG_MACRO_DIR([m4])
29AM_SANITY_CHECK
30
31dnl Last slash shouldn't be stripped if prefix=/
32if test "$prefix" != "/"; then
33    prefix=`echo "$prefix" | sed -e 's/\/$//g'`
34fi
35
36dnl Checks for programs.
37AC_PROG_CC([icc cl gcc cc])
38AC_DEFINE_UNQUOTED([CONFIG_CC], "$CC", [C Compiler used])
39
40AC_PROG_AWK
41AC_PROG_CPP
42AC_PROG_INSTALL
43AC_PROG_LN_S
44AC_PROG_MAKE_SET
45AC_PROG_RANLIB
46AC_CHECK_PROGS(AR, ar aal, ar)
47AC_PROG_CC_C99
48AC_PROG_CXX
49
50AC_MSG_CHECKING([Checking for a valid Perl interpreter!])
51AC_CHECK_PROGS(PERL, perl, )
52AC_PATH_PROGS(PERL, perl, )
53if test "x${PERL}" == "x"; then
54   AC_MSG_NOTICE([A valid Perl installation is \
55required to run the test suite!])
56   XPERL="no"
57else
58   XPERL="yes"
59fi
60
61AC_AIX
62AC_EXEEXT
63AC_GNU_SOURCE
64
65AC_PROG_INSTALL
66
67AC_LIBTOOL_DLOPEN
68AC_PROG_LIBTOOL
69AM_PROG_LIBTOOL
70
71AM_PROG_CC_C_O
72
73AC_PROG_YACC
74AC_PROG_LEX
75
76AC_C_BIGENDIAN
77AC_C_INLINE
78AC_C_VOLATILE
79
80AC_CANONICAL_HOST
81
82
83# CFLAGS_save="$CFLAGS"
84# CFLAGS="$"
85
86xpkgs=""
87AC_ARG_WITH(maint-str,
88  [AS_HELP_STRING([--with-maint-str=""],
89    [A Simple Maintainer string!])],
90  [xpkgs="$withval"])
91if test "x$xpkgs" != "x"; then
92  AC_DEFINE_UNQUOTED([MAINTAINER_INFO], "$xpkgs", \
93[Maintainer String])
94fi
95
96# Just to make sure we dont do debug on default!
97debug=no
98AC_ARG_WITH(debug,
99  [AS_HELP_STRING([--with-debug=yes/no],
100    [With Debug symbols, default no.])],
101  [debug="$withval"])
102if test "x$debug" == "xyes"; then
103  AC_DEFINE([DEBUG], 1, [Debug Symbols Flag])
104  #turn on extra debug compiler options :)
105  if test "x$CC" == "xgcc -std=gnu99"; then
106     CFLAGS="$CFLAGS -g -O2 -D_DEBUG -ggdb3 -pedantic -Wall -Wextra -fstrict-aliasing"
107  fi   
108fi
109
110# turn on some optimizations for gcc
111# support for other compilers soon
112if test "x$debug" == "xno"; then
113  if test "x$CC" == "xgcc -std=gnu99"; then
114    CFLAGS="$CFLAGS -g -O3 -fwrapv -fstrict-aliasing -ffast-math -fstack-protector"
115  fi
116fi
117# lets get the gcc version :)
118CC_VER=""
119if test "x$CC" == "xgcc -std=gnu99"; then
120   CC_VER=`$CC -dumpversion`
121else
122   CC_VER="undefined"
123fi
124AC_DEFINE_UNQUOTED([CONFIG_CC_VER], "$CC_VER", [C Compiler Version])
125
126ACX_PTHREAD(,AC_MSG_ERROR(could not find libpthread))
127LIBS="${PTHREAD_LIBS} ${LIBS}"
128AM_CFLAGS="${PTHREAD_CFLAGS} ${AM_CFLAGS}"
129CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
130CC="$PTHREAD_CC"
131pthread="yes"
132
133# a lang needs math functions...
134AC_CHECK_LIB([m], [pow], ,
135  [AC_MSG_ERROR([System Math library is required!])])
136
137# used for constant folding and rounding
138AC_CHECK_LIB([gmp], [__gmpz_init], ,
139  [AC_MSG_ERROR([GNU MP not found, see http://gmplib.org/])])
140AC_CHECK_LIB([mpfr],[mpfr_init] , ,
141  [AC_MSG_ERROR([MPFR not found, see http://www.mpfr.org/])])
142AC_CHECK_SIZEOF(mp_limb_t, , [#include <gmp.h>])
143
144AC_CHECK_LIB([pcre], [pcre_compile], ,
145  [AC_MSG_ERROR([Libpcre3 - Perl Regex not found. \
146On Debfian can be found via libpcre3-dev])])
147
148VL_LIB_READLINE
149AS_IF([test "x$vl_cv_lib_readline" = "xno"],
150      AC_MSG_ERROR([libreadline is required for Crules. \
151On Debian this can be found in libreadline5-dev. On RedHat \
152this can be found in readline-devel.]))
153AC_CHECK_FUNCS(dlopen)
154
155gl_VISIBILITY
156
157GCOV="no"
158AC_ARG_WITH(gcov,
159  [AS_HELP_STRING([--with-gcov=yes/no],
160    [With GCC Code Coverage reporting.])],
161  [GCOV="$withval"])
162if test "x$GCOV" == "xyes"; then
163  if test "x$CC" == "xgcc -std=gnu99"; then
164    AC_MSG_NOTICE([Pushing GCC GCOV Support!])
165    CFLAGS="$CFLAGS -DGCOV -fprofile-arcs -ftest-coverage"
166  else
167    AC_MSG_ERROR([GCOV support requires GCC!])
168  fi
169fi
170
171AC_SUBST(CFLAGS)
172AC_SUBST(LDFLAGS)
173
174AC_PATH_PROG(MV, mv, mv)
175AC_PATH_PROG(RM, rm, rm)
176AC_PATH_PROG(CP, cp, cp)
177AC_PATH_PROG(SED, sed, sed)
178AC_PATH_PROG(CMP, cmp, cmp)
179AC_PATH_PROG(CHMOD, chmod, chmod)
180AC_PATH_PROG(HOSTNAME, hostname, hostname)
181
182# Check whether --with-system-type or --without-system-type was given.
183AC_ARG_WITH([system-type],
184    [AS_HELP_STRING([--with-system-type],
185       [Set the system type, like "sun-solaris10"])],
186    [SYSTEM_TYPE="$withval"],
187    [SYSTEM_TYPE="$host_vendor-$host_os"])
188AC_ARG_WITH([machine-type],
189    [AS_HELP_STRING([--with-machine-type],
190       [Set the machine type, like "sparc"])],
191    [MACHINE_TYPE="$withval"],
192    [MACHINE_TYPE="$host_cpu"])
193AC_SUBST(SYSTEM_TYPE)
194AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$SYSTEM_TYPE"],
195                   [Name of system, eg sun-solaris])
196AC_SUBST(MACHINE_TYPE)
197AC_DEFINE_UNQUOTED([MACHINE_TYPE], ["$MACHINE_TYPE"],
198                   [Machine type name, eg sparc])
199
200AM_INIT_AUTOMAKE
201
202AC_CHECK_SIZEOF(long)
203AC_CHECK_SIZEOF(char)
204AC_CHECK_SIZEOF(int)
205AC_CHECK_SIZEOF(void*)
206AC_CHECK_SIZEOF(short)
207AC_CHECK_SIZEOF(double)
208AC_CHECK_SIZEOF(float)
209AC_CHECK_SIZEOF(size_t)
210AC_CHECK_SIZEOF(long int)
211AC_CHECK_SIZEOF(long long)
212AC_CHECK_SIZEOF(crl_symbol_obj, , \
213  [#include "include/crules/symbols.h"])
214
215# Checks for header files.
216AC_HEADER_SYS_WAIT
217AC_HEADER_STDBOOL
218AC_HEADER_STDC
219AC_CHECK_HEADERS([stdlib.h string.h stdarg.h unistd.h \
220                  stdint.h stdio.h getopt.h \
221                  assert.h sys/types.h signal.h \
222                  fcntl.h pthread.h sys/wait.h \
223                  gmp.h mpfr.h pcre.h])
224
225# Checks for typedefs, structures, and compiler characteristics.
226AC_C_CONST
227AC_TYPE_PID_T
228AC_TYPE_SIZE_T
229AC_CHECK_FUNCS([popen fopen fclose sprintf fprintf strdup \
230                strlen strcpy strcmp getopt_long \
231                memcpy calloc system sysconf atoi \
232                getpid execl fork wait exit atof \
233                vfprintf memcmp getc fgets pipe \
234                waitpid fdopen])
235
236# Checks for library functions.
237AC_FUNC_MALLOC
238AC_FUNC_UTIME_NULL
239AC_FUNC_VPRINTF
240AC_CONFIG_FILES([Makefile
241                 include/Makefile
242                 src/Makefile
243                 tests/Makefile
244                 config/pkg-config/crules.pc])
245AC_OUTPUT
246
247echo "---"
248echo "Configuration summary for $PACKAGE_NAME version $VERSION"
249echo ""
250echo "   * Installation prefix:       $prefix"
251echo "   * System type:               $SYSTEM_TYPE"
252echo "   * Host CPU:                  $host_cpu"
253echo "   * C Compiler:                $CC"
254echo "   * YACC version:              $YACC"
255echo "   * LEX version:               $LEX"
256echo "   * Perl support:              $XPERL"
257echo "   * GMP & MPFR support:        yes"
258echo "   * Perl Regex Support:        yes"
259echo "   * POSIX pthreads:            $pthread"
260echo "   * DEBUG Symbols:             $debug"
261echo "   * GCOV Support:              $GCOV"
262echo ""
263echo "---"
264
265dnl libtoolize scans configure.ac  and needs to see some text
266m4_define([LIBTOOLIZE_AC_INIT], [])
Note: See TracBrowser for help on using the browser.