From e637a4f593b43a9acde23545c162e708b52a342f Mon Sep 17 00:00:00 2001
From: Yao Qi <yao@codesourcery.com>
Date: Wed, 9 Mar 2011 06:10:40 +0000
Subject: [PATCH] gdb/ 2011-03-09  Yao Qi  <yao@codesourcery.com>

	Revert:
	2011-02-11  Yao Qi  <yao@codesourcery.com>

	* common/Makefile.in: Add copyright header.

	2011-02-11  Yao Qi  <yao@codesourcery.com>

	* Makefile.in: Remove signals.o from COMMON_OBS.  Link
	libcommon.a.
	* configure.ac: Add common to sub dir.
	* configure: Regenerate.

gdb/gdbserver/
2011-03-09  Yao Qi  <yao@codesourcery.com>

	Revert:
	2011-03-04  Yao Qi  <yao@codesourcery.com>

	* Makefile.in: Remove GNU make feature --directory.

	2011-03-05  Yao Qi  <yao@codesourcery.com>

	* Makefile.in (CLEANDIRS, REQUIRED_SUBDIRS): New variable.
	(subdir_do): New make target.  Copied from gdb/Makefile.
	(maintainer-clean, realclean, distclean, clean): Call corresponding
	make targets in common/Makefile.

	2011-02-11  Yao Qi  <yao@codesourcery.com>

	* configure.ac: Call AC_PROG_RANLIB.
	* Makefile.in: Remove signals.o from OBS.  Link libcommon.a.
	* configure: Regenerate.
---
 gdb/ChangeLog              | 14 ++++++
 gdb/Makefile.in            | 27 ++++++-----
 gdb/configure              |  3 --
 gdb/configure.ac           |  1 -
 gdb/gdbserver/ChangeLog    | 20 ++++++++
 gdb/gdbserver/Makefile.in  | 61 +++----------------------
 gdb/gdbserver/configure    | 93 --------------------------------------
 gdb/gdbserver/configure.ac |  1 -
 8 files changed, 53 insertions(+), 167 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a0e3885da33..0870bfc718d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+2011-03-09  Yao Qi  <yao@codesourcery.com>
+
+	Revert:
+	2011-02-11  Yao Qi  <yao@codesourcery.com>
+
+	* common/Makefile.in: Add copyright header.
+
+	2011-02-11  Yao Qi  <yao@codesourcery.com>
+
+	* Makefile.in: Remove signals.o from COMMON_OBS.  Link
+	libcommon.a.
+	* configure.ac: Add common to sub dir.
+	* configure: Regenerate.
+
 2011-03-08  Maxim Grigoriev  <maxim2405@gmail.com>
 
 	* xtensa-tdep.c (call0_ret): New function.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index db69d973c2b..489b1e9c5e3 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -88,8 +88,6 @@ DEPMODE = @CCDEPMODE@
 DEPDIR = @DEPDIR@
 depcomp = $(SHELL) $(srcdir)/../depcomp
 
-PWD_COMMAND = $${PWDCMD-pwd}
-
 # Note that these are overridden by GNU make-specific code below if
 # GNU make is used.  The overrides implement dependency tracking.
 COMPILE.pre = $(CC)
@@ -142,10 +140,6 @@ LIBDECNUMBER = $(LIBDECNUMBER_DIR)/libdecnumber.a
 LIBDECNUMBER_SRC = $(srcdir)/$(LIBDECNUMBER_DIR)
 LIBDECNUMBER_CFLAGS = -I$(LIBDECNUMBER_DIR) -I$(LIBDECNUMBER_SRC)
 
-LIBCOMMON_DIR = common
-LIBCOMMON = $(LIBCOMMON_DIR)/libcommon.a
-LIBCOMMON_SRC = $(srcdir)/$(LIBCOMMON_DIR)
-
 # Where is the READLINE library?  Typically in ../readline.
 READLINE_DIR = ../readline
 READLINE_SRC = $(srcdir)/$(READLINE_DIR)
@@ -473,10 +467,9 @@ INTERNAL_LDFLAGS = $(CFLAGS) $(GLOBAL_CFLAGS) $(MH_LDFLAGS) $(LDFLAGS) $(CONFIG_
 CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \
 	$(XM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ @PYTHON_LIBS@ \
 	$(LIBEXPAT) \
-	$(LIBIBERTY) $(WIN32LIBS) $(LIBGNU) $(LIBCOMMON)
+	$(LIBIBERTY) $(WIN32LIBS) $(LIBGNU)
 CDEPS = $(XM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) \
-	$(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) \
-        $(LIBCOMMON)
+	$(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU)
 
 ADD_FILES = $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES)
 ADD_DEPS = $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES)
@@ -861,6 +854,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
 	memattr.o mem-break.o target.o parse.o language.o buildsym.o \
 	findcmd.o \
 	std-regs.o \
