From 3abe9c9ebb6edf00418306f026fd256c52e42af4 Mon Sep 17 00:00:00 2001 From: borutr Date: Mon, 30 Oct 2006 19:32:18 +0000 Subject: [PATCH] * debugger/mcs51/sdcdb.c: replaced hardcoded "/" with DIR_SEPARATOR_STRING * debugger/mcs51/acinclude.m4: locate readline even when cross compiling git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4446 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 7 +- debugger/mcs51/acinclude.m4 | 251 +++++++----------------------------- debugger/mcs51/sdcdb.c | 2 +- 3 files changed, 51 insertions(+), 209 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1120cd0e..434718d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-10-30 Borut Razem + + * debugger/mcs51/sdcdb.c: replaced hardcoded "/" with DIR_SEPARATOR_STRING + * debugger/mcs51/acinclude.m4: locate readline even when cross compiling + 2006-10-29 Jesus Calvino-Fraga * device/include/mcs51/serial_IO.h: putchar() and getchar() using @@ -136,7 +141,7 @@ 2006-10-20 Borut Razem - * sebugger/mcs51/sdcdb.c: replaced isblank() with isspace() + * debugger/mcs51/sdcdb.c: replaced isblank() with isspace() 2006-10-19 Maarten Brock diff --git a/debugger/mcs51/acinclude.m4 b/debugger/mcs51/acinclude.m4 index aeabddf2..64ea826c 100644 --- a/debugger/mcs51/acinclude.m4 +++ b/debugger/mcs51/acinclude.m4 @@ -1,213 +1,50 @@ -dnl Scott Dattalo -dnl -dnl This is copied from the NcFTP distribution. -dnl Author Mike Gleason mgleason@NcFTP.com -dnl -dnl This macro will check for the presence and version -dnl of the readline library. To get it into the aclocal.m4 -dnl file, do this: +dnl This macro will check for the presence of the readline library. +dnl To get it into the aclocal.m4 dnl file, do this: dnl aclocal -I . --verbose dnl dnl The --verbose will show all of the files that are searched dnl for .m4 macros. -AC_DEFUN([wi_LIB_READLINE], [ -AC_MSG_CHECKING([for GNU Readline library, version 2.0 or newer]) - -wi_cv_lib_readline=no -wi_cv_lib_readline_result=no -ac_save_LIBS="$LIBS" -# Note: $LIBCURSES is permitted to be empty. -for LIBREADLINE in "-lreadline" "-lreadline $LIBCURSES" "-lreadline -ltermcap" "-lreadline -lncurses" "-lreadline -lcurses" -do - LIBS="$ac_save_LIBS $LIBREADLINE" - AC_TRY_RUN([ - /* program */ -#include -#include - -main(int argc, char **argv) -{ - /* Note: don't actually call readline, since it may block; - * We just want to see if it (dynamic) linked in okay. - */ - if (argc == 0) /* never true */ - readline(0); - exit(0); -} -],[ - # action if true - wi_cv_lib_readline=yes -],[ - # action if false - wi_cv_lib_readline=no -],[ - # action if cross compiling - wi_cv_lib_readline=no -]) - - if test "$wi_cv_lib_readline" = yes ; then break ; fi -done - -# Now try it again, to be sure it is recent enough. -# rl_function_of_keyseq appeared in version 2.0 -# -dnl AC_CHECK_FUNC(rl_function_of_keyseq, [wi_cv_lib_readline=yes],[ -dnl wi_cv_lib_readline=no;wi_cv_lib_readline_result="no (it is present but too old to use)" -dnl ]) - AC_TRY_LINK([ - /* includes */ - ],[ - /* function-body */ - readline(0); - rl_function_of_keyseq(0); - ],[ - wi_cv_lib_readline=yes - ],[ - wi_cv_lib_readline=no - wi_cv_lib_readline_result="no (it is present but too old to use)" - ]) - -if test "$wi_cv_lib_readline" = no ; then - LIBREADLINE="" - # restore LIBS - LIBS="$ac_save_LIBS" -else - /bin/rm -f readline.ver - touch readline.ver - - AC_TRY_RUN([ - /* program */ -#include -#include -#include - -extern char *rl_library_version; -main() -{ - FILE *fp; - double d; - - sscanf(rl_library_version, "%lf", &d); - fp = fopen("readline.ver", "w"); - if (fp == NULL) exit(1); - if (fprintf(fp, "%s\n", rl_library_version) < 0) exit(1); - if (fprintf(fp, "%03d\n", (int) (d * 100.0)) < 0) exit(1); - if (fclose(fp) < 0) exit(1); - exit(0); -} - ],[ - # action if true - rl_library_version=`sed -n 1,1p readline.ver 2>/dev/null` - rlver=`sed -n 2,2p readline.ver 2>/dev/null` - /bin/rm -f readline.ver - ],[ - # action if false - rl_library_version='' - rlver='' - /bin/rm -f readline.ver - ],[ - # action if cross compiling - rl_library_version='' - rlver='' - /bin/rm -f readline.ver - ]) - - case "$rlver" in - ???) - wi_cv_lib_readline_result="yes, installed version is $rl_library_version" - ;; - *) - # Test using current LIBS. - AC_TRY_LINK([ - /* includes */ - extern int rl_completion_append_character; - ],[ - /* function-body */ - readline(0); - rl_completion_append_character = 0; - ],[ - rlver="210" - ],[ - rlver="200" - ]) - - if test "$rlver" = "210" ; then - wi_cv_lib_readline_result="yes, version 2.1 or higher" - else - wi_cv_lib_readline_result="yes, version 2.0" - fi - ;; - esac - - wi_cv_lib_readline=yes - # restore LIBS - LIBS="$ac_save_LIBS" -fi -AC_MSG_RESULT($wi_cv_lib_readline_result) -AC_SUBST(LIBREADLINE) - -if test "$wi_cv_lib_readline" = yes ; then - # Now verify that all the headers are installed. - # - AC_REQUIRE_CPP() - unset ac_cv_header_readline_chardefs_h - unset ac_cv_header_readline_history_h - unset ac_cv_header_readline_keymaps_h - unset ac_cv_header_readline_readline_h - unset ac_cv_header_readline_tilde_h - AC_CHECK_HEADERS([readline/chardefs.h readline/history.h readline/keymaps.h readline/readline.h readline/tilde.h]) - - for xxwi in \ - "$ac_cv_header_readline_chardefs_h" \ - "$ac_cv_header_readline_history_h" \ - "$ac_cv_header_readline_keymaps_h" \ - "$ac_cv_header_readline_readline_h" \ - "$ac_cv_header_readline_tilde_h" - do - if test "$xxwi" = no ; then - break - fi - done - - if test "$xxwi" = no ; then - AC_MSG_WARN([GNU Readline headers are not installed or could not be found -- GNU Readline will not be used.]) - wi_cv_lib_readline=no - wi_cv_lib_readline_result="no (headers not installed)" - else - AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE, $rlver,[Readline]) - fi -fi - dnl Check to see if we have a namespace clean version of readline - dnl or not. At least FreeBSD 4.9 ships with non-ns-clean readline. - if test "$wi_cv_lib_readline" = "yes" ; then - ac_save_LIBS="$LIBS" - LIBS="$ac_save_LIBS $LIBREADLINE" - AC_CHECK_FUNCS(rl_completion_matches completion_matches) - # restore LIBS - LIBS="$ac_save_LIBS" - fi - dnl Check to see if rl_callback_handler_install takes a cast - AC_MSG_CHECKING([to see if readline callbacks take a cast]) - ac_save_LIBS="$LIBS" - LIBS="$ac_save_LIBS $LIBREADLINE" - ac_save_CC="$CC" - CC="$CXX" - AC_TRY_LINK([ -#include -#include -void func(void) { return; } - ],[ - rl_callback_handler_install(">", (void(*)(char*))func); - ],[ - AC_DEFINE(READLINE_CB_TAKES_CAST, 1, [callbacks take a cast]) - AC_MSG_RESULT([yes]) - ],[ - AC_MSG_RESULT([no]) - ]) - # restore LIBS - LIBS="$ac_save_LIBS" - CC="$ac_save_CC" +AC_DEFUN([wi_LIB_READLINE], [ + dnl check for the readline.h header file + AC_CHECK_HEADER(readline/readline.h) + + if test "$ac_cv_header_readline_readline_h" = yes; then + dnl check for the readline library + + ac_save_LIBS="$LIBS" + # Note: $LIBCURSES is permitted to be empty. + + for LIBREADLINE in "-lreadline.dll" "-lreadline" "-lreadline $LIBCURSES" "-lreadline -ltermcap" "-lreadline -lncurses" "-lreadline -lcurses" + do + AC_MSG_CHECKING([for GNU Readline library]) + + LIBS="$ac_save_LIBS $LIBREADLINE" + + AC_TRY_LINK([ + /* includes */ + #include + #include + ],[ + /* function-body */ + readline(NULL); + rl_function_of_keyseq(NULL, NULL, NULL); + ],[ + wi_cv_lib_readline=yes + wi_cv_lib_readline_result="$LIBREADLINE" + ],[ + wi_cv_lib_readline=no + wi_cv_lib_readline_result=no + ]) + + if test "$wi_cv_lib_readline" = yes; then + AC_MSG_RESULT($wi_cv_lib_readline_result) + AC_SUBST(LIBREADLINE) + AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE, 1, [Readline]) + break + fi + done + + LIBS="$ac_save_LIBS" + fi ]) -dnl -dnl diff --git a/debugger/mcs51/sdcdb.c b/debugger/mcs51/sdcdb.c index eb598461..507ad1bf 100644 --- a/debugger/mcs51/sdcdb.c +++ b/debugger/mcs51/sdcdb.c @@ -52,7 +52,7 @@ short showfull = 0; char userinterrupt = 0; char nointerrupt = 0; char contsim = 0; -char *ssdirl = DATADIR LIB_DIR_SUFFIX ":" DATADIR LIB_DIR_SUFFIX "/small" ; +char *ssdirl = DATADIR LIB_DIR_SUFFIX ":" DATADIR LIB_DIR_SUFFIX DIR_SEPARATOR_STRING "small" ; char *simArgs[40]; int nsimArgs = 0; char model_str[20]; -- 2.47.2