~ubuntu-branches/ubuntu/precise/gnupg2/precise-proposed

« back to all changes in this revision

Viewing changes to scripts/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) 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc.
 
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
# Used to cross-compile GnuPG for Windows.
 
44
if test "$1" = "--build-w32"; then
 
45
    tmp=`dirname $0`
 
46
    tsdir=`cd "$tmp"; cd ..; pwd`
 
47
    shift
 
48
    if [ ! -f $tsdir/scripts/config.guess ]; then
 
49
        echo "$tsdir/scripts/config.guess not found" >&2
 
50
        exit 1
 
51
    fi
 
52
    build=`$tsdir/scripts/config.guess`
 
53
 
 
54
    # See whether we have the Debian cross compiler package or the
 
55
    # old mingw32/cpd system
 
56
    if i586-mingw32msvc-gcc --version >/dev/null 2>&1 ; then
 
57
       host=i586-mingw32msvc
 
58
       crossbindir=/usr/$host/bin
 
59
       conf_CC="CC=${host}-gcc"
 
60
    else
 
61
       host=i386--mingw32
 
62
       if ! mingw32 --version >/dev/null; then
 
63
          echo "We need at least version 0.3 of MingW32/CPD" >&2
 
64
          exit 1
 
65
       fi
 
66
       crossbindir=`mingw32 --install-dir`/bin
 
67
       # Old autoconf version required us to setup the environment
 
68
       # with the proper tool names.
 
69
       CC=`mingw32 --get-path gcc`
 
70
       CPP=`mingw32 --get-path cpp`
 
71
       AR=`mingw32 --get-path ar`
 
72
       RANLIB=`mingw32 --get-path ranlib`
 
73
       export CC CPP AR RANLIB 
 
74
       conf_CC=""
 
75
    fi
 
76
   
 
77
    if [ -f "$tsdir/config.log" ]; then
 
78
        if ! head $tsdir/config.log | grep "$host" >/dev/null; then
 
79
            echo "Pease run a 'make distclean' first" >&2
 
80
            exit 1
 
81
        fi
 
82
    fi
 
83
 
 
84
    disable_foo_tests=""
 
85
    if [ -n "$lib_config_files" ]; then
 
86
        for i in $lib_config_files; do
 
87
            j=`echo $i | tr '[a-z-]' '[A-Z_]'`
 
88
            eval "$j=${crossbindir}/$i"
 
89
            export $j
 
90
            disable_foo_tests="$disable_foo_tests --disable-`echo $i| \
 
91
                           sed 's,-config$,,'`-test"
 
92
            if [ ! -f "${crossbindir}/$i" ]; then                   
 
93
                echo "$i not installed for MingW32" >&2
 
94
                DIE=yes
 
95
            fi
 
96
        done
 
97
    fi
 
98
    [ $DIE = yes ] && exit 1
 
99
 
 
100
    $tsdir/configure ${conf_CC} --build=${build} --host=${host} \
 
101
                ${disable_foo_tests}  $*
 
102
 
 
103
    # Ugly hack to overcome a gettext problem.  Someone should look into
 
104
    # gettext to figure out why the po directory is not ignored as it used
 
105
    # to be.
 
106
    [ $? = 0 ] && touch $tsdir/po/all
 
107
    exit $?
 
108
fi
 
109
 
 
110
 
 
111
# This is the special case to build on a ColdFire platform under 
 
112
# the uClinux kernel.  Tested on a MCF4249C3 board.
 
113
if test "$1" = "--build-coldfire"; then
 
114
    tmp=`dirname $0`
 
115
    tsdir=`cd "$tmp"; cd ..; pwd`
 
116
    shift
 
117
    if [ $# -lt 1 ]; then
 
118
      echo "usage: autogen.sh --build-coldfire <crossroot>" >&2
 
119
      exit 1
 
120
    fi
 
121
    crossdir="$1"
 
122
    shift
 
123
 
 
124
    host=m68k-elf
 
125
    crossprefix=${host}-
 
126
    if [ ! -f $tsdir/scripts/config.guess ]; then
 
127
        echo "$tsdir/scripts/config.guess not found" >&2
 
128
        exit 1
 
129
    fi
 
130
    build=`$tsdir/scripts/config.guess`
 
131
        
 
132
    if [ -f "$tsdir/config.log" ]; then
 
133
        if ! head $tsdir/config.log | grep m68k-elf >/dev/null; then
 
134
            echo "Pease run a 'make distclean' first" >&2
 
135
            exit 1
 
136
        fi
 
137
    fi
 
138
 
 
139
    crossbindir=$crossdir/bin
 
140
    CC=${crossbindir}/${crossprefix}gcc
 
141
    CPP=${crossbindir}/cpp
 
142
    AR=${crossbindir}/${crossprefix}ar
 
143
    RANLIB=${crossbindir}/${crossprefix}ranlib
 
144
 
 
145
    CFLAGS="-Os -g -fomit-frame-pointer"
 
146
    CFLAGS="$CFLAGS -m5307 -DCONFIG_COLDFIRE"
 
147
    CFLAGS="$CFLAGS -Dlinux -D__linux__ -Dunix -D__uClinux__ -DEMBED"
 
148
    CFLAGS="$CFLAGS -fno-builtin -msep-data"
 
149
    LDFLAGS="-Wl,-elf2flt -Wl,-move-rodata -nostartfiles"
 
150
    LDFLAGS="$LDFLAGS ${crossdir}/m68k-elf/lib/crt0.o"
 
151
    LIBS="-lc"
 
152
 
 
153
    disable_foo_tests=""
 
154
    if [ -n "$lib_config_files" ]; then
 
155
        for i in $lib_config_files; do
 
156
            j=`echo $i | tr '[a-z-]' '[A-Z_]'`
 
157
            eval "$j=${crossbindir}/$i"
 
158
            export $j
 
159
            disable_foo_tests="$disable_foo_tests --disable-`echo $i| \
 
