Skip to content
Snippets Groups Projects
autogen.sh 2.28 KiB
Newer Older
  • Learn to ignore specific revisions
  • #!/bin/sh
    
    Oliver Sander's avatar
    Oliver Sander committed
    # : duneproject 4749 2006-10-19 16:31:22Z christi $
    
    Oliver Sander's avatar
    Oliver Sander committed
    # barf on errors
    
    set -e
    
    usage () {
        echo "Usage: ./autogen.sh [options]"
    
    Oliver Sander's avatar
    Oliver Sander committed
        echo "  --ac=, --acversion=VERSION   use a specific VERSION of autoconf"
        echo "  --am=, --amversion=VERSION   use a specific VERSION of automake"
        echo "  -h,    --help                you already found this :-)"
    
    Oliver Sander's avatar
    Oliver Sander committed
    for OPT in "$@"; do
    
        set +e
        # stolen from configure...
        # when no option is set, this returns an error code
        arg=`expr "x$OPT" : 'x[^=]*=\(.*\)'`
        set -e
    
        case "$OPT" in
    
    Oliver Sander's avatar
    Oliver Sander committed
    	--ac=*|--acversion=*)
    			if test "x$arg" = "x"; then
    				usage; 
    				exit 1;
    			fi
    			ACVERSION=$arg
    			;;
    	--am=*|--amversion=*)
    			if test "x$arg" = "x"; then
    				usage; 
    				exit 1;
    			fi
    			AMVERSION=$arg
    			;;
    
    	-h|--help) usage ; exit 0 ;;
    
    Oliver Sander's avatar
    Oliver Sander committed
    	*)
                if test -d "$OPT/m4"; then
                  ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I $OPT/m4"
                fi
                if test -d "/share/aclocal"; then
                  ACLOCAL_FLAGS=" -I /share/aclocal"
                fi
                if test -d "$OPT/am"; then
                  am_dir="$OPT/am"
                fi
                ;;
    
    Oliver Sander's avatar
    Oliver Sander committed
    ## report parameters
    if test "x$ACVERSION" != "x"; then
    	echo "Forcing autoconf version $ACVERSION"
    	if ! which autoconf$ACVERSION > /dev/null; then
    		echo
    		echo "Error: Could not find autoconf$ACVERSION"
    		echo "       Did you specify a wrong version?"
    		exit 1
    	fi
    
    Oliver Sander's avatar
    Oliver Sander committed
    if test "x$AMVERSION" != "x"; then
    	echo "Forcing automake version $AMVERSION"
    	if ! which automake$AMVERSION > /dev/null; then
    		echo
    		echo "Error: Could not find automake$AMVERSION"
    		echo "       Did you specify a wrong version?"
    		exit 1
    	fi
    
    Oliver Sander's avatar
    Oliver Sander committed
    ## run autotools
    
    
    echo "--> libtoolize..."
    
    Oliver Sander's avatar
    Oliver Sander committed
    # this script won't rewrite the files if they already exist. This is a
    # PITA when you want to upgrade libtool, thus I'm setting --force
    
    libtoolize --force
    
    
    Oliver Sander's avatar
    Oliver Sander committed
    # prepare everything
    
    echo "--> aclocal..."
    
    Oliver Sander's avatar
    Oliver Sander committed
    aclocal$AMVERSION $ACLOCAL_FLAGS
    
    Oliver Sander's avatar
    Oliver Sander committed
    # applications should provide a config.h for now
    
    echo "--> autoheader..."
    
    Oliver Sander's avatar
    Oliver Sander committed
    autoheader$ACVERSION
    
    Oliver Sander's avatar
    Oliver Sander committed
    # create a link to the dune-common am directory
    echo "--> linking dune-common/am..."
    rm -f am
    ln -s $am_dir am
    
    # call automake/conf
    
    echo "--> automake..."
    
    Oliver Sander's avatar
    Oliver Sander committed
    automake$AMVERSION --add-missing
    
    
    echo "--> autoconf..."
    
    Oliver Sander's avatar
    Oliver Sander committed
    autoconf$ACVERSION
    
    Oliver Sander's avatar
    Oliver Sander committed
    ## tell the user what to do next
    echo "Now run ./configure "