common/autoconf/autogen.sh
changeset 14111 2a82ecb35fc7
parent 13697 5262b00bc10c
child 15065 7c06e7f756ee
--- a/common/autoconf/autogen.sh	Wed Jul 05 18:26:51 2017 +0200
+++ b/common/autoconf/autogen.sh	Fri Oct 26 14:29:57 2012 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,14 +29,11 @@
   # date +%s is not available on Solaris, use this workaround
   # from http://solarisjedi.blogspot.co.uk/2006/06/solaris-date-command-and-epoch-time.html
   TIMESTAMP=`/usr/bin/truss /usr/bin/date 2>&1 |  nawk -F= '/^time\(\)/ {gsub(/ /,"",$2);print $2}'`
-  # On Solaris /bin/sh doesn't support test -e but /usr/bin/test does.
-  TEST=`which test`
 else
   TIMESTAMP=`date +%s`
-  TEST="test"
 fi
 
-if $TEST "$CUSTOM_CONFIG_DIR" = ""; then
+if test "x$CUSTOM_CONFIG_DIR" = "x"; then
   custom_script_dir="$script_dir/../../jdk/make/closed/autoconf"
 else
   custom_script_dir=$CUSTOM_CONFIG_DIR
@@ -44,16 +41,22 @@
 
 custom_hook=$custom_script_dir/custom-hook.m4
 
+if test "x`which autoconf 2> /dev/null`" = x; then
+  echo You need autoconf installed to be able to regenerate the configure script
+  echo Error: Cannot find autoconf 1>&2
+  exit 1
+fi
+
 echo Generating generated-configure.sh
 cat $script_dir/configure.ac  | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | autoconf -W all -I$script_dir - > $script_dir/generated-configure.sh
 rm -rf autom4te.cache
 
-if $TEST -e $custom_hook; then
+if test -e $custom_hook; then
   echo Generating custom generated-configure.sh
   # We have custom sources available; also generate configure script
   # with custom hooks compiled in.
   cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | \
-    sed -e "s|AC_DEFUN_ONCE(\[CUSTOM_HOOK\])|m4_include([$custom_hook])|" | autoconf -W all -I$script_dir - > $custom_script_dir/generated-configure.sh
+    sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|" | autoconf -W all -I$script_dir - > $custom_script_dir/generated-configure.sh
   rm -rf autom4te.cache
 else
   echo No custom hook found:  $custom_hook