Home | History | Annotate | Line # | Download | only in dist
      1 #!/bin/sh
      2 
      3 # Copyright (c) 2013, Ben Noordhuis <info (at] bnoordhuis.nl>
      4 #
      5 # Permission to use, copy, modify, and/or distribute this software for any
      6 # purpose with or without fee is hereby granted, provided that the above
      7 # copyright notice and this permission notice appear in all copies.
      8 #
      9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     16 
     17 set -eu
     18 cd `dirname "$0"`
     19 
     20 if [ "${1:-dev}" == "release" ]; then
     21     export LIBUV_RELEASE=true
     22 else
     23     export LIBUV_RELEASE=false
     24 fi
     25 
     26 if [ "${LIBTOOLIZE:-}" = "" ] && [ "`uname`" = "Darwin" ]; then
     27   LIBTOOLIZE=glibtoolize
     28 fi
     29 
     30 ACLOCAL=${ACLOCAL:-aclocal}
     31 AUTOCONF=${AUTOCONF:-autoconf}
     32 AUTOMAKE=${AUTOMAKE:-automake}
     33 LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
     34 
     35 aclocal_version=`"$ACLOCAL" --version | head -n 1 | sed 's/[^.0-9]//g'`
     36 autoconf_version=`"$AUTOCONF" --version | head -n 1 | sed 's/[^.0-9]//g'`
     37 automake_version=`"$AUTOMAKE" --version | head -n 1 | sed 's/[^.0-9]//g'`
     38 automake_version_major=`echo "$automake_version" | cut -d. -f1`
     39 automake_version_minor=`echo "$automake_version" | cut -d. -f2`
     40 libtoolize_version=`"$LIBTOOLIZE" --version | head -n 1 | sed 's/[^.0-9]//g'`
     41 
     42 if [ $aclocal_version != $automake_version ]; then
     43     echo "FATAL: aclocal version appears not to be from the same as automake"
     44     exit 1
     45 fi
     46 
     47 UV_EXTRA_AUTOMAKE_FLAGS=
     48 if test "$automake_version_major" -gt 1 || \
     49    test "$automake_version_major" -eq 1 && \
     50    test "$automake_version_minor" -gt 11; then
     51   # serial-tests is available in v1.12 and newer.
     52   UV_EXTRA_AUTOMAKE_FLAGS="$UV_EXTRA_AUTOMAKE_FLAGS serial-tests"
     53 fi
     54 echo "m4_define([UV_EXTRA_AUTOMAKE_FLAGS], [$UV_EXTRA_AUTOMAKE_FLAGS])" \
     55     > m4/libuv-extra-automake-flags.m4
     56 
     57 (set -x
     58 "$LIBTOOLIZE" --copy --force
     59 "$ACLOCAL" -I m4
     60 )
     61 if $LIBUV_RELEASE; then
     62   "$AUTOCONF" -o /dev/null m4/libuv-check-versions.m4
     63   echo "
     64 AC_PREREQ($autoconf_version)
     65 AC_INIT([libuv-release-check], [0.0])
     66 AM_INIT_AUTOMAKE([$automake_version])
     67 LT_PREREQ($libtoolize_version)
     68 AC_OUTPUT
     69 " > m4/libuv-check-versions.m4
     70 fi
     71 (
     72 set -x
     73 "$AUTOCONF"
     74 "$AUTOMAKE" --add-missing --copy
     75 )
     76