util-vserver-0.30.208
[util-vserver.git] / m4 / pkgconfig.am
diff --git a/m4/pkgconfig.am b/m4/pkgconfig.am
new file mode 100644 (file)
index 0000000..e17d2af
--- /dev/null
@@ -0,0 +1,55 @@
+## $Id: pkgconfig.am,v 1.1 2003/10/13 19:50:29 ensc Exp $      ---*- makefile -*---
+
+## Copyright (C) 2002 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+##  
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; version 2 of the License.
+##  
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##  
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+##  
+
+BAD_INC_PATHS          =  /usr/include|/usr/local/include
+BAD_LIB_PATHS          =  /usr/lib
+
+pkgconfdir              =  $(libdir)/pkgconfig
+pkgconf_DATA            =  $(addsuffix .pc, $(PKGCONFIG_FILES))
+
+CLEANFILES             += $(addsuffix .pc,       $(PKGCONFIG_FILES))
+EXTRA_DIST             += $(addsuffix .pc.subst, $(PKGCONFIG_FILES))
+
+
+%.pc:                  %.pc.subst Makefile
+                       rm -f $@
+                       @case '$(libdir)' in                                                    \
+                               $(BAD_LIB_PATHS))       libflags=;;                             \
+                               *)                      libflags='-L$${libdir} ';;              \
+                       esac;                                                                   \
+                       case '$(pkgincludedir)' in                                              \
+                               $(BAD_INC_PATHS))       pkgincflags=;;                          \
+                               *)                      pkgincflags='-I$${pkgincludedir} ';;    \
+                       esac;                                                                   \
+                       case '$(includedir)' in                                                 \
+                               $(BAD_INC_PATHS))       incflags=;;                             \
+                               *)                      incflags='-I$${includedir} ';;          \
+                       esac;                                                                   \
+                       sed -e 's!@'PACKAGE'@!$(PACKAGE)!g;                                     \
+                               s!@'VERSION'@!$(VERSION)!g;                                     \
+                               s!@'prefix'@!$(prefix)!g;                                       \
+                               s!@'exec_prefix'@!$(exec_prefix)!g;                             \
+                               s!@'libdir'@!$(libdir)!g;                                       \
+                               s!@'includedir'@!$(includedir)!g;                               \
+                               s!@'libflags"@!$${libflags}$(pkgconf_LIBFLAGS)!g;"'             \
+                               s!@'incflags"@!$${incflags}$(pkgconf_INCFLAGS)!g;"'             \
+                               s!@'pkgincflags"@!$${pkgincflags}$(pkgconf_PKGINCFLAGS)!g;"'    \
+                               s!@'pkgincludedir'@!$(pkgincludedir)!g'                         \
+                        $< >$@
+                       test -z "$(CHMOD_REFERENCE)" || $(CHMOD_REFERENCE) '$<' '$@'
+                       chmod a-w $@