michael@0: #!/bin/sh michael@0: michael@0: # Default srcdir to this directory michael@0: srcdir= michael@0: michael@0: for option; do michael@0: case "$option" in michael@0: -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; michael@0: *) optarg= ;; michael@0: esac michael@0: michael@0: case "$option" in michael@0: --srcdir=*) srcdir="$optarg";; michael@0: esac michael@0: done michael@0: michael@0: if test -z "$CXX"; then michael@0: CXX=`which clang++` michael@0: fi michael@0: michael@0: echo -n "checking for llvm-config... " michael@0: michael@0: if test -z "$LLVMCONFIG"; then michael@0: LLVMCONFIG=`which llvm-config` michael@0: fi michael@0: michael@0: if test -z "$LLVMCONFIG"; then michael@0: LLVMCONFIG=`dirname $CXX`/llvm-config michael@0: fi michael@0: michael@0: if test ! -x "$LLVMCONFIG"; then michael@0: echo "configure: error: Cannot find an llvm-config binary for building a clang plugin" 1>&2 michael@0: exit 1 michael@0: fi michael@0: michael@0: echo "$LLVMCONFIG" michael@0: michael@0: LLVMCXXFLAGS=`$LLVMCONFIG --cxxflags` michael@0: LLVMLDFLAGS=`$LLVMCONFIG --ldflags` michael@0: CXXFLAGS="$CXXFLAGS $LLVMCXXFLAGS -fno-rtti -fno-exceptions" michael@0: LDFLAGS="$LDFLAGS $LLVMLDFLAGS" michael@0: michael@0: cat $srcdir/Makefile.in | sed \ michael@0: -e "s%@CXX@%$CXX%" \ michael@0: -e "s%@CXXFLAGS@%$CXXFLAGS%" \ michael@0: -e "s%@LDFLAGS@%$LDFLAGS%" \ michael@0: -e "s%@srcdir@%$srcdir%" \ michael@0: > Makefile