diff --git a/moo/Makefile.am b/moo/Makefile.am index 5734901..379ce8b 100644 --- a/moo/Makefile.am +++ b/moo/Makefile.am @@ -3,10 +3,16 @@ ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = -if ENABLE_STATIC_MODULE -SUBDIRS = libltdl mod lib +if ENABLE_LIBLTDL +SUBDIRS = libltdl else -SUBDIRS = libltdl lib mod +SUBDIRS = +endif + +if ENABLE_STATIC_MODULE +SUBDIRS += mod lib +else +SUBDIRS += lib mod endif DIST_SUBDIRS = $(SUBDIRS) diff --git a/moo/Makefile.in b/moo/Makefile.in index 44d6323..0d684ae 100644 --- a/moo/Makefile.in +++ b/moo/Makefile.in @@ -87,6 +87,8 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +@ENABLE_STATIC_MODULE_TRUE@am__append_1 = mod lib +@ENABLE_STATIC_MODULE_FALSE@am__append_2 = lib mod subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_namespace.m4 \ @@ -372,8 +374,8 @@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTION = foreign ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = -@ENABLE_STATIC_MODULE_FALSE@SUBDIRS = libltdl lib mod -@ENABLE_STATIC_MODULE_TRUE@SUBDIRS = libltdl mod lib +@ENABLE_LIBLTDL_FALSE@SUBDIRS = $(am__append_1) $(am__append_2) +@ENABLE_LIBLTDL_TRUE@SUBDIRS = libltdl $(am__append_1) $(am__append_2) DIST_SUBDIRS = $(SUBDIRS) all: all-recursive diff --git a/moo/configure b/moo/configure index 0055aae..37e6f08 100755 --- a/moo/configure +++ b/moo/configure @@ -656,6 +656,8 @@ MOO_SIZEOF_INT MOO_SIZEOF_LONG MOO_SIZEOF_LONG_LONG MOO_SIZEOF_WCHAR_T +ENABLE_LIBLTDL_FALSE +ENABLE_LIBLTDL_TRUE ENABLE_STATIC_MODULE_FALSE ENABLE_STATIC_MODULE_TRUE ENABLE_CXX_FALSE @@ -831,6 +833,7 @@ enable_ltdl_install enable_debug enable_cxx enable_static_module +enable_libltdl ' ac_precious_vars='build_alias host_alias @@ -1481,6 +1484,7 @@ Optional Features: available (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] @@ -18386,6 +18390,7 @@ fi LIBS="$save_LIBS" fi + if test "$ac_test_CFLAGS" != "set" then if test "$GCC" = "yes" @@ -20565,7 +20570,6 @@ else fi - test "${enable_shared}" = "no" -a "${enable_static}" = "yes" && enable_static_module_is="yes" if test "${enable_static_module_is}" = "yes" @@ -20583,6 +20587,30 @@ 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 + +$as_echo "#define MOO_ENABLE_LIBLTDL /**/" >>confdefs.h + +fi + if test "${enable_libltdl_is}" = "yes"; then + ENABLE_LIBLTDL_TRUE= + ENABLE_LIBLTDL_FALSE='#' +else + ENABLE_LIBLTDL_TRUE='#' + ENABLE_LIBLTDL_FALSE= +fi + + MOO_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t MOO_SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long @@ -20794,6 +20822,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/moo/configure.ac b/moo/configure.ac index 1fa08a3..0101258 100644 --- a/moo/configure.ac +++ b/moo/configure.ac @@ -65,6 +65,7 @@ if test "x$with_included_ltdl" != "xyes"; then LIBS="$save_LIBS" fi + dnl overrides the default CFLAGS setting if test "$ac_test_CFLAGS" != "set" then @@ -411,12 +412,12 @@ test "${ax_cv_cxx_have_std_namespace}" = "yes" || enable_cxx_is="no" AM_CONDITIONAL(ENABLE_CXX, test "${enable_cxx_is}" = "yes" ) +dnl ===== enable-static-module ===== AC_ARG_ENABLE([static-module], [AS_HELP_STRING([--enable-static-module],[build modules statically into the main library(default. no)])], enable_static_module_is=$enableval, enable_static_module_is=no ) - test "${enable_shared}" = "no" -a "${enable_static}" = "yes" && enable_static_module_is="yes" if test "${enable_static_module_is}" = "yes" @@ -425,6 +426,19 @@ 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 + AC_DEFINE([MOO_ENABLE_LIBLTDL],[],[use libltdl]) +fi +AM_CONDITIONAL(ENABLE_LIBLTDL, test "${enable_libltdl_is}" = "yes") + AC_SUBST(MOO_SIZEOF_WCHAR_T, $ac_cv_sizeof_wchar_t) AC_SUBST(MOO_SIZEOF_LONG_LONG, $ac_cv_sizeof_long_long) AC_SUBST(MOO_SIZEOF_LONG, $ac_cv_sizeof_long) diff --git a/moo/lib/comp.c b/moo/lib/comp.c index 0e2f340..e358d7c 100644 --- a/moo/lib/comp.c +++ b/moo/lib/comp.c @@ -5039,11 +5039,11 @@ static int compile_while_expression (moo_t* moo) } else if (prebbpos < postbbpos) { - /* emit code to pop the value pushed by the braced block */ + /* emit an instruction to pop the value pushed by the braced block */ if (emit_byte_instruction (moo, BCODE_POP_STACKTOP) <= -1) goto oops; } - /* emit code to jump back to the condition */ + /* emit an instruction to jump back to the condition */ if (emit_backward_jump_instruction (moo, BCODE_JUMP_BACKWARD_0, moo->c->mth.code.len - precondpos) <= -1) { if (moo->errnum == MOO_ERANGE) diff --git a/moo/lib/main.c b/moo/lib/main.c index de4019a..3e0d5d3 100644 --- a/moo/lib/main.c +++ b/moo/lib/main.c @@ -36,7 +36,7 @@ #if defined(_WIN32) # include # include -# if defined(MOO_HAVE_CFG_H) +# if defined(MOO_HAVE_CFG_H) && defined(MOO_ENABLE_LIBLTDL) # include # define USE_LTDL # endif @@ -53,8 +53,13 @@ # include #else # include -# include -# define USE_LTDL +# if defined(MOO_ENABLE_LIBLTDL) +# include +# define USE_LTDL +# else +# include +# error NOT IMPLEMENTED +# endif # if defined(HAVE_TIME_H) # include diff --git a/moo/lib/moo-cfg.h.in b/moo/lib/moo-cfg.h.in index e54e8a8..68778bb 100644 --- a/moo/lib/moo-cfg.h.in +++ b/moo/lib/moo-cfg.h.in @@ -323,6 +323,9 @@ /* Define to the shared archive member specification, say "(shr.o)". */ #undef LT_SHARED_LIB_MEMBER +/* use libltdl */ +#undef MOO_ENABLE_LIBLTDL + /* link modules statically into the main library */ #undef MOO_ENABLE_STATIC_MODULE