+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <direntz.h>
+#include <idzebra/util.h>
+#include <idzebra/recctrl.h>
+
+struct recTypeClass {
+ RecType recType;
+ struct recTypeClass *next;
+ void *module_handle;
+};
+
+struct recTypeInstance {
+ RecType recType;
+ struct recTypeInstance *next;
+ int init_flag;
+ void *clientData;
+};
+
+struct recTypes {
+ data1_handle dh;
+ struct recTypeInstance *entries;
+};
+
+static void recTypeClass_add (struct recTypeClass **rts, RecType *rt,
+ NMEM nmem, void *module_handle);
+
+RecTypeClass recTypeClass_create (Res res, NMEM nmem)
+{
+ struct recTypeClass *rts = 0;
+ const char *module_path = res_get_def(res, "modulePath",
+ DEFAULT_MODULE_PATH);
+
+#ifdef IDZEBRA_STATIC_GRS_SGML
+ if (1)
+ {
+ extern RecType idzebra_filter_grs_sgml[];
+ recTypeClass_add (&rts, idzebra_filter_grs_sgml, nmem, 0);
+ }
+#endif
+#ifdef IDZEBRA_STATIC_TEXT
+ if (1)
+ {
+ extern RecType idzebra_filter_text[];
+ recTypeClass_add (&rts, idzebra_filter_text, nmem, 0);
+ }
+#endif
+#ifdef IDZEBRA_STATIC_GRS_XML
+#if HAVE_EXPAT_H
+ if (1)
+ {
+ extern RecType idzebra_filter_grs_xml[];
+ recTypeClass_add (&rts, idzebra_filter_grs_xml, nmem, 0);
+ }
+#endif
+#endif
+#ifdef IDZEBRA_STATIC_GRS_REGX
+ if (1)
+ {
+ extern RecType idzebra_filter_grs_regx[];
+ recTypeClass_add (&rts, idzebra_filter_grs_regx, nmem, 0);
+ }
+#endif
+#ifdef IDZEBRA_STATIC_GRS_MARC
+ if (1)
+ {
+ extern RecType idzebra_filter_grs_marc[];
+ recTypeClass_add (&rts, idzebra_filter_grs_marc, nmem, 0);
+ }
+#endif
+#ifdef IDZEBRA_STATIC_GRS_DANBIB
+ if (1)
+ {
+ extern RecType idzebra_filter_grs_danbib[];
+ recTypeClass_add (&rts, idzebra_filter_grs_danbib, nmem, 0);
+ }
+#endif
+#ifdef IDZEBRA_STATIC_SAFARI
+ if (1)
+ {
+ extern RecType idzebra_filter_safari[];
+ recTypeClass_add (&rts, idzebra_filter_safari, nmem, 0);
+ }
+#endif
+#ifdef IDZEBRA_STATIC_ALVIS
+#if HAVE_XSLT
+ if (1)
+ {
+ extern RecType idzebra_filter_alvis[];
+ recTypeClass_add (&rts, idzebra_filter_alvis, nmem, 0);
+ }
+#endif
+#endif
+#ifdef IDZEBRA_STATIC_XSLT
+#if HAVE_XSLT
+ if (1)
+ {
+ extern RecType idzebra_filter_xslt[];
+ recTypeClass_add (&rts, idzebra_filter_xslt, nmem, 0);
+ }
+#endif
+#endif
+
+#if HAVE_DLFCN_H
+ if (module_path)
+ {
+ DIR *dir = opendir(module_path);
+ yaz_log(YLOG_LOG, "searching filters in %s", module_path);
+ if (dir)
+ {
+ struct dirent *de;