[Nauty] Patch for autoconf 2.72

dimpase at cs.ox.ac.uk dimpase at cs.ox.ac.uk
Sat Apr 27 05:01:50 AEST 2024


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@

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <https://mailman.anu.edu.au/pipermail/nauty/attachments/20240426/4f398220/attachment-0001.sig>


More information about the Nauty mailing list