2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Check that AM_PATH_PYTHON correctly sets all the output variables
18 # advertised in the manual.
23 # In case the user's config.site defines pythondir or pyexecdir.
24 CONFIG_SITE=/dev/null; export CONFIG_SITE
28 # Update the definition below if the documentation changes.
29 # Note that the value of the 'pythondir' and 'pyexecdir' variables can
30 # vary among different python installations, so we need more relaxed
31 # and ad-hoc checks for them. Also, more proper "functional" checks
32 # on them should be done in the 'python-virtualenv.test' test.
33 PYTHON_VERSION=$($PYTHON -c 'import sys; print(sys.version[:3])') || Exit 1
34 PYTHON_PLATFORM=$($PYTHON -c 'import sys; print(sys.platform)') || Exit 1
35 PYTHON_EXEC_PREFIX='${exec_prefix}'
36 PYTHON_PREFIX='${prefix}'
37 pkgpythondir="\${pythondir}/$me"
38 pkgpyexecdir="\${pyexecdir}/$me"
40 pyvars='PYTHON_VERSION PYTHON_PLATFORM PYTHON_PREFIX PYTHON_EXEC_PREFIX
41 pkgpythondir pkgpyexecdir'
43 cat >> configure.ac << 'END'
44 AC_CONFIG_FILES([vars-got pythondir pyexecdir])
54 cat > Makefile.am << 'END'
60 check-local: test-in test-am
61 .PHONY: test-in test-am
65 case `cat pythondir` in '$${prefix}'/*);; *) exit 1;; esac
67 case `cat pyexecdir` in '$${exec_prefix}'/*);; *) exit 1;; esac
68 cat $(srcdir)/vars-exp
69 cat $(builddir)/vars-got
70 diff $(srcdir)/vars-exp $(builddir)/vars-got
72 ## Note: this target's rules will be extended in the "for" loop below.
74 case '$(pythondir)' in '$(prefix)'/*);; *) exit 1;; esac
75 case '$(pyexecdir)' in '$(exec_prefix)'/*);; *) exit 1;; esac
78 echo @pythondir@ > pythondir.in
79 echo @pyexecdir@ > pyexecdir.in
84 for var in $pyvars; do
86 echo "var=$val" >> vars-exp
87 echo "var=@$var@" >> vars-got.in
88 echo "${tab}test x'\$($var)' = x'$val'" >> Makefile.am
95 $AUTOMAKE --add-missing
97 for var in pythondir pyexecdir $pyvars; do
98 grep "^$var *=" Makefile.in
102 ./configure PYTHON="$PYTHON"
104 $MAKE test-in test-am