Skip to content

Commit bb5a0fc

Browse files
author
erikd
committed
Shave (git://git.lespiau.name/shave) the autotool output.
git-svn-id: http://svn.metadecks.org/sweep/trunk@667 e2d53364-18fc-0310-981e-b60a84739af0
1 parent 3f9e155 commit bb5a0fc

File tree

5 files changed

+312
-5
lines changed

5 files changed

+312
-5
lines changed

autogen.sh

+20-5
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@ DIE=0
1313

1414
ACLOCAL_FLAGS="-I $srcdir/m4"
1515

16-
echo "checking for autoconf... "
16+
echo -n "checking for autoconf ... "
17+
result="yes"
1718
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
1819
echo
1920
echo "You must have autoconf installed to compile $package."
2021
echo "Download the appropriate package for your distribution,"
2122
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
23+
result="no"
2224
DIE=1
2325
}
26+
echo $result
2427

2528
VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/"
2629
VERSIONMKMAJ="sed -e s/\([0-9][0-9]*\)[^0-9].*/\\1/"
@@ -34,7 +37,7 @@ if test -r Makefile.am; then
3437
AM_NEEDED=""
3538
fi
3639
if test -z $AM_NEEDED; then
37-
echo -n "checking for automake... "
40+
echo -n "checking for automake ... "
3841
AUTOMAKE=automake
3942
ACLOCAL=aclocal
4043
if ($AUTOMAKE --version < /dev/null > /dev/null 2>&1); then
@@ -44,7 +47,7 @@ if test -r Makefile.am; then
4447
AUTOMAKE=
4548
fi
4649
else
47-
echo -n "checking for automake $AM_NEEDED or later... "
50+
echo -n "checking for automake $AM_NEEDED or later ... "
4851
majneeded=`echo $AM_NEEDED | $VERSIONMKMAJ`
4952
minneeded=`echo $AM_NEEDED | $VERSIONMKMIN`
5053
for am in automake-$AM_NEEDED automake$AM_NEEDED \
@@ -60,7 +63,7 @@ if test -r Makefile.am; then
6063
fi
6164
done
6265
test -z $AUTOMAKE && echo "no"
63-
echo -n "checking for aclocal $AM_NEEDED or later... "
66+
echo -n "checking for aclocal $AM_NEEDED or later ... "
6467
for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED \
6568
aclocal aclocal-1.7 aclocal-1.8 aclocal-1.9 aclocal-1.10; do
6669
($ac --version < /dev/null > /dev/null 2>&1) || continue
@@ -84,7 +87,7 @@ if test -r Makefile.am; then
8487
}
8588
fi
8689

87-
echo -n "checking for libtool... "
90+
echo -n "checking for libtool ... "
8891
for LIBTOOLIZE in libtoolize glibtoolize nope; do
8992
($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 && break
9093
done
@@ -103,6 +106,18 @@ fi
103106
DIE=1
104107
}
105108

109+
echo -n "checking for pkg-config ... "
110+
result="yes"
111+
(pkg-config --version) < /dev/null > /dev/null 2>&1 || {
112+
echo
113+
echo "You must have pkg-config installed to compile $package."
114+
echo "Download the appropriate package for your distribution."
115+
result="no"
116+
DIE=1
117+
}
118+
echo $result
119+
120+
106121
if test "$DIE" -eq 1; then
107122
exit 1
108123
fi

configure.ac

