-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautogen.sh
executable file
·162 lines (138 loc) · 5.26 KB
/
autogen.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/bin/sh
# Configure script bootstrap for SXEmacs
#
# Copyright (C) 2005 - 2012 Steve Youngs.
# Copyright (C) 2006, 2007, 2008 Sebastian Freundt.
# Copyright (C) 2007, 2010, 2011 Nelson Ferreira
# This file is part of SXEmacs.
# SXEmacs is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# SXEmacs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Parts of SXEmacs are also distributed under a BSD-like licence.
# Check file headers for more information.
# BSD's m4 probably isn't gonna cut it, use gm4 if it is available
type gm4 >/dev/null 2>&1 && M4=gm4 || M4=m4
M4_VERSION=$($M4 --version | head -n1 | sed -e 's/^\(m4 \)\?(\?GNU M4)\? *//g' )
GOOD_M4=$( echo $M4_VERSION | awk -F. '{if( ($1>1) || ( ($1==1) && ($2>4) ) || ( ($1==1) && ($2==4) && ($3>=6) )) print 1 }')
if [ "$GOOD_M4" != "1" ]; then
echo You have m4 version $M4_VERSION. SXEmacs requires m4 version 1.4.6 or later.
exit 1
fi
# To cater for Solaris
if test -d "/usr/xpg4/bin"; then
# don't add xpg4 dir to PATH if on OpenIndiana
grep -q OpenIndiana /etc/release 2>/dev/null||PATH=/usr/xpg4/bin:$PATH
export PATH
fi
type git >/dev/null 2>&1 && GIT=git
olddir=$(pwd)
srcdir=$(dirname $0)
cd "$srcdir"
EXPECTED_TREE_VERSION="22.1.15"
emacs_is_beta=t
if test -n "$GIT" -a -n "$($GIT symbolic-ref HEAD 2>/dev/null)"; then
TREE_VERSION="$($GIT tag|tail -n1|tr -d v)"
GIT_VERSION="$($GIT describe | head -n1)"
GIT_BRANCH="$(git branch --no-color | awk '/^\*/ { print $2 }')"
IN_GIT="1"
fi
if test -z "$TREE_VERSION"; then
TREE_VERSION="$EXPECTED_TREE_VERSION"
if test -n "$IN_GIT"; then
echo "If you cloned this branch into your own you could issue:"
echo "\tgit tag -s v${TREE_VERSION}.<your branch_name>"
echo ""
echo "Be careful about pushing the tags as they probably will be "
echo "more of a nuisance..."
echo ""
TREE_VERSION="$EXPECTED_TREE_VERSION.$GIT_BRANCH"
echo "For now I am assuming the tre version will be $TREE_VERSION"
echo ""
fi
fi
if test -z "$GIT_VERSION"; then
GIT_VERSION="${TREE_VERSION}-no_git_version"
fi
emacs_major_version="$(echo $TREE_VERSION|cut -d. -f1)"
emacs_minor_version="$(echo $TREE_VERSION|cut -d. -f2)"
emacs_beta_version="$(echo $TREE_VERSION|cut -d. -f3)"
emacs_full_version="$emacs_major_version.$emacs_minor_version.$emacs_beta_version"
sxemacs_codename="Goggomobil"
sxemacs_git_version="$GIT_VERSION"
if test "$emacs_full_version" != "$EXPECTED_TREE_VERSION"; then
# Note, there is no need check for git repos, because
# it can only happen in such a case anyway...
echo "*******************************************"
echo " WARNING: Your git tags may be out of date "
echo ""
echo " Expected tree version $EXPECTED_TREE_VERSION "
echo " got $emacs_full_version (from $TREE_VERSION) "
set -x
git tag
git describe
git describe --long
git config -l
set +x
echo "*******************************************"
fi
autoconf_ver=$(autoconf --version 2>/dev/null | head -n1)
autoheader_ver=$(autoheader --version 2>/dev/null | head -n1)
automake_ver=$(automake --version 2>/dev/null | head -n1)
aclocal_ver=$(aclocal --version 2>/dev/null | head -n1)
libtool_ver=$(libtool --version 2>/dev/null | head -n1)
# When things go wrong... get a bigger hammer!
if test -n "$PHAMMER"; then
HAMMER=$PHAMMER
fi
if test -n "$HAMMER"; then
if test -n "$GIT" -a -n "$($GIT symbolic-ref HEAD 2>/dev/null)"; then
$GIT clean -fxd
else
echo "ERROR: Not a git workspace, or you don't have git" >&2
exit 1
fi
unset HAMMER
fi
cat>sxemacs_version.m4<<EOF
dnl autogenerated version number
m4_define([SXEM4CS_VERSION], [$emacs_full_version])
m4_define([SXEM4CS_MAJOR_VERSION], [$emacs_major_version])
m4_define([SXEM4CS_MINOR_VERSION], [$emacs_minor_version])
m4_define([SXEM4CS_BETA_VERSION], [$emacs_beta_version])
m4_define([SXEM4CS_BETA_P], [$emacs_is_beta])
m4_define([SXEM4CS_GIT_VERSION], [$sxemacs_git_version])
m4_define([SXEM4CS_CODENAME], [$sxemacs_codename])
m4_define([4UTOCONF_VERSION], [$autoconf_ver])
m4_define([4UTOHEADER_VERSION], [$autoheader_ver])
m4_define([4CLOCAL_VERSION], [$aclocal_ver])
m4_define([4UTOMAKE_VERSION], [$automake_ver])
m4_define([4IBTOOL_VERSION], [$libtool_ver])
EOF
if type glibtoolize 2>/dev/null; then
LIBTOOLIZE=glibtoolize
else
LIBTOOLIZE=libtoolize
fi
# using libtoolize as we did before doesn't work anymore, so just mkdir --Horst
mkdir -p libltdl/m4
autoreconf --force --verbose --install -Wall
# hack-o-matic. Using gmp's config.{guess,sub} lets us have properer
# detected machine configurations --SY.
guess=$(grep GMP config.guess)
sub=$(grep GMP config.sub)
if test -z "${guess}"; then
mv -vf config.guess configfsf.guess
cp -v configgmp.guess config.guess
fi
if test -z "${sub}"; then
mv -vf config.sub configfsf.sub
cp -v configgmp.sub config.sub
fi
cd $olddir