1 AC_DEFUN([_AX_SUBMODULE],
4 m4_if(m4_bregexp($3,|,choice),choice,
6 [AS_HELP_STRING([--with-$1=$3],
7 [Which $1 to use [default=$4]])])])
10 AC_ARG_WITH($2_prefix,
11 [AS_HELP_STRING([--with-$1-prefix=DIR],
12 [Prefix of $1 installation])])
13 AC_ARG_WITH($2_exec_prefix,
14 [AS_HELP_STRING([--with-$1-exec-prefix=DIR],
15 [Exec prefix of $1 installation])])
17 m4_if(m4_bregexp($3,build,build),build,
18 [AC_ARG_WITH($2_builddir,
19 [AS_HELP_STRING([--with-$1-builddir=DIR],
20 [Location of $1 builddir])])])
21 if test "x$with_$2_prefix" != "x" -a "x$with_$2_exec_prefix" = "x"; then
22 with_$2_exec_prefix=$with_$2_prefix
24 if test "x$with_$2_prefix" != "x" -o "x$with_$2_exec_prefix" != "x"; then
25 if test "x$with_$2" != "x" -a "x$with_$2" != "xsystem"; then
26 AC_MSG_ERROR([Setting $with_$2_prefix implies use of system $1])
30 if test "x$with_$2_builddir" != "x"; then
31 if test "x$with_$2" != "x" -a "x$with_$2" != "xbuild"; then
32 AC_MSG_ERROR([Setting $with_$2_builddir implies use of build $1])
35 $2_srcdir=`echo @abs_srcdir@ | $with_$2_builddir/config.status --file=-`
36 AC_MSG_NOTICE($1 sources in $$2_srcdir)
38 if test "x$with_$2_exec_prefix" != "x"; then
39 export PKG_CONFIG_PATH="$with_$2_exec_prefix/lib/pkgconfig${PKG_CONFIG_PATH+:$PKG_CONFIG_PATH}"
47 if test -d $srcdir/.git -a \
48 -d $srcdir/$1; then if test \
49 "`cd $srcdir; git submodule status $1 | cut -c1`" = '-'; then
50 AC_MSG_WARN([git repo detected, but submodule $1 not initialized])
51 AC_MSG_WARN([You may want to run])
52 AC_MSG_WARN([ git submodule init])
53 AC_MSG_WARN([ git submodule update])
54 AC_MSG_WARN([ sh autogen.sh])
56 if test -f $srcdir/$1/configure; then
75 AC_MSG_CHECKING([which $1 to use])
76 AC_MSG_RESULT($with_$2)
80 AC_DEFUN([AX_SUBMODULE], [
81 _AX_SUBMODULE($1, m4_bpatsubst([$1],
82 [[^_abcdefghijklmnopqrstuvwxyz0123456789]],[_]), $2, $3)