+	signals.o \
 	exec.o reverse.o \
 	bcache.o objfiles.o observer.o minsyms.o maint.o demangle.o \
 	dbxread.o coffread.o coff-pe-read.o \
@@ -903,7 +897,7 @@ CLEANDIRS = $(SUBDIRS) gnulib
 # This is used to force build failures in existing trees when
 # a new directory is added.
 # The format here is for the `case' shell command.
-REQUIRED_SUBDIRS = doc | testsuite | gnulib | data-directory | common
+REQUIRED_SUBDIRS = doc | testsuite | gnulib | data-directory
 
 # For now, shortcut the "configure GDB for fewer languages" stuff.
 YYFILES = c-exp.c \
@@ -1170,10 +1164,6 @@ all-lib: gnulib/Makefile
 	@$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=gnulib subdir_do
 .PHONY: all-lib
 
-# 
-$(LIBCOMMON): $(LIBCOMMON_DIR)/Makefile
-	@$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=common subdir_do
-
 # Convenience rule to handle recursion.
 .PHONY: all-data-directory
 all-data-directory: data-directory/Makefile
@@ -1912,6 +1902,15 @@ mi-common.o: $(srcdir)/mi/mi-common.c
 	$(COMPILE) $(srcdir)/mi/mi-common.c
 	$(POSTCOMPILE)
 
+# gdb/common/ dependencies
+#
+# Need to explicitly specify the compile rule as make will do nothing
+# or try to compile the object file into the sub-directory.
+
+signals.o: $(srcdir)/common/signals.c
+	$(COMPILE) $(srcdir)/common/signals.c
+	$(POSTCOMPILE)
+
 #
 # gdb/tui/ dependencies
 #
diff --git a/gdb/configure b/gdb/configure
index adf4befc3bd..5ee5ce6db49 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -993,7 +993,6 @@ YACC
 YFLAGS
 XMKMF'
 ac_subdirs_all='testsuite
-common
 gdbtk
 multi-ice
 gdbserver'
@@ -7889,8 +7888,6 @@ fi
 
 subdirs="$subdirs testsuite"
 
-subdirs="$subdirs common"
-
 
 # Check whether to support alternative target configurations
 # Check whether --enable-targets was given.
diff --git a/gdb/configure.ac b/gdb/configure.ac
index f31ef2a30ec..d2b75f63752 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -109,7 +109,6 @@ AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this pat
 ])
 
 AC_CONFIG_SUBDIRS(testsuite)
-AC_CONFIG_SUBDIRS(common)
 
 # Check whether to support alternative target configurations
 AC_ARG_ENABLE(targets,
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 3c06909b708..237a4414b64 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,23 @@
+2011-03-09  Yao Qi  <yao@codesourcery.com>
+
+	Revert:
+	2011-03-04  Yao Qi  <yao@codesourcery.com>
+
+	* Makefile.in: Remove GNU make feature --directory.
+
+	2011-03-05  Yao Qi  <yao@codesourcery.com>
+
+	* Makefile.in (CLEANDIRS, REQUIRED_SUBDIRS): New variable.
+	(subdir_do): New make target.  Copied from gdb/Makefile.
+	(maintainer-clean, realclean, distclean, clean): Call corresponding
+	make targets in common/Makefile.
+
+	2011-02-11  Yao Qi  <yao@codesourcery.com>
+
+	* configure.ac: Call AC_PROG_RANLIB.
+	* Makefile.in: Remove signals.o from OBS.  Link libcommon.a.
+	* configure: Regenerate.
+
 2011-03-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	* remote-utils.c (putpkt_binary_1): Calculate BUF2 size dynamically.
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 81cf25a3763..c2da86788cc 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -45,8 +45,6 @@ includedir = @includedir@
 
 SHELL = /bin/sh
 EXEEXT = @EXEEXT@
-PWD_COMMAND = $${PWDCMD-pwd}
-RANLIB = @RANLIB@
 
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -132,17 +130,10 @@ DEPFILES = @GDBSERVER_DEPFILES@
 
 LIBOBJS = @LIBOBJS@
 
-LIBCOMMON_DIR = common
-LIBCOMMON = $(LIBCOMMON_DIR)/libcommon.a
-LIBCOMMON_SRC = $(srcdir)/$(LIBCOMMON_DIR)
-
-CLEANDIRS = $(LIBCOMMON_DIR)
-REQUIRED_SUBDIRS = no-required-subdir-yet
-
 SOURCES = $(SFILES)
 TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS}
 
-OBS = inferiors.o regcache.o remote-utils.o server.o target.o \
+OBS = inferiors.o regcache.o remote-utils.o server.o signals.o target.o \
 	utils.o version.o \
 	mem-break.o hostio.o event-loop.o tracepoint.o \
 	$(XML_BUILTIN) \
@@ -199,32 +190,6 @@ FLAGS_TO_PASS = \
 
 all: gdbserver$(EXEEXT) gdbreplay$(EXEEXT) $(extra_libraries)
 
