3 # BSD's m4 probably isn't gonna cut it, use gm4 if it is available
4 type gm4 >/dev/null 2>&1 && M4=gm4 || M4=m4
6 M4_VERSION=$($M4 --version | head -1 | sed -e 's/^\(m4 \)\?(\?GNU M4)\? *//g' )
7 GOOD_M4=$( echo $M4_VERSION | awk -F. '{if( ($1>1) || ( ($1==1) && ($2>4) ) || ( ($1==1) && ($2==4) && ($3>=6) )) print 1 }')
9 if [ "$GOOD_M4" != "1" ]; then
10 echo You have m4 version $M4_VERSION. SXEmacs requires m4 version 1.4.6 or later.
14 # To cater for Solaris
15 if test -d "/usr/xpg4/bin"; then
16 PATH=/usr/xpg4/bin:$PATH
20 type git >/dev/null 2>&1 && GIT=git
25 EXPECTED_TREE_VERSION="22.1.14"
28 if test -n "$GIT" -a -n "$($GIT symbolic-ref HEAD 2>/dev/null)"; then
29 TREE_VERSION="$($GIT tag|tail -n1|tr -d v)"
30 GIT_VERSION="$($GIT describe)"
33 if test -z "$TREE_VERSION"; then
34 TREE_VERSION="$EXPECTED_TREE_VERSION"
35 if test -n "$IN_GIT"; then
36 echo "If you cloned this branch into your own you should issue:"
37 echo "\tgit tag -s v${TREE_VERSION}.<your branch_name>"
38 echo "\tgit push --tag"
41 if test -z "$GIT_VERSION"; then
42 GIT_VERSION="${TREE_VERSION}-no_git_version"
45 emacs_major_version="$(echo $TREE_VERSION|cut -d. -f1)"
46 emacs_minor_version="$(echo $TREE_VERSION|cut -d. -f2)"
47 emacs_beta_version="$(echo $TREE_VERSION|cut -d. -f3)"
48 emacs_full_version="$emacs_major_version.$emacs_minor_version.$emacs_beta_version"
49 sxemacs_codename="Geo"
50 sxemacs_git_version="$GIT_VERSION"
52 if test "$emacs_full_version" != "$EXPECTED_TREE_VERSION"; then
53 # Note, there is no need check for git repos, because
54 # it can only happen in such a case anyway...
55 echo "*******************************************"
56 echo " WARNING: Your git tags may be out of date "
58 echo " Expected tree version $EXPECTED_TREE_VERSION "
59 echo " got $emacs_full_version (from $TREE_VERSION) "
66 echo "*******************************************"
69 autoconf_ver=$(autoconf --version 2>/dev/null | head -n1)
70 autoheader_ver=$(autoheader --version 2>/dev/null | head -n1)
71 automake_ver=$(automake --version 2>/dev/null | head -n1)
72 aclocal_ver=$(aclocal --version 2>/dev/null | head -n1)
73 libtool_ver=$(libtool --version 2>/dev/null | head -n1)
76 # When things go wrong... get a bigger hammer!
77 if test -n "$PHAMMER"; then
81 if test -n "$HAMMER"; then
82 if test -n "$GIT" -a -n "$($GIT symbolic-ref HEAD 2>/dev/null)"; then
85 echo "ERROR: Not a git workspace, or you don't have git" >&2
92 cat>sxemacs_version.m4<<EOF
93 dnl autogenerated version number
94 m4_define([SXEM4CS_VERSION], [$emacs_full_version])
95 m4_define([SXEM4CS_MAJOR_VERSION], [$emacs_major_version])
96 m4_define([SXEM4CS_MINOR_VERSION], [$emacs_minor_version])
97 m4_define([SXEM4CS_BETA_VERSION], [$emacs_beta_version])
98 m4_define([SXEM4CS_BETA_P], [$emacs_is_beta])
99 m4_define([SXEM4CS_GIT_VERSION], [$sxemacs_git_version])
100 m4_define([SXEM4CS_CODENAME], [$sxemacs_codename])
101 m4_define([4UTOCONF_VERSION], [$autoconf_ver])
102 m4_define([4UTOHEADER_VERSION], [$autoheader_ver])
103 m4_define([4CLOCAL_VERSION], [$aclocal_ver])
104 m4_define([4UTOMAKE_VERSION], [$automake_ver])
105 m4_define([4IBTOOL_VERSION], [$libtool_ver])
108 if test -z "$FORCE"; then
111 rm -rf autom4te.cache aclocal.m4
115 if type glibtoolize 2>/dev/null; then
116 LIBTOOLIZE=glibtoolize
118 LIBTOOLIZE=libtoolize
121 autoreconf $FORCE --verbose --install -Wall
123 # hack-o-matic. Using gmp's config.{guess,sub} lets us have properer
124 # detected machine configurations --SY.
125 guess=$(grep GMP config.guess)
126 sub=$(grep GMP config.sub)
127 if test -z "${guess}"; then
128 mv -vf config.guess configfsf.guess
129 cp -v configgmp.guess config.guess
131 if test -z "${sub}"; then
132 mv -vf config.sub configfsf.sub
133 cp -v configgmp.sub config.sub