[BACK]Return to configure.in CVS log [TXT][DIR] Up to [Development] / xfs-cmds / xfsdump

File: [Development] / xfs-cmds / xfsdump / configure.in (download)

Revision 1.26, Thu Dec 19 02:15:07 2002 UTC (14 years, 10 months ago) by nathans
Branch: MAIN
Changes since 1.25: +1 -1 lines

Fix build fallout from recent sync-up with kernel headers in xfsprogs.

dnl unpacking check - this file must exist
AC_INIT(common/main.c)
pkg_name="xfsdump"
AC_SUBST(pkg_name)

#
# Note: the following environment variables may be set to override the
# defaults (to change paths and/or executables, build parameters, etc):
#
#   DEBUG  OPTIMIZER  MAKE  CC  LD  TAR  ZIP  RPM  AWK  SED  ECHO
#   LIBTOOL  MALLOCLIB  DISTRIBUTION  PACKAGE_BUILDER
#

DEBUG=${DEBUG:-'-DDEBUG'}		# -DNDEBUG
OPTIMIZER=${OPTIMIZER:-'-g'}		# (-O1 enforced default)
MALLOCLIB=${MALLOCLIB:-''}		# /usr/lib/libefence.a

dnl Debug build?
debug_build="$DEBUG"
AC_SUBST(debug_build)

dnl Optimization options?
opt_build="$OPTIMIZER"
AC_SUBST(opt_build)

dnl Alternate malloc library?
malloc_lib="$MALLOCLIB"
AC_SUBST(malloc_lib)

dnl Set version
. ./VERSION

pkg_version=${PKG_MAJOR}.${PKG_MINOR}.${PKG_REVISION}
pkg_release=$PKG_BUILD
AC_SUBST(pkg_version)
AC_SUBST(pkg_release)

pkg_distribution="SGI XFS"
test -z "$DISTRIBUTION" || pkg_distribution="$DISTRIBUTION"
AC_SUBST(pkg_distribution)

pkg_builder=`id -u -n`@`hostname`
test -z "$PACKAGE_BUILDER" || pkg_builder="$PACKAGE_BUILDER"
AC_SUBST(pkg_builder)

dnl output header with cpp defs HAVE_*, etc
AC_CONFIG_HEADER(include/config.h)

dnl check if user wants their own C compiler
test -z "$CC" && AC_PROG_CC
cc=$CC
AC_SUBST(cc)

dnl check if users wants their own make
test -z "$MAKE" && AC_PATH_PROG(MAKE, make, /usr/bin/make)
make=$MAKE
AC_SUBST(make)

dnl check if users wants their own linker
test -z "$LD" && AC_PATH_PROG(LD, ld, /usr/bin/ld)
ld=$LD
AC_SUBST(ld)

dnl check if the tar program is available
test -z "$TAR" && AC_PATH_PROG(TAR, tar)
tar=$TAR
AC_SUBST(tar)

dnl check if the gzip program is available
test -z "$ZIP" && AC_PATH_PROG(ZIP, gzip, /bin/gzip)
zip=$ZIP
AC_SUBST(zip)

dnl check if the rpm program is available
test -z "$RPM" && AC_PATH_PROG(RPM, rpm, /bin/rpm)
rpm=$RPM
AC_SUBST(rpm)

dnl .. and what version is rpm
rpm_version=0
test -x $RPM && \
	rpm_version=`$RPM --version | awk '{print $NF}' | awk -F. '{print $1}'`
AC_SUBST(rpm_version)

dnl At some point in rpm 4.0, rpm can no longer build rpms, and
dnl rpmbuild is needed (rpmbuild may go way back; not sure)
dnl So, if rpm version >= 4.0, look for rpmbuild.  Otherwise build w/ rpm

if test $rpm_version -ge 4; then
	AC_PATH_PROG(RPMBUILD, rpmbuild)
	rpmbuild=$RPMBUILD
else
	rpmbuild=$RPM
fi

AC_SUBST(rpmbuild)
	
dnl check if the msgfmt program is available
test -z "$MSGFMT" && AC_CHECK_PROG(MSGFMT, msgfmt, /usr/bin/msgfmt)
msgfmt=$MSGFMT
AC_SUBST(msgfmt)

