common/autoconf/autogen.sh

changeset 0
75a576e87639
child 1133
50aaf272884f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/common/autoconf/autogen.sh	Wed Apr 27 01:39:08 2016 +0800
     1.3 @@ -0,0 +1,69 @@
     1.4 +#!/bin/bash
     1.5 +#
     1.6 +# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8 +#
     1.9 +# This code is free software; you can redistribute it and/or modify it
    1.10 +# under the terms of the GNU General Public License version 2 only, as
    1.11 +# published by the Free Software Foundation.
    1.12 +#
    1.13 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.15 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.16 +# version 2 for more details (a copy is included in the LICENSE file that
    1.17 +# accompanied this code).
    1.18 +#
    1.19 +# You should have received a copy of the GNU General Public License version
    1.20 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.21 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.22 +#
    1.23 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.24 +# or visit www.oracle.com if you need additional information or have any
    1.25 +# questions.
    1.26 +#
    1.27 +
    1.28 +script_dir=`dirname $0`
    1.29 +
    1.30 +# Create a timestamp as seconds since epoch
    1.31 +if test "x`uname -s`" = "xSunOS"; then
    1.32 +  TIMESTAMP=`date +%s`
    1.33 +  if test "x$TIMESTAMP" = "x%s"; then
    1.34 +    # date +%s not available on this Solaris, use workaround from nawk(1):
    1.35 +    TIMESTAMP=`nawk 'BEGIN{print srand()}'`
    1.36 +  fi
    1.37 +else
    1.38 +  TIMESTAMP=`date +%s`
    1.39 +fi
    1.40 +
    1.41 +if test "x$CUSTOM_CONFIG_DIR" = "x"; then
    1.42 +  custom_script_dir="$script_dir/../../jdk/make/closed/autoconf"
    1.43 +else
    1.44 +  custom_script_dir=$CUSTOM_CONFIG_DIR
    1.45 +fi
    1.46 +
    1.47 +custom_hook=$custom_script_dir/custom-hook.m4
    1.48 +
    1.49 +AUTOCONF="`which autoconf 2> /dev/null | grep -v '^no autoconf in'`"
    1.50 +
    1.51 +echo "Autoconf found: ${AUTOCONF}"
    1.52 +
    1.53 +if test "x${AUTOCONF}" = x; then
    1.54 +  echo You need autoconf installed to be able to regenerate the configure script
    1.55 +  echo Error: Cannot find autoconf 1>&2
    1.56 +  exit 1
    1.57 +fi
    1.58 +
    1.59 +echo Generating generated-configure.sh with ${AUTOCONF}
    1.60 +cat $script_dir/configure.ac  | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | ${AUTOCONF} -W all -I$script_dir - > $script_dir/generated-configure.sh
    1.61 +rm -rf autom4te.cache
    1.62 +
    1.63 +if test -e $custom_hook; then
    1.64 +  echo Generating custom generated-configure.sh
    1.65 +  # We have custom sources available; also generate configure script
    1.66 +  # with custom hooks compiled in.
    1.67 +  cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | \
    1.68 +      sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|" | ${AUTOCONF} -W all -I$script_dir - > $custom_script_dir/generated-configure.sh
    1.69 +  rm -rf autom4te.cache
    1.70 +else
    1.71 +  echo No custom hook found:  $custom_hook
    1.72 +fi

mercurial