Skip to content

Commit

Permalink
Add option to opt out of pkg-config during configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
albinahlback committed Oct 21, 2024
1 parent bec9543 commit b12f8dd
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 28 deletions.
33 changes: 19 additions & 14 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
48 changes: 34 additions & 14 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
################################################################################
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
################################################################################
Expand Down Expand Up @@ -543,6 +562,7 @@ done
################################################################################

# FIXME: Not the prettiest solution for BLAS
# FIXME: Fix Boehm GC

for lib in $library_dependencies;
do
Expand Down

0 comments on commit b12f8dd

Please sign in to comment.