I'm trying to do some testing of c-ares.  I checked out the GIT tag for the 
1.11.0 release,
and am testing against various OS's.  However a *lot* of these do not support 
C++11 and it
appears this is required for building, even though c-ares itself does not have 
any such
requirement.

At this point, it appears that means there is no way to build without making 
changes to the
build system (configure.ac) to disable the config subdir if you don't have a 
C++11 compiler.
Is this intentional?

I'd think it should just disable the building of the tests if the system 
doesn't have the
prerequisites ... or at least provide a configure flag to specifically disable 
building of
the tests.

I've attached a possible patch to automatically select if it should build tests 
or not,
and if you explicitly pass --enable-tests and it can't be used on that system, 
it will
cause configure to fail instead of silently disabling them.

-Brad
--- configure.ac	(revision 42807)
+++ configure.ac	(working copy)
@@ -82,6 +82,7 @@
 AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
 
 XC_CHECK_PROG_CC
+AX_CXX_COMPILE_STDCXX_11([noext],[optional])
 
 XC_AUTOMAKE
 
@@ -877,7 +878,29 @@
 
 XC_CHECK_BUILD_FLAGS
 
-if test "x$cross_compiling" = "xno"; then
+AC_MSG_CHECKING([whether to build tests])
+AC_ARG_ENABLE(tests,
+	AC_HELP_STRING([--enable-tests], [build test suite]),
+	[ build_tests="$enableval" ],
+	[ if test "x$HAVE_CXX11" = "x1" && test "x$cross_compiling" = "xno" ; then
+	    build_tests="yes"
+	  else
+	    build_tests="no"
+	  fi
+	]
+)
+
+if test "x$build_tests" = "xyes" ; then
+	if test "x$HAVE_CXX11" = "0" ; then
+		AC_MSG_ERROR([*** Building tests requires a CXX11 compiler])
+	fi
+	if test "x$cross_compiling" = "xyes" ; then
+		AC_MSG_ERROR([*** Tests not supported when cross compiling])
+	fi
+fi
+AC_MSG_RESULT([$build_tests])
+
+if test "x$build_tests" = "xyes" ; then
   AC_CONFIG_SUBDIRS([test])
 fi
 

Reply via email to