diff options
author | Justin Erenkrantz <jerenkrantz@apache.org> | 2006-08-22 17:18:29 +0000 |
---|---|---|
committer | Justin Erenkrantz <jerenkrantz@apache.org> | 2006-08-22 17:18:29 +0000 |
commit | 0fe09356fd821520575f65b4d8048ac088f8866d (patch) | |
tree | e5f5a68236034c2a994fbb0998c439d5ab19b27f /build/jlibtool.c | |
parent | 6fe7dcef8fb278408f2b027eae22f83f01e67092 (diff) | |
download | apr-0fe09356fd821520575f65b4d8048ac088f8866d.tar.gz |
* jlibtool.c: Support the build overriding -undefined via run-time arguments;
also support -undefined dynamic_lookup on 10.3+.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@433700 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'build/jlibtool.c')
-rw-r--r-- | build/jlibtool.c | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/build/jlibtool.c b/build/jlibtool.c index 735123d50..e884e20ef 100644 --- a/build/jlibtool.c +++ b/build/jlibtool.c @@ -65,7 +65,8 @@ # define PIC_FLAG "-fPIC -fno-common" # define SHARED_OPTS "-dynamiclib" # define MODULE_OPTS "-bundle" -# define DYNAMIC_LINK_OPTS "-flat_namespace -undefined suppress" +# define DYNAMIC_LINK_OPTS "-flat_namespace" +# define DYNAMIC_LINK_UNDEFINED "-undefined suppress" # define dynamic_link_version_func darwin_dynamic_link_function # define DYNAMIC_INSTALL_NAME "-install_name" # define DYNAMIC_LINK_NO_INSTALL "-dylib_file" @@ -274,6 +275,7 @@ typedef struct { library_opts shared_opts; const char *version_info; + const char *undefined_flag; } command_t; #ifdef RPATH @@ -932,6 +934,38 @@ char * load_noinstall_path(const char *arg, int pathlen) return expanded_path; } +void add_dynamic_link_opts(command_t *cmd_data) +{ +#ifdef DYNAMIC_LINK_OPTS + if (cmd_data->options.pic_mode != pic_AVOID) { + push_count_chars(cmd_data->program_opts, + DYNAMIC_LINK_OPTS); + if (cmd_data->undefined_flag) { + push_count_chars(cmd_data->program_opts, "-undefined"); +#if defined(__APPLE__) + /* -undefined dynamic_lookup is used by the bundled Python in + * 10.4, but if we don't set MACOSX_DEPLOYMENT_TARGET to 10.3+, + * we'll get a linker error if we pass this flag. + */ + if (strcasecmp(cmd_data->undefined_flag, + "dynamic_lookup") == 0) { + insert_count_chars(cmd_data->program_opts, + "MACOSX_DEPLOYMENT_TARGET=10.3", 0); + } +#endif + push_count_chars(cmd_data->program_opts, + cmd_data->undefined_flag); + } + else { +#ifdef DYNAMIC_LINK_UNDEFINED + push_count_chars(cmd_data->program_opts, + DYNAMIC_LINK_UNDEFINED); +#endif + } + } +#endif +} + /* Read the final install location and add it to runtime library search path. */ #ifdef RPATH void add_rpath(count_chars *cc, const char *path) @@ -1375,6 +1409,9 @@ void parse_args(int argc, char *argv[], command_t *cmd_data) /* Skip the argument. */ ++a; argused = 1; + } else if (strcmp(arg+1, "undefined") == 0) { + cmd_data->undefined_flag = argv[++a]; + argused = 1; } else if (arg[1] == 'R' && !arg[2]) { /* -R dir Add dir to runtime library search path. */ add_runtimedirlib(argv[++a], cmd_data); @@ -1588,11 +1625,7 @@ void link_fixup(command_t *c) push_count_chars(c->arglist, c->output_name); append_count_chars(c->arglist, c->obj_files); append_count_chars(c->arglist, c->shared_opts.dependencies); -#ifdef DYNAMIC_LINK_OPTS - if (c->options.pic_mode != pic_AVOID) { - push_count_chars(c->arglist, DYNAMIC_LINK_OPTS); - } -#endif + add_dynamic_link_opts(c); } } } @@ -1809,12 +1842,8 @@ int run_mode(command_t *cmd_data) push_count_chars(cmd_data->program_opts, MODULE_OPTS); #endif } -#ifdef DYNAMIC_LINK_OPTS - if (cmd_data->options.pic_mode != pic_AVOID) { - push_count_chars(cmd_data->program_opts, - DYNAMIC_LINK_OPTS); - } -#endif + add_dynamic_link_opts(cmd_data); + rv = run_command(cmd_data, cmd_data->shared_opts.normal); if (rv) { return rv; |