2 # Run this to generate all the initial makefiles, etc.
4 # Copyright (C) 2003 g10 Code GmbH
6 # This file is free software; as a special exception the author gives
7 # unlimited permission to copy and/or distribute it, with or without
8 # modifications, as long as this notice is preserved.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
12 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 configure_ac="configure.ac"
17 awk 'NR==1 {split($NF,A,".");X=1000000*A[1]+1000*A[2]+A[3];print X;exit 0}'
21 if [ `("$1" --version || echo "0") | cvtver` -ge "$2" ]; then
24 echo "**Error**: "\`$1\'" not installed or too old." >&2
25 echo ' Version '$3' or newer is required.' >&2
26 [ -n "$4" ] && echo ' Note that this is part of '\`$4\''.' >&2
34 if test x"$1" = x"--force"; then
39 # Begin list of optional variables sourced from ~/.gnupg-autogen.rc
45 # End list of optional variables sourced from ~/.gnupg-autogen.rc
46 # What follows are variables which are sourced but default to
47 # environment variables or lacking them hardcoded values.
52 if [ -f "$HOME/.gnupg-autogen.rc" ]; then
53 echo "sourcing extra definitions from $HOME/.gnupg-autogen.rc"
54 . "$HOME/.gnupg-autogen.rc"
57 # Convenience option to use certain configure options for some hosts.
76 echo "**Error**: invalid build option $1" >&2
84 # ***** W32 build script *******
85 # Used to cross-compile for Windows.
86 if [ "$myhost" = "w32" ]; then
88 tsdir=`cd "$tmp"; pwd`
90 if [ ! -f $tsdir/config.guess ]; then
91 echo "$tsdir/config.guess not found" >&2
94 build=`$tsdir/config.guess`
99 [ -z "$w32root" ] && w32root="$HOME/w32ce_root"
100 toolprefixes="arm-mingw32ce"
104 [ -z "$w32root" ] && w32root="$HOME/w64root"
105 toolprefixes="amd64-mingw32msvc"
108 [ -z "$w32root" ] && w32root="$HOME/w32root"
109 toolprefixes="i586-mingw32msvc i386-mingw32msvc"
112 echo "Using $w32root as standard install directory" >&2
115 for host in $toolprefixes; do
116 if ${host}-gcc --version >/dev/null 2>&1 ; then
117 crossbindir=/usr/${host}/bin
118 conf_CC="CC=${host}-gcc"
122 if [ -z "$crossbindir" ]; then
123 echo "Cross compiler kit not installed" >&2
124 if [ -z "$myhostsub" ]; then
125 echo "Under Debian GNU/Linux, you may install it using" >&2
126 echo " apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2
132 if [ -f "$tsdir/config.log" ]; then
133 if ! head $tsdir/config.log | grep "$host" >/dev/null; then
134 echo "Pease run a 'make distclean' first" >&2
139 $tsdir/configure --enable-maintainer-mode --prefix=${w32root} \
140 --host=${host} --build=${build} \
141 --with-gpg-error-prefix=${w32root} \
142 --with-libassuan-prefix=${w32root} "$@"
146 # ***** end W32 build script *******
149 # ***** AMD64 cross build script *******
150 # Used to cross-compile for AMD64 (for testing)
151 if [ "$myhost" = "amd64" ]; then
153 tsdir=`cd "$tmp"; pwd`
155 if [ ! -f $tsdir/config.guess ]; then
156 echo "$tsdir/config.guess not found" >&2
159 build=`$tsdir/config.guess`
161 [ -z "$amd64root" ] && amd64root="$HOME/amd64root"
162 echo "Using $amd64root as standard install directory" >&2
164 # Locate the cross compiler
166 for host in x86_64-linux-gnu amd64-linux-gnu; do
167 if ${host}-gcc --version >/dev/null 2>&1 ; then
168 crossbindir=/usr/${host}/bin
169 conf_CC="CC=${host}-gcc"
173 if [ -z "$crossbindir" ]; then
174 echo "Cross compiler kit not installed" >&2
179 if [ -f "$tsdir/config.log" ]; then
180 if ! head $tsdir/config.log | grep "$host" >/dev/null; then
181 echo "Please run a 'make distclean' first" >&2
186 $tsdir/configure --enable-maintainer-mode --prefix=${amd64root} \
187 --host=${host} --build=${build}
191 # ***** end AMD64 cross build script *******
195 # Grep the required versions from configure.ac
196 autoconf_vers=`sed -n '/^AC_PREREQ(/ {
200 autoconf_vers_num=`echo "$autoconf_vers" | cvtver`
202 automake_vers=`sed -n '/^min_automake_version=/ {
206 automake_vers_num=`echo "$automake_vers" | cvtver`
208 #gettext_vers=`sed -n '/^AM_GNU_GETTEXT_VERSION(/ {
212 #gettext_vers_num=`echo "$gettext_vers" | cvtver`
215 if [ -z "$autoconf_vers" -o -z "$automake_vers" ]
217 echo "**Error**: version information not found in "\`${configure_ac}\'"." >&2
221 # Allow to override the default tool names
222 AUTOCONF=${AUTOCONF_PREFIX}${AUTOCONF:-autoconf}${AUTOCONF_SUFFIX}
223 AUTOHEADER=${AUTOCONF_PREFIX}${AUTOHEADER:-autoheader}${AUTOCONF_SUFFIX}
225 AUTOMAKE=${AUTOMAKE_PREFIX}${AUTOMAKE:-automake}${AUTOMAKE_SUFFIX}
226 ACLOCAL=${AUTOMAKE_PREFIX}${ACLOCAL:-aclocal}${AUTOMAKE_SUFFIX}
228 #GETTEXT=${GETTEXT_PREFIX}${GETTEXT:-gettext}${GETTEXT_SUFFIX}
229 #MSGMERGE=${GETTEXT_PREFIX}${MSGMERGE:-msgmerge}${GETTEXT_SUFFIX}
232 if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then
233 check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf
235 if check_version $AUTOMAKE $automake_vers_num $automake_vers; then
236 check_version $ACLOCAL $automake_vers_num $autoconf_vers automake
238 #if check_version $GETTEXT $gettext_vers_num $gettext_vers; then
239 # check_version $MSGMERGE $gettext_vers_num $gettext_vers gettext
242 if test "$DIE" = "yes"; then
245 Note that you may use alternative versions of the tools by setting
246 the corresponding environment variables; see README.GIT for details.
253 # Update the git setup.
255 if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then
257 *** Activating trailing whitespace git pre-commit hook. ***
258 For more information see this thread:
259 http://mail.gnome.org/archives/desktop-devel-list/2009-May/msg00084html
260 To deactivate this pre-commit hook again move .git/hooks/pre-commit
261 and .git/hooks/pre-commit.sample out of the way.
263 cp -av .git/hooks/pre-commit.sample .git/hooks/pre-commit
264 chmod -c +x .git/hooks/pre-commit
266 if [ -f build-aux/git-hooks/commit-msg -a ! -f .git/hooks/commit-msg ] ; then
268 *** Activating commit log message check hook. ***
270 cp -av build-aux/git-hooks/commit-msg .git/hooks/commit-msg
271 chmod -c +x .git/hooks/commit-msg
277 echo "Running aclocal -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
278 $ACLOCAL -I m4 $ACLOCAL_FLAGS
279 echo "Running autoheader..."
281 echo "Running automake --gnu ..."
283 echo "Running autoconf${FORCE} ..."
286 echo "You may now run
287 ./configure --enable-maintainer-mode && make