# Process this file with autoconf to produce a configure script. # # Copyright (C) 2004 Richard Kettlewell # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA # AC_INIT(cparse, 0.0.20040813, richard+cparse@sfere.greenend.org.uk) AM_INIT_AUTOMAKE(cparse, 0.0.20040813) AC_CONFIG_SRCDIR([cparse.h]) AM_CONFIG_HEADER([config.h]) # Checks for programs. AC_PROG_CC AC_SET_MAKE AC_PROG_YACC AM_PROG_LEX # libtool config AC_DISABLE_STATIC AC_PROG_LIBTOOL missing_libraries="" missing_headers="" missing_functions="" # Turn of libgc so that you can use valgrind. (Hopefuly someone will add libgc # support to valgrind at some point.) Since nothing ever calls free() this is # rather wasteful of memory - it's not intended to allow people to use the code # in production without a garbage collector. AC_ARG_WITH([gc],[use the garbage collector],[ WANT_GC="$withval" ],[WANT_GC=yes]) # Checks for libraries. # We save up a list of missing libraries that we can't do without # and report them all at once. if test $WANT_GC = yes; then AC_CHECK_LIB(gc, GC_malloc, [AC_SUBST(LIBGC,[-lgc])], [missing_libraries="$missing_libraries libgc"]) AC_DEFINE([USE_GC],[1],[define to use a garbage collector]) fi if test ! -z "$missing_libraries"; then AC_MSG_ERROR([missing libraries:$missing_libraries]) fi # Checks for header files. RJK_FIND_GC_H AC_CHECK_HEADERS([inttypes.h]) # Compilation will fail if any of these headers are missing, so we # check for them here and fail early. # We don't bother checking very standard stuff AC_CHECK_HEADERS([getopt.h unistd.h],[:],[ missing_headers="$missing_headers $ac_header" ]) if test ! -z "$missing_headers"; then AC_MSG_ERROR([missing headers:$missing_headers]) fi # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T AC_C_INLINE AC_CHECK_TYPES([_Bool]) if test "x$GCC" = xyes; then # a reasonable default set of warnings CC="${CC} -Wall -W -Wpointer-arith -Wbad-function-cast \ -Wwrite-strings -Wmissing-prototypes \ -Wshadow \ -Wmissing-declarations -Wnested-externs -Werror" AC_DEFINE([__NO_STRING_INLINES],[1],[define to suppress gcc optimizations we can't cope with]) fi # Flex includes and other headers before we get a chance to # include , so we have to hack definitions that affect the # meanings of those header files onto the command line. CC="${CC} -D_GNU_SOURCE" AH_BOTTOM([#ifdef __GNUC__ # define attribute(x) __attribute__(x) #else # define attribute(x) #endif /* older GNU C versions define LONG_LONG_MAX instead of LLONG_MAX */ #include #if !defined LLONG_MAX && defined LONG_LONG_MAX # define LLONG_MAX LONG_LONG_MAX # define ULLONG_MAX ULONG_LONG_MAX #endif /* not everyone defines SIZE_MAX, fortunately we can compute it portably */ #if !defined SIZE_MAX # define SIZE_MAX ((size_t)~(size_t)0) #endif]) AC_CONFIG_FILES([Makefile tests/Makefile]) AC_OUTPUT