elfutils: produce correct libelf.pc file when building with full nls
[openwrt/openwrt.git] / package / libs / elfutils / patches / 003-libintl-compatibility.patch
diff --git a/package/libs/elfutils/patches/003-libintl-compatibility.patch b/package/libs/elfutils/patches/003-libintl-compatibility.patch
new file mode 100644 (file)
index 0000000..35a2711
--- /dev/null
@@ -0,0 +1,72 @@
+--- a/libelf/libelfP.h
++++ b/libelf/libelfP.h
+@@ -39,6 +39,9 @@
+ #include <stdio.h>
+ #include <string.h>
++#ifdef _ /* fix libintl-stub */
++#undef _
++#endif
+ /* gettext helper macros.  */
+ #define _(Str) dgettext ("elfutils", Str)
+--- a/libdw/libdwP.h
++++ b/libdw/libdwP.h
+@@ -35,7 +35,9 @@
+ #include <libdw.h>
+ #include <dwarf.h>
+-
++#ifdef _ /* fix libintl-stub */
++#undef _
++#endif
+ /* gettext helper macros.  */
+ #define _(Str) dgettext ("elfutils", Str)
+--- a/libdwfl/libdwflP.h
++++ b/libdwfl/libdwflP.h
+@@ -43,6 +43,9 @@
+ typedef struct Dwfl_Process Dwfl_Process;
++#ifdef _ /* fix libintl-stub */
++#undef _
++#endif
+ /* gettext helper macros.  */
+ #define _(Str) dgettext ("elfutils", Str)
+--- a/libasm/libasmP.h
++++ b/libasm/libasmP.h
+@@ -35,6 +35,9 @@
+ #include "libdwelf.h"
++#ifdef _ /* fix libintl-stub */
++#undef _
++#endif
+ /* gettext helper macros.  */
+ #define _(Str) dgettext ("elfutils", Str)
+--- a/config/libelf.pc.in
++++ b/config/libelf.pc.in
+@@ -8,7 +8,7 @@ Description: elfutils libelf library to
+ Version: @VERSION@
+ URL: http://elfutils.org/
+-Libs: -L${libdir} -lelf
++Libs: -L${libdir} -lelf @intl_LDFLAGS@
+ Cflags: -I${includedir}
+ Requires.private: zlib
+--- a/configure.ac
++++ b/configure.ac
+@@ -538,6 +538,9 @@ AC_CONFIG_FILES([config/libelf.pc config
+ AC_SUBST(USE_NLS, yes)
+ AM_PO_SUBDIRS
++case "$USE_NLS" in yes) intl_LDFLAGS="-lintl" ;; esac
++AC_SUBST([intl_LDFLAGS])
++
+ dnl Appended to the config.h file.
+ dnl We hide all kinds of configuration magic in lib/eu-config.h.
+ AH_BOTTOM([#include <eu-config.h>])