make/autoconf/autogen.sh
changeset 47313 eb28be8f935d
parent 47216 71c04702a3d5
equal deleted inserted replaced
47312:d4f959806fe9 47313:eb28be8f935d
     1 #!/bin/bash
     1 #!/bin/bash
     2 #
     2 #
     3 # Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
     3 # Copyright (c) 2011, 2017, 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
     7 # under the terms of the GNU General Public License version 2 only, as
     7 # under the terms of the GNU General Public License version 2 only, as
     8 # published by the Free Software Foundation.
     8 # published by the Free Software Foundation.
    50   fi
    50   fi
    51 else
    51 else
    52   TIMESTAMP=`date +%s`
    52   TIMESTAMP=`date +%s`
    53 fi
    53 fi
    54 
    54 
    55 if test "x$CUSTOM_CONFIG_DIR" = "x"; then
       
    56   topdir=`cd $script_dir/../..  >/dev/null && pwd`
       
    57   custom_script_dir="$topdir/closed/autoconf"
       
    58 else
       
    59   custom_script_dir=$CUSTOM_CONFIG_DIR
       
    60 fi
       
    61 
       
    62 custom_hook=$custom_script_dir/custom-hook.m4
       
    63 
       
    64 AUTOCONF="`which autoconf 2> /dev/null | grep -v '^no autoconf in'`"
    55 AUTOCONF="`which autoconf 2> /dev/null | grep -v '^no autoconf in'`"
    65 
    56 
    66 if test "x${AUTOCONF}" = x; then
    57 if test "x${AUTOCONF}" = x; then
    67   echo "You need autoconf installed to be able to regenerate the configure script"
    58   echo "You need autoconf installed to be able to regenerate the configure script"
    68   echo "Error: Cannot find autoconf" 1>&2
    59   echo "Error: Cannot find autoconf" 1>&2
    73 echo "Using autoconf at ${AUTOCONF} [$autoconf_version]"
    64 echo "Using autoconf at ${AUTOCONF} [$autoconf_version]"
    74 
    65 
    75 echo "Generating generated-configure.sh"
    66 echo "Generating generated-configure.sh"
    76 generate_configure_script "$script_dir/generated-configure.sh" 'cat'
    67 generate_configure_script "$script_dir/generated-configure.sh" 'cat'
    77 
    68 
    78 if test -e $custom_hook; then
    69 if test "x$CUSTOM_CONFIG_DIR" != "x"; then
       
    70   custom_hook=$CUSTOM_CONFIG_DIR/custom-hook.m4
       
    71   if test ! -e $custom_hook; then
       
    72     echo "CUSTOM_CONFIG_DIR set but $CUSTOM_CONFIG_DIR/custom-hook.m4 not present"
       
    73     echo "Error: Cannot continue" 1>&2
       
    74     exit 1
       
    75   fi
       
    76 
    79   # We have custom sources available; also generate configure script
    77   # We have custom sources available; also generate configure script
    80   # with custom hooks compiled in.
    78   # with custom hooks compiled in.
    81   echo "Generating custom generated-configure.sh"
    79   echo "Generating custom generated-configure.sh"
    82   generate_configure_script "$custom_script_dir/generated-configure.sh" 'sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|"'
    80   generate_configure_script "$CUSTOM_CONFIG_DIR/generated-configure.sh" 'sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|"'
    83 else
       
    84   echo "(No custom hook found at $custom_hook)"
       
    85 fi
    81 fi