]> err.no Git - dpkg/commitdiff
Use functions from libcompat when those are not provided by the system
authorGuillem Jover <guillem@debian.org>
Mon, 4 Feb 2008 06:07:40 +0000 (08:07 +0200)
committerGuillem Jover <guillem@debian.org>
Mon, 4 Feb 2008 07:18:37 +0000 (09:18 +0200)
ChangeLog
configure.ac
debian/changelog
dpkg-deb/Makefile.am
dpkg-split/Makefile.am
dselect/Makefile.am
lib/Makefile.am
libcompat/Makefile.am
m4/funcs.m4
src/Makefile.am
utils/Makefile.am

index 00028ce7052943557d753410d06512f9faa4ce7f..5a7fb98f2e20b751cf328167113fbd14b5a0b897 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2008-02-03  Guillem Jover  <guillem@debian.org>
+
+       * m4/funcs.m4 (DPKG_CHECK_COMPAT_FUNCS): New macro.
+       * configure.ac (DPKG_CHECK_COMPAT_FUNCS): Check getopt, getopt_long
+       and obstack_free.
+       * libcompat/Makefile.am (libcompat_a_SOURCES): Set empty by default.
+       Only add 'getopt.c getopt.h' if !HAVE_GETOPT. Only add 'getopt1.c'
+       if !HAVE_GETOPT_LONG. Only add 'obstack.c obstack.h' if
+       !HAVE_OBSTACK_FREE.
+       (INCLUDES): Add '-idirafter $(top_srcdir)/libcompat'.
+       * dpkg-deb/Makefile.am (INCLUDES): Likewise.
+       * dpkg-split/Makefile.am (INCLUDES): Likewise.
+       * dselect/Makefile.am (INCLUDES): Likewise.
+       * lib/Makefile.am (INCLUDES): Likewise.
+       * src/Makefile.am (INCLUDES): Likewise.
+       * utils/Makefile.am (INCLUDES): Use -idirafter instead of -I for
+       '$(top_srcdir)/libcompat'.
+
+       * src/Makefile.am (dpkg_LDADD): Add '../libcompat/libcompat.a'.
+       (dpkg_query_LDADD): Likewise.
+       * dpkg-deb/Makefile.am (dpkg_deb_LDADD): Likewise.
+       * dpkg-split/Makefile.am (dpkg_split_LDADD): Likewise.
+       * dselect/Makefile.am (dselect_LDADD): Likewise.
+
 2008-02-03  Guillem Jover  <guillem@debian.org>
 
        * libcompat/Makefile.am (libcompat_a_SOURCES): Remove closeout.c,
index a32ebf409fbed2ced750f6e81405a4f5729b886e..5bd0ea330e4e9d197996567119f4cd6b8eab9e39 100644 (file)
@@ -92,6 +92,7 @@ DPKG_C_ATTRIBUTE
 
 # Checks for library functions.
 DPKG_FUNC_VA_COPY
+DPKG_CHECK_COMPAT_FUNCS([getopt getopt_long obstack_free])
 AC_CHECK_FUNCS([vsnprintf snprintf strtoul strerror strsignal alphasort \
                 isascii bcopy memcpy scandir unsetenv lchown setsid \
                 getdtablesize])
index ae313fb608c97502492e695ccc9ed9be5fbe827e..7c58f22dc071e200b7c8df9b31628e41a73361f1 100644 (file)
@@ -13,6 +13,7 @@ dpkg (1.14.17) UNRELEASED; urgency=low
     EXIT STATUS and EXAMPLE sections to man page. Thanks to Justin Pryzby.
   * Add Raphael Hertzog to Uploaders, and remove Brendan O'Dea and
     Christian Perrier with their permission.
+  * Use functions from libcompat when those are not provided by the system.
 
   [ Raphael Hertzog ]
   * Add a warning displayed by dpkg-genchanges if the current version is
index 6574dc877f2385f50d301533f880cfea748e8425..d433cb4268f21c24ce426ac739dbfa92240c5325 100644 (file)
@@ -3,6 +3,7 @@
 localedir = $(datadir)/locale
 INCLUDES = \
        -DLOCALEDIR=\"$(localedir)\" \
+       -idirafter $(top_srcdir)/libcompat \
        -I$(top_srcdir)/lib
 
 
@@ -16,4 +17,5 @@ dpkg_deb_SOURCES = \
        main.c
 
 dpkg_deb_LDADD = \
+       ../libcompat/libcompat.a \
        $(LIBINTL) ../lib/libdpkg.a $(ZLIB_LIBS) $(BZ2_LIBS) $(SELINUX_LIBS)
index ff6c34b42c008f37d670fe6c97317a04ca8756c5..7d85d15ce7d574ff3be5629657076ad6d8092fda 100644 (file)
@@ -4,6 +4,7 @@ localedir = $(datadir)/locale
 INCLUDES = \
        -DLOCALEDIR=\"$(localedir)\" \
        -DADMINDIR=\"$(admindir)\" -DMKSPLITSCRIPT=\"$(pkglibdir)/mksplit\" \
+       -idirafter $(top_srcdir)/libcompat \
        -I$(top_srcdir)/lib
 
 
@@ -17,7 +18,10 @@ dpkg_split_SOURCES = \
        queue.c \
        split.c
 
-dpkg_split_LDADD = $(LIBINTL) ../lib/libdpkg.a
+dpkg_split_LDADD = \
+       ../libcompat/libcompat.a \
+       $(LIBINTL) \
+       ../lib/libdpkg.a
 
 
 pkglib_SCRIPTS = mksplit