+6
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,13 @@ AC_MSG_ERROR([
597597

598598
else
599599

600+
# Shave make automake/libtool output much less verbose and much more
601+
# readable. See : git://git.lespiau.name/shave
602+
SHAVE_INIT([],[enable])
603+
600604
AC_OUTPUT([
605+
shave
606+
shave-libtool
601607
Makefile
602608
sweep.spec
603609
m4/Makefile

m4/shave.m4

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
dnl Make automake/libtool output more friendly to humans
2+
dnl
3+
dnl Copyright (c) 2009, Damien Lespiau <[email protected]>
4+
dnl
5+
dnl Permission is hereby granted, free of charge, to any person
6+
dnl obtaining a copy of this software and associated documentation
7+
dnl files (the "Software"), to deal in the Software without
8+
dnl restriction, including without limitation the rights to use,
9+
dnl copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
dnl copies of the Software, and to permit persons to whom the
11+
dnl Software is furnished to do so, subject to the following
12+
dnl conditions:
13+
dnl
14+
dnl The above copyright notice and this permission notice shall be
15+
dnl included in all copies or substantial portions of the Software.
16+
dnl
17+
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
dnl EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19+
dnl OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
dnl NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21+
dnl HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22+
dnl WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23+
dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24+
dnl OTHER DEALINGS IN THE SOFTWARE.
25+
dnl
26+
dnl SHAVE_INIT([shavedir],[default_mode])
27+
dnl
28+
dnl shavedir: the directory where the shave scripts are, it defaults to
29+
dnl $(top_builddir)
30+
dnl default_mode: (enable|disable) default shave mode. This parameter
31+
dnl controls shave's behaviour when no option has been
32+
dnl given to configure. It defaults to disable.
33+
dnl
34+
dnl * SHAVE_INIT should be called late in your configure.(ac|in) file (just
35+
dnl before AC_CONFIG_FILE/AC_OUTPUT is perfect. This macro rewrites CC and
36+
dnl LIBTOOL, you don't want the configure tests to have these variables
37+
dnl re-defined.
38+
dnl * This macro requires GNU make's -s option.
39+
40+
AC_DEFUN([_SHAVE_ARG_ENABLE],
41+
[
42+
AC_ARG_ENABLE([shave],
43+
AS_HELP_STRING(
44+
[--enable-shave],
45+
[use shave to make the build pretty [[default=$1]]]),,
46+
[enable_shave=$1]
47+
)
48+
])
49+
50+
AC_DEFUN([SHAVE_INIT],
51+
[
52+
dnl you can tweak the default value of enable_shave
53+
m4_if([$2], [enable], [_SHAVE_ARG_ENABLE(yes)], [_SHAVE_ARG_ENABLE(no)])
54+
55+
if test x"$enable_shave" = xyes; then
56+
dnl where can we find the shave scripts?
57+
m4_if([$1],,
58+
[shavedir="$ac_pwd"],
59+
[shavedir="$ac_pwd/$1"])
60+
AC_SUBST(shavedir)
61+
62+
dnl make is now quiet
63+
AC_SUBST([MAKEFLAGS], [-s])
64+
AC_SUBST([AM_MAKEFLAGS], ['`test -z $V && echo -s`'])
65+
66+
dnl we need sed
67+
AC_CHECK_PROG(SED,sed,sed,false)
68+
69+
dnl substitute libtool
70+
SHAVE_SAVED_LIBTOOL=$LIBTOOL
71+
LIBTOOL="${SHELL} ${shavedir}/shave-libtool '${SHAVE_SAVED_LIBTOOL}'"
72+
AC_SUBST(LIBTOOL)
73+
74+
dnl substitute cc/cxx
75+
SHAVE_SAVED_CCAS=$CCAS
76+
SHAVE_SAVED_CC=$CC
77+
SHAVE_SAVED_CXX=$CXX
78+
SHAVE_SAVED_FC=$FC
79+
SHAVE_SAVED_F77=$F77
80+
SHAVE_SAVED_OBJC=$OBJC
81+
SHAVE_SAVED_MCS=$MCS
82+
CCAS="${SHELL} ${shavedir}/shave ccas ${SHAVE_SAVED_CCAS}"
83+
CC="${SHELL} ${shavedir}/shave cc ${SHAVE_SAVED_CC}"
84+
CXX="${SHELL} ${shavedir}/shave cxx ${SHAVE_SAVED_CXX}"
85+
FC="${SHELL} ${shavedir}/shave fc ${SHAVE_SAVED_FC}"
86+
F77="${SHELL} ${shavedir}/shave f77 ${SHAVE_SAVED_F77}"
87+
OBJC="${SHELL} ${shavedir}/shave objc ${SHAVE_SAVED_OBJC}"
88+
MCS="${SHELL} ${shavedir}/shave mcs ${SHAVE_SAVED_MCS}"
89+
AC_SUBST(CCAS)
90+
AC_SUBST(CC)
91+
AC_SUBST(CXX)
92+
AC_SUBST(FC)
93+
AC_SUBST(F77)
94+
AC_SUBST(OBJC)
95+
AC_SUBST(MCS)
96+
97+
V=@
98+
else
99+
V=1
100+
fi
101+
Q='$(V:1=)'
102+
AC_SUBST(V)
103+
AC_SUBST(Q)
104+
])
105+

shave-libtool.in

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/sh
2+
3+
# we need sed
4+
SED=@SED@
5+
if test -z "$SED" ; then
6+
SED=sed
7+
fi
8+
9+
lt_unmangle ()
10+
{
11+
last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'`
12+
}
13+
14+
# the real libtool to use
15+
LIBTOOL="$1"
16+
shift
17+
18+
# if 1, don't print anything, the underlaying wrapper will do it
19+
pass_though=0
20+
21+
# scan the arguments, keep the right ones for libtool, and discover the mode
22+
preserved_args=
23+
while test "$#" -gt 0; do
24+
opt="$1"
25+
shift
26+
27+
case $opt in
28+
--mode=*)
29+
mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'`
30+
preserved_args="$preserved_args $opt"
31+
;;
32+
-o)
33+
lt_output="$1"
34+
preserved_args="$preserved_args $opt"
35+
;;
36+
*)
37+
preserved_args="$preserved_args $opt"
38+
;;
39+
esac
40+
done
41+
42+
case "$mode" in
43+
compile)
44+
# shave will be called and print the actual CC/CXX/LINK line
45+
preserved_args="$preserved_args --shave-mode=$mode"
46+
pass_though=1
47+
;;
48+
link)
49+
preserved_args="$preserved_args --shave-mode=$mode"
50+
Q=" LINK "
51+
;;
52+
*)
53+
# let's u
54+
# echo "*** libtool: Unimplemented mode: $mode, fill a bug report"
55+
;;
56+
esac
57+
58+
lt_unmangle "$lt_output"
59+
output=$last_result
60+
61+
if test -z $V; then
62+
if test $pass_though -eq 0; then
63+
echo "$Q$output"
64+
fi
65+
$LIBTOOL --silent $preserved_args
66+
else
67+
echo $LIBTOOL $preserved_args
68+
$LIBTOOL $preserved_args
69+
fi

