source: git/m4/gfanlib-check.m4 @ 6015d4

spielwiese
Last change on this file since 6015d4 was 6015d4, checked in by Max Horn <max@…>, 4 years ago
autoconf: improve cddlib and polymake detection For the cddlib detection (used for gfanlib), switch to using AC_CHECK_LIB; this gives better diagnostics, and since it is "standard", is a bit easier to debug. For polymake, when checking for `polymake-config` via `AC_CHECK_PROG`, use `yes` and `no` instead of `1` and `0` as results. This let's the configure script print nicer messages ("checking for FOO... yes" vs "checking for FOO... 1")
  • Property mode set to 100644
File size: 2.0 KB
Line 
1# gfanlib.m4
2
3AC_DEFUN([SING_CHECK_GFANLIB],
4[
5
6AC_ARG_ENABLE(gfanlib,
7AS_HELP_STRING([--enable-gfanlib], [Enables gfanlib, a package for basic convex geometry]),
8[ENABLE_GFANLIB="$enableval"],
9[ENABLE_GFANLIB=""])
10
11AC_MSG_CHECKING(whether to check for gfanlib)
12PASSED_ALL_TESTS_FOR_GFANLIB="0"
13
14if test "x$ENABLE_GFANLIB" = "xno"; then
15  AC_MSG_RESULT([no])
16else
17  AC_MSG_RESULT([yes])
18
19  AC_CHECK_HEADERS([setoper.h cdd/setoper.h cddlib/setoper.h])
20
21  if test "x$ac_cv_header_setoper_h" = xno -a "x$ac_cv_header_cdd_setoper_h" = xno -a "x$ac_cv_header_cddlib_setoper_h" = xno
22  then
23    if test "x$ENABLE_GFANLIB" = "xyes"; then
24      AC_MSG_ERROR([Error, setoper.h is missing!])
25    fi
26  else
27
28    # Check whether --with-gmp was given.
29    DEFAULT_CHECKING_PATH="/usr /usr/local /sw /opt/local"
30    GMP_HOME_PATH="${DEFAULT_CHECKING_PATH}"
31    if test "$with_gmp" = yes ; then
32      GMP_HOME_PATH="${DEFAULT_CHECKING_PATH}"
33    elif test "$with_gmp" != no ; then
34      GMP_HOME_PATH="$with_gmp ${DEFAULT_CHECKING_PATH}"
35    fi
36
37    BACKUP_CFLAGS=${CFLAGS}
38    BACKUP_LIBS=${LIBS}
39
40    for GMP_HOME in ${GMP_HOME_PATH}
41    do
42      if test "x$GMP_HOME" != "x/usr"; then
43        if test -e ${GMP_HOME}/include/gmp.h; then
44          GMP_CPPFLAGS="-I${GMP_HOME}/include"
45          GMP_LIBS="-L${GMP_HOME}/lib -Wl,-rpath -Wl,${GMP_HOME}/lib -lgmp"
46        fi
47      fi
48    done
49    if test -z "${GMP_LIBS}"
50    then
51      GMP_LIBS="-lgmp"
52    fi
53
54    AC_LANG_PUSH(C++)
55    AC_CHECK_LIB([cddgmp], [dd_free_global_constants],
56       [PASSED_ALL_TESTS_FOR_GFANLIB="1"
57        CDDGMPLDFLAGS="-lcddgmp $GMP_LIBS"
58        CDDGMPCPPFLAGS="-DGMPRATIONAL"],
59       [if test "x$ENABLE_GFANLIB" = "xyes"; then
60         AC_MSG_ERROR([Error, could not use libcddgmp])
61        fi
62       ],
63       [$GMP_LIBS])
64    AC_LANG_POP()
65
66    AC_SUBST(CDDGMPCPPFLAGS)
67    AC_SUBST(CDDGMPLDFLAGS)
68  fi
69fi
70
71AM_CONDITIONAL(HAVE_GFANLIB, test "x$PASSED_ALL_TESTS_FOR_GFANLIB" = x1)
72AC_DEFINE_UNQUOTED(HAVE_GFANLIB, ${PASSED_ALL_TESTS_FOR_GFANLIB}, [whether gfanlib support is enabled])
73
74])
Note: See TracBrowser for help on using the repository browser.