ARCHIVE_VERSION=0.19.5
AC_SUBST([ARCHIVE_VERSION])
+PACKAGE_SUFFIX="-$ARCHIVE_VERSION"
+AC_SUBST([PACKAGE_SUFFIX])
+AC_DEFINE_UNQUOTED(PACKAGE_SUFFIX, "$PACKAGE_SUFFIX",
+ [Define to the suffix of this package])
+
dnl Check for tools needed for formatting the documentation.
ac_aux_dir_abs=`cd $ac_aux_dir && pwd`
AC_PATH_PROG([DVIPS], [dvips], [$ac_aux_dir_abs/missing dvips])
mv intl/Makefile.tmp intl/Makefile
])
+AC_CONFIG_FILES([its/Makefile])
+
AC_CONFIG_FILES([gnulib-lib/Makefile])
AC_CONFIG_FILES([libgrep/Makefile])
struct locating_rule_list_ty
{
- char *base;
-
struct locating_rule_ty *items;
size_t nitems;
size_t nitems_max;
return NULL;
}
-char *
+const char *
locating_rule_list_locate (struct locating_rule_list_ty *rules,
const char *path)
{
{
target = locating_rule_match (&rules->items[i], path);
if (target != NULL)
- return xconcatenated_filename (rules->base, target, NULL);
+ return target;
}
return NULL;
return true;
}
-static bool
+bool
locating_rule_list_add_directory (struct locating_rule_list_ty *rules,
const char *directory)
{
}
struct locating_rule_list_ty *
-locating_rule_list_alloc (const char *base, const char *directory)
+locating_rule_list_alloc (void)
{
struct locating_rule_list_ty *result;
xmlCheckVersion (LIBXML_VERSION);
result = XCALLOC (1, struct locating_rule_list_ty);
- result->base = xstrdup (base);
-
- locating_rule_list_add_directory (result, directory);
return result;
}
void
locating_rule_list_destroy (struct locating_rule_list_ty *rules)
{
- free (rules->base);
-
while (rules->nitems-- > 0)
locating_rule_destroy (&rules->items[rules->nitems]);
free (rules->items);
typedef struct locating_rule_list_ty locating_rule_list_ty;
-/* Creates a fresh locating_rule_list_ty with the base URI BASE, and loads
- the locating rules from the files in DIRECTORY. */
-extern struct locating_rule_list_ty *locating_rule_list_alloc (const char *base,
- const char *directory);
+/* Creates a fresh locating_rule_list_ty. */
+extern struct locating_rule_list_ty *locating_rule_list_alloc (void);
+
+extern bool
+ locating_rule_list_add_directory (locating_rule_list_ty *rules,
+ const char *directory);
/* Determines the location of resource associated with PATH, accoding
to the loaded locating rules. */
-extern char *locating_rule_list_locate (locating_rule_list_ty *locators,
- const char *path);
+extern const char *locating_rule_list_locate (locating_rule_list_ty *rules,
+ const char *path);
-/* Releases memory allocated for LOCATORS. */
-extern void locating_rule_list_free (locating_rule_list_ty *locators);
+/* Releases memory allocated for RULES. */
+extern void locating_rule_list_free (locating_rule_list_ty *rules);
#ifdef __cplusplus
}
/* A convenience macro. I don't like writing gettext() every time. */
#define _(str) gettext (str)
+#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
+
#include "x-c.h"
#include "x-po.h"
bool sort_by_msgid = false;
bool sort_by_filepos = false;
bool its = false;
+ char *its_dirs[2] = { NULL, NULL };
const char *file_name;
const char *files_from = NULL;
string_list_ty *file_list;
if (its)
{
const char *gettextdatadir;
- char *itsdir;
+ char *versioned_gettextdatadir;
/* Make it possible to override the locator file location. This
is necessary for running the testsuite before "make
if (gettextdatadir == NULL || gettextdatadir[0] == '\0')
gettextdatadir = relocate (GETTEXTDATADIR);
- itsdir = xconcatenated_filename (gettextdatadir, "its", NULL);
- its_locating_rules = locating_rule_list_alloc (itsdir, itsdir);
- free (itsdir);
+ its_dirs[0] = xconcatenated_filename (gettextdatadir, "its", NULL);
+
+ versioned_gettextdatadir =
+ xasprintf ("%s%s", relocate (GETTEXTDATADIR), PACKAGE_SUFFIX);
+ its_dirs[1] = xconcatenated_filename (versioned_gettextdatadir, "its",
+ NULL);
+ free (versioned_gettextdatadir);
+
+ its_locating_rules = locating_rule_list_alloc ();
+ for (i = 0; i < SIZEOF (its_dirs); i++)
+ locating_rule_list_add_directory (its_locating_rules, its_dirs[i]);
}
/* Determine extractor from language. */
if (language == NULL && its_locating_rules != NULL)
{
- char *its_filename = NULL;
-
- its_filename = locating_rule_list_locate (its_locating_rules,
- filename);
- if (its_filename != NULL)
+ const char *its_basename =
+ locating_rule_list_locate (its_locating_rules, filename);
+ if (its_basename != NULL)
{
+ size_t j;
+
its_rules = its_rule_list_alloc ();
- if (!its_rule_list_add_file (its_rules, its_filename))
+ for (j = 0; j < SIZEOF (its_dirs); j++)
+ {
+ char *its_filename =
+ xconcatenated_filename (its_dirs[j], its_basename,
+ NULL);
+ bool result =
+ its_rule_list_add_file (its_rules, its_filename);
+ free (its_filename);
+ if (result)
+ break;
+ }
+ if (j == SIZEOF (its_dirs))
{
its_rule_list_free (its_rules);
its_rules = NULL;
}
}
- free (its_filename);
}
if (its_rules == NULL)
if (its_locating_rules)
locating_rule_list_free (its_locating_rules);
+ for (i = 0; i < SIZEOF (its_dirs); i++)
+ free (its_dirs[i]);
+
exit (EXIT_SUCCESS);
}
# Variable needed by LTLIBINTL.
top_builddir=../..
+# Variable needed by xgettext.
+GETTEXTDATADIR="$top_builddir"
+
OBJEXT="@OBJEXT@"
EXEEXT="@EXEEXT@"
CC="@CC@"