X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=acinclude.m4;h=acee3e17c3df6f714894b9b7866ae48c06b224a4;hb=c326b4dc1dd42a50875578f0e7580125a1ddc03c;hp=313dd6f18db32fbf1d546c53a5b954ca4e203d6f;hpb=79231a87aef1ed9169de458349c03cf12ef793e1;p=nagiosplug.git diff --git a/acinclude.m4 b/acinclude.m4 index 313dd6f..acee3e1 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1 +1,77 @@ -ifdef(AC_FUNC_STRTOD,,`define([AC_FUNC_STRTOD],[AM_FUNC_STRTOD]') \ No newline at end of file +dnl @synopsis ACX_WHICH_GETHOSTBYNAME_R +dnl +dnl Provides a test to determine the correct way to call gethostbyname_r +dnl +dnl defines HAVE_GETHOSTBYNAME_R to the number of arguments required +dnl +dnl e.g. 6 arguments (linux) +dnl e.g. 5 arguments (solaris) +dnl e.g. 3 arguments (osf/1) +dnl +dnl @author Brian Stafford +dnl +dnl based on version by Caolan McNamara +dnl based on David Arnold's autoconf suggestion in the threads faq +dnl +AC_DEFUN([ACX_WHICH_GETHOSTBYNAME_R], +[AC_CACHE_CHECK(number of arguments to gethostbyname_r, + acx_which_gethostbyname_r, [ + AC_TRY_COMPILE([ +# include + ], [ + + char *name; + struct hostent *he; + struct hostent_data data; + (void) gethostbyname_r(name, he, &data); + + ],acx_which_gethostbyname_r=3, + [ +dnl acx_which_gethostbyname_r=0 + AC_TRY_COMPILE([ +# include + ], [ + char *name; + struct hostent *he, *res; + char *buffer = NULL; + int buflen = 2048; + int h_errnop; + (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop) + ],acx_which_gethostbyname_r=6, + + [ +dnl acx_which_gethostbyname_r=0 + AC_TRY_COMPILE([ +# include + ], [ + char *name; + struct hostent *he; + char *buffer = NULL; + int buflen = 2048; + int h_errnop; + (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop) + ],acx_which_gethostbyname_r=5,acx_which_gethostbyname_r=0) + + ] + + ) + ] + ) + ]) + +if test $acx_which_gethostbyname_r -gt 0 ; then + AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYNAME_R], $acx_which_gethostbyname_r, + [Number of parameters to gethostbyname_r or 0 if not available]) +fi + +]) + +dnl @synopsis ACX_HELP_STRING(OPTION,DESCRIPTION) +AC_DEFUN([ACX_HELP_STRING], + [ $1 builtin([substr],[ ],len($1))[$2]]) + + +dnl @synopsis ACX_FEATURE(ENABLE_OR_WITH,NAME[,VALUE]) +AC_DEFUN([ACX_FEATURE], + [echo "builtin([substr],[ ],len(--$1-$2))--$1-$2: ifelse($3,,[$]translit($1-$2,-,_),$3)"]) +