From 0e72f5793bec9624d80261f3cfc1103bb1ca82e7 Mon Sep 17 00:00:00 2001 From: Charles Wilson Date: Sun, 25 May 2008 00:13:04 -0400 Subject: [PATCH] Cwrapper should not eat -- arguments * libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src) [file scope]: Defined all option strings in terms of macro LTWRAPPER_OPTION_PREFIX. Similarly defined all option string lengths in terms of macro LTWRAPPER_OPTION_PREFIX_LENGTH. [main]: Modified option parsing algorithm to pass -- on to target, and to not stop processing arguments when -- is seen. Added check for unrecognized options in reserved namespace defined by LTWRAPPER_OPTION_PREFIX. --- ChangeLog | 12 ++++++++++ libltdl/config/ltmain.m4sh | 49 ++++++++++++++++++++++---------------- 2 files changed, 40 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6538f6296..7e00eb96c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2008-05-25 Charles Wilson + + Cwrapper should not eat -- arguments + * libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src) + [file scope]: Defined all option strings in terms of macro + LTWRAPPER_OPTION_PREFIX. Similarly defined all option string + lengths in terms of macro LTWRAPPER_OPTION_PREFIX_LENGTH. + [main]: Modified option parsing algorithm to pass -- on to + target, and to not stop processing arguments when -- is seen. + Added check for unrecognized options in reserved namespace + defined by LTWRAPPER_OPTION_PREFIX. + 2008-05-25 Ralf Wildenhues Fix ifort settings again. diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 0bfae76be..888b74be6 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -2841,18 +2841,24 @@ EOF cat <<"EOF" -static const char *dumpscript_opt = "--lt-dump-script"; +#define LTWRAPPER_OPTION_PREFIX "--lt-" +#define LTWRAPPER_OPTION_PREFIX_LENGTH 5 -static const size_t env_set_opt_len = 12; -static const char *env_set_opt = "--lt-env-set"; +static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH; +static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; + +static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; + +static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7; +static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set"; /* argument is putenv-style "foo=bar", value of foo is set to bar */ -static const size_t env_prepend_opt_len = 16; -static const char *env_prepend_opt = "--lt-env-prepend"; +static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11; +static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend"; /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */ -static const size_t env_append_opt_len = 15; -static const char *env_append_opt = "--lt-env-append"; +static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10; +static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append"; /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */ int @@ -2989,8 +2995,7 @@ EOF lt_opt_process_env_set (p); } else if ((arglen == env_set_opt_len) && - (i + 1 < argc) && - (strcmp (argv[i + 1], "--") != 0)) + (i + 1 < argc)) { lt_opt_process_env_set (argv[i + 1]); i++; /* don't copy */ @@ -3008,8 +3013,7 @@ EOF lt_opt_process_env_prepend (p); } else if ((arglen == env_prepend_opt_len) && - (i + 1 < argc) && - (strcmp (argv[i + 1], "--") != 0)) + (i + 1 < argc)) { lt_opt_process_env_prepend (argv[i + 1]); i++; /* don't copy */ @@ -3027,8 +3031,7 @@ EOF lt_opt_process_env_append (p); } else if ((arglen == env_append_opt_len) && - (i + 1 < argc) && - (strcmp (argv[i + 1], "--") != 0)) + (i + 1 < argc)) { lt_opt_process_env_append (argv[i + 1]); i++; /* don't copy */ @@ -3037,15 +3040,19 @@ EOF lt_fatal ("%s missing required argument", env_append_opt); continue; } - if (strcmp (argv[i], "--") == 0) + if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0) { - /* immediately copy all the rest of the arguments */ - ++i; - for (; i < argc; i++) - newargz[++newargc] = xstrdup (argv[i]); - - /* same as break, because i = argc */ - continue; + /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX + namespace, but it is not one of the ones we know about and + have already dealt with, above (inluding dump-script), then + report an error. Otherwise, targets might begin to believe + they are allowed to use options in the LTWRAPPER_OPTION_PREFIX + namespace. The first time any user complains about this, we'll + need to make LTWRAPPER_OPTION_PREFIX a configure-time option + or a configure.ac-settable value. + */ + lt_fatal ("Unrecognized option in %s namespace: '%s'", + ltwrapper_option_prefix, argv[i]); } /* otherwise ... */ newargz[++newargc] = xstrdup (argv[i]); -- 2.47.2