From e3ca6af2c580c0b748a5635c15b973094765abbf Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Tue, 3 Dec 2024 02:28:15 +0100 Subject: [PATCH] configure: Allow building the library without tool(s) --- configure.ac | 16 +++++++++++++++- tools/Makefile.am | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 65cc697d..fc0d8c4d 100644 --- a/configure.ac +++ b/configure.ac @@ -147,6 +147,14 @@ else fi AM_CONDITIONAL([HAVE_CYTHON],[test "x$cython_python_bindings" = "xyes"]) +AC_ARG_WITH([tools], + [AS_HELP_STRING([--with-tools], [Build libplist tools. [default=yes]])], + [build_tools=${withval}], + [build_tools=yes] +) +AS_IF([test "x$build_tools" = "xyes"], [AC_DEFINE(BUILD_TOOLS, 1, [Define if we are building plist tools])]) +AM_CONDITIONAL(BUILD_TOOLS, test "x$build_tools" = "xyes") + AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter -Wno-strict-aliasing $PTHREAD_CFLAGS") GLOBAL_LDFLAGS="$PTHREAD_LIBS" @@ -199,7 +207,11 @@ AC_ARG_WITH([tests], [AS_HELP_STRING([--without-tests], [Do not build libplist test suite (default is yes)])], [build_tests=${withval}], - [build_tests=yes]) + [build_tests=${build_tools}]) + +if test "x$build_tests" = "xyes" -a "x$build_tools" != "xyes"; then + AC_MSG_ERROR([Building the test suite requires plistutil. Reconfigure with --with-tools=yes to enable.]) +fi if test "x$build_fuzzers" = "xyes"; then if test "x$build_sanitizers" = "xno"; then @@ -318,6 +330,8 @@ Configuration for $PACKAGE $VERSION: Install prefix ..........: $prefix Debug code ..............: $debug Python bindings .........: $cython_python_bindings + Build tools .............: $build_tools + Build test suite ........: $build_tests $EXTRA_CONF Now type 'make' to build $PACKAGE $VERSION, and then 'make install' for installation. diff --git a/tools/Makefile.am b/tools/Makefile.am index 9f3214dc..58832861 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,3 +1,5 @@ +if BUILD_TOOLS + AM_CFLAGS = \ $(GLOBAL_CFLAGS) \ -I$(top_srcdir)/include @@ -8,3 +10,5 @@ bin_PROGRAMS = plistutil plistutil_SOURCES = plistutil.c plistutil_LDADD = $(top_builddir)/src/libplist-2.0.la + +endif