]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/serf/buildconf
Merge hostapd / wpa_supplicant 2.0.
[FreeBSD/FreeBSD.git] / contrib / serf / buildconf
1 #!/bin/sh
2 #
3 # Copyright 2005 Justin Erenkrantz and Greg Stein
4 # Copyright 2005 The Apache Software Foundation or its licensors, as
5 # applicable.
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #     http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 #
20 # buildconf: Build the support scripts needed to compile from a
21 #            checked-out version of the source code.
22
23 # set a couple of defaults for where we should be looking for our support libs.
24 # can be overridden with --with-apr=[dir] and --with-apr-util=[dir]
25
26 apr_src_dir="apr ../apr"
27 apu_src_dir="apr-util ../apr-util"
28
29 while test $# -gt 0 
30 do
31   # Normalize
32   case "$1" in
33   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
34   *) optarg= ;;
35   esac
36
37   case "$1" in
38   --with-apr=*)
39   apr_src_dir=$optarg
40   ;;
41   esac
42
43   case "$1" in
44   --with-apr-util=*)
45   apu_src_dir=$optarg
46   ;;
47   esac
48
49   shift
50 done
51
52 #
53 # Check to be sure that we have the srclib dependencies checked-out
54 #
55
56 should_exit=0
57 apr_found=0
58 apu_found=0
59
60 for dir in $apr_src_dir
61 do
62     if [ -d "${dir}" -a -f "${dir}/build/apr_common.m4" ]; then
63         echo "found apr source: ${dir}"
64         apr_src_dir=$dir
65         apr_found=1
66         break
67     fi
68 done
69
70 if [ $apr_found -lt 1 ]; then
71     echo ""
72     echo "You don't have a copy of the apr source in srclib/apr. "
73     echo "Please get the source using the following instructions," 
74     echo "or specify the location of the source with " 
75     echo "--with-apr=[path to apr] :"
76     echo ""
77     echo "   svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr"
78     echo ""
79     should_exit=1
80 fi
81
82 for dir in $apu_src_dir
83 do
84     if [ -d "${dir}" -a -f "${dir}/Makefile.in" ]; then
85         echo "found apr-util source: ${dir}"
86         apu_src_dir=$dir
87         apu_found=1
88         break
89     fi
90 done
91
92 if [ $apu_found -lt 1 ]; then
93     echo ""
94     echo "APR-util not found.  Assuming you are using APR 2.x."
95     echo ""
96     apu_src_dir=
97 fi
98
99 if [ $should_exit -gt 0 ]; then
100     exit 1
101 fi
102
103 echo copying build files
104 cp $apr_src_dir/build/config.guess $apr_src_dir/build/config.sub \
105    $apr_src_dir/build/install.sh $apr_src_dir/build/apr_common.m4 \
106    $apr_src_dir/build/find_apr.m4 $apr_src_dir/build/get-version.sh build
107
108 if [ -n "$apu_src_dir" -a -d "$apu_src_dir" ] ; then
109  cp $apu_src_dir/build/find_apu.m4 build
110 fi
111
112 echo generating configure
113 ${AUTOCONF:-autoconf}
114
115 # Remove autoconf 2.5x's cache directory
116 rm -rf autom4te*.cache
117
118 echo generating serf.def
119 ./build/gen_def.py serf.h serf_bucket_*.h > build/serf.def