2 # Configure script bootstrap for SXEmacs
4 # Copyright (C) 2005, 2006, 2007 Steve Youngs.
5 # Copyright (C) 2006, 2007, 2008 Sebastian Freundt.
6 # Copyright (C) 2007, 2010, 2011 Nelson Ferreira
8 # This file is part of SXEmacs.
10 # SXEmacs is free software: you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation, either version 3 of the License, or
13 # (at your option) any later version.
15 # SXEmacs is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 # Parts of SXEmacs are also distributed under a BSD-like licence.
24 # Check file headers for more information.
26 # BSD's m4 probably isn't gonna cut it, use gm4 if it is available
27 type gm4 >/dev/null 2>&1 && M4=gm4 || M4=m4
29 M4_VERSION=$($M4 --version | head -n1 | sed -e 's/^\(m4 \)\?(\?GNU M4)\? *//g' )
30 GOOD_M4=$( echo $M4_VERSION | awk -F. '{if( ($1>1) || ( ($1==1) && ($2>4) ) || ( ($1==1) && ($2==4) && ($3>=6) )) print 1 }')
32 if [ "$GOOD_M4" != "1" ]; then
33 echo You have m4 version $M4_VERSION. SXEmacs requires m4 version 1.4.6 or later.
37 # To cater for Solaris
38 if test -d "/usr/xpg4/bin"; then
39 PATH=/usr/xpg4/bin:$PATH
43 type git >/dev/null 2>&1 && GIT=git
48 EXPECTED_TREE_VERSION="22.1.14"
51 if test -n "$GIT" -a -n "$($GIT symbolic-ref HEAD 2>/dev/null)"; then
52 TREE_VERSION="$($GIT tag|tail -n1|tr -d v)"
53 GIT_VERSION="$($GIT describe | head -n1)"
56 if test -z "$TREE_VERSION"; then
57 TREE_VERSION="$EXPECTED_TREE_VERSION"
58 if test -n "$IN_GIT"; then
59 echo "If you cloned this branch into your own you should issue:"
60 echo "\tgit tag -s v${TREE_VERSION}.<your branch_name>"
61 echo "\tgit push --tag"
64 if test -z "$GIT_VERSION"; then
65 GIT_VERSION="${TREE_VERSION}-no_git_version"
68 emacs_major_version="$(echo $TREE_VERSION|cut -d. -f1)"
69 emacs_minor_version="$(echo $TREE_VERSION|cut -d. -f2)"
70 emacs_beta_version="$(echo $TREE_VERSION|cut -d. -f3)"
71 emacs_full_version="$emacs_major_version.$emacs_minor_version.$emacs_beta_version"
72 sxemacs_codename="Geo"
73 sxemacs_git_version="$GIT_VERSION"
75 if test "$emacs_full_version" != "$EXPECTED_TREE_VERSION"; then
76 # Note, there is no need check for git repos, because
77 # it can only happen in such a case anyway...
78 echo "*******************************************"
79 echo " WARNING: Your git tags may be out of date "
81 echo " Expected tree version $EXPECTED_TREE_VERSION "
82 echo " got $emacs_full_version (from $TREE_VERSION) "
89 echo "*******************************************"
92 autoconf_ver=$(autoconf --version 2>/dev/null | head -n1)
93 autoheader_ver=$(autoheader --version 2>/dev/null | head -n1)
94 automake_ver=$(automake --version 2>/dev/null | head -n1)
95 aclocal_ver=$(aclocal --version 2>/dev/null | head -n1)
96 libtool_ver=$(libtool --version 2>/dev/null | head -n1)
99 # When things go wrong... get a bigger hammer!
100 if test -n "$PHAMMER"; then
104 if test -n "$HAMMER"; then
105 if test -n "$GIT" -a -n "$($GIT symbolic-ref HEAD 2>/dev/null)"; then
108 echo "ERROR: Not a git workspace, or you don't have git" >&2
115 cat>sxemacs_version.m4<<EOF
116 dnl autogenerated version number
117 m4_define([SXEM4CS_VERSION], [$emacs_full_version])
118 m4_define([SXEM4CS_MAJOR_VERSION], [$emacs_major_version])
119 m4_define([SXEM4CS_MINOR_VERSION], [$emacs_minor_version])
120 m4_define([SXEM4CS_BETA_VERSION], [$emacs_beta_version])
121 m4_define([SXEM4CS_BETA_P], [$emacs_is_beta])
122 m4_define([SXEM4CS_GIT_VERSION], [$sxemacs_git_version])
123 m4_define([SXEM4CS_CODENAME], [$sxemacs_codename])
124 m4_define([4UTOCONF_VERSION], [$autoconf_ver])
125 m4_define([4UTOHEADER_VERSION], [$autoheader_ver])
126 m4_define([4CLOCAL_VERSION], [$aclocal_ver])
127 m4_define([4UTOMAKE_VERSION], [$automake_ver])
128 m4_define([4IBTOOL_VERSION], [$libtool_ver])
131 if test -z "$FORCE"; then
134 rm -rf autom4te.cache aclocal.m4
138 if type glibtoolize 2>/dev/null; then
139 LIBTOOLIZE=glibtoolize
141 LIBTOOLIZE=libtoolize
144 autoreconf $FORCE --verbose --install -Wall
146 # hack-o-matic. Using gmp's config.{guess,sub} lets us have properer
147 # detected machine configurations --SY.
148 guess=$(grep GMP config.guess)
149 sub=$(grep GMP config.sub)
150 if test -z "${guess}"; then
151 mv -vf config.guess configfsf.guess
152 cp -v configgmp.guess config.guess
154 if test -z "${sub}"; then
155 mv -vf config.sub configfsf.sub
156 cp -v configgmp.sub config.sub