[Nauty] Patch for autoconf 2.72
Brendan McKay
Brendan.McKay at anu.edu.au
Sat Apr 27 13:47:39 AEST 2024
Thanks, Jerry and Dima, for this information. I had already noticed the
problem with $ac_cv_sys_file_offset_bits being set to empty and
adopted Jerry's solution.
Regarding Dima's suggestions, I won't adopt them for two reasons.
One is that some people use nauty successfully with very old systems
and compilers that possibly do need _FILE_OFFSET_BITS and
_LARGEFILE_SOURCE and I don't want to break them. The other is
that $ac_cv_sys_largefile_opts is an undocumented internal variable
that didn't exist before autoconf 2.72 (I tested only 2.69) so it won't
work with older versions of autoconf and 2.72 is only months old.
It isn't even clear if $ac_cv_sys_largefile_opts will continue to exist
in future releases of autoconf.
What is omitted is the inclusion of a largefile compiler option in
the *.pc files. I wonder if there is a way to do that which works both
before and after 2.72.
Jerry, your information about the noreturn option is very useful and
I will adopt your suggestion. This option has so far been more trouble
than it is worth ;).
To readers who are wondering what this is all about: you don't need
autoconf to configure and compile nauty. You only need it if you
want to make your own changes to the configuration script.
Brendan.
On 27/4/2024 5:01 am, Dima Pasechnik via Nauty wrote:
> Dear all,
>
> On Fri, Apr 26, 2024 at 08:56:04AM -0600, Jerry James via Nauty wrote:
>> I maintain the nauty package for the Fedora Linux distribution. I
>> recently discovered that if the configure script is regenerated with
>> autoconf 2.72, the build fails on 64-bit architectures because
>> _FILE_OFFSET_BITS is defined to be the empty string. It looks like
>> AC_SYS_LARGEFILE was rewritten for autoconf 2.72, and now sets
>> ac_cv_sys_file_offset_bits to the empty string on 64-bit systems. I
>> would like to suggest this patch:
>>
>> --- configure.ac.orig
>> +++ configure.ac
>> @@ -191,6 +191,7 @@ MORECFLAGS=""
>> dnl we need AC_SYS_LARGEFILE and AC_FUNC_FSEEKO
>> AC_SYS_LARGEFILE
>> AS_IF([test "x$ac_cv_sys_file_offset_bits" =
>> xno],[ac_cv_sys_file_offset_bits=0])
>> +AS_IF([test "x$ac_cv_sys_file_offset_bits" =
>> x],[ac_cv_sys_file_offset_bits=64])
>> AC_SUBST(ac_cv_sys_file_offset_bits)
>>
>> dnl AS_IF([test "x$user_cflags" = x || test "x$user_cflags" = x-m32],
>>
>> The extra conditional should never evaluate to true for configure
>> scripts generated by autoconf < 2.72, and works around the issue for
>> autoconf >= 2.72.
> faced with the same issue on Gentoo Linux (which does use autoconf 2.72)
> one gets https://bugs.gentoo.org/921138
> To fix it I came up with a more extensive patch (which is autoconf 2.72+
> -only). In particular the _FILE_OFFSET_BITS and _LARGEFILE_SOURCE are
> not needed any more, and it makes nauty-h.in cleaner.
>
> HTH
> Dima
>
>
> https://gitweb.gentoo.org/repo/gentoo.git/tree/sci-mathematics/nauty/files/nauty-2.8.8-autoconf-2.72.patch
> diff --git a/configure.ac b/configure.ac
> index 5f28e30..69d42ff 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -186,9 +186,18 @@ dnl AC_PROG_CC
> dnl CFLAGS=$user_cflags
> MORECFLAGS=""
> dnl we need AC_SYS_LARGEFILE and AC_FUNC_FSEEKO
> +LARGEFILECFLAGS=""
> AC_SYS_LARGEFILE
> -AS_IF([test "x$ac_cv_sys_file_offset_bits" = xno],[ac_cv_sys_file_offset_bits=0])
> -AC_SUBST(ac_cv_sys_file_offset_bits)
> +dnl AS_IF([test "x$ac_cv_sys_file_offset_bits" = xno],[ac_cv_sys_file_offset_bits=0])
> +dnl AC_SUBST(ac_cv_sys_file_offset_bits
> +AS_CASE([$ac_cv_sys_largefile_opts],
> + ["none needed"], [],
> + ["support not detected"], [],
> + dnl otherwise it is a compiler flag
> + [LARGEFILECFLAGS="$ac_cv_sys_largefile_opts"]
> + )
> +MORECFLAGS="$LARGEFILECFLAGS"
> +AC_SUBST(LARGEFILECFLAGS)
>
> dnl AS_IF([test "x$user_cflags" = x || test "x$user_cflags" = x-m32],
> dnl [
> diff --git a/nauty-h.in b/nauty-h.in
> index ae65bc9..51508d9 100644
> --- a/nauty-h.in
> +++ b/nauty-h.in
> @@ -60,13 +60,6 @@ it is necessary to check they are correct.
> #define FLEX_ARRAY_OK @flex_array_ok@
> /* whether the compiler supports flexible array members in structures */
>
> -#define _FILE_OFFSET_BITS @ac_cv_sys_file_offset_bits@
> -#if _FILE_OFFSET_BITS == 64
> -#define _LARGEFILE_SOURCE
> -#else
> -#undef _FILE_OFFSET_BITS
> -#endif
> -
> /* Support of gcc extensions __builtin_clz, __builtin_clzl, __builtin_clzll */
> #ifndef HAVE_HWLZCNT
> #define HAVE_HWLZCNT @have_hwlzcnt@
> diff --git a/nauty-pc.in b/nauty-pc.in
> index cde86b3..c0bcef8 100644
> --- a/nauty-pc.in
> +++ b/nauty-pc.in
> @@ -9,4 +9,4 @@ Version: @PACKAGE_VERSION@
> URL: @PACKAGE_URL@
> Libs: -L${libdir} -l at PACKAGE@
> Libs.private: -lpthread
> -Cflags: -I${includedir}
> +Cflags: -I${includedir} @LARGEFILECFLAGS@
>
>
> _______________________________________________
> Nauty mailing list
> Nauty at anu.edu.au
> https://mailman.anu.edu.au/mailman/listinfo/nauty
More information about the Nauty
mailing list