comparison lib-src/config.values.sh @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 74fd4e045ea6
children
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
1 : #-*- Perl -*- 1 #! /bin/sh
2 eval 'exec perl -w -S $0 ${1+"$@"}' # Portability kludge
3 if 0;
4
5 # config.values.sh --- create config.values.in from ../configure 2 # config.values.sh --- create config.values.in from ../configure
6 3
7 # Author: Martin Buchholz 4 # Author: Martin Buchholz
8 # Maintainer: Martin Buchholz 5 # Maintainer: Martin Buchholz
9 # Keywords: configure elisp report-xemacs-bugs 6 # Keywords: configure elisp report-xemacs-bugs
36 ## 33 ##
37 ## This script needs only to be run occasionally (before a Net release) 34 ## This script needs only to be run occasionally (before a Net release)
38 ## by an XEmacs Maintainer (consider yourself so blessed, if you are 35 ## by an XEmacs Maintainer (consider yourself so blessed, if you are
39 ## actually reading this commentary). 36 ## actually reading this commentary).
40 ## 37 ##
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
41 45
42 if (! -r "./configure") { 46 exec < ./configure > "lib-src/config.values.in"
43 chdir ".." or die "Can't chdir: $!"; 47 cat <<\EOF
44 if (! -r "./configure") { 48 ;;; Do not edit this file!
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!
62 ;;; This file was automatically generated, by the config.values.sh script, 49 ;;; This file was automatically generated, by the config.values.sh script,
63 ;;; from configure, which was itself automatically generated from configure.in. 50 ;;; from configure, which was itself automatically generated from configure.in
64 ;;; 51 ;;;
65 ;;; See lisp/util/config.el for details on how this file is used. 52 ;;; See lisp/util/config.el for details on how this file is used.
66 ;;; 53 ;;;
67 ;;; You are trapped in a twisty maze of strange-looking files, all autogenerated... 54 ;;; You are trapped in a twisty maze of strange-looking files, all autogenerated...
68 55
73 ;;; to create the (Lisp object) config-value-hash-table 60 ;;; to create the (Lisp object) config-value-hash-table
74 61
75 ;;; Variables defined in configure by AC_SUBST follow: 62 ;;; Variables defined in configure by AC_SUBST follow:
76 ;;; (These are used in Makefiles) 63 ;;; (These are used in Makefiles)
77 64
78 "; 65 EOF
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
79 72
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 .= "
89 ;;; Variables defined in configure by AC_DEFINE and AC_DEFINE_UNQUOTED follow: 73 ;;; Variables defined in configure by AC_DEFINE and AC_DEFINE_UNQUOTED follow:
90 ;;; (These are used in C code) 74 ;;; (These are used in C code)
91 75
92 "; 76 EOF
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 }