dnl **** Process this file with autoconf to produce a configure script. AC_INIT(src/main.cc) AC_CONFIG_AUX_DIR(ac-tools) AC_CONFIG_HEADER(config.h:ac-tools/config.h.in C/igb.h:ac-tools/igb.h.in src/IGBheader.h:ac-tools/IGBheader.h.in ) AC_PREFIX_DEFAULT("/usr/local") AC_LANG_C builtin(include, ac-tools/aclocal.m4) builtin(include, ac-tools/ac_cxx_have_std.m4) builtin(include, ac-tools/ac_cxx_namespaces.m4) dnl AC_SUBST(EXEEXT) AC_SUBST(OBJEXT) AC_SUBST(BATEXT) AC_SUBST(MKINSTALLDIRS) AC_SUBST(GUI_FLAGS) AC_SUBST(GUI_LIBS) AC_SUBST(FLTK_LIBS) AC_SUBST(FLTK_LDFLAGS) AC_SUBST(FLTK_CXXFLAGS) AC_SUBST(LIB_AVIFILE) AC_SUBST(INC_AVIFILE) AC_SUBST(GRACE_LIB) AC_SUBST(GRACE_EXE) AC_SUBST(SUBDIRS) AC_SUBST(GRAPH_WIDGET) dnl **** option to define config file overriding autodetect AC_ARG_ENABLE(config, [ --enable-config=FILE define configuration FILE to override autodetection (not recommended!)], [CONF_FILE="${enableval}"]) dnl **** define C compiler CC=${CC-gcc} CXX=${CXX-g++} AC_ARG_WITH(cc, [ --with-cxx=PROG use PROG as C compiler [${CC-gcc}]], [CC="${withval}"]) dnl Chance to add include path AC_ARG_WITH(extra-incpath, [ --with-extra-incpath=PATH define extra include path (dir1:dir2:...) [none]], [CPPFLAGS="${CPPFLAGS} -I`echo ${withval}|sed 's/:/\ -I/g'`"]) dnl ... and ld path AC_ARG_WITH(extra-ldpath, [ --with-extra-ldpath=PATH define extra ld path (dir1:dir2:...) [none]], [LDFLAGS="-L`echo ${withval}|sed 's/:/\ -L/g'` ${LDFLAGS}"; case "${host}" in sparc-sun-solaris*) LDFLAGS="-R:${withval} ${LDFLAGS}";; esac ]) dnl **** whether to use libavifile AC_ARG_ENABLE(avifile, [ --enable-avifile use libavifile for avi output [[yes]]], [case "${enableval}" in yes) avifile=true ;; no) avifile=false;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-avifile) ;; esac],[avifile=true]) dnl **** use Gnuplot AC_ARG_ENABLE(gnuplot, [ --enable-gnuplot use gnuplot to display time plots [[no]]], [case "${enableval}" in yes) gnuplot=true ;; no) gnuplot=false;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-gnuplot) ;; esac],[gnuplot=false]) dnl **** use grace AC_ARG_ENABLE(grace, [ --enable-grace use grace to display tableau plots [[yes]]], [case "${enableval}" in yes) grace=true ;; no) grace=false;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-grace) ;; esac],[grace=true]) dnl **** check if user wants to compile with debugging support AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [no]], [case "${enableval}" in yes) debug=true ;; no) debug=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; esac],[debug=false]) dnl **** Possibility to override defaults if test "x$CONF_FILE" != "x" then if test -r $CONF_FILE then AC_MSG_RESULT(--> using \`$CONF_FILE' as config file) . $CONF_FILE else AC_MSG_ERROR(--> Can't open file \`$CONF_FILE' for reading!) exit 1 fi else dnl **** Define CFLAGS etc empty to prevent configure from setting them CFLAGS=${CFLAGS-""} FFLAGS=${FFLAGS-""} LDFLAGS=${LDFLAGS-""} OPTIMIZE=${OPTIMIZE-""} DEBUG=${DEBUG-""} fi dnl **** Check for host type AC_CANONICAL_HOST dnl Checks for C++ compiler AC_PROG_CXX AC_ISC_POSIX AC_AIX AC_MINIX AC_CYGWIN if test "x${CFLAGS}" = "x" then if test "x${GCC}" = "xyes" then dnl **** default settings for gcc DEBUG="-g -O2" OPTIMIZE="-O2" dnl CFLAGS="-fno-common -Wall -pedantic -Wpointer-arith -Wnested-externs" CFLAGS= dnl **** check for strength-reduce bug ACX_GCC_STRENGTH_REDUCE(CFLAGS="$CFLAGS -fno-strength-reduce") dnl **** some arch-specific optimizations/settings for gcc case "${host}" in i486-*) CPU_FLAGS="-m486";; i586-*) ACX_CHECK_CC_FLAGS(-mcpu=pentium,cpu_pentium, [CPU_FLAGS=-mcpu=pentium], [ACX_CHECK_CC_FLAGS(-mpentium,pentium, [CPU_FLAGS=-mpentium], [CPU_FLAGS=-m486])]) ;; i686-*) ACX_CHECK_CC_FLAGS(-mcpu=pentiumpro,cpu_pentiumpro, [CPU_FLAGS=-mcpu=pentiumpro], [ACX_CHECK_CC_FLAGS(-mpentiumpro,pentiumpro, [CPU_FLAGS=-mpentiumpro], [CPU_FLAGS=-m486])]) ;; mips-sgi-*) CFLAGS="$CFLAGS ";; esac CFLAGS="$CPU_FLAGS $CFLAGS" else case "${host}" in alpha*-dec-osf4.*) CFLAGS="-std1 -w0" OPTIMIZE="-O2" DEBUG="-g3 -O2" ;; hppa*-hp-hpux*) CFLAGS="-Aa -D_HPUX_SOURCE" OPTIMIZE="-O" DEBUG="-g -O" ;; mips-sgi-irix6.[[4-9]]*) CFLAGS="-w -32" OPTIMIZE="-O2 -OPT:Olimit=0" DEBUG="-g3 -O2 -OPT:Olimit=0" ;; mips-sgi-irix*) CFLAGS="-fullwarn -woff 835 -32" OPTIMIZE="-O2 -Olimit 3500" ;; rs6000-ibm-aix*) CFLAGS="-D_ALL_SOURCE" OPTIMIZE="-O2" DEBUG="-g -O2" ;; *) CFLAGS="" OPTIMIZE="-O" DEBUG="-g" ;; esac fi fi case $debug in true) CFLAGS="$DEBUG $CFLAGS";; *) CFLAGS="$OPTIMIZE $CFLAGS";; esac dnl **** Check for some compiler/system characteristics AC_C_CHAR_UNSIGNED AC_CHECK_SIZEOF(char,0) AC_CHECK_SIZEOF(short,0) AC_CHECK_SIZEOF(int,0) AC_CHECK_SIZEOF(long,0) AC_CHECK_SIZEOF(long long,0) AC_CHECK_SIZEOF(float,0) AC_CHECK_SIZEOF(double,0) AC_CHECK_SIZEOF(long double,0) AC_CHECK_SIZEOF(void *,0) dnl **** Check for endianess AC_C_BIGENDIAN dnl **** .exe/.obj file extensions AC_EXEEXT AC_OBJEXT OBJEXT=".$OBJEXT" AC_PROG_MAKE_SET AC_PROG_INSTALL case "x$INSTALL" in x/*) ;; *) INSTALL=`pwd`/ac-tools/"shtool install -c" ; esac MKINSTALLDIRS=`pwd`/ac-tools/"shtool mkdir -p -f" dnl **** Check for avifile-config AC_CHECK_PROG( has_avifile_config, avifile-config, yes, no ) if test "${has_avifile_config}" = yes then LIB_AVIFILE=`avifile-config --libs` INC_AVIFILE=`avifile-config --cflags` AC_DEFINE(HAVE_AVIFILE) HAVE_AVIFILE=1 GUI_LIBS= fi dnl **** Check for gnuplot if test "${gnuplot}" = true then AC_CHECK_PROG( have_gnuplot_exe, gnuplot, true, false ) if test "${have_gnuplot_exe}" = true then GRAPH_WIDGET=Fl_Gnuplot CFLAGS="$CFLAGS -DUSE_GNUPLOT" else GRAPH_WIDGET=Graph fi else GRAPH_WIDGET=Graph fi dnl **** Check for grace if test "${grace}" = true then AC_CHECK_PROG( have_grace_exe, xmgrace, true, false ) if test "${have_grace_exe}" = true then AC_CHECK_LIB( grace_np, GraceOpenVA ) fi fi dnl **** Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS( values.h ) dnl **** Checks for typedefs, structures, and compiler characteristics. AC_TYPE_PID_T AC_TYPE_SIZE_T AC_STRUCT_TM dnl **** Checks for library functions. AC_TYPE_SIGNAL AC_CHECK_FUNCS(strstr) AC_CHECK_FUNCS(memcpy memmove) dnl **** Check for locale AC_CHECK_FUNCS(setlocale) dnl **** Check for buggy realloc() ACX_CHECK_REALLOC(AC_DEFINE(REALLOC_IS_BUGGY)) dnl **** check for libz AC_LANG(C) AC_CHECK_LIB(z, gzprintf, , [AC_MSG_ERROR( Compatible zlib not found -- please upgrade/install )] ) dnl **** check for libungif AC_CHECK_LIB( ungif, EGifPutExtensionLast, , [AC_MSG_ERROR( Compatible libungif not found -- please upgrade )] ) dnl **** check for libpng AC_CHECK_LIB( png, png_set_IHDR, , [AC_MSG_ERROR( compatible libpng not found --- please install/upgrade )] ) dnl **** check for standard C++ library AC_CXX_HAVE_STD if test "$ac_cv_cxx_have_std" = no then AC_MSG_ERROR( C++ standard library not found ) fi dnl **** check for libfltk ACX_CHECK_FLTK if test x"$FLTK_LDFLAGS" = x then AC_MSG_ERROR( Please install the FLTK widget set library, version >= 1.1 ) fi dnl **** Final list of subdirs SUBDIRS="src utils" dnl **** Create Make.conf AC_OUTPUT(makeinclude:ac-tools/makeinclude.in)