[PATCH 17/18] Configury and Makefile updates for VxWorks

Joel Brobecker
2011-02-24T17:59:13Z

This is the last (code) patch! :) Documentation and NEWS entry
will follow.

It contains the changes needed to configure and build the VxWorks
debugger.

gdb/ChangeLog:

* configure.ac: Add support for vxworks targets.
* configure: Regenerate.
* configure.tgt: Add support for vxworks targets.
* Makefile.in (VXWORKS_CFLAGS): New variable.
(INTERNAL_CFLAGS_BASE): Use VXWORKS_CFLAGS.
---
gdb/Makefile.in | 6 +++-
gdb/configure | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++
gdb/configure.ac | 57 ++++++++++++++++++++++++++++++
gdb/configure.tgt | 41 +++++++++++++++++++++
4 files changed, 204 insertions(+), 1 deletions(-)

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index fae43b2..3b2333a 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -440,6 +440,9 @@ CFLAGS = @CFLAGS@
# a bit the consequences by putting the Python includes last in the list.
INTERNAL_CPPFLAGS = @CPPFLAGS@ @PYTHON_CPPFLAGS@

+# Set by configure for all CFLAGS related to vxWorks targets.
+VXWORKS_CFLAGS= @VXWORKS_CFLAGS@
+
# Need to pass this to testsuite for "make check". Probably should be
# consistent with top-level Makefile.in and gdb/testsuite/Makefile.in
# so "make check" has the same result no matter where it is run.
@@ -450,7 +453,8 @@ INTERNAL_CFLAGS_BASE = \
$(CFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) \
$(GDB_CFLAGS) $(OPCODES_CFLAGS) $(READLINE_CFLAGS) \
$(BFD_CFLAGS) $(INCLUDE_CFLAGS) $(LIBDECNUMBER_CFLAGS) \
- $(INTL_CFLAGS) $(INCGNU) $(ENABLE_CFLAGS) $(INTERNAL_CPPFLAGS)
+ $(INTL_CFLAGS) $(INCGNU) $(ENABLE_CFLAGS) $(INTERNAL_CPPFLAGS) \
+ $(VXWORKS_CFLAGS)
INTERNAL_WARN_CFLAGS = $(INTERNAL_CFLAGS_BASE) $(GDB_WARN_CFLAGS)
INTERNAL_CFLAGS = $(INTERNAL_WARN_CFLAGS) $(GDB_WERROR_CFLAGS)

diff --git a/gdb/configure b/gdb/configure
index adf4bef..01d4b1d 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -599,6 +599,7 @@ gl_LTLIBOBJS
gl_LIBOBJS
LTLIBOBJS
LIBOBJS
+VXWORKS_CFLAGS
GDB_NM_FILE
frags
target_subdir
@@ -15921,6 +15922,106 @@ ac_config_links="$ac_config_links $ac_config_links_1"
$as_echo "#define GDB_DEFAULT_HOST_CHARSET \"UTF-8\"" >>confdefs.h