160
                           sed 's,-config$,,'`-test"
 
161
            if [ ! -f "${crossbindir}/$i" ]; then                   
 
162
                echo "$i not installed for ColdFire" >&2
 
163
                DIE=yes
 
164
            fi
 
165
        done
 
166
    fi
 
167
    [ $DIE = yes ] && exit 1
 
168
 
 
169
    $tsdir/configure --build=${build} --host=${host} \
 
170
                ${disable_foo_tests} \
 
171
                --disable-dynload \
 
172
                --disable-exec \
 
173
                --disable-photo-viewers \
 
174
                --disable-keyserver-helpers \
 
175
                --disable-ldap \
 
176
                --disable-mailto \
 
177
                --disable-largefile \
 
178
                --disable-asm \
 
179
                --disable-nls $* \
 
180
                CC="$CC" CPP="$CPP" AR="$AR" RANLIB="$RANLIB" \
 
181
                CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" LIBS="$LIBS"
 
182
    exit $?
 
183
fi
 
184
 
 
185
 
 
186
# This is the special case to build on a ColdFire platform under 
 
187
# the uClinux kernel with uClinux-dist.  Tested on a MCF4249C3 board.
 
188
if test "$1" = "--build-uclinux"; then
 
189
    tmp=`dirname $0`
 
190
    tsdir=`cd "$tmp"; cd ..; pwd`
 
191
    shift
 
192
 
 
193
    if [ ! -f $tsdir/scripts/config.guess ]; then
 
194
        echo "$tsdir/scripts/config.guess not found" >&2
 
195
        exit 1
 
196
    fi
 
197
    build=`$tsdir/scripts/config.guess`
 
198
    host=m68k-elf
 
199
        
 
200
    if [ -f "$tsdir/config.log" ]; then
 
201
        if ! head $tsdir/config.log | grep m68k-elf >/dev/null; then
 
202
            echo "Please run a 'make distclean' first" >&2
 
203
            exit 1
 
204
        fi
 
205
    fi
 
206
 
 
207
    $tsdir/configure --build=${build} --host=${host} \
 
208
                ${disable_foo_tests} \
 
209
                --disable-dynload \
 
210
                --disable-exec \
 
211
                --disable-photo-viewers \
 
212
                --disable-keyserver-helpers \
 
213
                --disable-ldap \
 
214
                --disable-mailto \
 
215
                --disable-largefile \
 
216
                --disable-asm \
 
217
                --disable-nls $* \
 
218
                CC="$CC" CPP="$CPP" AR="$AR" RANLIB="$RANLIB" \
 
219
                CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" LIBS="$LDLIBS"
 
220
    exit $?
 
221
fi
 
222
 
 
223
 
 
224
# Grep the required versions from configure.ac
 
225
autoconf_vers=`sed -n '/^AC_PREREQ(/ { 
 
226
s/^.*(\(.*\))/\1/p
 
227
q
 
228
}' ${configure_ac}`
 
229
autoconf_vers_num=`echo "$autoconf_vers" | cvtver`
 
230
 
 
231
automake_vers=`sed -n '/^min_automake_version=/ { 
 
232
s/^.*="\(.*\)"/\1/p
 
233
q
 
234
}' ${configure_ac}`
 
235
automake_vers_num=`echo "$automake_vers" | cvtver`
 
236
 
 
237
gettext_vers=`sed -n '/^AM_GNU_GETTEXT_VERSION(/ { 
 
238
s/^.*(\(.*\))/\1/p
 
239
q
 
240
}' ${configure_ac}`
 
241
gettext_vers_num=`echo "$gettext_vers" | cvtver`
 
242
 
 
243
 
 
244
if [ -z "$autoconf_vers" -o -z "$automake_vers" -o -z "$gettext_vers" ]
 
245
then
 
246
  echo "**Error**: version information not found in "\`${configure_ac}\'"." >&2
 
247
  exit 1
 
248
fi
 
249
 
 
250
 
 
251
if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then
 
252
    check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf
 
253
fi
 
254
if check_version $AUTOMAKE $automake_vers_num $automake_vers; then
 
255
  check_version $ACLOCAL $automake_vers_num $automake_vers automake
 
256
fi
 
257
if check_version $GETTEXT $gettext_vers_num $gettext_vers; then
 
258
  check_version $MSGMERGE $gettext_vers_num $gettext_vers gettext
 
259
fi
 
260
 
 
261
if test "$DIE" = "yes"; then
 
262
    cat <<EOF
 
263
 
 
264
Note that you may use alternative versions of the tools by setting 
 
265
the corresponding environment variables; see README.CVS for details.
 
266
                   
 
267
EOF
 
268
    exit 1
 
269
fi
 
270
 
 
271
 
 
272
echo "Running aclocal -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
 
273
$ACLOCAL -I m4 $ACLOCAL_FLAGS
 
274
echo "Running autoheader..."
 
275
$AUTOHEADER
 
276
echo "Running automake --gnu --add-missing..."
 
277
$AUTOMAKE --gnu --add-missing;
 
278
echo "Running autoconf..."
 
279
$AUTOCONF
 
280
 
 
281
echo "You may now run \"./configure --enable-maintainer-mode && make\"."