File: configure

package info (click to toggle)
r-cran-igraph 2.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 27,772 kB
  • sloc: ansic: 206,420; cpp: 21,827; fortran: 4,090; yacc: 1,229; lex: 518; sh: 52; makefile: 8
file content (53 lines) | stat: -rwxr-xr-x 2,273 bytes parent folder | download
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
#!/bin/sh

# Use xml2-config or pkg-config to get the include directories for libxml-2.0
if xml2-config --version >/dev/null 2>&1; then
    libxml2_cflags=$(xml2-config --cflags)
    libxml2_libs=$(xml2-config --libs)
elif pkg-config --version >/dev/null 2>&1; then
    libxml2_cflags=$(pkg-config --cflags libxml-2.0)
    libxml2_libs=$(pkg-config --libs --static libxml-2.0)
else
    echo "Warning: libxml2 not found. Neither xml2-config nor pkg-config is available."
    libxml_unavilable=true
fi

if [ -n "$libxml2_cflags" ]; then
    PKG_CFLAGS="$PKG_CFLAGS $libxml2_cflags -DHAVE_LIBXML"
    echo "libxml2 include directories: $libxml2_cflags"
else
    echo "Warning: libxml2 include directory not found."
    libxml_unavilable=true
fi

if [ -n "$libxml2_libs" ]; then
    PKG_LIBS="$PKG_LIBS $libxml2_libs"
    echo "libxml2 library link flags: $libxml2_libs"
else
    echo "Warning: libxml2 library link flags not found."
    libxml_unavilable=true
fi

if [ "$libxml_unavilable" = true ]; then
    echo "GraphML import will not be available."
fi

# shellcheck disable=SC2016
OBJECTS='${IGRAPH_SOURCES} ${GLUE_C_SOURCES} ${GLUE_CPP_SOURCES} ${MINI_GMP_SOURCES}'

if echo '#include <glpk.h>' | `"${R_HOME}/bin/R" CMD config CC` -E `"${R_HOME}/bin/R" CMD config CPPFLAGS` - > /dev/null 2>&1; then
  echo "Using installed GLPK"
  PKG_LIBS="$PKG_LIBS -lglpk"
else
  echo "Using vendored GLPK"
  PKG_CFLAGS="$PKG_CFLAGS -Ivendor/cigraph/vendor/glpk -Ivendor/cigraph/vendor/glpk/env -Ivendor/cigraph/vendor/glpk/minisat -Ivendor/cigraph/vendor/glpk/misc -Ivendor/cigraph/vendor/glpk/draft -Ivendor/cigraph/vendor/glpk/npp -Ivendor/cigraph/vendor/glpk/api -Ivendor/cigraph/vendor/glpk/mpl -Ivendor/cigraph/vendor/glpk/bflib -Ivendor/cigraph/vendor/glpk/amd -Ivendor/cigraph/vendor/glpk/simplex -Ivendor/cigraph/vendor/glpk/colamd"
  # shellcheck disable=SC2016
  OBJECTS="${OBJECTS}"' ${GLPK_SOURCES}'
fi

echo "# Generated from Makevars.in, do not edit by hand" > src/Makevars.new
sed -e "s|@cflags@|$PKG_CFLAGS|" -e "s|@libs@|$PKG_LIBS|" -e "s|@objects@|${OBJECTS}|" src/Makevars.in >> src/Makevars.new
if [ ! -f src/Makevars ] || (which diff > /dev/null && ! diff -q src/Makevars src/Makevars.new); then
    cp -f src/Makevars.new src/Makevars
fi
rm -f src/Makevars.new