summaryrefslogtreecommitdiff
path: root/srclib/libapreq/buildconf
blob: 0c2f5df1ad650c51fd6d218df2efc2952b785725 (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
#!/bin/sh
#
# Copyright 1999-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.
#
#

# Default place to look for apr source.  Can be overridden with 
#   --with-apr=[directory]
apr_src_dir=../apr
apu_src_dir=../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
  ;;
  --with-apr-util=*)
  apu_src_dir=$optarg
  ;;
  esac

  shift
done

if [ -f "$apr_src_dir/build/apr_common.m4" ]; then
  echo ""
  echo "Looking for apr source in $apr_src_dir"
else
  echo ""
  echo "Problem finding apr source in $apr_src_dir."
  echo "Use:"
  echo "  --with-apr=[directory]" 
  exit 1
fi

if [ -f "$apu_src_dir/build/find_apu.m4" ]; then
  echo ""
  echo "Looking for apr-util source in $apu_src_dir"
else
  echo ""
  echo "Problem finding apr-util source in $apu_src_dir."
  echo "Use:"
  echo "  --with-apr-util=[directory]" 
  exit 1
fi

set -e

# Remove some files, then copy them from apr source tree
rm -f build/apr_common.m4 build/find_apr.m4 build/install.sh \
      build/config.guess build/config.sub
cp $apr_src_dir/build/apr_common.m4 $apr_src_dir/build/find_apr.m4 \
   $apr_src_dir/build/install.sh $apr_src_dir/build/config.guess  \
   $apr_src_dir/build/config.sub build

rm -f build/find_apu.m4
cp $apu_src_dir/build/find_apu.m4 build


# Remove aclocal.m4 as it'll break some builds...
rm -rf aclocal.m4 autom4te*.cache

#
# Generate the autoconf header (include/apreq_config.h) and ./configure
#
echo "Creating include/apreq_config.h ..."
${AUTOHEADER:-autoheader}

echo "Creating configure ..."
### do some work to toss config.cache?
if ${AUTOCONF:-autoconf}; then
  :
else
  echo "autoconf failed"
  exit 1
fi

#
# Generate build-outputs.mk for the build systme
#
echo "Generating 'make' outputs ..."
$apr_src_dir/build/gen-build.py make

# Remove autoconf cache again
rm -rf autom4te*.cache