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 ohair@478: # date +%s is not available on Solaris, use this workaround ohair@478: # from http://solarisjedi.blogspot.co.uk/2006/06/solaris-date-command-and-epoch-time.html ohair@478: TIMESTAMP=`/usr/bin/truss /usr/bin/date 2>&1 | nawk -F= '/^time\(\)/ {gsub(/ /,"",$2);print $2}'` 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: ohair@494: if test "x`which autoconf 2> /dev/null`" = 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: ohair@478: echo Generating generated-configure.sh erikj@458: 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|" | \ ohair@494: 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