From d44b400c4a54af66ff6a76adb3d69c073bec93a5 Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Sun, 14 Oct 2018 10:14:48 +0000 Subject: [PATCH] fixed some build files --- moo/lib/Makefile.am | 12 +++++----- moo/lib/Makefile.in | 53 ++++++++++++++++++++++++--------------------- moo/lib/main.c | 14 ++++++------ moo/mod/Makefile.am | 13 ----------- moo/mod/Makefile.in | 46 ++++++++++++++++++--------------------- 5 files changed, 62 insertions(+), 76 deletions(-) diff --git a/moo/lib/Makefile.am b/moo/lib/Makefile.am index bbaea62..69f8928 100644 --- a/moo/lib/Makefile.am +++ b/moo/lib/Makefile.am @@ -34,13 +34,13 @@ endif if WIN32 # you must adjust the value of DEFAULT_MODPOSTFIX according # to the first number in -version-info above -CPPFLAGS_LIB_COMMON += -DMOO_DEFAULT_PFMODPREFIX=\"libmoo-\" -DMOO_DEFAULT_PFMODPOSTFIX=\"-1.dll\" +CPPFLAGS_PFMOD = -DMOO_DEFAULT_PFMODPREFIX=\"libmoo-\" -DMOO_DEFAULT_PFMODPOSTFIX=\"-1.dll\" else -CPPFLAGS_LIB_COMMON += -DMOO_DEFAULT_PFMODPREFIX=\"$(libdir)/libmoo-\" +CPPFLAGS_PFMOD = -DMOO_DEFAULT_PFMODPREFIX=\"$(libdir)/libmoo-\" if MACOSX -CPPFLAGS_LIB_COMMON += -DMOO_DEFAULT_PFMODPOSTFIX=\".dylib\" +CPPFLAGS_PFMOD += -DMOO_DEFAULT_PFMODPOSTFIX=\".dylib\" else -CPPFLAGS_LIB_COMMON += -DMOO_DEFAULT_PFMODPOSTFIX=\".so\" +CPPFLAGS_PFMOD += -DMOO_DEFAULT_PFMODPOSTFIX=\".so\" endif endif @@ -116,8 +116,8 @@ endif bin_PROGRAMS = moo moo_SOURCES = main.c -moo_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) -moo_LDFLAGS = $(LDFLAGS_LIB_COMMON) +moo_CPPFLAGS = $(CPPFLAGS_ALL_COMMON) $(CPPFLAGS_PFMOD) +moo_LDFLAGS = $(LDFLAGS_ALL_COMMON) moo_LDADD = $(LIBADD_LIB_COMMON) -lmoo $(PTHREAD_LIBS) if ENABLE_STATIC_MODULE moo_DEPENDENCIES = libmoo.la diff --git a/moo/lib/Makefile.in b/moo/lib/Makefile.in index eb0ca99..eaa3c4b 100644 --- a/moo/lib/Makefile.in +++ b/moo/lib/Makefile.in @@ -91,14 +91,9 @@ host_triplet = @host@ @ENABLE_LIBLTDL_TRUE@am__append_1 = $(LTDL_LIBS) @ENABLE_LIBLTDL_FALSE@am__append_2 = $(DL_LIBS) @ENABLE_LIBUNWIND_TRUE@am__append_3 = $(UNWIND_LIBS) - -# you must adjust the value of DEFAULT_MODPOSTFIX according -# to the first number in -version-info above -@WIN32_TRUE@am__append_4 = -DMOO_DEFAULT_PFMODPREFIX=\"libmoo-\" -DMOO_DEFAULT_PFMODPOSTFIX=\"-1.dll\" -@WIN32_FALSE@am__append_5 = -DMOO_DEFAULT_PFMODPREFIX=\"$(libdir)/libmoo-\" -@MACOSX_TRUE@@WIN32_FALSE@am__append_6 = -DMOO_DEFAULT_PFMODPOSTFIX=\".dylib\" -@MACOSX_FALSE@@WIN32_FALSE@am__append_7 = -DMOO_DEFAULT_PFMODPOSTFIX=\".so\" -@ENABLE_STATIC_MODULE_TRUE@am__append_8 = -lmoo-stdio +@MACOSX_TRUE@@WIN32_FALSE@am__append_4 = -DMOO_DEFAULT_PFMODPOSTFIX=\".dylib\" +@MACOSX_FALSE@@WIN32_FALSE@am__append_5 = -DMOO_DEFAULT_PFMODPOSTFIX=\".so\" +@ENABLE_STATIC_MODULE_TRUE@am__append_6 = -lmoo-stdio @ENABLE_STATIC_MODULE_FALSE@libmoo_la_DEPENDENCIES = \ @ENABLE_STATIC_MODULE_FALSE@ $(am__DEPENDENCIES_5) \ @ENABLE_STATIC_MODULE_FALSE@ $(am__DEPENDENCIES_1) \ @@ -106,14 +101,14 @@ host_triplet = @host@ @ENABLE_STATIC_MODULE_FALSE@ $(am__DEPENDENCIES_1) \ @ENABLE_STATIC_MODULE_FALSE@ $(am__DEPENDENCIES_1) \ @ENABLE_STATIC_MODULE_FALSE@ $(am__DEPENDENCIES_1) -@ENABLE_MOD_CON_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_9 = -lmoo-con -@ENABLE_MOD_CON_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_10 = $(abs_builddir)/../mod/libmoo-con.la -@ENABLE_MOD_FFI_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_11 = -lmoo-ffi -@ENABLE_MOD_FFI_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_12 = $(abs_builddir)/../mod/libmoo-ffi.la -@ENABLE_MOD_SCK_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_13 = -lmoo-sck -@ENABLE_MOD_SCK_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_14 = $(abs_builddir)/../mod/libmoo-sck.la -@ENABLE_MOD_X11_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_15 = -lmoo-x11 -@ENABLE_MOD_X11_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_16 = $(abs_builddir)/../mod/libmoo-x11.la +@ENABLE_MOD_CON_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_7 = -lmoo-con +@ENABLE_MOD_CON_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_8 = $(abs_builddir)/../mod/libmoo-con.la +@ENABLE_MOD_FFI_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_9 = -lmoo-ffi +@ENABLE_MOD_FFI_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_10 = $(abs_builddir)/../mod/libmoo-ffi.la +@ENABLE_MOD_SCK_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_11 = -lmoo-sck +@ENABLE_MOD_SCK_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_12 = $(abs_builddir)/../mod/libmoo-sck.la +@ENABLE_MOD_X11_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_13 = -lmoo-x11 +@ENABLE_MOD_X11_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_14 = $(abs_builddir)/../mod/libmoo-x11.la bin_PROGRAMS = moo$(EXEEXT) @ENABLE_STATIC_MODULE_FALSE@moo_DEPENDENCIES = $(am__DEPENDENCIES_5) \ @ENABLE_STATIC_MODULE_FALSE@ $(am__DEPENDENCIES_1) @@ -423,11 +418,19 @@ CPPFLAGS_ALL_COMMON = \ ################################################## # MAIN LIBRARY ################################################## -CPPFLAGS_LIB_COMMON = $(CPPFLAGS_ALL_COMMON) $(am__append_4) \ - $(am__append_5) $(am__append_6) $(am__append_7) +CPPFLAGS_LIB_COMMON = $(CPPFLAGS_ALL_COMMON) LDFLAGS_LIB_COMMON = $(LDFLAGS_ALL_COMMON) -version-info 1:0:0 -no-undefined LIBADD_LIB_COMMON = $(LIBM) $(am__append_1) $(am__append_2) \ $(am__append_3) +@WIN32_FALSE@CPPFLAGS_PFMOD = \ +@WIN32_FALSE@ -DMOO_DEFAULT_PFMODPREFIX=\"$(libdir)/libmoo-\" \ +@WIN32_FALSE@ $(am__append_4) $(am__append_5) + +# you must adjust the value of DEFAULT_MODPOSTFIX according +# to the first number in -version-info above +@WIN32_TRUE@CPPFLAGS_PFMOD = -DMOO_DEFAULT_PFMODPREFIX=\"libmoo-\" \ +@WIN32_TRUE@ -DMOO_DEFAULT_PFMODPOSTFIX=\"-1.dll\" \ +@WIN32_TRUE@ $(am__append_4) $(am__append_5) pkginclude_HEADERS = \ moo.h \ moo-bct.h \ @@ -472,15 +475,15 @@ libmoo_la_SOURCES = \ libmoo_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) libmoo_la_LDFLAGS = $(LDFLAGS_LIB_COMMON) -libmoo_la_LIBADD = $(LIBADD_LIB_COMMON) $(am__append_8) \ - $(am__append_9) $(am__append_11) $(am__append_13) \ - $(am__append_15) +libmoo_la_LIBADD = $(LIBADD_LIB_COMMON) $(am__append_6) \ + $(am__append_7) $(am__append_9) $(am__append_11) \ + $(am__append_13) @ENABLE_STATIC_MODULE_TRUE@libmoo_la_DEPENDENCIES = $(abs_builddir)/../mod/libmoo-stdio.la \ -@ENABLE_STATIC_MODULE_TRUE@ $(am__append_10) $(am__append_12) \ -@ENABLE_STATIC_MODULE_TRUE@ $(am__append_14) $(am__append_16) +@ENABLE_STATIC_MODULE_TRUE@ $(am__append_8) $(am__append_10) \ +@ENABLE_STATIC_MODULE_TRUE@ $(am__append_12) $(am__append_14) moo_SOURCES = main.c -moo_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) -moo_LDFLAGS = $(LDFLAGS_LIB_COMMON) +moo_CPPFLAGS = $(CPPFLAGS_ALL_COMMON) $(CPPFLAGS_PFMOD) +moo_LDFLAGS = $(LDFLAGS_ALL_COMMON) moo_LDADD = $(LIBADD_LIB_COMMON) -lmoo $(PTHREAD_LIBS) @ENABLE_STATIC_MODULE_TRUE@moo_DEPENDENCIES = libmoo.la all: moo-cfg.h diff --git a/moo/lib/main.c b/moo/lib/main.c index 4b803b3..5b6fdc0 100644 --- a/moo/lib/main.c +++ b/moo/lib/main.c @@ -358,6 +358,8 @@ static moo_mmgr_t sys_mmgr = # define IS_PATH_SEP(c) ((c) == '/') #endif +/* TODO: handle path with a drive letter or in the UNC notation */ +#define IS_PATH_ABSOLUTE(x) IS_PATH_SEP(x[0]) static const moo_bch_t* get_base_name (const moo_bch_t* path) { @@ -909,8 +911,10 @@ static void* dl_open (moo_t* moo, const moo_ooch_t* name, int flags) { moo_oow_t len, i, xlen, dlen; - /* opening a primitive function module - mostly libmoo-xxxx */ - dlen = moo_copy_bcstr(bufptr, bufcapa, MOO_DEFAULT_PFMODDIR); + /* opening a primitive function module - mostly libmoo-xxxx. + * if PFMODPREFIX is absolute, never use PFMODDIR */ + dlen = IS_PATH_ABSOLUTE(MOO_DEFAULT_PFMODPREFIX)? + 0: moo_copy_bcstr(bufptr, bufcapa, MOO_DEFAULT_PFMODDIR); len = moo_copy_bcstr(&bufptr[dlen], bufcapa - dlen, MOO_DEFAULT_PFMODPREFIX); len += dlen; @@ -939,11 +943,7 @@ static void* dl_open (moo_t* moo, const moo_ooch_t* name, int flags) { MOO_DEBUG3 (moo, "Unable to open(ext) PFMOD %hs[%js] - %hs\n", &bufptr[dlen], name, sys_dl_error()); - #if defined(_WIN32) || defined(__DOS__) || defined(__OS2__) - if (dlen > 0 && bufptr[len] != '/' && bufptr[len != '\\') - #else - if (dlen > 0 && bufptr[len] != '/') - #endif + if (dlen > 0) { handle = sys_dl_openext(&bufptr[0]); if (handle) goto pfmod_open_ok; diff --git a/moo/mod/Makefile.am b/moo/mod/Makefile.am index ee8fb61..75f79cf 100644 --- a/moo/mod/Makefile.am +++ b/moo/mod/Makefile.am @@ -9,19 +9,6 @@ CPPFLAGS_COMMON = \ -I$(abs_srcdir)/../lib \ -I$(includedir) -if WIN32 -# you must adjust the value of DEFAULT_MODPOSTFIX according -# to the first number in -version-info above -CPPFLAGS_COMMON += -DMOO_DEFAULT_PFMODPREFIX=\"libmoo-\" -DMOO_DEFAULT_PFMODPOSTFIX=\"-1.dll\" -else -CPPFLAGS_COMMON += -DMOO_DEFAULT_PFMODPREFIX=\"$(libdir)/libmoo-\" -if MACOSX -CPPFLAGS_COMMON += -DMOO_DEFAULT_PFMODPOSTFIX=\".dylib\" -else -CPPFLAGS_COMMON += -DMOO_DEFAULT_PFMODPOSTFIX=\".so\" -endif -endif - if ENABLE_STATIC_MODULE ################################################## diff --git a/moo/mod/Makefile.in b/moo/mod/Makefile.in index f144e9d..721f361 100644 --- a/moo/mod/Makefile.in +++ b/moo/mod/Makefile.in @@ -88,21 +88,14 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ - -# you must adjust the value of DEFAULT_MODPOSTFIX according -# to the first number in -version-info above -@WIN32_TRUE@am__append_1 = -DMOO_DEFAULT_PFMODPREFIX=\"libmoo-\" -DMOO_DEFAULT_PFMODPOSTFIX=\"-1.dll\" -@WIN32_FALSE@am__append_2 = -DMOO_DEFAULT_PFMODPREFIX=\"$(libdir)/libmoo-\" -@MACOSX_TRUE@@WIN32_FALSE@am__append_3 = -DMOO_DEFAULT_PFMODPOSTFIX=\".dylib\" -@MACOSX_FALSE@@WIN32_FALSE@am__append_4 = -DMOO_DEFAULT_PFMODPOSTFIX=\".so\" -@ENABLE_MOD_CON_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_5 = libmoo-con.la -@ENABLE_MOD_FFI_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_6 = libmoo-ffi.la -@ENABLE_MOD_SCK_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_7 = libmoo-sck.la -@ENABLE_MOD_X11_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_8 = libmoo-x11.la -@ENABLE_MOD_CON_TRUE@@ENABLE_STATIC_MODULE_FALSE@am__append_9 = libmoo-con.la -@ENABLE_MOD_FFI_TRUE@@ENABLE_STATIC_MODULE_FALSE@am__append_10 = libmoo-ffi.la -@ENABLE_MOD_SCK_TRUE@@ENABLE_STATIC_MODULE_FALSE@am__append_11 = libmoo-sck.la -@ENABLE_MOD_X11_TRUE@@ENABLE_STATIC_MODULE_FALSE@am__append_12 = libmoo-x11.la +@ENABLE_MOD_CON_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_1 = libmoo-con.la +@ENABLE_MOD_FFI_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_2 = libmoo-ffi.la +@ENABLE_MOD_SCK_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_3 = libmoo-sck.la +@ENABLE_MOD_X11_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_4 = libmoo-x11.la +@ENABLE_MOD_CON_TRUE@@ENABLE_STATIC_MODULE_FALSE@am__append_5 = libmoo-con.la +@ENABLE_MOD_FFI_TRUE@@ENABLE_STATIC_MODULE_FALSE@am__append_6 = libmoo-ffi.la +@ENABLE_MOD_SCK_TRUE@@ENABLE_STATIC_MODULE_FALSE@am__append_7 = libmoo-sck.la +@ENABLE_MOD_X11_TRUE@@ENABLE_STATIC_MODULE_FALSE@am__append_8 = libmoo-x11.la subdir = mod ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \ @@ -435,10 +428,13 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = nostdinc -CPPFLAGS_COMMON = -I$(abs_builddir) -I$(abs_builddir)/../lib \ - -I$(abs_srcdir) -I$(abs_srcdir)/../lib -I$(includedir) \ - $(am__append_1) $(am__append_2) $(am__append_3) \ - $(am__append_4) +CPPFLAGS_COMMON = \ + -I$(abs_builddir) \ + -I$(abs_builddir)/../lib \ + -I$(abs_srcdir) \ + -I$(abs_srcdir)/../lib \ + -I$(includedir) + ################################################## # DYNAMIC MODULES @@ -451,13 +447,13 @@ CPPFLAGS_COMMON = -I$(abs_builddir) -I$(abs_builddir)/../lib \ @ENABLE_STATIC_MODULE_TRUE@LDFLAGS_COMMON = -L$(libdir) -version-info 1:0:0 -no-undefined @ENABLE_STATIC_MODULE_FALSE@LIBADD_COMMON = -lmoo @ENABLE_STATIC_MODULE_TRUE@LIBADD_COMMON = -@ENABLE_STATIC_MODULE_TRUE@noinst_LTLIBRARIES = $(am__append_5) \ -@ENABLE_STATIC_MODULE_TRUE@ $(am__append_6) $(am__append_7) \ -@ENABLE_STATIC_MODULE_TRUE@ libmoo-stdio.la $(am__append_8) +@ENABLE_STATIC_MODULE_TRUE@noinst_LTLIBRARIES = $(am__append_1) \ +@ENABLE_STATIC_MODULE_TRUE@ $(am__append_2) $(am__append_3) \ +@ENABLE_STATIC_MODULE_TRUE@ libmoo-stdio.la $(am__append_4) @ENABLE_STATIC_MODULE_FALSE@pkgmodexecdir = $(libdir) -@ENABLE_STATIC_MODULE_FALSE@pkgmodexec_LTLIBRARIES = $(am__append_9) \ -@ENABLE_STATIC_MODULE_FALSE@ $(am__append_10) $(am__append_11) \ -@ENABLE_STATIC_MODULE_FALSE@ libmoo-stdio.la $(am__append_12) +@ENABLE_STATIC_MODULE_FALSE@pkgmodexec_LTLIBRARIES = $(am__append_5) \ +@ENABLE_STATIC_MODULE_FALSE@ $(am__append_6) $(am__append_7) \ +@ENABLE_STATIC_MODULE_FALSE@ libmoo-stdio.la $(am__append_8) @ENABLE_MOD_CON_TRUE@libmoo_con_la_SOURCES = _con.c _con.h @ENABLE_MOD_CON_TRUE@libmoo_con_la_CPPFLAGS = $(CPPFLAGS_COMMON) @ENABLE_MOD_CON_TRUE@libmoo_con_la_LDFLAGS = $(LDFLAGS_COMMON)