~ubuntu-branches/ubuntu/jaunty/gnupg2/jaunty

« back to all changes in this revision

Viewing changes to autogen.sh

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Mueller
  • Date: 2005-03-29 10:30:32 UTC
  • Revision ID: james.westby@ubuntu.com-20050329103032-sj42n2ain3ipx310
Tags: upstream-1.9.15
ImportĀ upstreamĀ versionĀ 1.9.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
# Run this to generate all the initial makefiles, etc. 
 
3
#
 
4
# Copyright (C) 2003 g10 Code GmbH
 
5
#
 
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.
 
9
#
 
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.
 
13
 
 
14
configure_ac="configure.ac"
 
15
 
 
16
cvtver () {
 
17
  awk 'NR==1 {split($NF,A,".");X=1000000*A[1]+1000*A[2]+A[3];print X;exit 0}'
 
18
}
 
19
 
 
20
check_version () {
 
21
    if [ `("$1" --version || echo "0") | cvtver` -ge "$2" ]; then
 
22
       return 0
 
23
    fi
 
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
 
27
    DIE="yes"
 
28
    return 1
 
29
}
 
30
 
 
31
# Allow to override the default tool names
 
32
AUTOCONF=${AUTOCONF_PREFIX}${AUTOCONF:-autoconf}${AUTOCONF_SUFFIX}
 
33
AUTOHEADER=${AUTOCONF_PREFIX}${AUTOHEADER:-autoheader}${AUTOCONF_SUFFIX}
 
34
 
 
35
AUTOMAKE=${AUTOMAKE_PREFIX}${AUTOMAKE:-automake}${AUTOMAKE_SUFFIX}
 
36
ACLOCAL=${AUTOMAKE_PREFIX}${ACLOCAL:-aclocal}${AUTOMAKE_SUFFIX}
 
37
 
 
38
GETTEXT=${GETTEXT_PREFIX}${GETTEXT:-gettext}${GETTEXT_SUFFIX}
 
39
MSGMERGE=${GETTEXT_PREFIX}${MSGMERGE:-msgmerge}${GETTEXT_SUFFIX}
 
40
 
 
41
DIE=no
 
42
 
 
43
# ***** W32 build script *******
 
44
# Used to cross-compile for Windows.
 
45
if test "$1" = "--build-w32"; then
 
46
    tmp=`dirname $0`
 
47
    tsdir=`cd "$tmp"; pwd`
 
48
    shift
 
49
    if [ ! -f $tsdir/scripts/config.guess ]; then
 
50
        echo "$tsdir/scripts/config.guess not found" >&2
 
51
        exit 1
 
52
    fi
 
53
    build=`$tsdir/scripts/config.guess`
 
54
 
 
55
    [ -z "$w32root" ] && w32root="$HOME/w32root"
 
56
    echo "Using $w32root as standard install directory" >&2
 
57
    
 
58
    # See whether we have the Debian cross compiler package or the
 
59
    # old mingw32/cpd system
 
60
    if i586-mingw32msvc-gcc --version >/dev/null 2>&1 ; then
 
61
        host=i586-mingw32msvc
 
62
        crossbindir=/usr/$host/bin
 
63
    else
 
64
       host=i386--mingw32
 
65
       if ! mingw32 --version >/dev/null; then
 
66
          echo "We need at least version 0.3 of MingW32/CPD" >&2
 
67
          exit 1
 
68
       fi
 
69
       crossbindir=`mingw32 --install-dir`/bin
 
70
       # Old autoconf version required us to setup the environment
 
71
       # with the proper tool names.
 
72
       CC=`mingw32 --get-path gcc`
 
73
       CPP=`mingw32 --get-path cpp`
 
74
       AR=`mingw32 --get-path ar`
 
75
       RANLIB=`mingw32 --get-path ranlib`
 
76
       export CC CPP AR RANLIB 
 
77
    fi
 
78
   
 
79
    if [ -f "$tsdir/config.log" ]; then
 
80
        if ! head $tsdir/config.log | grep "$host" >/dev/null; then
 
81
            echo "Pease run a 'make distclean' first" >&2
 
82
            exit 1
 
83
        fi
 
84
    fi
 
85
 
 
86
    ./configure --enable-maintainer-mode --prefix=${w32root}  \
 
87
             --host=i586-mingw32msvc --build=${build} \
 
88
             --with-gpg-error-prefix=${w32root} \
 
89
             --with-ksba-prefix=${w32root} \
 
90
             --with-libgcrypt-prefix=${w32root} \
 
91
             --with-libassuan-prefix=${w32root} \
 
92
             --with-zlib=${w32root} \
 
93
             --with-pth-prefix=${w32root} \
 
94
             --disable-gpg
 
95
    rc=$?
 
96
    # Ugly hack to overcome a gettext problem.  Someone should look into
 
97
    # gettext to figure out why the po directory is not ignored as it used
 
98
    # to be.
 
99
    [ $rc = 0 ] && touch $tsdir/po/all
 
100
    exit $rc
 
101
fi
 
102
# ***** end W32 build script *******
 
103
 
 
104
 
 
105
 
 
106
 
 
107
# Grep the required versions from configure.ac
 
108
autoconf_vers=`sed -n '/^AC_PREREQ(/ { 
 
109
s/^.*(\(.*\))/\1/p
 
110
q
 
111
}' ${configure_ac}`
 
112
autoconf_vers_num=`echo "$autoconf_vers" | cvtver`
 
113
 
 
114
automake_vers=`sed -n '/^min_automake_version=/ { 
 
115
s/^.*="\(.*\)"/\1/p
 
116
q
 
117
}' ${configure_ac}`
 
118
automake_vers_num=`echo "$automake_vers" | cvtver`
 
119
 
 
120
gettext_vers=`sed -n '/^AM_GNU_GETTEXT_VERSION(/ { 
 
121
s/^.*(\(.*\))/\1/p
 
122
q
 
123
}' ${configure_ac}`
 
124
gettext_vers_num=`echo "$gettext_vers" | cvtver`
 
125
 
 
126
 
 
127
if [ -z "$autoconf_vers" -o -z "$automake_vers" -o -z "$gettext_vers" ]
 
128
then
 
129
  echo "**Error**: version information not found in "\`${configure_ac}\'"." >&2
 
130
  exit 1
 
131
fi
 
132
 
 
133
 
 
134
if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then
 
135
    check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf
 
136
fi
 
137
if check_version $AUTOMAKE $automake_vers_num $automake_vers; then
 
138
  check_version $ACLOCAL $automake_vers_num $autoconf_vers automake
 
139
fi
 
140
if check_version $GETTEXT $gettext_vers_num $gettext_vers; then
 
141
  check_version $MSGMERGE $gettext_vers_num $gettext_vers gettext
 
142
fi
 
143
 
 
144
if test "$DIE" = "yes"; then
 
145
    cat <<EOF
 
146
 
 
147
Note that you may use alternative versions of the tools by setting 
 
148
the corresponding environment variables; see README.CVS for details.
 
149
                   
 
150
EOF
 
151
    exit 1
 
152
fi
 
153
 
 
154
 
 
155
echo "Running aclocal -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
 
156
$ACLOCAL -I m4 $ACLOCAL_FLAGS
 
157
echo "Running autoheader..."
 
158
$AUTOHEADER
 
159
echo "Running automake --gnu ..."
 
160
$AUTOMAKE --gnu;
 
161
echo "Running autoconf..."
 
162
$AUTOCONF
 
163
 
 
164
echo "You may now run \"./configure --enable-maintainer-mode && make\"."