annotate sparql/librdf/autogen.sh @ 770:c54bc2ffbf92 tip

update tags
author convert-repo
date Fri, 16 Dec 2011 11:34:01 +0000
parents e3790284fd4a
children
rev   line source
mas01mj@584 1 #!/bin/sh
mas01mj@584 2 #
mas01mj@584 3 # autogen.sh - Generates initial makefiles from a pristine CVS tree
mas01mj@584 4 #
mas01mj@584 5 # USAGE:
mas01mj@584 6 # autogen.sh [configure options]
mas01mj@584 7 #
mas01mj@584 8 # Configuration is affected by environment variables as follows:
mas01mj@584 9 #
mas01mj@584 10 # DRYRUN
mas01mj@584 11 # If set to any value it will do no configuring but will emit the
mas01mj@584 12 # programs that would be run.
mas01mj@584 13 # e.g. DRYRUN=1 ./autogen.sh
mas01mj@584 14 #
mas01mj@584 15 # AUTOMAKE ACLOCAL AUTOCONF AUTOHEADER LIBTOOLIZE GTKDOCIZE
mas01mj@584 16 # If set (named after program) then this overrides any searching for
mas01mj@584 17 # the programs on the current PATH.
mas01mj@584 18 # e.g. AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 ./autogen.sh
mas01mj@584 19 #
mas01mj@584 20 # CONFIG_DIR (default ../config)
mas01mj@584 21 # The directory where fresh GNU config.guess and config.sub can be
mas01mj@584 22 # found for automatic copying in-place.
mas01mj@584 23 #
mas01mj@584 24 # PATH
mas01mj@584 25 # Where the programs are searched for
mas01mj@584 26 #
mas01mj@584 27 # SRCDIR (default .)
mas01mj@584 28 # Source directory
mas01mj@584 29 #
mas01mj@584 30 # This script is based on similar scripts used in various tools
mas01mj@584 31 # commonly made available via CVS and used with GNU automake.
mas01mj@584 32 # Try 'locate autogen.sh' on your system and see what you get.
mas01mj@584 33 #
mas01mj@584 34 # This script is in the public domain
mas01mj@584 35 #
mas01mj@584 36
mas01mj@584 37 # Directory for the sources
mas01mj@584 38 SRCDIR=${SRCDIR-.}
mas01mj@584 39
mas01mj@584 40 # Where the GNU config.sub, config.guess might be found
mas01mj@584 41 CONFIG_DIR=${CONFIG_DIR-../config}
mas01mj@584 42
mas01mj@584 43 # The programs required for configuring which will be searched for
mas01mj@584 44 # in the current PATH.
mas01mj@584 45 # Set an envariable of the same name in uppercase, to override scan
mas01mj@584 46 #
mas01mj@584 47 programs="automake aclocal autoconf autoheader libtoolize"
mas01mj@584 48 confs=`find . -name configure.ac -print`
mas01mj@584 49 if grep "^GTK_DOC_CHECK" $confs >/dev/null; then
mas01mj@584 50 programs="$programs gtkdocize"
mas01mj@584 51 fi
mas01mj@584 52 if grep "^AC_CHECK_PROGS.SWIG" $confs >/dev/null; then
mas01mj@584 53 programs="$programs swig"
mas01mj@584 54 fi
mas01mj@584 55 ltdl=
mas01mj@584 56 if grep "^LTDL_INIT" $confs >/dev/null; then
mas01mj@584 57 ltdl="--ltdl"
mas01mj@584 58 fi
mas01mj@584 59
mas01mj@584 60 # Some dependencies for autotools:
mas01mj@584 61 # automake 1.10 requires autoconf 2.60
mas01mj@584 62 # automake 1.9 requires autoconf 2.58
mas01mj@584 63 # automake 1.8 requires autoconf 2.58
mas01mj@584 64 # automake 1.7 requires autoconf 2.54
mas01mj@584 65 automake_min_vers=010700
mas01mj@584 66 aclocal_min_vers=$automake_min_vers
mas01mj@584 67 autoconf_min_vers=025400
mas01mj@584 68 autoheader_min_vers=$autoconf_min_vers
mas01mj@584 69 libtoolize_min_vers=020200
mas01mj@584 70 gtkdocize_min_vers=010300
mas01mj@584 71 swig_min_vers=010324
mas01mj@584 72
mas01mj@584 73 # Default program arguments
mas01mj@584 74 automake_args="--add-missing"
mas01mj@584 75 autoconf_args=
mas01mj@584 76 libtoolize_args="$ltdl --force --copy --automake"
mas01mj@584 77 gtkdocize_args="--copy"
mas01mj@584 78 aclocal_args=
mas01mj@584 79 automake_args="--gnu --add-missing --force --copy"
mas01mj@584 80 # --enable-gtk-doc does no harm if it's not available
mas01mj@584 81 configure_args="--enable-maintainer-mode --enable-gtk-doc"
mas01mj@584 82
mas01mj@584 83
mas01mj@584 84 # You should not need to edit below here
mas01mj@584 85 ######################################################################
mas01mj@584 86
mas01mj@584 87
mas01mj@584 88 # number comparisons may need a C locale
mas01mj@584 89 LANG=C
mas01mj@584 90 LC_NUMERIC=C
mas01mj@584 91
mas01mj@584 92
mas01mj@584 93 program=`basename $0`
mas01mj@584 94
mas01mj@584 95 if test "X$DRYRUN" != X; then
mas01mj@584 96 DRYRUN=echo
mas01mj@584 97 fi
mas01mj@584 98
mas01mj@584 99 cat > autogen-get-version.pl <<EOF
mas01mj@584 100 use File::Basename;
mas01mj@584 101 my \$prog=basename \$0;
mas01mj@584 102 die "\$prog: USAGE PATH PROGRAM-NAME\n e.g. \$prog /usr/bin/foo-123 foo\n"
mas01mj@584 103 unless @ARGV==2;
mas01mj@584 104
mas01mj@584 105 my(\$path,\$name)=@ARGV;
mas01mj@584 106 exit 0 if !-f \$path;
mas01mj@584 107 die "\$prog: \$path not found\n" if !-r \$path;
mas01mj@584 108
mas01mj@584 109 my \$mname=\$name; \$mname =~ s/^g(libtoolize)\$/\$1/;
mas01mj@584 110
mas01mj@584 111 my(@vnums);
mas01mj@584 112 for my \$varg (qw(--version -version)) {
mas01mj@584 113 my \$cmd="\$path \$varg";
mas01mj@584 114 open(PIPE, "\$cmd 2>&1 |") || next;
mas01mj@584 115 while(<PIPE>) {
mas01mj@584 116 chomp;
mas01mj@584 117 next if @vnums; # drain pipe if we got a vnums
mas01mj@584 118 next unless /^\$mname/i;
mas01mj@584 119 my(\$v)=/(\S+)\$/i; \$v =~ s/-.*\$//;
mas01mj@584 120 @vnums=grep { defined \$_ && !/^\s*\$/} map { s/\D//g; \$_; } split(/\./, \$v);
mas01mj@584 121 }
mas01mj@584 122 close(PIPE);
mas01mj@584 123 last if @vnums;
mas01mj@584 124 }
mas01mj@584 125
mas01mj@584 126 @vnums=(@vnums, 0, 0, 0)[0..2];
mas01mj@584 127 \$vn=join('', map { sprintf('%02d', \$_) } @vnums);
mas01mj@584 128 print "\$vn\n";
mas01mj@584 129 exit 0;
mas01mj@584 130 EOF
mas01mj@584 131
mas01mj@584 132 autogen_get_version="`pwd`/autogen-get-version.pl"
mas01mj@584 133
mas01mj@584 134 trap "rm -f $autogen_get_version" 0 1 9 15
mas01mj@584 135
mas01mj@584 136
mas01mj@584 137 update_prog_version() {
mas01mj@584 138 dir=$1
mas01mj@584 139 prog=$2
mas01mj@584 140
mas01mj@584 141 # If there exists an envariable PROG in uppercase, use that and do not scan
mas01mj@584 142 ucprog=`echo $prog | tr 'a-z' 'A-Z' `
mas01mj@584 143 eval env=\$${ucprog}
mas01mj@584 144 if test X$env != X; then
mas01mj@584 145 prog_name=$env
mas01mj@584 146 prog_vers=`perl $autogen_get_version $prog_name $prog`
mas01mj@584 147
mas01mj@584 148 if test X$prog_vers = X; then
mas01mj@584 149 prog_vers=0
mas01mj@584 150 fi
mas01mj@584 151 eval ${prog}_name=${prog_name}
mas01mj@584 152 eval ${prog}_vers=${prog_vers}
mas01mj@584 153 eval ${prog}_dir=environment
mas01mj@584 154 return
mas01mj@584 155 fi
mas01mj@584 156
mas01mj@584 157 eval prog_name=\$${prog}_name
mas01mj@584 158 eval prog_vers=\$${prog}_vers
mas01mj@584 159 eval prog_dir=\$${prog}_dir
mas01mj@584 160 if test X$prog_vers = X; then
mas01mj@584 161 prog_vers=0
mas01mj@584 162 fi
mas01mj@584 163
mas01mj@584 164 save_PATH="$PATH"
mas01mj@584 165
mas01mj@584 166 cd "$dir"
mas01mj@584 167 PATH=".:$PATH"
mas01mj@584 168
mas01mj@584 169 names=`ls $prog* 2>/dev/null`
mas01mj@584 170 if [ "X$names" != "X" ]; then
mas01mj@584 171 for name in $names; do
mas01mj@584 172 vers=`perl $autogen_get_version $dir/$name $prog`
mas01mj@584 173 if [ "X$vers" = "X" ]; then
mas01mj@584 174 continue
mas01mj@584 175 fi
mas01mj@584 176
mas01mj@584 177 if expr $vers '>' $prog_vers >/dev/null; then
mas01mj@584 178 prog_name=$name
mas01mj@584 179 prog_vers=$vers
mas01mj@584 180 prog_dir="$dir"
mas01mj@584 181 fi
mas01mj@584 182 done
mas01mj@584 183 fi
mas01mj@584 184
mas01mj@584 185 eval ${prog}_name=${prog_name}
mas01mj@584 186 eval ${prog}_vers=${prog_vers}
mas01mj@584 187 eval ${prog}_dir=${prog_dir}
mas01mj@584 188
mas01mj@584 189 PATH="$save_PATH"
mas01mj@584 190 }
mas01mj@584 191
mas01mj@584 192
mas01mj@584 193 check_prog_version() {
mas01mj@584 194 prog=$1
mas01mj@584 195
mas01mj@584 196 eval min=\$${prog}_min_vers
mas01mj@584 197
mas01mj@584 198 eval prog_name=\$${prog}_name
mas01mj@584 199 eval prog_vers=\$${prog}_vers
mas01mj@584 200 eval prog_dir=\$${prog}_dir
mas01mj@584 201
mas01mj@584 202 echo "$program: $prog program '$prog_name' V $prog_vers (min $min) in $prog_dir" 1>&2
mas01mj@584 203
mas01mj@584 204 rc=1
mas01mj@584 205 if test $prog_vers != 0; then
mas01mj@584 206 if expr $prog_vers '<' $min >/dev/null; then
mas01mj@584 207 echo "$program: ERROR: \`$prog' version $prog_vers in $prog_dir is too old."
mas01mj@584 208 echo " (version $min or newer is required)"
mas01mj@584 209 rc=0
mas01mj@584 210 else
mas01mj@584 211 # Things are ok, so set the ${prog} name
mas01mj@584 212 eval ${prog}=${prog_name}
mas01mj@584 213 fi
mas01mj@584 214 else
mas01mj@584 215 echo "$program: ERROR: You must have \`$prog' installed to compile this package."
mas01mj@584 216 echo " (version $min or newer is required)"
mas01mj@584 217 rc=0
mas01mj@584 218 fi
mas01mj@584 219
mas01mj@584 220 return $rc
mas01mj@584 221 }
mas01mj@584 222
mas01mj@584 223
mas01mj@584 224 # Find newest version of programs in the current PATH
mas01mj@584 225 save_args=${1+"$*"}
mas01mj@584 226 save_ifs="$IFS"
mas01mj@584 227 IFS=":"
mas01mj@584 228 set - $PATH
mas01mj@584 229 IFS="$save_ifs"
mas01mj@584 230
mas01mj@584 231 echo "$program: Looking for programs: $programs"
mas01mj@584 232
mas01mj@584 233 here=`pwd`
mas01mj@584 234 while [ $# -ne 0 ] ; do
mas01mj@584 235 dir=$1
mas01mj@584 236 shift
mas01mj@584 237 if [ ! -d "$dir" ]; then
mas01mj@584 238 continue
mas01mj@584 239 fi
mas01mj@584 240
mas01mj@584 241 for prog in $programs; do
mas01mj@584 242 update_prog_version "$dir" $prog
mas01mj@584 243 done
mas01mj@584 244 done
mas01mj@584 245 cd $here
mas01mj@584 246
mas01mj@584 247 set - $save_args
mas01mj@584 248 # END Find programs
mas01mj@584 249
mas01mj@584 250
mas01mj@584 251 # Check the versions meet the requirements
mas01mj@584 252 for prog in $programs; do
mas01mj@584 253 if check_prog_version $prog; then
mas01mj@584 254 exit 1
mas01mj@584 255 fi
mas01mj@584 256 done
mas01mj@584 257
mas01mj@584 258 echo "$program: Dependencies satisfied"
mas01mj@584 259
mas01mj@584 260 # Delete this libtoolize- generated directory now so that it is never
mas01mj@584 261 # considered by autogen.sh
mas01mj@584 262 $DRURUN rm -rf libltdl
mas01mj@584 263
mas01mj@584 264 config_dir=
mas01mj@584 265 if test -d $CONFIG_DIR; then
mas01mj@584 266 config_dir=`cd $CONFIG_DIR; pwd`
mas01mj@584 267 fi
mas01mj@584 268
mas01mj@584 269
mas01mj@584 270 for coin in `find $SRCDIR -name configure.ac -print`
mas01mj@584 271 do
mas01mj@584 272 dir=`dirname $coin`
mas01mj@584 273 if test -f "$dir/NO-AUTO-GEN"; then
mas01mj@584 274 echo $program: Skipping $dir -- flagged as no auto-gen
mas01mj@584 275 else
mas01mj@584 276 echo " "
mas01mj@584 277 echo $program: Processing directory $dir
mas01mj@584 278 ( cd "$dir"
mas01mj@584 279
mas01mj@584 280 # Ensure that these are created by the versions on this system
mas01mj@584 281 # (indirectly via automake)
mas01mj@584 282 $DRYRUN rm -f ltconfig ltmain.sh libtool stamp-h*
mas01mj@584 283 # Made by automake
mas01mj@584 284 $DRYRUN rm -f missing depcomp
mas01mj@584 285 # automake junk
mas01mj@584 286 $DRYRUN rm -rf autom4te*.cache
mas01mj@584 287
mas01mj@584 288 if test "X$config_dir" != X; then
mas01mj@584 289 echo "$program: Updating config.guess and config.sub"
mas01mj@584 290 for file in config.guess config.sub; do
mas01mj@584 291 cfile=$config_dir/$file
mas01mj@584 292 if test -f $cfile; then
mas01mj@584 293 $DRYRUN rm -f $file
mas01mj@584 294 $DRYRUN cp -p $cfile $file
mas01mj@584 295 fi
mas01mj@584 296 done
mas01mj@584 297 fi
mas01mj@584 298
mas01mj@584 299 echo "$program: Running $libtoolize $libtoolize_args"
mas01mj@584 300 $DRYRUN rm -f ltmain.sh libtool
mas01mj@584 301 eval $DRYRUN $libtoolize $libtoolize_args
mas01mj@584 302
mas01mj@584 303 if grep "^GTK_DOC_CHECK" configure.ac >/dev/null; then
mas01mj@584 304 # gtkdocize junk
mas01mj@584 305 $DRYRUN rm -rf gtk-doc.make
mas01mj@584 306 echo "$program: Running $gtkdocize $gtkdocize_args"
mas01mj@584 307 $DRYRUN $gtkdocize $gtkdocize_args
mas01mj@584 308 fi
mas01mj@584 309
mas01mj@584 310 echo "$program: Running $aclocal $aclocal_args"
mas01mj@584 311 $DRYRUN $aclocal $aclocal_args
mas01mj@584 312 if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
mas01mj@584 313 echo "$program: Running $autoheader"
mas01mj@584 314 $DRYRUN $autoheader
mas01mj@584 315 fi
mas01mj@584 316 echo "$program: Running $automake $automake_args"
mas01mj@584 317 $DRYRUN $automake $automake_args $automake_args
mas01mj@584 318 echo "$program: Running $autoconf"
mas01mj@584 319 $DRYRUN $autoconf $autoconf_args
mas01mj@584 320 )
mas01mj@584 321 fi
mas01mj@584 322 done
mas01mj@584 323
mas01mj@584 324
mas01mj@584 325 rm -f config.cache
mas01mj@584 326
mas01mj@584 327 AUTOMAKE=$automake
mas01mj@584 328 AUTOCONF=$autoconf
mas01mj@584 329 ACLOCAL=$aclocal
mas01mj@584 330 export AUTOMAKE AUTOCONF ACLOCAL
mas01mj@584 331
mas01mj@584 332 echo " "
mas01mj@584 333 if test -z "$*"; then
mas01mj@584 334 echo "$program: WARNING: Running \`configure' with arguments:"
mas01mj@584 335 echo "$configure_args"
mas01mj@584 336 echo "If you wish to pass others to it, please specify them on the"
mas01mj@584 337 echo "\`$program' command line."
mas01mj@584 338 fi
mas01mj@584 339
mas01mj@584 340 echo "$program: Running ./configure $configure_args $@"
mas01mj@584 341 if test "X$DRYRUN" = X; then
mas01mj@584 342 $DRYRUN ./configure $configure_args "$@" \
mas01mj@584 343 && echo "$program: Now type \`make' to compile this package" || exit 1
mas01mj@584 344 else
mas01mj@584 345 $DRYRUN ./configure $configure_args "$@"
mas01mj@584 346 fi