Remove armeb FreeBSD 6 compat shim
[freebsd-src.git] / contrib / apr / buildconf
blobb70fa53eca1648a16f6029f654b3bf79ee76947a
1 #!/bin/sh
2 # Licensed to the Apache Software Foundation (ASF) under one or more
3 # contributor license agreements. See the NOTICE file distributed with
4 # this work for additional information regarding copyright ownership.
5 # The ASF licenses this file to You under the Apache License, Version 2.0
6 # (the "License"); you may not use this file except in compliance with
7 # the License. You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
19 # buildconf: Build the support scripts needed to compile from a
20 # checked-out version of the source code.
22 if [ "$1" = "--verbose" -o "$1" = "-v" ]; then
23 verbose="--verbose"
24 shift
27 # Verify that the builder has the right config tools installed
29 build/buildcheck.sh $verbose || exit 1
31 libtoolize=`build/PrintPath glibtoolize1 glibtoolize libtoolize15 libtoolize14 libtoolize`
32 if [ "x$libtoolize" = "x" ]; then
33 echo "libtoolize not found in path"
34 exit 1
37 # Create the libtool helper files
39 # Note: we copy (rather than link) them to simplify distribution.
40 # Note: APR supplies its own config.guess and config.sub -- we do not
41 # rely on libtool's versions
43 echo "buildconf: copying libtool helper files using $libtoolize"
45 # Remove any libtool files so one can switch between libtool versions
46 # by simply rerunning the buildconf script.
47 rm -f aclocal.m4 libtool.m4
48 (cd build ; rm -f ltconfig ltmain.sh argz.m4 libtool.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 lt~obsolete.m4)
50 # Determine libtool version, because --copy behaves differently
51 # w.r.t. copying libtool.m4
52 lt_pversion=`$libtoolize --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'`
53 lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
54 IFS=.; set $lt_version; IFS=' '
56 # libtool 1
57 if test "$1" = "1"; then
58 $libtoolize --copy --automake
59 # Unlikely, maybe for old versions the file exists
60 if [ -f libtool.m4 ]; then
61 ltfile=`pwd`/libtool.m4
62 else
64 # Extract all lines setting variables from libtoolize up until
65 # libtool_m4 gets set
66 ltfindcmd="`sed -n \"/=[^\\\`]/p;/libtool_m4=/{s/.*=/echo /p;q;}\" \
67 < $libtoolize`"
69 # Get path to libtool.m4 either from LIBTOOL_M4 env var or our libtoolize based script
70 ltfile=${LIBTOOL_M4-`eval "$ltfindcmd"`}
72 # Expecting the code above to be very portable, but just in case...
73 if [ -z "$ltfile" -o ! -f "$ltfile" ]; then
74 ltpath=`dirname $libtoolize`
75 ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4
78 if [ ! -f $ltfile ]; then
79 echo "$ltfile not found"
80 exit 1
82 # Do we need this anymore?
83 echo "buildconf: Using libtool.m4 at ${ltfile}."
84 rm -f build/libtool.m4
85 cp -p $ltfile build/libtool.m4
87 # libtool 2
88 elif test "$1" = "2"; then
89 $libtoolize --copy --quiet $verbose
92 # Replace top_builddir by apr_builddir.
93 # Wouldn't it just be better to define top_builddir??
94 # Not sure, would it interfere with httpd top_builddir when bundled?
95 mv build/libtool.m4 build/libtool.m4.$$
96 sed -e 's/\(LIBTOOL=.*\)top_build/\1apr_build/' < build/libtool.m4.$$ > build/libtool.m4
97 rm -f build/libtool.m4.$$
99 # Clean up any leftovers
100 rm -f aclocal.m4 libtool.m4
103 # Generate the autoconf header and ./configure
105 echo "buildconf: creating include/arch/unix/apr_private.h.in ..."
106 ${AUTOHEADER:-autoheader} $verbose
108 echo "buildconf: creating configure ..."
109 ### do some work to toss config.cache?
110 ${AUTOCONF:-autoconf} $verbose
112 # Remove autoconf 2.5x's cache directory
113 rm -rf autom4te*.cache
115 echo "buildconf: generating 'make' outputs ..."
116 build/gen-build.py $verbose make
118 # Create RPM Spec file
119 if [ -f `which cut` ]; then
120 echo "buildconf: rebuilding rpm spec file"
121 ( REVISION=`build/get-version.sh all include/apr_version.h APR`
122 VERSION=`echo $REVISION | cut -d- -s -f1`
123 RELEASE=`echo $REVISION | cut -d- -s -f2`
124 if [ "x$VERSION" = "x" ]; then
125 VERSION=$REVISION
126 RELEASE=1
128 cat ./build/rpm/apr.spec.in | \
129 sed -e "s/APR_VERSION/$VERSION/" \
130 -e "s/APR_RELEASE/$RELEASE/" \
131 > apr.spec )
134 exit 0