summaryrefslogtreecommitdiff
path: root/build-aux/no-bogus-m4-defines
blob: 6767e6103ba61c10c6c69032102bde36621ecb90 (plain)
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
#! /bin/sh

#   no-bogus-m4-defines - detect wrong m4 definitions
#   -------------------------------------------------
#   Try to catch the case where 'aclocal' pulls installed libtool
#   macro file contents from another version of libtool into the
#   current package 'aclocal.m4'.  Currently used by 'make dist'
#   and by ./bootstrap (bootstrap.conf).
#
#   Copyright (C) 2015-2016 Free Software Foundation, Inc.
#
#   This file is part of GNU Libtool.
#
# GNU Libtool 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.
#
# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
# or obtained by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

# Please report bugs or propose patches to bug-libtool@gnu.org.

. `echo "$0" |${SED-sed} 's|[^/]*$||'`/funclib.sh
# source this for "GNU m4" detection methods
. `echo "$0" |${SED-sed} 's|[^/]*$||'`/extract-trace

$require_gnu_m4

bogus_macros='LT_INIT AC_PROG_LIBTOOL AM_PROG_LIBTOOL'

bogus_macros_grep=''
for macro in $bogus_macros; do
  func_append bogus_macros_grep "/$macro/p;"
done

clean_false_alarms="pushdef(\`AC_BEFORE', \`')"

bogus_macros_check_output=`$ECHO "$clean_false_alarms" \
  |$M4 - aclocal.m4 libltdl/aclocal.m4 \
  |$SED -n "$bogus_macros_grep"`

exit_val=0
for macro in $bogus_macros; do
  case $bogus_macros_check_output in
    *$macro*)
      func_error "Bogus $macro macro definition in an aclocal.m4 file"
      exit_val=1
      ;;
  esac
done

exit $exit_val