Blame m4/ac_cxx_string_compare_string_first.m4

Packit Service e31359
dnl @synopsis AC_CXX_STRING_COMPARE_STRING_FIRST
Packit Service e31359
dnl
Packit Service e31359
dnl If the standard library string::compare() function takes the
Packit Service e31359
dnl string as its first argument, define FUNC_STRING_COMPARE_STRING_FIRST to 1.
Packit Service e31359
dnl
Packit Service e31359
dnl @author Steven Robbins
Packit Service e31359
dnl
Packit Service e31359
AC_DEFUN([AC_CXX_STRING_COMPARE_STRING_FIRST], [
Packit Service e31359
	AC_CACHE_CHECK(whether std::string::compare takes a string in argument 1,
Packit Service e31359
	ac_cv_cxx_string_compare_string_first,
Packit Service e31359
	[
Packit Service e31359
		AC_REQUIRE([AC_CXX_NAMESPACES])
Packit Service e31359
		AC_LANG_SAVE
Packit Service e31359
		AC_LANG_CPLUSPLUS
Packit Service e31359
		AC_TRY_COMPILE([
Packit Service e31359
#include <string>
Packit Service e31359
#ifdef HAVE_NAMESPACES
Packit Service e31359
using namespace std;
Packit Service e31359
#endif
Packit Service e31359
		], [
Packit Service e31359
string x("hi"); string y("h");
Packit Service e31359
return x.compare(y,0,1) == 0;
Packit Service e31359
		],
Packit Service e31359
		ac_cv_cxx_string_compare_string_first=yes, 
Packit Service e31359
		ac_cv_cxx_string_compare_string_first=no)
Packit Service e31359
		AC_LANG_RESTORE
Packit Service e31359
	])
Packit Service e31359
	AS_IF([test "x$ac_cv_cxx_string_compare_string_first" = "xyes"], [
Packit Service e31359
		AC_DEFINE(FUNC_STRING_COMPARE_STRING_FIRST,1,
Packit Service e31359
			[define if library uses std::string::compare(string,pos,n)])
Packit Service e31359
	])
Packit Service e31359
])