From: Han-Wen Nienhuys Date: Sun, 6 Mar 2005 19:41:13 +0000 (+0000) Subject: (open_library): dlopen libkpathsea.so X-Git-Tag: release/2.5.14~12 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=58140b4fd0e713ecb6839c5e62d6c2b756625b27;p=lilypond.git (open_library): dlopen libkpathsea.so (open_library): alternative for static library. --- diff --git a/ChangeLog b/ChangeLog index 115564af53..e56e84a8a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2005-03-06 Han-Wen Nienhuys * kpath-guile/kpath.c (open_library): dlopen libkpathsea.so + (open_library): alternative for static library. 2005-03-06 Jan Nieuwenhuizen diff --git a/kpath-guile/kpath.c b/kpath-guile/kpath.c index 01f340e4f8..2b4a48a774 100644 --- a/kpath-guile/kpath.c +++ b/kpath-guile/kpath.c @@ -33,20 +33,20 @@ I found a somewhat more elegant patch for this: Just #include #include +#if !HAVE_DYNAMIC_LIBKPATHSEA + #define popen REALLYUGLYKLUDGE #define pclose ANOTHERREALLYUGLYKLUDGE #define getopt YAKLUDGE #include #include - - - +#endif static void *kpathsea_handle = 0; static char *(*dl_kpse_find_file) (char const*, kpse_file_format_type, boolean) = 0; static void (*dl_kpse_maketex_option) (char const*, boolean) = 0; -static void (*dl_kpse_set_program_name) (char const*) = 0; +static void (*dl_kpse_set_program_name) (char const*, char const*) = 0; static char const *(*dl_kpse_init_format) (kpse_file_format_type) = 0; static char *(*dl_kpse_var_expand) (char const*) = 0; static kpse_format_info_type (*dl_kpse_format_info)[kpse_last_format] = 0; @@ -107,7 +107,7 @@ SCM ly_kpathsea_expand_variable(SCM var) static char const* LIBKPATHSEA = "libkpathsea.so"; int -open_dynamic_library () +open_library () { #if HAVE_DYNAMIC_LIBKPATHSEA struct @@ -152,21 +152,27 @@ open_dynamic_library () return 1; } } - return 0; +#else + dl_kpse_find_file = &kpse_find_file; + dl_kpse_set_program_name = &kpse_set_program_name; + dl_kpse_format_info = &kpse_format_info; + dl_kpse_init_format = &kpse_init_format; + dl_kpse_maketex_option = &kpse_maketex_option; + dl_kpse_var_expand = &kpse_var_expand; #endif } void initialize_kpathsea () { - if (open_dynamic_library ()) + if (open_library ()) { fprintf (stderr, "Error opening kpathsea library. Aborting"); exit (1); } - (*dl_kpse_set_program_name) ("lilypond"); + (*dl_kpse_set_program_name) ("lilypond", "lilypond"); (*dl_kpse_maketex_option) ("tfm", TRUE); SCM find = scm_c_define_gsubr ("ly:kpathsea-find-file", 1, 0, 0, ly_kpathsea_find_file);