2 # Copyright (C) 2011-2017 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
26 # Update the definition below if the documentation changes.
27 # Note that the value of the 'pythondir' and 'pyexecdir' variables can
28 # vary among different python installations, so we need more relaxed
29 # and ad-hoc checks for them. Also, more proper "functional" checks
30 # on them should be done in the 'python-virtualenv.sh' test.
31 PYTHON_VERSION
=$
($PYTHON -c 'import sys; print(sys.version[:3])') ||
exit 1
32 PYTHON_PLATFORM
=$
($PYTHON -c 'import sys; print(sys.platform)') ||
exit 1
33 PYTHON_EXEC_PREFIX
='${exec_prefix}'
34 PYTHON_PREFIX
='${prefix}'
35 pkgpythondir
="\${pythondir}/$me"
36 pkgpyexecdir
="\${pyexecdir}/$me"
38 pyvars
='PYTHON_VERSION PYTHON_PLATFORM PYTHON_PREFIX PYTHON_EXEC_PREFIX
39 pkgpythondir pkgpyexecdir'
41 cat >> configure.ac
<< 'END'
42 AC_CONFIG_FILES
([vars-got pythondir pyexecdir
])
52 cat > Makefile.am
<< 'END'
58 check-local
: test-in test-am
59 .PHONY
: test-in test-am
63 case `cat pythondir` in '$${prefix}'/*);; *) exit 1;; esac
65 case `cat pyexecdir` in '$${exec_prefix}'/*);; *) exit 1;; esac
66 cat $
(srcdir
)/vars-exp
67 cat $
(builddir
)/vars-got
68 diff $
(srcdir
)/vars-exp $
(builddir
)/vars-got
70 ## Note: this target's rules will be extended in the "for" loop below.
72 case '$(pythondir)' in '$(prefix)'/*);; *) exit 1;; esac
73 case '$(pyexecdir)' in '$(exec_prefix)'/*);; *) exit 1;; esac
76 echo @pythondir@
> pythondir.
in
77 echo @pyexecdir@
> pyexecdir.
in
82 for var
in $pyvars; do
84 echo "var=$val" >> vars-exp
85 echo "var=@$var@" >> vars-got.
in
86 echo "${tab}test x'\$($var)' = x'$val'" >> Makefile.am
93 $AUTOMAKE --add-missing
95 for var
in pythondir pyexecdir
$pyvars; do
96 grep "^$var *=" Makefile.
in
100 .
/configure PYTHON
="$PYTHON"
102 $MAKE test-in test-am