File: ac_gen

package info (click to toggle)
regina-normal 4.3.1-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 16,396 kB
  • ctags: 7,338
  • sloc: cpp: 55,359; sh: 17,392; ansic: 12,913; perl: 3,294; makefile: 918; python: 114
file content (150 lines) | stat: -rwxr-xr-x 3,809 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/sh
#
# Regina - A Normal Surface Theory Calculator
# Autoconf Preparation Utility
#
# Copyright (c) 2002-2006, Ben Burton
# For further details contact Ben Burton (bab@debian.org).
#
# Usage: ac_gen
#
# Regenerates ../configure.ac and ../acinclude.m4 from files within this
# (admin) subdirectory.
#
# This script should NOT be run directly; to use it run "make -f Makefile.svn"
# from the top-level source directory (the directory above this).
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA.
#

set -e

# Are we in the top-level source directory?

if ! test -d admin; then
  echo "This script should not be run directly." 1>&2
  echo "To use it, run \"make -f Makefile.svn\" from the top-level" 1>&2
  echo "source directory." 1>&2
  exit 1
fi

# ------------------------
# Regenerate configure.ac:
# ------------------------

real=configure.ac
output=configure.ac.tmp

echo "Regenerating $real:"

# Actually generate the new file.

cat > "$output" <<EOF
dnl
dnl    DO NOT EDIT THIS FILE DIRECTLY if this source tree has been checked
dnl    out from subversion or CVS.  It has been automatically generated by
dnl    Makefile.svn and any changes will be overwritten.  Try editing
dnl    configure.ac.top or configure.ac.bot from subdirectory ./admin instead.
EOF

cat admin/configure.ac.top >> "$output"

echo "# List of Makefiles (automatically generated by Makefile.svn):" \
  >> "$output"
for i in `find . -name Makefile.am | sort | sed -e 's#^./##;s#\.am$##'`; do
  case "$i" in
    ./Makefile )
      echo "AC_CONFIG_FILES([Makefile])" >> "$output"
    ;;
    javaui/* )
    ;;
    test/* )
    ;;
    utils/local/* )
    ;;
    utils/snappea/* )
    ;;
    * )
      echo "AC_CONFIG_FILES([$i])" >> "$output"
    ;;
  esac
done

cat admin/configure.ac.bot >> "$output"

# Did configure.ac change?

if test -e "$real"; then
  if diff "$output" "$real" > /dev/null; then
    echo "File $real is unchanged."
    rm -f "$output"
  else
    echo "File $real has changed."
    rm -f "$real"
    mv "$output" "$real"
  fi
else
  echo "File $real is new."
  mv "$output" "$real"
fi

# ------------------------
# Regenerate acinclude.m4:
# ------------------------

real=acinclude.m4
output=acinclude.m4.tmp

echo "Regenerating $real:"

# Actually generate the new file.

cat > "$output" <<EOF
dnl
dnl    DO NOT EDIT THIS FILE DIRECTLY if this source tree has been checked
dnl    out from subversion or CVS.  It has been automatically generated by
dnl    Makefile.svn and any changes will be overwritten.  Try editing
dnl    acinclude.m4.top from subdirectory ./admin instead.
EOF

cat admin/acinclude.m4.top >> "$output"

for i in admin/*.m4.ext; do
  echo "Adding $i..."
  echo >> "$output"
  echo "dnl" >> "$output"
  echo "dnl    Imported by $0: $i" >> "$output"
  echo "dnl" >> "$output"
  echo >> "$output"
  cat "$i" >> "$output"
done

# Did acinclude.m4 change?

if test -e "$real"; then
  if diff "$output" "$real" > /dev/null; then
    echo "File $real is unchanged."
    rm -f "$output"
  else
    echo "File $real has changed."
    rm -f "$real"
    mv "$output" "$real"
  fi
else
  echo "File $real is new."
  mv "$output" "$real"
fi