summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/Makefile.in9
-rw-r--r--gdb/config.in9
-rwxr-xr-xgdb/configure87
-rw-r--r--gdb/configure.ac54
5 files changed, 94 insertions, 74 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 00b0f069fd..d7bf88b665 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2012-01-18 Doug Evans <dje@google.com>
+
+ * Makefile.in (TARGET_SYSTEM_ROOT, TARGET_SYSTEM_ROOT_DEFINE): Delete.
+ (main.o): Remove rule.
+ * configure.ac (BINDIR): Define with AC_DEFINE_DIR.
+ (--with-sysroot): Rewrite.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+
2012-01-18 Sergio Durigan Junior <sergiodj@redhat.com>
* parse.c (initialize_expout): New function.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 25067f136d..38c93c9fcd 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -166,10 +166,6 @@ INTL = @LIBINTL@
INTL_DEPS = @LIBINTL_DEP@
INTL_CFLAGS = @INCINTL@
-# Did the user give us a --with-sysroot option?
-TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
-TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
-
# Did the user give us a --with-gdb-datadir option?
GDB_DATADIR = @GDB_DATADIR@
@@ -1518,11 +1514,6 @@ ALLDEPFILES = \
# Some files need explicit build rules (due to -Werror problems) or due
# to sub-directory fun 'n' games.
-# main.o needs an explicit build rule to get TARGET_SYSTEM_ROOT and BINDIR.
-main.o: $(srcdir)/main.c
- $(COMPILE) $(TARGET_SYSTEM_ROOT_DEFINE) -DBINDIR=\"$(bindir)\" $(srcdir)/main.c
- $(POSTCOMPILE)
-
# FIXME: cagney/2003-08-10: "monitor.c" gets -Wformat-nonliteral
# errors. It turns out that that is the least of monitor.c's
# problems. The function print_vsprintf appears to be using
diff --git a/gdb/config.in b/gdb/config.in
index 4aff10db69..f1e6b9aed2 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -7,6 +7,9 @@
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
+/* Directory of programs. */
+#undef BINDIR
+
/* Define to the number of bits in type 'ptrdiff_t'. */
#undef BITSIZEOF_PTRDIFF_T
@@ -854,6 +857,12 @@
moved. */
#undef SYSTEM_GDBINIT_RELOCATABLE
+/* search for usr/lib et al within DIR */
+#undef TARGET_SYSTEM_ROOT
+
+/* Define if the sysroot directory should be relocated when GDB is moved. */
+#undef TARGET_SYSTEM_ROOT_RELOCATABLE
+
/* Define if <thread_db.h> has the TD_NOTALLOC error code. */
#undef THREAD_DB_HAS_TD_NOTALLOC
diff --git a/gdb/configure b/gdb/configure
index 048f26620c..5b2a6dd1e1 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -654,7 +654,6 @@ SER_HARDWIRE
WERROR_CFLAGS
WARN_CFLAGS
SYSTEM_GDBINIT
-TARGET_SYSTEM_ROOT_DEFINE
TARGET_SYSTEM_ROOT
CONFIG_LDFLAGS
RDYNAMIC
@@ -7900,6 +7899,24 @@ _ACEOF
+# We can't pass paths as command line arguments.
+# Mingw32 tries to be clever and will convert the paths for us.
+# For example -DBINDIR="/usr/local/bin" passed on the command line may get
+# converted to -DBINDIR="E:/msys/mingw32/msys/1.0/local/bin".
+# This breaks GDB's relocatable path conversions since paths passed in
+# config.h would not get so translated, the path prefixes no longer match.
+
+ test "x$prefix" = xNONE && prefix="$ac_default_prefix"
+ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+ ac_define_dir=`eval echo $bindir`
+ ac_define_dir=`eval echo $ac_define_dir`
+
+cat >>confdefs.h <<_ACEOF
+#define BINDIR "$ac_define_dir"
+_ACEOF
+
+
+
# GDB's datadir relocation
@@ -15043,45 +15060,53 @@ $as_echo "#define HAVE_PERSONALITY 1" >>confdefs.h
fi
-target_sysroot_reloc=0
+# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
+# except that the argument to --with-sysroot is optional.
+# --with-sysroot (or --with-sysroot=yes) sets the default sysroot path.
+if test "x$with_sysroot" = xyes; then
+ with_sysroot="${exec_prefix}/${target_alias}/sys-root"
+fi
# Check whether --with-sysroot was given.
if test "${with_sysroot+set}" = set; then :
- withval=$with_sysroot;
- case ${with_sysroot} in
- yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;;
- *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
- esac
+ withval=$with_sysroot; TARGET_SYSTEM_ROOT=$withval
+else
+ TARGET_SYSTEM_ROOT=
+fi
- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
- if test "x$prefix" = xNONE; then
- test_prefix=/usr/local
- else
- test_prefix=$prefix
- fi
- if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
- test_exec_prefix=$test_prefix
- else
- test_exec_prefix=$exec_prefix
- fi
- case ${TARGET_SYSTEM_ROOT} in
- "${test_prefix}"|"${test_prefix}/"*|\
- "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
- '${prefix}'|'${prefix}/'*|\
- '${exec_prefix}'|'${exec_prefix}/'*)
- target_sysroot_reloc=1
- ;;
- esac
+ test "x$prefix" = xNONE && prefix="$ac_default_prefix"
+ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+ ac_define_dir=`eval echo $TARGET_SYSTEM_ROOT`
+ ac_define_dir=`eval echo $ac_define_dir`
-else
+cat >>confdefs.h <<_ACEOF
+#define TARGET_SYSTEM_ROOT "$ac_define_dir"
+_ACEOF
- TARGET_SYSTEM_ROOT=
- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"\"'
-fi
-TARGET_SYSTEM_ROOT_DEFINE="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE=$target_sysroot_reloc"
+
+ if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
+ if test "x$prefix" = xNONE; then
+ test_prefix=/usr/local
+ else
+ test_prefix=$prefix
+ fi
+ else
+ test_prefix=$exec_prefix
+ fi
+ value=0
+ case ${ac_define_dir} in
+ "${test_prefix}"|"${test_prefix}/"*|\
+ '${exec_prefix}'|'${exec_prefix}/'*)
+ value=1
+ ;;
+ esac
+
+cat >>confdefs.h <<_ACEOF
+#define TARGET_SYSTEM_ROOT_RELOCATABLE $value
+_ACEOF
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 7db7675e23..652c0c601a 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -125,6 +125,14 @@ GDB_AC_WITH_DIR(DEBUGDIR, separate-debug-dir,
[look for global separate debug info in this path @<:@LIBDIR/debug@:>@],
[${libdir}/debug])
+# We can't pass paths as command line arguments.
+# Mingw32 tries to be clever and will convert the paths for us.
+# For example -DBINDIR="/usr/local/bin" passed on the command line may get
+# converted to -DBINDIR="E:/msys/mingw32/msys/1.0/local/bin".
+# This breaks GDB's relocatable path conversions since paths passed in
+# config.h would not get so translated, the path prefixes no longer match.
+AC_DEFINE_DIR(BINDIR, bindir, [Directory of programs.])
+
# GDB's datadir relocation
GDB_AC_WITH_DIR(GDB_DATADIR, gdb-datadir,
@@ -1753,42 +1761,20 @@ fi
dnl Handle optional features that can be enabled.
-target_sysroot_reloc=0
+# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
+# except that the argument to --with-sysroot is optional.
+# --with-sysroot (or --with-sysroot=yes) sets the default sysroot path.
+if test "x$with_sysroot" = xyes; then
+ with_sysroot="${exec_prefix}/${target_alias}/sys-root"
+fi
AC_ARG_WITH(sysroot,
-AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [search for usr/lib et al within DIR]),
-[
- case ${with_sysroot} in
- yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;;
- *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
- esac
-
- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
-
- if test "x$prefix" = xNONE; then
- test_prefix=/usr/local
- else
- test_prefix=$prefix
- fi
- if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
- test_exec_prefix=$test_prefix
- else
- test_exec_prefix=$exec_prefix
- fi
- case ${TARGET_SYSTEM_ROOT} in
- "${test_prefix}"|"${test_prefix}/"*|\
- "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
- '${prefix}'|'${prefix}/'*|\
- '${exec_prefix}'|'${exec_prefix}/'*)
- target_sysroot_reloc=1
- ;;
- esac
-], [
- TARGET_SYSTEM_ROOT=
- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"\"'
-])
-TARGET_SYSTEM_ROOT_DEFINE="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE=$target_sysroot_reloc"
+ AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@],
+ [search for usr/lib et al within DIR]),
+ [TARGET_SYSTEM_ROOT=$withval], [TARGET_SYSTEM_ROOT=])
+AC_DEFINE_DIR(TARGET_SYSTEM_ROOT, TARGET_SYSTEM_ROOT,
+ [search for usr/lib et al within DIR])
AC_SUBST(TARGET_SYSTEM_ROOT)
-AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+GDB_AC_DEFINE_RELOCATABLE(TARGET_SYSTEM_ROOT, sysroot, ${ac_define_dir})
GDB_AC_WITH_DIR(SYSTEM_GDBINIT, system-gdbinit,
[automatically load a system-wide gdbinit file],
OpenPOWER on IntegriCloud