2 # Configure script bootstrap for SXEmacs
4 # Copyright (C) 2005 - 2012 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
29 type gm4 >/dev/null 2>&1 && M4=gm4 || M4=m4
32 M4_VERSION=$($M4 --version | head -n1 | sed -e 's/^\(m4 \)\?(\?GNU M4)\? *//g' )
33 GOOD_M4=$( echo $M4_VERSION | awk -F. '{if( ($1>1) || ( ($1==1) && ($2>4) ) || ( ($1==1) && ($2==4) && ($3>=6) )) print 1 }')
35 if [ "$GOOD_M4" != "1" ]; then
36 echo You have m4 version $M4_VERSION. SXEmacs requires m4 version 1.4.6 or later.
40 # To cater for Solaris
41 if test -d "/usr/xpg4/bin"; then
42 # don't add xpg4 dir to PATH if on OpenIndiana
43 grep -q OpenIndiana /etc/release 2>/dev/null||PATH=/usr/xpg4/bin:$PATH
49 type git >/dev/null 2>&1 && GIT=git
56 EXPECTED_TREE_VERSION="22.1.15"
59 if test -n "$GIT" -a -n "$($GIT symbolic-ref HEAD 2>/dev/null)"; then
60 TREE_VERSION="$($GIT tag|tail -n1|tr -d v)"
61 GIT_VERSION="$($GIT describe | head -n1)"
62 GIT_BRANCH="$(git branch --no-color | awk '/^\*/ { print $2 }')"
65 if test -z "$TREE_VERSION"; then
66 TREE_VERSION="$EXPECTED_TREE_VERSION"
67 if test -n "$IN_GIT"; then
68 echo "If you cloned this branch into your own you could issue:"
69 echo "\tgit tag -s v${TREE_VERSION}.<your branch_name>"
71 echo "Be careful about pushing the tags as they probably will be "
72 echo "more of a nuisance..."
74 TREE_VERSION="$EXPECTED_TREE_VERSION.$GIT_BRANCH"
75 echo "For now I am assuming the tre version will be $TREE_VERSION"
79 if test -z "$GIT_VERSION"; then
80 GIT_VERSION="${TREE_VERSION}-no_git_version"
83 emacs_major_version="$(echo $TREE_VERSION|cut -d. -f1)"
84 emacs_minor_version="$(echo $TREE_VERSION|cut -d. -f2)"
85 emacs_beta_version="$(echo $TREE_VERSION|cut -d. -f3)"
86 emacs_full_version="$emacs_major_version.$emacs_minor_version.$emacs_beta_version"
87 sxemacs_codename="Goggomobil"
88 sxemacs_git_version="$GIT_VERSION"
90 if test "$emacs_full_version" != "$EXPECTED_TREE_VERSION"; then
91 # Note, there is no need check for git repos, because
92 # it can only happen in such a case anyway...
93 echo "*******************************************"
94 echo " WARNING: Your git tags may be out of date "
96 echo " Expected tree version $EXPECTED_TREE_VERSION "
97 echo " got $emacs_full_version (from $TREE_VERSION) "
104 echo "*******************************************"
107 test -z "$AUTOCONF" && type autoconf >/dev/null 2>&1 && AUTOCONF=autoconf
109 test -z "$AUTORECONF" && type autoreconf >/dev/null 2>&1 && AUTORECONF=autoreconf
111 test -z "$AUTOHEADER" && type autoheader >/dev/null 2>&1 && AUTOHEADER=autoheader
113 test -z "$AUTOMAKE" && type automake >/dev/null 2>&1 && AUTOMAKE=automake
115 test -z "$ACLOCAL" && type aclocal >/dev/null 2>&1 && ACLOCAL=aclocal
117 test -z "$LIBTOOL" && type libtool >/dev/null 2>&1 && LIBTOOL=libtool
120 autoconf_ver=$($AUTOCONF --version 2>/dev/null | head -n1)
121 if test -z "$autoconf_ver"; then
122 echo Could not determine autoconf
125 autoreconf_ver=$($AUTORECONF --version 2>/dev/null | head -n1)
126 if test -z "$autoreconf_ver"; then
127 echo Could not determine autoreconf
130 autoheader_ver=$($AUTOHEADER --version 2>/dev/null | head -n1)
131 if test -z "$autoheader_ver"; then
132 echo Could not determine autoheader
135 automake_ver=$($AUTOMAKE --version 2>/dev/null | head -n1)
136 if test -z "$automake_ver"; then
137 echo Could not determine automake
140 aclocal_ver=$($ACLOCAL --version 2>/dev/null | head -n1)
141 if test -z "$aclocal_ver"; then
142 echo Could not determine aclocal
145 libtool_ver=$($LIBTOOL --version 2>/dev/null | head -n1)
146 if test -z "$libtool_ver"; then
147 echo Could not determine libtool
151 # When things go wrong... get a bigger hammer!
152 if test -n "$PHAMMER"; then
156 if test -n "$HAMMER"; then
157 if test -n "$GIT" -a -n "$($GIT symbolic-ref HEAD 2>/dev/null)"; then
160 echo "ERROR: Not a git workspace, or you don't have git" >&2
167 cat>sxemacs_version.m4<<EOF
168 dnl autogenerated version number
169 m4_define([SXEM4CS_VERSION], [$emacs_full_version])
170 m4_define([SXEM4CS_MAJOR_VERSION], [$emacs_major_version])
171 m4_define([SXEM4CS_MINOR_VERSION], [$emacs_minor_version])
172 m4_define([SXEM4CS_BETA_VERSION], [$emacs_beta_version])
173 m4_define([SXEM4CS_BETA_P], [$emacs_is_beta])
174 m4_define([SXEM4CS_GIT_VERSION], [$sxemacs_git_version])
175 m4_define([SXEM4CS_CODENAME], [$sxemacs_codename])
176 m4_define([4UTOCONF_VERSION], [$autoconf_ver])
177 m4_define([4UTOHEADER_VERSION], [$autoheader_ver])
178 m4_define([4CLOCAL_VERSION], [$aclocal_ver])
179 m4_define([4UTOMAKE_VERSION], [$automake_ver])
180 m4_define([4IBTOOL_VERSION], [$libtool_ver])
183 if type glibtoolize 2>/dev/null; then
184 LIBTOOLIZE=glibtoolize
186 LIBTOOLIZE=libtoolize
189 # using libtoolize as we did before doesn't work anymore, so just mkdir --Horst
190 test -d libtld/m4 || mkdir -p libltdl/m4
191 $AUTORECONF --force --verbose --install -Wall
193 # hack-o-matic. Using gmp's config.{guess,sub} lets us have properer
194 # detected machine configurations --SY.
195 guess=$(grep GMP config.guess)
196 sub=$(grep GMP config.sub)
197 if test -z "${guess}"; then
198 mv -f config.guess configfsf.guess
199 cp configgmp.guess config.guess
201 if test -z "${sub}"; then
202 mv -f config.sub configfsf.sub
203 cp configgmp.sub config.sub