common/autoconf/autogen.sh

Thu, 31 Aug 2017 15:40:18 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:40:18 +0800
changeset 1133
50aaf272884f
parent 839
174a54ce39c4
parent 0
75a576e87639
child 2316
64a3eeabf6e5
permissions
-rw-r--r--

merge

aoqi@0 1 #!/bin/bash
aoqi@0 2 #
aoqi@0 3 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
aoqi@0 4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 5 #
aoqi@0 6 # This code is free software; you can redistribute it and/or modify it
aoqi@0 7 # under the terms of the GNU General Public License version 2 only, as
aoqi@0 8 # published by the Free Software Foundation.
aoqi@0 9 #
aoqi@0 10 # This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 13 # version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 14 # accompanied this code).
aoqi@0 15 #
aoqi@0 16 # You should have received a copy of the GNU General Public License version
aoqi@0 17 # 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 19 #
aoqi@0 20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 21 # or visit www.oracle.com if you need additional information or have any
aoqi@0 22 # questions.
aoqi@0 23 #
aoqi@0 24
aoqi@0 25 script_dir=`dirname $0`
aoqi@0 26
aoqi@0 27 # Create a timestamp as seconds since epoch
aoqi@0 28 if test "x`uname -s`" = "xSunOS"; then
aoqi@0 29 TIMESTAMP=`date +%s`
aoqi@0 30 if test "x$TIMESTAMP" = "x%s"; then
aoqi@0 31 # date +%s not available on this Solaris, use workaround from nawk(1):
aoqi@0 32 TIMESTAMP=`nawk 'BEGIN{print srand()}'`
aoqi@0 33 fi
aoqi@0 34 else
aoqi@0 35 TIMESTAMP=`date +%s`
aoqi@0 36 fi
aoqi@0 37
aoqi@0 38 if test "x$CUSTOM_CONFIG_DIR" = "x"; then
aoqi@0 39 custom_script_dir="$script_dir/../../jdk/make/closed/autoconf"
aoqi@0 40 else
aoqi@0 41 custom_script_dir=$CUSTOM_CONFIG_DIR
aoqi@0 42 fi
aoqi@0 43
aoqi@0 44 custom_hook=$custom_script_dir/custom-hook.m4
aoqi@0 45
aoqi@0 46 AUTOCONF="`which autoconf 2> /dev/null | grep -v '^no autoconf in'`"
aoqi@0 47
aoqi@0 48 echo "Autoconf found: ${AUTOCONF}"
aoqi@0 49
aoqi@0 50 if test "x${AUTOCONF}" = x; then
aoqi@0 51 echo You need autoconf installed to be able to regenerate the configure script
aoqi@0 52 echo Error: Cannot find autoconf 1>&2
aoqi@0 53 exit 1
aoqi@0 54 fi
aoqi@0 55
aoqi@0 56 echo Generating generated-configure.sh with ${AUTOCONF}
aoqi@0 57 cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | ${AUTOCONF} -W all -I$script_dir - > $script_dir/generated-configure.sh
aoqi@0 58 rm -rf autom4te.cache
aoqi@0 59
aoqi@0 60 if test -e $custom_hook; then
aoqi@0 61 echo Generating custom generated-configure.sh
aoqi@0 62 # We have custom sources available; also generate configure script
aoqi@0 63 # with custom hooks compiled in.
aoqi@0 64 cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | \
aoqi@0 65 sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|" | ${AUTOCONF} -W all -I$script_dir - > $custom_script_dir/generated-configure.sh
aoqi@0 66 rm -rf autom4te.cache
aoqi@0 67 else
aoqi@0 68 echo No custom hook found: $custom_hook
aoqi@0 69 fi

mercurial