typo
[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 lib_config_files=""
7 autoconf_vers=2.53
8 automake_vers=1.5
9 aclocal_vers=1.5
10 libtool_vers=1.4
11
12 DIE=no
13 if test "$1" = "--build-w32"; then
14     shift
15     target=i386--mingw32
16     if [ ! -f ./config.guess ]; then
17         echo "./config.guess not found" >&2
18         exit 1
19     fi
20     host=`./config.guess`
21         
22     if ! mingw32 --version >/dev/null; then
23         echo "We need at least version 0.3 of MingW32/CPD" >&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     crossinstalldir=`mingw32 --install-dir`
35     crossbindir=`mingw32 --get-bindir 2>/dev/null` \
36                || crossbindir="$crossinstalldir/bin"
37     crossdatadir=`mingw32 --get-datadir 2>/dev/null` \
38                || crossdatadir="$crossinstalldir/share"
39     crosslibdir=`mingw32 --get-libdir 2>/dev/null` \
40                || crosslibdir="$crossinstalldir/i386--mingw32/lib"
41     crossincdir=`mingw32 --get-includedir 2>/dev/null` \
42                || crossincdir="$crossinstalldir/i386--mingw32/include"
43     CC=`mingw32 --get-path gcc`
44     CPP=`mingw32 --get-path cpp`
45     AR=`mingw32 --get-path ar`
46     RANLIB=`mingw32 --get-path ranlib`
47     export CC CPP AR RANLIB 
48
49     disable_foo_tests=""
50     if [ -n "$lib_config_files" ]; then
51         for i in $lib_config_files; do
52             j=`echo $i | tr '[a-z-]' '[A-Z_]'`
53             eval "$j=${crossbindir}/$i"
54             export $j
55             disable_foo_tests="$disable_foo_tests --disable-`echo $i| \
56                            sed 's,-config$,,'`-test"
57             if [ ! -f "${crossbindir}/$i" ]; then                   
58                 echo "$i not installed for MingW32" >&2
59                 DIE=yes
60             fi
61         done
62     fi
63     [ $DIE = yes ] && exit 1
64
65     ./configure --host=${host} --target=${target}  ${disable_foo_tests} \
66                 --bindir=${crossbindir} --libdir=${crosslibdir} \
67                 --datadir=${crossdatadir} --includedir=${crossincdir} \
68                 --enable-maintainer-mode $*
69     exit $?
70 fi
71
72
73
74 if (autoconf --version) < /dev/null > /dev/null 2>&1 ; then
75     if (autoconf --version | awk 'NR==1 { if( $3 >= '$autoconf_vers') \
76                                exit 1; exit 0; }');
77     then
78        echo "**Error**: "\`autoconf\'" is too old."
79        echo '           (version ' $autoconf_vers ' or newer is required)'
80        DIE="yes"
81     fi
82 else
83     echo
84     echo "**Error**: You must have "\`autoconf\'" installed to compile $PGM."
85     echo '           (version ' $autoconf_vers ' or newer is required)'
86     DIE="yes"
87 fi
88
89 if (automake --version) < /dev/null > /dev/null 2>&1 ; then
90   if (automake --version | awk 'NR==1 { if( $4 >= '$automake_vers') \
91                              exit 1; exit 0; }');
92      then
93      echo "**Error**: "\`automake\'" is too old."
94      echo '           (version ' $automake_vers ' or newer is required)'
95      DIE="yes"
96   fi
97   if (aclocal --version) < /dev/null > /dev/null 2>&1; then
98     if (aclocal --version | awk 'NR==1 { if( $4 >= '$aclocal_vers' ) \
99                                                 exit 1; exit 0; }' );
100     then
101       echo "**Error**: "\`aclocal\'" is too old."
102       echo '           (version ' $aclocal_vers ' or newer is required)'
103       DIE="yes"
104     fi
105   else
106     echo
107     echo "**Error**: Missing "\`aclocal\'".  The version of "\`automake\'
108     echo "           installed doesn't appear recent enough."
109     DIE="yes"
110   fi
111 else
112     echo
113     echo "**Error**: You must have "\`automake\'" installed to compile $PGM."
114     echo '           (version ' $automake_vers ' or newer is required)'
115     DIE="yes"
116 fi
117
118
119 if (libtool --version) < /dev/null > /dev/null 2>&1 ; then
120     if (libtool --version | awk 'NR==1 { if( $4 >= '$libtool_vers') \
121                                exit 1; exit 0; }');
122     then
123        echo "**Error**: "\`libtool\'" is too old."
124        echo '           (version ' $libtool_vers ' or newer is required)'
125        DIE="yes"
126     fi
127 else
128     echo
129     echo "**Error**: You must have "\`libtool\'" installed to compile $PGM."
130     echo '           (version ' $libtool_vers ' or newer is required)'
131     DIE="yes"
132 fi
133
134 if test "$DIE" = "yes"; then
135     exit 1
136 fi
137
138 echo "Running libtoolize...  Ignore non-fatal messages."
139 echo "no" | libtoolize
140
141
142 echo "Running aclocal..."
143 aclocal
144 echo "Running autoheader..."
145 autoheader
146 echo "Running automake --gnu -a ..."
147 automake --gnu -a
148 echo "Running autoconf..."
149 autoconf