Skip to content

Commit

Permalink
chore: make libxml optional (#1282)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviator-app[bot] authored Mar 6, 2024
2 parents 99a260f + ffabf14 commit 5c730b0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ Config/testthat/start-first: vs-es, scan, vs-operators, weakref,
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
SystemRequirements: libxml2, glpk (>= 4.57, optional)
SystemRequirements: libxml2 (optional), glpk (>= 4.57, optional)
18 changes: 11 additions & 7 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,28 @@ 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 "Error: Neither xml2-config nor pkg-config is available"
exit 1
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"
PKG_CFLAGS="$PKG_CFLAGS $libxml2_cflags -DHAVE_LIBXML"
echo "libxml2 include directories: $libxml2_cflags"
else
echo "Error: libxml2 include directory not found"
exit 1
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 "Error: libxml2 library link flags not found"
exit 1
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

OBJECTS='${SOURCES} ${MINIGMPSOURCES}'
Expand Down
3 changes: 2 additions & 1 deletion src/Makevars.ucrt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ PKG_CPPFLAGS = -I"${LIB_XML}/include/libxml2" -I"${LIB_XML}/include" -DLIBXML_ST
-DNDEBUG -DNTIMER -DNPRINT -DIGRAPH_THREAD_LOCAL= \
-DPRPACK_IGRAPH_SUPPORT \
-DHAVE_GFORTRAN=1 \
-D_GNU_SOURCE=1
-D_GNU_SOURCE=1 \
-DHAVE_LIBXML

PKG_LIBS = -L"${LIB_XML}/lib" -lxml2 -liconv -lz -lws2_32 -lstdc++ \
-lglpk $(BLAS_LIBS) $(LAPACK_LIBS) $(FLIBS) -llzma
Expand Down
3 changes: 2 additions & 1 deletion src/Makevars.win
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ PKG_CPPFLAGS=-DUSING_R -I. -Ivendor -Ivendor/cigraph/src -Ivendor/cigraph/includ
-DNDEBUG -DNTIMER -DNPRINT -DIGRAPH_THREAD_LOCAL= \
-DPRPACK_IGRAPH_SUPPORT \
-DHAVE_GFORTRAN=1 \
-D_GNU_SOURCE=1
-D_GNU_SOURCE=1 \
-DHAVE_LIBXML

PKG_LIBS = -lxml2 -lz -lstdc++ \
-lglpk $(BLAS_LIBS) $(LAPACK_LIBS)
Expand Down
1 change: 0 additions & 1 deletion src/vendor/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#endif

#define HAVE_GLPK 1
#define HAVE_LIBXML 1

/* #undef INTERNAL_BLAS */
/* #undef INTERNAL_LAPACK */
Expand Down

0 comments on commit 5c730b0

Please sign in to comment.