1*2b15cb3dSCy Schubert# Modified by Dave Hart for integration into NTP 4.2.7 <hart@ntp.org> 2*2b15cb3dSCy Schubert# 3*2b15cb3dSCy Schubert# Changed in a backwards-incompatible way to separate HAVE_SNPRINTF from 4*2b15cb3dSCy Schubert# HW_WANT_RPL_SNPRINTF, etc. for each of the four replaced functions. 5*2b15cb3dSCy Schubert# HAVE_* will always be set if the corresponding HW_FUNC_* macro is 6*2b15cb3dSCy Schubert# invoked, directly or indirectly. This allows 3rd-party modules like 7*2b15cb3dSCy Schubert# libopts to avoid their own replacement of snprintf. 8*2b15cb3dSCy Schubert# 9*2b15cb3dSCy Schubert# Changed to honor hw_nodef_snprintf, etc. which prevent config.h from 10*2b15cb3dSCy Schubert# aliasing snprintf to rpl_snprintf, etc. 11*2b15cb3dSCy Schubert# 12*2b15cb3dSCy Schubert# Changed to honor hw_force_rpl_snprintf=yes, etc. This is used by NTP 13*2b15cb3dSCy Schubert# to test rpl_snprintf() and rpl_vsnprintf() on platforms which provide 14*2b15cb3dSCy Schubert# C99-compliant implementations. 15*2b15cb3dSCy Schubert# 16*2b15cb3dSCy Schubert 17*2b15cb3dSCy Schubert# $Id: snprintf.m4,v 1.1.1.1 2008/01/06 03:24:00 holger Exp $ 18*2b15cb3dSCy Schubert 19*2b15cb3dSCy Schubert# Copyright (c) 2008 Holger Weiss <holger@jhweiss.de>. 20*2b15cb3dSCy Schubert# 21*2b15cb3dSCy Schubert# This code may freely be used, modified and/or redistributed for any purpose. 22*2b15cb3dSCy Schubert# It would be nice if additions and fixes to this file (including trivial code 23*2b15cb3dSCy Schubert# cleanups) would be sent back in order to let me include them in the version 24*2b15cb3dSCy Schubert# available at <http://www.jhweiss.de/software/snprintf.html>. However, this is 25*2b15cb3dSCy Schubert# not a requirement for using or redistributing (possibly modified) versions of 26*2b15cb3dSCy Schubert# this file, nor is leaving this notice intact mandatory. 27*2b15cb3dSCy Schubert 28*2b15cb3dSCy Schubert# HW_HEADER_STDARG_H 29*2b15cb3dSCy Schubert# ------------------ 30*2b15cb3dSCy Schubert# Define HAVE_STDARG_H to 1 if <stdarg.h> is available. 31*2b15cb3dSCy SchubertAC_DEFUN([HW_HEADER_STDARG_H], 32*2b15cb3dSCy Schubert[ 33*2b15cb3dSCy Schubert AC_PREREQ([2.60])dnl Older releases should work if AC_CHECK_HEADERS is used. 34*2b15cb3dSCy Schubert AC_CHECK_HEADERS_ONCE([stdarg.h]) 35*2b15cb3dSCy Schubert])# HW_HEADER_STDARG_H 36*2b15cb3dSCy Schubert 37*2b15cb3dSCy Schubert# HW_HEADER_VARARGS_H 38*2b15cb3dSCy Schubert# ------------------- 39*2b15cb3dSCy Schubert# Define HAVE_VARARGS_H to 1 if <varargs.h> is available. 40*2b15cb3dSCy SchubertAC_DEFUN([HW_HEADER_VARARGS_H], 41*2b15cb3dSCy Schubert[ 42*2b15cb3dSCy Schubert AC_PREREQ([2.60])dnl Older releases should work if AC_CHECK_HEADERS is used. 43*2b15cb3dSCy Schubert AC_CHECK_HEADERS_ONCE([varargs.h]) 44*2b15cb3dSCy Schubert])# HW_HEADER_VARARGS_H 45*2b15cb3dSCy Schubert 46*2b15cb3dSCy Schubert# HW_FUNC_VA_COPY 47*2b15cb3dSCy Schubert# --------------- 48*2b15cb3dSCy Schubert# Set $hw_cv_func_va_copy to "yes" or "no". Define HAVE_VA_COPY to 1 if 49*2b15cb3dSCy Schubert# $hw_cv_func_va_copy is set to "yes". Note that it's "unspecified whether 50*2b15cb3dSCy Schubert# va_copy and va_end are macros or identifiers declared with external linkage." 51*2b15cb3dSCy Schubert# (C99: 7.15.1, 1) Therefore, the presence of va_copy(3) cannot simply "be 52*2b15cb3dSCy Schubert# tested with #ifdef", as suggested by the Autoconf manual (5.5.1). 53*2b15cb3dSCy SchubertAC_DEFUN([HW_FUNC_VA_COPY], 54*2b15cb3dSCy Schubert[ 55*2b15cb3dSCy Schubert AC_REQUIRE([HW_HEADER_STDARG_H])dnl Our check evaluates HAVE_STDARG_H. 56*2b15cb3dSCy Schubert AC_REQUIRE([HW_HEADER_VARARGS_H])dnl Our check evaluates HAVE_VARARGS_H. 57*2b15cb3dSCy Schubert AC_CACHE_CHECK([for va_copy], 58*2b15cb3dSCy Schubert [hw_cv_func_va_copy], 59*2b15cb3dSCy Schubert [AC_RUN_IFELSE( 60*2b15cb3dSCy Schubert [AC_LANG_PROGRAM( 61*2b15cb3dSCy Schubert [[#if HAVE_STDARG_H 62*2b15cb3dSCy Schubert #include <stdarg.h> 63*2b15cb3dSCy Schubert #elif HAVE_VARARGS_H 64*2b15cb3dSCy Schubert #include <varargs.h> 65*2b15cb3dSCy Schubert #endif]], 66*2b15cb3dSCy Schubert [[va_list ap, aq; va_copy(aq, ap);]])], 67*2b15cb3dSCy Schubert [hw_cv_func_va_copy=yes], 68*2b15cb3dSCy Schubert [hw_cv_func_va_copy=no], 69*2b15cb3dSCy Schubert [hw_cv_func_va_copy=no])]) 70*2b15cb3dSCy Schubert AS_IF([test "$hw_cv_func_va_copy" = yes], 71*2b15cb3dSCy Schubert [AC_DEFINE([HAVE_VA_COPY], [1], 72*2b15cb3dSCy Schubert [Define to 1 if you have the `va_copy' function or macro.])]) 73*2b15cb3dSCy Schubert])# HW_FUNC_VA_COPY 74*2b15cb3dSCy Schubert 75*2b15cb3dSCy Schubert# HW_FUNC___VA_COPY 76*2b15cb3dSCy Schubert# ----------------- 77*2b15cb3dSCy Schubert# Set $hw_cv_func___va_copy to "yes" or "no". Define HAVE___VA_COPY to 1 if 78*2b15cb3dSCy Schubert# $hw_cv_func___va_copy is set to "yes". 79*2b15cb3dSCy SchubertAC_DEFUN([HW_FUNC___VA_COPY], 80*2b15cb3dSCy Schubert[ 81*2b15cb3dSCy Schubert AC_REQUIRE([HW_HEADER_STDARG_H])dnl Our check evaluates HAVE_STDARG_H. 82*2b15cb3dSCy Schubert AC_REQUIRE([HW_HEADER_VARARGS_H])dnl Our check evaluates HAVE_VARARGS_H. 83*2b15cb3dSCy Schubert AC_CACHE_CHECK([for __va_copy], 84*2b15cb3dSCy Schubert [hw_cv_func___va_copy], 85*2b15cb3dSCy Schubert [AC_RUN_IFELSE( 86*2b15cb3dSCy Schubert [AC_LANG_PROGRAM( 87*2b15cb3dSCy Schubert [[#if HAVE_STDARG_H 88*2b15cb3dSCy Schubert #include <stdarg.h> 89*2b15cb3dSCy Schubert #elif HAVE_VARARGS_H 90*2b15cb3dSCy Schubert #include <varargs.h> 91*2b15cb3dSCy Schubert #endif]], 92*2b15cb3dSCy Schubert [[va_list ap, aq; __va_copy(aq, ap);]])], 93*2b15cb3dSCy Schubert [hw_cv_func___va_copy=yes], 94*2b15cb3dSCy Schubert [hw_cv_func___va_copy=no], 95*2b15cb3dSCy Schubert [hw_cv_func___va_copy=no])]) 96*2b15cb3dSCy Schubert AS_IF([test "$hw_cv_func___va_copy" = yes], 97*2b15cb3dSCy Schubert [AC_DEFINE([HAVE___VA_COPY], [1], 98*2b15cb3dSCy Schubert [Define to 1 if you have the `__va_copy' function or macro.])]) 99*2b15cb3dSCy Schubert])# HW_FUNC___VA_COPY 100*2b15cb3dSCy Schubert 101*2b15cb3dSCy Schubert# HW_FUNC_VSNPRINTF 102*2b15cb3dSCy Schubert# ----------------- 103*2b15cb3dSCy Schubert# Set $hw_cv_func_vsnprintf and $hw_cv_func_vsnprintf_c99 to "yes" or 104*2b15cb3dSCy Schubert# "no", respectively. If either $hw_force_rpl_vsnprintf is "yes" or 105*2b15cb3dSCy Schubert# $hw_cv_func_vsnprintf_c99 is "no", define HW_WANT_RPL_VSNPRINTF and 106*2b15cb3dSCy Schubert# define vsnprintf to rpl_vsnprintf. 107*2b15cb3dSCy SchubertAC_DEFUN([HW_FUNC_VSNPRINTF], 108*2b15cb3dSCy Schubert[ 109*2b15cb3dSCy Schubert AC_PREREQ([2.60])dnl 2.59 should work if some AC_TYPE_* macros are replaced. 110*2b15cb3dSCy Schubert AC_REQUIRE([HW_HEADER_STDARG_H])dnl Our check evaluates HAVE_STDARG_H. 111*2b15cb3dSCy Schubert AC_CHECK_FUNC([vsnprintf], 112*2b15cb3dSCy Schubert [hw_cv_func_vsnprintf=yes], 113*2b15cb3dSCy Schubert [hw_cv_func_vsnprintf=no]) 114*2b15cb3dSCy Schubert AS_IF([test "$hw_cv_func_vsnprintf" = yes], 115*2b15cb3dSCy Schubert [AC_CACHE_CHECK([whether vsnprintf is C99 compliant], 116*2b15cb3dSCy Schubert [hw_cv_func_vsnprintf_c99], 117*2b15cb3dSCy Schubert [AC_RUN_IFELSE( 118*2b15cb3dSCy Schubert [AC_LANG_PROGRAM( 119*2b15cb3dSCy Schubert [[#if HAVE_STDARG_H 120*2b15cb3dSCy Schubert #include <stdarg.h> 121*2b15cb3dSCy Schubert #endif 122*2b15cb3dSCy Schubert #include <stdio.h> 123*2b15cb3dSCy Schubert static int testprintf(char *buf, size_t size, const char *format, ...) 124*2b15cb3dSCy Schubert { 125*2b15cb3dSCy Schubert int result; 126*2b15cb3dSCy Schubert va_list ap; 127*2b15cb3dSCy Schubert va_start(ap, format); 128*2b15cb3dSCy Schubert result = vsnprintf(buf, size, format, ap); 129*2b15cb3dSCy Schubert va_end(ap); 130*2b15cb3dSCy Schubert return result; 131*2b15cb3dSCy Schubert }]], 132*2b15cb3dSCy Schubert [[char buf[43]; 133*2b15cb3dSCy Schubert if (testprintf(buf, 4, "The answer is %27.2g.", 42.0) != 42 || 134*2b15cb3dSCy Schubert testprintf(buf, 0, "No, it's %32zu.", (size_t)42) != 42 || 135*2b15cb3dSCy Schubert buf[0] != 'T' || buf[3] != '\0') 136*2b15cb3dSCy Schubert return 1;]])], 137*2b15cb3dSCy Schubert [hw_cv_func_vsnprintf_c99=yes], 138*2b15cb3dSCy Schubert [hw_cv_func_vsnprintf_c99=no], 139*2b15cb3dSCy Schubert [hw_cv_func_vsnprintf_c99=no])])], 140*2b15cb3dSCy Schubert [hw_cv_func_vsnprintf_c99=no]) 141*2b15cb3dSCy Schubert AC_DEFINE([HAVE_VSNPRINTF], [1], 142*2b15cb3dSCy Schubert [Define if C99-compliant `vsnprintf' is available.]) 143*2b15cb3dSCy Schubert AC_MSG_CHECKING([if C99-snprintf replacement vsnprintf will be used]) 144*2b15cb3dSCy Schubert AS_IF([test "${hw_force_rpl_vsnprintf=no}" = yes -o "$hw_cv_func_vsnprintf_c99" = no], 145*2b15cb3dSCy Schubert [hw_use_rpl_vsnprintf=yes], 146*2b15cb3dSCy Schubert [hw_use_rpl_vsnprintf=no]) 147*2b15cb3dSCy Schubert AC_MSG_RESULT([$hw_use_rpl_vsnprintf]) 148*2b15cb3dSCy Schubert AS_IF([test "$hw_use_rpl_vsnprintf" = yes], 149*2b15cb3dSCy Schubert [AC_DEFINE([HW_WANT_RPL_VSNPRINTF], [1], 150*2b15cb3dSCy Schubert [Define to provide `rpl_vsnprintf' function.]) 151*2b15cb3dSCy Schubert AS_IF([test ${hw_nodef_vsnprintf=no} = no], 152*2b15cb3dSCy Schubert [AC_DEFINE([vsnprintf], [rpl_vsnprintf], 153*2b15cb3dSCy Schubert [Define to rpl_vsnprintf if the replacement function should be used.])]) 154*2b15cb3dSCy Schubert AC_CHECK_HEADERS([inttypes.h locale.h stddef.h stdint.h]) 155*2b15cb3dSCy Schubert AC_CHECK_MEMBERS([struct lconv.decimal_point, struct lconv.thousands_sep], 156*2b15cb3dSCy Schubert [], [], [#include <locale.h>]) 157*2b15cb3dSCy Schubert AC_TYPE_LONG_DOUBLE 158*2b15cb3dSCy Schubert AC_TYPE_LONG_LONG_INT 159*2b15cb3dSCy Schubert AC_TYPE_UNSIGNED_LONG_LONG_INT 160*2b15cb3dSCy Schubert AC_TYPE_SIZE_T 161*2b15cb3dSCy Schubert AC_TYPE_INTMAX_T 162*2b15cb3dSCy Schubert AC_TYPE_UINTMAX_T 163*2b15cb3dSCy Schubert AC_TYPE_UINTPTR_T 164*2b15cb3dSCy Schubert AC_CHECK_TYPES([ptrdiff_t]) 165*2b15cb3dSCy Schubert AC_CHECK_FUNCS([localeconv]) 166*2b15cb3dSCy Schubert _HW_FUNC_XPRINTF_REPLACE]) 167*2b15cb3dSCy Schubert])# HW_FUNC_VSNPRINTF 168*2b15cb3dSCy Schubert 169*2b15cb3dSCy Schubert# HW_FUNC_SNPRINTF 170*2b15cb3dSCy Schubert# ---------------- 171*2b15cb3dSCy Schubert# Set $hw_cv_func_snprintf and $hw_cv_func_snprintf_c99 to "yes" or 172*2b15cb3dSCy Schubert# "no", respectively. If either $hw_force_rpl_snprintf is "yes" or 173*2b15cb3dSCy Schubert# $hw_cv_func_snprintf_c99 is "no", define HW_WANT_RPL_SNPRINTF and 174*2b15cb3dSCy Schubert# define snprintf to rpl_snprintf. 175*2b15cb3dSCy Schubert# The same will be done for vsnprintf, as if HW_FUNC_VSNPRINTF were 176*2b15cb3dSCy Schubert# used. 177*2b15cb3dSCy SchubertAC_DEFUN([HW_FUNC_SNPRINTF], 178*2b15cb3dSCy Schubert[ 179*2b15cb3dSCy Schubert AC_REQUIRE([HW_FUNC_VSNPRINTF])dnl Our snprintf(3) calls vsnprintf(3). 180*2b15cb3dSCy Schubert AC_CHECK_FUNC([snprintf], 181*2b15cb3dSCy Schubert [hw_cv_func_snprintf=yes], 182*2b15cb3dSCy Schubert [hw_cv_func_snprintf=no]) 183*2b15cb3dSCy Schubert AS_IF([test "$hw_cv_func_snprintf" = yes], 184*2b15cb3dSCy Schubert [AC_CACHE_CHECK([whether snprintf is C99 compliant], 185*2b15cb3dSCy Schubert [hw_cv_func_snprintf_c99], 186*2b15cb3dSCy Schubert [AC_RUN_IFELSE( 187*2b15cb3dSCy Schubert [AC_LANG_PROGRAM([[#include <stdio.h>]], 188*2b15cb3dSCy Schubert [[char buf[43]; 189*2b15cb3dSCy Schubert if (snprintf(buf, 4, "The answer is %27.2g.", 42.0) != 42 || 190*2b15cb3dSCy Schubert snprintf(buf, 0, "No, it's %32zu.", (size_t)42) != 42 || 191*2b15cb3dSCy Schubert buf[0] != 'T' || buf[3] != '\0') 192*2b15cb3dSCy Schubert return 1;]])], 193*2b15cb3dSCy Schubert [hw_cv_func_snprintf_c99=yes], 194*2b15cb3dSCy Schubert [hw_cv_func_snprintf_c99=no], 195*2b15cb3dSCy Schubert [hw_cv_func_snprintf_c99=no])])], 196*2b15cb3dSCy Schubert [hw_cv_func_snprintf_c99=no]) 197*2b15cb3dSCy Schubert AC_DEFINE([HAVE_SNPRINTF], [1], 198*2b15cb3dSCy Schubert [Define if C99-compliant `snprintf' is available.]) 199*2b15cb3dSCy Schubert AC_MSG_CHECKING([if C99-snprintf replacement snprintf will be used]) 200*2b15cb3dSCy Schubert AS_IF([test "${hw_force_rpl_snprintf=no}" = yes -o "$hw_cv_func_snprintf_c99" = no], 201*2b15cb3dSCy Schubert [hw_use_rpl_snprintf=yes], 202*2b15cb3dSCy Schubert [hw_use_rpl_snprintf=no]) 203*2b15cb3dSCy Schubert AC_MSG_RESULT([$hw_use_rpl_snprintf]) 204*2b15cb3dSCy Schubert AS_IF([test "$hw_use_rpl_snprintf" = yes], 205*2b15cb3dSCy Schubert [AC_DEFINE([HW_WANT_RPL_SNPRINTF], [1], 206*2b15cb3dSCy Schubert [Define to provide `rpl_snprintf' function.]) 207*2b15cb3dSCy Schubert AS_IF([test ${hw_nodef_snprintf=no} = no], 208*2b15cb3dSCy Schubert [AC_DEFINE([snprintf], [rpl_snprintf], 209*2b15cb3dSCy Schubert [Define to rpl_snprintf if the replacement function should be used.])]) 210*2b15cb3dSCy Schubert _HW_FUNC_XPRINTF_REPLACE]) 211*2b15cb3dSCy Schubert])# HW_FUNC_SNPRINTF 212*2b15cb3dSCy Schubert 213*2b15cb3dSCy Schubert# HW_FUNC_VASPRINTF 214*2b15cb3dSCy Schubert# ----------------- 215*2b15cb3dSCy Schubert# Set $hw_cv_func_vasprintf to "yes" or "no". If either 216*2b15cb3dSCy Schubert# $hw_force_rpl_vasprintf is "yes" or $hw_cv_func_vasprintf is "no", 217*2b15cb3dSCy Schubert# define HW_WANT_RPL_VASPRINTF and define vasprintf to rpl_vasprintf. 218*2b15cb3dSCy Schubert# The same will be done for vsnprintf, as if HW_FUNC_VSNPRINTF were 219*2b15cb3dSCy Schubert# used. 220*2b15cb3dSCy SchubertAC_DEFUN([HW_FUNC_VASPRINTF], 221*2b15cb3dSCy Schubert[ 222*2b15cb3dSCy Schubert AC_REQUIRE([HW_FUNC_VSNPRINTF])dnl Our vasprintf(3) calls vsnprintf(3). 223*2b15cb3dSCy Schubert AC_CHECK_FUNCS([vasprintf], 224*2b15cb3dSCy Schubert [hw_cv_func_vasprintf=yes], 225*2b15cb3dSCy Schubert [hw_cv_func_vasprintf=no]) 226*2b15cb3dSCy Schubert AC_DEFINE([HAVE_VASPRINTF], [1], 227*2b15cb3dSCy Schubert [Define if `vasprintf' is available.]) 228*2b15cb3dSCy Schubert AC_MSG_CHECKING([if C99-snprintf replacement vasprintf will be used]) 229*2b15cb3dSCy Schubert AS_IF([test "${hw_force_rpl_vasprintf=no}" = yes -o "$hw_cv_func_vasprintf" = no], 230*2b15cb3dSCy Schubert [hw_use_rpl_vasprintf=yes], 231*2b15cb3dSCy Schubert [hw_use_rpl_vasprintf=no]) 232*2b15cb3dSCy Schubert AC_MSG_RESULT([$hw_use_rpl_vasprintf]) 233*2b15cb3dSCy Schubert AS_IF([test "$hw_use_rpl_vasprintf" = yes], 234*2b15cb3dSCy Schubert [AC_DEFINE([HW_WANT_RPL_VASPRINTF], [1], 235*2b15cb3dSCy Schubert [Define to provide `rpl_vasprintf' function.]) 236*2b15cb3dSCy Schubert AS_IF([test ${hw_nodef_vasprintf=no} = no], 237*2b15cb3dSCy Schubert [AC_DEFINE([vasprintf], [rpl_vasprintf], 238*2b15cb3dSCy Schubert [Define to rpl_vasprintf if the replacement function should be used.])]) 239*2b15cb3dSCy Schubert AC_CHECK_HEADERS([stdlib.h]) 240*2b15cb3dSCy Schubert HW_FUNC_VA_COPY 241*2b15cb3dSCy Schubert AS_IF([test "$hw_cv_func_va_copy" = no], 242*2b15cb3dSCy Schubert [HW_FUNC___VA_COPY]) 243*2b15cb3dSCy Schubert _HW_FUNC_XPRINTF_REPLACE]) 244*2b15cb3dSCy Schubert])# HW_FUNC_VASPRINTF 245*2b15cb3dSCy Schubert 246*2b15cb3dSCy Schubert# HW_FUNC_ASPRINTF 247*2b15cb3dSCy Schubert# ---------------- 248*2b15cb3dSCy Schubert# Set $hw_cv_func_asprintf to "yes" or "no". If either 249*2b15cb3dSCy Schubert# $hw_force_rpl_asprintf is "yes" or $hw_cv_func_asprintf is "no", 250*2b15cb3dSCy Schubert# define HW_WANT_RPL_ASPRINTF and define asprintf to rpl_asprintf. 251*2b15cb3dSCy Schubert# The same will be done for vasprintf, as if HW_FUNC_VASPRINTF were 252*2b15cb3dSCy Schubert# used. 253*2b15cb3dSCy SchubertAC_DEFUN([HW_FUNC_ASPRINTF], 254*2b15cb3dSCy Schubert[ 255*2b15cb3dSCy Schubert AC_REQUIRE([HW_FUNC_VASPRINTF])dnl Our asprintf(3) calls vasprintf(3). 256*2b15cb3dSCy Schubert AC_CHECK_FUNCS([asprintf], 257*2b15cb3dSCy Schubert [hw_cv_func_asprintf=yes], 258*2b15cb3dSCy Schubert [hw_cv_func_asprintf=no]) 259*2b15cb3dSCy Schubert AC_DEFINE([HAVE_ASPRINTF], [1], 260*2b15cb3dSCy Schubert [Define if `asprintf' is available.]) 261*2b15cb3dSCy Schubert AC_MSG_CHECKING([if C99-snprintf replacement asprintf will be used]) 262*2b15cb3dSCy Schubert AS_IF([test "${hw_force_rpl_asprintf=no}" = yes -o "$hw_cv_func_asprintf" = no], 263*2b15cb3dSCy Schubert [hw_use_rpl_asprintf=yes], 264*2b15cb3dSCy Schubert [hw_use_rpl_asprintf=no]) 265*2b15cb3dSCy Schubert AC_MSG_RESULT([$hw_use_rpl_asprintf]) 266*2b15cb3dSCy Schubert AS_IF([test "$hw_use_rpl_asprintf" = yes], 267*2b15cb3dSCy Schubert [AC_DEFINE([HW_WANT_RPL_ASPRINTF], [1], 268*2b15cb3dSCy Schubert [Define to provide `rpl_asprintf' function.]) 269*2b15cb3dSCy Schubert AS_IF([test ${hw_nodef_asprintf=no} = no], 270*2b15cb3dSCy Schubert [AC_DEFINE([asprintf], [rpl_asprintf], 271*2b15cb3dSCy Schubert [Define to rpl_asprintf if the replacement function should be used.])]) 272*2b15cb3dSCy Schubert _HW_FUNC_XPRINTF_REPLACE]) 273*2b15cb3dSCy Schubert])# HW_FUNC_ASPRINTF 274*2b15cb3dSCy Schubert 275*2b15cb3dSCy Schubert# _HW_FUNC_XPRINTF_REPLACE 276*2b15cb3dSCy Schubert# ------------------------ 277*2b15cb3dSCy Schubert# Arrange for building snprintf.c. Must be called if one or more of the 278*2b15cb3dSCy Schubert# functions provided by snprintf.c are needed. 279*2b15cb3dSCy SchubertAC_DEFUN([_HW_FUNC_XPRINTF_REPLACE], 280*2b15cb3dSCy Schubert[ 281*2b15cb3dSCy Schubert AS_IF([test "x$_hw_cv_func_xprintf_replace_done" != xyes], 282*2b15cb3dSCy Schubert [AC_C_CONST 283*2b15cb3dSCy Schubert HW_HEADER_STDARG_H 284*2b15cb3dSCy Schubert AC_LIBOBJ([snprintf]) 285*2b15cb3dSCy Schubert _hw_cv_func_xprintf_replace_done=yes]) 286*2b15cb3dSCy Schubert])# _HW_FUNC_XPRINTF_REPLACE 287*2b15cb3dSCy Schubert 288*2b15cb3dSCy Schubertdnl vim: set joinspaces textwidth=80: 289