Add 2 missing files and other changes
[gpgme.git] / autogen.sh
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3 # It is only needed for the CVS version.
4
5 PGM=GPGME
6 DIE=no
7
8 #
9 # Use --build-w32 to prepare the cross compiling build for Windoze
10 #
11 if test "$1" = "--build-w32"; then
12     shift
13     target=i386--mingw32
14     host=`./config.guess`
15         
16     CC="${target}-gcc"
17     CPP="${target}-gcc -E"
18     RANLIB="${target}-ranlib"
19         
20     cc_version=`$CC --version`
21     if ! echo "$cc_version" | egrep '[0-9]+wk[0-9]+' ; then
22         echo "gcc version $cc_version is not supported" >&2
23         echo "see doc/README.W32 for instructions" >&2
24         exit 1
25     fi
26         
27     if [ -f config.h ]; then
28         if grep HAVE_DOSISH_SYSTEM config.h | grep undef >/dev/null; then
29             echo "Pease run a 'make distclean' first" >&2
30             exit 1
31         fi
32     fi
33
34     export CC CPP RANLIB
35     ./configure --host=${host} --target=${target} $*
36     exit $?
37 fi
38
39
40 autoconf_vers=2.13
41 automake_vers=1.4
42 aclocal_vers=1.4
43 libtool_vers=1.3
44
45 if (autoconf --version) < /dev/null > /dev/null 2>&1 ; then
46     if (autoconf --version | awk 'NR==1 { if( $3 >= '$autoconf_vers') \
47                                exit 1; exit 0; }');
48     then
49        echo "**Error**: "\`autoconf\'" is too old."
50        echo '           (version ' $autoconf_vers ' or newer is required)'
51        DIE="yes"
52     fi
53 else
54     echo
55     echo "**Error**: You must have "\`autoconf\'" installed to compile $PGM."
56     echo '           (version ' $autoconf_vers ' or newer is required)'
57     DIE="yes"
58 fi
59
60 if (automake --version) < /dev/null > /dev/null 2>&1 ; then
61   if (automake --version | awk 'NR==1 { if( $4 >= '$automake_vers') \
62                              exit 1; exit 0; }');
63      then
64      echo "**Error**: "\`automake\'" is too old."
65      echo '           (version ' $automake_vers ' or newer is required)'
66      DIE="yes"
67   fi
68   if (aclocal --version) < /dev/null > /dev/null 2>&1; then
69     if (aclocal --version | awk 'NR==1 { if( $4 >= '$aclocal_vers' ) \
70                                                 exit 1; exit 0; }' );
71     then
72       echo "**Error**: "\`aclocal\'" is too old."
73       echo '           (version ' $aclocal_vers ' or newer is required)'
74       DIE="yes"
75     fi
76   else
77     echo
78     echo "**Error**: Missing "\`aclocal\'".  The version of "\`automake\'
79     echo "           installed doesn't appear recent enough."
80     DIE="yes"
81   fi
82 else
83     echo
84     echo "**Error**: You must have "\`automake\'" installed to compile $PGM."
85     echo '           (version ' $automake_vers ' or newer is required)'
86     DIE="yes"
87 fi
88
89
90 if (libtool --version) < /dev/null > /dev/null 2>&1 ; then
91     if (libtool --version | awk 'NR==1 { if( $4 >= '$libtool_vers') \
92                                exit 1; exit 0; }');
93     then
94        echo "**Error**: "\`libtool\'" is too old."
95        echo '           (version ' $libtool_vers ' or newer is required)'
96        DIE="yes"
97     fi
98 else
99     echo
100     echo "**Error**: You must have "\`libtool\'" installed to compile $PGM."
101     echo '           (version ' $libtool_vers ' or newer is required)'
102     DIE="yes"
103 fi
104
105 if test "$DIE" = "yes"; then
106     exit 1
107 fi
108
109 echo "Running libtoolize...  Ignore non-fatal messages."
110 echo "no" | libtoolize
111
112
113 echo "Running aclocal..."
114 aclocal
115 echo "Running autoheader..."
116 autoheader
117 echo "Running automake --gnu ..."
118 automake --gnu;
119 echo "Running autoconf..."
120 autoconf
121
122 if test "$*" = ""; then
123     conf_options="--enable-maintainer-mode"
124 else
125    conf_options=$*
126 fi
127 echo "Running ./configure $conf_options"
128 ./configure $conf_options
129
130
131
132