EMchat is https as well
[sxemacs] / autogen.sh
1 #!/bin/sh
2 # Configure script bootstrap for SXEmacs
3 #
4 # Copyright (C) 2005 - 2012 Steve Youngs.
5 # Copyright (C) 2006, 2007, 2008 Sebastian Freundt.
6 # Copyright (C) 2007, 2010, 2011 Nelson Ferreira
7
8 # This file is part of SXEmacs.
9
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.
14
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.
19
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/>.
22
23 # Parts of SXEmacs are also distributed under a BSD-like licence.
24 # Check file headers for more information.
25
26 # BSD's m4 probably isn't gonna cut it, use gm4 if it is available
27 if test -z "$M4"
28 then
29    type gm4 >/dev/null 2>&1 && M4=gm4 || M4=m4
30 fi
31
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 }')
34
35 if [ "$GOOD_M4" != "1" ]; then
36     echo You have m4 version $M4_VERSION.  SXEmacs requires m4 version 1.4.6 or later.
37     exit 1
38 fi
39
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
44     export PATH
45 fi
46
47 if test -z "$GIT"
48 then
49     type git >/dev/null 2>&1 && GIT=git
50 fi
51
52 olddir=$(pwd)
53 srcdir=$(dirname $0)
54 cd "$srcdir"
55
56 EXPECTED_TREE_VERSION="22.1.16"
57
58 emacs_is_beta=t
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 }')"
63         IN_GIT="1"
64 fi
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>"
70             echo ""
71             echo "Be careful about pushing the tags as they probably will be "
72             echo "more of a nuisance..."
73             echo ""
74             TREE_VERSION="$EXPECTED_TREE_VERSION.$GIT_BRANCH"
75             echo "For now I am assuming the tre version will be $TREE_VERSION"
76             echo ""
77         fi
78 fi
79 if test -z "$GIT_VERSION"; then
80         GIT_VERSION="${TREE_VERSION}-no_git_version"
81 fi
82
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="Hillman Hunter"
88 sxemacs_git_version="$GIT_VERSION"
89
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 "
95     echo ""
96     echo " Expected tree version $EXPECTED_TREE_VERSION "
97     echo " got $emacs_full_version (from $TREE_VERSION) "
98     set -x
99     git tag
100     git describe
101     git describe --long
102     git config -l
103     set +x
104     echo "*******************************************"
105 fi
106
107 test -z "$AUTOCONF"   && type autoconf   >/dev/null 2>&1 && AUTOCONF=autoconf
108 export AUTOCONF
109 test -z "$AUTORECONF" && type autoreconf >/dev/null 2>&1 && AUTORECONF=autoreconf
110 export AUTORECONF
111 test -z "$AUTOHEADER" && type autoheader >/dev/null 2>&1 && AUTOHEADER=autoheader
112 export AUTOHEADER
113 test -z "$AUTOMAKE"   && type automake   >/dev/null 2>&1 && AUTOMAKE=automake
114 export AUTOMAKE
115 test -z "$ACLOCAL"    && type aclocal    >/dev/null 2>&1 && ACLOCAL=aclocal
116 export ACLOCAL
117 test -z "$LIBTOOL"    && type libtool    >/dev/null 2>&1 && LIBTOOL=libtool
118 export LIBTOOL
119 if test -z "$LIBTOOLIZE"; then
120   if type glibtoolize >/dev/null 2>&1; then
121     LIBTOOLIZE=glibtoolize
122   elif type libtoolize >/dev/null 2>&1; then
123     LIBTOOLIZE=libtoolize
124   fi
125 fi
126 export LIBTOOLIZE
127
128 autoconf_ver=$($AUTOCONF --version 2>/dev/null | head -n1)
129 if test -z "$autoconf_ver"; then
130     echo Could not determine autoconf
131     exit 1
132 fi
133 autoreconf_ver=$($AUTORECONF --version 2>/dev/null | head -n1)
134 if test -z "$autoreconf_ver"; then
135     echo Could not determine autoreconf
136     exit 1
137 fi
138 autoheader_ver=$($AUTOHEADER --version 2>/dev/null | head -n1)
139 if test -z "$autoheader_ver"; then
140     echo Could not determine autoheader
141     exit 1
142 fi
143 automake_ver=$($AUTOMAKE --version 2>/dev/null | head -n1)
144 if test -z "$automake_ver"; then
145     echo Could not determine automake
146     exit 1
147 fi
148 aclocal_ver=$($ACLOCAL --version 2>/dev/null | head -n1)
149 if test -z "$aclocal_ver"; then
150     echo Could not determine aclocal
151     exit 1
152 fi
153 libtool_ver=$($LIBTOOL --version 2>/dev/null | head -n1)
154 if test -z "$libtool_ver" -a -n "$LIBTOOLIZE"; then
155     libtool_ver=$($LIBTOOLIZE --version 2>/dev/null | head -n1)
156 fi
157 if test -z "$libtool_ver"; then
158     echo WARNING: Could not determine libtool
159 fi
160
161 # When things go wrong... get a bigger hammer!
162 if test -n "$PHAMMER"; then
163     HAMMER=$PHAMMER
164 fi
165
166 if test -n "$HAMMER"; then
167         if test -n "$GIT" -a -n "$($GIT symbolic-ref HEAD 2>/dev/null)"; then
168                 $GIT clean -fxd
169         else
170                 echo "ERROR: Not a git workspace, or you don't have git" >&2
171                 exit 1
172         fi
173         unset HAMMER
174 fi
175
176
177 cat>sxemacs_version.m4<<EOF
178 dnl autogenerated version number
179 m4_define([SXEM4CS_VERSION], [$emacs_full_version])
180 m4_define([SXEM4CS_MAJOR_VERSION], [$emacs_major_version])
181 m4_define([SXEM4CS_MINOR_VERSION], [$emacs_minor_version])
182 m4_define([SXEM4CS_BETA_VERSION], [$emacs_beta_version])
183 m4_define([SXEM4CS_BETA_P], [$emacs_is_beta])
184 m4_define([SXEM4CS_GIT_VERSION], [$sxemacs_git_version])
185 m4_define([SXEM4CS_CODENAME], [$sxemacs_codename])
186 m4_define([4UTOCONF_VERSION], [$autoconf_ver])
187 m4_define([4UTOHEADER_VERSION], [$autoheader_ver])
188 m4_define([4CLOCAL_VERSION], [$aclocal_ver])
189 m4_define([4UTOMAKE_VERSION], [$automake_ver])
190 m4_define([4IBTOOL_VERSION], [$libtool_ver])
191 EOF
192
193
194 # using libtoolize as we did before doesn't work anymore, so just mkdir --Horst
195 test -d libtld/m4 || mkdir -p libltdl/m4 
196 $AUTORECONF --force --verbose --install -Wall
197
198 # hack-o-matic.  Using gmp's config.{guess,sub} lets us have properer
199 # detected machine configurations --SY.
200 guess=$(grep GMP config.guess)
201 sub=$(grep GMP config.sub)
202 if test -z "${guess}"; then
203     mv -f config.guess configfsf.guess
204     cp configgmp.guess config.guess
205 fi
206 if test -z "${sub}"; then
207     mv -f config.sub configfsf.sub
208     cp configgmp.sub config.sub
209 fi
210
211 cd $olddir