+2002-09-06 Havoc Pennington <hp@redhat.com>
+
+ * parse.c, pkg.c: handle other_libs other_cflags same
+ as -l/-L/-I flags, so we pull in from dependent packages.
+ Closes #85244, #90706, #89851
+
2002-03-27 Havoc Pennington <hp@redhat.com>
* pkg.c (verify_package): fix a typo
pkg-config is a script to make putting together all the build
flags when compiling/linking a lot easier.
-to use it, do something like the following in your configure.in
+Report bugs at http://bugzilla.gnome.org (pkg-config is in no way
+gnome-specific but gnome.org was a convenient bug tracker).
+
+To use pkg-config, do something like the following in your configure.in
PKG_CHECK_MODULES(GNOME, gtk > 1.2.8 gnomeui >= 1.2.0)
AC_SUBST(GNOME_CFLAGS)
/* Strip out -l and -L flags, put them in a separate list. */
char *trimmed;
- GString *other;
char **argv = NULL;
int argc;
int result;
exit (1);
}
-
- other = g_string_new ("");
i = 0;
while (i < argc)
}
else
{
- g_string_append_c (other, ' ');
- g_string_append (other, arg);
- g_string_append_c (other, ' ');
+ if (*arg != '\0')
+ pkg->other_libs = g_slist_prepend (pkg->other_libs,
+ g_strdup (arg));
}
g_free (arg);
g_free (argv);
g_free (trimmed);
- pkg->other_libs = other->str;
-
- g_string_free (other, FALSE);
-
pkg->l_libs = g_slist_reverse (pkg->l_libs);
pkg->L_libs = g_slist_reverse (pkg->L_libs);
+ pkg->other_libs = g_slist_reverse (pkg->other_libs);
}
static void
/* Strip out -I flags, put them in a separate list. */
char *trimmed;
- GString *other;
char **argv = NULL;
int argc;
int result;
exit (1);
}
-
- other = g_string_new ("");
i = 0;
while (i < argc)
}
else
{
- if (other->len > 0)
- g_string_append (other, " ");
- g_string_append (other, arg);
+ if (*arg != '\0')
+ pkg->other_cflags = g_slist_prepend (pkg->other_cflags,
+ g_strdup (arg));
}
g_free (arg);
g_free (argv);
g_free (trimmed);
- pkg->other_cflags = other->str;
-
- g_string_free (other, FALSE);
-
pkg->I_cflags = g_slist_reverse (pkg->I_cflags);
+ pkg->other_cflags = g_slist_reverse (pkg->other_cflags);
}
static void
return pkg->L_libs;
}
+static GSList*
+get_other_libs (Package *pkg)
+{
+ return pkg->other_libs;
+}
+
static GSList *
get_I_cflags (Package *pkg)
{
return pkg->I_cflags;
}
+static GSList *
+get_other_cflags (Package *pkg)
+{
+ return pkg->other_cflags;
+}
+
static GSList *
get_conflicts (Package *pkg)
{
char *
package_get_other_libs (Package *pkg)
{
- return g_strdup (pkg->other_libs);
+ if (pkg->other_libs_merged == NULL)
+ pkg->other_libs_merged = get_merged (pkg, get_other_libs, TRUE);
+
+ return pkg->other_libs_merged;
}
char *
packages_get_other_libs (GSList *pkgs)
{
- GSList *tmp;
- GString *str;
- char *retval;
-
- str = g_string_new ("");
-
- tmp = pkgs;
- while (tmp != NULL)
- {
- Package *pkg = tmp->data;
-
- if (pkg->other_libs)
- {
- g_string_append (str, pkg->other_libs);
- g_string_append (str, " ");
- }
-
- tmp = g_slist_next (tmp);
- }
-
- retval = str->str;
- g_string_free (str, FALSE);
-
- return retval;
+ return get_multi_merged (pkgs, get_other_libs, TRUE);
}
char *
char *
package_get_other_cflags (Package *pkg)
{
- return g_strdup (pkg->other_cflags);
+ if (pkg->other_cflags_merged == NULL)
+ pkg->other_cflags_merged = get_merged (pkg, get_other_cflags, TRUE);
+
+ return pkg->other_cflags_merged;
}
char *
packages_get_other_cflags (GSList *pkgs)
{
- GSList *tmp;
- GString *str;
- char *retval;
-
- str = g_string_new ("");
-
- tmp = pkgs;
- while (tmp != NULL)
- {
- Package *pkg = tmp->data;
-
- if (pkg->other_cflags)
- {
- g_string_append (str, pkg->other_cflags);
- g_string_append (str, " ");
- }
-
- tmp = g_slist_next (tmp);
- }
-
- retval = str->str;
- g_string_free (str, FALSE);
-
- return retval;
+ return get_multi_merged (pkgs, get_other_cflags, TRUE);
}
char *
char *l_libs_merged;
GSList *L_libs;
char *L_libs_merged;
- char *other_libs;
+ GSList *other_libs;
char *other_libs_merged;
GSList *I_cflags;
char *I_cflags_merged;
- char *other_cflags;
+ GSList *other_cflags;
char *other_cflags_merged;
GHashTable *vars;
GHashTable *required_versions; /* hash from name to RequiredVersion */