+# Support for vxWorks targets.
+
+case ${target} in
+ *-*-vxworks*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+ LIBS="-ldl $LIBS"
+
+fi
+
+ ;;
+esac
+
+VXWORKS_CFLAGS=
+case "${target}" in
+
+ # vxWorks 653 targets.
+ *-vxworks653 | *-vxworksae )
+ if test "${WIND_FOUNDATION_PATH}" != ""; then
+ # vxWorks 653 version PSC 2.x
+ VXWORKS_CFLAGS="-I${WIND_FOUNDATION_PATH}/include"
+ vxworks_libdir="${WIND_FOUNDATION_PATH}/${WIND_HOST_TYPE}/lib"
+ elif test "${WIND_BASE}" != ""; then
+ # vxWorks 653 version PSC 1.x
+ VXWORKS_CFLAGS="-I${WIND_BASE}/host/include"
+ vxworks_libdir="${WIND_BASE}/host/${WIND_HOST_TYPE}/lib"
+ else
+ as_fn_error "cannot find vxWorks base installation from environment" "$LINENO" 5
+ fi
+ ;;
+
+ # vxWorks 6.x targets.
+ *-vxworks6 )
+ if test "${WIND_FOUNDATION_PATH}" = ""; then
+ as_fn_error "cannot find vxWorks base installation from environment" "$LINENO" 5
+ fi
+ VXWORKS_CFLAGS="-I${WIND_FOUNDATION_PATH}/include"
+ vxworks_libdir="${WIND_FOUNDATION_PATH}/${WIND_HOST_TYPE}/lib"
+ ;;
+
+ # vxWorks 5.x targets.
+ *-vxworks )
+ if test "${WIND_BASE}" = ""; then
+ as_fn_error "cannot find vxWorks base installation from environment" "$LINENO" 5
+ fi
+ VXWORKS_CFLAGS="-I${WIND_BASE}/host/include"
+ vxworks_libdir="${WIND_BASE}/host/${WIND_HOST_TYPE}/lib"
+ case "${host_os}" in
+ mingw* | *-cygwin* )
+ LIBS="${LIBS} $vxworks_libdir/tcldll.lib"
+ ;;
+ * )
+ LIBS="${LIBS} -L$vxworks_libdir"
+ LIBS="${LIBS} -ltcl"
+ ;;
+ esac
+ ;;
+esac
+
+
+
ac_config_files="$ac_config_files Makefile .gdbinit:gdbinit.in doc/Makefile gnulib/Makefile data-directory/Makefile"

ac_config_commands="$ac_config_commands default"
diff --git a/gdb/configure.ac b/gdb/configure.ac
index f31ef2a..4c0759c 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -2167,6 +2167,63 @@ dnl At the moment, we just assume it's UTF-8.
AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "UTF-8",
[Define to be a string naming the default host character set.])

