diff --git a/acinclude.m4 b/acinclude.m4 index e64dfaef08..5038381e80 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -139,39 +139,44 @@ dnl `-l' flag(s). Else, straight up use lib-path and include-path. AC_DEFUN([FLINT_SET_LIBFLAGS], [tmpalias=m4_default([$4],[$1]) -if test "x$PKG_CONFIG" != "x" && test "x`$PKG_CONFIG --path $1`" != "x"; +if test "x$2" != "x"; then - if test "x$2" != "x"; - then - withpath="--with-path=$2" - else - withpath="" - fi + pkgconfigpath="PKG_CONFIG_PATH=$2/pkgconfig" +fi +if test "$enable_pkg_config" = "yes" && eval "$pkgconfigpath $PKG_CONFIG --path $1"; test "$?" = "0"; +then # libdir - tmp=`$PKG_CONFIG --variable=libdir $withpath $1` dnl ' Fix Vim syntax + tmp=`eval "$pkgconfigpath $PKG_CONFIG --variable=libdir $1"` dnl ' Fix Vim syntax eval ${tmpalias}_libdir="\${tmp}" + echo "libdir = $tmp" # includedir - tmp=`$PKG_CONFIG --variable=includedir $withpath $1` dnl ' Fix Vim syntax + tmp=`eval "$pkgconfigpath $PKG_CONFIG --variable=includedir $1"` dnl ' Fix Vim syntax eval ${tmpalias}_includedir="\${tmp}" + echo "includedir = $tmp" # LIBS - tmp=`$PKG_CONFIG --libs-only-l $withpath $1` dnl ' Fix Vim syntax + tmp=`eval "$pkgconfigpath $PKG_CONFIG --libs-only-l $1"` dnl ' Fix Vim syntax eval ${tmpalias}_LIBS="\${tmp}" + echo "LIBS = $tmp" # LDFLAGS - tmp=`$PKG_CONFIG --libs-only-L $withpath $1` dnl ' Fix Vim syntax + tmp=`eval "$pkgconfigpath $PKG_CONFIG --libs-only-L $1"` dnl ' Fix Vim syntax eval ${tmpalias}_LDFLAGS="\${tmp}" + echo "LDFLAGS = $tmp" # CPPFLAGS - tmp=`$PKG_CONFIG --cflags-only-other $withpath $1 | sed -n 's/\(-D\w\+\)\(\|=\w\+\)/\n\1\2\n/gp' | sed -n '/^-D/p'` dnl ' Fix Vim syntax - tmp="`$PKG_CONFIG --cflags-only-I $withpath $1` $tmp" dnl ' Fix Vim syntax + tmp=`eval "$pkgconfigpath $PKG_CONFIG --cflags-only-other $1" | sed -n 's/\(-D\w\+\)\(\|=\w\+\)/\n\1\2\n/gp' | sed -n '/^-D/p'` dnl ' Fix Vim syntax + tmp2=`eval "$pkgconfigpath $PKG_CONFIG --cflags-only-I $1"` dnl ' Fix Vim syntax + tmp="$tmp $tmp2" eval ${tmpalias}_CPPFLAGS="\${tmp}" + echo "CPPFLAGS = $tmp" # CFLAGS - tmp=`$PKG_CONFIG --cflags-only-other $withpath $1 | sed 's/\(-D\w\+\)\(\|=\w\+\)//g' | sed 's/ / /g'` dnl ' Fix Vim syntax + tmp=`eval "$pkgconfigpath $PKG_CONFIG --cflags-only-other $withpath $1" | sed 's/\(-D\w\+\)\(\|=\w\+\)//g' | sed 's/ / /g'` dnl ' Fix Vim syntax eval ${tmpalias}_CFLAGS="\${tmp}" + echo "CFLAGS = $tmp" else if test "x${2}" != "x"; then diff --git a/configure.ac b/configure.ac index 6402158877..29c87e1abf 100644 --- a/configure.ac +++ b/configure.ac @@ -148,20 +148,6 @@ then CXXFLAGS= fi -################################################################################ -# programs -################################################################################ - -dnl NOTE: The following line is invoked from LT_INIT -dnl AC_PROG_CC - -AC_PROG_MKDIR_P -AC_PATH_PROGS(PKG_CONFIG, [pkg-config pkgconf], []) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config or pkgconf]) - -FLINT_CC_IS_GCC -FLINT_CC_IS_CLANG - ################################################################################ # build system ################################################################################ @@ -271,6 +257,17 @@ yes|no) esac], enable_dependency_tracking="yes") +AC_ARG_ENABLE(pkg-config, +[AS_HELP_STRING([--enable-pkg-config],[Enable finding dependency information via pkg-config [default=auto]])], +[case $enableval in +yes|no) + ;; +*) + AC_MSG_ERROR([Bad value $enableval for --enable-pkg-config. Need yes or no.]) + ;; +esac], +enable_pkg_config="yes") + AC_ARG_ENABLE(pretty-tests, [AS_HELP_STRING([--enable-pretty-tests],[Enable pretty printing for tests [default=yes]])], [case $enableval in @@ -349,6 +346,28 @@ yes|no) esac], enable_fast_build="no") +################################################################################ +# programs +################################################################################ + +dnl NOTE: The following line is invoked from LT_INIT +dnl AC_PROG_CC + +AC_PROG_MKDIR_P + +if test "$enable_pkg_config" = "yes"; +then + AC_PATH_PROGS(PKG_CONFIG, [pkg-config pkgconf], []) + if test "x$PKG_CONFIG" = "x"; + then + enable_pkg_config="no" + fi +fi +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config or pkgconf]) + +FLINT_CC_IS_GCC +FLINT_CC_IS_CLANG + ################################################################################ # library dependencies ################################################################################ @@ -543,6 +562,7 @@ done ################################################################################ # FIXME: Not the prettiest solution for BLAS +# FIXME: Fix Boehm GC for lib in $library_dependencies; do