+2005-04-01 Tollef Fog Heen <tfheen@err.no>
+
+ * configure.in: Try to detect whether this architecture supports
+ inter-library dependencies. If so, we default to assuming that
+ this support is used and link to the minimal set of libraries
+ rather than traversing the full depends set.
+
+ * main.c (main): Only recurse if we want a static library list or
+ if this architecture doesn't support inter-library dependencies.
+ This will probably expose bugs for libraries which declare
+ dependencies in their .pc files but don't actually link against
+ each other.
+
+ * pkg.c (packages_get_all_libs): Add recurse option
+ (packages_get_L_libs): Add recurse option
+ (package_get_L_libs): Add recurse option
+ (packages_get_l_libs): Add recurse option
+ (package_get_l_libs): Add recurse option
+
+ * pkg.h: Update prototypes to handle the recurse option.
+
2005-03-29 Tollef Fog Heen <tfheen@err.no>
* check/check-cflags, check/check-define-variable,
AC_INIT(pkg-config.1)
-AM_INIT_AUTOMAKE(pkgconfig, 0.16.0)
+AM_INIT_AUTOMAKE(pkgconfig, 0.16.1)
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(config.h)
PKG_CONFIG_FIND_PC_PATH
+#
+# Code taken from gtk+-2.0's configure.in.
+#
+# This causes pkg-config to only list direct dependencies on platforms
+# which support inter-library dependencies.
+#
+
+AC_ARG_ENABLE(indirect-deps,
+ [AC_HELP_STRING([--enable-indirect-deps=@<:@yes/no/auto@:>@],
+ [list both direct and indirect dependencies. [default=auto]])],,
+ [enable_indirect_deps=auto])
+
+AC_MSG_CHECKING([Whether to list both direct and indirect dependencies])
+case $enable_indirect_deps in
+ auto)
+ deplib_check_method=`(./libtool --config; echo eval echo \\$deplib_check_method) | sh`
+ if test "X$deplib_check_method" = Xnone || test "x$enable_static" = xyes ; then
+ enable_indirect_deps=yes
+ else
+ enable_indirect_deps=no
+ fi
+ ;;
+ yes|no)
+ ;;
+ *) AC_MSG_ERROR([Value given to --enable-indirect-deps must be one of yes, no
+or auto])
+ ;;
+esac
+AC_MSG_RESULT($enable_explicit_deps)
+
+AC_DEFINE_UNQUOTED(ENABLE_INDIRECT_DEPS, `test $enable_indirect_deps = yes; echo $?`, [Indirect shared library dependencies enabled])
+
AC_MSG_CHECKING([for Win32])
case "$host" in
*-*-mingw*)
int want_I_cflags = 0;
int want_other_cflags = 0;
int want_list = 0;
+ int want_static_lib_list = ENABLE_INDIRECT_DEPS;
int result;
int want_uninstalled = 0;
char *variable_name = NULL;
"require given version of pkg-config", "VERSION" },
{ "libs", 0, POPT_ARG_NONE, &want_libs, 0,
"output all linker flags" },
+ { "static", 0, POPT_ARG_NONE, &want_static_lib_list, 0,
+ "output linker flags for static linking" },
{ "libs-only-l", 0, POPT_ARG_NONE, &want_l_libs, 0,
"output -l flags" },
{ "libs-only-other", 0, POPT_ARG_NONE, &want_other_libs, 0,
if (want_l_libs)
{
- char *str = packages_get_l_libs (packages);
+ char *str = packages_get_l_libs (packages, want_static_lib_list);
printf ("%s ", str);
g_free (str);
need_newline = TRUE;
}
else if (want_L_libs)
{
- char *str = packages_get_L_libs (packages);
+ char *str = packages_get_L_libs (packages, want_static_lib_list);
printf ("%s ", str);
g_free (str);
need_newline = TRUE;
}
else if (want_libs)
{
- char *str = packages_get_all_libs (packages);
+ char *str = packages_get_all_libs (packages, want_static_lib_list);
printf ("%s ", str);
g_free (str);
need_newline = TRUE;
}
char *
-package_get_l_libs (Package *pkg)
+package_get_l_libs (Package *pkg, gboolean recurse)
{
+ if (!recurse)
+ return string_list_to_string (get_l_libs(pkg));
/* We don't want these in search path order, rather in dependency
* order, so static linking works.
*/
}
char *
-packages_get_l_libs (GSList *pkgs)
+packages_get_l_libs (GSList *pkgs, gboolean recurse)
{
+ if (!recurse) {
+ GSList *tmp;
+ GSList *list;
+ GSList *dups_list = NULL;
+ char *retval;
+
+ tmp = pkgs;
+ while (tmp != NULL)
+ {
+ dups_list = g_slist_concat (dups_list, get_l_libs(tmp->data));
+ tmp = tmp->next;
+ }
+
+ list = string_list_strip_duplicates_from_back (dups_list);
+ g_slist_free (dups_list);
+
+ retval = string_list_to_string (list);
+
+ g_slist_free (list);
+
+ return retval;
+
+ }
+
return get_multi_merged_from_back (pkgs, get_l_libs, FALSE);
}
char *
-package_get_L_libs (Package *pkg)
+package_get_L_libs (Package *pkg, gboolean recurse)
{
+ if (!recurse)
+ return string_list_to_string (get_L_libs(pkg));
+
/* We want these in search path order so the -L flags don't override PKG_CONFIG_PATH */
if (pkg->L_libs_merged == NULL)
pkg->L_libs_merged = get_merged (pkg, get_L_libs, TRUE);
}
char *
-packages_get_L_libs (GSList *pkgs)
+packages_get_L_libs (GSList *pkgs, gboolean recurse)
{
+ if (!recurse) {
+ GSList *tmp;
+ GSList *list;
+ GSList *dups_list = NULL;
+ char *retval;
+
+ tmp = pkgs;
+ while (tmp != NULL)
+ {
+ dups_list = g_slist_concat (dups_list, get_L_libs(tmp->data));
+ tmp = tmp->next;
+ }
+
+ list = string_list_strip_duplicates_from_back (dups_list);
+ g_slist_free (dups_list);
+
+ retval = string_list_to_string (list);
+
+ g_slist_free (list);
+
+ return retval;
+ }
+
return get_multi_merged (pkgs, get_L_libs, TRUE);
}
}
char *
-packages_get_all_libs (GSList *pkgs)
+packages_get_all_libs (GSList *pkgs, gboolean recurse)
{
char *l_libs;
char *L_libs;
str = g_string_new ("");
other_libs = packages_get_other_libs (pkgs);
- L_libs = packages_get_L_libs (pkgs);
- l_libs = packages_get_l_libs (pkgs);
+ L_libs = packages_get_L_libs (pkgs, recurse);
+ l_libs = packages_get_l_libs (pkgs, recurse);
if (other_libs)
g_string_append (str, other_libs);
};
Package *get_package (const char *name);
-char * package_get_l_libs (Package *pkg);
-char * packages_get_l_libs (GSList *pkgs);
-char * package_get_L_libs (Package *pkg);
-char * packages_get_L_libs (GSList *pkgs);
+char * package_get_l_libs (Package *pkg, gboolean recurse);
+char * packages_get_l_libs (GSList *pkgs, gboolean recurse);
+char * package_get_L_libs (Package *pkg, gboolean recurse);
+char * packages_get_L_libs (GSList *pkgs, gboolean recurse);
char * package_get_other_libs (Package *pkg);
char * packages_get_other_libs (GSList *pkgs);
-char * packages_get_all_libs (GSList *pkgs);
+char * packages_get_all_libs (GSList *pkgs, gboolean recurse);
char * package_get_I_cflags (Package *pkg);
char * packages_get_I_cflags (GSList *pkgs);
char * package_get_other_cflags (Package *pkg);