changelog: Describe v0.4, closes 1 bug
[dragbox/debian.git] / acinclude.m4
blob4962ebe7c762ecf5daea60f75a82100a93856bc0
1 ##### http://autoconf-archive.cryp.to/ac_python_module.html
3 # SYNOPSIS
5 #   AC_PYTHON_MODULE(modname[, fatal])
7 # DESCRIPTION
9 #   Checks for Python module.
11 #   If fatal is non-empty then absence of a module will trigger an
12 #   error.
14 # LAST MODIFICATION
16 #   2007-01-09
18 # COPYLEFT
20 #   Copyright (c) 2007 Andrew Collier <colliera@ukzn.ac.za>
22 #   Copying and distribution of this file, with or without
23 #   modification, are permitted in any medium without royalty provided
24 #   the copyright notice and this notice are preserved.
26 AC_DEFUN([AC_PYTHON_MODULE],[
27     if test -z $PYTHON;
28     then
29         PYTHON="python"
30     fi
31     PYTHON_NAME=`basename $PYTHON`
32     AC_MSG_CHECKING($PYTHON_NAME module: $1)
33         $PYTHON -c "import $1" 2>/dev/null
34         if test $? -eq 0;
35         then
36                 AC_MSG_RESULT(yes)
37                 eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
38         else
39                 AC_MSG_RESULT(no)
40                 eval AS_TR_CPP(HAVE_PYMOD_$1)=no
41                 #
42                 if test -n "$2"
43                 then
44                         AC_MSG_ERROR(failed to find required module $1)
45                         exit 1
46                 fi
47         fi
51 dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
52 dnl
53 dnl example
54 dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
55 dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
57 AC_DEFUN([AS_AC_EXPAND],
59   EXP_VAR=[$1]
60   FROM_VAR=[$2]
62   dnl first expand prefix and exec_prefix if necessary
63   prefix_save=$prefix
64   exec_prefix_save=$exec_prefix
66   dnl if no prefix given, then use /usr/local, the default prefix
67   if test "x$prefix" = "xNONE"; then
68     prefix=$ac_default_prefix
69   fi
70   dnl if no exec_prefix given, then use prefix
71   if test "x$exec_prefix" = "xNONE"; then
72     exec_prefix=$prefix
73   fi
75   full_var="$FROM_VAR"
76   dnl loop until it doesn't change anymore
77   while true; do
78     new_full_var="`eval echo $full_var`"
79     if test "x$new_full_var" = "x$full_var"; then break; fi
80     full_var=$new_full_var
81   done
83   dnl clean up
84   full_var=$new_full_var
85   AC_SUBST([$1], "$full_var")
87   dnl restore prefix and exec_prefix
88   prefix=$prefix_save
89   exec_prefix=$exec_prefix_save