quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

autogen.sh (2751B)


      1 #! /bin/sh
      2 
      3 args=$(getopt bfos "$@")
      4 if [ $? -ne 0 ]; then
      5   echo "Usage: autogen.sh [-b] [-f] [-o] [-s] [--]"
      6   echo
      7   echo ">   -b: do not update the system detection scripts"
      8   echo ">   -f: force the recreation of all autoconf scripts"
      9   echo ">   -o: overwrite/downgrade system detection scripts"
     10   echo ">   -s: setup an environment for developers"
     11   exit 2
     12 fi
     13 
     14 force=false
     15 update_config=true
     16 overwrite_config=false
     17 dev_setup=false
     18 
     19 eval set -- "$args"
     20 
     21 while [ $# -ne 0 ]; do
     22   case $1 in
     23   -b)
     24     update_config=false
     25     ;;
     26   -f)
     27     force=true
     28     ;;
     29   -o)
     30     overwrite_config=true
     31     ;;
     32   -s)
     33     dev_setup=true
     34     ;;
     35   --)
     36     shift
     37     break
     38     ;;
     39   esac
     40   shift
     41 done
     42 
     43 if [ -s configure ]; then
     44   if [ "$force" != true ]; then
     45     echo "autoconf scripts already exist." >&2
     46     exit 0
     47   fi
     48 elif [ "$dev_setup" != true ]; then
     49   echo "A development environment was not created."
     50   exit 0
     51 fi
     52 
     53 if glibtoolize --version >/dev/null 2>&1; then
     54   LIBTOOLIZE='glibtoolize'
     55 else
     56   LIBTOOLIZE='libtoolize'
     57 fi
     58 
     59 command -v command >/dev/null 2>&1 || {
     60   echo "command is required, but wasn't found on this system"
     61   exit 1
     62 }
     63 
     64 command -v $LIBTOOLIZE >/dev/null 2>&1 || {
     65   echo "libtool is required, but wasn't found on this system"
     66   exit 1
     67 }
     68 
     69 command -v autoconf >/dev/null 2>&1 || {
     70   echo "autoconf is required, but wasn't found on this system"
     71   exit 1
     72 }
     73 
     74 command -v automake >/dev/null 2>&1 || {
     75   echo "automake is required, but wasn't found on this system"
     76   exit 1
     77 }
     78 
     79 if [ "$overwrite_config" = false ]; then
     80   if [ -f build-aux/config.guess ]; then
     81     mv build-aux/config.guess build-aux/config.guess.stable
     82   fi
     83   if [ -f build-aux/config.sub ]; then
     84     mv build-aux/config.sub build-aux/config.sub.stable
     85   fi
     86 fi
     87 $LIBTOOLIZE --copy --install &&
     88   aclocal &&
     89   automake --add-missing --copy --force-missing --include-deps &&
     90   autoconf && echo Done.
     91 if [ "$overwrite_config" = false ]; then
     92   if [ -f build-aux/config.guess.stable ]; then
     93     mv build-aux/config.guess.stable build-aux/config.guess
     94   fi
     95   if [ -f build-aux/config.sub.stable ]; then
     96     mv build-aux/config.sub.stable build-aux/config.sub
     97   fi
     98 fi
     99 
    100 [ "$update_config" = true ] && [ -z "$DO_NOT_UPDATE_CONFIG_SCRIPTS" ] &&
    101   command -v curl >/dev/null 2>&1 && {
    102   echo "Downloading config.guess and config.sub..."
    103 
    104   curl -sSL --fail -o config.guess \
    105     'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' &&
    106     chmod +x config.guess &&
    107     chmod +x build-aux/config.guess
    108 
    109   curl -sSL --fail -o config.sub \
    110     'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' &&
    111     chmod +x build-aux/config.sub &&
    112     mv -f config.sub build-aux/config.sub
    113 
    114   echo "Done."
    115 }
    116 
    117 rm -f config.guess config.sub