3 # Configure script bootstrap for SXEmacs
5 # Copyright (C) 2005, 2006, 2007 Steve Youngs.
6 # Copyright (C) 2006, 2007, 2008 Sebastian Freundt.
7 # Copyright (C) 2007, 2010, 2011 Nelson Ferreira
9 # This file is part of SXEmacs.
11 # SXEmacs is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your option) any later version.
16 # SXEmacs is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 # Parts of SXEmacs are also distributed under a BSD-like licence.
25 # Check file headers for more information.
28 # 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
31 M4_VERSION=$($M4 --version | head -1 | sed -e 's/^\(m4 \)\?(\?GNU M4)\? *//g' )
32 GOOD_M4=$( echo $M4_VERSION | awk -F. '{if( ($1>1) || ( ($1==1) && ($2>4) ) || ( ($1==1) && ($2==4) && ($3>=6) )) print 1 }')
34 if [ "$GOOD_M4" != "1" ]; then
35 echo You have m4 version $M4_VERSION. SXEmacs requires m4 version 1.4.6 or later.
39 # To cater for Solaris
40 if test -d "/usr/xpg4/bin"; then
41 PATH=/usr/xpg4/bin:$PATH
45 type git >/dev/null 2>&1 && GIT=git
50 EXPECTED_TREE_VERSION="22.1.14"
53 if test -n "$GIT" -a -n "$($GIT symbolic-ref HEAD 2>/dev/null)"; then
54 TREE_VERSION="$($GIT tag|tail -n1|tr -d v)"
55 GIT_VERSION="$($GIT describe)"
58 if test -z "$TREE_VERSION"; then
59 TREE_VERSION="$EXPECTED_TREE_VERSION"
60 if test -n "$IN_GIT"; then
61 echo "If you cloned this branch into your own you should issue:"
62 echo "\tgit tag -s v${TREE_VERSION}.<your branch_name>"
63 echo "\tgit push --tag"
66 if test -z "$GIT_VERSION"; then
67 GIT_VERSION="${TREE_VERSION}-no_git_version"
70 emacs_major_version="$(echo $TREE_VERSION|cut -d. -f1)"
71 emacs_minor_version="$(echo $TREE_VERSION|cut -d. -f2)"
72 emacs_beta_version="$(echo $TREE_VERSION|cut -d. -f3)"
73 emacs_full_version="$emacs_major_version.$emacs_minor_version.$emacs_beta_version"
74 sxemacs_codename="Geo"
75 sxemacs_git_version="$GIT_VERSION"
77 if test "$emacs_full_version" != "$EXPECTED_TREE_VERSION"; then
78 # Note, there is no need check for git repos, because
79 # it can only happen in such a case anyway...
80 echo "*******************************************"
81 echo " WARNING: Your git tags may be out of date "
83 echo " Expected tree version $EXPECTED_TREE_VERSION "
84 echo " got $emacs_full_version (from $TREE_VERSION) "
91 echo "*******************************************"
94 autoconf_ver=$(autoconf --version 2>/dev/null | head -n1)
95 autoheader_ver=$(autoheader --version 2>/dev/null | head -n1)
96 automake_ver=$(automake --version 2>/dev/null | head -n1)
97 aclocal_ver=$(aclocal --version 2>/dev/null | head -n1)
98 libtool_ver=$(libtool --version 2>/dev/null | head -n1)
101 # When things go wrong... get a bigger hammer!
102 if test -n "$PHAMMER"; then
106 if test -n "$HAMMER"; then
107 if test -n "$GIT" -a -n "$($GIT symbolic-ref HEAD 2>/dev/null)"; then
110 echo "ERROR: Not a git workspace, or you don't have git" >&2
117 cat>sxemacs_version.m4<<EOF
118 dnl autogenerated version number
119 m4_define([SXEM4CS_VERSION], [$emacs_full_version])
120 m4_define([SXEM4CS_MAJOR_VERSION], [$emacs_major_version])
121 m4_define([SXEM4CS_MINOR_VERSION], [$emacs_minor_version])
122 m4_define([SXEM4CS_BETA_VERSION], [$emacs_beta_version])
123 m4_define([SXEM4CS_BETA_P], [$emacs_is_beta])
124 m4_define([SXEM4CS_GIT_VERSION], [$sxemacs_git_version])
125 m4_define([SXEM4CS_CODENAME], [$sxemacs_codename])
126 m4_define([4UTOCONF_VERSION], [$autoconf_ver])
127 m4_define([4UTOHEADER_VERSION], [$autoheader_ver])
128 m4_define([4CLOCAL_VERSION], [$aclocal_ver])
129 m4_define([4UTOMAKE_VERSION], [$automake_ver])
130 m4_define([4IBTOOL_VERSION], [$libtool_ver])
133 if test -z "$FORCE"; then
136 rm -rf autom4te.cache aclocal.m4
140 if type glibtoolize 2>/dev/null; then
141 LIBTOOLIZE=glibtoolize
143 LIBTOOLIZE=libtoolize
146 autoreconf $FORCE --verbose --install -Wall
148 # hack-o-matic. Using gmp's config.{guess,sub} lets us have properer
149 # detected machine configurations --SY.
150 guess=$(grep GMP config.guess)
151 sub=$(grep GMP config.sub)
152 if test -z "${guess}"; then
153 mv -vf config.guess configfsf.guess
154 cp -v configgmp.guess config.guess
156 if test -z "${sub}"; then
157 mv -vf config.sub configfsf.sub
158 cp -v configgmp.sub config.sub