File lib3ds-pkgconfig.patch of Package lib3ds

Index: lib3ds-1.3.0/lib3ds-config.in
===================================================================
--- lib3ds-1.3.0.orig/lib3ds-config.in
+++ lib3ds-1.3.0/lib3ds-config.in
@@ -1,9 +1,5 @@
 #!/bin/sh
 
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-exec_prefix_set=no
-
 usage()
 {
     cat <<EOF
@@ -22,6 +18,8 @@ if test $# -eq 0; then
 	usage 1 1>&2
 fi
 
+PKG_CONFIG_ARGS=
+
 while test $# -gt 0; do
   case "$1" in
   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
@@ -30,23 +28,23 @@ while test $# -gt 0; do
 
   case $1 in
     --prefix=*)
-      prefix=$optarg
+      PKG_CONFIG_ARGS="$PKG_CONFIG_ARGS --define-variable=prefix=$optarg"
       if test $exec_prefix_set = no ; then
-        exec_prefix=$optarg
+        PKG_CONFIG_ARGS="$PKG_CONFIG_ARGS --define-variable=exec_prefix=$optarg"
       fi
       ;;
     --prefix)
       echo_prefix=yes
       ;;
     --exec-prefix=*)
-      exec_prefix=$optarg
+      PKG_CONFIG_ARGS="$PKG_CONFIG_ARGS --define-variable=exec_prefix=$optarg"
       exec_prefix_set=yes
       ;;
     --exec-prefix)
       echo_exec_prefix=yes
       ;;
     --version)
-      echo @LIB3DS_VERSION@
+      pkg-config --modversion lib3ds
       ;;
     --cflags)
       echo_cflags=yes
@@ -62,23 +60,18 @@ while test $# -gt 0; do
 done
 
 if test "$echo_prefix" = "yes"; then
-	echo $prefix
+  pkg-config $PKG_CONFIG_ARGS --variable=prefix lib3ds
 fi
 
 if test "$echo_exec_prefix" = "yes"; then
-	echo $exec_prefix
+  pkg-config $PKG_CONFIG_ARGS --variable=exec_prefix lib3ds
 fi
 
 if test "$echo_cflags" = "yes"; then
-      if test @includedir@ != /usr/include ; then
-            echo -I@includedir@
-      fi
+  pkg-config $PKG_CONFIG_ARGS --cflags lib3ds
 fi
 
 if test "$echo_libs" = "yes"; then
-      if test @libdir@ != /usr/lib ; then
-            my_linker_flags="-L@libdir@"
-      fi
-      echo ${my_linker_flags} -l3ds
-fi      
+  pkg-config $PKG_CONFIG_ARGS --libs lib3ds
+fi
 
Index: lib3ds-1.3.0/lib3ds.pc.in
===================================================================
--- /dev/null
+++ lib3ds-1.3.0/lib3ds.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: lib3ds
+Description: lib3ds
+Version: @VERSION@
+Requires:
+Libs: -L${libdir} -l3ds -lm
+Cflags: -I${includedir}
Index: lib3ds-1.3.0/Makefile.am
===================================================================
--- lib3ds-1.3.0.orig/Makefile.am
+++ lib3ds-1.3.0/Makefile.am
@@ -35,6 +35,7 @@ man_MANS = \
 EXTRA_DIST = \
   lib3ds.m4 \
   lib3ds-config.1 \
+  lib3ds.pc \
   AUTHORS \
   COPYING \
   ChangeLog \
Index: lib3ds-1.3.0/configure.in
===================================================================
--- lib3ds-1.3.0.orig/configure.in
+++ lib3ds-1.3.0/configure.in
@@ -16,6 +16,8 @@ AM_INIT_AUTOMAKE(lib3ds, $LIB3DS_VERSION
 AC_PROG_CC
 AC_PROG_LIBTOOL
 
+AC_CONFIG_FILES([lib3ds.pc])
+
 AC_MSG_CHECKING([for debugging mode])
 AC_ARG_ENABLE(debug-mode,   
   [  --enable-debug-mode     enable debugging mode],
openSUSE Build Service is sponsored by