summaryrefslogtreecommitdiffstats
path: root/tools/config-gen
blob: c2989e9c9aee06913e08d824a460c75887b0757a (plain)
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
#!/bin/sh
#
# Copyright (C) 2011 Karel Zak <kzak@redhat.com>
#

test -f sys-utils/mount.c || {
	echo
	echo "You must run this script in the top-level util-linux directory"
	echo
	exit 1
}

unset CC
unset CXX
unset CFLAGS
unset LDFLAGS
unset SUID_CFLAGS
unset SUID_LDFLAGS

. tools/config-gen-functions.sh

if [ $# -eq 0 ]; then
	echo "This script requires at least one of the folloving arguments:"
	cd tools/config-gen.d
	for i in *.conf; do
		echo "  ${i%%.conf}"
	done
	exit 1
fi

while [ -n "$1" ]; do
	opts="$opts $(ul_get_configuration tools/config-gen.d/$1.conf)"
	if [ "$1" == "fuzz" ]; then
		export CC=${CC:-clang}
		export CXX=${CXX:-clang++}
	fi
	shift
done

opts=$(echo $opts | tr " " "\n" | sort -u)
echo "Configure options:"
for x in $opts; do
	echo "	$x"
done
echo

if [ -n "$CFLAGS" ]; then
	echo "CFLAGS:   $CFLAGS"
	CFLAGS="$CFLAGS"
	export CFLAGS
	echo
fi
if [ -n "$LDFLAGS" ]; then
	echo "LDFLAGS:  $LDFLAGS"
	LDFLAGS="$LDFLAGS"
	export LDFLAGS
	echo
fi

if [ ! -f ./configure ]; then
	./autogen.sh
fi

./configure $opts