ohair@494: #!/bin/bash ohair@425: # ohair@425: # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. ohair@425: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ohair@425: # ohair@425: # This code is free software; you can redistribute it and/or modify it ohair@425: # under the terms of the GNU General Public License version 2 only, as ohair@425: # published by the Free Software Foundation. ohair@425: # ohair@425: # This code is distributed in the hope that it will be useful, but WITHOUT ohair@425: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ohair@425: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ohair@425: # version 2 for more details (a copy is included in the LICENSE file that ohair@425: # accompanied this code). ohair@425: # ohair@425: # You should have received a copy of the GNU General Public License version ohair@425: # 2 along with this work; if not, write to the Free Software Foundation, ohair@425: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ohair@425: # ohair@425: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@425: # or visit www.oracle.com if you need additional information or have any ohair@425: # questions. ohair@425: # ohair@425: erikj@458: script_dir=`dirname $0` erikj@458: erikj@458: # Create a timestamp as seconds since epoch ohair@478: if test "x`uname -s`" = "xSunOS"; then tbell@571: TIMESTAMP=`date +%s` tbell@571: if test "x$TIMESTAMP" = "x%s"; then tbell@571: # date +%s not available on this Solaris, use workaround from nawk(1): tbell@571: TIMESTAMP=`nawk 'BEGIN{print srand()}'` tbell@571: fi ohair@478: else ohair@478: TIMESTAMP=`date +%s` ohair@478: fi erikj@458: ohair@494: if test "x$CUSTOM_CONFIG_DIR" = "x"; then ohair@478: custom_script_dir="$script_dir/../../jdk/make/closed/autoconf" ohair@478: else ohair@478: custom_script_dir=$CUSTOM_CONFIG_DIR ohair@478: fi ohair@478: ohair@478: custom_hook=$custom_script_dir/custom-hook.m4 ohair@478: andrew@664: AUTOCONF=$(which autoconf 2> /dev/null); andrew@664: AUTOCONF_267=$(which autoconf-2.67 2> /dev/null); andrew@664: andrew@664: echo "Autoconf found: ${AUTOCONF}" andrew@664: echo "Autoconf-2.67 found: ${AUTOCONF_267}" andrew@664: andrew@664: if test "x${AUTOCONF}" = x; then ohair@494: echo You need autoconf installed to be able to regenerate the configure script ohair@494: echo Error: Cannot find autoconf 1>&2 ohair@494: exit 1 ohair@494: fi ohair@494: andrew@664: if test "x${AUTOCONF_267}" != x; then andrew@664: AUTOCONF=${AUTOCONF_267}; andrew@664: fi andrew@664: andrew@664: echo Generating generated-configure.sh with ${AUTOCONF} andrew@664: cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | ${AUTOCONF} -W all -I$script_dir - > $script_dir/generated-configure.sh erikj@458: rm -rf autom4te.cache erikj@458: ohair@494: if test -e $custom_hook; then ohair@478: echo Generating custom generated-configure.sh ohair@478: # We have custom sources available; also generate configure script ohair@478: # with custom hooks compiled in. erikj@458: cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | \ andrew@664: sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|" | ${AUTOCONF} -W all -I$script_dir - > $custom_script_dir/generated-configure.sh erikj@458: rm -rf autom4te.cache ohair@478: else ohair@478: echo No custom hook found: $custom_hook erikj@458: fi