-$(LIBCOMMON): $(LIBCOMMON_DIR)/Makefile
-	@$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=common subdir_do
-
-common/Makefile: configure-common config.status
-        CONFIG_FILES="common/Makefile" \
-          CONFIG_COMMANDS="depfiles" \
-          CONFIG_HEADERS= \
-          CONFIG_LINKS= \
-          $(SHELL) config.status
-
-configure-common: 
-	@: $(MAKE); $(unstage)
-	@r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-        test ! -f common/Makefile || exit 0; \
-        $(SHELL) $(srcdir)/../../mkinstalldirs common ; \
-        $(HOST_EXPORTS)  \
-        echo Configuring in common; \
-        cd "common" || exit 1; \
-        commondir="$$s/../common"; \
-        srcdiroption="--srcdir=$${commondir}"; \
-	$(SHELL) $${commondir}/configure --enable-gdbserver=yes \
-          $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-          --target=${target_alias} $${srcdiroption}  \
-          || exit 1
-
 # Traditionally "install" depends on "all".  But it may be useful
 # not to; for example, if the user has made some trivial change to a
 # source file and doesn't care about rebuilding or just wants to save the
@@ -259,10 +224,10 @@ html:
 install-html:
 clean-info:
 
-gdbserver$(EXEEXT): $(OBS) ${ADD_DEPS} ${CDEPS} $(LIBCOMMON)
+gdbserver$(EXEEXT): $(OBS) ${ADD_DEPS} ${CDEPS}
 	rm -f gdbserver$(EXEEXT)
 	${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbserver$(EXEEXT) $(OBS) \
-	$(LIBCOMMON) $(GDBSERVER_LIBS) $(XM_CLIBS)
+	  $(GDBSERVER_LIBS) $(XM_CLIBS)
 
 gdbreplay$(EXEEXT): $(GDBREPLAY_OBS)
 	rm -f gdbreplay$(EXEEXT)
@@ -294,7 +259,6 @@ TAGS:	${TAGFILES}
 tags: TAGS
 
 clean:
-	@$(MAKE) $(FLAGS_TO_PASS) DO=clean "DODIRS=$(CLEANDIRS)" subdir_do
 	rm -f *.o ${ADD_FILES} *~
 	rm -f version.c
 	rm -f gdbserver$(EXEEXT) gdbreplay$(EXEEXT) core make.log
@@ -326,22 +290,6 @@ config.h: stamp-h ; @true
 stamp-h: config.in config.status
 	CONFIG_FILES="" CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
 
-subdir_do: force
-	@for i in $(DODIRS); do \
-		case $$i in \
-		$(REQUIRED_SUBDIRS)) \
-			if [ ! -f ./$$i/Makefile ] ; then \
-				echo "Missing $$i/Makefile" >&2 ; \
-				exit 1 ; \
-			fi ;; \
-		esac ; \
-		if [ -f ./$$i/Makefile ] ; then \
-			if (cd ./$$i; \
-				$(MAKE) $(FLAGS_TO_PASS) $(DO)) ; then true ; \
-			else exit 1 ; fi ; \
-		else true ; fi ; \
-	done
-
 Makefile: Makefile.in config.status
 	CONFIG_HEADERS="" $(SHELL) ./config.status
 
@@ -435,6 +383,9 @@ tracepoint.o: tracepoint.c $(server_h) $(srcdir)/../common/ax.def
 utils.o: utils.c $(server_h)
 gdbreplay.o: gdbreplay.c config.h
 
+signals.o: ../common/signals.c $(server_h) $(signals_def)
+	$(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
+
 # We build memmem.c without -Werror because this file is not under
 # our control.  On LynxOS, the compiler generates some warnings
 # because str-two-way.h uses a constant (MAX_SIZE) whose definition
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index 024da0b5d8d..aaa73fced50 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -625,7 +625,6 @@ build
 EGREP
 GREP
 CPP
-RANLIB
 OBJEXT
 EXEEXT
 ac_ct_CC
@@ -2986,98 +2985,6 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_RANLIB+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$RANLIB"; then
-  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
-$as_echo "$RANLIB" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_RANLIB"; then
-  ac_ct_RANLIB=$RANLIB
-  # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_RANLIB"; then
-  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_RANLIB="ranlib"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
-$as_echo "$ac_ct_RANLIB" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_RANLIB" = x; then
-    RANLIB=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    RANLIB=$ac_ct_RANLIB
-  fi
-else
-  RANLIB="$ac_cv_prog_RANLIB"
-fi
-
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index d81f24153dd..07ac26a0000 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -26,7 +26,6 @@ AC_CONFIG_HEADER(config.h:config.in)
 AC_CONFIG_LIBOBJ_DIR(../gnulib)
 
 AC_PROG_CC
-AC_PROG_RANLIB
 AC_GNU_SOURCE
 
 AC_CANONICAL_SYSTEM