Add build system

Add autoconf style build infrastructure to the ZFS tree.  This
includes autogen.sh, configure.ac, m4 macros, some scripts/*,
and makefiles for all the core ZFS components.
This commit is contained in:
Brian Behlendorf
2010-08-26 11:22:58 -07:00
parent 40b84e7aec
commit c9c0d073da
108 changed files with 5853 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
SUBDIRS = zfs zpool zpool_id zpool_layout zdb zinject ztest
+31
View File
@@ -0,0 +1,31 @@
include $(top_srcdir)/config/Rules.am
DEFAULT_INCLUDES += \
-I${top_srcdir}/lib/libspl/include \
-I${top_srcdir}/lib/libefi/include \
-I${top_srcdir}/lib/libzpool/include \
-I${top_srcdir}/lib/libnvpair/include \
-I${top_srcdir}/lib/libzfs/include \
-I${top_srcdir}/module/zfs/include \
-I${top_srcdir}/module/zcommon/include \
-I${top_srcdir}/module/nvpair/include \
-I${top_srcdir}/module/avl/include \
-I${top_srcdir}/module/unicode/include
sbin_PROGRAMS = zdb
zdb_SOURCES = \
${top_srcdir}/cmd/zdb/zdb.c \
${top_srcdir}/cmd/zdb/zdb_il.c
zdb_LDADD = \
$(top_builddir)/lib/libspl/libspl.la \
$(top_builddir)/lib/libavl/libavl.la \
$(top_builddir)/lib/libefi/libefi.la \
$(top_builddir)/lib/libnvpair/libnvpair.la \
$(top_builddir)/lib/libunicode/libunicode.la \
$(top_builddir)/lib/libuutil/libuutil.la \
$(top_builddir)/lib/libzpool/libzpool.la \
$(top_builddir)/lib/libzfs/libzfs.la
zdb_LDFLAGS = -pthread -lm $(ZLIB) -lrt $(LIBUUID) $(LIBBLKID)
+32
View File
@@ -0,0 +1,32 @@
include $(top_srcdir)/config/Rules.am
DEFAULT_INCLUDES += \
-I${top_srcdir}/lib/libspl/include \
-I${top_srcdir}/lib/libefi/include \
-I${top_srcdir}/lib/libuutil/include \
-I${top_srcdir}/lib/libzfs/include \
-I${top_srcdir}/lib/libnvpair/include \
-I${top_srcdir}/module/zcommon/include \
-I${top_srcdir}/module/nvpair/include \
-I${top_srcdir}/module/avl/include \
-I${top_srcdir}/module/unicode/include
sbin_PROGRAMS = zfs
zfs_SOURCES = \
${top_srcdir}/cmd/zfs/zfs_iter.c \
${top_srcdir}/cmd/zfs/zfs_iter.h \
${top_srcdir}/cmd/zfs/zfs_main.c \
${top_srcdir}/cmd/zfs/zfs_util.h
zfs_LDADD = \
$(top_builddir)/lib/libspl/libspl.la \
$(top_builddir)/lib/libavl/libavl.la \
$(top_builddir)/lib/libefi/libefi.la \
$(top_builddir)/lib/libnvpair/libnvpair.la \
$(top_builddir)/lib/libunicode/libunicode.la \
$(top_builddir)/lib/libuutil/libuutil.la \
$(top_builddir)/lib/libzpool/libzpool.la \
$(top_builddir)/lib/libzfs/libzfs.la
zfs_LDFLAGS = -pthread -lm $(ZLIB) -lrt $(LIBUUID) $(LIBBLKID)
+34
View File
@@ -0,0 +1,34 @@
include $(top_srcdir)/config/Rules.am
DEFAULT_INCLUDES += \
-I${top_srcdir}/lib/libspl/include \
-I${top_srcdir}/lib/libefi/include \
-I${top_srcdir}/lib/libzpool/include \
-I${top_srcdir}/lib/libuutil/include \
-I${top_srcdir}/lib/libzfs/include \
-I${top_srcdir}/lib/libnvpair/include \
-I${top_srcdir}/module/zfs \
-I${top_srcdir}/module/zfs/include \
-I${top_srcdir}/module/zcommon/include \
-I${top_srcdir}/module/nvpair/include \
-I${top_srcdir}/module/avl/include \
-I${top_srcdir}/module/unicode/include
sbin_PROGRAMS = zinject
zinject_SOURCES = \
${top_srcdir}/cmd/zinject/translate.c \
${top_srcdir}/cmd/zinject/zinject.c \
${top_srcdir}/cmd/zinject/zinject.h
zinject_LDADD = \
$(top_builddir)/lib/libspl/libspl.la \
$(top_builddir)/lib/libavl/libavl.la \
$(top_builddir)/lib/libefi/libefi.la \
$(top_builddir)/lib/libnvpair/libnvpair.la \
$(top_builddir)/lib/libunicode/libunicode.la \
$(top_builddir)/lib/libuutil/libuutil.la \
$(top_builddir)/lib/libzpool/libzpool.la \
$(top_builddir)/lib/libzfs/libzfs.la
zinject_LDFLAGS = -pthread -lm $(ZLIB) -lrt $(LIBUUID) $(LIBBLKID)
+34
View File
@@ -0,0 +1,34 @@
include $(top_srcdir)/config/Rules.am
DEFAULT_INCLUDES += \
-I${top_srcdir}/lib/libspl/include \
-I${top_srcdir}/lib/libefi/include \
-I${top_srcdir}/lib/libuutil/include \
-I${top_srcdir}/lib/libzfs/include \
-I${top_srcdir}/lib/libnvpair/include \
-I${top_srcdir}/module/zcommon/include \
-I${top_srcdir}/module/zfs/include \
-I${top_srcdir}/module/nvpair/include \
-I${top_srcdir}/module/avl/include \
-I${top_srcdir}/module/unicode/include
sbin_PROGRAMS = zpool
zpool_SOURCES = \
${top_srcdir}/cmd/zpool/zpool_iter.c \
${top_srcdir}/cmd/zpool/zpool_main.c \
${top_srcdir}/cmd/zpool/zpool_util.c \
${top_srcdir}/cmd/zpool/zpool_util.h \
${top_srcdir}/cmd/zpool/zpool_vdev.c
zpool_LDADD = \
$(top_builddir)/lib/libspl/libspl.la \
$(top_builddir)/lib/libavl/libavl.la \
$(top_builddir)/lib/libefi/libefi.la \
$(top_builddir)/lib/libnvpair/libnvpair.la \
$(top_builddir)/lib/libunicode/libunicode.la \
$(top_builddir)/lib/libuutil/libuutil.la \
$(top_builddir)/lib/libzpool/libzpool.la \
$(top_builddir)/lib/libzfs/libzfs.la
zpool_LDFLAGS = -pthread -lm $(ZLIB) -lrt $(LIBUUID) $(LIBBLKID)
+1
View File
@@ -0,0 +1 @@
dist_bin_SCRIPTS = zpool_id
+60
View File
@@ -0,0 +1,60 @@
#!/bin/bash
CONFIG=${CONFIG:-/etc/zfs/zdev.conf}
PATH_ID=${PATH_ID:-/lib/udev/path_id}
AWK=${AWK:-/bin/awk}
die() {
echo "Error: $*"
exit 1
}
usage() {
cat << EOF
Usage: zpool_id [h] [-c configfile] <devpath>
-c Alternate config file [default /etc/zfs/zdev.conf]
-d Use path_id from device as the mapping key
-h Show this message
EOF
exit 1
}
while getopts 'c:d:h' OPTION; do
case ${OPTION} in
c)
CONFIG=${OPTARG}
;;
d)
DEVICE=${OPTARG}
;;
h)
usage
;;
esac
done
# Check that a device was requested
[ -z ${DEVICE} ] && usage
# Check for the existence of a configuration file
[ ! -f ${CONFIG} ] && die "Missing config file: ${CONFIG}"
# Use udev's path_id to generate a unique persistent key
eval `${PATH_ID} ${DEVICE}`
[ -z ${ID_PATH} ] && die "Missing ID_PATH for ${DEVICE}"
# Use the persistent key to lookup the zpool device id in the
# configuration file which is of the format <device id> <key>.
# Lines starting with #'s are treated as comments and ignored.
# Exact matches are required, wild cards are not supported,
# and only the first match is returned.
ID_ZPOOL=`${AWK} "/${ID_PATH}\>/ && !/^#/ { print \\$1; exit }" ${CONFIG}`
[ -z ${ID_ZPOOL} ] && die "Missing ID_ZPOOL for ID_PATH: ${ID_PATH}"
if [ ${ID_ZPOOL} ]; then
echo "ID_PATH=${ID_PATH}"
echo "ID_ZPOOL=${ID_ZPOOL}"
echo "ID_ZPOOL_PATH=disk/zpool/${ID_ZPOOL}"
fi
exit 0
+1
View File
@@ -0,0 +1 @@
dist_bin_SCRIPTS = zpool_layout
+127
View File
@@ -0,0 +1,127 @@
#!/bin/bash
#
# Set BUSES and PORTS to match the topology of your system. As each
# port is enumerated it will be assigned the next channel name. The
# current script enumerates each port on a bus before moving on to
# enumerate the next bus.
#
# Every distribution, version of udev, and type of attached storage
# seems to result in slightly different formatting of the by-path
# name. For this reason you may need to adjust the parsing below
# to suit your needs. This is one of the reasons to use a custom
# /etc/zfs/zdev.conf file, it allows the by-path naming convertion
# to change and still keep the simple <channel><rank> naming.
#
CONFIG=${CONFIG:-/etc/zfs/zdev.conf}
BUSES=( 01 02 03 )
PORTS=( 4 0 )
CHANNELS=( A B C D E F G H I J K L M N O P Q R S T U V W X Y Z )
TRIGGER=
usage() {
cat << EOF
Usage: zpool_layout [-th] [-c file] [-b buses] [-p ports] [-n channels]
-c Alternate config file [default=/etc/zfs/zdev.conf]
-b Enumerate buses [default="01 02 03"]
-p Enumerate ports [default="4 0"]
-n Channel names [default="A..Z"]
-t Trigger and wait for udev to settle [default=no]
-h Show this message
EOF
exit 0
}
while getopts 'c:b:p:n:th' OPTION; do
case ${OPTION} in
c)
CONFIG=${OPTARG}
;;
b)
BUSES=(${OPTARG})
;;
p)
PORTS=(${OPTARG})
;;
n)
CHANNELS=(${OPTARG})
;;
t)
TRIGGER=1
;;
h)
usage
;;
esac
done
# Save stdout as fd #8, then redirect stdout to the config file.
exec 8>&1
exec >${CONFIG}
pushd /dev/disk/by-path >/dev/null
# Generate comment header.
echo "#"
echo "# Custom /dev/disk/by-path to /dev/disk/zpool mapping, "
echo "# based of the following physical cable layout."
echo "#"
# Generate host port layout table for comment header.
echo "# ------------------ Host Port Layout ---------------------"
echo -n "# "
for (( i=0; i<${#BUSES[*]}; i++ )); do
printf "%-8d" ${BUSES[$i]}
done
echo
for (( i=0, k=0; i<${#PORTS[*]}; i++ )); do
printf "# Port %-2d " ${PORTS[$i]}
for (( j=0; j<${#BUSES[*]}; j++, k++ )); do
let k=$j*${#PORTS[*]}+$i
printf "%-8s" ${CHANNELS[$k]}
done
echo
done
echo "#"
# Generate channel/disk layout table for comment header.
echo "# ----------------- Channel/Disk Layout -------------------"
echo "# Channel Disks"
for (( i=0, k=0; i<${#BUSES[*]}; i++ )); do
for (( j=0; j<${#PORTS[*]}; j++, k++ )); do
printf "# %-9s" ${CHANNELS[$k]}
ls *:${BUSES[$i]}:*:${PORTS[$j]}* 2>/dev/null | \
cut -f7 -d'-' | sort -u -n | tr '\n' ','
echo
done
done
echo "#"
# Generate mapping from <channel><rank> to by-path name.
TMP_FILE=`mktemp`
AWK=${AWK:-/bin/awk}
for (( i=0, k=0; i<${#BUSES[*]}; i++ )); do
for (( j=0; j<${#PORTS[*]}; j++, k++ )); do
ls *:${BUSES[$i]}:*:${PORTS[$j]}* 2>/dev/null | \
grep -v part | sort -n -k7 -t'-'>${TMP_FILE}
echo
echo -n "# Channel ${CHANNELS[$k]}, "
echo "Bus ${BUSES[$i]}, Port ${PORTS[$j]}"
${AWK} -F '-' -v ch="${CHANNELS[$k]}" \
'{print ch$7 "\t" $0 }' ${TMP_FILE}
done
done
# Restore stdout from fd #8 and close fd #8.
exec 1>&8 8>&-
rm -f ${TMP_FILE}
popd >/dev/null
if [ ${TRIGGER} ]; then
udevadm trigger
udevadm settle
fi
exit 0
+34
View File
@@ -0,0 +1,34 @@
include $(top_srcdir)/config/Rules.am
AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN)
DEFAULT_INCLUDES += \
-I${top_srcdir}/lib/libspl/include \
-I${top_srcdir}/lib/libefi/include \
-I${top_srcdir}/lib/libzpool/include \
-I${top_srcdir}/lib/libuutil/include \
-I${top_srcdir}/lib/libzfs/include \
-I${top_srcdir}/lib/libnvpair/include \
-I${top_srcdir}/module/zfs \
-I${top_srcdir}/module/zfs/include \
-I${top_srcdir}/module/zcommon/include \
-I${top_srcdir}/module/nvpair/include \
-I${top_srcdir}/module/avl/include \
-I${top_srcdir}/module/unicode/include
sbin_PROGRAMS = ztest
ztest_SOURCES = \
${top_srcdir}/cmd/ztest/ztest.c
ztest_LDADD = \
$(top_builddir)/lib/libspl/libspl.la \
$(top_builddir)/lib/libavl/libavl.la \
$(top_builddir)/lib/libefi/libefi.la \
$(top_builddir)/lib/libnvpair/libnvpair.la \
$(top_builddir)/lib/libunicode/libunicode.la \
$(top_builddir)/lib/libuutil/libuutil.la \
$(top_builddir)/lib/libzpool/libzpool.la \
$(top_builddir)/lib/libzfs/libzfs.la
ztest_LDFLAGS = -pthread -lm $(ZLIB) -lrt -ldl $(LIBUUID) $(LIBBLKID)