1 AC_DEFUN([AX_SUBMODULE],
4 m4_if(m4_bregexp($2,|,choice),choice,
6 [AS_HELP_STRING([--with-$1=$2],
7 [Which $1 to use [default=$3]])])])
10 AC_ARG_WITH($1_prefix,
11 [AS_HELP_STRING([--with-$1-prefix=DIR],
12 [Prefix of $1 installation])])
13 AC_ARG_WITH($1_exec_prefix,
14 [AS_HELP_STRING([--with-$1-exec-prefix=DIR],
15 [Exec prefix of $1 installation])])
17 m4_if(m4_bregexp($2,build,build),build,
18 [AC_ARG_WITH($1_builddir,
19 [AS_HELP_STRING([--with-$1-builddir=DIR],
20 [Location of $1 builddir])])])
21 if test "x$with_$1_prefix" != "x" -a "x$with_$1_exec_prefix" = "x"; then
22 with_$1_exec_prefix=$with_$1_prefix
24 if test "x$with_$1_prefix" != "x" -o "x$with_$1_exec_prefix" != "x"; then
25 if test "x$with_$1" != "x" -a "x$with_$1" != "xyes" -a "x$with_$1" != "xsystem"; then
26 AC_MSG_ERROR([Setting $with_$1_prefix implies use of system $1])
30 if test "x$with_$1_builddir" != "x"; then
31 if test "x$with_$1" != "x" -a "x$with_$1" != "xyes" -a "x$with_$1" != "xbuild"; then
32 AC_MSG_ERROR([Setting $with_$1_builddir implies use of build $1])
35 $1_srcdir=`echo @abs_srcdir@ | $with_$1_builddir/config.status --file=-`
36 AC_MSG_NOTICE($1 sources in $$1_srcdir)
38 if test "x$with_$1_exec_prefix" != "x"; then
39 export PKG_CONFIG_PATH="$with_$1_exec_prefix/lib/pkgconfig${PKG_CONFIG_PATH+:$PKG_CONFIG_PATH}"
47 if test -d $srcdir/.git -a \
49 ! -d $srcdir/$1/.git; 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
68 AC_MSG_CHECKING([which $1 to use])
69 AC_MSG_RESULT($with_$1)