forked from homalg-project/CddInterface
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
75 lines (66 loc) · 2.07 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#
# CddInterface: Gap interface to Cdd package
#
# This file is part of the build system of a GAP kernel extension.
# Requires GNU autoconf, GNU automake and GNU libtool.
#
dnl ##
dnl ## Setup autoconf
dnl ##
AC_PREREQ([2.68])
AC_INIT([CddInterface], [package])
AC_CONFIG_SRCDIR([src/CddInterface.c])
AC_CONFIG_MACRO_DIR([m4])
m4_include([m4/find_gap.m4])
dnl ##
dnl ## Set the language
dnl ##
AC_PROG_CC
AC_LANG([C])
dnl ##
dnl ## Locate the GAP root dir
dnl ##
FIND_GAP
dnl ##
dnl ## Set cdd root dir
dnl ##
AC_ARG_WITH([cddlib],
[AS_HELP_STRING([--with-cddlib=<path>], [specify the path of cdd installation])],
[], [with_cddlib=yes])
AS_IF([test "x$with_cddlib" = "xno"], [AC_MSG_ERROR([cddlib is required and cannot be disabled])])
# if no path was given. as a special consideration, detect if the user has cddlib
# installed via Homebrew (on macOS), and if so, use that
AS_IF([test "x$with_cddlib" = "xyes"],[
AS_IF([command -v brew >/dev/null 2>&1],[
AC_MSG_NOTICE([BREW detected])
with_cddlib=$(brew --prefix)
])
])
AS_IF([test "x$with_cddlib" != "xyes"],[
# Debian and Ubuntu put the headers into PREFIX/include/cdd, while on
# e.g. homebrew the headers are in PREFIX/include/cddlib. Finally in
# some cases, the headers are directly in PREFIX/include/ -- so we
# just add all three to the CPPFLAGS
AS_IF([test -d "$with_cddlib"],[],[AC_MSG_ERROR([the cddlib path is not a directory])])
CDD_CPPFLAGS="-I$with_cddlib/include/cdd -I$with_cddlib/include/cddlib -I$with_cddlib/include"
CDD_LDFLAGS="-L$with_cddlib/lib -lcddgmp -lgmp"
],[
CDD_CPPFLAGS="-I/usr/include/cdd -I/usr/include/cddlib"
CDD_LDFLAGS="-lcddgmp -lgmp"
])
AC_SUBST(CDD_CPPFLAGS)
AC_SUBST(CDD_LDFLAGS)
dnl check that cddlib actually is usable
old_CPPFLAGS="$CPPFLAGS"
old_LDFLAGS="$LDFLAGS"
CPPFLAGS="$CPPFLAGS $CDD_CPPFLAGS"
LDFLAGS="$LDFLAGS $CDD_LDFLAGS"
AC_CHECK_HEADER([setoper.h], [], [AC_MSG_ERROR([could not use setoper.h])], [])
AC_CHECK_LIB([cddgmp],[dd_SetLinearity])
CPPFLAGS="$old_CPPFLAGS"
LDFLAGS="$old_LDFLAGS"
dnl ##
dnl ## Output everything
dnl ##
AC_CONFIG_FILES([Makefile])
AC_OUTPUT