From fdf8e8a8e5a190ff03aefbd9dc80bcc083a2854b Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Thu, 3 Nov 2011 23:47:05 +0100 Subject: [PATCH] Allow to explicitly enable or disable building the CLI tool --- README.in | 6 ++++++ configure.ac | 25 ++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/README.in b/README.in index 7dbca47..9bb76df 100644 --- a/README.in +++ b/README.in @@ -29,6 +29,12 @@ For detailed installation instructions, see the INSTALL file. If you are working on Windows, you may want to consider using the alternate build system, see below. +Optional features +----------------- + +You can explicitly enable or disable building of the command-line tool by giving +the --enable-cli-tool or --disable-cli-tool argument to configure. + Alternate installation, Waf =========================== diff --git a/configure.ac b/configure.ac index 286babf..338e977 100644 --- a/configure.ac +++ b/configure.ac @@ -15,6 +15,23 @@ AC_CONFIG_HEADERS([config.h]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +# CLI-tool specific macros to enable/disable it +AC_ARG_ENABLE([cli-tool], + AS_HELP_STRING([--disable-cli-tool], + [Disable the standalone command-line tool [[default=auto]]]), + [enable_cli_tool="$enableval"], + [enable_cli_tool="auto"]) + +# Output or not $1 as an error or a warning depending on $enable_cli_tool +AC_DEFUN([CLI_TOOL_MSG_ERROR], +[ + AS_IF([test "x$enable_cli_tool" = "xyes"], + [AC_MSG_ERROR([$1])], + [test "x$enable_cli_tool" != "xno"], + [AC_MSG_WARN([$1])]) +]) + # # revision of the library (libtool stuff) # @@ -49,13 +66,15 @@ HAVE_GIO_UNIX="no" PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0], [HAVE_GIO_UNIX="yes"], [HAVE_GIO_UNIX="no" - AC_MSG_WARN([The ctpl command-line utility will not be built because of the following error: ${GIO_UNIX_PKG_ERRORS}])]) + CLI_TOOL_MSG_ERROR([Cannot build the CLI tool: ${GIO_UNIX_PKG_ERRORS}]) + enable_cli_tool="no"]) HAVE_GIO_2_24="no" PKG_CHECK_MODULES([GIO_2_24], [gio-2.0 >= 2.24], [HAVE_GIO_2_24="yes"], [HAVE_GIO_2_24="no" - AC_MSG_WARN([The ctpl command-line utility will not be built because of the following error: ${GIO_2_24_PKG_ERRORS}])]) -AM_CONDITIONAL([BUILD_CTPL], [test x$HAVE_GIO_UNIX = xyes -a x$HAVE_GIO_2_24 = xyes]) + CLI_TOOL_MSG_ERROR([Cannot build the CLI tool: ${GIO_2_24_PKG_ERRORS}]) + enable_cli_tool="no"]) +AM_CONDITIONAL([BUILD_CTPL], [test "x$enable_cli_tool" != xno]) # needed for the math functions checks to work AC_CHECK_LIB([m], [acos]) -- 1.7.2.5