The following commit has been merged in the master branch:
commit f0325f1a3158f829c784f4e4aaa279550c2e361c
Author: Guillem Jover <[EMAIL PROTECTED]>
Date: Mon Feb 4 08:07:40 2008 +0200
Use functions from libcompat when those are not provided by the system
diff --git a/ChangeLog b/ChangeLog
index 00028ce..5a7fb98 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
2008-02-03 Guillem Jover <[EMAIL PROTECTED]>
+ * 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 <[EMAIL PROTECTED]>
+
* libcompat/Makefile.am (libcompat_a_SOURCES): Remove closeout.c,
closeout.h, error.h, long-options.c and long-options.h.
* libcompat/closeout.c: Remove unused file.
diff --git a/configure.ac b/configure.ac
index a32ebf4..5bd0ea3 100644
--- a/configure.ac
+++ b/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])
diff --git a/debian/changelog b/debian/changelog
index ae313fb..7c58f22 100644
--- a/debian/changelog
+++ b/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
diff --git a/dpkg-deb/Makefile.am b/dpkg-deb/Makefile.am
index 6574dc8..d433cb4 100644
--- a/dpkg-deb/Makefile.am
+++ b/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)
diff --git a/dpkg-split/Makefile.am b/dpkg-split/Makefile.am
index ff6c34b..7d85d15 100644
--- a/dpkg-split/Makefile.am
+++ b/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
diff --git a/dselect/Makefile.am b/dselect/Makefile.am
index 241124c..e433dfc 100644
--- a/dselect/Makefile.am
+++ b/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
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 184b9c9..9a99004 100644
--- a/lib/Makefile.am
+++ b/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
diff --git a/libcompat/Makefile.am b/libcompat/Makefile.am
index f7893cc..f17b393 100644
--- a/libcompat/Makefile.am
+++ b/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
+
diff --git a/m4/funcs.m4 b/m4/funcs.m4
index f9dafee..658a41c 100644
--- a/m4/funcs.m4
+++ b/m4/funcs.m4
@@ -1,3 +1,5 @@
+# Copyright © 2008 Guillem Jover <[EMAIL PROTECTED]>
+
# 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
diff --git a/src/Makefile.am b/src/Makefile.am
index 78adf86..80e61e7 100644
--- a/src/Makefile.am
+++ b/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
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 2f5fb35..cd1e4f1 100644
--- a/utils/Makefile.am
+++ b/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
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]