[Freeswitch-svn] [commit] r8454 - freeswitch/trunk

Freeswitch SVN stkn at freeswitch.org
Fri May 16 15:29:26 EDT 2008


Author: stkn
Date: Fri May 16 15:29:26 2008
New Revision: 8454

Modified:
   freeswitch/trunk/configure.in

Log:
Non-bash and m4 quoting fixes, improve site-packages detection with distutils

Modified: freeswitch/trunk/configure.in
==============================================================================
--- freeswitch/trunk/configure.in	(original)
+++ freeswitch/trunk/configure.in	Fri May 16 15:29:26 2008
@@ -469,21 +469,6 @@
 		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 @@
 		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 @@
 				)
 			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"



More information about the Freeswitch-svn mailing list