Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

better cholmod detection

  • Loading branch information...
commit 1c21ff8bc839eac61731c32646467e1b48fd26c7 1 parent 398d4c7
@laurentbartholdi authored
Showing with 43 additions and 25 deletions.
  1. +1 −1  cnf/Makefile.in
  2. +16 −12 cnf/m4/ac_check_cholmod.m4
  3. +26 −12 configure
View
2  cnf/Makefile.in
@@ -37,7 +37,7 @@ $(LOCALBIN):
mkdir -p $(LOCALBIN)
$(LOCALBIN)/layout: src/layout.C
- $(CXX) @CHOLMOD_CFLAGS@ @LIBDOGLEG_CFLAGS@ @LIBDOGLEG_LDFLAGS@ $< -o $@ @CHOLMOD_LIBS@ @LIBDOGLEG_LIBS@
+ $(CXX) @CHOLMOD_CFLAGS@ @CHOLMOD_LDFLAGS@ @LIBDOGLEG_CFLAGS@ @LIBDOGLEG_LDFLAGS@ $< -o $@ @CHOLMOD_LIBS@ @LIBDOGLEG_LIBS@
$(LOCALBIN)/hsolve: src/hsolve.C
$(CXX) @LEVMAR_CFLAGS@ @LEVMAR_LDFLAGS@ $< -o $@ @LEVMAR_LIBS@
View
28 cnf/m4/ac_check_cholmod.m4
@@ -2,13 +2,19 @@
# sets the CHOLMOD_CFLAGS, CHOLMOD_LDFLAGS and CHOLMOD_LIBS appropriately
AC_DEFUN([AC_CHECK_CHOLMOD],[
-
cm_LIBS="$LIBS"
+cm_CPPFLAGS="$CPPFLAGS"
+cm_LDFLAGS="$LDFLAGS"
+AC_LANG_PUSH([C])
+
+CHOLMOD=yes
+CHOLMOD_CFLAGS=""
+CHOLMOD_LDFLAGS=""
AC_ARG_WITH(cholmod,
[ --with-cholmod=<location>
Location at which the cholmod library, needed for layout, was installed.],
- [CHOLMOD_CFLAGS="-I$withval/include"; CHOLMODLIB="$withval/lib"]
+ [CHOLMOD_CFLAGS="-I$withval/include"; CHOLMOD_LDFLAGS="-L$withval/lib"]
)
AC_ARG_WITH(cholmod-include,
@@ -21,22 +27,17 @@ AC_ARG_WITH(cholmod-lib,
[ --with-cholmod-lib=<location>
Location at which the cholmod library files were installed.
],
- [CHOLMODLIB="$withval"]
+ [CHOLMOD_LDFLAGS="-L$withval"]
)
-AC_CHECK_HEADER(suitesparse/cholmod.h,[CHOLMOD_CFLAGS="-I/usr/include/suitesparse"])
-
-if test "$CHOLMOD_CFLAGS" != ""; then
- CPPFLAGS="$CPPFLAGS $CHOLMOD_CFLAGS"
+if test "$CHOLMOD_CFLAGS" = ""; then
+ AC_CHECK_HEADER(suitesparse/cholmod.h,[CHOLMOD_CFLAGS="-I/usr/include/suitesparse"])
fi
+CPPFLAGS="$CPPFLAGS $CHOLMOD_CFLAGS"
AC_CHECK_HEADER(cholmod.h,,AC_MSG_ERROR([cholmod.h not found. Specify its location using --with-cholmod.]))
-if test "$CHOLMODLIB" != ""; then
- LDFLAGS="$LDFLAGS -L$CHOLMODLIB"
- CHOLMOD_LDFLAGS="-L$CHOLMODLIB"
-fi
-
+LDFLAGS="$LDFLAGS $CHOLMOD_LDFLAGS"
CHOLMOD_LIBS=""
for cm_extra in -llapack -lcolamd -lsuitesparseconfig -lamd -lrt; do
@@ -51,6 +52,9 @@ fi
CHOLMOD_LIBS="-lcholmod $CHOLMOD_LIBS"
+AC_LANG_POP([C])
+CPPFLAGS="$cm_CPPFLAGS"
+LDFLAGS="$cm_LDFLAGS"
LIBS="$cm_LIBS"
AC_SUBST(CHOLMOD_CFLAGS)
AC_SUBST(CHOLMOD_LDFLAGS)
View
38 configure
@@ -16831,13 +16831,24 @@ LIBS="$lm_LIBS"
-
cm_LIBS="$LIBS"
+cm_CPPFLAGS="$CPPFLAGS"
+cm_LDFLAGS="$LDFLAGS"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+CHOLMOD=yes
+CHOLMOD_CFLAGS=""
+CHOLMOD_LDFLAGS=""
# Check whether --with-cholmod was given.
if test "${with_cholmod+set}" = set; then :
- withval=$with_cholmod; CHOLMOD_CFLAGS="-I$withval/include"; CHOLMODLIB="$withval/lib"
+ withval=$with_cholmod; CHOLMOD_CFLAGS="-I$withval/include"; CHOLMOD_LDFLAGS="-L$withval/lib"
fi
@@ -16853,22 +16864,21 @@ fi
# Check whether --with-cholmod-lib was given.
if test "${with_cholmod_lib+set}" = set; then :
- withval=$with_cholmod_lib; CHOLMODLIB="$withval"
+ withval=$with_cholmod_lib; CHOLMOD_LDFLAGS="-L$withval"
fi
-ac_fn_c_check_header_mongrel "$LINENO" "suitesparse/cholmod.h" "ac_cv_header_suitesparse_cholmod_h" "$ac_includes_default"
+if test "$CHOLMOD_CFLAGS" = ""; then
+ ac_fn_c_check_header_mongrel "$LINENO" "suitesparse/cholmod.h" "ac_cv_header_suitesparse_cholmod_h" "$ac_includes_default"
if test "x$ac_cv_header_suitesparse_cholmod_h" = xyes; then :
CHOLMOD_CFLAGS="-I/usr/include/suitesparse"
fi
-
-if test "$CHOLMOD_CFLAGS" != ""; then
- CPPFLAGS="$CPPFLAGS $CHOLMOD_CFLAGS"
fi
+CPPFLAGS="$CPPFLAGS $CHOLMOD_CFLAGS"
ac_fn_c_check_header_mongrel "$LINENO" "cholmod.h" "ac_cv_header_cholmod_h" "$ac_includes_default"
if test "x$ac_cv_header_cholmod_h" = xyes; then :
@@ -16878,11 +16888,7 @@ fi
-if test "$CHOLMODLIB" != ""; then
- LDFLAGS="$LDFLAGS -L$CHOLMODLIB"
- CHOLMOD_LDFLAGS="-L$CHOLMODLIB"
-fi
-
+LDFLAGS="$LDFLAGS $CHOLMOD_LDFLAGS"
CHOLMOD_LIBS=""
for cm_extra in -llapack -lcolamd -lsuitesparseconfig -lamd -lrt; do
@@ -16938,6 +16944,14 @@ fi
CHOLMOD_LIBS="-lcholmod $CHOLMOD_LIBS"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CPPFLAGS="$cm_CPPFLAGS"
+LDFLAGS="$cm_LDFLAGS"
LIBS="$cm_LIBS"
Please sign in to comment.
Something went wrong with that request. Please try again.