autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_FUNC_FSEEKO and optional execution


From: Eric Blake
Subject: Re: AC_FUNC_FSEEKO and optional execution
Date: Mon, 23 Mar 2009 05:10:23 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Russ Allbery on 3/22/2009 1:18 PM:
> Currently, this is done with:
> 
>     AC_FUNC_FSEEKO
>     if test x"$ac_cv_func_fseeko" != xyes ; then
>         INN_TYPE_FPOS_T_LARGE
>         AC_CHECK_DECLS([fseeko, ftello])
>         AC_LIBOBJ([fseeko])
>         AC_LIBOBJ([ftello])
>     fi
> 
> This stopped working with recent Autoconf (I think around 2.62, but I
> could be wrong).  AC_FUNC_FSEEKO used to set ac_cv_func_fseeko but
> stopped; now ac_cv_sys_largefile_source is set instead (and not to
> something as simple as yes or no).

AC_FUNC_FSEEKO was rewritten for 2.61, but a typo rendered it broken in
that release, so it didn't work again until 2.62.

> 
> This is exactly why I hate relying on cache variables.  :)

Relying on documented cache variables is fine.  But you are correct that
relying on undocumented cache variables tends to be problematic.

> 
> Could AC_FUNC_FSEEKO acquire ACTION_IF_FOUND and ACTION_IF_NOT_FOUND
> arguments so that I can implement this conditional probing and AC_LIBOBJ
> calls in a sane fashion without relying on undocumented and unsupported
> macro internals?

Why not ditch AC_FUNC_FSEEKO, and write a portable variant yourself?

AC_DEFUN([INN_FSEEKO],
[AC_REQUIRE([AC_SYS_LARGEFILE])dnl
AC_CACHE_CHECK([for fseeko], [inn_cv_func_fseeko],
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h> /* for off_t */
#include <stdio.h>
]], [[int (*fp) (FILE *, off_t, int) = fseeko;
      return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);]])]
  [inn_cv_func_fseeko=yes], [inn_cv_func_fseeko=no])])
if test x"$inn_cv_func_fseeko" != xyes ; then
  INN_TYPE_FPOS_T_LARGE
  AC_CHECK_DECLS([fseeko, ftello])
  AC_LIBOBJ([fseeko])
  AC_LIBOBJ([ftello])
fi
])

That said, if others agree with you that exporting ac_cv_func_fseeko for
compatibility is still worthwhile (it was dropped in commit 90fcd46
autoconf 2.60a-37), then we could probably modify AC_FUNC_FSEEKO to once
again set that variable to yes or no for 2.64 and beyond.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAknHbh8ACgkQ84KuGfSFAYA6OwCfeVoku0/b2IEcg8rVqY8Ha6zW
Mr8AoKx/OPW3jJJ5t4xsHZr1wk3wyE6b
=iKXx
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]