dnl CF_FUNC_VASPRINTF version: 1 updated: 2019/07/31 20:03:22
dnl -----------------
dnl Check if vasprintf is available, and if it is (or can be) declared.
AC_DEFUN([CF_FUNC_VASPRINTF],[
AC_REQUIRE([CF_GNU_SOURCE])
AC_CHECK_FUNC(vasprintf,[
	AC_DEFINE(HAVE_VASPRINTF)
	AC_MSG_CHECKING(if vasprintf requires workaround)
	AC_TRY_COMPILE([
		#include <stdio.h>
		],[
		void *p = (void *)vasprintf; return (p != 0)
	],[
		AC_MSG_RESULT(no)
	],[
		AC_TRY_COMPILE([
			#ifndef _GNU_SOURCE
			#define _GNU_SOURCE 1
			#include <stdio.h>
			#endif
			],[
			void *p = (void *)vasprintf; return (p != 0)
		],[
			AC_MSG_RESULT(yes)
			CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE)
		],[
			AC_MSG_RESULT(unknown)
		])
	])
])
])dnl
