Add log dump
[lash.git] / acinclude.m4
blob3c709d01d9da5d66666b10840e86b763ad8070cf
1 AC_DEFUN([AC_PROG_SWIG],[
2         AC_PATH_PROG([SWIG],[swig])
3         if test -z "$SWIG" ; then
4                 AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org])
5                 SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false'
6         elif test -n "$1" ; then
7                 AC_MSG_CHECKING([for SWIG version])
8                 [swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
9                 AC_MSG_RESULT([$swig_version])
10                 if test -n "$swig_version" ; then
11                         # Calculate the required version number components
12                         [required=$1]
13                         [required_major=`echo $required | sed 's/[^0-9].*//'`]
14                         if test -z "$required_major" ; then
15                                 [required_major=0]
16                         fi
17                         [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
18                         [required_minor=`echo $required | sed 's/[^0-9].*//'`]
19                         if test -z "$required_minor" ; then
20                                 [required_minor=0]
21                         fi
22                         [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
23                         [required_patch=`echo $required | sed 's/[^0-9].*//'`]
24                         if test -z "$required_patch" ; then
25                                 [required_patch=0]
26                         fi
27                         # Calculate the available version number components
28                         [available=$swig_version]
29                         [available_major=`echo $available | sed 's/[^0-9].*//'`]
30                         if test -z "$available_major" ; then
31                                 [available_major=0]
32                         fi
33                         [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
34                         [available_minor=`echo $available | sed 's/[^0-9].*//'`]
35                         if test -z "$available_minor" ; then
36                                 [available_minor=0]
37                         fi
38                         [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
39                         [available_patch=`echo $available | sed 's/[^0-9].*//'`]
40                         if test -z "$available_patch" ; then
41                                 [available_patch=0]
42                         fi
43                         if test $available_major -ne $required_major \
44                                 -o $available_minor -ne $required_minor \
45                                 -o $available_patch -lt $required_patch ; then
46                                 AC_MSG_WARN([SWIG version >= $1 is required.  You have $swig_version.  You should look at http://www.swig.org])
47                                 SWIG='echo "Error: SWIG version >= $1 is required.  You have '"$swig_version"'.  You should look at http://www.swig.org" ; false'
48                         else
49                                 AC_MSG_NOTICE([SWIG executable is '$SWIG'])
50                                 SWIG_LIB=`$SWIG -swiglib`
51                                 AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB'])
52                         fi
53                 else
54                         AC_MSG_WARN([cannot determine SWIG version])
55                         SWIG='echo "Error: Cannot determine SWIG version.  You should look at http://www.swig.org" ; false'
56                 fi
57         fi
58         AC_SUBST([SWIG_LIB])
61 dnl a macro to check for ability to create python extensions
62 dnl  AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
63 dnl function also defines PYTHON_INCLUDES
64 AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
65 [AC_REQUIRE([AM_PATH_PYTHON])
66 AC_MSG_CHECKING(for headers required to compile python extensions)
67 dnl deduce PYTHON_INCLUDES
68 py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
69 py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
70 PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
71 if test "$py_prefix" != "$py_exec_prefix"; then
72   PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
74 AC_SUBST(PYTHON_INCLUDES)
75 dnl check if the headers exist:
76 save_CPPFLAGS="$CPPFLAGS"
77 CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
78 AC_TRY_CPP([#include <Python.h>],dnl
79 [AC_MSG_RESULT(found)
80 $1],dnl
81 [AC_MSG_RESULT(not found)
82 $2])
83 CPPFLAGS="$save_CPPFLAGS"
86 dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
87 dnl example
88 dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
89 dnl will set SYSCONFDIR to /usr/local/etc
91 dnl written by thomas vander stichele
93 AC_DEFUN([AS_AC_EXPAND],
95   EXP_VAR=[$1]
96   FROM_VAR=[$2]
98   dnl first expand prefix and exec_prefix if necessary
99   prefix_save=$prefix
100   if test "x$prefix" = "xNONE"; then
101     prefix=/usr/local
102   fi
103   exec_prefix_save=$exec_prefix
104   if test "x$exec_prefix" = "xNONE"; then
105     if test "x$prefix_save" = "xNONE"; then
106       exec_prefix=/usr/local
107     else
108       exec_prefix=$prefix
109     fi
110   fi
112   full_var="$FROM_VAR"
113   dnl loop until it doesn't change anymore
114   while true; do
115     new_full_var="`eval echo $full_var`"
116     if test "x$new_full_var" = "x$full_var"; then break; fi
117     full_var=$new_full_var
118   done
120   dnl clean up
121   full_var=$new_full_var
122   [$1]=$full_var
123   prefix=$prefix_save
124   exec_prefix=$exec_prefix_save