Modernize the build system so it builds on current toolchains

The autotools setup could not bootstrap with modern autoconf/libtool:
`autoreconf -fi` failed with "possibly undefined macro: AC_PROG_LIBTOOL",
and several other macros used here were removed or deprecated long ago.

configure.ac:
  - AC_PROG_LIBTOOL -> LT_INIT (with AC_CONFIG_MACRO_DIRS/AC_CONFIG_AUX_DIR);
    add AM_PROG_AR required by newer libtool/automake.
  - AM_CONFIG_HEADER -> AC_CONFIG_HEADERS; AC_OUTPUT(files...) -> AC_OUTPUT
    with an explicit AC_CONFIG_FILES list.
  - AC_TRY_COMPILE -> AC_COMPILE_IFELSE; drop AC_HEADER_STDC,
    AC_PROG_GCC_TRADITIONAL, AC_STRUCT_ST_RDEV, AC_C_CONST and AC_C_INLINE
    (all obsolete or unconditionally available).
  - Drop AC_FUNC_MEMCMP/STRFTIME/VPRINTF; the corresponding HAVE_* macros
    were never referenced. Keep the register_printf_* check but test the
    ac_cv_func_* names that AC_CHECK_FUNCS actually sets.
  - Pin -std=gnu11 (the sources predate C99 and rely on implicit-int-era
    behaviour that newer C standards reject) and fix the -Wuninitialized
    probe, which never set its cache variable.
  - off_t/blkcnt_t sizeof fallbacks 64 -> 8 (bytes, not bits).

reiserfscore.pc.in: substitute @PACKAGE_VERSION@; REISERFSPROGS_VERSION was
never defined, so the generated .pc always carried an empty Version.

lib/parse_time.c: define _GNU_SOURCE, not _XOPEN_SOURCE. The valueless
_XOPEN_SOURCE disables _DEFAULT_SOURCE, which hides loff_t in <sys/types.h>
and broke the build. Every other translation unit already uses _GNU_SOURCE.

reiserfscore/xattr.c: drop the unused <sys/acl.h> include; no libacl symbol
is used (the reiserfs_acl_* structs come from reiserfs_fs.h), and the header
is not a declared build dependency.

Add autogen.sh to regenerate the build system after a fresh clone, and
update .gitignore for the build-aux/m4 layout and generated artifacts.

Verified: ./autogen.sh && ./configure && make completes on gcc 16 /
automake 1.18 / autoconf 2.72. mkreiserfs, reiserfsck --check,
debugreiserfs -S and reiserfstune all run against a freshly formatted
64 MiB image.
This commit is contained in:
lgcosta committed 2026-11-11 21:29:42 -03:00
1 parent f97d2e9dd7
commit d3925f1521
6 files changed
+114 -71

No files matched your search

