diff --git a/Makefile.in b/Makefile.in index 80c25ce..572b30e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -272,6 +272,7 @@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIPO = @LIPO@ LN_S = @LN_S@ +LTDL_LIBS = @LTDL_LIBS@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ diff --git a/configure b/configure index 6372c63..eb391fb 100755 --- a/configure +++ b/configure @@ -651,6 +651,8 @@ HCL_SIZEOF_LONG_LONG HCL_SIZEOF_CHAR32_T HCL_SIZEOF_CHAR16_T HCL_SIZEOF_WCHAR_T +ENABLE_LIBLTDL_FALSE +ENABLE_LIBLTDL_TRUE ENABLE_STATIC_MODULE_FALSE ENABLE_STATIC_MODULE_TRUE ENABLE_DYNAMIC_MODULE_FALSE @@ -663,6 +665,7 @@ PACKAGE_VERSION_MINOR PACKAGE_VERSION_MAJOR QUADMATH_LIBS UNICOWS_LIBS +LTDL_LIBS DL_LIBS LIBM WIN32_FALSE @@ -807,6 +810,7 @@ enable_unicode enable_cxx enable_dynamic_module enable_static_module +enable_libltdl ' ac_precious_vars='build_alias host_alias @@ -1460,6 +1464,7 @@ Optional Features: --enable-dynamic-module enable dynamic module capability(default. yes) --enable-static-module build modules statically into the main library(default. no) + --enable-libltdl use libltdl(default. yes) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -17528,7 +17533,7 @@ fi done -for ac_header in dlfcn.h sys/mman.h +for ac_header in dlfcn.h ltdl.h sys/mman.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -17683,6 +17688,72 @@ fi LIBS="$save_LIBS" +save_LIBS="$LIBS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing lt_dlopen" >&5 +$as_echo_n "checking for library containing lt_dlopen... " >&6; } +if ${ac_cv_search_lt_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char lt_dlopen (); +int +main () +{ +return lt_dlopen (); + ; + return 0; +} +_ACEOF +for ac_lib in '' ltdl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_lt_dlopen=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_lt_dlopen+:} false; then : + break +fi +done +if ${ac_cv_search_lt_dlopen+:} false; then : + +else + ac_cv_search_lt_dlopen=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_lt_dlopen" >&5 +$as_echo "$ac_cv_search_lt_dlopen" >&6; } +ac_res=$ac_cv_search_lt_dlopen +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + + LTDL_LIBS="$ac_cv_search_lt_dlopen" + if test "x${LTDL_LIBS}" = "xnone required" + then + LTDL_LIBS="" + fi + +fi + +LIBS="$save_LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lunicows" >&5 $as_echo_n "checking for main in -lunicows... " >&6; } if ${ac_cv_lib_unicows_main+:} false; then : @@ -19543,6 +19614,34 @@ else fi +# Check whether --enable-libltdl was given. +if test "${enable_libltdl+set}" = set; then : + enableval=$enable_libltdl; enable_libltdl_is=$enableval +else + enable_libltdl_is=yes + +fi + +if test "${enable_libltdl_is}" = "yes" +then + if test "${ac_cv_header_ltdl_h}" = "yes" -a "${LTDL_LIBS}" != "" + then + +$as_echo "#define HCL_ENABLE_LIBLTDL /**/" >>confdefs.h + + else + enable_libltdl_is="no" + fi +fi + if test "${enable_libltdl_is}" = "yes"; then + ENABLE_LIBLTDL_TRUE= + ENABLE_LIBLTDL_FALSE='#' +else + ENABLE_LIBLTDL_TRUE='#' + ENABLE_LIBLTDL_FALSE= +fi + + HCL_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t HCL_SIZEOF_CHAR16_T=$ac_cv_sizeof_char16_t @@ -19737,6 +19836,10 @@ if test -z "${ENABLE_STATIC_MODULE_TRUE}" && test -z "${ENABLE_STATIC_MODULE_FAL as_fn_error $? "conditional \"ENABLE_STATIC_MODULE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_LIBLTDL_TRUE}" && test -z "${ENABLE_LIBLTDL_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_LIBLTDL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 diff --git a/configure.ac b/configure.ac index d61275c..e56cf83 100644 --- a/configure.ac +++ b/configure.ac @@ -117,7 +117,7 @@ dnl check header files. AC_HEADER_STDC AC_CHECK_HEADERS([stddef.h wchar.h wctype.h errno.h signal.h fcntl.h dirent.h]) AC_CHECK_HEADERS([time.h sys/time.h utime.h spawn.h execinfo.h ucontext.h]) -AC_CHECK_HEADERS([dlfcn.h sys/mman.h]) +AC_CHECK_HEADERS([dlfcn.h ltdl.h sys/mman.h]) dnl check data types dnl AC_CHECK_TYPE([wchar_t], @@ -146,6 +146,17 @@ AC_SEARCH_LIBS([dlopen], [dl dld], [ LIBS="$save_LIBS" AC_SUBST(DL_LIBS) +save_LIBS="$LIBS" +AC_SEARCH_LIBS([lt_dlopen], [ltdl], [ + LTDL_LIBS="$ac_cv_search_lt_dlopen" + if test "x${LTDL_LIBS}" = "xnone required" + then + LTDL_LIBS="" + fi +]) +LIBS="$save_LIBS" +AC_SUBST(LTDL_LIBS) + dnl check is the import library for unicows.dll exists dnl this check doesn't look for a particular symbol dnl but for the symbol 'main' since i want to check @@ -479,6 +490,23 @@ then fi AM_CONDITIONAL(ENABLE_STATIC_MODULE, test "${enable_static_module_is}" = "yes") +dnl ===== enable-libltdl ===== +AC_ARG_ENABLE([libltdl], + [AS_HELP_STRING([--enable-libltdl],[use libltdl(default. yes)])], + enable_libltdl_is=$enableval, + enable_libltdl_is=yes +) +if test "${enable_libltdl_is}" = "yes" +then + if test "${ac_cv_header_ltdl_h}" = "yes" -a "${LTDL_LIBS}" != "" + then + AC_DEFINE([HCL_ENABLE_LIBLTDL],[],[use libltdl when loading a dynamic module]) + else + enable_libltdl_is="no" + fi +fi +AM_CONDITIONAL(ENABLE_LIBLTDL, test "${enable_libltdl_is}" = "yes") + AC_SUBST(HCL_SIZEOF_WCHAR_T, $ac_cv_sizeof_wchar_t) AC_SUBST(HCL_SIZEOF_CHAR16_T, $ac_cv_sizeof_char16_t) AC_SUBST(HCL_SIZEOF_CHAR32_T, $ac_cv_sizeof_char32_t) diff --git a/lib/Makefile.am b/lib/Makefile.am index b638113..9af14d6 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -20,12 +20,12 @@ CPPFLAGS_LIB_COMMON = $(CPPFLAGS_ALL_COMMON) LDFLAGS_LIB_COMMON = $(LDFLAGS_ALL_COMMON) -version-info 1:0:0 -no-undefined LIBADD_LIB_COMMON = $(LIBM) -#if ENABLE_LIBLTDL -#CPPFLAGS_LIB_COMMON += $(LTDLINCL) -#LIBADD_LIB_COMMON += $(LIBLTDL) -#else +if ENABLE_LIBLTDL +LIBADD_LIB_COMMON += $(LTDL_LIBS) +else LIBADD_LIB_COMMON += $(DL_LIBS) -#endif +endif + pkgincludedir = $(includedir) pkglibdir = $(libdir) diff --git a/lib/Makefile.in b/lib/Makefile.in index 7950239..173e60e 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -88,13 +88,15 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -@ENABLE_STATIC_MODULE_TRUE@am__append_1 = -lhcl-arr -lhcl-dic \ +@ENABLE_LIBLTDL_TRUE@am__append_1 = $(LTDL_LIBS) +@ENABLE_LIBLTDL_FALSE@am__append_2 = $(DL_LIBS) +@ENABLE_STATIC_MODULE_TRUE@am__append_3 = -lhcl-arr -lhcl-dic \ @ENABLE_STATIC_MODULE_TRUE@ -lhcl-str -@ENABLE_STATIC_MODULE_TRUE@am__append_2 = $(abs_builddir)/../mod/libhcl-arr.la \ +@ENABLE_STATIC_MODULE_TRUE@am__append_4 = $(abs_builddir)/../mod/libhcl-arr.la \ @ENABLE_STATIC_MODULE_TRUE@ $(abs_builddir)/../mod/libhcl-dic.la \ @ENABLE_STATIC_MODULE_TRUE@ $(abs_builddir)/../mod/libhcl-str.la bin_PROGRAMS = hcl$(EXEEXT) -@ENABLE_STATIC_MODULE_FALSE@hcl_DEPENDENCIES = $(am__DEPENDENCIES_2) +@ENABLE_STATIC_MODULE_FALSE@hcl_DEPENDENCIES = $(am__DEPENDENCIES_4) subdir = lib ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_namespace.m4 \ @@ -141,7 +143,10 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(pkgincludedir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) am__DEPENDENCIES_1 = -am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +@ENABLE_LIBLTDL_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) +@ENABLE_LIBLTDL_FALSE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) +am__DEPENDENCIES_4 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) am_libhcl_la_OBJECTS = libhcl_la-bigint.lo libhcl_la-comp.lo \ libhcl_la-debug.lo libhcl_la-decode.lo libhcl_la-dic.lo \ libhcl_la-err.lo libhcl_la-exec.lo libhcl_la-gc.lo \ @@ -228,7 +233,6 @@ CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/hcl-cfg.h.in \ $(top_srcdir)/ac/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -#endif pkgincludedir = $(includedir) pkglibdir = $(libdir) ACLOCAL = @ACLOCAL@ @@ -294,6 +298,7 @@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIPO = @LIPO@ LN_S = @LN_S@ +LTDL_LIBS = @LTDL_LIBS@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ @@ -391,12 +396,7 @@ CPPFLAGS_ALL_COMMON = \ ################################################## CPPFLAGS_LIB_COMMON = $(CPPFLAGS_ALL_COMMON) LDFLAGS_LIB_COMMON = $(LDFLAGS_ALL_COMMON) -version-info 1:0:0 -no-undefined - -#if ENABLE_LIBLTDL -#CPPFLAGS_LIB_COMMON += $(LTDLINCL) -#LIBADD_LIB_COMMON += $(LIBLTDL) -#else -LIBADD_LIB_COMMON = $(LIBM) $(DL_LIBS) +LIBADD_LIB_COMMON = $(LIBM) $(am__append_1) $(am__append_2) pkginclude_HEADERS = \ hcl-cfg.h \ hcl-cmn.h \ @@ -432,8 +432,8 @@ libhcl_la_SOURCES = \ libhcl_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) libhcl_la_LDFLAGS = $(LDFLAGS_LIB_COMMON) -libhcl_la_LIBADD = $(LIBADD_LIB_COMMON) $(am__append_1) -libhcl_la_DEPENDENCIES = $(am__append_2) +libhcl_la_LIBADD = $(LIBADD_LIB_COMMON) $(am__append_3) +libhcl_la_DEPENDENCIES = $(am__append_4) hcl_SOURCES = main.c hcl_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) hcl_LDFLAGS = $(LDFLAGS_LIB_COMMON) diff --git a/lib/hcl-cfg.h.in b/lib/hcl-cfg.h.in index 9390fe6..78cc570 100644 --- a/lib/hcl-cfg.h.in +++ b/lib/hcl-cfg.h.in @@ -87,6 +87,9 @@ /* Define to 1 if you have the `logq' function. */ #undef HAVE_LOGQ +/* Define to 1 if you have the header file. */ +#undef HAVE_LTDL_H + /* Define to 1 if you have the `makecontext' function. */ #undef HAVE_MAKECONTEXT @@ -234,6 +237,9 @@ /* enable dynamic module capability */ #undef HCL_ENABLE_DYNAMIC_MODULE +/* use libltdl when loading a dynamic module */ +#undef HCL_ENABLE_LIBLTDL + /* link modules statically into the main library */ #undef HCL_ENABLE_STATIC_MODULE diff --git a/mod/Makefile.in b/mod/Makefile.in index 4937a76..79f3629 100644 --- a/mod/Makefile.in +++ b/mod/Makefile.in @@ -295,6 +295,7 @@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIPO = @LIPO@ LN_S = @LN_S@ +LTDL_LIBS = @LTDL_LIBS@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@