From f08ac8625265e6d45b32903007b7086219e5419a Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Fri, 16 May 2008 19:29:26 +0000 Subject: [PATCH] Non-bash and m4 quoting fixes, improve site-packages detection with distutils git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8454 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- configure.in | 49 +++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/configure.in b/configure.in index 50eba52e21..a33542cec4 100644 --- a/configure.in +++ b/configure.in @@ -469,21 +469,6 @@ then fi AC_MSG_RESULT([$PYTHON_VER]) - AC_MSG_CHECKING([location of site-packages]) - - # NOTE: this assumes our desired location is always the last one in the list - # (= system package location is searched last) - # - # needs double brackets because m4 removes one pair - PYTHON_SITE_DIR="`$PYTHON -c 'import sys; print sys.path[[-1]];'`" - - if test -z "$PYTHON_SITE_DIR" ; then - AC_MSG_ERROR([Unable to detect python site-packages path]) - elif test ! -d "$PYTHON_SITE_DIR" ; then - AC_MSG_ERROR([Path $PYTHON_SITE_DIR returned by python does not exist!]) - fi - AC_MSG_RESULT([$PYTHON_SITE_DIR]) - AC_SUBST([PYTHON_SITE_DIR], [$PYTHON_SITE_DIR]) AC_MSG_CHECKING([for python distutils]) python_has_distutils="no" @@ -496,6 +481,22 @@ then if test "$python_has_distutils" = "no" ; then AC_MSG_RESULT([Falling back to python-config]) + # NOTE: this assumes our desired location is always the last one in the list + # (= system package location is searched last) + # + # needs double brackets because m4 removes one pair + AC_MSG_CHECKING([location of site-packages]) + + PYTHON_SITE_DIR="`$PYTHON -c 'import sys; print sys.path[[-1]];'`" + + if test -z "$PYTHON_SITE_DIR" ; then + AC_MSG_ERROR([Unable to detect python site-packages path]) + elif test ! -d "$PYTHON_SITE_DIR" ; then + AC_MSG_ERROR([Path $PYTHON_SITE_DIR returned by python does not exist!]) + fi + AC_MSG_RESULT([$PYTHON_SITE_DIR]) + AC_SUBST([PYTHON_SITE_DIR], [$PYTHON_SITE_DIR]) + # # no python distutils, try to use python-config # (do we really need to keep this?) @@ -521,12 +522,24 @@ then ) fi else + AC_MSG_CHECKING([location of site-packages]) + + PYTHON_SITE_DIR="`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_python_lib(1);'`" + + if test -z "$PYTHON_SITE_DIR" ; then + AC_MSG_ERROR([Unable to detect python site-packages path]) + elif test ! -d "$PYTHON_SITE_DIR" ; then + AC_MSG_ERROR([Path $PYTHON_SITE_DIR returned by python does not exist!]) + fi + AC_MSG_RESULT([$PYTHON_SITE_DIR]) + AC_SUBST([PYTHON_SITE_DIR], [$PYTHON_SITE_DIR]) + # # python distutils found, get settings from python directly # - PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; flags = ["-I" + sysconfig.get_python_inc(0), "-I" + sysconfig.get_python_inc(1), " ".join(sysconfig.get_config_var("CFLAGS").split())]; print " ".join(flags);'`" - PYTHON_LDFLAGS="`$PYTHON -c 'from distutils import sysconfig; libs = sysconfig.get_config_var("LIBS").split() + sysconfig.get_config_var("SYSLIBS").split(); libs.append("-lpython"+sysconfig.get_config_var("VERSION")); print " ".join(libs);'`" - PYTHON_LIB="`$PYTHON -c 'from distutils import sysconfig; print "python" + sysconfig.get_config_var("VERSION");'`" + PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print \" \".join(flags);'`" + PYTHON_LDFLAGS="`$PYTHON -c 'from distutils import sysconfig; libs = sysconfig.get_config_var(\"LIBS\").split() + sysconfig.get_config_var(\"SYSLIBS\").split(); libs.append(\"-lpython\"+sysconfig.get_config_var(\"VERSION\")); print \" \".join(libs);'`" + PYTHON_LIB="`$PYTHON -c 'from distutils import sysconfig; print \"python\" + sysconfig.get_config_var(\"VERSION\");'`" fi if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LDFLAGS"