dnl check if the makedepend program is available
test -z "$MAKEDEPEND" && AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
makedepend=$MAKEDEPEND
AC_SUBST(makedepend)

dnl check if symbolic links are supported
AC_PROG_LN_S

dnl check if user wants their own awk, sed and echo
test -z "$AWK" && AC_PATH_PROG(AWK, awk, /bin/awk)
awk=$AWK
AC_SUBST(awk)
test -z "$SED" && AC_PATH_PROG(SED, sed, /bin/sed)
sed=$SED
AC_SUBST(sed)
test -z "$ECHO" && AC_PATH_PROG(ECHO, echo, /bin/echo)
echo=$ECHO
AC_SUBST(echo)

dnl ensure libtool is installed
test -z "$LIBTOOL" && AC_PATH_PROG(LIBTOOL, libtool,,/usr/bin)
if test "$LIBTOOL" = ""; then
	echo
	echo 'FATAL ERROR: libtool does not seem to be installed.'
	echo $pkg_name cannot be built without a working libtool installation.
	exit 1
fi
libtool=$LIBTOOL
AC_SUBST(libtool)

dnl libtool to build libraries static only?
AC_ARG_ENABLE(shared,
	[ --enable-shared=[yes/no] Enable use of shared libraries [default=yes]],,
	enable_shared=yes)
AC_SUBST(enable_shared)

CPPFLAGS="$CPPFLAGS -I/usr/include/xfs"
AC_SUBST(CPPFLAGS)

dnl Checks for UUID header and library.
AC_CHECK_HEADER(uuid/uuid.h,, [
	echo
	echo 'FATAL ERROR: could not find a valid UUID header.'
	echo
	echo 'Install the Universally Unique Identifiers development package.'
	exit 1
])
AC_CHECK_LIB(uuid, uuid_generate,, [
	echo
	echo 'FATAL ERROR: could not find a valid UUID library.'
	echo
	echo 'Install the Universally Unique Identifiers library package.'
	exit 1
])
libuuid="/usr/lib/libuuid.a"
AC_SUBST(libuuid)

savedLIBS="$LIBS"
savedCFLAGS="$CFLAGS"

