aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/Makefile.in
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2024-03-14 13:39:18 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2024-03-14 13:40:08 -0400
commitda48217f315084097ef25226c0acab3bbd55ebd3 (patch)
tree22b9b0342f9b0923ec951b9cd9a238579c95e93c /gdbserver/Makefile.in
parent91e15dbaf9d05747fab0d33e5af7ae69c983398a (diff)
downloadbinutils-da48217f315084097ef25226c0acab3bbd55ebd3.zip
binutils-da48217f315084097ef25226c0acab3bbd55ebd3.tar.gz
binutils-da48217f315084097ef25226c0acab3bbd55ebd3.tar.bz2
gdbserver/linux: probe for libiconv in configure
Make gdbserver's build system locate libiconv when building for Linux. Commit 07b3255c3bae ("Filter invalid encodings from Linux thread names") make libiconv madantory for building gdbserver on Linux. While trying to cross-compile gdb for xtensa-fsf-linux-uclibc (with a toolchain generated with crosstool-ng), I got: /home/smarchi/src/binutils-gdb/gdbserver/linux-low.cc:48:10: fatal error: iconv.h: No such file or directory 48 | #include <iconv.h> | ^~~~~~~~~ I downloaded GNU libiconv, built it for that host, and installed it in an arbitrary directory. I had to modify the gdbserver build system to locate libiconv and use it, the result is this patch. I eventually found that crosstool-ng has a config option to make uclibc provide an implementation of iconv, which is of course much easier. But given that this patch is now written, I think it would be worth merging it, it could help some people who do not have iconv built-in their libc in the future (and may not have the luxury of rebuilding their libc like I do). Using AM_ICONV in configure.ac adds these options for configure (the same we have for gdb): --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib --without-libiconv-prefix don't search for libiconv in includedir and libdir --with-libiconv-type=TYPE type of library to search for (auto/static/shared) It sets the `LIBICONV` variable with whatever is needed to link with libiconv, and adds the necessary `-I` flag to `CPPFLAGS`. To avoid unnecessarily linking against libiconv on hosts that don't need it, set `MAYBE_LIBICONV` with the contents of `LIBICONV` only if the host is Linux, and use `MAYBE_LIBICONV` in `Makefile.in`. Since libiconv is a hard requirement for Linux hosts, error out if it is not found. The bits in acinclude.m4 are similar to what we have in gdb/acinclude.m4. Update the top-level build system to support building against an in-tree libiconv (I did not test this part though). Something tells me that the all-gdbserver dependency on all-libiconv is unnecessary, since there is already a dependency of configure-gdbserver on all-libiconv (and all-gdbserver surely depends on configure-gdbserver). I just copied what's done for GDB though. ChangeLog: * Makefile.def: Add configure-gdbserver and all-gdbserver dependencies on all-libiconv. * Makefile.in: Re-generate. Change-Id: I90f8ef88dd4917df5a68b45550d93622fc9cfed4 Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdbserver/Makefile.in')
-rw-r--r--gdbserver/Makefile.in4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
index d12f874..c712089 100644
--- a/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
@@ -152,6 +152,8 @@ PTHREAD_LIBS = @PTHREAD_LIBS@
WIN32APILIBS = @WIN32APILIBS@
+MAYBE_LIBICONV = @MAYBE_LIBICONV@
+
# INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros.
INTERNAL_CFLAGS_BASE = ${GLOBAL_CFLAGS} \
${PROFILE_CFLAGS} ${INCLUDE_CFLAGS} ${CPPFLAGS} $(PTHREAD_CFLAGS)
@@ -354,7 +356,7 @@ gdbserver$(EXEEXT): $(sort $(OBS)) ${CDEPS} $(LIBGNU) $(LIBIBERTY) \
$(CXXFLAGS) \
-o gdbserver$(EXEEXT) $(OBS) $(GDBSUPPORT) $(LIBGNU) \
$(LIBGNU_EXTRA_LIBS) $(LIBIBERTY) $(INTL) \
- $(GDBSERVER_LIBS) $(XM_CLIBS) $(WIN32APILIBS)
+ $(GDBSERVER_LIBS) $(XM_CLIBS) $(WIN32APILIBS) $(MAYBE_LIBICONV)
gdbreplay$(EXEEXT): $(sort $(GDBREPLAY_OBS)) $(LIBGNU) $(LIBIBERTY) \
$(INTL_DEPS) $(GDBSUPPORT)