Merge from emacs-23
[bpt/emacs.git] / admin / build-configs
1 #! /usr/bin/perl
2 # Build Emacs in several different configurations.
3
4 # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
5 # Free Software Foundation, Inc.
6
7 # This file is part of GNU Emacs.
8
9 # GNU Emacs is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13
14 # GNU Emacs is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18
19 # You should have received a copy of the GNU General Public License
20 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
21
22
23 require 5;
24 use Getopt::Long;
25 use File::Basename;
26 use Cwd;
27
28 @configs =
29 (
30 ["--without-x", "--optim"],
31 ["--without-x-toolkit", "--optim"],
32 ["--without-toolkit-scroll-bars", "--optim"],
33 ["--with-x-toolkit=lucid", "--optim"],
34 ["--with-x-toolkit=motif", "--optim"],
35 ["--with-x-toolkit=motif", "--enable-checking"],
36 ["--with-x-toolkit=motif", "--gcc3"],
37 ["--with-x-toolkit=motif", ""],
38 );
39
40 $log = "/tmp/$$.out";
41 print "Using log file $log\n";
42 unlink $log;
43
44 $root = $ENV{"EMACS_ROOT"};
45 $root = "/gd/gnu/emacs" unless $root;
46
47 $rc = GetOptions ("help" => \$help);
48 if ($rc == 0 || $help)
49 {
50 print <<USAGE;
51 build-configs
52
53 Build Emacs in different configurations.
54
55 --help show this help
56
57 USAGE
58 exit 1;
59 }
60
61 # Chdir to the top-level directory of the tree. If not in a tree
62 # containing Emacs, use the default.
63
64 while (! -f "src/emacs.c" && cwd () ne "/")
65 {
66 chdir "..";
67 }
68
69 chdir $root if cwd () eq "/";
70 print "Build in ", cwd (), "\n";
71
72 foreach $config (@configs)
73 {
74 my $configure_options = @$config[0];
75 my $make_options = @$config[1];
76 my $rc;
77
78 print "$configure_options, $make_options\n";
79 unlink "config.cache";
80
81 $rc = system ("$root/configure $configure_options >>$log 2>&1");
82 if ($rc != 0)
83 {
84 print "configure failed\n";
85 exit 1;
86 }
87
88 $rc = system ("make-emacs --all $make_options >>$log 2>&1");
89 if ($rc != 0)
90 {
91 print "Make failed\n";
92 exit 1;
93 }
94 }
95
96 # Local Variables:
97 # mode: cperl
98 # End:
99
100 # arch-tag: 20a4452d-610a-4e54-9abc-ffe79f5c0d30