dnl Checks for curses header and library.
AC_CHECK_HEADER(ncurses.h,, [
	echo
	echo 'FATAL ERROR: could not find a valid ncurses header.'
	exit 1
])
AC_CHECK_LIB(ncurses, initscr,, [
	echo
	echo 'FATAL ERROR: could not find a valid ncurses library.'
	exit 1
])
AC_MSG_CHECKING([for bad glibc/ncurses header interaction])
libcurses="-lncurses"
LIBS="$LIBS $libcurses"
CFLAGS="$CFLAGS -D_GNU_SOURCE"
AC_TRY_LINK([
#include <ncurses.h>
#include <signal.h>],
	[wgetch(stdscr);],
	[have_curses=yes; AC_MSG_RESULT([ok])],
	[have_curses=no; libcurses=""; AC_MSG_RESULT([bad, disabling curses])])
AC_SUBST(libcurses)
AC_SUBST(have_curses)

LIBS="$savedLIBS"
CFLAGS="$savedCFLAGS"

dnl Checks for base XFS headers and libraries.
AC_CHECK_HEADER(xfs/libxfs.h,, [
	echo
	echo 'FATAL ERROR: could not find a valid XFS library header.'
	echo
	echo 'Install the XFS programs [xfsprogs] development package.'
	echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
	exit 1
])
AC_CHECK_LIB(xfs, libxfs_init,, [
	echo
	echo 'FATAL ERROR: could not find a valid XFS base library.'
	echo
	echo 'Install the XFS programs [xfsprogs] library package.'
	echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
	exit 1
])
AC_CHECK_HEADER(xfs/handle.h,, [
	echo
	echo 'FATAL ERROR: could not find a valid XFS handle header.'
	echo
	echo 'Install the XFS programs [xfsprogs] development package.'
	echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
	exit 1
])
AC_CHECK_LIB(handle, attr_list_by_handle,, [
	echo
	echo 'FATAL ERROR: could not find a current XFS handle library.'
	echo
	echo 'Install the XFS programs [xfsprogs] library package.'
	echo 'Alternatively, run "make install-lib" from the xfsprogs source.'
	exit 1
])

libxfs="-lxfs"
test -f `pwd`/../xfsprogs/libxfs/libxfs.la && libxfs="`pwd`/../xfsprogs/libxfs/libxfs.la"
test -f /usr/lib/libxfs.la && libxfs="/usr/lib/libxfs.la"

libhdl="-lhandle"
test -f `pwd`/../xfsprogs/libhandle/libhandle.la && libhdl="`pwd`/../xfsprogs/libhandle/libhandle.la"
test -f /usr/lib/libhandle.la && libhdl="/usr/lib/libhandle.la"

AC_SUBST(libxfs)
AC_SUBST(libhdl)

dnl Check xfsprogs-dev has needed macros
AC_MSG_CHECKING([macros in xfs/xfs_fs.h])
AC_TRY_LINK([#include <libxfs.h>],
	[ xfs_mount_t *mp; int x = XFS_AGFL_DADDR(mp); ],
	[ echo ok ],
	[ echo
	echo 'FATAL ERROR: could not find needed macros in the XFS headers.'
	echo
	echo 'Upgrade your XFS programs [xfsprogs] development package.'
	echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
	exit 1
])

dnl Checks for the DMAPI library
AC_CHECK_HEADER(xfs/dmapi.h,, [
	echo
	echo 'FATAL ERROR: could not find a valid DMAPI library header.'
	echo
	echo 'Install the data migration API [dmapi] development package.'
	echo 'Alternatively, run "make install-dev" from the dmapi source.'
	exit 1
])
AC_CHECK_LIB(dm, dm_make_handle,, [
	echo
	echo 'FATAL ERROR: could not find a valid DMAPI base library.'
	echo
	echo 'Install the data migration API [dmapi] library package.'
	echo 'Alternatively, run "make install" from the dmapi source.'
	exit 1
])

libdm="-ldm"
test -f `pwd`/../dmapi/libdm/libdm.la && libdm="`pwd`/../dmapi/libdm/libdm.la"
test -f /usr/lib/libdm.la && libdm="/usr/lib/libdm.la"
AC_SUBST(libdm)

dnl Checks for extended attributes header and library.
AC_CHECK_HEADER(attr/attributes.h,, [
	echo
	echo 'FATAL ERROR: could not find a valid extended attributes header.'
	echo
	echo 'Install the extended attributes [attr] development package.'
	echo 'Alternatively, run "make install-dev" from the attr source.'
	exit 1
])
AC_CHECK_LIB(attr, attr_get,, [
	echo
	echo 'FATAL ERROR: could not find a valid extended attributes library.'
	echo
	echo 'Install the extended attributes [attr] library package.'
	echo 'Alternatively, run "make install-lib" from the attr source.'
	exit 1
])
libattr="-lattr"
test -f `pwd`/../attr/libattr/libattr.la && libattr="`pwd`/../attr/libattr/libattr.la"
test -f /usr/lib/libattr.la && libattr="/usr/lib/libattr.la"
AC_SUBST(libattr)

dnl Check attr-dev is recent enough
AC_MSG_CHECKING([macros in attr/attributes.h])
AC_TRY_LINK([
#include <linux/types.h>
#include <attr/attributes.h>],
	[ int x = ATTR_SHIFT; ],
	[ echo
	echo 'FATAL ERROR: incorrect macros exist in attributes.h header file.'
	echo
	echo 'Upgrade the extended attributes [attr] development package.'
	echo 'Alternatively, run "make install-dev" from the attr source.'
	exit 1 ],
	[ echo ok ])

dnl Check if we have a type for the version 1 XFS geometry ioctl
AC_MSG_CHECKING([for XFS geometry ioctl (v1)])
AC_TRY_COMPILE(
	[ #include <libxfs.h> ],
	[ xfs_fsop_geom_v1_t geom; ],
AC_DEFINE(HAVE_V1_GEOMETRY) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no))

dnl man pages (source)
dnl also check if man page source is gzipped
dnl (usually on Debian, but not Redhat pre-7.0)
have_zipped_manpages=false
for d in ${prefix}/share/man ${prefix}/man ; do
    if test -f $d/man1/man.1.gz
    then
	have_zipped_manpages=true
	break
    fi
done
AC_SUBST(have_zipped_manpages)

dnl build definitions for use in Makefiles
AC_OUTPUT(include/builddefs)