index 241124cb346dc8c1b32bf15607dc3de2fe399eb7..e433dfc345c98262046b3ff9de3e379bef47d5b2 100644 (file)
@@ -6,6 +6,7 @@ localedir = $(datadir)/locale
 INCLUDES = \
        -DLOCALEDIR=\"$(localedir)\" \
        -DADMINDIR=\"$(admindir)\" -DLIBDIR=\"$(pkglibdir)\" \
+       -idirafter $(top_srcdir)/libcompat \
        -I$(top_srcdir)/lib
 
 
@@ -33,7 +34,11 @@ dselect_SOURCES = \
        pkgsublist.cc \
        pkgtop.cc
 
-dselect_LDADD = $(LIBINTL) ../lib/libdpkg.a $(CURSES_LIBS)
+dselect_LDADD = \
+       ../libcompat/libcompat.a \
+       $(LIBINTL) \
+       $(CURSES_LIBS) \
+       ../lib/libdpkg.a
 
 
 EXTRA_DIST = keyoverride mkcurkeys.pl
index 184b9c9cb2360ff9e11bf97965d5c4188f8c1f32..9a99004c06756b53963163ae5a241cdfcf1ac044 100644 (file)
@@ -5,7 +5,8 @@ pkgconfdir = $(sysconfdir)/@PACKAGE@
 INCLUDES = \
        -DLOCALEDIR=\"$(localedir)\" \
        -DCONFIGDIR=\"$(pkgconfdir)\" \
-       -DCOPYINGFILE=\"$(datadir)/common-licenses/GPL-2\"
+       -DCOPYINGFILE=\"$(datadir)/common-licenses/GPL-2\" \
+       -idirafter $(top_srcdir)/libcompat
 
 
 noinst_LIBRARIES = libdpkg.a
index f7893ccaf80e993a7bda0d9b7cebb72b70004e77..f17b3931fd5dd78874421d39817b54427b78508f 100644 (file)
@@ -3,12 +3,23 @@
 localedir = $(datadir)/locale
 INCLUDES = \
        -DLOCALEDIR=\"$(localedir)\" \
-       -I$(top_srcdir)/lib
+       -I$(top_srcdir)/lib \
+       -idirafter $(top_srcdir)/libcompat
 
 
 noinst_LIBRARIES = libcompat.a
 
-libcompat_a_SOURCES = \
-       getopt.c getopt.h \
-       getopt1.c \
-       obstack.c obstack.h
+libcompat_a_SOURCES =
+
+if !HAVE_GETOPT
+libcompat_a_SOURCES += getopt.c getopt.h
+endif
+
+if !HAVE_GETOPT_LONG
+libcompat_a_SOURCES += getopt1.c
+endif
+
+if !HAVE_OBSTACK_FREE
+libcompat_a_SOURCES += obstack.c obstack.h
+endif
+
index f9dafee2ca8b2c2f08ee884a9a51170f37453e8a..658a41c461ed497701f67489da0ece04b265eed4 100644 (file)
@@ -1,3 +1,5 @@
+# Copyright © 2008 Guillem Jover <guillem@debian.org>
+
 # DPKG_FUNC_VA_COPY
 # -----------------
 # Define HAVE_VA_COPY if we have va_copy, fail if they can't be assigned
@@ -26,3 +28,15 @@ v1 = v2;
                       [dpkg_cv_va_list_copy=yes],
                       [dpkg_cv_va_list_copy=no])])])
 ])# DPKG_FUNC_VA_COPY
+
+# DPKG_CHECK_COMPAT_FUNCS(LIST)
+# -----------------------
+# Check each function and define an automake conditional
+AC_DEFUN([DPKG_CHECK_COMPAT_FUNCS],
+[
+  AC_CHECK_FUNCS([$1])
+  m4_foreach_w([ac_func], [$1], [
+    AM_CONDITIONAL(HAVE_[]AS_TR_CPP(ac_func),
+                   [test "x$ac_cv_func_[]AS_TR_SH(ac_func)" = "xyes"])
+  ])
+]) # DPKG_CHECK_COMPAT_FUNCS
index 78adf862153fb809caeaf30b49313e34f27a8570..80e61e76ba869323b1916841c13c7c945df466b8 100644 (file)
@@ -4,6 +4,7 @@ localedir = $(datadir)/locale
 INCLUDES = \
        -DLOCALEDIR=\"$(localedir)\" \
        -DADMINDIR=\"$(admindir)\" \
+       -idirafter $(top_srcdir)/libcompat \
        -I$(top_srcdir)/lib
 
 
@@ -26,6 +27,7 @@ dpkg_SOURCES = \
        update.c
 
 dpkg_LDADD = \
+       ../libcompat/libcompat.a \
        $(LIBINTL) ../lib/libdpkg.a $(ZLIB_LIBS) $(BZ2_LIBS) $(SELINUX_LIBS)
 
 dpkg_query_SOURCES = \
@@ -33,8 +35,10 @@ dpkg_query_SOURCES = \
        filesdb.c filesdb.h \
        query.c
 
-dpkg_query_LDADD = $(LIBINTL) ../lib/libdpkg.a
-
+dpkg_query_LDADD = \
+       ../libcompat/libcompat.a \
+       $(LIBINTL) \
+       ../lib/libdpkg.a
 
 install-data-local:
        $(mkdir_p) $(DESTDIR)$(admindir)/alternatives
index 2f5fb35b51ce0e10211eee9fd5ba24e6c9b65989..cd1e4f1f2f3056093e7f310f0eef7f49311b2b47 100644 (file)
@@ -3,7 +3,7 @@
 localedir = $(datadir)/locale
 INCLUDES = \
        -DLOCALEDIR=\"$(localedir)\" \
-       -I$(top_srcdir)/libcompat \
+       -idirafter $(top_srcdir)/libcompat \
        -I$(top_srcdir)/lib