+# Support for vxWorks targets.
+
+dnl The WTX support requires dlopen to load the WTX libraries.
+case ${target} in
+ *-*-vxworks*)
+ AC_CHECK_LIB(dl, dlopen)
+ ;;
+esac
+
+VXWORKS_CFLAGS=
+case "${target}" in
+
+ # vxWorks 653 targets.
+ *-vxworks653 | *-vxworksae )
+ if test "${WIND_FOUNDATION_PATH}" != ""; then
+ # vxWorks 653 version PSC 2.x
+ VXWORKS_CFLAGS="-I${WIND_FOUNDATION_PATH}/include"
+ vxworks_libdir="${WIND_FOUNDATION_PATH}/${WIND_HOST_TYPE}/lib"
+ elif test "${WIND_BASE}" != ""; then
+ # vxWorks 653 version PSC 1.x
+ VXWORKS_CFLAGS="-I${WIND_BASE}/host/include"
+ vxworks_libdir="${WIND_BASE}/host/${WIND_HOST_TYPE}/lib"
+ else
+ AC_ERROR(cannot find vxWorks base installation from environment)
+ fi
+ ;;
+
+ # vxWorks 6.x targets.
+ *-vxworks6 )
+ if test "${WIND_FOUNDATION_PATH}" = ""; then
+ AC_ERROR(cannot find vxWorks base installation from environment)
+ fi
+ VXWORKS_CFLAGS="-I${WIND_FOUNDATION_PATH}/include"
+ vxworks_libdir="${WIND_FOUNDATION_PATH}/${WIND_HOST_TYPE}/lib"
+ ;;
+
+ # vxWorks 5.x targets.
+ *-vxworks )
+ if test "${WIND_BASE}" = ""; then
+ AC_ERROR(cannot find vxWorks base installation from environment)
+ fi
+ VXWORKS_CFLAGS="-I${WIND_BASE}/host/include"
+ vxworks_libdir="${WIND_BASE}/host/${WIND_HOST_TYPE}/lib"
+ case "${host_os}" in
+ mingw* | *-cygwin* )
+ LIBS="${LIBS} $vxworks_libdir/tcldll.lib"
+ ;;
+ * )
+ LIBS="${LIBS} -L$vxworks_libdir"
+ LIBS="${LIBS} -ltcl"
+ ;;
+ esac
+ ;;
+esac
+
+AC_SUBST(VXWORKS_CFLAGS)
+
AC_OUTPUT(Makefile .gdbinit:gdbinit.in doc/Makefile gnulib/Makefile data-directory/Makefile,
[
case x$CONFIG_HEADERS in
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 7d017a9..d395668 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -28,6 +28,14 @@ case $targ in
;;
esac

+# The list of common files needed for all vxWorks ports.
+wtx_tdep_files="remote-wtxapi.o remote-wtx-opt.o remote-wtx-pd.o \
+ remote-wtx.o remote-wtx-utils.o remote-wtx-bp.o \
+ remote-wtx-hw.o remote-wtx-tasks.o"
+# The list of common files needed in order to support the DFW protocol
+# in vxWorks 6.x ports.
+dfw_tdep_files="remote-dfwapi.o remote-dfw.o"
+
# map target info into gdb names.

case "${targ}" in
@@ -239,6 +247,21 @@ i[34567]86-*-mingw32*)
solib-target.o corelow.o windows-tdep.o"
build_gdbserver=yes
;;
+i[34567]86-*-vxworks653 | i[34567]86-*-vxworksae )
+ # Target: Intel 386 running vxWorks 653
+ gdb_target_obs="i386-tdep.o i387-tdep.o i386-vxworks-tdep.o \
+ ${wtx_tdep_files} remote-wtx-tcl.o"
+ ;;
+i[34567]86-*-vxworks6* )
+ # Target: Intel 386 running vxWorks 6.x
+ gdb_target_obs="i386-tdep.o i387-tdep.o ${dfw_tdep_files} \
+ ${wtx_tdep_files} "
+ ;;
+i[34567]86-*-vxworks* )
+ # Target: Intel 386 running vxWorks 5.x
+ gdb_target_obs="i386-tdep.o i387-tdep.o i386-vxworks-tdep.o \
+ ${wtx_tdep_files} remote-wtx-tcl.o"
+ ;;
i[34567]86-*-*)
# Target: i386
gdb_target_obs="i386-tdep.o i387-tdep.o"
@@ -417,6 +440,24 @@ powerpc-*-linux* | powerpc64-*-linux*)
gdb_sim=../sim/ppc/libsim.a
build_gdbserver=yes
;;
+powerpc-*-vxworks653 | powerpc-*-vxworksae )
+ # Target: PowerPC running vxWorks 653
+ gdb_target_obs="rs6000-tdep.o rs6000-vxworks-tdep.o ppc-sysv-tdep.o \
+ solib.o solib-svr4.o \
+ ${wtx_tdep_files} remote-wtx-tcl.o"
+ ;;
+powerpc-*-vxworks6* | e500*-*-vxworks6* )
+ # Target: PowerPC running vxWorks 6.x
+ gdb_target_obs="rs6000-tdep.o rs6000-vxworks-tdep.o ppc-sysv-tdep.o \
+ solib.o solib-svr4.o \
+ ${dfw_tdep_files} ${wtx_tdep_files} "
+ ;;
+powerpc-*-vxworks* )
+ # Target: PowerPC running vxWorks 5.x
+ gdb_target_obs="rs6000-tdep.o rs6000-vxworks-tdep.o ppc-sysv-tdep.o \
+ solib.o solib-svr4.o \
+ ${wtx_tdep_files} remote-wtx-tcl.o"
+ ;;
powerpc*-*-*)
# Target: PowerPC running eabi
gdb_target_obs="rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o \
--
1.7.0.4