shave.in

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2009, Damien Lespiau <[email protected]>
4+
#
5+
# Permission is hereby granted, free of charge, to any person
6+
# obtaining a copy of this software and associated documentation
7+
# files (the "Software"), to deal in the Software without
8+
# restriction, including without limitation the rights to use,
9+
# copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the
11+
# Software is furnished to do so, subject to the following
12+
# conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be
15+
# included in all copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19+
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21+
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22+
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24+
# OTHER DEALINGS IN THE SOFTWARE.
25+
26+
# we need sed
27+
SED=@SED@
28+
if test -z "$SED" ; then
29+
SED=sed
30+
fi
31+
32+
lt_unmangle ()
33+
{
34+
last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'`
35+
}
36+
37+
# the tool to wrap (cc, cxx, ar, ranlib, ..)
38+
tool="$1"
39+
shift
40+
41+
# the reel tool (to call)
42+
REEL_TOOL="$1"
43+
shift
44+
45+
pass_through=0
46+
preserved_args=
47+
while test "$#" -gt 0; do
48+
opt="$1"
49+
shift
50+
51+
case $opt in
52+
--shave-mode=*)
53+
mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'`
54+
;;
55+
-o)
56+
lt_output="$1"
57+
preserved_args="$preserved_args $opt"
58+
;;
59+
-out:*|/out:*)
60+
lt_output="${opt#-out:}"
61+
preserved_args="$preserved_args $opt"
62+
;;
63+
*)
64+
preserved_args="$preserved_args $opt"
65+
;;
66+
esac
67+
done
68+
69+
# mode=link is handled in the libtool wrapper
70+
case "$mode,$tool" in
71+
link,*)
72+
pass_through=1
73+
;;
74+
*,cxx)
75+
Q=" CXX "
76+
;;
77+
*,ccas)
78+
Q=" AS "
79+
;;
80+
*,cc)
81+
Q=" CC "
82+
;;
83+
*,fc)
84+
Q=" FC "
85+
;;
86+
*,f77)
87+
Q=" F77 "
88+
;;
89+
*,objc)
90+
Q=" OBJC "
91+
;;
92+
*,mcs)
93+
Q=" MCS "
94+
;;
95+
*,*)
96+
# should not happen
97+
Q=" CC "
98+
;;
99+
esac
100+
101+
lt_unmangle "$lt_output"
102+
output=$last_result
103+
104+
if test -z $V; then
105+
if test $pass_through -eq 0; then
106+
echo "$Q$output"
107+
fi
108+
$REEL_TOOL $preserved_args
109+
else
110+
echo $REEL_TOOL $preserved_args
111+
$REEL_TOOL $preserved_args
112+
fi

0 commit comments

Comments
 (0)