X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=configure.ac;h=e49d712e123b34e6f05f19f76a6875e9175fed5f;hb=c5a002b518cfc72c60960a740bf4c443aba27ca3;hp=8c9e208958f1e0de16fa4fe849f5cec30242284d;hpb=f719cf8faf20897df40be9e54aa88d1433c92e0e;p=platform%2Fupstream%2Fisl.git diff --git a/configure.ac b/configure.ac index 8c9e208..e49d712 100644 --- a/configure.ac +++ b/configure.ac @@ -1,143 +1,117 @@ -AC_INIT -AM_INIT_AUTOMAKE(isl, 0.00) +AC_INIT([isl], [0.12], [isl-development@googlegroups.com]) +AC_CONFIG_AUX_DIR([.]) +AC_CONFIG_MACRO_DIR([m4]) +AM_INIT_AUTOMAKE([foreign]) +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) +AC_SUBST(versioninfo) +versioninfo=12:0:2 + +if test "x$prefix" != "xNONE"; then + prefix_wd=`cd $prefix && pwd` + srcdir_wd=`cd $srcdir && pwd` + wd=`pwd` + if test "x$prefix_wd" = "x$srcdir_wd"; then + AC_MSG_ERROR(Installation in source directory not supported) + fi + if test "x$prefix_wd" = "x$wd"; then + AC_MSG_ERROR(Installation in build directory not supported) + fi +fi AC_PROG_CC +AC_PROG_CXX + +AX_CC_MAXOPT +AX_GCC_WARN_UNUSED_RESULT +AX_C___ATTRIBUTE__ AC_PROG_LIBTOOL -AX_CREATE_STDINT_H(include/isl_stdint.h) +AC_CHECK_PROG(PERL, perl, perl, []) +AC_CHECK_PROG(PDFLATEX, pdflatex, pdflatex, []) +AC_CHECK_PROG(POD2HTML, pod2html, pod2html, []) + +AM_CONDITIONAL(GENERATE_DOC, test -n "$PERL" -a -n "$PDFLATEX" -a -n "$POD2HTML") -AC_ARG_WITH(gmp_prefix, - [AS_HELP_STRING([--with-gmp-prefix=DIR], - [Location of GMP installation])]) +AX_CREATE_STDINT_H(include/isl/stdint.h) + +AX_SUBMODULE(gmp,system|build,system) AC_SUBST(GMP_CPPFLAGS) AC_SUBST(GMP_LDFLAGS) -if test "x$with_gmp_prefix" != "x"; then - isl_configure_args="$isl_configure_args --with-gmp=$with_gmp_prefix" - GMP_CPPFLAGS="-I$with_gmp_prefix/include" - GMP_LDFLAGS="-L$with_gmp_prefix/lib" -fi - -AC_DEFUN([ISL_SUBMODULE],[ - AC_ARG_WITH($1_prefix, - [AS_HELP_STRING([--with-$1-prefix=DIR], - [Location of system $1])]) - AC_ARG_WITH($1_builddir, - [AS_HELP_STRING([--with-$1-builddir=DIR], - [Location of $1 builddir])]) - if test "x$with_$1_prefix" != "x"; then - if test "x$with_$1" != "x" -a "x$with_$1" != "xsystem"; then - AC_MSG_ERROR([Setting $with_$1_prefix implies use of system $1]) - fi - with_$1="system" - fi - if test "x$with_$1_builddir" != "x"; then - if test "x$with_$1" != "x" -a "x$with_$1" != "xbuild"; then - AC_MSG_ERROR([Setting $with_$1_builddir implies use of build $1]) - fi - with_$1="build" - $1_srcdir=`echo @abs_srcdir@ | $with_$1_builddir/config.status --file=-` - AC_MSG_NOTICE($1 sources in $$1_srcdir) +AC_SUBST(GMP_LIBS) +case "$with_gmp" in +system) + if test "x$with_gmp_prefix" != "x"; then + isl_configure_args="$isl_configure_args --with-gmp=$with_gmp_prefix" + GMP_CPPFLAGS="-I$with_gmp_prefix/include" + GMP_LDFLAGS="-L$with_gmp_prefix/lib" fi - case "$with_$1" in - no|bundled|system|build) - ;; - *) - if test -d $srcdir/.git -a \ - -d $srcdir/$1 -a \ - ! -d $srcdir/$1/.git; then - AC_MSG_WARN( -[git repo detected, but submodule $1 not initialized]) - AC_MSG_WARN([You may want to run]) - AC_MSG_WARN([ git submodule init]) - AC_MSG_WARN([ git submodule update]) - AC_MSG_WARN([ sh autogen.sh]) - fi - if test -f $srcdir/$1/configure; then - with_$1="bundled" - fi - ;; - esac -]) - -AC_ARG_WITH(polylib, - [AS_HELP_STRING([--with-polylib=build|system|no], - [Which PolyLib to use])]) -ISL_SUBMODULE(polylib) -if test "x$with_polylib" = "x"; then - with_polylib="no" -fi -AC_MSG_CHECKING([which polylib to use]) -AC_MSG_RESULT($with_polylib) - -have_polylib=false -AC_SUBST(POLYLIB_CPPFLAGS) -AC_SUBST(POLYLIB_LDFLAGS) -AC_SUBST(POLYLIB_LIBS) -case "$with_polylib" in - build) - polylibs=`echo @polylibs@ | $with_polylib_builddir/config.status --file=-` - AC_MSG_NOTICE(Configured polylibs: $polylibs) - isl_cv_polylib=missing - for bits in $polylibs; do - if test "$bits" = "libpolylibgmp.la"; then - isl_cv_polylib=ok - fi - done - if test "$isl_cv_polylib" = "missing"; then - AC_MSG_ERROR(no gmp polylib configured) - fi - POLYLIB_CPPFLAGS="-I$with_polylib_builddir/include -I$polylib_srcdir/include" - POLYLIB_LIBS="$with_polylib_builddir/libpolylibgmp.la" - ;; - system) - POLYLIB_LIBS="-lpolylibgmp" - if test "x$with_polylib_prefix" != "x"; then - POLYLIB_CPPFLAGS="-I$with_polylib_prefix/include" - POLYLIB_LDFLAGS="-L$with_polylib_prefix/lib" - fi - SAVE_CPPFLAGS="$CPPFLAGS" - SAVE_LDFLAGS="$LDFLAGS" - CPPFLAGS="$POLYLIB_CPPFLAGS $CPPFLAGS" - LDFLAGS="$POLYLIB_LDFLAGS $LDFLAGS" - AC_CHECK_LIB(polylibgmp, PolyhedronTSort,[ true ],[ - AC_MSG_ERROR(Need polylib) - ]) - CPPFLAGS="$SAVE_CPPFLAGS" - LDFLAGS="$SAVE_LDFLAGS" - ;; - no) + GMP_LIBS=-lgmp + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + SAVE_LIBS="$LIBS" + CPPFLAGS="$GMP_CPPFLAGS $CPPFLAGS" + LDFLAGS="$GMP_LDFLAGS $LDFLAGS" + LIBS="$GMP_LIBS $LIBS" + AC_CHECK_HEADER([gmp.h], [], [AC_ERROR([gmp.h header not found])]) + AC_CHECK_LIB([gmp], [main], [], [AC_ERROR([gmp library not found])]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ + mpz_t n, d; + if (mpz_divisible_p(n, d)) + mpz_divexact_ui(n, n, 4); + ]])], [], [AC_ERROR([gmp library too old])]) + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + LIBS="$SAVE_LIBS" ;; - *) - AC_MSG_ERROR(unsupported) +build) + GMP_CPPFLAGS="-I$gmp_srcdir -I$with_gmp_builddir" + GMP_LIBS="$with_gmp_builddir/libgmp.la" ;; esac -if test "$with_polylib" != "no"; then - AC_DEFINE(ISL_POLYLIB,,polylib is available) - have_polylib=true -fi -AM_CONDITIONAL(HAVE_POLYLIB, test x$have_polylib = xtrue) - -AC_ARG_WITH(piplib, - [AS_HELP_STRING([--with-piplib=build|bundled|system|no], - [Which piplib to use])]) -ISL_SUBMODULE(piplib) -if test "x$with_piplib" = "x"; then - with_piplib="system" +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" +SAVE_LIBS="$LIBS" +CPPFLAGS="$GMP_CPPFLAGS $CPPFLAGS" +LDFLAGS="$GMP_LDFLAGS $LDFLAGS" +LIBS="$GMP_LIBS $LIBS" +need_get_memory_functions=false +AC_CHECK_DECLS(mp_get_memory_functions,[],[ + need_get_memory_functions=true +],[#include ]) +AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ + mpz_t x,y,g,a,b; + mpz_init(x); + mpz_init(y); + mpz_init(g); + mpz_init(a); + mpz_init(b); + mpz_set_si(x, -1); + mpz_set_si(y, 9); + mpz_gcdext(g, a, b, x, y); + if (mpz_get_si(a) == -1 && mpz_get_si(b) == 0) + return 0; + else + return 1; +]])], [need_normalized_gcdext=false], [need_normalized_gcdext=true], +[need_normalized_gcdext=true]) +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" +LIBS="$SAVE_LIBS" +AM_CONDITIONAL(NEED_GET_MEMORY_FUNCTIONS, test x$need_get_memory_functions = xtrue) +if test $need_normalized_gcdext = true; then +AC_DEFINE([GMP_NORMALIZE_GCDEXT], [], + [result of mpz_gcdext needs to be normalized]) fi -AC_MSG_CHECKING([which piplib to use]) -AC_MSG_RESULT($with_piplib) + +AX_SUBMODULE(piplib,no|system|build,no) have_piplib=false AC_SUBST(PIPLIB_CPPFLAGS) AC_SUBST(PIPLIB_LDFLAGS) AC_SUBST(PIPLIB_LIBS) case "$with_piplib" in - bundled) - PIPLIB_CPPFLAGS="-I$srcdir/piplib/include" - isl_configure_args="$isl_configure_args --enable-mp-version" - ;; build) PIPLIB_CPPFLAGS="-I$piplib_srcdir/include" PIPLIB_LIBS="$with_piplib_builddir/libpiplibMP.la" @@ -173,17 +147,129 @@ if test "$with_piplib" != "no"; then have_piplib=true fi AM_CONDITIONAL(HAVE_PIPLIB, test x$have_piplib = xtrue) -AM_CONDITIONAL(BUNDLED_PIPLIB, test $with_piplib = bundled) -AC_CONFIG_HEADERS(config.h) -AC_CONFIG_HEADERS(include/isl_ctx.h) +AC_SUBST(CLANG_CXXFLAGS) +AC_SUBST(CLANG_LDFLAGS) +AC_SUBST(CLANG_LIBS) +AX_SUBMODULE(clang,system|no,no) +case "$with_clang" in +system) + llvm_config="llvm-config" + AC_CHECK_PROG([llvm_config_found], ["$llvm_config"], [yes]) + if test "x$with_clang_prefix" != "x"; then + llvm_config="$with_clang_prefix/bin/llvm-config" + if test -x "$llvm_config"; then + llvm_config_found=yes + fi + fi + if test "$llvm_config_found" != yes; then + AC_MSG_ERROR([llvm-config not found]) + fi + CLANG_CXXFLAGS=`$llvm_config --cxxflags` + CLANG_LDFLAGS=`$llvm_config --ldflags` + targets=`$llvm_config --targets-built` + CLANG_LIBS=`$llvm_config --libs $targets asmparser bitreader support mc` + CLANG_PREFIX=`$llvm_config --prefix` + AC_DEFINE_UNQUOTED(CLANG_PREFIX, ["$CLANG_PREFIX"], + [Clang installation prefix]) + + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CLANG_CXXFLAGS $CPPFLAGS" + AC_LANG_PUSH(C++) + AC_CHECK_HEADER([clang/Basic/SourceLocation.h], [], + [AC_ERROR([clang header file not found])]) + AC_EGREP_HEADER([getDefaultTargetTriple], [llvm/Support/Host.h], [], + [AC_DEFINE([getDefaultTargetTriple], [getHostTriple], + [Define to getHostTriple for older versions of clang])]) + AC_EGREP_HEADER([getExpansionLineNumber], + [clang/Basic/SourceLocation.h], [], + [AC_DEFINE([getExpansionLineNumber], + [getInstantiationLineNumber], + [Define to getInstantiationLineNumber for older versions of clang])]) + AC_EGREP_HEADER([DiagnosticsEngine], + [clang/Basic/Diagnostic.h], [], + [AC_DEFINE([DiagnosticsEngine], + [Diagnostic], + [Define to Diagnostic for older versions of clang])]) + AC_EGREP_HEADER([ArrayRef], [clang/Driver/Driver.h], + [AC_DEFINE([USE_ARRAYREF], [], + [Define if Driver::BuildCompilation takes ArrayRef])]) + AC_EGREP_HEADER([CXXIsProduction], [clang/Driver/Driver.h], + [AC_DEFINE([HAVE_CXXISPRODUCTION], [], + [Define if Driver constructor takes CXXIsProduction argument])]) + AC_EGREP_HEADER([ IsProduction], [clang/Driver/Driver.h], + [AC_DEFINE([HAVE_ISPRODUCTION], [], + [Define if Driver constructor takes IsProduction argument])]) + AC_EGREP_HEADER([void HandleTopLevelDecl\(], [clang/AST/ASTConsumer.h], + [AC_DEFINE([HandleTopLevelDeclReturn], [void], + [Return type of HandleTopLevelDeclReturn]) + AC_DEFINE([HandleTopLevelDeclContinue], [], + [Return type of HandleTopLevelDeclReturn])], + [AC_DEFINE([HandleTopLevelDeclReturn], [bool], + [Return type of HandleTopLevelDeclReturn]) + AC_DEFINE([HandleTopLevelDeclContinue], [true], + [Return type of HandleTopLevelDeclReturn])]) + AC_CHECK_HEADER([clang/Basic/DiagnosticOptions.h], + [AC_DEFINE([HAVE_BASIC_DIAGNOSTICOPTIONS_H], [], + [Define if clang/Basic/DiagnosticOptions.h exists])]) + AC_TRY_COMPILE([#include ], [ + using namespace clang; + TargetOptions *TO; + DiagnosticsEngine *Diags; + TargetInfo::CreateTargetInfo(*Diags, TO); + ], [AC_DEFINE([CREATETARGETINFO_TAKES_POINTER], [], + [Define if TargetInfo::CreateTargetInfo takes pointer])]) + AC_TRY_COMPILE([#include ], [ + using namespace clang; + DiagnosticConsumer *client; + CompilerInstance *Clang; + Clang->createDiagnostics(client); + ], [], [AC_DEFINE([CREATEDIAGNOSTICS_TAKES_ARG], [], + [Define if CompilerInstance::createDiagnostics takes argc and argv])]) + AC_TRY_COMPILE([#include ], [ + using namespace clang; + HeaderSearchOptions HSO; + HSO.AddPath("", frontend::Angled, false, false); + ], [AC_DEFINE([ADDPATH_TAKES_4_ARGUMENTS], [], + [Define if HeaderSearchOptions::AddPath takes 4 arguments])]) + AC_LANG_POP + CPPFLAGS="$SAVE_CPPFLAGS" + + SAVE_LDFLAGS="$LDFLAGS" + LDFLAGS="$CLANG_LDFLAGS $LDFLAGS" + AC_SUBST(LIB_CLANG_EDIT) + AC_CHECK_LIB([clangEdit], [main], [LIB_CLANG_EDIT=-lclangEdit], []) + LDFLAGS="$SAVE_LDFLAGS" + ;; +esac +AM_CONDITIONAL(HAVE_CLANG, test $with_clang = system) + +AX_SET_WARNING_FLAGS + +AC_SUBST(WARNING_FLAGS) + +PACKAGE_CFLAGS="$GMP_CPPFLAGS" +PACKAGE_LDFLAGS="$GMP_LDFLAGS" +PACKAGE_LIBS="-lisl -lgmp" +AX_CREATE_PKGCONFIG_INFO + +AX_DETECT_GIT_HEAD +echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > gitversion.h + +AH_BOTTOM([#include ]) +AC_CONFIG_HEADERS(isl_config.h) +AC_CONFIG_HEADERS(include/isl/config.h) AC_CONFIG_FILES(Makefile) -if test $with_piplib = bundled; then - AC_CONFIG_SUBDIRS(piplib) +AC_CONFIG_FILES(doc/Makefile) +if test $with_clang = system; then + AC_CONFIG_FILES(interface/Makefile) fi +AC_CONFIG_FILES([bound_test.sh], [chmod +x bound_test.sh]) +AC_CONFIG_FILES([codegen_test.sh], [chmod +x codegen_test.sh]) +AC_CONFIG_FILES([pip_test.sh], [chmod +x pip_test.sh]) AC_CONFIG_COMMANDS_POST([ dnl pass on arguments to subdir configures, but don't - ac_configure_args="$ac_configure_args $isl_configure_args" + dnl add them to config.status ac_configure_args="$ac_configure_args $isl_configure_args" ]) AC_OUTPUT