Blame isl-0.14/m4/ax_submodule.m4

Packit fb9d21
AC_DEFUN([AX_SUBMODULE],
Packit fb9d21
[
Packit fb9d21
Packit fb9d21
m4_if(m4_bregexp($2,|,choice),choice,
Packit fb9d21
	[AC_ARG_WITH($1,
Packit fb9d21
		[AS_HELP_STRING([--with-$1=$2],
Packit fb9d21
				[Which $1 to use [default=$3]])])])
Packit fb9d21
case "system" in
Packit fb9d21
$2)
Packit fb9d21
	AC_ARG_WITH($1_prefix,
Packit fb9d21
		    [AS_HELP_STRING([--with-$1-prefix=DIR],
Packit fb9d21
				    [Prefix of $1 installation])])
Packit fb9d21
	AC_ARG_WITH($1_exec_prefix,
Packit fb9d21
		    [AS_HELP_STRING([--with-$1-exec-prefix=DIR],
Packit fb9d21
				    [Exec prefix of $1 installation])])
Packit fb9d21
esac
Packit fb9d21
m4_if(m4_bregexp($2,build,build),build,
Packit fb9d21
	[AC_ARG_WITH($1_builddir,
Packit fb9d21
		[AS_HELP_STRING([--with-$1-builddir=DIR],
Packit fb9d21
				[Location of $1 builddir])])])
Packit fb9d21
if test "x$with_$1_prefix" != "x" -a "x$with_$1_exec_prefix" = "x"; then
Packit fb9d21
	with_$1_exec_prefix=$with_$1_prefix
Packit fb9d21
fi
Packit fb9d21
if test "x$with_$1_prefix" != "x" -o "x$with_$1_exec_prefix" != "x"; then
Packit fb9d21
	if test "x$with_$1" != "x" -a "x$with_$1" != "xyes" -a "x$with_$1" != "xsystem"; then
Packit fb9d21
		AC_MSG_ERROR([Setting $with_$1_prefix implies use of system $1])
Packit fb9d21
	fi
Packit fb9d21
	with_$1="system"
Packit fb9d21
fi
Packit fb9d21
if test "x$with_$1_builddir" != "x"; then
Packit fb9d21
	if test "x$with_$1" != "x" -a "x$with_$1" != "xyes" -a "x$with_$1" != "xbuild"; then
Packit fb9d21
		AC_MSG_ERROR([Setting $with_$1_builddir implies use of build $1])
Packit fb9d21
	fi
Packit fb9d21
	with_$1="build"
Packit fb9d21
	$1_srcdir=`echo @abs_srcdir@ | $with_$1_builddir/config.status --file=-`
Packit fb9d21
	AC_MSG_NOTICE($1 sources in $$1_srcdir)
Packit fb9d21
fi
Packit fb9d21
if test "x$with_$1_exec_prefix" != "x"; then
Packit fb9d21
	export PKG_CONFIG_PATH="$with_$1_exec_prefix/lib/pkgconfig${PKG_CONFIG_PATH+:$PKG_CONFIG_PATH}"
Packit fb9d21
fi
Packit fb9d21
case "$with_$1" in
Packit fb9d21
$2)
Packit fb9d21
	;;
Packit fb9d21
*)
Packit fb9d21
	case "$3" in
Packit fb9d21
	bundled)
Packit fb9d21
		if test -d $srcdir/.git -a \
Packit fb9d21
			-d $srcdir/$1 -a \
Packit fb9d21
			! -d $srcdir/$1/.git; then
Packit fb9d21
			AC_MSG_WARN([git repo detected, but submodule $1 not initialized])
Packit fb9d21
			AC_MSG_WARN([You may want to run])
Packit fb9d21
			AC_MSG_WARN([	git submodule init])
Packit fb9d21
			AC_MSG_WARN([	git submodule update])
Packit fb9d21
			AC_MSG_WARN([	sh autogen.sh])
Packit fb9d21
		fi
Packit fb9d21
		if test -f $srcdir/$1/configure; then
Packit fb9d21
			with_$1="bundled"
Packit fb9d21
		else
Packit fb9d21
			with_$1="no"
Packit fb9d21
		fi
Packit fb9d21
		;;
Packit fb9d21
	*)
Packit fb9d21
		with_$1="$3"
Packit fb9d21
		;;
Packit fb9d21
	esac
Packit fb9d21
	;;
Packit fb9d21
esac
Packit fb9d21
AC_MSG_CHECKING([which $1 to use])
Packit fb9d21
AC_MSG_RESULT($with_$1)
Packit fb9d21
Packit fb9d21
])