| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# Copyright by The HDF Group. |
| 4 |
# Copyright by the Board of Trustees of the University of Illinois. |
| 5 |
# All rights reserved. |
| 6 |
# |
| 7 |
# This file is part of HDF. The full HDF copyright notice, including |
| 8 |
# terms governing use, modification, and redistribution, is contained in |
| 9 |
# the COPYING file, which can be found at the root of the source code |
| 10 |
# distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. |
| 11 |
# If you do not have access to either file, you may request a copy from |
| 12 |
# [email protected]. |
| 13 |
# |
| 14 |
|
| 15 |
USAGE() |
| 16 |
{ |
| 17 |
cat <<EOF |
| 18 |
|
| 19 |
switch_maint_mode reverses the status of AM_MAINTAINER_MODE in |
| 20 |
configure.ac from enable to disable or vice-versa. When enabled, |
| 21 |
this feature forces the autotools to run when the input files are |
| 22 |
older than the output files. This is the default for development |
| 23 |
branches. When disabled, the autotools will NOT be re-run regardless |
| 24 |
of their timestamps or any modifications. This is the default for |
| 25 |
tarballs and release branches since it avoids having end-users |
| 26 |
requiring the autotools. |
| 27 |
|
| 28 |
Command Syntax |
| 29 |
============== |
| 30 |
switch_maint_mode [-help] [-enable|disable] <path-to-configure.ac> |
| 31 |
|
| 32 |
EOF |
| 33 |
} |
| 34 |
|
| 35 |
MODE="notset" |
| 36 |
CONFIG_AC_PATH= |
| 37 |
|
| 38 |
# Display help/usage if any options were passed in |
| 39 |
while [ $# -gt 0 ]; do |
| 40 |
case "$1" in |
| 41 |
-enable) |
| 42 |
MODE="enable" |
| 43 |
;; |
| 44 |
-disable) |
| 45 |
MODE="disable" |
| 46 |
;; |
| 47 |
-help) |
| 48 |
USAGE |
| 49 |
exit 0 |
| 50 |
;; |
| 51 |
*) |
| 52 |
CONFIG_AC_PATH="$1" |
| 53 |
;; |
| 54 |
esac |
| 55 |
shift |
| 56 |
done |
| 57 |
|
| 58 |
# Did we get a file path? |
| 59 |
if test -z $CONFIG_AC_PATH ; then |
| 60 |
USAGE |
| 61 |
exit 1 |
| 62 |
fi |
| 63 |
|
| 64 |
# Did we get a mode? |
| 65 |
if test -z $MODE ; then |
| 66 |
USAGE |
| 67 |
exit 1 |
| 68 |
fi |
| 69 |
|
| 70 |
# Run perl over configure.ac |
| 71 |
if test "X-$MODE" = "X-enable" ; then |
| 72 |
perl -pi -e 's/^(AM_MAINTAINER_MODE\(\[)([a-z]+)(\]\))/$1enable$3/g' $CONFIG_AC_PATH |
| 73 |
fi |
| 74 |
if test "X-$MODE" = "X-disable" ; then |
| 75 |
perl -pi -e 's/^(AM_MAINTAINER_MODE\(\[)([a-z]+)(\]\))/$1disable$3/g' $CONFIG_AC_PATH |
| 76 |
fi |
| 77 |
|