]> granicus.if.org Git - apache/blob - buildconf
fb76f6c6ffd4c5fbdbf5705ecf6c9917948bf10e
[apache] / buildconf
1 #!/bin/sh
2
3 # TODO - Steal the new PHP buildconf and build.mk.
4 # This will do for now, though
5
6 supplied_flag=$1
7
8 # do some version checking for the tools we use
9 if test "$1" = "--force"; then
10     shift
11 # this is a posix correct "test -nt"
12 elif test "`ls -t buildconf buildconf.stamp 2>/dev/null |head -1`" != "buildconf"; then
13     :
14 else
15     echo "buildconf: checking installation..."
16
17     # autoconf will check for the version itself
18     # automake 1.4 or newer
19     am_version=`automake --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
20     if test "$am_version" = ""; then
21         echo "buildconf: automake not found."
22         echo "           You need automake version 1.4 or newer installed"
23         echo "           to build APACHE from CVS."
24         exit 1
25     fi
26     old_IFS="$IFS"
27     IFS=.; set $am_version; IFS="$old_IFS"
28     if test "$1" = "1" -a "$2" -lt "4" || test "$1" -lt "1"; then
29         echo "buildconf: automake version $am_version found."
30         echo "           You need automake version 1.4 or newer installed"
31         echo "           to build APACHE from CVS."
32         exit 1
33     else
34         echo "buildconf: automake version $am_version (ok)"
35     fi
36
37     # libtool 1.3.3 or newer
38     lt_pversion=`libtool --version 2>/dev/null|sed -e 's/^[^0-9]*//' -e 's/[- ].*//'`
39     if test "$lt_pversion" = ""; then
40         echo "buildconf: libtool not found."
41         echo "           You need libtool version 1.3 or newer installed"
42         echo "           to build APACHE from CVS."
43         exit 1
44     fi
45     lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
46     IFS=.; set $lt_version; IFS="$old_IFS"
47     if test "$1" -gt "1" || test "$2" -gt "3" || test "$2" = "3" -a "$3" -ge "3"
48     then
49         echo "buildconf: libtool version $lt_pversion (ok)"
50     else
51         echo "buildconf: libtool version $lt_pversion found."
52         echo "           You need libtool version 1.3.3 or newer installed"
53         echo "           to build APACHE from CVS."
54         exit 1
55     fi
56     touch buildconf.stamp
57 fi
58
59 am_prefix=`which automake | sed -e 's#/[^/]*/[^/]*$##'`
60 lt_prefix=`which libtool | sed -e 's#/[^/]*/[^/]*$##'`
61 if test "$am_prefix" != "$lt_prefix"; then
62     echo "buildconf: WARNING: automake and libtool are installed in different"
63     echo "           directories.  This may cause aclocal to fail."
64     echo "buildconf: continuing anyway"
65 fi
66
67 if test "$supplied_flag" = "--copy"; then
68     automake_flags=--copy
69 fi
70
71 mv aclocal.m4 aclocal.m4.old 2>/dev/null
72 aclocal
73 if test "$?" != "0" -a "$am_prefix" != "$lt_prefix"; then
74     echo "buildconf: ERROR: aclocal failed, probably because automake and"
75     echo "           libtool are installed with different prefixes;"
76     echo "           automake is installed in $am_prefix, but libtool in $lt_prefix."
77     echo "           Please re-install automake and/or libtool with a common prefix"
78     echo "           and try again."
79     exit 1
80 fi
81
82 if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
83     echo "buildconf: keeping aclocal.m4"
84     mv aclocal.m4.old aclocal.m4
85 else
86     echo "buildconf: created or modified aclocal.m4"
87 fi
88
89 autoheader
90
91 # find all Makefile.ams
92 files="Makefile `find ap lib main modules regex os -name Makefile.am | sed 's#\.am$##'`"
93
94 # suppress stupid automake warning
95 automake --add-missing $automake_flags $files 2>&1 | grep -v \$APACHE_OUTPUT_FILES >&2
96
97
98 mv configure configure.old 2>/dev/null
99 autoconf
100 if cmp configure.old configure > /dev/null 2>&1; then
101     echo "buildconf: keeping configure"
102     mv configure.old configure
103 else
104     echo "buildconf: created or modified configure"
105 fi
106
107 # Now do APR...
108
109 echo "buildconf: setting up APR"
110
111 cd lib/apr
112
113 mv configure configure.old 2>/dev/null
114 autoheader
115 autoconf
116 if cmp configure.old configure > /dev/null 2>&1; then
117     echo "buildconf: keeping configure"
118     mv configure.old configure
119 else
120     echo "buildconf: created or modified configure"
121 fi
122
123 cd ../..
124
125 # Remove cached config data
126 rm -f config.cache
127