-
Notifications
You must be signed in to change notification settings - Fork 13
/
configure.ac
180 lines (163 loc) · 4.73 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
AC_INIT(igraph)
AC_CONFIG_SRCDIR(src/f2c.h)
AC_CONFIG_HEADERS(src/config.h)
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
echo "could not determine R_HOME"
exit 1
fi
CC=`"${R_HOME}/bin/R" CMD config CC`
CXX=`"${R_HOME}/bin/R" CMD config CXX11`
if test -z "$CXX"; then
AC_MSG_ERROR([No C++11 compiler is available])
fi
CXX11STD=`"${R_HOME}/bin/R" CMD config CXX11STD`
CXX="${CXX} ${CXX11STD}"
FC=`"${R_HOME}/bin/R" CMD config FC`
CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`
CXXFLAGS=`"${R_HOME}/bin/R" CMD config CXX11FLAGS`
CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
FCFLAGS=`"${R_HOME}/bin/R" CMD config FCFLAGS`
FLIBS=`"${R_HOME}/bin/R" CMD config FLIBS`
LDFLAGS=`"${R_HOME}/bin/R" CMD config LDFLAGS`
AC_LANG(C)
AC_PROG_CC
AC_LANG(C++)
AC_PROG_CXX
# Fortran compiler, we need to check if it is the GNU compiler
AC_PROG_FC
if test "x$ac_cv_fc_compiler_gnu" = xyes; then
AC_DEFINE([HAVE_GFORTRAN], [1], [Define to 1 if using the GNU Fortran compiler])
fi
LIBS_SAVE=$LIBS
LIBS="$LIBS -lm"
AC_CHECK_FUNCS([expm1 fmin finite log2 log1p rint rintf round stpcpy strcasecmp _stricmp strdup])
AC_CHECK_FUNCS(isfinite,
[AC_DEFINE(HAVE_ISFINITE, 1)],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>]],
[[double f = 0.0; isfinite(f)]])],
[AC_DEFINE(HAVE_ISFINITE, 1)],
[AC_MSG_FAILURE([isfinite() not available])]
)]
)
LIBS=$LIBS_SAVE
AC_CHECK_HEADER([sys/times.h],
[AC_DEFINE([HAVE_TIMES_H], [1], [Define to 1 if you have the sys/times.h header])])
AC_CHECK_HEADERS([ \
net/if.h \
netinet/in.h \
net/if_dl.h \
sys/sockio.h \
sys/un.h \
sys/socket.h \
sys/ioctl.h \
sys/time.h \
sys/file.h \
])
AC_CHECK_MEMBER([struct sockaddr.sa_len],
AC_DEFINE_UNQUOTED([HAVE_SA_LEN], [1], [Define if struct sockaddr contains sa_len]), [],
[#include <sys/types.h>
#include <sys/socket.h>])
graphml_support=yes
AC_ARG_ENABLE(graphml,
AS_HELP_STRING([--disable-graphml], [Disable support for GraphML format]),
[graphml_support=$enableval], [graphml_support=yes])
HAVE_LIBXML=0
if test $graphml_support = yes; then
AC_PATH_PROG([XML2CONFIG], [xml2-config], [none])
if test "$XML2CONFIG" = "none"; then
graphml_support=no
else
# xml2-config puts only preprocessor flags in --cflags (i.e. -D and -I) so
# we can put them in XML2_CPPFLAGS. This might not be true for other
# libraries, though.
XML2_CPPFLAGS=`$XML2CONFIG --cflags`
XML2_LIBS=`$XML2CONFIG --libs`
OLDLIBS=${LIBS}
LIBS=${XML2_LIBS}
AC_CHECK_LIB([xml2], [xmlSAXUserParseFile], [
OLDCPPFLAGS=${CPPFLAGS}
CPPFLAGS=${XML2_CPPFLAGS}
AC_CHECK_HEADER([libxml/parser.h], [
HAVE_LIBXML=1
AC_DEFINE([HAVE_LIBXML], [1], [Define to 1 if you have the libxml2 libraries installed])
], [
graphml_support=no
])
CPPFLAGS=${OLDCPPFLAGS}
], [
graphml_support=no
])
LIBS=${OLDLIBS}
fi
fi
AC_SUBST(HAVE_LIBXML)
AC_SUBST(XML2_LIBS)
AC_SUBST(XML2_CPPFLAGS)
AC_DEFINE([INTERNAL_GMP], [1], [Define to 1 if you use the vendored mini-GMP library])
AC_LANG_PUSH([C++])
HAVE_GMP=0
INTERNAL_GMP=1
GMP_LIBS=""
gmp_support=no
AC_CHECK_LIB([gmp], [__gmpz_add], [
AC_CHECK_HEADER([gmp.h], [
HAVE_GMP=1
INTERNAL_GMP=0
AC_DEFINE([HAVE_GMP], [1], [Define to 1 if you have the GMP library])
gmp_support=yes
GMP_LIBS="-lgmp"
])
])
AC_SUBST(HAVE_GMP)
AC_SUBST(INTERNAL_GMP)
AC_SUBST(GMP_LIBS)
AC_LANG_POP([C++])
HAVE_GLPK=0
GLPK_LIBS=""
glpk_support=no
AC_ARG_ENABLE(glpk, AS_HELP_STRING([--disable-glpk], [Compile without the GLPK library]))
if test "x$enable_glpk" != "xno"; then
AC_CHECK_LIB([glpk], [glp_read_mps], [
AC_CHECK_HEADER([glpk.h], [
AC_EGREP_CPP(yes, [
#include <glpk.h>
#if GLP_MAJOR_VERSION > 4 || (GLP_MAJOR_VERSION == 4 && GLP_MINOR_VERSION >= 57)
yes
#endif
], [
HAVE_GLPK=1
AC_DEFINE([HAVE_GLPK], [1], [Define to 1 if you have the GLPK library])
glpk_support=yes
GLPK_LIBS="-lglpk"
])
])
])
fi
AC_SUBST(HAVE_GLPK)
AC_SUBST(GLPK_LIBS)
AC_DEFINE(IGRAPH_THREAD_LOCAL, [], [We don't care about thread-local storage in R])
AC_CONFIG_FILES([src/Makevars.tmp:src/Makevars.in], [
if test -f src/Makevars && cmp -s src/Makevars.tmp src/Makevars; then
AC_MSG_NOTICE([creating src/Makevars])
AC_MSG_NOTICE([src/Makevars is unchanged])
rm src/Makevars.tmp
else
AC_MSG_NOTICE([creating src/Makevars])
mv src/Makevars.tmp src/Makevars
fi
]
)
AC_OUTPUT
echo ""
echo "*** Compiler settings used:"
echo " CC=${CC}"
echo " LD=${LD}"
echo " CFLAGS=${CFLAGS}"
echo " CPPFLAGS=${CPPFLAGS}"
echo " CXX=${CXX}"
echo " CXXFLAGS=${CXXFLAGS}"
echo " LDFLAGS=${LDFLAGS}"
echo " LIBS=${LIBS}"