[PATCH 2/6] Switch to using autoconf
David Howells
dhowells at redhat.com
Fri Mar 6 01:28:58 PST 2026
Switch to using autoconf rather than trying to magically divine whether
/usr/lib or /usr/lib64 should be used for the shared library.
Signed-off-by: David Howells <dhowells at redhat.com>
---
.gitignore | 16 +
Makefile => Makefile.in | 74 ++---
conf.h.in | 1 +
configure.ac | 15 +
install-sh | 541 ++++++++++++++++++++++++++++++++++
man/Makefile.in | 51 ++++
redhat/kafs-client.spec | 3 +-
src/Makefile.config | 63 ----
src/{Makefile => Makefile.in} | 45 ++-
src/aklog-kafs.c | 3 +-
10 files changed, 690 insertions(+), 122 deletions(-)
rename Makefile => Makefile.in (67%)
create mode 100644 conf.h.in
create mode 100644 configure.ac
create mode 100755 install-sh
create mode 100644 man/Makefile.in
delete mode 100644 src/Makefile.config
rename src/{Makefile => Makefile.in} (71%)
diff --git a/.gitignore b/.gitignore
index b69739a..de4ccd3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,5 +4,21 @@ kafs-preload
kafs-dns
*.o
*.os
+*~
libkafs_client.so*
TAGS
+autom4te.cache/
+conf.h
+config.log
+config.status
+configure
+man/aklog-kafs.1
+man/kafs-check-config.8
+man/kafs-client.conf.5
+man/kafs-dns.8
+man/kafs-preload.8
+man/kafs.7
+man/rxrpc.7
+rpmbuild/
+*/Makefile
+Makefile
diff --git a/Makefile b/Makefile.in
similarity index 67%
rename from Makefile
rename to Makefile.in
index 34598b5..fed4be6 100644
--- a/Makefile
+++ b/Makefile.in
@@ -1,40 +1,19 @@
-CFLAGS = -g -O2 -Wall -Wsign-compare
-MKDIR = mkdir
-INSTALL = install
+VERSION = @PACKAGE_VERSION@
+CFLAGS = @CPPFLAGS@ @CFLAGS@ -Wall -Wsign-compare
+MKDIR_P = @MKDIR_P@
+INSTALL = @INSTALL@
DESTDIR =
-ETCDIR = /etc
-BINDIR = /usr/bin
-LIBEXECDIR = /usr/libexec
-MANDIR = /usr/share/man
-DATADIR = /usr/share/kafs-client
-UNITDIR = /usr/lib/systemd/system
-SPECFILE = redhat/kafs-client.spec
+ETCDIR = @datadir@
+BINDIR = @bindir@
+LIBDIR = @libdir@
+LIBEXECDIR = @libexecdir@
+MANDIR = @mandir@
+DATADIR = @datarootdir@/kafs-client
+UNITDIR = @prefix@/lib/systemd/system
+TARBALL = kafs-client-$(VERSION).tar
+ZTARBALL = $(TARBALL).bz2
-LNS := ln -sf
-
-###############################################################################
-#
-# Determine the current package version from the specfile
-#
-###############################################################################
-VERSION := $(word 2,$(shell grep "^Version:" $(SPECFILE)))
-TARBALL := kafs-client-$(VERSION).tar
-ZTARBALL := $(TARBALL).bz2
-
-###############################################################################
-#
-# Guess at the appropriate word size
-#
-###############################################################################
-BUILDFOR := $(shell file /usr/bin/make | sed -e 's!.*ELF \(32\|64\)-bit.*!\1!')-bit
-
-ifeq ($(BUILDFOR),32-bit)
-CFLAGS += -m32
-else
-ifeq ($(BUILDFOR),64-bit)
-CFLAGS += -m64
-endif
-endif
+LN_S = @LN_S@
###############################################################################
#
@@ -43,33 +22,22 @@ endif
###############################################################################
all:
$(MAKE) -C src all
+ $(MAKE) -C man all
###############################################################################
#
# Install everything
#
###############################################################################
-MAN1 := $(MANDIR)/man1
-MAN5 := $(MANDIR)/man5
-MAN7 := $(MANDIR)/man7
-MAN8 := $(MANDIR)/man8
-
install: all
+ $(MAKE) -C man install
$(MAKE) -C src install
- $(MKDIR) -p -m755 $(DESTDIR)$(MAN1)/
- $(MKDIR) -p -m755 $(DESTDIR)$(MAN5)/
- $(MKDIR) -p -m755 $(DESTDIR)$(MAN7)/
- $(MKDIR) -p -m755 $(DESTDIR)$(MAN8)/
- $(INSTALL) -D -m 0644 man/*.1 $(DESTDIR)$(MAN1)/
- $(INSTALL) -D -m 0644 man/*.5 $(DESTDIR)$(MAN5)/
- $(INSTALL) -D -m 0644 man/*.7 $(DESTDIR)$(MAN7)/
- $(INSTALL) -D -m 0644 man/*.8 $(DESTDIR)$(MAN8)/
$(INSTALL) -D -m 0644 conf/cellservdb.conf $(DESTDIR)$(DATADIR)/cellservdb.conf
$(INSTALL) -D -m 0644 conf/client.conf $(DESTDIR)$(ETCDIR)/kafs/client.conf
$(INSTALL) -D -m 0644 conf/kafs_dns.conf $(DESTDIR)$(ETCDIR)/request-key.d/kafs_dns.conf
$(INSTALL) -D -m 0644 conf/kafs-config.service $(DESTDIR)$(UNITDIR)/kafs-config.service
$(INSTALL) -D -m 0644 conf/afs.mount $(DESTDIR)$(UNITDIR)/afs.mount
- $(MKDIR) -m755 $(DESTDIR)$(ETCDIR)/kafs/client.d
+ $(MKDIR_P) -m755 $(DESTDIR)$(ETCDIR)/kafs/client.d
###############################################################################
#
@@ -77,12 +45,18 @@ install: all
#
###############################################################################
clean:
- $(MAKE) -C src clean
$(RM) debugfiles.list debugsources.list
+ $(RM) *~
+ $(MAKE) -C man clean
+ $(MAKE) -C src clean
distclean: clean
+ $(MAKE) -C man distclean
$(MAKE) -C src distclean
$(RM) -r rpmbuild $(TARBALL)
+ $(RM) -r autom4te.cache
+ $(RM) conf.h config.log config.status configure
+ $(RM) man/Makefile src/Makefile Makefile
###############################################################################
#
diff --git a/conf.h.in b/conf.h.in
new file mode 100644
index 0000000..f277887
--- /dev/null
+++ b/conf.h.in
@@ -0,0 +1 @@
+#undef PACKAGE_VERSION
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..b11cdec
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,15 @@
+# Process this file with autoconf to produce a configure script.
+
+AC_INIT([kafs-client], [0.5])
+AC_PROG_CC
+AC_PROG_MKDIR_P
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_CONFIG_HEADERS([conf.h])
+AC_CONFIG_FILES(
+ Makefile
+ man/Makefile
+ src/Makefile
+)
+AC_OUTPUT
+
diff --git a/install-sh b/install-sh
new file mode 100755
index 0000000..73cbd67
--- /dev/null
+++ b/install-sh
@@ -0,0 +1,541 @@
+#!/usr/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2023-11-23.18; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# 'make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+tab=' '
+nl='
+'
+IFS=" $tab$nl"
+
+# Set DOITPROG to "echo" to test this script.
+
+doit=${DOITPROG-}
+doit_exec=${doit:-exec}
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+# Create dirs (including intermediate dirs) using mode 755.
+# This is like GNU 'install' as of coreutils 8.32 (2020).
+mkdir_umask=22
+
+backupsuffix=
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+is_target_a_directory=possibly
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -p pass -p to $cpprog.
+ -s $stripprog installed files.
+ -S SUFFIX attempt to back up existing files, with suffix SUFFIX.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
+
+By default, rm is invoked with -f; when overridden with RMPROG,
+it's up to you to specify -f if you want it.
+
+If -S is not specified, no backups are attempted.
+
+Report bugs to <bug-automake at gnu.org>.
+GNU Automake home page: <https://www.gnu.org/software/automake/>.
+General help using GNU software: <https://www.gnu.org/gethelp/>."
+
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
+
+ -C) copy_on_change=true;;
+
+ -d) dir_arg=true;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+ case $mode in
+ *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
+
+ -o) chowncmd="$chownprog $2"
+ shift;;
+
+ -p) cpprog="$cpprog -p";;
+
+ -s) stripcmd=$stripprog;;
+
+ -S) backupsuffix="$2"
+ shift;;
+
+ -t)
+ is_target_a_directory=always
+ dst_arg=$2
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ shift;;
+
+ -T) is_target_a_directory=never;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+ shift
+done
+
+# We allow the use of options -d and -T together, by making -d
+# take the precedence; this is for compatibility with GNU install.
+
+if test -n "$dir_arg"; then
+ if test -n "$dst_arg"; then
+ echo "$0: target directory not allowed when installing a directory." >&2
+ exit 1
+ fi
+fi
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ done
+fi
+
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call 'install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+if test -z "$dir_arg"; then
+ if test $# -gt 1 || test "$is_target_a_directory" = always; then
+ if test ! -d "$dst_arg"; then
+ echo "$0: $dst_arg: Is not a directory." >&2
+ exit 1
+ fi
+ fi
+fi
+
+if test -z "$dir_arg"; then
+ do_exit='(exit $ret); exit $ret'
+ trap "ret=129; $do_exit" 1
+ trap "ret=130; $do_exit" 2
+ trap "ret=141; $do_exit" 13
+ trap "ret=143; $do_exit" 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
+for src
+do
+ # Protect names problematic for 'test' and other utilities.
+ case $src in
+ -* | [=\(\)!]) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ # Don't chown directories that already exist.
+ if test $dstdir_status = 0; then
+ chowncmd=""
+ fi
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+ dst=$dst_arg
+
+ # If destination is a directory, append the input filename.
+ if test -d "$dst"; then
+ if test "$is_target_a_directory" = never; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dstbase=`basename "$src"`
+ case $dst in
+ */) dst=$dst$dstbase;;
+ *) dst=$dst/$dstbase;;
+ esac
+ dstdir_status=0
+ else
+ dstdir=`dirname "$dst"`
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ case $dstdir in
+ */) dstdirslash=$dstdir;;
+ *) dstdirslash=$dstdir/;;
+ esac
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ # The $RANDOM variable is not portable (e.g., dash). Use it
+ # here however when possible just to lower collision chance.
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+
+ trap '
+ ret=$?
+ rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
+ exit $ret
+ ' 0
+
+ # Because "mkdir -p" follows existing symlinks and we likely work
+ # directly in world-writeable /tmp, make sure that the '$tmpdir'
+ # directory is successfully created first before we actually test
+ # 'mkdir -p'.
+ if (umask $mkdir_umask &&
+ $mkdirprog $mkdir_mode "$tmpdir" &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ test_tmpdir="$tmpdir/a"
+ ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
+ fi
+ trap '' 0;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix='/';;
+ [-=\(\)!]*) prefix='./';;
+ *) prefix='';;
+ esac
+
+ oIFS=$IFS
+ IFS=/
+ set -f
+ set fnord $dstdir
+ shift
+ set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test X"$d" = X && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=${dstdirslash}_inst.$$_
+ rmtmp=${dstdirslash}_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask &&
+ { test -z "$stripcmd" || {
+ # Create $dsttmp read-write so that cp doesn't create it read-only,
+ # which would cause strip to fail.
+ if test -z "$doit"; then
+ : >"$dsttmp" # No need to fork-exec 'touch'.
+ else
+ $doit touch "$dsttmp"
+ fi
+ }
+ } &&
+ $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+ set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ set +f &&
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # If $backupsuffix is set, and the file being installed
+ # already exists, attempt a backup. Don't worry if it fails,
+ # e.g., if mv doesn't support -f.
+ if test -n "$backupsuffix" && test -f "$dst"; then
+ $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
+ fi
+
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
+
+# Local variables:
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/man/Makefile.in b/man/Makefile.in
new file mode 100644
index 0000000..2805219
--- /dev/null
+++ b/man/Makefile.in
@@ -0,0 +1,51 @@
+PACKAGE = @PACKAGE_NAME@
+VERSION = @PACKAGE_VERSION@
+DESTDIR =
+DATADIR = @datarootdir@/kafs-client
+MANDIR = @mandir@
+MAN1 = $(MANDIR)/man1
+MAN5 = $(MANDIR)/man5
+MAN7 = $(MANDIR)/man7
+MAN8 = $(MANDIR)/man8
+MKDIR_P = @MKDIR_P@
+
+PODS1 := \
+ aklog-kafs.pod
+PODS5 := \
+ kafs-client.conf.pod
+PODS7 := \
+ kafs.pod \
+ rxrpc.pod
+PODS8 := \
+ kafs-check-config.pod \
+ kafs-dns.pod \
+ kafs-preload.pod
+
+MANPAGES1 := $(patsubst %.pod,%.1,$(PODS1))
+MANPAGES5 := $(patsubst %.pod,%.5,$(PODS5))
+MANPAGES7 := $(patsubst %.pod,%.7,$(PODS7))
+MANPAGES8 := $(patsubst %.pod,%.8,$(PODS8))
+
+%.1: %.pod
+ pod2man --release=$(VERSION) --section=1 --center=$(PACKAGE) $< >$@
+%.5: %.pod
+ pod2man --release=$(VERSION) --section=5 --center=$(PACKAGE) $< >$@
+%.7: %.pod
+ pod2man --release=$(VERSION) --section=7 --center=$(PACKAGE) $< >$@
+%.8: %.pod
+ pod2man --release=$(VERSION) --section=8 --center=$(PACKAGE) $< >$@
+
+all: $(MANPAGES1) $(MANPAGES5) $(MANPAGES7) $(MANPAGES8)
+
+install: all
+ $(INSTALL) -D -m 0644 -t $(DESTDIR)$(MAN1)/ $(MANPAGES1) aklog.1
+ $(INSTALL) -D -m 0644 -t $(DESTDIR)$(MAN5)/ $(MANPAGES5)
+ $(INSTALL) -D -m 0644 -t $(DESTDIR)$(MAN7)/ $(MANPAGES7) AF_RXRPC.7
+ $(INSTALL) -D -m 0644 -t $(DESTDIR)$(MAN8)/ $(MANPAGES8)
+ $(INSTALL) -D -m 0644 aklog.1 $(DESTDIR)$(MAN1)/
+ $(INSTALL) -D -m 0644 AF_RXRPC.7 $(DESTDIR)$(MAN7)/
+
+clean:
+ $(RM) $(MANPAGES) *~
+
+distclean: clean
diff --git a/redhat/kafs-client.spec b/redhat/kafs-client.spec
index d5ba438..635b6f1 100644
--- a/redhat/kafs-client.spec
+++ b/redhat/kafs-client.spec
@@ -71,6 +71,8 @@ another AFS implementation (such as OpenAFS).
%setup -q
%build
+autoconf
+%configure
%make_build \
ETCDIR=%{_sysconfdir} \
BINDIR=%{_bindir} \
@@ -132,7 +134,6 @@ ln -s aklog-kafs %{buildroot}/%{_bindir}/aklog
%{_libdir}/libkafs_client.so.%{libapiversion}
%{_libdir}/libkafs_client.so.%{libapivermajor}
%{datadir}
-%{_sysconfdir}/kafs
%config(noreplace) %{_sysconfdir}/kafs/client.conf
%config(noreplace) %{_sysconfdir}/kafs/client.d
diff --git a/src/Makefile.config b/src/Makefile.config
deleted file mode 100644
index 7f4004a..0000000
--- a/src/Makefile.config
+++ /dev/null
@@ -1,63 +0,0 @@
-INSTALL = install
-DESTDIR =
-ETCDIR = /etc
-BINDIR = /usr/bin
-LIBEXECDIR = /usr/libexec
-INCLUDEDIR = /usr/include
-DATADIR = /usr/share/kafs-client
-SPECFILE = ../redhat/kafs-client.spec
-
-ifeq ($(origin LIBDIR),undefined)
-LIBDIR := $(shell ldd /usr/bin/make | grep '\(/libc\)' | sed -e 's!.*\(/.*\)/libc[.].*!\1!')
-endif
-
-LNS := ln -sf
-
-###############################################################################
-#
-# Determine the current package version from the specfile
-#
-###############################################################################
-VERSION := $(word 2,$(shell grep "^Version:" $(SPECFILE)))
-CPPFLAGS += -DVERSION="\"$(VERSION)\""
-
-###############################################################################
-#
-# Determine the current library version from the version script
-#
-###############################################################################
-libversion := $(filter KAFS_CLIENT_%,$(shell grep ^KAFS_CLIENT_ version.lds))
-libversion := $(lastword $(libversion))
-libversion := $(lastword $(libversion))
-APIVERSION := $(subst KAFS_CLIENT_,,$(libversion))
-vernumbers := $(subst ., ,$(APIVERSION))
-APIMAJOR := $(firstword $(vernumbers))
-
-DEVELLIB := libkafs_client.so
-SONAME := $(DEVELLIB).$(APIMAJOR)
-LIBNAME := $(DEVELLIB).$(APIVERSION)
-
-###############################################################################
-#
-# Guess at the appropriate word size
-#
-###############################################################################
-BUILDFOR := $(shell file /usr/bin/make | sed -e 's!.*ELF \(32\|64\)-bit.*!\1!')-bit
-
-ifeq ($(BUILDFOR),32-bit)
-CFLAGS += -m32
-else
-ifeq ($(BUILDFOR),64-bit)
-CFLAGS += -m64
-endif
-endif
-
-###############################################################################
-#
-# Guess at the appropriate lib directory and word size
-#
-###############################################################################
-ifeq ($(origin LIBDIR),undefined)
-LIBDIR := $(shell ldd /usr/bin/make | grep '\(/libc\)' | sed -e 's!.*\(/.*\)/libc[.].*!\1!')
-endif
-BUILDFOR := $(shell file /usr/bin/make | sed -e 's!.*ELF \(32\|64\)-bit.*!\1!')-bit
diff --git a/src/Makefile b/src/Makefile.in
similarity index 71%
rename from src/Makefile
rename to src/Makefile.in
index d7fd488..4b5cda3 100644
--- a/src/Makefile
+++ b/src/Makefile.in
@@ -1,6 +1,35 @@
-CFLAGS ?= -g -Wall -Wsign-compare
+VERSION = @PACKAGE_VERSION@
+CFLAGS = @CPPFLAGS@ @CFLAGS@ -Wall -Wsign-compare
+LDFLAGS = @LDFLAGS@
+MKDIR_P = @MKDIR_P@
+INSTALL = @INSTALL@
+DESTDIR =
+ETCDIR = @datadir@
+BINDIR = @bindir@
+LIBDIR = @libdir@
+LIBEXECDIR = @libexecdir@
+INCLUDEDIR = @includedir@
+MANDIR = @mandir@
+DATADIR = @datarootdir@/kafs-client
+UNITDIR = @libdir@/systemd/system
+LN_S = @LN_S@
+
+###############################################################################
+#
+# Determine the current library version from the version script
+#
+###############################################################################
+libversion := $(filter KAFS_CLIENT_%,$(shell grep ^KAFS_CLIENT_ version.lds))
+libversion := $(lastword $(libversion))
+libversion := $(lastword $(libversion))
+APIVERSION := $(subst KAFS_CLIENT_,,$(libversion))
+vernumbers := $(subst ., ,$(APIVERSION))
+APIMAJOR := $(firstword $(vernumbers))
+
+DEVELLIB := libkafs_client.so
+SONAME := $(DEVELLIB).$(APIMAJOR)
+LIBNAME := $(DEVELLIB).$(APIVERSION)
-include Makefile.config
all: lib progs
@@ -14,10 +43,12 @@ CPPFLAGS += -Iinclude -DETCDIR=\"$(ETCDIR)\"
lib: $(DEVELLIB)
$(DEVELLIB): $(SONAME)
- $(LNS) $< $@
+ $(RM) $@
+ $(LN_S) $< $@
$(SONAME): $(LIBNAME)
- $(LNS) $< $@
+ $(RM) $@
+ $(LN_S) $< $@
LIB_HEADERS := $(wildcard include/kafs/*.h)
LIB_FILES := \
@@ -80,11 +111,11 @@ $(KAFS_DNS_OBJS): $(LIB_HEADERS)
#
###############################################################################
install: all
- mkdir -p $(DESTDIR)$(INCLUDEDIR)/kafs
+ $(MKDIR_P) $(DESTDIR)$(INCLUDEDIR)/kafs
$(INSTALL) -D -m 0644 $(LIB_HEADERS) $(DESTDIR)$(INCLUDEDIR)/kafs/
$(INSTALL) -D -m 0755 $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
- $(LNS) $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SONAME)
- $(LNS) $(LIBDIR)/$(SONAME) $(DESTDIR)$(LIBDIR)/$(DEVELLIB)
+ $(LN_S) $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SONAME)
+ $(LN_S) $(SONAME) $(DESTDIR)$(LIBDIR)/$(DEVELLIB)
$(INSTALL) -D -m 0755 aklog-kafs $(DESTDIR)$(BINDIR)/aklog-kafs
$(INSTALL) -D -m 0755 kafs-check-config $(DESTDIR)$(SBINDIR)/kafs-check-config
$(INSTALL) -D -m 0755 kafs-preload $(DESTDIR)$(LIBEXECDIR)/kafs-preload
diff --git a/src/aklog-kafs.c b/src/aklog-kafs.c
index 2e909ea..654f45e 100644
--- a/src/aklog-kafs.c
+++ b/src/aklog-kafs.c
@@ -32,6 +32,7 @@
#include <sys/socket.h>
#include <krb5/krb5.h>
#include <linux/if_alg.h>
+#include "../conf.h"
// command line switches
int opt_debug = 0;
@@ -424,7 +425,7 @@ int main(int argc, char **argv)
++opt_debug;
break;
case 'V':
- printf("kAFS client: %s\n", VERSION);
+ printf("kAFS client: %s\n", PACKAGE_VERSION);
exit(0);
default:
display_usage(EXIT_SUCCESS);
More information about the linux-afs
mailing list