From: Guillem Jover Date: Mon, 4 Feb 2008 06:07:40 +0000 (+0200) Subject: Use functions from libcompat when those are not provided by the system X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0325f1a3158f829c784f4e4aaa279550c2e361c;p=dpkg Use functions from libcompat when those are not provided by the system --- diff --git a/ChangeLog b/ChangeLog index 00028ce7..5a7fb98f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2008-02-03 Guillem Jover + + * 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 * libcompat/Makefile.am (libcompat_a_SOURCES): Remove closeout.c, diff --git a/configure.ac b/configure.ac index a32ebf40..5bd0ea33 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 ae313fb6..7c58f22d 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 6574dc87..d433cb42 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 ff6c34b4..7d85d15c 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 241124cb..e433dfc3 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 184b9c9c..9a99004c 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 f7893cca..f17b3931 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 f9dafee2..658a41c4 100644 --- a/m4/funcs.m4 +++ b/m4/funcs.m4 @@ -1,3 +1,5 @@ +# Copyright © 2008 Guillem Jover + # 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 78adf862..80e61e76 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 2f5fb35b..cd1e4f1f 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