comparison lib-src/config.values.sh @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents bfd6434d15b3
children 697ef44129c6
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
1 #! /bin/sh 1 : #-*- Perl -*-
2 eval 'exec perl -w -S $0 ${1+"$@"}' # Portability kludge
3 if 0;
4
2 # config.values.sh --- create config.values.in from ../configure 5 # config.values.sh --- create config.values.in from ../configure
3 6
4 # Author: Martin Buchholz 7 # Author: Martin Buchholz
5 # Maintainer: Martin Buchholz 8 # Maintainer: Martin Buchholz
6 # Keywords: configure elisp report-xemacs-bugs 9 # Keywords: configure elisp report-xemacs-bugs
33 ## 36 ##
34 ## This script needs only to be run occasionally (before a Net release) 37 ## This script needs only to be run occasionally (before a Net release)
35 ## by an XEmacs Maintainer (consider yourself so blessed, if you are 38 ## by an XEmacs Maintainer (consider yourself so blessed, if you are
36 ## actually reading this commentary). 39 ## actually reading this commentary).
37 ## 40 ##
38 if test ! -r ./configure; then
39 cd ..
40 if test ! -r ./configure; then
41 echo "Can't find configure!";
42 exit 1;
43 fi
44 fi
45 41
46 exec < ./configure > "lib-src/config.values.in" 42 if (! -r "./configure") {
47 cat <<\EOF 43 chdir ".." or die "Can't chdir: $!";
48 ;;; Do not edit this file! 44 if (! -r "./configure") {
45 die "Can't find configure!";
46 }
47 }
48
49 sub FileContents {
50 local $/ = undef; # Slurp mode
51 open (FILE, "< $_[0]") or die "$_[0]: $!";
52 my $contents = <FILE>;
53 close FILE or die "$_[0]: $!";
54 return $contents;
55 }
56
57 my $configure_contents = FileContents "./configure";
58 my $cvi_contents = FileContents "lib-src/config.values.in";
59
60 my $new_cvi_contents =
61 ";;; Do not edit this file!
49 ;;; This file was automatically generated, by the config.values.sh script, 62 ;;; This file was automatically generated, by the config.values.sh script,
50 ;;; from configure, which was itself automatically generated from configure.in 63 ;;; from configure, which was itself automatically generated from configure.in.
51 ;;; 64 ;;;
52 ;;; See lisp/util/config.el for details on how this file is used. 65 ;;; See lisp/util/config.el for details on how this file is used.
53 ;;; 66 ;;;
54 ;;; You are trapped in a twisty maze of strange-looking files, all autogenerated... 67 ;;; You are trapped in a twisty maze of strange-looking files, all autogenerated...
55 68
60 ;;; to create the (Lisp object) config-value-hash-table 73 ;;; to create the (Lisp object) config-value-hash-table
61 74
62 ;;; Variables defined in configure by AC_SUBST follow: 75 ;;; Variables defined in configure by AC_SUBST follow:
63 ;;; (These are used in Makefiles) 76 ;;; (These are used in Makefiles)
64 77
65 EOF 78 ";
66 sed -n '/^s%@\([A-Za-z_][A-Za-z_]*\)@%\$\1%g$/ {
67 s/^s%@\([A-Za-z_][A-Za-z_]*\)@%\$\1%g$/\1 "@\1@"/
68 p
69 }' | \
70 sort -u
71 cat <<\EOF
72 79
80 my %done;
81 for my $var (sort { $a cmp $b }
82 $configure_contents =~
83 /^s\%\@([A-Za-z0-9_]+)\@\%\$[A-Za-z0-9_]+\%g/mg) {
84 $new_cvi_contents .= "$var \"\@$var\@\"\n" unless exists $done{$var};
85 $done{$var} = 1;
86 }
87
88 $new_cvi_contents .= "
73 ;;; Variables defined in configure by AC_DEFINE and AC_DEFINE_UNQUOTED follow: 89 ;;; Variables defined in configure by AC_DEFINE and AC_DEFINE_UNQUOTED follow:
74 ;;; (These are used in C code) 90 ;;; (These are used in C code)
75 91
76 EOF 92 ";
93
94 if ($cvi_contents ne $new_cvi_contents) {
95 unlink "lib-src/config.values.in";
96 open (CVI, "> lib-src/config.values.in")
97 or die "lib-src/config.values.in: $!";
98 print CVI $new_cvi_contents;
99 close CVI
100 or die "lib-src/config.values.in: $!";
101 }