From c71cc3d9caa830bea91cf82c60f2d912e66aa9d5 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 29 Sep 2025 11:19:59 +0200 Subject: Update deprecated autoconf macros and automatically derive version number from latest git tag --- autogen.sh | 6 ++++++ configure.ac | 18 ++++++++++++------ git-version-gen | 20 ++++++++++++++++++++ 3 files changed, 38 insertions(+), 6 deletions(-) create mode 100755 git-version-gen diff --git a/autogen.sh b/autogen.sh index 1247057..da46cbc 100755 --- a/autogen.sh +++ b/autogen.sh @@ -7,6 +7,12 @@ test -z "$srcdir" && srcdir=. ( cd "$srcdir" + gprefix=`which glibtoolize 2>&1 >/dev/null` + if [ $? -eq 0 ]; then + glibtoolize --force + else + libtoolize --force + fi aclocal autoheader automake --add-missing diff --git a/configure.ac b/configure.ac index f30e7d9..5eb827e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,16 +1,22 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_PREREQ(2.64) -AC_INIT([ifuse], [1.1.5], [https://github.com/libimobiledevice/ifuse/issues],, [https://libimobiledevice.org]) +AC_PREREQ(2.68) +AC_INIT([ifuse], [m4_esyscmd(./git-version-gen $RELEASE_VERSION)], [https://github.com/libimobiledevice/ifuse/issues],, [https://libimobiledevice.org]) AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip check-news]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) AC_CONFIG_SRCDIR([src/]) AC_CONFIG_HEADERS([config.h]) +# Check if we have a version defined +if test -z $PACKAGE_VERSION; then + AC_MSG_ERROR([PACKAGE_VERSION is not defined. Make sure to configure a source tree checked out from git or that .tarball-version is present.]) +fi + # Checks for programs. AC_PROG_CC AM_PROG_CC_C_O +LT_INIT # Checks for libraries. PKG_CHECK_MODULES(libimobiledevice, libimobiledevice-1.0 >= 1.3.0) @@ -18,8 +24,7 @@ PKG_CHECK_MODULES(libfuse, fuse3 >= 3.0.0) PKG_CHECK_MODULES(libplist, libplist-2.0 >= 2.2.0) # Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS([arpa/inet.h stdint.h stdlib.h string.h]) +AC_CHECK_HEADERS([stdint.h stdlib.h string.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -36,17 +41,18 @@ AC_CHECK_FUNCS([strcasecmp strdup strerror strndup]) m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) -AC_OUTPUT([ +AC_CONFIG_FILES([ Makefile src/Makefile docs/Makefile ]) +AC_OUTPUT echo " Configuration for $PACKAGE $VERSION: ------------------------------------------- - Install prefix ..........: $prefix + Install prefix: .........: $prefix Now type 'make' to build $PACKAGE $VERSION, and then 'make install' for installation. diff --git a/git-version-gen b/git-version-gen new file mode 100755 index 0000000..d868952 --- /dev/null +++ b/git-version-gen @@ -0,0 +1,20 @@ +#!/bin/sh +SRCDIR=`dirname $0` +if test -n "$1"; then + VER=$1 +else + if test -r "${SRCDIR}/.git" && test -x "`which git`" ; then + git update-index -q --refresh + if ! VER=`git describe --tags --dirty 2>/dev/null`; then + COMMIT=`git rev-parse --short HEAD` + DIRTY=`git diff --quiet HEAD || echo "-dirty"` + VER=`sed -n '1,/RE/s/Version \(.*\)/\1/p' ${SRCDIR}/NEWS`-git-${COMMIT}${DIRTY} + fi + else + if test -f "${SRCDIR}/.tarball-version"; then + VER=`cat "${SRCDIR}/.tarball-version"` + fi + fi +fi +VER=`printf %s "$VER" | head -n1` +printf %s "$VER" -- cgit v1.1-32-gdbae