dnl Process this file with autoconf to produce a configure script for libmaa. dnl dnl Created: Sun Nov 6 13:56:03 1994 by faith@dict.org dnl Revised: Sat Mar 30 11:56:33 2002 by faith@dict.org dnl Copyright 1994-1998, 2001-2002 Rickard E. Faith (faith@dict.org) dnl dnl This program is free software; you can redistribute it and/or modify it dnl under the terms of the GNU General Public License as published by the dnl Free Software Foundation; either version 1, or (at your option) any dnl later version. dnl dnl This program is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License along dnl with this program; if not, write to the Free Software Foundation, Inc., dnl 675 Mass Ave, Cambridge, MA 02139, USA. dnl dnl $Id: configure.in,v 1.33 2006/12/13 16:19:14 cheusov Exp $ dnl dnl Flag conventions: dnl CFLAGS and LDFLAGS should be settable on the make commandline dnl for optimization and stripping. dnl WCFLAGS and WLDFLAGS are warnings and stuff that we like (e.g., -pipe) dnl XTRACFLAGS, XTRALDFLAGS are for things like dmalloc # LIBOBJS is an automatically-generated list of extra objects we need dnl LDSHARED is the shared library linker dnl These aren't used for libmaa: dnl XCFLAGS and XLDFLAGS are for X11 dnl YCFLAGS is for yacc dnl LCFLAGS is for lex AC_PREREQ(2.53) AC_REVISION($Revision: 1.33 $) AC_INIT AC_CONFIG_SRCDIR([maa.h]) AC_CONFIG_HEADER(config.h) MAA_MAJOR=1 MAA_MINOR=0 echo Configuring for libmaa $MAA_MAJOR.$MAA_MINOR echo . AC_ARG_WITH(cc, [ --with-cc with cc (instead of gcc)], [ if test "x${withval}" = xyes; then CC=cc fi ]) AC_CANONICAL_HOST AC_PROG_AWK AC_PROG_CC AC_ISC_POSIX REALCC="$CC" if test "$CC" = gcc; then CFLAGS="$CFLAGS -g -O -Wall -pedantic" else CFLAGS="$CFLAGS -g" fi needs_xmalloc=1 local_dmalloc=0 AC_ARG_WITH(cflags, [ --with-cflags=FLAGS use FLAGS for CFLAGS], [ if test "x${withval}" = xyes; then CFLAGS="$withval" fi ]) AC_ARG_WITH(prof, [ --with-prof with prof profiling], [ if test "x${withval}" = xyes; then CFLAGS="$CFLAGS -p" LDFLAGS="$LDFLAGS -p" fi ]) AC_ARG_WITH(gprof, [ --with-gprof with gprof profiling], [ if test "x${withval}" = xyes; then CFLAGS="$CFLAGS -pg" LDFLAGS="$LDFLAGS -pg" fi ]) AC_ARG_WITH(dmalloc, [ --with-dmalloc with Gray Watson's debugging malloc], [ if test "x${withval}" = xyes; then needs_dmalloc=1 needs_xmalloc=0 fi ]) AC_ARG_WITH(local-dmalloc, [ --with-local-dmalloc with dmalloc built in local source tree], [ if test "x${withval}" = xyes; then needs_dmalloc=1 local_dmalloc=1 needs_xmalloc=0 fi ]) AC_ARG_WITH(checker, [ --with-checker with Checker support (Linux only)], [ if test "x${withval}" = xyes; then REALCC=checkergcc fi ]) AC_ARG_WITH(efence, [ --with-efence with Electric Fence (by Bruce Perens)], [ if test "x${withval}" = xyes; then REALLIBS="$REALLIBS -lefence" fi ]) AC_ARG_WITH(insure, [ --with-insure with Insure support (from ParaSoft Corp.)], [ if test "x${withval}" = xyes; then REALCC=insight fi ]) AC_ARG_WITH(purify, [ --with-purify with Purify support (from Pure, Inc.)], [ if test "x${withval}" = xyes; then REALCC="purify gcc" fi ]) shared=0 AC_ARG_ENABLE(shared, [ --enable-shared enable shared libraries], [ if test "x${enableval}" = xyes; then shared=1 fi ]) TARGETLIBS=libmaa.a RPATHFLAGS="" dnl Checks for programs. echo Checking for programs AC_PROG_INSTALL AC_PROG_RANLIB AC_CHECK_PROGS(PERL,perl4 perl) AC_CHECK_PROGS(LATEX,latex2e latex) AC_CHECK_PROGS(FIG2DEV,fig2dev) AC_CHECK_PROGS(DVIPS,dvips) AC_CHECK_PROGS(REFBIBTEX,refbibtex) AC_CHECK_PROGS(BIBTEX,bibtex) echo . echo Checking for libraries if test "$local_dmalloc" = 0 -a "$needs_dmalloc" = 1; then AC_CHECK_LIB(dmalloc,main, REALLIBS="$REALLIBS -ldmalloc" CFLAGS="-DDMALLOC_FUNC_CHECK $CFLAGS", local_dmalloc=1) fi if test "$local_dmalloc" = 1; then AC_MSG_CHECKING(for dmalloc in local source tree) if test -d dmalloc; then REALLIBS="$REALLIBS -L./dmalloc -ldmalloc" CFLAGS="-DDMALLOC_FUNC_CHECK -I./dmalloc $CFLAGS" XTRAHEADERS="./dmalloc/dmalloc.h" extra_subdirs="$extra_subdirs dmalloc" AC_CONFIG_SUBDIRS(dmalloc) AC_MSG_RESULT(./dmalloc) else if test -d ../dmalloc; then REALLIBS="$REALLIBS -L../dmalloc -ldmalloc" CFLAGS="-DDMALLOC_FUNC_CHECK -I../dmalloc $CFLAGS" XTRAHEADERS="../dmalloc/dmalloc.h" AC_MSG_RESULT(../dmalloc) else AC_MSG_RESULT(no) fi fi fi #AC_CHECK_LIB(c,getopt,, [AC_LIBOBJ([getopt])]) #AC_CHECK_LIB(c,getopt_long,,[AC_LIBOBJ([getopt_long])]) if test "$needs_xmalloc" = 1; then AC_LIBOBJ([xmalloc]) fi echo . echo Checking for header file support AC_HEADER_STDC AC_HEADER_TIME AC_CHECK_HEADERS(unistd.h strings.h limits.h) AC_CHECK_HEADERS(sys/resource.h sys/time.h sys/param.h sys/wait.h) AC_MSG_CHECKING(for SYSLOG_NAMES support in syslog.h) AC_TRY_COMPILE([ #define SYSLOG_NAMES #include #include ], [ CODE *p = &prioritynames[0]; CODE *f = &facilitynames[0]; ], AC_DEFINE(HAVE_SYSLOG_NAMES) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) echo . echo Checking for system constants AC_TYPE_SIZE_T AC_TYPE_SIGNAL AC_C_CONST AC_C_INLINE AC_C_BIGENDIAN AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(void *) AC_CHECK_SIZEOF(long long int) echo . echo Checking for library functions AC_FUNC_ALLOCA AC_FUNC_VPRINTF AC_CHECK_FUNCS(snprintf) AC_CHECK_FUNCS(gettimeofday strchr strerror memcpy atexit on_exit sysconf) AC_CHECK_FUNCS(strdup strtol strtoul) AC_CHECK_FUNCS(vsyslog) AC_REPLACE_FUNCS(getopt) AC_REPLACE_FUNCS(strdup strtol strtoul) AC_REPLACE_FUNCS(strlcpy) echo . echo Making output files CC="$REALCC" LIBS="$REALLIBS" AC_SUBST(MAA_MINOR) AC_SUBST(MAA_MAJOR) AC_SUBST(RPATHFLAGS) AC_SUBST(TARGETLIBS) AC_SUBST(XTRAHEADERS) AC_SUBST(AWK) AC_CONFIG_FILES([Makefile doc/Makefile arggram2c]) AC_OUTPUT date > stamp-h.in date > stamp-h echo . echo Done