+31 -9
View File
@@ -1,32 +1,54 @@
# Editor / OS cruft
*~
*.[ao]
*.8
core
tags
# Autotools generated files (run ./autogen.sh to regenerate)
INSTALL
Makefile.in
aclocal.m4
autom4te.cache/
compile
config.guess
config.sub
config.h.in
configure
depcomp
config.h.in
install-sh
missing
aclocal.m4
autom4te.cache
tags
.pc
ltmain.sh
ar-lib
/build-aux/
/m4/
# configure / make output
Makefile
.deps
.deps/
.libs/
*.o
*.a
*.lo
*.la
config.log
config.status
config.h
include/config.h
include/credits.h
include/stamp-h1
libtool
reiserfscore/reiserfs_err.c
reiserfscore/reiserfs_err.h
reiserfscore/reiserfscore.pc
reiserfsprogs-*.tar.*
# Generated man pages (from *.8.in)
*.8
# Built programs
/debugreiserfs/debugreiserfs
/fsck/reiserfsck
/mkreiserfs/mkreiserfs
/resize_reiserfs/resize_reiserfs
/tune/reiserfstune
# Release tarballs
reiserfsprogs-*.tar.*
Executable
+14
View File
@@ -0,0 +1,14 @@
#!/bin/sh
# Regenerate the autotools build system (configure, Makefile.in, ...).
# Run this after a fresh clone; release tarballs ship the generated files.
set -e
srcdir=$(dirname "$0")
cd "$srcdir"
mkdir -p m4 build-aux
autoreconf -fi
echo
echo "Now run ./configure && make"
+67 -59
View File
@@ -1,68 +1,79 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT([reiserfsprogs], [3.6.25], [reiserfs-devel@vger.kernel.org])
AC_CANONICAL_HOST
AC_PREREQ(2.50)
AC_PREREQ([2.64])
AC_CONFIG_MACRO_DIRS([m4])
AC_CONFIG_AUX_DIR([build-aux])
AH_TEMPLATE([HAVE_LIBUUID], [Define for enable libuuid using.])
AM_INIT_AUTOMAKE([1.11.1 dist-xz silent-rules])
AM_INIT_AUTOMAKE([1.11.1 foreign dist-xz silent-rules subdir-objects])
AM_SILENT_RULES([yes])
AM_MAINTAINER_MODE
dnl We install in /sbin, the utils are to be available on boot
dnl AC_PREFIX(/)
AM_CONFIG_HEADER(include/config.h)
AC_CONFIG_HEADERS([include/config.h])
dnl Checks for programs.
AC_PROG_CC
AC_PROG_AWK
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AM_PROG_AR
dnl libtool, replaces the long-obsolete AC_PROG_LIBTOOL
LT_INIT
dnl Checks for libraries.
# Check for LIBUUID
AC_CHECK_LIB(uuid, uuid_generate, , AC_MSG_WARN(libuuid could not be found))
AC_CHECK_LIB([uuid], [uuid_generate], [], [AC_MSG_WARN([libuuid could not be found])])
UUID_LIBS="$LIBS"
AC_SUBST(UUID_LIBS)
AC_SUBST([UUID_LIBS])
AC_CHECK_LIB(com_err, _et_list, , AC_MSG_ERROR(libcom_err could not be found))
AC_CHECK_LIB([com_err], [_et_list], [], [AC_MSG_ERROR([libcom_err could not be found])])
COM_ERR_LIBS="$LIBS"
AC_SUBST(COM_ERR_LIBS)
AC_SUBST([COM_ERR_LIBS])
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/ioctl.h unistd.h uuid/uuid.h)
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h sys/ioctl.h unistd.h uuid/uuid.h])
AC_HEADER_MAJOR
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_STRUCT_ST_RDEV
dnl Use a deterministic language level: the code predates C99 and C23
dnl removes constructs (e.g. implicit int in some spots) it relies on.
AC_MSG_CHECKING([whether $CC accepts -std=gnu11])
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -std=gnu11"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no]); CFLAGS="$saved_CFLAGS"])
# Checking for compiler warning options
AC_CACHE_CHECK([whether -Wuninitialized works], [ac_cv_wuninitialized_flag], [
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-O1 -Wuninitialized"
AC_TRY_COMPILE(, , [ac_cv_wuninitialized_flag=yes], [ac_cv_wuninitialized_flag=no])
CPPFLAGS="$saved_CPPFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[ac_cv_wuninitialized_flag=yes], [ac_cv_wuninitialized_flag=no])
])
AC_CACHE_CHECK([whether -Wno-unused-parameter works], [ac_cv_wno_unused_parameter_flag], [
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-Wno-unused-parameter"
AC_TRY_COMPILE(, , [ac_cv_wno_unused_parameter_flag=yes], [ac_cv_wno_unused_parameter_flag=no])
CPPFLAGS="$CPPFLAGS -Wno-unused-parameter"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[ac_cv_wno_unused_parameter_flag=yes], [ac_cv_wno_unused_parameter_flag=no])
CPPFLAGS="$saved_CPPFLAGS"
])
AC_CACHE_CHECK([whether -Wredundant-decls works], [ac_cv_wredundant_decls_flag], [
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-Wredundant-decls"
AC_TRY_COMPILE(, , [ac_cv_wredundant_decls_flag=yes], [ac_cv_wredundant_decls_flag=no])
CPPFLAGS="$CPPFLAGS -Wredundant-decls"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[ac_cv_wredundant_decls_flag=yes], [ac_cv_wredundant_decls_flag=no])
CPPFLAGS="$saved_CPPFLAGS"
])
@@ -70,77 +81,74 @@ AC_CACHE_CHECK([whether -Wredundant-decls works], [ac_cv_wredundant_decls_flag],
AC_SYS_LARGEFILE
if test -z "${ac_cv_sys_file_offset_bits}"; then
AC_MSG_WARN(Can't detect right _FILE_OFFSET_BITS. Will be forced to 64bit.)
AC_MSG_WARN([Can't detect right _FILE_OFFSET_BITS. Will be forced to 64bit.])
ac_cv_sys_file_offset_bits=64
fi
AC_CHECK_SIZEOF(off_t, 64, [
AC_CHECK_SIZEOF([off_t], [8], [
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <unistd.h>
])
AC_CHECK_SIZEOF(blkcnt_t, 64, [
AC_CHECK_SIZEOF([blkcnt_t], [8], [
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <unistd.h>
])
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(strerror strstr strtol statfs getmntent hasmntopt memset time \
uname strptime ctime_r register_printf_modifier \
register_printf_specifier)
AC_CHECK_FUNCS([strerror strstr strtol statfs getmntent hasmntopt memset time \
uname strptime ctime_r register_printf_modifier \
register_printf_specifier])
if test -z "${ac_cv_func_register_printf_function}" -a -z "${ac_cv_func_register_printf_specifier}"; then
AC_MSG_ERROR(reiserfsprogs requires a method to add printf modifiers)
if test "x$ac_cv_func_register_printf_specifier" != xyes -a \
"x$ac_cv_func_register_printf_modifier" != xyes; then
AC_MSG_ERROR([reiserfsprogs requires a method to add printf modifiers])
fi
dnl Never enable this. It is for debugging only
AC_ARG_ENABLE(io-failure-emulation,
AC_ARG_ENABLE([io-failure-emulation],
[AS_HELP_STRING([--enable-io-failure-emulation], [Never use this. It is for debugging only])])
if test "$enable_io_failure_emulation" = "yes" ; then
AC_MSG_WARN([Careful! IO failure emulation is ON])
AC_DEFINE(IO_FAILURE_EMULATION, 1, [gets set when configure --enable-io-failure-emulation])
AC_DEFINE([IO_FAILURE_EMULATION], [1], [gets set when configure --enable-io-failure-emulation])
fi
if test "x$ac_cv_wno_unused_parameter_flag" = xyes; then
CFLAGS="$CFLAGS -Wno-unused-parameter"
else
CFLAGS="$CFLAGS -Wno-unused"
fi
if test "x$ac_cv_wredundant_decls_flag" = xyes; then
CFLAGS="$CFLAGS -Wredundant-decls"
fi
if test "x$ac_cv_wuninitialized_flag" = xyes; then
CFLAGS="$CFLAGS -Wuninitialized"
fi
CPPFLAGS="-I\$(top_srcdir)/include $CPPFLAGS"
AC_OUTPUT(
include/Makefile
mkreiserfs/Makefile
mkreiserfs/mkreiserfs.8
resize_reiserfs/Makefile
resize_reiserfs/resize_reiserfs.8
fsck/Makefile
fsck/reiserfsck.8
lib/Makefile
Makefile
reiserfscore/Makefile
reiserfscore/reiserfscore.pc
debugreiserfs/Makefile
debugreiserfs/debugreiserfs.8
tune/Makefile
tune/reiserfstune.8
)
AC_CONFIG_FILES([
Makefile
include/Makefile
lib/Makefile
reiserfscore/Makefile
reiserfscore/reiserfscore.pc
fsck/Makefile
fsck/reiserfsck.8
mkreiserfs/Makefile
mkreiserfs/mkreiserfs.8
debugreiserfs/Makefile
debugreiserfs/debugreiserfs.8
resize_reiserfs/Makefile
resize_reiserfs/resize_reiserfs.8
tune/Makefile
tune/reiserfstune.8
])
AC_OUTPUT
AC_MSG_NOTICE([
+1 -1
View File
@@ -1,4 +1,4 @@
#define _XOPEN_SOURCE
#define _GNU_SOURCE
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+1 -1
View File
@@ -5,6 +5,6 @@ includedir=@includedir@
Name: reiserfscore
Description: ReiserFS Core Library
Version: @REISERFSPROGS_VERSION@
Version: @PACKAGE_VERSION@
Cflags: -I${includedir}/reiserfs -I${includedir}
Libs: -L${libdir} -lreiserfscore
-1
View File
@@ -1,7 +1,6 @@
#include <sys/types.h>
#include <stdio.h>
#include <errno.h>
#include <sys/acl.h>
#include "reiserfs_lib.h"
static inline unsigned short from32to16(unsigned int x)