isl_coalesce.c: is_adj_eq_extension: always put extension in smallest position
[isl.git] / m4 / ax_submodule.m4
blob7cf899576d79317e74f3303fd2acbf66e7313840
1 AC_DEFUN([AX_SUBMODULE],
4 m4_if(m4_bregexp($2,|,choice),choice,
5         [AC_ARG_WITH($1,
6                 [AS_HELP_STRING([--with-$1=$2],
7                                 [Which $1 to use [default=$3]])])])
8 case "system" in
9 $2)
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])])
16 esac
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])
27         fi
28         with_$1="system"
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])
33         fi
34         with_$1="build"
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}"
41 case "$with_$1" in
42 $2)
43         ;;
45         case "$3" in
46         bundled)
47                 if test -d $srcdir/.git -a \
48                         -d $srcdir/$1 -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])
55                 fi
56                 if test -f $srcdir/$1/configure; then
57                         with_$1="bundled"
58                 else
59                         with_$1="no"
60                 fi
61                 ;;
62         *)
63                 with_$1="$3"
64                 ;;
65         esac
66         ;;
67 esac
68 AC_MSG_CHECKING([which $1 to use])
69 AC_MSG_RESULT($with_$1)