[patch] cygwin, --enable-indirect-deps

Charles Wilson cygwin at cwilson.fastmail.fm
Fri Nov 10 23:06:52 PST 2006


The attached patch fixes three issues on cygwin with pkg-config-0.21.

(1) We do not have a "root" user at all on cygwin, but neither do we 
have /usr/xpg4/bin/sh.  So, all of the check-* scripts need to be more 
careful before exec'ing /usr/xpg4/bin/sh.

(2) When this change was made:

         * pkg.c (packages_get_other_cflags, package_get_other_cflags)
         (packages_get_I_cflags): Always add all cflags.  Debian #340904

check-requires-private was not updated to reflect that behavior change.

(3) check-libs and check-libs-private behavior need to accommodate 
altered behavior when --enable-indirect-deps

--
Chuck

2006-11-10  Charles Wilson  <...>

	* check/common: parse config.h to set variable 'indirect_deps'
	based on ENABLE_INDIRECT_DEPS status.
	* check/check-cflags: be more careful before invoking
	/usr/xpg4/bin/sh
	* check/check-define-variable: ditto
	* check/check-includedir: ditto
	* check/check-libs-private: ditto
	* check/check-libs: be more careful before invoking
	/usr/xpg4/bin/sh.  Also, accommodate --enable-indirect-deps.
	* check/check-requires-private: be more careful before invoking
	/usr/xpg4/bin/sh.  Adapt to behavior change in Debian #340904.
	Also, accommodate --enable-indirect-deps.
-------------- next part --------------
diff -urN origsrc/pkg-config-0.21/check/check-cflags src/pkg-config-0.21/check/check-cflags
--- origsrc/pkg-config-0.21/check/check-cflags	2006-08-16 13:05:30.000000000 -0400
+++ src/pkg-config-0.21/check/check-cflags	2006-11-11 01:16:36.328125000 -0500
@@ -1,8 +1,12 @@
 #! /bin/sh
 
-# Do the Solaris Dance:
+# Do the Solaris Dance but Two-Step for Cygwin
 if [ ! -d ~root ]  ; then
-    exec /usr/xpg4/bin/sh $0 "$@" 
+    KERNEL_NAME=`uname -s`
+    case "$KERNEL_NAME" in
+      *[Cc][Yy][Gg][Ww][Ii][Nn]* ) ;; # fall thru, don't re-exec
+      *) exec /usr/xpg4/bin/sh $0 "$@" ;;
+    esac
 fi
 
 set -e
diff -urN origsrc/pkg-config-0.21/check/check-define-variable src/pkg-config-0.21/check/check-define-variable
--- origsrc/pkg-config-0.21/check/check-define-variable	2006-08-16 13:05:30.000000000 -0400
+++ src/pkg-config-0.21/check/check-define-variable	2006-11-11 01:16:36.328125000 -0500
@@ -1,8 +1,12 @@
 #! /bin/sh
 
-# Do the Solaris Dance:
+# Do the Solaris Dance but Two-Step for Cygwin
 if [ ! -d ~root ]  ; then
-    exec /usr/xpg4/bin/sh $0 "$@" 
+    KERNEL_NAME=`uname -s`
+    case "$KERNEL_NAME" in
+      *[Cc][Yy][Gg][Ww][Ii][Nn]* ) ;; # fall thru, don't re-exec
+      *) exec /usr/xpg4/bin/sh $0 "$@" ;;
+    esac
 fi
 
 set -e
diff -urN origsrc/pkg-config-0.21/check/check-includedir src/pkg-config-0.21/check/check-includedir
--- origsrc/pkg-config-0.21/check/check-includedir	2006-08-16 13:05:30.000000000 -0400
+++ src/pkg-config-0.21/check/check-includedir	2006-11-11 01:16:36.343750000 -0500
@@ -1,8 +1,12 @@
 #! /bin/sh
 
-# Do the Solaris Dance:
+# Do the Solaris Dance but Two-Step for Cygwin
 if [ ! -d ~root ]  ; then
-    exec /usr/xpg4/bin/sh $0 "$@"
+    KERNEL_NAME=`uname -s`
+    case "$KERNEL_NAME" in
+      *[Cc][Yy][Gg][Ww][Ii][Nn]* ) ;; # fall thru, don't re-exec
+      *) exec /usr/xpg4/bin/sh $0 "$@" ;;
+    esac
 fi
 
 set -e
diff -urN origsrc/pkg-config-0.21/check/check-libs src/pkg-config-0.21/check/check-libs
--- origsrc/pkg-config-0.21/check/check-libs	2006-08-16 13:05:30.000000000 -0400
+++ src/pkg-config-0.21/check/check-libs	2006-11-11 01:16:36.359375000 -0500
@@ -1,8 +1,12 @@
 #! /bin/sh
 
-# Do the Solaris Dance:
+# Do the Solaris Dance but Two-Step for Cygwin
 if [ ! -d ~root ]  ; then
