X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/e61d39cddfd015032a6419ce75c36ecdf1e9fe9f..40ce283460ee15747f71ed0eb72d75846391a98a:/autogen.sh diff --git a/autogen.sh b/autogen.sh index 9cfaa40eee..614bdc71b6 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,9 +1,10 @@ #!/bin/sh -### autogen.sh - tool to help build Emacs from a bzr checkout +### autogen.sh - tool to help build Emacs from a repository checkout -## Copyright (C) 2011-2012 Free Software Foundation, Inc. +## Copyright (C) 2011-2014 Free Software Foundation, Inc. ## Author: Glenn Morris +## Maintainer: emacs-devel@gnu.org ## This file is part of GNU Emacs. @@ -22,10 +23,10 @@ ### Commentary: -## The Emacs bzr repository does not include the configure script -## (and associated helpers). The first time you fetch Emacs from bzr, +## The Emacs repository does not include the configure script (and +## associated helpers). The first time you fetch Emacs from the repo, ## run this script to generate the necessary files. -## For more details, see the file INSTALL.BZR. +## For more details, see the file INSTALL.REPO. ### Code: @@ -49,7 +50,7 @@ automake_min=`sed -n 's/^ *AM_INIT_AUTOMAKE(\([0-9\.]*\)).*/\1/p' configure.ac` get_version () { ## Remove eg "./autogen.sh: line 50: autoconf: command not found". - $1 --version 2>&1 | sed -e '/not found/d' -n -e '1 s/.* \([1-9][0-9\.]*\).*/\1/p' + $1 --version 2>&1 | sed -e '/not found/d' -e 's/.* //' -n -e '1 s/\([0-9][0-9\.]*\).*/\1/p' } ## $1 = version string, eg "2.59" @@ -75,7 +76,7 @@ minor_version () check_version () { ## Respect eg $AUTOMAKE if it is set, like autoreconf does. - uprog=`echo $1 | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + uprog=`echo $1 | sed -e 's/-/_/g' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` eval uprog=\$${uprog} @@ -105,7 +106,7 @@ check_version () cat < src/stamp-h.in || exit -echo "You can now run \`./configure'." +## Install Git hooks, if using Git. +if test -d .git/hooks; then + tailored_hooks= + sample_hooks= + + for hook in commit-msg pre-commit; do + cmp build-aux/git-hooks/$hook .git/hooks/$hook >/dev/null 2>&1 || + tailored_hooks="$tailored_hooks $hook" + done + for hook in applypatch-msg pre-applypatch; do + cmp .git/hooks/$hook.sample .git/hooks/$hook >/dev/null 2>&1 || + sample_hooks="$sample_hooks $hook" + done + + if test -n "$tailored_hooks$sample_hooks"; then + echo "Installing git hooks..." + + case `cp --help 2>/dev/null` in + *--backup*--verbose*) + cp_options='--backup=numbered --verbose';; + *) + cp_options='';; + esac + + if test -n "$tailored_hooks"; then + for hook in $tailored_hooks; do + cp $cp_options build-aux/git-hooks/$hook .git/hooks || exit + chmod a-w .git/hooks/$hook || exit + done + fi + + if test -n "$sample_hooks"; then + for hook in $sample_hooks; do + cp $cp_options .git/hooks/$hook.sample .git/hooks/$hook || exit + chmod a-w .git/hooks/$hook || exit + done + fi + fi +fi + +echo "You can now run './configure'." exit 0