summaryrefslogtreecommitdiff
path: root/buildconf
blob: 037cdbc6f0f6999049edd6b33a55b54de40262fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/sh
#
# Copyright 2005 Justin Erenkrantz and Greg Stein
# Copyright 2005 The Apache Software Foundation or its licensors, as
# applicable.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# buildconf: Build the support scripts needed to compile from a
#            checked-out version of the source code.

# set a couple of defaults for where we should be looking for our support libs.
# can be overridden with --with-apr=[dir] and --with-apr-util=[dir]

apr_src_dir="apr ../apr"
apu_src_dir="apr-util ../apr-util"

while test $# -gt 0 
do
  # Normalize
  case "$1" in
  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  *) optarg= ;;
  esac

  case "$1" in
  --with-apr=*)
  apr_src_dir=$optarg
  ;;
  esac

  case "$1" in
  --with-apr-util=*)
  apu_src_dir=$optarg
  ;;
  esac

  shift
done

#
# Check to be sure that we have the srclib dependencies checked-out
#

should_exit=0
apr_found=0
apu_found=0

for dir in $apr_src_dir
do
    if [ -d "${dir}" -a -f "${dir}/build/apr_common.m4" ]; then
        echo "found apr source: ${dir}"
        apr_src_dir=$dir
        apr_found=1
        break
    fi
done

if [ $apr_found -lt 1 ]; then
    echo ""
    echo "You don't have a copy of the apr source in srclib/apr. "
    echo "Please get the source using the following instructions," 
    echo "or specify the location of the source with " 
    echo "--with-apr=[path to apr] :"
    echo ""
    echo "   svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr"
    echo ""
    should_exit=1
fi

for dir in $apu_src_dir
do
    if [ -d "${dir}" -a -f "${dir}/Makefile.in" ]; then
        echo "found apr-util source: ${dir}"
        apu_src_dir=$dir
        apu_found=1
        break
    fi
done

if [ $apu_found -lt 1 ]; then
    echo ""
    echo "APR-util not found.  Assuming you are using APR 2.x."
    echo ""
    apu_src_dir=
fi

if [ $should_exit -gt 0 ]; then
    exit 1
fi

echo copying build files
cp $apr_src_dir/build/config.guess $apr_src_dir/build/config.sub \
   $apr_src_dir/build/install.sh $apr_src_dir/build/apr_common.m4 \
   $apr_src_dir/build/find_apr.m4 $apr_src_dir/build/get-version.sh build

if [ -n "$apu_src_dir" -a -d "$apu_src_dir" ] ; then
 cp $apu_src_dir/build/find_apu.m4 build
fi

echo generating configure
${AUTOCONF:-autoconf}

# Remove autoconf 2.5x's cache directory
rm -rf autom4te*.cache

echo generating serf.def
./build/gen_def.py serf.h serf_bucket_*.h > build/serf.def