-    exec /usr/xpg4/bin/sh $0 "$@" 
+    KERNEL_NAME=`uname -s`
+    case "$KERNEL_NAME" in
+      *[Cc][Yy][Gg][Ww][Ii][Nn]* ) ;; # fall thru, don't re-exec
+      *) exec /usr/xpg4/bin/sh $0 "$@" ;;
+    esac
 fi
 
 set -e
@@ -10,6 +14,10 @@
 . ${srcdir}/common
 
 ARGS="--libs simple"
-RESULT="-lsimple"
+if [ x$indirect_deps = xyes ] ; then
+  RESULT="-lsimple -lm"
+else
+  RESULT="-lsimple"
+fi
 
 run_test
diff -urN origsrc/pkg-config-0.21/check/check-libs-private src/pkg-config-0.21/check/check-libs-private
--- origsrc/pkg-config-0.21/check/check-libs-private	2006-08-16 13:05:30.000000000 -0400
+++ src/pkg-config-0.21/check/check-libs-private	2006-11-11 01:16:36.359375000 -0500
@@ -1,8 +1,12 @@
 #! /bin/sh
 
-# Do the Solaris Dance:
+# Do the Solaris Dance but Two-Step for Cygwin
 if [ ! -d ~root ]  ; then
-    exec /usr/xpg4/bin/sh $0 "$@" 
+    KERNEL_NAME=`uname -s`
+    case "$KERNEL_NAME" in
+      *[Cc][Yy][Gg][Ww][Ii][Nn]* ) ;; # fall thru, don't re-exec
+      *) exec /usr/xpg4/bin/sh $0 "$@" ;;
+    esac
 fi
 
 set -e
diff -urN origsrc/pkg-config-0.21/check/check-requires-private src/pkg-config-0.21/check/check-requires-private
--- origsrc/pkg-config-0.21/check/check-requires-private	2006-08-16 13:05:30.000000000 -0400
+++ src/pkg-config-0.21/check/check-requires-private	2006-11-11 01:16:36.375000000 -0500
@@ -1,8 +1,12 @@
 #! /bin/sh
 
-# Do the Solaris Dance:
+# Do the Solaris Dance but Two-Step for Cygwin
 if [ ! -d ~root ]  ; then
-    exec /usr/xpg4/bin/sh $0 "$@" 
+    KERNEL_NAME=`uname -s`
+    case "$KERNEL_NAME" in
+      *[Cc][Yy][Gg][Ww][Ii][Nn]* ) ;; # fall thru, don't re-exec
+      *) exec /usr/xpg4/bin/sh $0 "$@" ;;
+    esac
 fi
 
 set -e
@@ -11,17 +15,21 @@
 
 # expect cflags from requires-test and public-dep
 ARGS="--cflags requires-test"
-RESULT="-I/requires-test/include -I/public-dep/include"
+RESULT="-I/requires-test/include -I/private-dep/include -I/public-dep/include"
 run_test
 
 # still expect those cflags for static linking case
 ARGS="--static --cflags requires-test"
-RESULT="-I/requires-test/include -I/public-dep/include"
+RESULT="-I/requires-test/include -I/private-dep/include -I/public-dep/include"
 run_test
 
 # expect libs for just requires-test and public-dep
 ARGS="--libs requires-test"
-RESULT="-L/requires-test/lib -L/public-dep/lib -lrequires-test -lpublic-dep"
+if [ x$indirect_deps = xyes ] ; then
+  RESULT="-L/requires-test/lib -L/private-dep/lib -L/public-dep/lib -lrequires-test -lprivate-dep -lpublic-dep"
+else
+  RESULT="-L/requires-test/lib -L/public-dep/lib -lrequires-test -lpublic-dep"
+fi
 run_test
 
 # expect libs for requires-test, public-dep and private-dep in static case
diff -urN origsrc/pkg-config-0.21/check/common src/pkg-config-0.21/check/common
--- origsrc/pkg-config-0.21/check/common	2006-08-16 13:05:30.000000000 -0400
+++ src/pkg-config-0.21/check/common	2006-11-11 01:45:44.015625000 -0500
@@ -9,6 +9,20 @@
 PKG_CONFIG_PATH=$srcdir
 export PKG_CONFIG_PATH
 
+indirect_deps=`grep -m 1 ENABLE_INDIRECT_DEPS ../config.h`
+case "${indirect_deps}" in
+    \#define* )
+        indirect_deps_val=`echo "${indirect_deps}" | sed -e 's,#define,,' -e 's,ENABLE_INDIRECT_DEPS,,' -e 's/ *//g'`
+        if expr $indirect_deps_val != 0 >/dev/null ; then
+            indirect_deps=yes
+        else
+            indirect_deps=no
+        fi
+        ;;
+    /\*\ \#undef* ) indirect_deps=no ;;
+    * )             indirect_deps=unknown ;;
+esac
+
 run_test () {
     ${pkgconfig} $ARGS >/dev/null 2>&1
     if [ "$?" -ne "0" ]; then


More information about the pkg-config mailing list