From 6b94589fa407c0cd3b4ee718cf2511308ae1421c Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 2 Dec 2000 18:02:05 +0000 Subject: *** empty log message *** --- m4/off_t-format.m4 | 82 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 37 deletions(-) (limited to 'm4') diff --git a/m4/off_t-format.m4 b/m4/off_t-format.m4 index 7eba1d371..7d5e86600 100644 --- a/m4/off_t-format.m4 +++ b/m4/off_t-format.m4 @@ -3,44 +3,52 @@ dnl FIXME AC_DEFUN(jm_SYS_OFF_T_PRINTF_FORMAT, [dnl - AC_CHECK_HEADERS(string.h stdlinb.h) - AC_CACHE_CHECK([for printf format that works with type off_t], - jm_cv_sys_off_t_printf_format, - [ - for jm_fmt in '' L ll q; do - jm_OFF_T_FORMAT="$jm_fmt" - export jm_OFF_T_FORMAT - AC_TRY_RUN([ -# include -# include -# if HAVE_STDLIB_H -# include -# endif -# if HAVE_STRING_H -# include -# endif - int - main() - { - static off_t x[] = {1, 255, 65535, 99999999}; - char buf[50], fmt[50]; + AC_CHECK_HEADERS(string.h stdlinb.h) + AC_CACHE_CHECK([for printf format that works with type off_t], + jm_cv_sys_off_t_printf_format, + [ + jm_cv_sys_off_t_printf_format=undef + for jm_fmt in '' L ll q; do + jm_OFF_T_FORMAT="$jm_fmt" + export jm_OFF_T_FORMAT + AC_TRY_RUN([ +# include +# include +# if HAVE_STDLIB_H +# include +# endif +# if HAVE_STRING_H +# include +# endif + int + main() + { + static off_t x[] = {1, 255, 65535, 99999999}; + char buf[50], fmt[50]; - /* this should be one of these values: "", "L", "ll", "q" */ - char *f = getenv ("jm_OFF_T_FORMAT"); + /* this should be one of these values: "", "L", "ll", "q" */ + char *f = getenv ("jm_OFF_T_FORMAT"); - sprintf (fmt, "%%%sd %%%sx %%%sx %%%sd", f, f, f, f); - sprintf (buf, fmt, x[0], x[1], x[2], x[3]); - exit (strcmp (buf, "1 ff ffff 99999999")); - } - ], jm_cv_sys_off_t_printf_format=$jm_fmt; break - , jm_cv_sys_off_t_printf_format=no dnl The library version does NOT work. - , jm_cv_sys_off_t_printf_format=no dnl We're cross compiling. - ) - done - ]) - fi + sprintf (fmt, "%%%sd %%%sx %%%sx %%%sd", f, f, f, f); + sprintf (buf, fmt, x[0], x[1], x[2], x[3]); + exit (strcmp (buf, "1 ff ffff 99999999")); + } + ], jm_cv_sys_off_t_printf_format=$jm_fmt; break + , dnl didn't work + dnl Cross compiling -- you lose. Specify it via the cache. + ) + done - if test $am_cv_func_working_getline = no; then - AC_LIBOBJ(getline) - fi + # Die if none of the above worked. + # FIXME: If this failure become a problem that we can't work around, + # an alternative would be to arrange not to build od. + if test $jm_cv_sys_off_t_printf_format = undef; then + AC_MSG_ERROR(dnl + [couldn't find a printf format that works with the type, off_t]) + fi + ]) + + AC_DEFINE_UNQUOTED(OFF_T_PRINTF_FORMAT_STRING, + "$jm_cv_sys_off_t_printf_format", + [printf format string for type off_t, without the `%']); ]) -- cgit v1.2.3-70-g09d2