die only after all the version checks are done and not for each one
[rrdtool.git] / MakeMakefile
1 #!/bin/sh
2 #
3 # Run this script after the first cvs checkout to build
4 # makefiles and friends
5
6 vcheck (){
7   perl <<PERL
8 @t = split /\./, "$1";
9 @v = map { int \$_ } split /\./, (split /\s+/, \`$2\`)[3];
10 print "$2 = ", (join ".",@v), "  (expected $1)\n";
11 \$v = \$t[0]*1000000+\$t[1]*1000+\$t[2] <= \$v[0]*1000000+\$v[1]*1000+\$v[2];
12 exit \$v
13 PERL
14 }
15
16 ERROR=0
17
18 if vcheck 1.5 "libtool --version"
19 then
20   echo "get a copy of GNU libtool >= 1.5"
21   ERROR=1
22 fi
23
24 #if vcheck 1.8.2  "automake  --version"
25 #then
26 #  if vcheck 1.8.2  "automake-1.8 --version"
27 #  then
28 #    echo "get a copy of GNU automake >= 1.8.2"
29 #    exit 1
30 #  else
31 #    automake=automake-1.8
32 #    aclocal="aclocal-1.8  --acdir=/usr/share/aclocal-1.8 -I /usr/share/aclocal/"
33 #  fi
34 #else
35 #    automake="automake"
36 #    aclocal="aclocal  -I /usr/pack/libtool-1.5-to/share/aclocal"
37 #fi
38
39 if vcheck 1.7.9  "automake  --version"
40 then
41   if vcheck 1.7.9  "automake-1.7 --version"
42   then
43     echo "get a copy of GNU automake >= 1.79"
44     ERROR=1
45   else
46     automake=automake-1.7
47     aclocal="aclocal-1.7  --acdir=/usr/share/aclocal-1.7 -I /usr/share/aclocal/"
48   fi
49 else
50     automake="automake"
51     aclocal="aclocal -I /usr/pack/libtool-1.5-to/share/aclocal"
52 fi
53
54 if vcheck 2.58 "autoconf --version"
55 then
56   echo "get a copy of GNU autoconf >= 2.58"
57   ERROR=1
58 fi
59
60 if [ $ERROR -ne 0 ]
61 then
62   exit 1
63 fi
64
65 set -x
66 find . -name Makefile | xargs rm -f
67 find . -name "*.la" | xargs rm -f
68 find . -name Makefile.in | xargs rm -f
69 find . -name .libs | xargs rm -r
70 find . -name .debs | xargs rm -r
71
72
73 # wget ftp://ftp.gnu.org/gnu/libtool/libtool-1.5.tar.gz
74 libtoolize --copy --force
75 #cp ltmain.sh config
76
77 # wget ftp://sources.redhat.com/pub/automake/automake-1.7.9.tar.gz
78 # If autoconf generates undefined MACRO errors, it may be unable
79 # to find libtool.m4. Add the -I flag to aclocal to specify the
80 # directory location of this file.
81 $aclocal
82 $automake --foreign --add-missing --force-missing --copy --warnings=all
83 # wget ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.58.tar.gz
84 autoconf --warnings=all --force
85 rm config.h.in
86 autoheader --warnings=all --force  
87
88