File: ax_check_eigen.m4

package info (click to toggle)
cufflinks 2.2.1+dfsg.1-4
  • links: PTS, VCS
  • area: non-free
  • in suites: bullseye, sid
  • size: 4,268 kB
  • sloc: cpp: 57,165; ansic: 12,297; python: 517; makefile: 240; sh: 59
file content (94 lines) | stat: -rw-r--r-- 2,119 bytes parent folder | download | duplicates (4)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# SYNOPSIS
#
#   AX_EIGEN
#
# DESCRIPTION
#
#   Test for the EIGEN libraries of a particular version (or newer)
#
#   If no path to the installed eigen library is given the macro searchs
#   under /usr, /usr/local, /opt and /opt/local and evaluates the
#   $EIGEN_ROOT environment variable. 
#	Adapted from AX_BOOST_BASE
#
#   This macro calls:
#
#     AC_SUBST(EIGEN_CPPFLAGS) / AC_SUBST(EIGEN_LDFLAGS)
#
#   And sets:
#
#     HAVE_EIGEN
#
# LICENSE
#
#   Copyright (c) 2010 Cole Trapnell <cole@cs.umd.edu>
#
#   Copying and distribution of this file, with or without modification, are
#   permitted in any medium without royalty provided the copyright notice
#   and this notice are preserved.

AC_DEFUN([AX_EIGEN],
[
AC_ARG_WITH([eigen],
AS_HELP_STRING([--with-eigen@<:@=DIR@:>@], [use EIGEN libraries (default is yes) - it is possible to specify the root directory for EIGEN (optional)]),
[
if test "$withval" = "no"; then
want_eigen="no"
elif test "$withval" = "yes"; then
want_eigen="yes"
ac_eigen_path=""
else
want_eigen="yes"
ac_eigen_path="$withval"
fi
],
[want_eigen="yes"])

if test "x$want_eigen" = "xyes"; then
AC_MSG_CHECKING(for eigenlib)
succeeded=no

dnl first we check the system location for eigen libraries
if test "$ac_eigen_path" != ""; then
EIGEN_CPPFLAGS="-I$ac_eigen_path/include"
else
for ac_eigen_path_tmp in /usr /usr/local /opt /opt/local ; do
if test -d "$ac_eigen_path_tmp/include/eigen" && test -r "$ac_eigen_path_tmp/include/eigen"; then
EIGEN_CPPFLAGS="-I$ac_eigen_path_tmp/include"
break;
fi
done
fi

CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $EIGEN_CPPFLAGS"
export EIGEN_CPPFLAGS

AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@%:@include <eigen3/Eigen/Dense>
]], [[
]])],[
AC_MSG_RESULT(yes)
succeeded=yes
found_system=yes
],[
])
AC_LANG_POP([C++])

CPPFLAGS="$CPPFLAGS $EIGEN_CPPFLAGS"
export CPPFLAGS
LDFLAGS="$LDFLAGS $EIGEN_LDFLAGS"
export LDFLAGS
export EIGEN_CPPFLAGS

if test "$succeeded" == "yes" ; then
AC_SUBST(EIGEN_CPPFLAGS)
AC_DEFINE(HAVE_EIGEN,,[define if the EIGEN library is available])
fi

CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
fi

])