1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
|
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
# MALLOCLIB DISTRIBUTION PACKAGE_BUILDER PREFIX ROOT_PREFIX
#
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 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 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
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="-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 'Install either the e2fsprogs-devel (rpm) or the uuid-dev (deb) package.'
exit 1
])
AC_CHECK_LIB(uuid, uuid_generate,, [
echo
echo 'FATAL ERROR: could not find a valid UUID library.'
echo 'Install either the e2fsprogs-devel (rpm) or the uuid-dev (deb) package.'
exit 1
])
libuuid="/usr/lib/libuuid.a"
AC_SUBST(libuuid)
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 'Install either the xfsprogs-devel (rpm) or the xfslibs-dev (deb) 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 'Install either the xfsprogs-devel (rpm) or the xfslibs-dev (deb) 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 'Install either the xfsprogs-devel (rpm) or the xfslibs-dev (deb) 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 'Upgrade the xfsprogs-devel (rpm) or the xfslibs-dev (deb) package.'
echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
exit 1
])
libxfs="-lxfs"
test -f /usr/lib/libxfs.la && libxfs="/usr/lib/libxfs.la"
libhdl="-lhandle"
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>],
[ int x = XFS_IOC_ATTRLIST_BY_HANDLE; ],
[ echo ok ],
[ echo
echo 'FATAL ERROR: could not find needed macros in the XFS headers.'
echo 'Upgrade the xfsprogs-devel (rpm) or the xfslibs-dev (deb) 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 'Install either the dmapi-devel (rpm) or the dmapi-dev (deb) 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 'Install either the dmapi-devel (rpm) or the dmapi-dev (deb) package.'
echo 'Alternatively, run "make install-dev" from the dmapi source.'
exit 1
])
libdm="-ldm"
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 'Install either the libattr (rpm) or the attr-dev (deb) 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 'Install either the libattr (rpm) or the libattr1 (deb) package.'
echo 'Alternatively, run "make install-lib" from the attr source.'
exit 1
])
libattr="-lattr"
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 present in attributes.h header file.'
echo 'Upgrade the attr-devel (rpm) or the attr-dev (deb) package.'
echo 'Alternatively, run "make install-dev" from the attr source.'
exit 1 ],
[ echo ok ])
dnl alternate root and usr prefixes
test -z "$ROOT_PREFIX" && ROOT_PREFIX=""
root_prefix="$ROOT_PREFIX"
test -z "$PREFIX" && PREFIX="/usr"
prefix="$PREFIX"
dnl man pages (source)
dnl also check if man page source is gzipped
dnl (usually on Debian, but not Redhat pre-7.0)
pkg_man_dir=${prefix}/share/man
have_zipped_manpages=false
for d in ${prefix}/share/man ${prefix}/man ; do
if test -f $d/man1/man.1.gz
then
pkg_man_dir=$d
have_zipped_manpages=true
break
fi
done
AC_SUBST(pkg_man_dir)
AC_SUBST(have_zipped_manpages)
dnl binaries
pkg_bin_dir=${prefix}/sbin
AC_SUBST(pkg_bin_dir)
dnl static libraries
pkg_lib_dir=${prefix}/lib
AC_SUBST(pkg_lib_dir)
dnl runtime shared system libraries
pkg_slib_dir=${root_prefix}/lib
AC_SUBST(pkg_slib_dir)
dnl system binaries
pkg_sbin_dir=${root_prefix}/sbin
AC_SUBST(pkg_sbin_dir)
dnl include files
pkg_inc_dir=${prefix}/include/xfs
AC_SUBST(pkg_inc_dir)
dnl doc directory
pkg_doc_dir=${prefix}/share/doc/${pkg_name}
AC_SUBST(pkg_doc_dir)
dnl
dnl output files
dnl
AC_OUTPUT( \
dnl Build definitions for use in Makefiles
include/builddefs \
)
|