]> git.pld-linux.org Git - projects/rc-scripts.git/blob - autogen.sh
Always run changelog generation when asked. Obfuscate email addreses here. Use mktemp...
[projects/rc-scripts.git] / autogen.sh
1 #!/bin/sh
2 # $Id$
3 # Run this to generate all the initial makefiles, etc.
4
5 srcdir=`dirname $0`
6 test -z "$srcdir" && srcdir=.
7
8 PKG_NAME="PLD Linux Distribution rc-scripts"
9
10 if [ "$1" = "changelog" ]; then
11
12         [ -z "$svn2log" -a -x ~/bin/svn2log.py ] && svn2log=~/bin/svn2log.py
13         [ -z "$svn2log" -a -x /usr/bin/svn2log ] && svn2log=/usr/bin/svn2log
14         if [ -z "$svn2log" ]; then
15                 echo >&2 'Need svn2log program!'
16                 exit 1
17         fi
18
19     [ -n "$2" ] && dir="$2" || dir="rc-scripts"
20         # create users for svn2log format
21         tmp=$(mktemp -q svn2logXXXXXX 2>/dev/null || echo ${TMPDIR:-/tmp}/svn2log.tmp)
22         > $tmp
23
24         [ -z "$users" -a -f ../CVSROOT/users ] && users=../CVSROOT/users
25         [ -z "$users" -a -f ~/.CVS-PLD/CVSROOT/users ] && users=~/.CVS-PLD/CVSROOT/users
26         if [ -z "$users" ]; then
27                 echo >&2 "Can't find users file!"
28                 echo >&2 'Run in parent dir to fetch one:'
29                 echo >&2 '$ cvs -d :pserver:cvs@cvs.pld-linux.org:/cvsroot co CVSROOT/users'
30                 exit 1
31         fi
32
33     awk -F":" ' { login=$1; if ($3 != "") { name=$3 } else { name=$1 }; email=$2; printf "%s\t%s <%s@pld-linux.org>\n", login, name, login } ' $users > $tmp
34
35     svn log -v --xml | $svn2log --domain "pld-linux.org" -p /${dir}/trunk -u $tmp --exclude ChangeLog -o ChangeLog
36     rm -f $tmp
37
38         # obfuscate emails <user@domain> and (user@domain)
39         sed -i -e 's,\([<(].*\)@\(.*[)>]\),\1/at/\2,g' ChangeLog
40
41     exit 0
42 fi
43
44 cd "$srcdir"
45
46     
47 (test -f $srcdir/configure.ac \
48   && test -d $srcdir/src) || {
49     echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
50     echo " top-level rc-scripts directory"
51
52     exit 1
53 }
54
55 DIE=0
56
57 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
58   echo
59   echo "**Error**: You must have \`autoconf' installed to compile $PKG_NAME."
60   echo "Download the appropriate package for your distribution,"
61   echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
62   DIE=1
63 }
64
65 (grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
66   (libtoolize --version) < /dev/null > /dev/null 2>&1 || {
67     echo
68     echo "**Error**: You must have \`libtool' installed to compile $PKG_NAME."
69     echo "Get ftp://alpha.gnu.org/gnu/libtool/libtool-1.4b.tar.gz"
70     echo "(or a newer version if it is available)"
71     DIE=1
72   }
73 }
74
75 grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && {
76   grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \
77   (gettextize --version) < /dev/null > /dev/null 2>&1 || {
78     echo
79     echo "**Error**: You must have \`gettext' installed to compile $PKG_NAME."
80     echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.38.tar.gz"
81     echo "(or a newer version if it is available)"
82     DIE=1
83   }
84 }
85
86 (automake --version) < /dev/null > /dev/null 2>&1 || {
87   echo
88   echo "**Error**: You must have \`automake' installed to compile $PKG_NAME."
89   echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.4-p4.tar.gz"
90   echo "(or a newer version if it is available)"
91   DIE=1
92   NO_AUTOMAKE=yes
93 }
94
95
96 # if no automake, don't bother testing for aclocal
97 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
98   echo
99   echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
100   echo "installed doesn't appear recent enough."
101   echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.4-p4.tar.gz"
102   echo "(or a newer version if it is available)"
103   DIE=1
104 }
105
106 if test "$DIE" -eq 1; then
107   exit 1
108 fi
109
110 if test -z "$*"; then
111   echo "**Warning**: I am going to run \`configure' with no arguments."
112   echo "If you wish to pass any to it, please specify them on the"
113   echo \`$0\'" command line."
114   echo
115 fi
116
117 case $CC in
118 xlc )
119   am_opt=--include-deps;;
120 esac
121
122 for coin in `find $srcdir -name configure.ac -print`
123 do 
124   dr=`dirname $coin`
125   if test -f $dr/NO-AUTO-GEN; then
126     echo skipping $dr -- flagged as no auto-gen
127   else
128     echo processing $dr
129     macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
130     ( cd $dr
131       aclocalinclude="$ACLOCAL_FLAGS"
132       for k in $macrodirs; do
133         if test -d $k; then
134           aclocalinclude="$aclocalinclude -I $k"
135         ##else 
136         ##  echo "**Warning**: No such directory \`$k'.  Ignored."
137         fi
138       done
139       if grep "^AM_GNU_GETTEXT" configure.ac >/dev/null; then
140         if grep "sed.*POTFILES" configure.ac >/dev/null; then
141           : do nothing -- we still have an old unmodified configure.ac
142         else
143           echo "Creating $dr/aclocal.m4 ..."
144           test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
145           echo "Running gettextize...  Ignore non-fatal messages."
146           echo "no" | gettextize --force --copy
147           echo "Making $dr/aclocal.m4 writable ..."
148           test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
149         fi
150       fi
151       if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
152         echo "Running libtoolize..."
153         libtoolize --force --copy
154       fi
155       echo "Running aclocal $aclocalinclude ..."
156       aclocal $aclocalinclude
157       if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
158         echo "Running autoheader..."
159         autoheader
160       fi
161       echo "Running autoconf ..."
162       autoconf
163       echo "Running automake --gnu $am_opt ..."
164       automake --add-missing --gnu $am_opt
165     )
166   fi
167 done
168
169 conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
170
171 if test x$NOCONFIGURE = x; then
172   echo Running $srcdir/configure $conf_flags "$@" ...
173   $srcdir/configure $conf_flags "$@" \
174   && echo Now type \`make\' to compile $PKG_NAME
175 else
176   echo Skipping configure process.
177 fi
This page took 0.036823 seconds and 4 git commands to generate.