Root/sparsehash/patches/0001-add-autogen.patch

Source at commit 36c149ecbe9376d615e9cac3d2ec114cb43185f8 created 11 years 2 months ago.
By Mirko Lindner, add sparsehash
1diff -Naur sparsehash-1.6/autogen.sh sparsehash-1.6-2/autogen.sh
2--- sparsehash-1.6/autogen.sh 1970-01-01 01:00:00.000000000 +0100
3+++ sparsehash-1.6-2/autogen.sh 2010-02-09 11:28:17.000000000 +0100
4@@ -0,0 +1,1578 @@
5+#!/bin/sh
6+# a u t o g e n . s h
7+#
8+# Copyright (c) 2005-2009 United States Government as represented by
9+# the U.S. Army Research Laboratory.
10+#
11+# Redistribution and use in source and binary forms, with or without
12+# modification, are permitted provided that the following conditions
13+# are met:
14+#
15+# 1. Redistributions of source code must retain the above copyright
16+# notice, this list of conditions and the following disclaimer.
17+#
18+# 2. Redistributions in binary form must reproduce the above
19+# copyright notice, this list of conditions and the following
20+# disclaimer in the documentation and/or other materials provided
21+# with the distribution.
22+#
23+# 3. The name of the author may not be used to endorse or promote
24+# products derived from this software without specific prior written
25+# permission.
26+#
27+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
28+# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
29+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
31+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
33+# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
35+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
36+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38+#
39+###
40+#
41+# Script for automatically preparing the sources for compilation by
42+# performing the myriad of necessary steps. The script attempts to
43+# detect proper version support, and outputs warnings about particular
44+# systems that have autotool peculiarities.
45+#
46+# Basically, if everything is set up and installed correctly, the
47+# script will validate that minimum versions of the GNU Build System
48+# tools are installed, account for several common configuration
49+# issues, and then simply run autoreconf for you.
50+#
51+# If autoreconf fails, which can happen for many valid configurations,
52+# this script proceeds to run manual preparation steps effectively
53+# providing a POSIX shell script (mostly complete) reimplementation of
54+# autoreconf.
55+#
56+# The AUTORECONF, AUTOCONF, AUTOMAKE, LIBTOOLIZE, ACLOCAL, AUTOHEADER
57+# environment variables and corresponding _OPTIONS variables (e.g.
58+# AUTORECONF_OPTIONS) may be used to override the default automatic
59+# detection behaviors. Similarly the _VERSION variables will override
60+# the minimum required version numbers.
61+#
62+# Examples:
63+#
64+# To obtain help on usage:
65+# ./autogen.sh --help
66+#
67+# To obtain verbose output:
68+# ./autogen.sh --verbose
69+#
70+# To skip autoreconf and prepare manually:
71+# AUTORECONF=false ./autogen.sh
72+#
73+# To verbosely try running with an older (unsupported) autoconf:
74+# AUTOCONF_VERSION=2.50 ./autogen.sh --verbose
75+#
76+# Author:
77+# Christopher Sean Morrison <morrison@brlcad.org>
78+#
79+# Patches:
80+# Sebastian Pipping <sebastian@pipping.org>
81+#
82+######################################################################
83+
84+# set to minimum acceptable version of autoconf
85+if [ "x$AUTOCONF_VERSION" = "x" ] ; then
86+ AUTOCONF_VERSION=2.52
87+fi
88+# set to minimum acceptable version of automake
89+if [ "x$AUTOMAKE_VERSION" = "x" ] ; then
90+ AUTOMAKE_VERSION=1.6.0
91+fi
92+# set to minimum acceptable version of libtool
93+if [ "x$LIBTOOL_VERSION" = "x" ] ; then
94+ LIBTOOL_VERSION=1.4.2
95+fi
96+
97+
98+##################
99+# ident function #
100+##################
101+ident ( ) {
102+ # extract copyright from header
103+ __copyright="`grep Copyright $AUTOGEN_SH | head -${HEAD_N}1 | awk '{print $4}'`"
104+ if [ "x$__copyright" = "x" ] ; then
105+ __copyright="`date +%Y`"
106+ fi
107+
108+ # extract version from CVS Id string
109+ __id="$Id: autogen.sh 33925 2009-03-01 23:27:06Z brlcad $"
110+ __version="`echo $__id | sed 's/.*\([0-9][0-9][0-9][0-9]\)[-\/]\([0-9][0-9]\)[-\/]\([0-9][0-9]\).*/\1\2\3/'`"
111+ if [ "x$__version" = "x" ] ; then
112+ __version=""
113+ fi
114+
115+ echo "autogen.sh build preparation script by Christopher Sean Morrison"
116+ echo " + config.guess download patch by Sebastian Pipping (2008-12-03)"
117+ echo "revised 3-clause BSD-style license, copyright (c) $__copyright"
118+ echo "script version $__version, ISO/IEC 9945 POSIX shell script"
119+}
120+
121+
122+##################
123+# USAGE FUNCTION #
124+##################
125+usage ( ) {
126+ echo "Usage: $AUTOGEN_SH [-h|--help] [-v|--verbose] [-q|--quiet] [-d|--download] [--version]"
127+ echo " --help Help on $NAME_OF_AUTOGEN usage"
128+ echo " --verbose Verbose progress output"
129+ echo " --quiet Quiet suppressed progress output"
130+ echo " --download Download the latest config.guess from gnulib"
131+ echo " --version Only perform GNU Build System version checks"
132+ echo
133+ echo "Description: This script will validate that minimum versions of the"
134+ echo "GNU Build System tools are installed and then run autoreconf for you."
135+ echo "Should autoreconf fail, manual preparation steps will be run"
136+ echo "potentially accounting for several common preparation issues. The"
137+
138+ echo "AUTORECONF, AUTOCONF, AUTOMAKE, LIBTOOLIZE, ACLOCAL, AUTOHEADER,"
139+ echo "PROJECT, & CONFIGURE environment variables and corresponding _OPTIONS"
140+ echo "variables (e.g. AUTORECONF_OPTIONS) may be used to override the"
141+ echo "default automatic detection behavior."
142+ echo
143+
144+ ident
145+
146+ return 0
147+}
148+
149+
150+##########################
151+# VERSION_ERROR FUNCTION #
152+##########################
153+version_error ( ) {
154+ if [ "x$1" = "x" ] ; then
155+ echo "INTERNAL ERROR: version_error was not provided a version"
156+ exit 1
157+ fi
158+ if [ "x$2" = "x" ] ; then
159+ echo "INTERNAL ERROR: version_error was not provided an application name"
160+ exit 1
161+ fi
162+ $ECHO
163+ $ECHO "ERROR: To prepare the ${PROJECT} build system from scratch,"
164+ $ECHO " at least version $1 of $2 must be installed."
165+ $ECHO
166+ $ECHO "$NAME_OF_AUTOGEN does not need to be run on the same machine that will"
167+ $ECHO "run configure or make. Either the GNU Autotools will need to be installed"
168+ $ECHO "or upgraded on this system, or $NAME_OF_AUTOGEN must be run on the source"
169+ $ECHO "code on another system and then transferred to here. -- Cheers!"
170+ $ECHO
171+}
172+
173+##########################
174+# VERSION_CHECK FUNCTION #
175+##########################
176+version_check ( ) {
177+ if [ "x$1" = "x" ] ; then
178+ echo "INTERNAL ERROR: version_check was not provided a minimum version"
179+ exit 1
180+ fi
181+ _min="$1"
182+ if [ "x$2" = "x" ] ; then
183+ echo "INTERNAL ERROR: version check was not provided a comparison version"
184+ exit 1
185+ fi
186+ _cur="$2"
187+
188+ # needed to handle versions like 1.10 and 1.4-p6
189+ _min="`echo ${_min}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`"
190+ _cur="`echo ${_cur}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`"
191+
192+ _min_major="`echo $_min | cut -d. -f1`"
193+ _min_minor="`echo $_min | cut -d. -f2`"
194+ _min_patch="`echo $_min | cut -d. -f3`"
195+
196+ _cur_major="`echo $_cur | cut -d. -f1`"
197+ _cur_minor="`echo $_cur | cut -d. -f2`"
198+ _cur_patch="`echo $_cur | cut -d. -f3`"
199+
200+ if [ "x$_min_major" = "x" ] ; then
201+ _min_major=0
202+ fi
203+ if [ "x$_min_minor" = "x" ] ; then
204+ _min_minor=0
205+ fi
206+ if [ "x$_min_patch" = "x" ] ; then
207+ _min_patch=0
208+ fi
209+ if [ "x$_cur_minor" = "x" ] ; then
210+ _cur_major=0
211+ fi
212+ if [ "x$_cur_minor" = "x" ] ; then
213+ _cur_minor=0
214+ fi
215+ if [ "x$_cur_patch" = "x" ] ; then
216+ _cur_patch=0
217+ fi
218+
219+ $VERBOSE_ECHO "Checking if ${_cur_major}.${_cur_minor}.${_cur_patch} is greater than ${_min_major}.${_min_minor}.${_min_patch}"
220+
221+ if [ $_min_major -lt $_cur_major ] ; then
222+ return 0
223+ elif [ $_min_major -eq $_cur_major ] ; then
224+ if [ $_min_minor -lt $_cur_minor ] ; then
225+ return 0
226+ elif [ $_min_minor -eq $_cur_minor ] ; then
227+ if [ $_min_patch -lt $_cur_patch ] ; then
228+ return 0
229+ elif [ $_min_patch -eq $_cur_patch ] ; then
230+ return 0
231+ fi
232+ fi
233+ fi
234+ return 1
235+}
236+
237+
238+######################################
239+# LOCATE_CONFIGURE_TEMPLATE FUNCTION #
240+######################################
241+locate_configure_template ( ) {
242+ _pwd="`pwd`"
243+ if test -f "./configure.ac" ; then
244+ echo "./configure.ac"
245+ elif test -f "./configure.in" ; then
246+ echo "./configure.in"
247+ elif test -f "$_pwd/configure.ac" ; then
248+ echo "$_pwd/configure.ac"
249+ elif test -f "$_pwd/configure.in" ; then
250+ echo "$_pwd/configure.in"
251+ elif test -f "$PATH_TO_AUTOGEN/configure.ac" ; then
252+ echo "$PATH_TO_AUTOGEN/configure.ac"
253+ elif test -f "$PATH_TO_AUTOGEN/configure.in" ; then
254+ echo "$PATH_TO_AUTOGEN/configure.in"
255+ fi
256+}
257+
258+
259+##################
260+# argument check #
261+##################
262+ARGS="$*"
263+PATH_TO_AUTOGEN="`dirname $0`"
264+NAME_OF_AUTOGEN="`basename $0`"
265+AUTOGEN_SH="$PATH_TO_AUTOGEN/$NAME_OF_AUTOGEN"
266+
267+LIBTOOL_M4="${PATH_TO_AUTOGEN}/misc/libtool.m4"
268+
269+if [ "x$HELP" = "x" ] ; then
270+ HELP=no
271+fi
272+if [ "x$QUIET" = "x" ] ; then
273+ QUIET=no
274+fi
275+if [ "x$VERBOSE" = "x" ] ; then
276+ VERBOSE=no
277+fi
278+if [ "x$VERSION_ONLY" = "x" ] ; then
279+ VERSION_ONLY=no
280+fi
281+if [ "x$DOWNLOAD" = "x" ] ; then
282+ DOWNLOAD=no
283+fi
284+if [ "x$AUTORECONF_OPTIONS" = "x" ] ; then
285+ AUTORECONF_OPTIONS="-i -f"
286+fi
287+if [ "x$AUTOCONF_OPTIONS" = "x" ] ; then
288+ AUTOCONF_OPTIONS="-f"
289+fi
290+if [ "x$AUTOMAKE_OPTIONS" = "x" ] ; then
291+ AUTOMAKE_OPTIONS="-a -c -f"
292+fi
293+ALT_AUTOMAKE_OPTIONS="-a -c"
294+if [ "x$LIBTOOLIZE_OPTIONS" = "x" ] ; then
295+ LIBTOOLIZE_OPTIONS="--automake -c -f"
296+fi
297+ALT_LIBTOOLIZE_OPTIONS="--automake --copy --force"
298+if [ "x$ACLOCAL_OPTIONS" = "x" ] ; then
299+ ACLOCAL_OPTIONS=""
300+fi
301+if [ "x$AUTOHEADER_OPTIONS" = "x" ] ; then
302+ AUTOHEADER_OPTIONS=""
303+fi
304+if [ "x$CONFIG_GUESS_URL" = "x" ] ; then
305+ CONFIG_GUESS_URL="http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=build-aux/config.guess;hb=HEAD"
306+fi
307+for arg in $ARGS ; do
308+ case "x$arg" in
309+ x--help) HELP=yes ;;
310+ x-[hH]) HELP=yes ;;
311+ x--quiet) QUIET=yes ;;
312+ x-[qQ]) QUIET=yes ;;
313+ x--verbose) VERBOSE=yes ;;
314+ x-[dD]) DOWNLOAD=yes ;;
315+ x--download) DOWNLOAD=yes ;;
316+ x-[vV]) VERBOSE=yes ;;
317+ x--version) VERSION_ONLY=yes ;;
318+ *)
319+ echo "Unknown option: $arg"
320+ echo
321+ usage
322+ exit 1
323+ ;;
324+ esac
325+done
326+
327+
328+#####################
329+# environment check #
330+#####################
331+
332+# sanity check before recursions potentially begin
333+if [ ! -f "$AUTOGEN_SH" ] ; then
334+ echo "INTERNAL ERROR: $AUTOGEN_SH does not exist"
335+ if [ ! "x$0" = "x$AUTOGEN_SH" ] ; then
336+ echo "INTERNAL ERROR: dirname/basename inconsistency: $0 != $AUTOGEN_SH"
337+ fi
338+ exit 1
339+fi
340+
341+# force locale setting to C so things like date output as expected
342+LC_ALL=C
343+
344+# commands that this script expects
345+for __cmd in echo head tail pwd ; do
346+ echo "test" | $__cmd > /dev/null 2>&1
347+ if [ $? != 0 ] ; then
348+ echo "INTERNAL ERROR: '${__cmd}' command is required"
349+ exit 2
350+ fi
351+done
352+echo "test" | grep "test" > /dev/null 2>&1
353+if test ! x$? = x0 ; then
354+ echo "INTERNAL ERROR: grep command is required"
355+ exit 1
356+fi
357+echo "test" | sed "s/test/test/" > /dev/null 2>&1
358+if test ! x$? = x0 ; then
359+ echo "INTERNAL ERROR: sed command is required"
360+ exit 1
361+fi
362+
363+
364+# determine the behavior of echo
365+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
366+ *c*,-n*) ECHO_N= ECHO_C='
367+' ECHO_T=' ' ;;
368+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
369+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
370+esac
371+
372+# determine the behavior of head
373+case "x`echo 'head' | head -n 1 2>&1`" in
374+ *xhead*) HEAD_N="n " ;;
375+ *) HEAD_N="" ;;
376+esac
377+
378+# determine the behavior of tail
379+case "x`echo 'tail' | tail -n 1 2>&1`" in
380+ *xtail*) TAIL_N="n " ;;
381+ *) TAIL_N="" ;;
382+esac
383+
384+VERBOSE_ECHO=:
385+ECHO=:
386+if [ "x$QUIET" = "xyes" ] ; then
387+ if [ "x$VERBOSE" = "xyes" ] ; then
388+ echo "Verbose output quelled by quiet option. Further output disabled."
389+ fi
390+else
391+ ECHO=echo
392+ if [ "x$VERBOSE" = "xyes" ] ; then
393+ echo "Verbose output enabled"
394+ VERBOSE_ECHO=echo
395+ fi
396+fi
397+
398+
399+# allow a recursive run to disable further recursions
400+if [ "x$RUN_RECURSIVE" = "x" ] ; then
401+ RUN_RECURSIVE=yes
402+fi
403+
404+
405+################################################
406+# check for help arg and bypass version checks #
407+################################################
408+if [ "x`echo $ARGS | sed 's/.*[hH][eE][lL][pP].*/help/'`" = "xhelp" ] ; then
409+ HELP=yes
410+fi
411+if [ "x$HELP" = "xyes" ] ; then
412+ usage
413+ $ECHO "---"
414+ $ECHO "Help was requested. No preparation or configuration will be performed."
415+ exit 0
416+fi
417+
418+
419+#######################
420+# set up signal traps #
421+#######################
422+untrap_abnormal ( ) {
423+ for sig in 1 2 13 15; do
424+ trap - $sig
425+ done
426+}
427+
428+# do this cleanup whenever we exit.
429+trap '
430+ # start from the root
431+ if test -d "$START_PATH" ; then
432+ cd "$START_PATH"
433+ fi
434+
435+ # restore/delete backup files
436+ if test "x$PFC_INIT" = "x1" ; then
437+ recursive_restore
438+ fi
439+' 0
440+
441+# trap SIGHUP (1), SIGINT (2), SIGPIPE (13), SIGTERM (15)
442+for sig in 1 2 13 15; do
443+ trap '
444+ $ECHO ""
445+ $ECHO "Aborting $NAME_OF_AUTOGEN: caught signal '$sig'"
446+
447+ # start from the root
448+ if test -d "$START_PATH" ; then
449+ cd "$START_PATH"
450+ fi
451+
452+ # clean up on abnormal exit
453+ $VERBOSE_ECHO "rm -rf autom4te.cache"
454+ rm -rf autom4te.cache
455+
456+ if test -f "acinclude.m4.$$.backup" ; then
457+ $VERBOSE_ECHO "cat acinclude.m4.$$.backup > acinclude.m4"
458+ chmod u+w acinclude.m4
459+ cat acinclude.m4.$$.backup > acinclude.m4
460+
461+ $VERBOSE_ECHO "rm -f acinclude.m4.$$.backup"
462+ rm -f acinclude.m4.$$.backup
463+ fi
464+
465+ { (exit 1); exit 1; }
466+' $sig
467+done
468+
469+
470+#############################
471+# look for a configure file #
472+#############################
473+if [ "x$CONFIGURE" = "x" ] ; then
474+ CONFIGURE="`locate_configure_template`"
475+ if [ ! "x$CONFIGURE" = "x" ] ; then
476+ $VERBOSE_ECHO "Found a configure template: $CONFIGURE"
477+ fi
478+else
479+ $ECHO "Using CONFIGURE environment variable override: $CONFIGURE"
480+fi
481+if [ "x$CONFIGURE" = "x" ] ; then
482+ if [ "x$VERSION_ONLY" = "xyes" ] ; then
483+ CONFIGURE=/dev/null
484+ else
485+ $ECHO
486+ $ECHO "A configure.ac or configure.in file could not be located implying"
487+ $ECHO "that the GNU Build System is at least not used in this directory. In"
488+ $ECHO "any case, there is nothing to do here without one of those files."
489+ $ECHO
490+ $ECHO "ERROR: No configure.in or configure.ac file found in `pwd`"
491+ exit 1
492+ fi
493+fi
494+
495+####################
496+# get project name #
497+####################
498+if [ "x$PROJECT" = "x" ] ; then
499+ PROJECT="`grep AC_INIT $CONFIGURE | grep -v '.*#.*AC_INIT' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_INIT(\([^,)]*\).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`"
500+ if [ "x$PROJECT" = "xAC_INIT" ] ; then
501+ # projects might be using the older/deprecated arg-less AC_INIT .. look for AM_INIT_AUTOMAKE instead
502+ PROJECT="`grep AM_INIT_AUTOMAKE $CONFIGURE | grep -v '.*#.*AM_INIT_AUTOMAKE' | tail -${TAIL_N}1 | sed 's/^[ ]*AM_INIT_AUTOMAKE(\([^,)]*\).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`"
503+ fi
504+ if [ "x$PROJECT" = "xAM_INIT_AUTOMAKE" ] ; then
505+ PROJECT="project"
506+ fi
507+ if [ "x$PROJECT" = "x" ] ; then
508+ PROJECT="project"
509+ fi
510+else
511+ $ECHO "Using PROJECT environment variable override: $PROJECT"
512+fi
513+$ECHO "Preparing the $PROJECT build system...please wait"
514+$ECHO
515+
516+
517+########################
518+# check for autoreconf #
519+########################
520+HAVE_AUTORECONF=no
521+if [ "x$AUTORECONF" = "x" ] ; then
522+ for AUTORECONF in autoreconf ; do
523+ $VERBOSE_ECHO "Checking autoreconf version: $AUTORECONF --version"
524+ $AUTORECONF --version > /dev/null 2>&1
525+ if [ $? = 0 ] ; then
526+ HAVE_AUTORECONF=yes
527+ break
528+ fi
529+ done
530+else
531+ HAVE_AUTORECONF=yes
532+ $ECHO "Using AUTORECONF environment variable override: $AUTORECONF"
533+fi
534+
535+
536+##########################
537+# autoconf version check #
538+##########################
539+_acfound=no
540+if [ "x$AUTOCONF" = "x" ] ; then
541+ for AUTOCONF in autoconf ; do
542+ $VERBOSE_ECHO "Checking autoconf version: $AUTOCONF --version"
543+ $AUTOCONF --version > /dev/null 2>&1
544+ if [ $? = 0 ] ; then
545+ _acfound=yes
546+ break
547+ fi
548+ done
549+else
550+ _acfound=yes
551+ $ECHO "Using AUTOCONF environment variable override: $AUTOCONF"
552+fi
553+
554+_report_error=no
555+if [ ! "x$_acfound" = "xyes" ] ; then
556+ $ECHO "ERROR: Unable to locate GNU Autoconf."
557+ _report_error=yes
558+else
559+ _version="`$AUTOCONF --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`"
560+ if [ "x$_version" = "x" ] ; then
561+ _version="0.0.0"
562+ fi
563+ $ECHO "Found GNU Autoconf version $_version"
564+ version_check "$AUTOCONF_VERSION" "$_version"
565+ if [ $? -ne 0 ] ; then
566+ _report_error=yes
567+ fi
568+fi
569+if [ "x$_report_error" = "xyes" ] ; then
570+ version_error "$AUTOCONF_VERSION" "GNU Autoconf"
571+ exit 1
572+fi
573+
574+
575+##########################
576+# automake version check #
577+##########################
578+_amfound=no
579+if [ "x$AUTOMAKE" = "x" ] ; then
580+ for AUTOMAKE in automake ; do
581+ $VERBOSE_ECHO "Checking automake version: $AUTOMAKE --version"
582+ $AUTOMAKE --version > /dev/null 2>&1
583+ if [ $? = 0 ] ; then
584+ _amfound=yes
585+ break
586+ fi
587+ done
588+else
589+ _amfound=yes
590+ $ECHO "Using AUTOMAKE environment variable override: $AUTOMAKE"
591+fi
592+
593+
594+_report_error=no
595+if [ ! "x$_amfound" = "xyes" ] ; then
596+ $ECHO
597+ $ECHO "ERROR: Unable to locate GNU Automake."
598+ _report_error=yes
599+else
600+ _version="`$AUTOMAKE --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`"
601+ if [ "x$_version" = "x" ] ; then
602+ _version="0.0.0"
603+ fi
604+ $ECHO "Found GNU Automake version $_version"
605+ version_check "$AUTOMAKE_VERSION" "$_version"
606+ if [ $? -ne 0 ] ; then
607+ _report_error=yes
608+ fi
609+fi
610+if [ "x$_report_error" = "xyes" ] ; then
611+ version_error "$AUTOMAKE_VERSION" "GNU Automake"
612+ exit 1
613+fi
614+
615+
616+########################
617+# check for libtoolize #
618+########################
619+HAVE_LIBTOOLIZE=yes
620+HAVE_ALT_LIBTOOLIZE=no
621+_ltfound=no
622+if [ "x$LIBTOOLIZE" = "x" ] ; then
623+ LIBTOOLIZE=libtoolize
624+ $VERBOSE_ECHO "Checking libtoolize version: $LIBTOOLIZE --version"
625+ $LIBTOOLIZE --version > /dev/null 2>&1
626+ if [ ! $? = 0 ] ; then
627+ HAVE_LIBTOOLIZE=no
628+ $ECHO
629+ if [ "x$HAVE_AUTORECONF" = "xno" ] ; then
630+ $ECHO "Warning: libtoolize does not appear to be available."
631+ else
632+ $ECHO "Warning: libtoolize does not appear to be available. This means that"
633+ $ECHO "the automatic build preparation via autoreconf will probably not work."
634+ $ECHO "Preparing the build by running each step individually, however, should"
635+ $ECHO "work and will be done automatically for you if autoreconf fails."
636+ fi
637+
638+ # look for some alternates
639+ for tool in glibtoolize libtoolize15 libtoolize14 libtoolize13 ; do
640+ $VERBOSE_ECHO "Checking libtoolize alternate: $tool --version"
641+ _glibtoolize="`$tool --version > /dev/null 2>&1`"
642+ if [ $? = 0 ] ; then
643+ $VERBOSE_ECHO "Found $tool --version"
644+ _glti="`which $tool`"
645+ if [ "x$_glti" = "x" ] ; then
646+ $VERBOSE_ECHO "Cannot find $tool with which"
647+ continue;
648+ fi
649+ if test ! -f "$_glti" ; then
650+ $VERBOSE_ECHO "Cannot use $tool, $_glti is not a file"
651+ continue;
652+ fi
653+ _gltidir="`dirname $_glti`"
654+ if [ "x$_gltidir" = "x" ] ; then
655+ $VERBOSE_ECHO "Cannot find $tool path with dirname of $_glti"
656+ continue;
657+ fi
658+ if test ! -d "$_gltidir" ; then
659+ $VERBOSE_ECHO "Cannot use $tool, $_gltidir is not a directory"
660+ continue;
661+ fi
662+ HAVE_ALT_LIBTOOLIZE=yes
663+ LIBTOOLIZE="$tool"
664+ $ECHO
665+ $ECHO "Fortunately, $tool was found which means that your system may simply"
666+ $ECHO "have a non-standard or incomplete GNU Autotools install. If you have"
667+ $ECHO "sufficient system access, it may be possible to quell this warning by"
668+ $ECHO "running:"
669+ $ECHO
670+ sudo -V > /dev/null 2>&1
671+ if [ $? = 0 ] ; then
672+ $ECHO " sudo ln -s $_glti $_gltidir/libtoolize"
673+ $ECHO
674+ else
675+ $ECHO " ln -s $_glti $_gltidir/libtoolize"
676+ $ECHO
677+ $ECHO "Run that as root or with proper permissions to the $_gltidir directory"
678+ $ECHO
679+ fi
680+ _ltfound=yes
681+ break
682+ fi
683+ done
684+ else
685+ _ltfound=yes
686+ fi
687+else
688+ _ltfound=yes
689+ $ECHO "Using LIBTOOLIZE environment variable override: $LIBTOOLIZE"
690+fi
691+
692+
693+############################
694+# libtoolize version check #
695+############################
696+_report_error=no
697+if [ ! "x$_ltfound" = "xyes" ] ; then
698+ $ECHO
699+ $ECHO "ERROR: Unable to locate GNU Libtool."
700+ _report_error=yes
701+else
702+ _version="`$LIBTOOLIZE --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`"
703+ if [ "x$_version" = "x" ] ; then
704+ _version="0.0.0"
705+ fi
706+ $ECHO "Found GNU Libtool version $_version"
707+ version_check "$LIBTOOL_VERSION" "$_version"
708+ if [ $? -ne 0 ] ; then
709+ _report_error=yes
710+ fi
711+fi
712+if [ "x$_report_error" = "xyes" ] ; then
713+ version_error "$LIBTOOL_VERSION" "GNU Libtool"
714+ exit 1
715+fi
716+
717+
718+#####################
719+# check for aclocal #
720+#####################
721+if [ "x$ACLOCAL" = "x" ] ; then
722+ for ACLOCAL in aclocal ; do
723+ $VERBOSE_ECHO "Checking aclocal version: $ACLOCAL --version"
724+ $ACLOCAL --version > /dev/null 2>&1
725+ if [ $? = 0 ] ; then
726+ break
727+ fi
728+ done
729+else
730+ $ECHO "Using ACLOCAL environment variable override: $ACLOCAL"
731+fi
732+
733+
734+########################
735+# check for autoheader #
736+########################
737+if [ "x$AUTOHEADER" = "x" ] ; then
738+ for AUTOHEADER in autoheader ; do
739+ $VERBOSE_ECHO "Checking autoheader version: $AUTOHEADER --version"
740+ $AUTOHEADER --version > /dev/null 2>&1
741+ if [ $? = 0 ] ; then
742+ break
743+ fi
744+ done
745+else
746+ $ECHO "Using AUTOHEADER environment variable override: $AUTOHEADER"
747+fi
748+
749+
750+#########################
751+# check if version only #
752+#########################
753+$VERBOSE_ECHO "Checking whether to only output version information"
754+if [ "x$VERSION_ONLY" = "xyes" ] ; then
755+ $ECHO
756+ ident
757+ $ECHO "---"
758+ $ECHO "Version requested. No preparation or configuration will be performed."
759+ exit 0
760+fi
761+
762+
763+#################################
764+# PROTECT_FROM_CLOBBER FUNCTION #
765+#################################
766+protect_from_clobber ( ) {
767+ PFC_INIT=1
768+
769+ # protect COPYING & INSTALL from overwrite by automake. the
770+ # automake force option will (inappropriately) ignore the existing
771+ # contents of a COPYING and/or INSTALL files (depending on the
772+ # version) instead of just forcing *missing* files like it does
773+ # for AUTHORS, NEWS, and README. this is broken but extremely
774+ # prevalent behavior, so we protect against it by keeping a backup
775+ # of the file that can later be restored.
776+
777+ for file in COPYING INSTALL ; do
778+ if test -f ${file} ; then
779+ if test -f ${file}.$$.protect_from_automake.backup ; then
780+ $VERBOSE_ECHO "Already backed up ${file} in `pwd`"
781+ else
782+ $VERBOSE_ECHO "Backing up ${file} in `pwd`"
783+ $VERBOSE_ECHO "cp -p ${file} ${file}.$$.protect_from_automake.backup"
784+ cp -p ${file} ${file}.$$.protect_from_automake.backup
785+ fi
786+ fi
787+ done
788+}
789+
790+
791+##############################
792+# RECURSIVE_PROTECT FUNCTION #
793+##############################
794+recursive_protect ( ) {
795+
796+ # for projects using recursive configure, run the build
797+ # preparation steps for the subdirectories. this function assumes
798+ # START_PATH was set to pwd before recursion begins so that
799+ # relative paths work.
800+
801+ # git 'r done, protect COPYING and INSTALL from being clobbered
802+ protect_from_clobber
803+
804+ if test -d autom4te.cache ; then
805+ $VERBOSE_ECHO "Found an autom4te.cache directory, deleting it"
806+ $VERBOSE_ECHO "rm -rf autom4te.cache"
807+ rm -rf autom4te.cache
808+ fi
809+
810+ # find configure template
811+ _configure="`locate_configure_template`"
812+ if [ "x$_configure" = "x" ] ; then
813+ return
814+ fi
815+ # $VERBOSE_ECHO "Looking for configure template found `pwd`/$_configure"
816+
817+ # look for subdirs
818+ # $VERBOSE_ECHO "Looking for subdirs in `pwd`"
819+ _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $_configure | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`"
820+ CHECK_DIRS=""
821+ for dir in $_det_config_subdirs ; do
822+ if test -d "`pwd`/$dir" ; then
823+ CHECK_DIRS="$CHECK_DIRS \"`pwd`/$dir\""
824+ fi
825+ done
826+
827+ # process subdirs
828+ if [ ! "x$CHECK_DIRS" = "x" ] ; then
829+ $VERBOSE_ECHO "Recursively scanning the following directories:"
830+ $VERBOSE_ECHO " $CHECK_DIRS"
831+ for dir in $CHECK_DIRS ; do
832+ $VERBOSE_ECHO "Protecting files from automake in $dir"
833+ cd "$START_PATH"
834+ eval "cd $dir"
835+
836+ # recursively git 'r done
837+ recursive_protect
838+ done
839+ fi
840+} # end of recursive_protect
841+
842+
843+#############################
844+# RESTORE_CLOBBERED FUNCION #
845+#############################
846+restore_clobbered ( ) {
847+
848+ # The automake (and autoreconf by extension) -f/--force-missing
849+ # option may overwrite COPYING and INSTALL even if they do exist.
850+ # Here we restore the files if necessary.
851+
852+ spacer=no
853+
854+ for file in COPYING INSTALL ; do
855+ if test -f ${file}.$$.protect_from_automake.backup ; then
856+ if test -f ${file} ; then
857+ # compare entire content, restore if needed
858+ if test "x`cat ${file}`" != "x`cat ${file}.$$.protect_from_automake.backup`" ; then
859+ if test "x$spacer" = "xno" ; then
860+ $VERBOSE_ECHO
861+ spacer=yes
862+ fi
863+ # restore the backup
864+ $VERBOSE_ECHO "Restoring ${file} from backup (automake -f likely clobbered it)"
865+ $VERBOSE_ECHO "rm -f ${file}"
866+ rm -f ${file}
867+ $VERBOSE_ECHO "mv ${file}.$$.protect_from_automake.backup ${file}"
868+ mv ${file}.$$.protect_from_automake.backup ${file}
869+ fi # check contents
870+ elif test -f ${file}.$$.protect_from_automake.backup ; then
871+ $VERBOSE_ECHO "mv ${file}.$$.protect_from_automake.backup ${file}"
872+ mv ${file}.$$.protect_from_automake.backup ${file}
873+ fi # -f ${file}
874+
875+ # just in case
876+ $VERBOSE_ECHO "rm -f ${file}.$$.protect_from_automake.backup"
877+ rm -f ${file}.$$.protect_from_automake.backup
878+ fi # -f ${file}.$$.protect_from_automake.backup
879+ done
880+
881+ CONFIGURE="`locate_configure_template`"
882+ if [ "x$CONFIGURE" = "x" ] ; then
883+ return
884+ fi
885+
886+ _aux_dir="`grep AC_CONFIG_AUX_DIR $CONFIGURE | grep -v '.*#.*AC_CONFIG_AUX_DIR' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_CONFIG_AUX_DIR(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`"
887+ if test ! -d "$_aux_dir" ; then
888+ _aux_dir=.
889+ fi
890+
891+ for file in config.guess config.sub ltmain.sh ; do
892+ if test -f "${_aux_dir}/${file}" ; then
893+ $VERBOSE_ECHO "rm -f \"${_aux_dir}/${file}.backup\""
894+ rm -f "${_aux_dir}/${file}.backup"
895+ fi
896+ done
897+} # end of restore_clobbered
898+
899+
900+##############################
901+# RECURSIVE_RESTORE FUNCTION #
902+##############################
903+recursive_restore ( ) {
904+
905+ # restore COPYING and INSTALL from backup if they were clobbered
906+ # for each directory recursively.
907+
908+ # git 'r undone
909+ restore_clobbered
910+
911+ # find configure template
912+ _configure="`locate_configure_template`"
913+ if [ "x$_configure" = "x" ] ; then
914+ return
915+ fi
916+
917+ # look for subdirs
918+ _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $_configure | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`"
919+ CHECK_DIRS=""
920+ for dir in $_det_config_subdirs ; do
921+ if test -d "`pwd`/$dir" ; then
922+ CHECK_DIRS="$CHECK_DIRS \"`pwd`/$dir\""
923+ fi
924+ done
925+
926+ # process subdirs
927+ if [ ! "x$CHECK_DIRS" = "x" ] ; then
928+ $VERBOSE_ECHO "Recursively scanning the following directories:"
929+ $VERBOSE_ECHO " $CHECK_DIRS"
930+ for dir in $CHECK_DIRS ; do
931+ $VERBOSE_ECHO "Checking files for automake damage in $dir"
932+ cd "$START_PATH"
933+ eval "cd $dir"
934+
935+ # recursively git 'r undone
936+ recursive_restore
937+ done
938+ fi
939+} # end of recursive_restore
940+
941+
942+#######################
943+# INITIALIZE FUNCTION #
944+#######################
945+initialize ( ) {
946+
947+ # this routine performs a variety of directory-specific
948+ # initializations. some are sanity checks, some are preventive,
949+ # and some are necessary setup detection.
950+ #
951+ # this function sets:
952+ # CONFIGURE
953+ # SEARCH_DIRS
954+ # CONFIG_SUBDIRS
955+
956+ ##################################
957+ # check for a configure template #
958+ ##################################
959+ CONFIGURE="`locate_configure_template`"
960+ if [ "x$CONFIGURE" = "x" ] ; then
961+ $ECHO
962+ $ECHO "A configure.ac or configure.in file could not be located implying"
963+ $ECHO "that the GNU Build System is at least not used in this directory. In"
964+ $ECHO "any case, there is nothing to do here without one of those files."
965+ $ECHO
966+ $ECHO "ERROR: No configure.in or configure.ac file found in `pwd`"
967+ exit 1
968+ fi
969+
970+ #####################
971+ # detect an aux dir #
972+ #####################
973+ _aux_dir="`grep AC_CONFIG_AUX_DIR $CONFIGURE | grep -v '.*#.*AC_CONFIG_AUX_DIR' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_CONFIG_AUX_DIR(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`"
974+ if test ! -d "$_aux_dir" ; then
975+ _aux_dir=.
976+ else
977+ $VERBOSE_ECHO "Detected auxillary directory: $_aux_dir"
978+ fi
979+
980+ ################################
981+ # detect a recursive configure #
982+ ################################
983+ CONFIG_SUBDIRS=""
984+ _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $CONFIGURE | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`"
985+ for dir in $_det_config_subdirs ; do
986+ if test -d "`pwd`/$dir" ; then
987+ $VERBOSE_ECHO "Detected recursive configure directory: `pwd`/$dir"
988+ CONFIG_SUBDIRS="$CONFIG_SUBDIRS `pwd`/$dir"
989+ fi
990+ done
991+
992+ ###########################################################
993+ # make sure certain required files exist for GNU projects #
994+ ###########################################################
995+ _marker_found=""
996+ _marker_found_message_intro='Detected non-GNU marker "'
997+ _marker_found_message_mid='" in '
998+ for marker in foreign cygnus ; do
999+ _marker_found_message=${_marker_found_message_intro}${marker}${_marker_found_message_mid}
1000+ _marker_found="`grep 'AM_INIT_AUTOMAKE.*'${marker} $CONFIGURE`"
1001+ if [ ! "x$_marker_found" = "x" ] ; then
1002+ $VERBOSE_ECHO "${_marker_found_message}`basename \"$CONFIGURE\"`"
1003+ break
1004+ fi
1005+ if test -f "`dirname \"$CONFIGURE\"/Makefile.am`" ; then
1006+ _marker_found="`grep 'AUTOMAKE_OPTIONS.*'${marker} Makefile.am`"
1007+ if [ ! "x$_marker_found" = "x" ] ; then
1008+ $VERBOSE_ECHO "${_marker_found_message}Makefile.am"
1009+ break
1010+ fi
1011+ fi
1012+ done
1013+ if [ "x${_marker_found}" = "x" ] ; then
1014+ _suggest_foreign=no
1015+ for file in AUTHORS COPYING ChangeLog INSTALL NEWS README ; do
1016+ if [ ! -f $file ] ; then
1017+ $VERBOSE_ECHO "Touching ${file} since it does not exist"
1018+ _suggest_foreign=yes
1019+ touch $file
1020+ fi
1021+ done
1022+
1023+ if [ "x${_suggest_foreign}" = "xyes" ] ; then
1024+ $ECHO
1025+ $ECHO "Warning: Several files expected of projects that conform to the GNU"
1026+ $ECHO "coding standards were not found. The files were automatically added"
1027+ $ECHO "for you since you do not have a 'foreign' declaration specified."
1028+ $ECHO
1029+ $ECHO "Considered adding 'foreign' to AM_INIT_AUTOMAKE in `basename \"$CONFIGURE\"`"
1030+ if test -f "`dirname \"$CONFIGURE\"/Makefile.am`" ; then
1031+ $ECHO "or to AUTOMAKE_OPTIONS in your top-level Makefile.am file."
1032+ fi
1033+ $ECHO
1034+ fi
1035+ fi
1036+
1037+ ##################################################
1038+ # make sure certain generated files do not exist #
1039+ ##################################################
1040+ for file in config.guess config.sub ltmain.sh ; do
1041+ if test -f "${_aux_dir}/${file}" ; then
1042+ $VERBOSE_ECHO "mv -f \"${_aux_dir}/${file}\" \"${_aux_dir}/${file}.backup\""
1043+ mv -f "${_aux_dir}/${file}" "${_aux_dir}/${file}.backup"
1044+ fi
1045+ done
1046+
1047+ ############################
1048+ # search alternate m4 dirs #
1049+ ############################
1050+ SEARCH_DIRS=""
1051+ for dir in m4 ; do
1052+ if [ -d $dir ] ; then
1053+ $VERBOSE_ECHO "Found extra aclocal search directory: $dir"
1054+ SEARCH_DIRS="$SEARCH_DIRS -I $dir"
1055+ fi
1056+ done
1057+
1058+ ######################################
1059+ # remove any previous build products #
1060+ ######################################
1061+ if test -d autom4te.cache ; then
1062+ $VERBOSE_ECHO "Found an autom4te.cache directory, deleting it"
1063+ $VERBOSE_ECHO "rm -rf autom4te.cache"
1064+ rm -rf autom4te.cache
1065+ fi
1066+# tcl/tk (and probably others) have a customized aclocal.m4, so can't delete it
1067+# if test -f aclocal.m4 ; then
1068+# $VERBOSE_ECHO "Found an aclocal.m4 file, deleting it"
1069+# $VERBOSE_ECHO "rm -f aclocal.m4"
1070+# rm -f aclocal.m4
1071+# fi
1072+
1073+} # end of initialize()
1074+
1075+
1076+##############
1077+# initialize #
1078+##############
1079+
1080+# stash path
1081+START_PATH="`pwd`"
1082+
1083+# Before running autoreconf or manual steps, some prep detection work
1084+# is necessary or useful. Only needs to occur once per directory, but
1085+# does need to traverse the entire subconfigure hierarchy to protect
1086+# files from being clobbered even by autoreconf.
1087+recursive_protect
1088+
1089+# start from where we started
1090+cd "$START_PATH"
1091+
1092+# get ready to process
1093+initialize
1094+
1095+
1096+#########################################
1097+# DOWNLOAD_GNULIB_CONFIG_GUESS FUNCTION #
1098+#########################################
1099+
1100+# TODO - should make sure wget/curl exist and/or work before trying to
1101+# use them.
1102+
1103+download_gnulib_config_guess () {
1104+ # abuse gitweb to download gnulib's latest config.guess via HTTP
1105+ config_guess_temp="config.guess.$$.download"
1106+ ret=1
1107+ for __cmd in wget curl fetch ; do
1108+ $VERBOSE_ECHO "Checking for command ${__cmd}"
1109+ ${__cmd} --version > /dev/null 2>&1
1110+ ret=$?
1111+ if [ ! $ret = 0 ] ; then
1112+ continue
1113+ fi
1114+
1115+ __cmd_version=`${__cmd} --version | head -n 1 | sed -e 's/^[^0-9]\+//' -e 's/ .*//'`
1116+ $VERBOSE_ECHO "Found ${__cmd} ${__cmd_version}"
1117+
1118+ opts=""
1119+ case ${__cmd} in
1120+ wget)
1121+ opts="-O"
1122+ ;;
1123+ curl)
1124+ opts="-o"
1125+ ;;
1126+ fetch)
1127+ opts="-t 5 -f"
1128+ ;;
1129+ esac
1130+
1131+ $VERBOSE_ECHO "Running $__cmd \"${CONFIG_GUESS_URL}\" $opts \"${config_guess_temp}\""
1132+ eval "$__cmd \"${CONFIG_GUESS_URL}\" $opts \"${config_guess_temp}\"" > /dev/null 2>&1
1133+ if [ $? = 0 ] ; then
1134+ mv -f "${config_guess_temp}" ${_aux_dir}/config.guess
1135+ ret=0
1136+ break
1137+ fi
1138+ done
1139+
1140+ if [ ! $ret = 0 ] ; then
1141+ $ECHO "Warning: config.guess download failed from: $CONFIG_GUESS_URL"
1142+ rm -f "${config_guess_temp}"
1143+ fi
1144+}
1145+
1146+
1147+##############################
1148+# LIBTOOLIZE_NEEDED FUNCTION #
1149+##############################
1150+libtoolize_needed () {
1151+ ret=1 # means no, don't need libtoolize
1152+ for feature in AC_PROG_LIBTOOL AM_PROG_LIBTOOL LT_INIT ; do
1153+ $VERBOSE_ECHO "Searching for $feature in $CONFIGURE"
1154+ found="`grep \"^$feature.*\" $CONFIGURE`"
1155+ if [ ! "x$found" = "x" ] ; then
1156+ ret=0 # means yes, need to run libtoolize
1157+ break
1158+ fi
1159+ done
1160+ return ${ret}
1161+}
1162+
1163+
1164+
1165+############################################
1166+# prepare build via autoreconf or manually #
1167+############################################
1168+reconfigure_manually=no
1169+if [ "x$HAVE_AUTORECONF" = "xyes" ] ; then
1170+ $ECHO
1171+ $ECHO $ECHO_N "Automatically preparing build ... $ECHO_C"
1172+
1173+ $VERBOSE_ECHO "$AUTORECONF $SEARCH_DIRS $AUTORECONF_OPTIONS"
1174+ autoreconf_output="`$AUTORECONF $SEARCH_DIRS $AUTORECONF_OPTIONS 2>&1`"
1175+ ret=$?
1176+ $VERBOSE_ECHO "$autoreconf_output"
1177+
1178+ if [ ! $ret = 0 ] ; then
1179+ if [ "x$HAVE_ALT_LIBTOOLIZE" = "xyes" ] ; then
1180+ if [ ! "x`echo \"$autoreconf_output\" | grep libtoolize | grep \"No such file or directory\"`" = "x" ] ; then
1181+ $ECHO
1182+ $ECHO "Warning: autoreconf failed but due to what is usually a common libtool"
1183+ $ECHO "misconfiguration issue. This problem is encountered on systems that"
1184+ $ECHO "have installed libtoolize under a different name without providing a"
1185+ $ECHO "symbolic link or without setting the LIBTOOLIZE environment variable."
1186+ $ECHO
1187+ $ECHO "Restarting the preparation steps with LIBTOOLIZE set to $LIBTOOLIZE"
1188+
1189+ export LIBTOOLIZE
1190+ RUN_RECURSIVE=no
1191+ export RUN_RECURSIVE
1192+ untrap_abnormal
1193+
1194+ $VERBOSE_ECHO sh $AUTOGEN_SH "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
1195+ sh "$AUTOGEN_SH" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
1196+ exit $?
1197+ fi
1198+ fi
1199+
1200+ $ECHO "Warning: $AUTORECONF failed"
1201+
1202+ if test -f ltmain.sh ; then
1203+ $ECHO "libtoolize being run by autoreconf is not creating ltmain.sh in the auxillary directory like it should"
1204+ fi
1205+
1206+ $ECHO "Attempting to run the preparation steps individually"
1207+ reconfigure_manually=yes
1208+ else
1209+ if [ "x$DOWNLOAD" = "xyes" ] ; then
1210+ if libtoolize_needed ; then
1211+ download_gnulib_config_guess
1212+ fi
1213+ fi
1214+ fi
1215+else
1216+ reconfigure_manually=yes
1217+fi
1218+
1219+
1220+############################
1221+# LIBTOOL_FAILURE FUNCTION #
1222+############################
1223+libtool_failure ( ) {
1224+
1225+ # libtool is rather error-prone in comparison to the other
1226+ # autotools and this routine attempts to compensate for some
1227+ # common failures. the output after a libtoolize failure is
1228+ # parsed for an error related to AC_PROG_LIBTOOL and if found, we
1229+ # attempt to inject a project-provided libtool.m4 file.
1230+
1231+ _autoconf_output="$1"
1232+
1233+ if [ "x$RUN_RECURSIVE" = "xno" ] ; then
1234+ # we already tried the libtool.m4, don't try again
1235+ return 1
1236+ fi
1237+
1238+ if test -f "$LIBTOOL_M4" ; then
1239+ found_libtool="`$ECHO $_autoconf_output | grep AC_PROG_LIBTOOL`"
1240+ if test ! "x$found_libtool" = "x" ; then
1241+ if test -f acinclude.m4 ; then
1242+ rm -f acinclude.m4.$$.backup
1243+ $VERBOSE_ECHO "cat acinclude.m4 > acinclude.m4.$$.backup"
1244+ cat acinclude.m4 > acinclude.m4.$$.backup
1245+ fi
1246+ $VERBOSE_ECHO "cat \"$LIBTOOL_M4\" >> acinclude.m4"
1247+ chmod u+w acinclude.m4
1248+ cat "$LIBTOOL_M4" >> acinclude.m4
1249+
1250+ # don't keep doing this
1251+ RUN_RECURSIVE=no
1252+ export RUN_RECURSIVE
1253+ untrap_abnormal
1254+
1255+ $ECHO
1256+ $ECHO "Restarting the preparation steps with libtool macros in acinclude.m4"
1257+ $VERBOSE_ECHO sh $AUTOGEN_SH "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
1258+ sh "$AUTOGEN_SH" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
1259+ exit $?
1260+ fi
1261+ fi
1262+}
1263+
1264+
1265+###########################
1266+# MANUAL_AUTOGEN FUNCTION #
1267+###########################
1268+manual_autogen ( ) {
1269+
1270+ ##################################################
1271+ # Manual preparation steps taken are as follows: #
1272+ # aclocal [-I m4] #
1273+ # libtoolize --automake -c -f #
1274+ # aclocal [-I m4] #
1275+ # autoconf -f #
1276+ # autoheader #
1277+ # automake -a -c -f #
1278+ ##################################################
1279+
1280+ ###########
1281+ # aclocal #
1282+ ###########
1283+ $VERBOSE_ECHO "$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS"
1284+ aclocal_output="`$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS 2>&1`"
1285+ ret=$?
1286+ $VERBOSE_ECHO "$aclocal_output"
1287+ if [ ! $ret = 0 ] ; then $ECHO "ERROR: $ACLOCAL failed" && exit 2 ; fi
1288+
1289+ ##############
1290+ # libtoolize #
1291+ ##############
1292+ if libtoolize_needed ; then
1293+ if [ "x$HAVE_LIBTOOLIZE" = "xyes" ] ; then
1294+ $VERBOSE_ECHO "$LIBTOOLIZE $LIBTOOLIZE_OPTIONS"
1295+ libtoolize_output="`$LIBTOOLIZE $LIBTOOLIZE_OPTIONS 2>&1`"
1296+ ret=$?
1297+ $VERBOSE_ECHO "$libtoolize_output"
1298+
1299+ if [ ! $ret = 0 ] ; then $ECHO "ERROR: $LIBTOOLIZE failed" && exit 2 ; fi
1300+ else
1301+ if [ "x$HAVE_ALT_LIBTOOLIZE" = "xyes" ] ; then
1302+ $VERBOSE_ECHO "$LIBTOOLIZE $ALT_LIBTOOLIZE_OPTIONS"
1303+ libtoolize_output="`$LIBTOOLIZE $ALT_LIBTOOLIZE_OPTIONS 2>&1`"
1304+ ret=$?
1305+ $VERBOSE_ECHO "$libtoolize_output"
1306+
1307+ if [ ! $ret = 0 ] ; then $ECHO "ERROR: $LIBTOOLIZE failed" && exit 2 ; fi
1308+ fi
1309+ fi
1310+
1311+ ###########
1312+ # aclocal #
1313+ ###########
1314+ # re-run again as instructed by libtoolize
1315+ $VERBOSE_ECHO "$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS"
1316+ aclocal_output="`$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS 2>&1`"
1317+ ret=$?
1318+ $VERBOSE_ECHO "$aclocal_output"
1319+
1320+ # libtoolize might put ltmain.sh in the wrong place
1321+ if test -f ltmain.sh ; then
1322+ if test ! -f "${_aux_dir}/ltmain.sh" ; then
1323+ $ECHO
1324+ $ECHO "Warning: $LIBTOOLIZE is creating ltmain.sh in the wrong directory"
1325+ $ECHO
1326+ $ECHO "Fortunately, the problem can be worked around by simply copying the"
1327+ $ECHO "file to the appropriate location (${_aux_dir}/). This has been done for you."
1328+ $ECHO
1329+ $VERBOSE_ECHO "cp -p ltmain.sh \"${_aux_dir}/ltmain.sh\""
1330+ cp -p ltmain.sh "${_aux_dir}/ltmain.sh"
1331+ $ECHO $ECHO_N "Continuing build preparation ... $ECHO_C"
1332+ fi
1333+ fi # ltmain.sh
1334+
1335+ if [ "x$DOWNLOAD" = "xyes" ] ; then
1336+ download_gnulib_config_guess
1337+ fi
1338+ fi # libtoolize_needed
1339+
1340+ ############
1341+ # autoconf #
1342+ ############
1343+ $VERBOSE_ECHO
1344+ $VERBOSE_ECHO "$AUTOCONF $AUTOCONF_OPTIONS"
1345+ autoconf_output="`$AUTOCONF $AUTOCONF_OPTIONS 2>&1`"
1346+ ret=$?
1347+ $VERBOSE_ECHO "$autoconf_output"
1348+
1349+ if [ ! $ret = 0 ] ; then
1350+ # retry without the -f and check for usage of macros that are too new
1351+ ac2_59_macros="AC_C_RESTRICT AC_INCLUDES_DEFAULT AC_LANG_ASSERT AC_LANG_WERROR AS_SET_CATFILE"
1352+ ac2_55_macros="AC_COMPILER_IFELSE AC_FUNC_MBRTOWC AC_HEADER_STDBOOL AC_LANG_CONFTEST AC_LANG_SOURCE AC_LANG_PROGRAM AC_LANG_CALL AC_LANG_FUNC_TRY_LINK AC_MSG_FAILURE AC_PREPROC_IFELSE"
1353+ ac2_54_macros="AC_C_BACKSLASH_A AC_CONFIG_LIBOBJ_DIR AC_GNU_SOURCE AC_PROG_EGREP AC_PROG_FGREP AC_REPLACE_FNMATCH AC_FUNC_FNMATCH_GNU AC_FUNC_REALLOC AC_TYPE_MBSTATE_T"
1354+
1355+ macros_to_search=""
1356+ ac_major="`echo ${AUTOCONF_VERSION}. | cut -d. -f1 | sed 's/[^0-9]//g'`"
1357+ ac_minor="`echo ${AUTOCONF_VERSION}. | cut -d. -f2 | sed 's/[^0-9]//g'`"
1358+
1359+ if [ $ac_major -lt 2 ] ; then
1360+ macros_to_search="$ac2_59_macros $ac2_55_macros $ac2_54_macros"
1361+ else
1362+ if [ $ac_minor -lt 54 ] ; then
1363+ macros_to_search="$ac2_59_macros $ac2_55_macros $ac2_54_macros"
1364+ elif [ $ac_minor -lt 55 ] ; then
1365+ macros_to_search="$ac2_59_macros $ac2_55_macros"
1366+ elif [ $ac_minor -lt 59 ] ; then
1367+ macros_to_search="$ac2_59_macros"
1368+ fi
1369+ fi
1370+
1371+ configure_ac_macros=__none__
1372+ for feature in $macros_to_search ; do
1373+ $VERBOSE_ECHO "Searching for $feature in $CONFIGURE"
1374+ found="`grep \"^$feature.*\" $CONFIGURE`"
1375+ if [ ! "x$found" = "x" ] ; then
1376+ if [ "x$configure_ac_macros" = "x__none__" ] ; then
1377+ configure_ac_macros="$feature"
1378+ else
1379+ configure_ac_macros="$feature $configure_ac_macros"
1380+ fi
1381+ fi
1382+ done
1383+ if [ ! "x$configure_ac_macros" = "x__none__" ] ; then
1384+ $ECHO
1385+ $ECHO "Warning: Unsupported macros were found in $CONFIGURE"
1386+ $ECHO
1387+ $ECHO "The `basename \"$CONFIGURE\"` file was scanned in order to determine if any"
1388+ $ECHO "unsupported macros are used that exceed the minimum version"
1389+ $ECHO "settings specified within this file. As such, the following macros"
1390+ $ECHO "should be removed from configure.ac or the version numbers in this"
1391+ $ECHO "file should be increased:"
1392+ $ECHO
1393+ $ECHO "$configure_ac_macros"
1394+ $ECHO
1395+ $ECHO $ECHO_N "Ignorantly continuing build preparation ... $ECHO_C"
1396+ fi
1397+
1398+ ###################
1399+ # autoconf, retry #
1400+ ###################
1401+ $VERBOSE_ECHO
1402+ $VERBOSE_ECHO "$AUTOCONF"
1403+ autoconf_output="`$AUTOCONF 2>&1`"
1404+ ret=$?
1405+ $VERBOSE_ECHO "$autoconf_output"
1406+
1407+ if [ ! $ret = 0 ] ; then
1408+ # test if libtool is busted
1409+ libtool_failure "$autoconf_output"
1410+
1411+ # let the user know what went wrong
1412+ cat <<EOF
1413+$autoconf_output
1414+EOF
1415+ $ECHO "ERROR: $AUTOCONF failed"
1416+ exit 2
1417+ else
1418+ # autoconf sans -f and possibly sans unsupported options succeed so warn verbosely
1419+ $ECHO
1420+ $ECHO "Warning: autoconf seems to have succeeded by removing the following options:"
1421+ $ECHO " AUTOCONF_OPTIONS=\"$AUTOCONF_OPTIONS\""
1422+ $ECHO
1423+ $ECHO "Removing those options should not be necessary and indicate some other"
1424+ $ECHO "problem with the build system. The build preparation is highly suspect"
1425+ $ECHO "and may result in configuration or compilation errors. Consider"
1426+ if [ "x$VERBOSE_ECHO" = "x:" ] ; then
1427+ $ECHO "rerunning the build preparation with verbose output enabled."
1428+ $ECHO " $AUTOGEN_SH --verbose"
1429+ else
1430+ $ECHO "reviewing the minimum GNU Autotools version settings contained in"
1431+ $ECHO "this script along with the macros being used in your `basename \"$CONFIGURE\"` file."
1432+ fi
1433+ $ECHO
1434+ $ECHO $ECHO_N "Continuing build preparation ... $ECHO_C"
1435+ fi # autoconf ret = 0
1436+ fi # autoconf ret = 0
1437+
1438+ ##############
1439+ # autoheader #
1440+ ##############
1441+ need_autoheader=no
1442+ for feature in AM_CONFIG_HEADER AC_CONFIG_HEADER ; do
1443+ $VERBOSE_ECHO "Searching for $feature in $CONFIGURE"
1444+ found="`grep \"^$feature.*\" $CONFIGURE`"
1445+ if [ ! "x$found" = "x" ] ; then
1446+ need_autoheader=yes
1447+ break
1448+ fi
1449+ done
1450+ if [ "x$need_autoheader" = "xyes" ] ; then
1451+ $VERBOSE_ECHO "$AUTOHEADER $AUTOHEADER_OPTIONS"
1452+ autoheader_output="`$AUTOHEADER $AUTOHEADER_OPTIONS 2>&1`"
1453+ ret=$?
1454+ $VERBOSE_ECHO "$autoheader_output"
1455+ if [ ! $ret = 0 ] ; then $ECHO "ERROR: $AUTOHEADER failed" && exit 2 ; fi
1456+ fi # need_autoheader
1457+
1458+ ############
1459+ # automake #
1460+ ############
1461+ need_automake=no
1462+ for feature in AM_INIT_AUTOMAKE ; do
1463+ $VERBOSE_ECHO "Searching for $feature in $CONFIGURE"
1464+ found="`grep \"^$feature.*\" $CONFIGURE`"
1465+ if [ ! "x$found" = "x" ] ; then
1466+ need_automake=yes
1467+ break
1468+ fi
1469+ done
1470+
1471+ if [ "x$need_automake" = "xyes" ] ; then
1472+ $VERBOSE_ECHO "$AUTOMAKE $AUTOMAKE_OPTIONS"
1473+ automake_output="`$AUTOMAKE $AUTOMAKE_OPTIONS 2>&1`"
1474+ ret=$?
1475+ $VERBOSE_ECHO "$automake_output"
1476+
1477+ if [ ! $ret = 0 ] ; then
1478+
1479+ ###################
1480+ # automake, retry #
1481+ ###################
1482+ $VERBOSE_ECHO
1483+ $VERBOSE_ECHO "$AUTOMAKE $ALT_AUTOMAKE_OPTIONS"
1484+ # retry without the -f
1485+ automake_output="`$AUTOMAKE $ALT_AUTOMAKE_OPTIONS 2>&1`"
1486+ ret=$?
1487+ $VERBOSE_ECHO "$automake_output"
1488+
1489+ if [ ! $ret = 0 ] ; then
1490+ # test if libtool is busted
1491+ libtool_failure "$automake_output"
1492+
1493+ # let the user know what went wrong
1494+ cat <<EOF
1495+$automake_output
1496+EOF
1497+ $ECHO "ERROR: $AUTOMAKE failed"
1498+ exit 2
1499+ fi # automake retry
1500+ fi # automake ret = 0
1501+ fi # need_automake
1502+} # end of manual_autogen
1503+
1504+
1505+#####################################
1506+# RECURSIVE_MANUAL_AUTOGEN FUNCTION #
1507+#####################################
1508+recursive_manual_autogen ( ) {
1509+
1510+ # run the build preparation steps manually for this directory
1511+ manual_autogen
1512+
1513+ # for projects using recursive configure, run the build
1514+ # preparation steps for the subdirectories.
1515+ if [ ! "x$CONFIG_SUBDIRS" = "x" ] ; then
1516+ $VERBOSE_ECHO "Recursively configuring the following directories:"
1517+ $VERBOSE_ECHO " $CONFIG_SUBDIRS"
1518+ for dir in $CONFIG_SUBDIRS ; do
1519+ $VERBOSE_ECHO "Processing recursive configure in $dir"
1520+ cd "$START_PATH"
1521+ cd "$dir"
1522+
1523+ # new directory, prepare
1524+ initialize
1525+
1526+ # run manual steps for the subdir and any others below
1527+ recursive_manual_autogen
1528+ done
1529+ fi
1530+}
1531+
1532+
1533+################################
1534+# run manual preparation steps #
1535+################################
1536+if [ "x$reconfigure_manually" = "xyes" ] ; then
1537+ $ECHO
1538+ $ECHO $ECHO_N "Preparing build ... $ECHO_C"
1539+
1540+ recursive_manual_autogen
1541+fi
1542+
1543+
1544+#########################
1545+# restore and summarize #
1546+#########################
1547+cd "$START_PATH"
1548+
1549+# restore COPYING and INSTALL from backup if necessary
1550+recursive_restore
1551+
1552+# make sure we end up with a configure script
1553+config_ac="`locate_configure_template`"
1554+config="`echo $config_ac | sed 's/\.ac$//' | sed 's/\.in$//'`"
1555+if [ "x$config" = "x" ] ; then
1556+ $VERBOSE_ECHO "Could not locate the configure template (from `pwd`)"
1557+fi
1558+
1559+# summarize
1560+$ECHO "done"
1561+$ECHO
1562+if test "x$config" = "x" -o ! -f "$config" ; then
1563+ $ECHO "WARNING: The $PROJECT build system should now be prepared but there"
1564+ $ECHO "does not seem to be a resulting configure file. This is unexpected"
1565+ $ECHO "and likely the result of an error. You should run $NAME_OF_AUTOGEN"
1566+ $ECHO "with the --verbose option to get more details on a potential"
1567+ $ECHO "misconfiguration."
1568+else
1569+ $ECHO "The $PROJECT build system is now prepared. To build here, run:"
1570+ $ECHO " $config"
1571+ $ECHO " make"
1572+fi
1573+
1574+
1575+# Local Variables:
1576+# mode: sh
1577+# tab-width: 8
1578+# sh-basic-offset: 4
1579+# sh-indentation: 4
1580+# indent-tabs-mode: t
1581+# End:
1582+# ex: shiftwidth=4 tabstop=8
1583

Archive Download this file



interactive