Imported Upstream version 3.3.0
[platform/upstream/libarchive.git] / build / autogen.sh
1 #!/bin/sh
2
3 PATH=/usr/local/gnu-autotools/bin/:$PATH
4 export PATH
5
6 # Start from one level above the build directory
7 if [ -f version ]; then
8     cd ..
9 fi
10
11 if [ \! -f build/version ]; then
12     echo "Can't find source directory"
13     exit 1
14 fi
15
16 # BSD make's "OBJDIR" support freaks out the automake-generated
17 # Makefile.  Effectively disable it.
18 export MAKEOBJDIRPREFIX=/junk
19
20 # Start from the build directory, where the version file is located
21 if [ -f build/version ]; then
22     cd build
23 fi
24
25 if [ \! -f version ]; then
26     echo "Can't find version file"
27     exit 1
28 fi
29
30 # Update the build number in the 'version' file.
31 # Separate number from additional alpha/beta/etc marker
32 MARKER=`cat version | sed 's/[0-9.]//g'`
33 # Bump the number
34 VN=`cat version | sed 's/[^0-9.]//g'`
35 # Build out the string.
36 VS="$(($VN/1000000)).$(( ($VN/1000)%1000 )).$(( $VN%1000 ))$MARKER"
37
38 cd ..
39
40 # Clean up the source dir as much as we can.
41 /bin/sh build/clean.sh
42
43 # Substitute the versions into Libarchive's archive.h and archive_entry.h
44 perl -p -i -e "s/^(#define\tARCHIVE_VERSION_NUMBER).*/\$1 $VN/" libarchive/archive.h
45 perl -p -i -e "s/^(#define\tARCHIVE_VERSION_NUMBER).*/\$1 $VN/" libarchive/archive_entry.h
46 perl -p -i -e "s/^(#define\tARCHIVE_VERSION_ONLY_STRING).*/\$1 \"$VS\"/" libarchive/archive.h
47 # Substitute versions into configure.ac as well
48 perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_S\]),.*\)/$1,['"$VS"'])/' configure.ac
49 perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_N\]),.*\)/$1,['"$VN"'])/' configure.ac
50
51 # Remove developer CFLAGS if a release build is being made
52 if [ -n "${MAKE_LIBARCHIVE_RELEASE}" ]; then
53   perl -p -i -e "s/^(DEV_CFLAGS.*)/# \$1/" Makefile.am
54 fi
55
56 set -xe
57 aclocal -I build/autoconf
58
59 # Note: --automake flag needed only for libtoolize from
60 # libtool 1.5.x; in libtool 2.2.x it is a synonym for --quiet
61 case `uname` in
62 Darwin) glibtoolize --automake -c;;
63 *) libtoolize --automake -c;;
64 esac
65 autoconf
66 autoheader
67 automake -a -c