1#!/usr/bin/perl
2#
3# @(#)$Header: /mm2/home/cvs/bc-src/tgif/bootstrap.pl,v 1.16 2011/05/23 16:35:57 william Exp $
4#
5# bootstrap.pl version
6
7$skip_autoscan = 0;
8
9$num_cmd_args = $#ARGV +1;
10
11if ($num_cmd_args != 1) {
12    print "usage: bootstrap.pl version\n";
13    exit 0;
14}
15
16$version = $ARGV[0];
17
18$autodir = "/usr/share/automake-1.10";
19$email = "bill.cheng\@acm.org";
20
21print "clean up files...\n";
22system("rm -rf autom4te.cache");
23system("rm -f Makefile Makefile.distr Makefile.in aclocal.m4 autoscan.log");
24system("rm -f configure configure.ac config.h.in config.h");
25
26if (!$skip_autoscan) {
27    #
28    # These files will be generated, delete them to make sure that we start
29    #         from scratch
30    #
31    system("rm -f mkinstalldirs install-sh missing depcomp");
32    system("rm -f config.status configure.scan");
33
34    #
35    # Need these from for the script to run
36    #
37    print "copy files from $autodir...\n";
38    system("cp $autodir/mkinstalldirs $autodir/install-sh .");
39    system("cp $autodir/missing $autodir/depcomp .");
40
41    print "running autoscan...\n";
42    system("autoscan");
43}
44
45print "generating configure.ac...\n";
46
47$init_pat = "AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)";
48$init_dat = "AC_INIT(tgif, $version, $email)";
49$cmd = "sed -e '1,\$s/$init_pat/$init_dat/' configure.scan > configure.1.$$";
50system($cmd);
51
52$init_pat = "AC_INIT(\\\[FULL-PACKAGE-NAME\\\], \\\[VERSION\\\], \\\[BUG-REPORT-ADDRESS\\\])";
53$init_dat = "AC_INIT([tgif], [$version], [$email])";
54$cmd = "sed -e '1,\$s/$init_pat/$init_dat/' configure.1.$$ > configure.$$";
55system($cmd);
56
57system("awk -f scan2ac.awk configure.$$ > configure.ac");
58system("rm -f configure.1.$$ configure.$$");
59
60print "running aclocal...\n";
61system("aclocal");
62
63print "running autoheader...\n";
64system("autoheader");
65
66print "running automake -ac...\n";
67system("automake -ac");
68
69print "running autoconf...\n";
70system("autoconf");
71
72print "running configure...\n";
73system("./configure; cp Makefile Makefile.distr; make clean");
74