configure.ac: set maximal optimization compiler flags
[platform/upstream/isl.git] / m4 / ax_submodule.m4
1 AC_DEFUN([AX_SUBMODULE],
2 [
3
4 AC_ARG_WITH($1,
5         [AS_HELP_STRING([--with-$1=$2],
6                         [Which $1 to use [default=$3]])])
7 case "system" in
8 $2)
9         AC_ARG_WITH($1_prefix,
10                     [AS_HELP_STRING([--with-$1-prefix=DIR],
11                                     [Prefix of $1 installation])])
12         AC_ARG_WITH($1_exec_prefix,
13                     [AS_HELP_STRING([--with-$1-exec-prefix=DIR],
14                                     [Exec prefix of $1 installation])])
15 esac
16 case "build" in
17 $2)
18         AC_ARG_WITH($1_builddir,
19                     [AS_HELP_STRING([--with-$1-builddir=DIR],
20                                     [Location of $1 builddir])])
21 esac
22 if test "x$with_$1_prefix" != "x" -a "x$with_$1_exec_prefix" = "x"; then
23         with_$1_exec_prefix=$with_$1_prefix
24 fi
25 if test "x$with_$1_prefix" != "x" -o "x$with_$1_exec_prefix" != "x"; then
26         if test "x$with_$1" != "x" -a "x$with_$1" != "xsystem"; then
27                 AC_MSG_ERROR([Setting $with_$1_prefix implies use of system $1])
28         fi
29         with_$1="system"
30 fi
31 if test "x$with_$1_builddir" != "x"; then
32         if test "x$with_$1" != "x" -a "x$with_$1" != "xbuild"; then
33                 AC_MSG_ERROR([Setting $with_$1_builddir implies use of build $1])
34         fi
35         with_$1="build"
36         $1_srcdir=`echo @abs_srcdir@ | $with_$1_builddir/config.status --file=-`
37         AC_MSG_NOTICE($1 sources in $$1_srcdir)
38 fi
39 case "$with_$1" in
40 $2)
41         ;;
42 *)
43         case "$3" in
44         bundled)
45                 if test -d $srcdir/.git -a \
46                         -d $srcdir/$1 -a \
47                         ! -d $srcdir/$1/.git; then
48                         AC_MSG_WARN([git repo detected, but submodule $1 not initialized])
49                         AC_MSG_WARN([You may want to run])
50                         AC_MSG_WARN([   git submodule init])
51                         AC_MSG_WARN([   git submodule update])
52                         AC_MSG_WARN([   sh autogen.sh])
53                 fi
54                 if test -f $srcdir/$1/configure; then
55                         with_$1="bundled"
56                 else
57                         with_$1="no"
58                 fi
59                 ;;
60         *)
61                 with_$1="$3"
62                 ;;
63         esac
64         ;;
65 esac
66 AC_MSG_CHECKING([which $1 to use])
67 AC_MSG_RESULT($with_$1)
68
69 ])