2 ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
3 ##### bootstrap FreeSWITCH and FreeSWITCH libraries
5 . $
(dirname $0)/scripts
/ci
/build-requirements.sh
7 echo "bootstrap: checking installation..."
12 LIBDIR
=${BASEDIR}/libs
;
13 SUBDIRS
="apr iksemel srtp fs";
15 while getopts 'jhd:v' o
; do
18 d
) SUBDIRS
="$OPTARG";;
20 h
) echo "Usage: $0 <options>"
22 echo " -d 'library1 library2'"
23 echo " => Bootstrap only specified subdirectories"
24 echo " -j => Run Jobs in Background"
30 test $VERBOSE && echo "bootstrap: $@" >&2
35 if [ ! -f modules.conf
]; then
36 cp build
/modules.conf.
in modules.conf
41 # keep automake from making us magically GPL, and to stop
42 # complaining about missing files.
45 cp -f docs
/ChangeLog .
50 print_autotools_vers
() {
54 echo "Bootstrapping using:"
55 echo " autoconf : ${AUTOCONF:-`which autoconf`}"
56 echo " automake : ${AUTOMAKE:-`which automake`}"
57 echo " aclocal : ${ACLOCAL:-`which aclocal`}"
58 echo " libtool : ${libtool} (${lt_version})"
59 echo " libtoolize: ${libtoolize}"
60 echo " make : ${make} (${make_version})"
61 echo " awk : ${awk} (${awk_version})"
66 echo "Entering directory ${LIBDIR}/apr"
69 # Licensed to the Apache Software Foundation (ASF) under one or more
70 # contributor license agreements. See the NOTICE file distributed with
71 # this work for additional information regarding copyright ownership.
72 # The ASF licenses this file to You under the Apache License, Version 2.0
73 # (the "License"); you may not use this file except in compliance with
74 # the License. You may obtain a copy of the License at
76 # http://www.apache.org/licenses/LICENSE-2.0
78 # Unless required by applicable law or agreed to in writing, software
79 # distributed under the License is distributed on an "AS IS" BASIS,
80 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
81 # See the License for the specific language governing permissions and
82 # limitations under the License.
86 # bootstrap: Build the support scripts needed to compile from a
87 # checked-out version of the source code.
89 # Create the libtool helper files
91 # Note: we copy (rather than link) them to simplify distribution.
92 # Note: APR supplies its own config.guess and config.sub -- we do not
93 # rely on libtool's versions
95 echo "Copying libtool helper files ..."
97 # Remove any libtool files so one can switch between libtool 1.3
98 # and libtool 1.4 by simply rerunning the bootstrap script.
99 (cd build
; rm -f ltconfig ltmain.sh libtool.
m4)
101 if ${libtoolize} -n --install >/dev
/null
2>&1 ; then
102 $libtoolize --force --copy --install
104 $libtoolize --force --copy
107 if [ -f libtool.
m4 ]; then
108 ltfile
=`pwd`/libtool.
m4
110 if [ $lt_major -eq 2 ]; then
111 ltfindcmd
="`sed -n \"/aclocaldir=/{s/.*=/echo /p;q;}\" < $libtoolize`"
112 ltfile
=${LIBTOOL_M4-`eval "$ltfindcmd"`/libtool.m4}
114 ltfindcmd
="`sed -n \"/=[^\\\`]/p;/libtool_m4=/{s/.*=/echo /p;q;}\" \
116 ltfile
=${LIBTOOL_M4-`eval "$ltfindcmd"`}
118 # Expecting the code above to be very portable, but just in case...
119 if [ -z "$ltfile" -o ! -f "$ltfile" ]; then
120 ltpath
=`dirname $libtoolize`
121 ltfile
=`cd $ltpath/../share/aclocal ; pwd`/libtool.
m4
125 if [ ! -f $ltfile ]; then
126 echo "$ltfile not found"
130 echo "bootstrap: Using libtool.m4 at ${ltfile}."
132 cat $ltfile |
sed -e 's/LIBTOOL=\(.*\)top_build/LIBTOOL=\1apr_build/' > build
/libtool.
m4
134 # libtool.m4 from 1.6 requires ltsugar.m4
135 if [ -f ltsugar.
m4 ]; then
136 rm -f build
/ltsugar.
m4
137 mv ltsugar.
m4 build
/ltsugar.
m4
140 # Clean up any leftovers
141 rm -f aclocal.
m4 libtool.
m4
143 # fix for FreeBSD (at least):
144 # libtool.m4 is in share/aclocal, while e.g. aclocal19 only looks in share/aclocal19
145 # get aclocal's default directory and include the libtool.m4 directory via -I if
146 # it's in a different location
148 aclocal_dir
="`${ACLOCAL:-aclocal} --print-ac-dir`"
150 if [ -n "${aclocal_dir}" -a -n "${ltfile}" -a "`dirname ${ltfile}`" != "${aclocal_dir}" ] ; then
151 ACLOCAL_OPTS
="-I `dirname ${ltfile}`"
155 echo "Re-creating aclocal.m4 ..."
156 ${ACLOCAL:-aclocal} ${ACLOCAL_OPTS}
158 ### do some work to toss config.cache?
161 echo "Creating configure ..."
162 ${AUTOCONF:-autoconf}
165 # Generate the autoconf header
167 echo "Creating include/arch/unix/apr_private.h.in ..."
168 ${AUTOHEADER:-autoheader}
170 # Remove autoconf 2.5x's cache directory
171 rm -rf autom4te
*.cache
175 # Libs automake automation function
178 if [ -d ${LIBDIR}/${i} ]; then
179 echo "Entering directory ${LIBDIR}/${i}"
183 if [ -f ${LIBDIR}/${i}/configure.
in ]; then
184 CFFILE
="${LIBDIR}/${i}/configure.in"
186 if [ -f ${LIBDIR}/${i}/configure.ac
]; then
187 CFFILE
="${LIBDIR}/${i}/configure.ac"
191 if [ ! -z ${CFFILE} ]; then
192 LTTEST
=`grep "AC_PROG_LIBTOOL" ${CFFILE}`
193 LTTEST2
=`grep "AM_PROG_LIBTOOL" ${CFFILE}`
194 AMTEST
=`grep "AM_INIT_AUTOMAKE" ${CFFILE}`
195 AMTEST2
=`grep "AC_PROG_INSTALL" ${CFFILE}`
196 AHTEST
=`grep "AC_CONFIG_HEADERS" ${CFFILE}`
197 AXTEST
=`grep "ACX_LIBTOOL_C_ONLY" ${CFFILE}`
199 echo "Creating aclocal.m4"
200 ex
${ACLOCAL:-aclocal} ${ACLOCAL_OPTS} ${ACLOCAL_FLAGS}
202 # only run if AC_PROG_LIBTOOL is in configure.in/configure.ac
203 if [ ! -z "${LTTEST}" -o "${LTTEST2}" -o "${AXTEST}" ]; then
204 echo "Running libtoolize..."
205 if ${libtoolize} -n --install >/dev
/null
2>&1; then
206 ex
$libtoolize --force --copy --install
208 ex
$libtoolize --force --copy
212 echo "Creating configure"
213 ex
${AUTOCONF:-autoconf}
215 # only run if AC_CONFIG_HEADERS is found in configure.in/configure.ac
216 if [ ! -z "${AHTEST}" ]; then
217 echo "Running autoheader..."
218 ex
${AUTOHEADER:-autoheader};
221 # run if AM_INIT_AUTOMAKE / AC_PROG_INSTALL is in configure.in/configure.ac
222 if [ ! -z "${AMTEST}" -o "${AMTEST2}" ]; then
223 echo "Creating Makefile.in"
224 ex
${AUTOMAKE:-automake} --no-force --add-missing --copy;
226 ex
rm -rf autom4te
*.cache
229 echo "Skipping directory ${LIBDIR}/${i}"
236 ${ACLOCAL:-aclocal} ${ACLOCAL_OPTS}
237 $libtoolize --copy --automake
238 ${AUTOCONF:-autoconf}
239 ${AUTOHEADER:-autoheader}
240 ${AUTOMAKE:-automake} --no-force --add-missing --copy
241 rm -rf autom4te
*.cache
244 bootstrap_libs_pre
() {
250 bootstrap_libs_post
() {
257 for i
in ${SUBDIRS}; do
265 bootstrap_libs_pre
${i}
267 libbootstrap
${i} ; bootstrap_libs_post
${i}
269 (libbootstrap
${i} ; bootstrap_libs_post
${i}) &