-dnl Process this file with autoconf to produce a configure script.
-dnl Copyright (c) 2001 IPD, Universität Karlsruhe (TH)
+dnl
+dnl Project: libFIRM
+dnl File name: configure.in
+dnl Purpose:
+dnl Author: Till Riedel (??)
+dnl Modified by:
+dnl Created:
+dnl CVS-ID: $Id$
+dnl Copyright: (c) 2002-2003 Universität Karlsruhe
+dnl Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+dnl
-dnl libFIRM Project
-dnl $Id$
AC_REVISION($Id$)
-
-AC_INIT(ir/ir/ircons.c)
+AC_INIT(libfirm,1.3.0)
+AC_PREREQ(2.50)
dnl if other files should be generated just add them to ac_output_files
-ac_output_file="Makefile MakeRules ir/.dummy ir/adt/Makefile ir/debug/Makefile \
+ac_output_file="Makefile MakeRules ir/Makefile ir/adt/Makefile ir/debug/Makefile \
ir/tv/Makefile ir/common/Makefile ir/ident/Makefile ir/ir/Makefile \
- ir/tr/Makefile testprograms/Makefile"
+ ir/ana/Makefile ir/tr/Makefile ir/ana2/Makefile ir/stat/Makefile \
+ ir/opt/Makefile ir/external/Makefile ir/config/Makefile \
+ ir/arch/Makefile ir/lower/Makefile \
+ testprograms/Makefile firmjni/Makefile firmjni/testprograms/Makefile \
+ libfirm.doxygen"
dnl generate the config header file
AC_CONFIG_HEADER(config.h)
libfirm_conf_env="${CC+CC='$CC'} ${CFLAGS+CFLAGS='$CFLAGS'} ${CPP+CPP='$CPP'} ${CPPFLAGS+CPPFLAGS='$CPPFLAGS'} ${LDFLAGS+LDFLAGS='$LDFLAGS'} ${LIBS+LIBS='$LIBS'}"
AC_SUBST(libfirm_conf_env)
+dnl where is the configure file
+CONF_DIR_NAME=`dirname $0`
dnl Package options
dnl ===============
-dnl set debugging
+dnl enabled external libFirm plugins
+dnl -------------
+AC_MSG_CHECKING([for external libfirm plugins])
+AC_ARG_WITH(plugins,
+[ --with-plugins=list include external libfirm plugins list (space separated)],
+[
+ plugin_subdirs=$withval
+ plugin_files=
+ for i in $withval ; do
+ plugin_files="$i/Makefile $plugin_files"
+ done
+ ac_output_file="$ac_output_file $plugin_files"
+],
+[
+ plugin_files=
+ plugin_subdirs=
+])
+AC_SUBST(plugin_subdirs)
+if test "$plugin_subdirs" == ""; then
+ AC_MSG_RESULT([disabled])
+else
+ AC_MSG_RESULT([$plugin_subdirs])
+fi
+
+dnl check for additional include dirs
+AC_ARG_WITH(includedir, [ --with-includedir=add colon seperated list of directories to include search path],
+ CPPFLAGS=$CPPFLAGS" -I"`echo $withval|sed 's;\:; -I;g'`)
+
+dnl check for additional library dirs
+AC_ARG_WITH(libdir, [ --with-libdir=add colon seperated list of directories to linker search path],
+ LDFLAGS=$LDFLAGS" -L"`echo $withval|sed 's;\:; -L;g'`)
+dnl check for libxml2 library installation dir
+dnl AC_ARG_WITH(libxml2, [ --with-libxml2=prefix installation prefix of libxml2 (IPD: --with-libxml2=/usr/public/libxml2)],
+dnl LDFLAGS=$LDFLAGS" -L"$withval"/lib";
+dnl CPPFLAGS=$CPPFLAGS" -I"$withval"/include/libxml2")
+
+dnl check for libxml2 library installation dir
+AC_CHECK_PROG(XML2CONFIG, xml2-config, "xml2-config", "echo")
+if test "$XML2CONFIG" != "xml2-config"; then
+ AC_MSG_ERROR(xml2-config for detecting libxml2 not found)
+fi
+AC_SUBST(XML2CONFIG)
+LDFLAGS=$LDFLAGS" -L/usr/lib `$XML2CONFIG --libs`";
+CPPFLAGS=$CPPFLAGS" `$XML2CONFIG --cflags`";
+
+dnl set debugging
+dnl -------------
AC_ARG_ENABLE(debug,
[ --enable-debug enable assertions and additional debugging routines],
[if test "$enableval" = yes; then
fi])
AC_SUBST(enable_debug_libfirm)
+dnl disable inlining
+dnl ----------------
+AC_ARG_ENABLE(inlining,
+[ --disable-inlining disable inline C-extension],
+[if test "$enableval" = yes; then
+ AC_DEFINE(USE_INLINING)
+fi],
+AC_DEFINE(USE_INLINING)
+)
dnl set profiling
-
+dnl -------------
AC_ARG_ENABLE(profile,
[ --enable-profile enable profiling],
[if test "$enableval"=yes; then
[enable_profile_libfirm=no])
AC_SUBST(enable_profile_libfirm)
+dnl set auto documentation
+dnl ----------------------
+AC_ARG_ENABLE(autodoc,
+[ --enable-autodoc enable auto documentation],
+[if test "$enableval"=yes; then
+ enable_auto_documentation=yes
+fi],
+[enable_auto_documentation=no])
+AC_SUBST(enable_auto_documentation)
+
+
+dnl set firm jni
+dnl ------------
+AC_ARG_ENABLE(firmjni,
+[ --enable-firmjni check for tools necesarry to construct a java native interface for Firm],
+[if test "$enableval"=yes; then
+ enable_firm_jni=yes
+fi],
+[enable_firm_jni=no])
+AC_SUBST(enable_firm_jni)
+
+dnl set heap analyses support
+dnl -------------------------
+AC_MSG_CHECKING([for heapanalysis])
+AC_ARG_ENABLE(heapanalysis, [ --enable-heapanalysis Compile with heap analysis.],
+ [enable_heapanalysis=$enableval], [enable_heapanalysis="no"])
+if test "$enable_heapanalysis" = "no"; then
+ AC_MSG_RESULT([disabled])
+else
+ AC_DEFINE(DO_HEAPANALYSIS)
+ AC_MSG_RESULT([enabled])
+fi
+AC_SUBST(enable_heapanalysis)
+
+dnl disable linking of libiberty parts (xmalloc, xprintf, obstack, ...)
+dnl ----------------------
+AC_ARG_ENABLE(libiberty,
+[ --disable-libiberty disable own libiberty parts],
+[if test "$enableval"=yes; then
+ disable_libiberty=yes
+fi],
+[disable_libiberty=no])
+AC_SUBST(disable_libiberty)
+
+dnl enable Firm hooks
+dnl -------------
+AC_ARG_ENABLE(hooks,
+[ --disable-hooks disable Firm hooks],
+[if test "$enableval" = yes; then
+ AC_DEFINE(FIRM_ENABLE_HOOKS)
+fi],
+AC_DEFINE(FIRM_ENABLE_HOOKS)
+)
+
+dnl enable Firm inplace edges
+dnl -------------
+AC_ARG_ENABLE(inplace_edges,
+[ --disable-inplace-edges disable Firm inplace edges],
+[if test "$enableval" = yes; then
+ AC_DEFINE(FIRM_EDGES_INPLACE)
+fi],
+AC_DEFINE(FIRM_EDGES_INPLACE)
+)
+
+dnl enable Firm statistics
+dnl -------------
+AC_ARG_ENABLE(statistics,
+[ --enable-statistics enable Firm statistics],
+[if test "$enableval"=yes; then
+ AC_DEFINE(FIRM_STATISTICS)
+fi])
+AC_SUBST(enable_statistics)
+
+dnl enable libcore debugging support
+dnl --------------------------------
+AC_ARG_ENABLE(libcore,
+[ --enable-libcore enable libcore debugging],
+[if test "$enableval"=yes; then
+ AC_DEFINE(WITH_LIBCORE)
+fi])
+AC_SUBST(enable_libcore)
+
+dnl enable ILP solver support
+dnl --------------------------------
+AC_ARG_ENABLE(ilp,
+[ --enable-ilp enable ilp solver],
+[if test "$enableval"=yes; then
+ AC_DEFINE(WITH_ILP)
+fi])
+AC_SUBST(enable_ilp)
+
+
+dnl enable wchar_t support for identifiers
+dnl --------------------------------
+AC_ARG_ENABLE(wchar_support,
+[ --enable-wchar-support enable wchar_t support for identifiers (needed for java)],
+[if test "$enableval"=yes; then
+ AC_DEFINE(FIRM_ENABLE_WCHAR)
+fi])
+AC_SUBST(enable_wchar_support)
+
+
+dnl disable external effects in XML
+dnl -------------------------------
+AC_MSG_CHECKING([for using external effects in xml2])
+AC_ARG_ENABLE(external-effects,
+[ --disable-external-effects disable descriptions of external effects in XML],
+[if test "$enableval"="no"; then
+ enable_external_effects=no
+fi],
+[enable_external_effects=yes])
+AC_SUBST(enable_external_effects)
+if test "$enable_external_effects" == no; then
+ AC_MSG_RESULT([disabled])
+else
+ AC_MSG_RESULT([enabled])
+fi
+dnl check for header and library below
dnl Checks for programs.
dnl ====================
-dnl check for a compiler
-
+dnl check for a C compiler
+dnl ----------------------
AC_PROG_CC
-dnl check for prelinkable linker
+dnl check for awk
+dnl -------------
+AC_PROG_AWK
+dnl check for prelinkable linker
+dnl ----------------------------
LIBFIRM_PROG_LD_R
if test "$libfirm_cv_prog_ld_r" != "yes"; then
AC_MSG_ERROR(need a prelinkcapable linker)
fi
dnl check for ar
-
+dnl ------------
AC_CHECK_PROG(AR, ar, "ar", "")
if test "$AR" != "ar"; then
AC_MSG_ERROR(need ar for creating archives)
fi
-dnl check wether ar can handle option -s
+dnl check for tar
+dnl -------------
+AC_CHECK_PROG(TAR, tar, "tar", "")
+if test "$TAR" != "tar"; then
+ AC_MSG_ERROR(need tar for creating archives in distribution)
+fi
+
+dnl check whether ar can handle option -s
dnl if not then ranlib is needed
dnl for simpliticity we use ranlib every time
AC_PROG_INSTALL
+touch tmp-install.a tmp-install.b
+if eval "$INSTALL tmp-install.a tmp-install.b" ; then
+ INSTALL="$INSTALL"
+fi
+rm tmp-install.a tmp-install.b
+
+
+AC_PROG_LN_S
+
+dnl check for doxygen if enabled
+dnl ----------------------------
+if test "$enable_auto_documentation" = yes; then
+ AC_CHECK_PROG(DOXYGEN, doxygen, "doxygen", "")
+ if test "$DOXYGEN" != "doxygen"; then
+ AC_MSG_ERROR(need doxygen for auto documentation)
+ fi
+ AC_CHECK_PROG(DOT, dot, "dot", "")
+ if test "$DOT" != "dot"; then
+ AC_MSG_ERROR(need dot for doxygen documentation (for class graphs) (IPD: module add Graphviz))
+ fi
+fi
+
+dnl check for availability of a jdk
+dnl -------------------------------
+if test "$enable_firm_jni" = yes; then
+ AC_CHECK_PROG(JAVAC, javac, "javac", "")
+ if test "$JAVAC" != "javac"; then
+ AC_MSG_ERROR(need java compiler javac to generate jni (IPD: module add jdk-1.3.1-sun))
+ fi
+ AC_CHECK_PROG(JAVAH, javah, "javah", "")
+ if test "$JAVAH" != "javah"; then
+ AC_MSG_ERROR(need javah to generate jni headers (IPD: module add jdk-1.3.1-sun))
+ fi
+fi
+
+
dnl Checks for header files.
dnl ========================
AC_HEADER_STDC
-dnl check for the gnu multiprecission (gmp) header file
+dnl check for the math header file
+
+AC_CHECK_HEADERS(math.h, ac_math_headers="yes", ac_math_headers="no")
+if test "$ac_math_headers" != yes; then
+ dnl math header not found.
+ AC_MSG_ERROR("math header file not found")
+fi
+
+
+#dnl check for the gnu multiprecission (gmp) header file
-AC_CHECK_HEADERS(gmp.h, ac_gmp_headers="yes", ac_gmp_headers="no")
-if test "$ac_gmp_headers" != yes; then
- dnl gmp header not found.
- AC_MSG_ERROR("GNU multiprecission gmp header file not found")
+#AC_CHECK_HEADERS(gmp.h, ac_gmp_headers="yes", ac_gmp_headers="no")
+#if test "$ac_gmp_headers" != yes; then
+# dnl gmp header not found.
+# AC_MSG_ERROR("GNU multiprecission gmp header file not found")
+#fi
+
+
+dnl check for the obstack header file
+dnl does not work with:
+dnl - cygwin
+dnl - MacOSX
+#AC_FUNC_OBSTACK
+
+AC_CHECK_HEADERS(obstack.h, ac_obstack_headers="yes", ac_obstack_headers="no")
+if test "$ac_obstack_headers" != yes; then
+ dnl obstack header not found.
+ AC_MSG_ERROR("obstack.h not found")
+fi
+
+
+AC_CHECK_HEADERS(alloca.h, ac_alloca_headers="yes", ac_alloca_headers="no")
+if test "$ac_alloca_headers" = "yes"; then
+ AC_DEFINE(HAVE_ALLOCA_H)
+else
+ if test "$ac_cv_header_stdc" = "no"; then
+ AC_MSG_ERROR("alloca.h and stdlib.h not found")
+ fi
+fi
+
+
+dnl check for jni header files
+
+if test "$enable_firm_jni" = yes; then
+ AC_CHECK_HEADERS(jni.h, ac_jni_headers="yes", ac_jni_headers="no")
+ if test "$ac_jni_headers" != yes; then
+ AC_MSG_ERROR(jni header file not found. (IPD: add --with-includedir=/usr/public2/java/jdk1.3.1-sun/include/:/usr/public2/java/jdk1.3.1-sun/include/linux/ to configure flags))
+ fi
fi
+if test "$enable_external_effects" == "yes"; then
+ AC_CHECK_HEADERS(libxml/parser.h, ac_xml_headers="yes", ac_xml_headers="no")
+ if test "$ac_xml_headers" != yes; then
+ AC_MSG_ERROR(xml header files not found. (IPD: add --with-includedir=/usr/public/libxml2/include/libxml2/ to configure flags))
+ fi
+fi
+
dnl Checks for libraries.
dnl =====================
-dnl check for the gnu multiprecission (gmp) library
+#dnl check for the gnu multiprecission (gmp) library
+
+#AC_CHECK_LIB(gmp, main, ac_gmp_library="yes", ac_gmp_library="no")
+#if test "$ac_gmp_library" != yes; then
+# dnl gmp library not found.
+# AC_MSG_ERROR("GNU multiprecission gmp library not found")
+#fi
-AC_CHECK_LIB(gmp, main, ac_gmp_library="yes", ac_gmp_library="no")
-if test "$ac_gmp_library" != yes; then
- dnl gmp library not found.
- echo $ac_gmp_library
- AC_MSG_ERROR("GNU multiprecission gmp library not found")
+
+AC_CHECK_LIB(m, main, ac_m_library="yes", ac_m_library="no")
+if test "$ac_m_library" != yes; then
+ dnl std math library not found.
+ AC_MSG_ERROR("standard math library not found")
fi
+if test "$enable_external_effects" == "yes"; then
+ AC_CHECK_LIB(xml2, xmlParseFile, ac_xml_library="yes", ac_xml_library="no")
+ if test "$ac_m_library" != yes; then
+ AC_MSG_ERROR("xml2 library not found (IPD: add --with-libdir=/usr/public/libxml2/lib/ to configure flags)")
+ else
+ LIBS=$LIBS" -lxml2"
+ fi
+fi
+
dnl Checks for typedefs, structures, and compiler characteristics.
dnl ==============================================================
-
+AC_C_CONST
+AC_C_VOLATILE
+AC_C_INLINE
+AC_C_BIGENDIAN(,,,)
+AC_C_LONG_DOUBLE
dnl Checks for library functions.
dnl =============================
+dnl check for strerror
+
+AC_CHECK_FUNC(strerror,,
+ AC_MSG_ERROR("need strerror function")
+)
+
dnl Error messaging
dnl ===============
AC_OUTPUT($ac_output_file,[ touch stamp-h ])
+
+dnl snip the lower part of config.h and put it to ir/config/firm_config.h
+$AWK -f $CONF_DIR_NAME/filter.awk < config.h | sed -f $CONF_DIR_NAME/filter.sed > ir/config/firm_config.h