+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,
# 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])
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
localedir = $(datadir)/locale
INCLUDES = \
-DLOCALEDIR=\"$(localedir)\" \
+ -idirafter $(top_srcdir)/libcompat \
-I$(top_srcdir)/lib
main.c
dpkg_deb_LDADD = \
+ ../libcompat/libcompat.a \
$(LIBINTL) ../lib/libdpkg.a $(ZLIB_LIBS) $(BZ2_LIBS) $(SELINUX_LIBS)
INCLUDES = \
-DLOCALEDIR=\"$(localedir)\" \
-DADMINDIR=\"$(admindir)\" -DMKSPLITSCRIPT=\"$(pkglibdir)/mksplit\" \
+ -idirafter $(top_srcdir)/libcompat \
-I$(top_srcdir)/lib
queue.c \
split.c
-dpkg_split_LDADD = $(LIBINTL) ../lib/libdpkg.a
+dpkg_split_LDADD = \
+ ../libcompat/libcompat.a \
+ $(LIBINTL) \
+ ../lib/libdpkg.a
pkglib_SCRIPTS = mksplit
INCLUDES = \
-DLOCALEDIR=\"$(localedir)\" \
-DADMINDIR=\"$(admindir)\" -DLIBDIR=\"$(pkglibdir)\" \
+ -idirafter $(top_srcdir)/libcompat \
-I$(top_srcdir)/lib
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
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
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
+
+# 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
[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
INCLUDES = \
-DLOCALEDIR=\"$(localedir)\" \
-DADMINDIR=\"$(admindir)\" \
+ -idirafter $(top_srcdir)/libcompat \
-I$(top_srcdir)/lib
update.c
dpkg_LDADD = \
+ ../libcompat/libcompat.a \
$(LIBINTL) ../lib/libdpkg.a $(ZLIB_LIBS) $(BZ2_LIBS) $(SELINUX_LIBS)
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
localedir = $(datadir)/locale
INCLUDES = \
-DLOCALEDIR=\"$(localedir)\" \
- -I$(top_srcdir)/libcompat \
+ -idirafter $(top_srcdir)/libcompat \
-I$(top_srcdir)/lib