mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-22 06:10:06 +00:00
btrfs-progs: autoconf: add ./configure script
- add ./autogen.sh script (necessary after git clean/clone) - add ./configure.ac - copy autotool helper scripts from automake - modify version.sh to be usable from the configure script - rename Makefile to Makefile.in and use basic variables from configure.ac Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz>
This commit is contained in:
parent
344599a7ae
commit
48e728d112
29
.gitignore
vendored
29
.gitignore
vendored
@ -39,3 +39,32 @@ libbtrfs.so.0
|
||||
libbtrfs.so.0.1
|
||||
library-test
|
||||
library-test-static
|
||||
|
||||
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
compile
|
||||
config.cache
|
||||
config.guess
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config.rpath
|
||||
config.status
|
||||
config.sub
|
||||
config/ltmain.sh
|
||||
config/py-compile
|
||||
config/test-driver
|
||||
configure
|
||||
cscope.out
|
||||
depcomp
|
||||
libtool
|
||||
m4/*.m4
|
||||
Makefile
|
||||
missing
|
||||
mkinstalldirs
|
||||
stamp-h
|
||||
stamp-h.in
|
||||
stamp-h1
|
||||
config/*
|
||||
|
||||
|
@ -5,8 +5,6 @@ CC = gcc
|
||||
LN = ln
|
||||
AR = ar
|
||||
AM_CFLAGS = -Wall -D_FILE_OFFSET_BITS=64 -DBTRFS_FLAT_INCLUDES -D_XOPEN_SOURCE=700 -D_GNU_SOURCE -fno-strict-aliasing -fPIC
|
||||
CFLAGS = -g -O1 -fno-strict-aliasing
|
||||
LDFLAGS = -rdynamic
|
||||
objects = ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o \
|
||||
root-tree.o dir-item.o file-item.o inode-item.o inode-map.o \
|
||||
extent-cache.o extent_io.o volumes.o utils.o repair.o \
|
74
autogen.sh
Executable file
74
autogen.sh
Executable file
@ -0,0 +1,74 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Helps generate autoconf stuff, when code is checked out from SCM.
|
||||
#
|
||||
# Copyright (C) 2006-2014 - Karel Zak <kzak@redhat.com>
|
||||
#
|
||||
|
||||
srcdir=`dirname $0`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
THEDIR=`pwd`
|
||||
cd $srcdir
|
||||
DIE=0
|
||||
|
||||
test -f btrfs.c || {
|
||||
echo
|
||||
echo "You must run this script in the top-level btrfs-progs directory"
|
||||
echo
|
||||
DIE=1
|
||||
}
|
||||
|
||||
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have autoconf installed to generate btrfs-progs build system."
|
||||
echo
|
||||
DIE=1
|
||||
}
|
||||
(autoheader --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have autoheader installed to generate btrfs-progs build system."
|
||||
echo "The autoheader command is part of the GNU autoconf package."
|
||||
echo
|
||||
DIE=1
|
||||
}
|
||||
|
||||
(automake --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have automake installed to generate btrfs-progs build system."
|
||||
echo
|
||||
DIE=1
|
||||
}
|
||||
|
||||
if test "$DIE" -eq 1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Generate build-system by:"
|
||||
echo " aclocal: $(aclocal --version | head -1)"
|
||||
echo " autoconf: $(autoconf --version | head -1)"
|
||||
echo " autoheader: $(autoheader --version | head -1)"
|
||||
echo " automake: $(automake --version | head -1)"
|
||||
|
||||
chmod +x version.sh
|
||||
rm -rf autom4te.cache
|
||||
|
||||
aclocal $AL_OPTS
|
||||
autoconf $AC_OPTS
|
||||
autoheader $AH_OPTS
|
||||
|
||||
# it's better to use helper files from automake installation than
|
||||
# maintain copies in git tree
|
||||
HELPER_DIR=$(automake --print-libdir)
|
||||
mkdir -p config/
|
||||
cp $HELPER_DIR/config.guess config/
|
||||
cp $HELPER_DIR/config.sub config/
|
||||
cp $HELPER_DIR/install-sh config/
|
||||
|
||||
cd $THEDIR
|
||||
|
||||
echo
|
||||
echo "Now type '$srcdir/configure' and 'make' to compile."
|
||||
echo
|
102
configure.ac
Normal file
102
configure.ac
Normal file
@ -0,0 +1,102 @@
|
||||
AC_INIT([btrfs-progs],
|
||||
m4_esyscmd([./version.sh --configure]),
|
||||
[linux-btrfs@vger.kernel.org],,
|
||||
[http://btrfs.wiki.kernel.org])
|
||||
|
||||
|
||||
AC_PREREQ([2.60])
|
||||
|
||||
AC_CONFIG_AUX_DIR([config])
|
||||
dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run
|
||||
dnl the compiler (like AC_PROG_LIBTOOL) to avoid autoconf errors.
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
|
||||
AC_CONFIG_SRCDIR([btrfs.c])
|
||||
AC_PREFIX_DEFAULT([/usr])
|
||||
|
||||
AC_PROG_CC
|
||||
AC_CANONICAL_HOST
|
||||
AC_C_CONST
|
||||
AC_C_VOLATILE
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
AC_PROG_INSTALL
|
||||
|
||||
AC_CHECK_FUNCS([openat], [],
|
||||
[AC_MSG_ERROR([cannot find openat() function])])
|
||||
|
||||
m4_ifndef([PKG_PROG_PKG_CONFIG],
|
||||
[m4_fatal([Could not locate the pkg-config autoconf
|
||||
macros. These are usually located in /usr/share/aclocal/pkg.m4.
|
||||
If your macros are in a different location, try setting the
|
||||
environment variable AL_OPTS="-I/other/macro/dir" before running
|
||||
./autogen.sh or autoreconf again.])])
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
|
||||
dnl
|
||||
dnl Calls pkg-config --static
|
||||
dnl
|
||||
AC_DEFUN([PKG_STATIC], [
|
||||
if AC_RUN_LOG([pkg-config --exists --print-errors "$2"]); then
|
||||
$1=`pkg-config --libs --static "$2"`
|
||||
AC_SUBST([$1])
|
||||
else
|
||||
AC_MSG_ERROR([pkg-config description of $2, needed for static build, is not available])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Define <NAME>_LIBS= and <NAME>_CFLAGS= by pkg-config
|
||||
dnl
|
||||
dnl The default PKG_CHECK_MODULES() action-if-not-found is end the
|
||||
dnl execution with error. The static libs are optional.
|
||||
|
||||
PKG_CHECK_MODULES(BLKID, [blkid])
|
||||
PKG_STATIC(BLKID_LIBS_STATIC, [blkid])
|
||||
|
||||
PKG_CHECK_MODULES(UUID, [uuid])
|
||||
PKG_STATIC(UUID_LIBS_STATIC, [uuid])
|
||||
|
||||
PKG_CHECK_MODULES(ZLIB, [zlib])
|
||||
PKG_STATIC(ZLIB_LIBS_STATIC, [zlib])
|
||||
|
||||
dnl lzo library does not provide pkg-config, let use classic way
|
||||
AC_CHECK_LIB([lzo2], [lzo_version], [
|
||||
LZO2_LIBS="-llzo2"
|
||||
LZO2_CFLAGS=""
|
||||
LZO2_LIBS_STATIC="-llzo2"],[
|
||||
AC_MSG_ERROR([cannot find lzo2 library])
|
||||
])
|
||||
AC_SUBST([LZO2_LIBS])
|
||||
AC_SUBST([LZO2_LIBS_STATIC])
|
||||
AC_SUBST([LZO2_CFLAGS])
|
||||
|
||||
|
||||
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
])
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
AC_MSG_RESULT([
|
||||
${PACKAGE_NAME} ${PACKAGE_VERSION}
|
||||
|
||||
prefix: ${prefix}
|
||||
exec prefix: ${exec_prefix}
|
||||
|
||||
bindir: ${bindir}
|
||||
libdir: ${libdir}
|
||||
includedir: ${includedir}
|
||||
|
||||
compiler: ${CC}
|
||||
cflags: ${CFLAGS}
|
||||
ldflags: ${LDFLAGS}
|
||||
|
||||
Type 'make' to compile.
|
||||
])
|
||||
|
7
version.sh
Normal file → Executable file
7
version.sh
Normal file → Executable file
@ -8,6 +8,7 @@
|
||||
|
||||
v="v3.18.2"
|
||||
|
||||
opt=$1
|
||||
lib_major=0
|
||||
lib_minor=1
|
||||
lib_patchlevel=1
|
||||
@ -28,6 +29,12 @@ if [ $? == 0 -a -d .git ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$opt" = "--configure" ]; then
|
||||
# Omit the trailing newline, so that m4_esyscmd can use the result directly.
|
||||
echo "$v" | tr -d '\n'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "/* NOTE: this file is autogenerated by version.sh, do not edit */" > .build-version.h
|
||||
echo "#ifndef __BUILD_VERSION" >> .build-version.h
|
||||
echo >> .build-version.h
|
||||
|
Loading…
Reference in New Issue
Block a user