1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3 4AC_INIT(libantlr3c, 3.4, jimi@temporal-wave.com) 5AC_PREREQ(2.60) 6AC_COPYRIGHT([ 7 (The "BSD licence") 8 Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC 9 http://www.temporal-wave.com 10 http://www.linkedin.com/in/jimidle 11 All rights reserved. 12 13 Redistribution and use in source and binary forms, with or without 14 modification, are permitted provided that the following conditions 15 are met: 16 1. Redistributions of source code must retain the above copyright 17 notice, this list of conditions and the following disclaimer. 18 2. Redistributions in binary form must reproduce the above copyright 19 notice, this list of conditions and the following disclaimer in the 20 documentation and/or other materials provided with the distribution. 21 3. The name of the author may not be used to endorse or promote products 22 derived from this software without specific prior written permission. 23 24 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 25 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 26 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 28 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 33 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34]) 35AC_CONFIG_SRCDIR(src/antlr3parser.c) 36 37 38AC_ARG_ENABLE([debuginfo], 39 [AS_HELP_STRING([--enable-debuginfo], [Compiles debug info into the library (default --disable-debuginfo)])], 40 [], [enable_debuginfo=no]) 41 42AC_ARG_ENABLE([64bit], 43 [AS_HELP_STRING([--enable-64bit], [Turns on flags that produce 64 bit object code if any are required (default --disable-64bit)])], 44 [], [enable_64bit=no]) 45 46AC_ARG_ENABLE([abiflags], 47 [AS_HELP_STRING([--disable-abiflags], [Does not add ABI flags -m32 or -m64 for older versions of gcc, such as itanium 3.x (default --enable-abiflags=yes)])], 48 [], [enable_abiflags=yes]) 49 50AC_ARG_ENABLE([antlrdebug], 51 [AS_HELP_STRING([--disable-antlrdebug], [Turns off default flags that include the antlr debugger in the runtime. Specify to remove debugger and the socket dependancies (default --enable-antlrdebug)])], 52 [], [enable_antlrdebug=yes]) 53 54AM_INIT_AUTOMAKE(foreign) 55AC_LANG(C) 56AC_PROG_CC([xlc aCC gcc cc]) 57AM_MAINTAINER_MODE 58AM_PROG_LIBTOOL 59 60AC_CANONICAL_BUILD 61AC_CANONICAL_HOST 62 63OBJECT_MODE= 64# Checks for programs. 65AC_MSG_CHECKING([compiler flags required for compiling ANTLR with $CC C compiler on host $host]) 66WARNFLAGS= 67case $CC in 68xlc*) 69 CPPCMNTFLAGS="-qcpluscmt" 70 if test x"$enable_64bit" = xyes; then 71 CCFLAGS64="-q64 -Wl,-b64" 72 OBJECT_MODE="64" 73 else 74 OBJECT_MODE="32" 75 fi 76 OPTIMFLAGS="-O2" 77 if test x"$enable_debuginfo" = xyes; then 78 DEBUGFLAGS="-g" 79 fi 80 ;; 81 82aCC*) 83 CPPCMNTFLAGS= 84 if test x"$enable_64bit" = xyes; then 85 CCFLAGS64="+DD64" 86 fi 87 OPTIMFLAGS="-O" 88 if test $DEBUGINF = 1; then 89 DEBUGFLAGS="-g" 90 fi 91 ;; 92 93gcc*) 94 CPPCMNTFLAGS= 95 if test x"$enable_64bit" = xyes; then 96 GCCABIFLAGS="-m64" 97 else 98 GCCABIFLAGS="-m32" 99 fi 100 if test x"$enable_abiflags" = xyes; then 101 CCFLAGS64=$GCCABIFLAGS 102 fi 103 OPTIMFLAGS="-O2" 104 if test x"$enable_debuginfo" = xyes; then 105 DEBUGFLAGS="-g" 106 fi 107 WARNFLAGS=-Wall 108 ;; 109 110*) 111 112case $host in 113sparc*-*solaris*) 114 CPPCMNTFLAGS= 115 if test x"$enable_64bit" = xyes; then 116 CCFLAGS64="-fast -xtarget=ultra4 -m64 -xarch=sparcvis" 117 fi 118 OPTIMFLAGS="-O" 119 if test x"$enable_debuginfo" = xyes; then 120 DEBUGFLAGS='-g' 121 fi 122 ;; 123 124*) 125 CPPCMNTFLAGS= 126 CCFLAGS64= 127 OPTIMFLAGS="-O" 128 if test x"$enable_debuginfo" = xyes; then 129 DEBUGFLAGS='-g' 130 fi 131 ;; 132esac 133 134 ;; 135esac 136 137CFLAGS="$CCFLAGS64 $CPPCMNTFLAGS $OPTIMFLAGS $DEBUGFLAGS $WARNFLAGS" 138AC_MSG_RESULT([$CFLAGS]) 139AC_SUBST([OBJECT_MODE]) 140 141AS_IF([test "x$enable_antlrdebug" = xno], [AC_DEFINE([ANTLR3_NODEBUGGER], [1], [Define if ANTLR debugger not required])], []) 142AS_IF([test x"$enable_64bit" = xyes], [AC_DEFINE([ANTLR3_USE_64BIT], [1], [Define if 64 bit mode required])], []) 143 144AC_PROG_INSTALL 145AC_PROG_LN_S 146AC_PROG_MAKE_SET 147 148# Checks for libraries. 149 150# Checks for header files. 151AC_INCLUDES_DEFAULT() 152AC_HEADER_RESOLV 153AC_CHECK_HEADERS([sys/malloc.h malloc.h], [], [], 154[[#ifdef HAVE_SYS_MALLOC_H 155#include <sys/malloc.h> 156#endif 157#ifdef HAVE_MALLOC_H 158#include <malloc.h> 159#endif 160]]) 161AC_CHECK_HEADERS([stdarg.h], [], [], 162[[#ifdef HAVE_STDARG_H 163#include <stdarg.h> 164#endif 165]]) 166 167AC_CHECK_HEADERS([sys/stat.h], [], [], 168[[#ifdef HAVE_SYS_STAT_H 169#include <sys/stat.h> 170#endif 171]]) 172 173AC_CHECK_HEADERS([ctype.h], [], [], 174[[#ifdef HAVE_CTYPE_H 175#include <ctype.h> 176#endif 177]]) 178 179AC_CHECK_HEADERS([netinet/tcp.h], [], [], 180[[#ifdef HAVE_NETINET_TCP_H 181#include <netinet/tcp.h> 182#endif 183]]) 184 185AC_CHECK_HEADERS([sys/socket.h socket.h], [], [], 186[[#ifdef HAVE_SYS_SOCKET_H 187#include <sys/socket.h> 188#endif 189#ifdef HAVE_SOCKET_H 190#include <socket.h> 191#endif 192]]) 193 194# Checks for typedefs, structures, and compiler characteristics. 195AC_C_CONST 196AC_TYPE_SIZE_T 197AC_TYPE_INT8_T 198AC_TYPE_INT16_T 199AC_TYPE_INT32_T 200AC_TYPE_INT64_T 201AC_TYPE_INTPTR_T 202AC_TYPE_UINT8_T 203AC_TYPE_UINT16_T 204AC_TYPE_UINT32_T 205AC_TYPE_UINT64_T 206AC_TYPE_UINTPTR_T 207AC_C_INLINE 208 209 210# Checks for library functions. 211AC_CHECK_FUNCS([memmove memset strdup accept]) 212 213AC_CONFIG_MACRO_DIR([m4]) 214 215AC_CONFIG_HEADERS(antlr3config.h) 216AC_CONFIG_FILES([Makefile]) 217AC_OUTPUT 218