1 |
werner |
36 |
#! /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 |
|
|
DIE=no |
39 |
|
|
|
40 |
|
|
# ***** W32 build script ******* |
41 |
|
|
# Used to cross-compile for Windows. |
42 |
|
|
if test "$1" = "--build-w32"; then |
43 |
|
|
tmp=`dirname $0` |
44 |
|
|
tsdir=`cd "$tmp"; pwd` |
45 |
|
|
shift |
46 |
|
|
if [ ! -f $tsdir/config.guess ]; then |
47 |
|
|
echo "$tsdir/config.guess not found" >&2 |
48 |
|
|
exit 1 |
49 |
|
|
fi |
50 |
|
|
build=`$tsdir/config.guess` |
51 |
|
|
|
52 |
|
|
[ -z "$w32root" ] && w32root="$HOME/w32root" |
53 |
|
|
echo "Using $w32root as standard install directory" >&2 |
54 |
|
|
|
55 |
|
|
# See whether we have the Debian cross compiler package installed |
56 |
|
|
# old mingw32/cpd system |
57 |
|
|
if i586-mingw32msvc-gcc --version >/dev/null 2>&1 ; then |
58 |
|
|
host=i586-mingw32msvc |
59 |
|
|
crossbindir=/usr/$host/bin |
60 |
|
|
else |
61 |
|
|
echo "Cross compiler kit not installed" >&2 |
62 |
|
|
echo "Under Debian GNU/LInux, you may install it using" >&2 |
63 |
|
|
echo " apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2 |
64 |
|
|
echo "Stop." >&2 |
65 |
|
|
exit 1 |
66 |
|
|
fi |
67 |
|
|
|
68 |
|
|
if [ -f "$tsdir/config.log" ]; then |
69 |
|
|
if ! head $tsdir/config.log | grep "$host" >/dev/null; then |
70 |
|
|
echo "Pease run a 'make distclean' first" >&2 |
71 |
|
|
exit 1 |
72 |
|
|
fi |
73 |
|
|
fi |
74 |
|
|
|
75 |
|
|
./configure --enable-maintainer-mode --prefix=${w32root} \ |
76 |
|
|
--host=i586-mingw32msvc --build=${build} \ |
77 |
|
|
--with-gpg-error-prefix=${w32root} \ |
78 |
|
|
--with-gpgme-prefix=${w32root} |
79 |
|
|
rc=$? |
80 |
|
|
|
81 |
|
|
exit $rc |
82 |
|
|
fi |
83 |
|
|
# ***** end W32 build script ******* |
84 |
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
# Grep the required versions from configure.ac |
89 |
|
|
autoconf_vers=`sed -n '/^AC_PREREQ(/ { |
90 |
|
|
s/^.*(\(.*\))/\1/p |
91 |
|
|
q |
92 |
|
|
}' ${configure_ac}` |
93 |
|
|
autoconf_vers_num=`echo "$autoconf_vers" | cvtver` |
94 |
|
|
|
95 |
|
|
automake_vers=`sed -n '/^min_automake_version=/ { |
96 |
|
|
s/^.*="\(.*\)"/\1/p |
97 |
|
|
q |
98 |
|
|
}' ${configure_ac}` |
99 |
|
|
automake_vers_num=`echo "$automake_vers" | cvtver` |
100 |
|
|
|
101 |
|
|
|
102 |
|
|
if [ -z "$autoconf_vers" -o -z "$automake_vers" ] |
103 |
|
|
then |
104 |
|
|
echo "**Error**: version information not found in "\`${configure_ac}\'"." >&2 |
105 |
|
|
exit 1 |
106 |
|
|
fi |
107 |
|
|
|
108 |
|
|
|
109 |
|
|
if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then |
110 |
|
|
check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf |
111 |
|
|
fi |
112 |
|
|
if check_version $AUTOMAKE $automake_vers_num $automake_vers; then |
113 |
|
|
check_version $ACLOCAL $automake_vers_num $autoconf_vers automake |
114 |
|
|
fi |
115 |
|
|
|
116 |
|
|
if test "$DIE" = "yes"; then |
117 |
|
|
cat <<EOF |
118 |
|
|
|
119 |
|
|
Note that you may use alternative versions of the tools by setting |
120 |
werner |
58 |
the corresponding environment variables; see README.SVN for details. |
121 |
werner |
36 |
|
122 |
|
|
EOF |
123 |
|
|
exit 1 |
124 |
|
|
fi |
125 |
|
|
|
126 |
|
|
|
127 |
|
|
echo "Running aclocal -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..." |
128 |
|
|
$ACLOCAL -I m4 $ACLOCAL_FLAGS |
129 |
|
|
echo "Running autoheader..." |
130 |
|
|
$AUTOHEADER |
131 |
|
|
echo "Running automake --gnu ..." |
132 |
|
|
$AUTOMAKE --gnu; |
133 |
|
|
echo "Running autoconf..." |
134 |
|
|
$AUTOCONF |
135 |
|
|
|
136 |
|
|
echo "You may now run \"./configure --enable-maintainer-mode && make\"." |