Explorar el Código

Use functions from libcompat when those are not provided by the system

Guillem Jover hace 18 años
padre
commit
f0325f1a31
Se han modificado 11 ficheros con 78 adiciones y 11 borrados
  1. 24 0
      ChangeLog
  2. 1 0
      configure.ac
  3. 1 0
      debian/changelog
  4. 2 0
      dpkg-deb/Makefile.am
  5. 5 1
      dpkg-split/Makefile.am
  6. 6 1
      dselect/Makefile.am
  7. 2 1
      lib/Makefile.am
  8. 16 5
      libcompat/Makefile.am
  9. 14 0
      m4/funcs.m4
  10. 6 2
      src/Makefile.am
  11. 1 1
      utils/Makefile.am

+ 24 - 0
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,

+ 1 - 0
configure.ac

@@ -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])

+ 1 - 0
debian/changelog

@@ -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

+ 2 - 0
dpkg-deb/Makefile.am

@@ -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)

+ 5 - 1
dpkg-split/Makefile.am

@@ -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

+ 6 - 1
dselect/Makefile.am

@@ -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

+ 2 - 1
lib/Makefile.am

@@ -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

+ 16 - 5
libcompat/Makefile.am

@@ -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
+

+ 14 - 0
m4/funcs.m4

@@ -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

+ 6 - 2
src/Makefile.am

@@ -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

+ 1 - 1
utils/Makefile.am

@@ -3,7 +3,7 @@
 localedir = $(datadir)/locale
 INCLUDES = \
 	-DLOCALEDIR=\"$(localedir)\" \
-	-I$(top_srcdir)/libcompat \
+	-idirafter $(top_srcdir)/libcompat \
 	-I$(top_srcdir)/lib