common/autoconf/autogen.sh
changeset 14111 2a82ecb35fc7
parent 13697 5262b00bc10c
child 15065 7c06e7f756ee
equal deleted inserted replaced
14104:8d9d430b4244 14111:2a82ecb35fc7
     1 #!/bin/sh
     1 #!/bin/bash
     2 #
     2 #
     3 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     3 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5 #
     5 #
     6 # This code is free software; you can redistribute it and/or modify it
     6 # This code is free software; you can redistribute it and/or modify it
    27 # Create a timestamp as seconds since epoch
    27 # Create a timestamp as seconds since epoch
    28 if test "x`uname -s`" = "xSunOS"; then
    28 if test "x`uname -s`" = "xSunOS"; then
    29   # date +%s is not available on Solaris, use this workaround
    29   # date +%s is not available on Solaris, use this workaround
    30   # from http://solarisjedi.blogspot.co.uk/2006/06/solaris-date-command-and-epoch-time.html
    30   # from http://solarisjedi.blogspot.co.uk/2006/06/solaris-date-command-and-epoch-time.html
    31   TIMESTAMP=`/usr/bin/truss /usr/bin/date 2>&1 |  nawk -F= '/^time\(\)/ {gsub(/ /,"",$2);print $2}'`
    31   TIMESTAMP=`/usr/bin/truss /usr/bin/date 2>&1 |  nawk -F= '/^time\(\)/ {gsub(/ /,"",$2);print $2}'`
    32   # On Solaris /bin/sh doesn't support test -e but /usr/bin/test does.
       
    33   TEST=`which test`
       
    34 else
    32 else
    35   TIMESTAMP=`date +%s`
    33   TIMESTAMP=`date +%s`
    36   TEST="test"
       
    37 fi
    34 fi
    38 
    35 
    39 if $TEST "$CUSTOM_CONFIG_DIR" = ""; then
    36 if test "x$CUSTOM_CONFIG_DIR" = "x"; then
    40   custom_script_dir="$script_dir/../../jdk/make/closed/autoconf"
    37   custom_script_dir="$script_dir/../../jdk/make/closed/autoconf"
    41 else
    38 else
    42   custom_script_dir=$CUSTOM_CONFIG_DIR
    39   custom_script_dir=$CUSTOM_CONFIG_DIR
    43 fi
    40 fi
    44 
    41 
    45 custom_hook=$custom_script_dir/custom-hook.m4
    42 custom_hook=$custom_script_dir/custom-hook.m4
    46 
    43 
       
    44 if test "x`which autoconf 2> /dev/null`" = x; then
       
    45   echo You need autoconf installed to be able to regenerate the configure script
       
    46   echo Error: Cannot find autoconf 1>&2
       
    47   exit 1
       
    48 fi
       
    49 
    47 echo Generating generated-configure.sh
    50 echo Generating generated-configure.sh
    48 cat $script_dir/configure.ac  | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | autoconf -W all -I$script_dir - > $script_dir/generated-configure.sh
    51 cat $script_dir/configure.ac  | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | autoconf -W all -I$script_dir - > $script_dir/generated-configure.sh
    49 rm -rf autom4te.cache
    52 rm -rf autom4te.cache
    50 
    53 
    51 if $TEST -e $custom_hook; then
    54 if test -e $custom_hook; then
    52   echo Generating custom generated-configure.sh
    55   echo Generating custom generated-configure.sh
    53   # We have custom sources available; also generate configure script
    56   # We have custom sources available; also generate configure script
    54   # with custom hooks compiled in.
    57   # with custom hooks compiled in.
    55   cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | \
    58   cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | \
    56     sed -e "s|AC_DEFUN_ONCE(\[CUSTOM_HOOK\])|m4_include([$custom_hook])|" | autoconf -W all -I$script_dir - > $custom_script_dir/generated-configure.sh
    59     sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|" | autoconf -W all -I$script_dir - > $custom_script_dir/generated-configure.sh
    57   rm -rf autom4te.cache
    60   rm -rf autom4te.cache
    58 else
    61 else
    59   echo No custom hook found:  $custom_hook
    62   echo No custom hook found:  $custom_hook
    60 fi
    63 fi