1#!/bin/sh 2 3# Copyright (c) 2013, Ben Noordhuis <info@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 17set -eu 18cd `dirname "$0"` 19 20if [ "${1:-dev}" = "release" ]; then 21 export LIBUV_RELEASE=true 22else 23 export LIBUV_RELEASE=false 24fi 25 26if [ "${LIBTOOLIZE:-}" = "" ] && [ "`uname`" = "Darwin" ]; then 27 LIBTOOLIZE=glibtoolize 28fi 29 30ACLOCAL=${ACLOCAL:-aclocal} 31AUTOCONF=${AUTOCONF:-autoconf} 32AUTOMAKE=${AUTOMAKE:-automake} 33LIBTOOLIZE=${LIBTOOLIZE:-libtoolize} 34 35aclocal_version=`"$ACLOCAL" --version | head -n 1 | sed 's/[^.0-9]//g'` 36autoconf_version=`"$AUTOCONF" --version | head -n 1 | sed 's/[^.0-9]//g'` 37automake_version=`"$AUTOMAKE" --version | head -n 1 | sed 's/[^.0-9]//g'` 38automake_version_major=`echo "$automake_version" | cut -d. -f1` 39automake_version_minor=`echo "$automake_version" | cut -d. -f2` 40libtoolize_version=`"$LIBTOOLIZE" --version | head -n 1 | sed 's/[^.0-9]//g'` 41 42if [ $aclocal_version != $automake_version ]; then 43 echo "FATAL: aclocal version appears not to be from the same as automake" 44 exit 1 45fi 46 47UV_EXTRA_AUTOMAKE_FLAGS= 48if 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" 53fi 54echo "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) 61if $LIBUV_RELEASE; then 62 "$AUTOCONF" -o /dev/null m4/libuv-check-versions.m4 63 echo " 64AC_PREREQ($autoconf_version) 65AC_INIT([libuv-release-check], [0.0]) 66AM_INIT_AUTOMAKE([$automake_version]) 67LT_PREREQ($libtoolize_version) 68AC_OUTPUT 69" > m4/libuv-check-versions.m4 70fi 71( 72set -x 73"$AUTOCONF" 74"$AUTOMAKE" --add-missing --copy 75) 76