From: Richard W.M. Jones Date: Thu, 9 Dec 2010 12:42:33 +0000 (+0000) Subject: build: Use ./configure --with-python-installdir=DIR to select Python dir. X-Git-Tag: 1.7.21~8 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=ff484e00535e11da17d9c63447abbb6b65e4f11b;p=libguestfs.git build: Use ./configure --with-python-installdir=DIR to select Python dir. We don't always want to install in the site-packages directory. Allow the directory to be chosen using a configure option. Rename the variable PYTHON_INSTALLDIR to reflect its true purpose. --- diff --git a/configure.ac b/configure.ac index 168da83..85a1dfd 100644 --- a/configure.ac +++ b/configure.ac @@ -480,7 +480,7 @@ dnl Check for Python (optional, for Python bindings). PYTHON_PREFIX= PYTHON_VERSION= PYTHON_INCLUDEDIR= -PYTHON_SITE_PACKAGES= +PYTHON_INSTALLDIR= AC_ARG_ENABLE([python], AS_HELP_STRING([--disable-python], [Disable Python language bindings]), @@ -516,23 +516,33 @@ AS_IF([test "x$enable_python" != "xno"], AC_MSG_WARN([Python include directory not found]) fi - for d in \ - $PYTHON_PREFIX/lib64/python$PYTHON_VERSION/site-packages \ - $PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages \ - /usr/lib64/python$PYTHON_VERSION/site-packages \ - /usr/lib/python$PYTHON_VERSION/site-packages \ - /usr/local/lib/python$PYTHON_VERSION/site-packages - do - AC_MSG_CHECKING([for $d]) - if test -d "$d"; then - AC_MSG_RESULT([found]) - PYTHON_SITE_PACKAGES=$d - break + AC_ARG_WITH([python-installdir], + [AS_HELP_STRING([--with-python-installdir], + [directory to install python modules @<:@default=check@:>@])], + [PYTHON_INSTALLDIR="$withval" + AC_MSG_NOTICE([Python install dir $PYTHON_INSTALLDIR])], + [PYTHON_INSTALLDIR=check]) + + if test "x$PYTHON_INSTALLDIR" = "xcheck"; then + PYTHON_INSTALLDIR= + for d in \ + $PYTHON_PREFIX/lib64/python$PYTHON_VERSION/site-packages \ + $PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages \ + /usr/lib64/python$PYTHON_VERSION/site-packages \ + /usr/lib/python$PYTHON_VERSION/site-packages \ + /usr/local/lib/python$PYTHON_VERSION/site-packages + do + AC_MSG_CHECKING([for $d]) + if test -d "$d"; then + AC_MSG_RESULT([found]) + PYTHON_INSTALLDIR=$d + break + fi + AC_MSG_RESULT([not found]) + done + if test "x$PYTHON_INSTALLDIR" = "x"; then + AC_MSG_WARN([Python site-packages directory not found]) fi - AC_MSG_RESULT([not found]) - done - if test "x$PYTHON_SITE_PACKAGES" = "x"; then - AC_MSG_WARN([Python site-packages directory not found]) fi old_LIBS="$LIBS" @@ -544,10 +554,10 @@ AS_IF([test "x$enable_python" != "xno"], AC_SUBST(PYTHON_PREFIX) AC_SUBST(PYTHON_VERSION) AC_SUBST(PYTHON_INCLUDEDIR) - AC_SUBST(PYTHON_SITE_PACKAGES) + AC_SUBST(PYTHON_INSTALLDIR) ]) AM_CONDITIONAL([HAVE_PYTHON], - [test "x$PYTHON_INCLUDEDIR" != "x" && test "x$PYTHON_SITE_PACKAGES" != "x"]) + [test "x$PYTHON" != "xno" && test "x$PYTHON_INCLUDEDIR" != "x" && test "x$PYTHON_INSTALLDIR" != "x"]) dnl Check for Ruby and rake (optional, for Ruby bindings). AC_ARG_ENABLE([ruby], diff --git a/python/Makefile.am b/python/Makefile.am index 519bda7..1fde976 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -33,7 +33,7 @@ EXTRA_DIST = \ if HAVE_PYTHON -pythondir = $(PYTHON_SITE_PACKAGES) +pythondir = $(PYTHON_INSTALLDIR) python_DATA = guestfs.py