enhanced pfmod loading code

This commit is contained in:
hyung-hwan 2018-10-14 10:13:24 +00:00
parent 8459db3adc
commit 9e72cb1ca3
9 changed files with 201 additions and 85 deletions

View File

@ -354,7 +354,6 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@
@ -585,7 +584,7 @@ distdir: $(DISTFILES)
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)" || chmod -R a+r "$(distdir)"
dist-gzip: distdir dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
$(am__post_remove_distdir) $(am__post_remove_distdir)
dist-bzip2: distdir dist-bzip2: distdir
@ -611,7 +610,7 @@ dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \ @echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2 "deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
$(am__post_remove_distdir) $(am__post_remove_distdir)
dist-zip: distdir dist-zip: distdir
@ -629,7 +628,7 @@ dist dist-all:
distcheck: dist distcheck: dist
case '$(DIST_ARCHIVES)' in \ case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \ *.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \ *.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \ *.tar.lz*) \
@ -639,7 +638,7 @@ distcheck: dist
*.tar.Z*) \ *.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \ *.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \ *.zip*) \
unzip $(distdir).zip ;;\ unzip $(distdir).zip ;;\
esac esac

34
configure vendored
View File

@ -677,6 +677,8 @@ PTHREAD_LIBS
PTHREAD_CC PTHREAD_CC
ax_pthread_config ax_pthread_config
LIBM LIBM
MACOSX_FALSE
MACOSX_TRUE
WIN32_FALSE WIN32_FALSE
WIN32_TRUE WIN32_TRUE
LIBTOOL_DEPS LIBTOOL_DEPS
@ -782,7 +784,6 @@ infodir
docdir docdir
oldincludedir oldincludedir
includedir includedir
runstatedir
localstatedir localstatedir
sharedstatedir sharedstatedir
sysconfdir sysconfdir
@ -876,7 +877,6 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc' sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com' sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var' localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include' includedir='${prefix}/include'
oldincludedir='/usr/include' oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@ -1129,15 +1129,6 @@ do
| -silent | --silent | --silen | --sile | --sil) | -silent | --silent | --silen | --sile | --sil)
silent=yes ;; silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;; ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@ -1275,7 +1266,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \ datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir runstatedir libdir localedir mandir
do do
eval ac_val=\$$ac_var eval ac_val=\$$ac_var
# Remove trailing slashes. # Remove trailing slashes.
@ -1428,7 +1419,6 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var] --localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib] --libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include] --includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include] --oldincludedir=DIR C header files for non-gcc [/usr/include]
@ -17191,9 +17181,15 @@ case "$host" in
*-*-mingw*|*-*-cygwin*) *-*-mingw*|*-*-cygwin*)
#CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0400" #CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0400"
platform_win32=yes platform_win32=yes
platform_macosx=no
;;
*-*-darwin*)
platform_win32=no
platform_macosx=yes
;; ;;
*) *)
platform_win32=no platform_win32=no
platform_macosx=no
;; ;;
esac esac
if test "x${platform_win32}" = "xyes" ; then if test "x${platform_win32}" = "xyes" ; then
@ -17204,6 +17200,14 @@ else
WIN32_FALSE= WIN32_FALSE=
fi fi
if test "x${platform_macosx}" = "xyes" ; then
MACOSX_TRUE=
MACOSX_FALSE='#'
else
MACOSX_TRUE='#'
MACOSX_FALSE=
fi
LIBM= LIBM=
case $host in case $host in
@ -21444,6 +21448,10 @@ if test -z "${WIN32_TRUE}" && test -z "${WIN32_FALSE}"; then
as_fn_error $? "conditional \"WIN32\" was never defined. as_fn_error $? "conditional \"WIN32\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5 Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi fi
if test -z "${MACOSX_TRUE}" && test -z "${MACOSX_FALSE}"; then
as_fn_error $? "conditional \"MACOSX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ENABLE_CXX_TRUE}" && test -z "${ENABLE_CXX_FALSE}"; then if test -z "${ENABLE_CXX_TRUE}" && test -z "${ENABLE_CXX_FALSE}"; then
as_fn_error $? "conditional \"ENABLE_CXX\" was never defined. as_fn_error $? "conditional \"ENABLE_CXX\" was never defined.

View File

@ -69,12 +69,19 @@ case "$host" in
*-*-mingw*|*-*-cygwin*) *-*-mingw*|*-*-cygwin*)
#CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0400" #CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0400"
platform_win32=yes platform_win32=yes
platform_macosx=no
;;
*-*-darwin*)
platform_win32=no
platform_macosx=yes
;; ;;
*) *)
platform_win32=no platform_win32=no
platform_macosx=no
;; ;;
esac esac
AM_CONDITIONAL(WIN32, test "x${platform_win32}" = "xyes" ) AM_CONDITIONAL(WIN32, test "x${platform_win32}" = "xyes" )
AM_CONDITIONAL(MACOSX, test "x${platform_macosx}" = "xyes" )
dnl check the math library (check if -lm is needed) dnl check the math library (check if -lm is needed)
LT_LIB_M LT_LIB_M

View File

@ -32,6 +32,19 @@ if ENABLE_LIBUNWIND
LIBADD_LIB_COMMON += $(UNWIND_LIBS) LIBADD_LIB_COMMON += $(UNWIND_LIBS)
endif endif
if WIN32
# you must adjust the value of DEFAULT_MODPOSTFIX according
# to the first number in -version-info above
CPPFLAGS_PFMOD = -DHCL_DEFAULT_PFMODPREFIX=\"libmoo-\" -DHCL_DEFAULT_PFMODPOSTFIX=\"-1.dll\"
else
CPPFLAGS_PFMOD = -DHCL_DEFAULT_PFMODPREFIX=\"$(libdir)/libmoo-\"
if MACOSX
CPPFLAGS_PFMOD += -DHCL_DEFAULT_PFMODPOSTFIX=\".dylib\"
else
CPPFLAGS_PFMOD += -DHCL_DEFAULT_PFMODPOSTFIX=\".so\"
endif
endif
pkgincludedir = $(includedir) pkgincludedir = $(includedir)
pkglibdir = $(libdir) pkglibdir = $(libdir)
@ -89,8 +102,8 @@ endif
bin_PROGRAMS = hcl bin_PROGRAMS = hcl
hcl_SOURCES = main.c hcl_SOURCES = main.c
hcl_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) hcl_CPPFLAGS = $(CPPFLAGS_ALL_COMMON) $(CPPFLAGS_PFMOD)
hcl_LDFLAGS = $(LDFLAGS_LIB_COMMON) hcl_LDFLAGS = $(LDFLAGS_ALL_COMMON)
hcl_LDADD = $(LIBADD_LIB_COMMON) -lhcl hcl_LDADD = $(LIBADD_LIB_COMMON) -lhcl
hcl_DEPENDENCIES = libhcl.la hcl_DEPENDENCIES = libhcl.la
@ -103,29 +116,29 @@ libhclex_la_SOURCES = \
json.c hcl-json.h \ json.c hcl-json.h \
hcl-s.c hcl-s.h \ hcl-s.c hcl-s.h \
hcl-c.c hcl-c.h hcl-c.c hcl-c.h
libhclex_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) libhclex_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) $(CPPFLAGS_PFMOD)
libhclex_la_LDFLAGS = $(LDFLAGS_LIB_COMMON) libhclex_la_LDFLAGS = $(LDFLAGS_LIB_COMMON)
libhclex_la_LIBADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl libhclex_la_LIBADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl
libhclex_la_DEPENDENCIES = libhcl.la libhclex_la_DEPENDENCIES = libhcl.la
bin_PROGRAMS += hcls bin_PROGRAMS += hcls
hcls_SOURCES = main-s.c hcls_SOURCES = main-s.c
hcls_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) hcls_CPPFLAGS = $(CPPFLAGS_ALL_COMMON)
hcls_LDFLAGS = $(LDFLAGS_LIB_COMMON) hcls_LDFLAGS = $(LDFLAGS_ALL_COMMON)
hcls_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex hcls_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex
hcls_DEPENDENCIES = libhclex.la hcls_DEPENDENCIES = libhclex.la
bin_PROGRAMS += hclc bin_PROGRAMS += hclc
hclc_SOURCES = main-c.c hclc_SOURCES = main-c.c
hclc_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) hclc_CPPFLAGS = $(CPPFLAGS_ALL_COMMON)
hclc_LDFLAGS = $(LDFLAGS_LIB_COMMON) hclc_LDFLAGS = $(LDFLAGS_ALL_COMMON)
hclc_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex hclc_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex
hclc_DEPENDENCIES = libhclex.la hclc_DEPENDENCIES = libhclex.la
bin_PROGRAMS += hclj bin_PROGRAMS += hclj
hclj_SOURCES = main-j.c hclj_SOURCES = main-j.c
hclj_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) hclj_CPPFLAGS = $(CPPFLAGS_ALL_COMMON)
hclj_LDFLAGS = $(LDFLAGS_LIB_COMMON) hclj_LDFLAGS = $(LDFLAGS_ALL_COMMON)
hclj_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex hclj_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex
hclj_DEPENDENCIES = libhclex.la hclj_DEPENDENCIES = libhclex.la
endif endif

View File

@ -91,15 +91,17 @@ host_triplet = @host@
@ENABLE_LIBLTDL_TRUE@am__append_1 = $(LTDL_LIBS) @ENABLE_LIBLTDL_TRUE@am__append_1 = $(LTDL_LIBS)
@ENABLE_LIBLTDL_FALSE@am__append_2 = $(DL_LIBS) @ENABLE_LIBLTDL_FALSE@am__append_2 = $(DL_LIBS)
@ENABLE_LIBUNWIND_TRUE@am__append_3 = $(UNWIND_LIBS) @ENABLE_LIBUNWIND_TRUE@am__append_3 = $(UNWIND_LIBS)
@ENABLE_STATIC_MODULE_TRUE@am__append_4 = -lhcl-arr -lhcl-dic \ @MACOSX_TRUE@@WIN32_FALSE@am__append_4 = -DHCL_DEFAULT_PFMODPOSTFIX=\".dylib\"
@MACOSX_FALSE@@WIN32_FALSE@am__append_5 = -DHCL_DEFAULT_PFMODPOSTFIX=\".so\"
@ENABLE_STATIC_MODULE_TRUE@am__append_6 = -lhcl-arr -lhcl-dic \
@ENABLE_STATIC_MODULE_TRUE@ -lhcl-str @ENABLE_STATIC_MODULE_TRUE@ -lhcl-str
@ENABLE_STATIC_MODULE_TRUE@am__append_5 = $(abs_builddir)/../mod/libhcl-arr.la \ @ENABLE_STATIC_MODULE_TRUE@am__append_7 = $(abs_builddir)/../mod/libhcl-arr.la \
@ENABLE_STATIC_MODULE_TRUE@ $(abs_builddir)/../mod/libhcl-dic.la \ @ENABLE_STATIC_MODULE_TRUE@ $(abs_builddir)/../mod/libhcl-dic.la \
@ENABLE_STATIC_MODULE_TRUE@ $(abs_builddir)/../mod/libhcl-str.la @ENABLE_STATIC_MODULE_TRUE@ $(abs_builddir)/../mod/libhcl-str.la
bin_PROGRAMS = hcl$(EXEEXT) $(am__EXEEXT_1) bin_PROGRAMS = hcl$(EXEEXT) $(am__EXEEXT_1)
@ENABLE_HCLEX_TRUE@am__append_6 = libhclex.la @ENABLE_HCLEX_TRUE@am__append_8 = libhclex.la
@ENABLE_HCLEX_TRUE@am__append_7 = hcl-c.h hcl-s.h hcl-tmr.h hcl-xutl.h hcl-json.h @ENABLE_HCLEX_TRUE@am__append_9 = hcl-c.h hcl-s.h hcl-tmr.h hcl-xutl.h hcl-json.h
@ENABLE_HCLEX_TRUE@am__append_8 = hcls hclc hclj @ENABLE_HCLEX_TRUE@am__append_10 = hcls hclc hclj
subdir = lib subdir = lib
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \
@ -420,7 +422,6 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@
@ -446,9 +447,18 @@ CPPFLAGS_LIB_COMMON = $(CPPFLAGS_ALL_COMMON)
LDFLAGS_LIB_COMMON = $(LDFLAGS_ALL_COMMON) -version-info 1:0:0 -no-undefined LDFLAGS_LIB_COMMON = $(LDFLAGS_ALL_COMMON) -version-info 1:0:0 -no-undefined
LIBADD_LIB_COMMON = $(LIBM) $(am__append_1) $(am__append_2) \ LIBADD_LIB_COMMON = $(LIBM) $(am__append_1) $(am__append_2) \
$(am__append_3) $(am__append_3)
@WIN32_FALSE@CPPFLAGS_PFMOD = \
@WIN32_FALSE@ -DHCL_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 = -DHCL_DEFAULT_PFMODPREFIX=\"libmoo-\" \
@WIN32_TRUE@ -DHCL_DEFAULT_PFMODPOSTFIX=\"-1.dll\" \
@WIN32_TRUE@ $(am__append_4) $(am__append_5)
pkginclude_HEADERS = hcl.h hcl-cmn.h hcl-opt.h hcl-rbt.h hcl-utl.h \ pkginclude_HEADERS = hcl.h hcl-cmn.h hcl-opt.h hcl-rbt.h hcl-utl.h \
$(am__append_7) $(am__append_9)
pkglib_LTLIBRARIES = libhcl.la $(am__append_6) pkglib_LTLIBRARIES = libhcl.la $(am__append_8)
libhcl_la_SOURCES = \ libhcl_la_SOURCES = \
hcl.h \ hcl.h \
hcl-cmn.h \ hcl-cmn.h \
@ -482,11 +492,11 @@ libhcl_la_SOURCES = \
libhcl_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) libhcl_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON)
libhcl_la_LDFLAGS = $(LDFLAGS_LIB_COMMON) libhcl_la_LDFLAGS = $(LDFLAGS_LIB_COMMON)
libhcl_la_LIBADD = $(LIBADD_LIB_COMMON) $(am__append_4) libhcl_la_LIBADD = $(LIBADD_LIB_COMMON) $(am__append_6)
libhcl_la_DEPENDENCIES = $(am__append_5) libhcl_la_DEPENDENCIES = $(am__append_7)
hcl_SOURCES = main.c hcl_SOURCES = main.c
hcl_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) hcl_CPPFLAGS = $(CPPFLAGS_ALL_COMMON) $(CPPFLAGS_PFMOD)
hcl_LDFLAGS = $(LDFLAGS_LIB_COMMON) hcl_LDFLAGS = $(LDFLAGS_ALL_COMMON)
hcl_LDADD = $(LIBADD_LIB_COMMON) -lhcl hcl_LDADD = $(LIBADD_LIB_COMMON) -lhcl
hcl_DEPENDENCIES = libhcl.la hcl_DEPENDENCIES = libhcl.la
@ENABLE_HCLEX_TRUE@libhclex_la_SOURCES = \ @ENABLE_HCLEX_TRUE@libhclex_la_SOURCES = \
@ -496,23 +506,23 @@ hcl_DEPENDENCIES = libhcl.la
@ENABLE_HCLEX_TRUE@ hcl-s.c hcl-s.h \ @ENABLE_HCLEX_TRUE@ hcl-s.c hcl-s.h \
@ENABLE_HCLEX_TRUE@ hcl-c.c hcl-c.h @ENABLE_HCLEX_TRUE@ hcl-c.c hcl-c.h
@ENABLE_HCLEX_TRUE@libhclex_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) @ENABLE_HCLEX_TRUE@libhclex_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) $(CPPFLAGS_PFMOD)
@ENABLE_HCLEX_TRUE@libhclex_la_LDFLAGS = $(LDFLAGS_LIB_COMMON) @ENABLE_HCLEX_TRUE@libhclex_la_LDFLAGS = $(LDFLAGS_LIB_COMMON)
@ENABLE_HCLEX_TRUE@libhclex_la_LIBADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl @ENABLE_HCLEX_TRUE@libhclex_la_LIBADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl
@ENABLE_HCLEX_TRUE@libhclex_la_DEPENDENCIES = libhcl.la @ENABLE_HCLEX_TRUE@libhclex_la_DEPENDENCIES = libhcl.la
@ENABLE_HCLEX_TRUE@hcls_SOURCES = main-s.c @ENABLE_HCLEX_TRUE@hcls_SOURCES = main-s.c
@ENABLE_HCLEX_TRUE@hcls_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) @ENABLE_HCLEX_TRUE@hcls_CPPFLAGS = $(CPPFLAGS_ALL_COMMON)
@ENABLE_HCLEX_TRUE@hcls_LDFLAGS = $(LDFLAGS_LIB_COMMON) @ENABLE_HCLEX_TRUE@hcls_LDFLAGS = $(LDFLAGS_ALL_COMMON)
@ENABLE_HCLEX_TRUE@hcls_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex @ENABLE_HCLEX_TRUE@hcls_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex
@ENABLE_HCLEX_TRUE@hcls_DEPENDENCIES = libhclex.la @ENABLE_HCLEX_TRUE@hcls_DEPENDENCIES = libhclex.la
@ENABLE_HCLEX_TRUE@hclc_SOURCES = main-c.c @ENABLE_HCLEX_TRUE@hclc_SOURCES = main-c.c
@ENABLE_HCLEX_TRUE@hclc_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) @ENABLE_HCLEX_TRUE@hclc_CPPFLAGS = $(CPPFLAGS_ALL_COMMON)
@ENABLE_HCLEX_TRUE@hclc_LDFLAGS = $(LDFLAGS_LIB_COMMON) @ENABLE_HCLEX_TRUE@hclc_LDFLAGS = $(LDFLAGS_ALL_COMMON)
@ENABLE_HCLEX_TRUE@hclc_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex @ENABLE_HCLEX_TRUE@hclc_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex
@ENABLE_HCLEX_TRUE@hclc_DEPENDENCIES = libhclex.la @ENABLE_HCLEX_TRUE@hclc_DEPENDENCIES = libhclex.la
@ENABLE_HCLEX_TRUE@hclj_SOURCES = main-j.c @ENABLE_HCLEX_TRUE@hclj_SOURCES = main-j.c
@ENABLE_HCLEX_TRUE@hclj_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) @ENABLE_HCLEX_TRUE@hclj_CPPFLAGS = $(CPPFLAGS_ALL_COMMON)
@ENABLE_HCLEX_TRUE@hclj_LDFLAGS = $(LDFLAGS_LIB_COMMON) @ENABLE_HCLEX_TRUE@hclj_LDFLAGS = $(LDFLAGS_ALL_COMMON)
@ENABLE_HCLEX_TRUE@hclj_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex @ENABLE_HCLEX_TRUE@hclj_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex
@ENABLE_HCLEX_TRUE@hclj_DEPENDENCIES = libhclex.la @ENABLE_HCLEX_TRUE@hclj_DEPENDENCIES = libhclex.la
all: hcl-cfg.h all: hcl-cfg.h

View File

@ -72,6 +72,14 @@
# define sys_dl_openext(x) dlopen(x,RTLD_NOW) # define sys_dl_openext(x) dlopen(x,RTLD_NOW)
# define sys_dl_close(x) dlclose(x) # define sys_dl_close(x) dlclose(x)
# define sys_dl_getsym(x,n) dlsym(x,n) # define sys_dl_getsym(x,n) dlsym(x,n)
# elif defined(__APPLE__) || defined(__MACOSX__)
# define USE_MACH_O
# include <mach-o/dyld.h>
# define sys_dl_error() mach_dlerror()
# define sys_dl_open(x) mach_dlopen(x)
# define sys_dl_openext(x) mach_dlopen(x)
# define sys_dl_close(x) mach_dlclose(x)
# define sys_dl_getsym(x,n) mach_dlsym(x,n)
# else # else
# error UNSUPPORTED DYNAMIC LINKER # error UNSUPPORTED DYNAMIC LINKER
# endif # endif
@ -104,6 +112,10 @@
# include <poll.h> # include <poll.h>
#endif #endif
#if !defined(HCL_DEFAULT_PFMODDIR)
# define HCL_DEFAULT_PFMODDIR ""
#endif
#if !defined(HCL_DEFAULT_PFMODPREFIX) #if !defined(HCL_DEFAULT_PFMODPREFIX)
# if defined(_WIN32) # if defined(_WIN32)
# define HCL_DEFAULT_PFMODPREFIX "hcl-" # define HCL_DEFAULT_PFMODPREFIX "hcl-"
@ -126,6 +138,8 @@
# else # else
# if defined(USE_DLFCN) # if defined(USE_DLFCN)
# define HCL_DEFAULT_PFMODPOSTFIX ".so" # define HCL_DEFAULT_PFMODPOSTFIX ".so"
# elif defined(USE_MACH_O)
# define HCL_DEFAULT_PFMODPOSTFIX ".dylib"
# else # else
# define HCL_DEFAULT_PFMODPOSTFIX "" # define HCL_DEFAULT_PFMODPOSTFIX ""
# endif # endif
@ -360,6 +374,9 @@ struct hcl_server_t
# define PATH_SEP_CHAR ('/') # define PATH_SEP_CHAR ('/')
#endif #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 hcl_bch_t* get_base_name (const hcl_bch_t* path) static const hcl_bch_t* get_base_name (const hcl_bch_t* path)
{ {
@ -732,10 +749,76 @@ static void syserrstrb (hcl_t* hcl, int syserr, hcl_bch_t* buf, hcl_oow_t len)
} }
/* ========================================================================= */ /* ========================================================================= */
#if defined(USE_MACH_O)
static const char* mach_dlerror_str = "";
static void* mach_dlopen (const char* path)
{
NSObjectFileImage image;
NSObjectFileImageReturnCode rc;
void* handle;
mach_dlerror_str = "";
if ((rc = NSCreateObjectFileImageFromFile(path, &image)) != NSObjectFileImageSuccess)
{
switch (rc)
{
case NSObjectFileImageFailure:
case NSObjectFileImageFormat:
mach_dlerror_str = "unable to crate object file image";
break;
case NSObjectFileImageInappropriateFile:
mach_dlerror_str = "inappropriate file";
break;
case NSObjectFileImageArch:
mach_dlerror_str = "incompatible architecture";
break;
case NSObjectFileImageAccess:
mach_dlerror_str = "inaccessible file";
break;
default:
mach_dlerror_str = "unknown error";
break;
}
return HCL_NULL;
}
handle = (void*)NSLinkModule(image, path, NSLINKMODULE_OPTION_PRIVATE | NSLINKMODULE_OPTION_RETURN_ON_ERROR);
NSDestroyObjectFileImage (image);
return handle;
}
static HCL_INLINE void mach_dlclose (void* handle)
{
mach_dlerror_str = "";
NSUnLinkModule (handle, NSUNLINKMODULE_OPTION_NONE);
}
static HCL_INLINE void* mach_dlsym (void* handle, const char* name)
{
mach_dlerror_str = "";
return (void*)NSAddressOfSymbol(NSLookupSymbolInModule(handle, name));
}
static const char* mach_dlerror (void)
{
int err_no;
const char* err_file;
NSLinkEditErrors err;
if (mach_dlerror_str[0] == '\0')
NSLinkEditError (&err, &err_no, &err_file, &mach_dlerror_str);
return mach_dlerror_str;
}
#endif
static void* dl_open (hcl_t* hcl, const hcl_ooch_t* name, int flags) static void* dl_open (hcl_t* hcl, const hcl_ooch_t* name, int flags)
{ {
#if defined(USE_LTDL) || defined(USE_DLFCN) #if defined(USE_LTDL) || defined(USE_DLFCN) || defined(USE_MACH_O)
hcl_bch_t stabuf[128], * bufptr; hcl_bch_t stabuf[128], * bufptr;
hcl_oow_t ucslen, bcslen, bufcapa; hcl_oow_t ucslen, bcslen, bufcapa;
void* handle; void* handle;
@ -748,7 +831,7 @@ static void* dl_open (hcl_t* hcl, const hcl_ooch_t* name, int flags)
#else #else
bufcapa = hcl_count_bcstr(name); bufcapa = hcl_count_bcstr(name);
#endif #endif
bufcapa += HCL_COUNTOF(HCL_DEFAULT_PFMODPREFIX) + HCL_COUNTOF(HCL_DEFAULT_PFMODPOSTFIX) + 1; bufcapa += HCL_COUNTOF(HCL_DEFAULT_PFMODDIR) + HCL_COUNTOF(HCL_DEFAULT_PFMODPREFIX) + HCL_COUNTOF(HCL_DEFAULT_PFMODPOSTFIX) + 1;
if (bufcapa <= HCL_COUNTOF(stabuf)) bufptr = stabuf; if (bufcapa <= HCL_COUNTOF(stabuf)) bufptr = stabuf;
else else
@ -759,10 +842,14 @@ static void* dl_open (hcl_t* hcl, const hcl_ooch_t* name, int flags)
if (flags & HCL_VMPRIM_DLOPEN_PFMOD) if (flags & HCL_VMPRIM_DLOPEN_PFMOD)
{ {
hcl_oow_t len, i, xlen; hcl_oow_t len, i, xlen, dlen;
/* opening a primitive function module - mostly libhcl-xxxx */ /* opening a primitive function module - mostly libhcl-xxxx.
* if PFMODPREFIX is absolute, never use PFMODDIR */
dlen = IS_PATH_ABSOLUTE(HCL_DEFAULT_PFMODPREFIX)?
0: hcl_copy_bcstr(bufptr, bufcapa, HCL_DEFAULT_PFMODDIR);
len = hcl_copy_bcstr(bufptr, bufcapa, HCL_DEFAULT_PFMODPREFIX); len = hcl_copy_bcstr(bufptr, bufcapa, HCL_DEFAULT_PFMODPREFIX);
len += dlen;
bcslen = bufcapa - len; bcslen = bufcapa - len;
#if defined(HCL_OOCH_IS_UCH) #if defined(HCL_OOCH_IS_UCH)
@ -771,7 +858,7 @@ static void* dl_open (hcl_t* hcl, const hcl_ooch_t* name, int flags)
bcslen = hcl_copy_bcstr(&bufptr[len], bcslen, name); bcslen = hcl_copy_bcstr(&bufptr[len], bcslen, name);
#endif #endif
/* length including the prefix and the name. but excluding the postfix */ /* length including the directory, the prefix and the name. but excluding the postfix */
xlen = len + bcslen; xlen = len + bcslen;
for (i = len; i < xlen; i++) for (i = len; i < xlen; i++)
@ -787,7 +874,14 @@ static void* dl_open (hcl_t* hcl, const hcl_ooch_t* name, int flags)
handle = sys_dl_openext(bufptr); handle = sys_dl_openext(bufptr);
if (!handle) if (!handle)
{ {
HCL_DEBUG3 (hcl, "Failed to open(ext) DL %hs[%js] - %hs\n", bufptr, name, sys_dl_error()); HCL_DEBUG3 (hcl, "Unable to open(ext) PFMOD %hs[%js] - %hs\n", &bufptr[dlen], name, sys_dl_error());
if (dlen > 0)
{
handle = sys_dl_openext(&bufptr[0]);
if (handle) goto pfmod_open_ok;
HCL_DEBUG3 (hcl, "Unable to open(ext) PFMOD %hs[%js] - %hs\n", &bufptr[0], name, sys_dl_error());
}
/* try without prefix and postfix */ /* try without prefix and postfix */
bufptr[xlen] = '\0'; bufptr[xlen] = '\0';
@ -797,8 +891,8 @@ static void* dl_open (hcl_t* hcl, const hcl_ooch_t* name, int flags)
hcl_bch_t* dash; hcl_bch_t* dash;
const hcl_bch_t* dl_errstr; const hcl_bch_t* dl_errstr;
dl_errstr = sys_dl_error(); dl_errstr = sys_dl_error();
HCL_DEBUG3 (hcl, "Failed to open(ext) DL %hs[%js] - %hs\n", &bufptr[len], name, dl_errstr); HCL_DEBUG3 (hcl, "Unable to open(ext) PFMOD %hs[%js] - %hs\n", &bufptr[len], name, dl_errstr);
hcl_seterrbfmt (hcl, HCL_ESYSERR, "unable to open(ext) DL %js - %hs", name, dl_errstr); hcl_seterrbfmt (hcl, HCL_ESYSERR, "unable to open(ext) PFMOD %js - %hs", name, dl_errstr);
dash = hcl_rfind_bchar(bufptr, hcl_count_bcstr(bufptr), '-'); dash = hcl_rfind_bchar(bufptr, hcl_count_bcstr(bufptr), '-');
if (dash) if (dash)
@ -813,12 +907,13 @@ static void* dl_open (hcl_t* hcl, const hcl_ooch_t* name, int flags)
} }
else else
{ {
HCL_DEBUG3 (hcl, "Opened(ext) DL %hs[%js] handle %p\n", &bufptr[len], name, handle); HCL_DEBUG3 (hcl, "Opened(ext) PFMOD %hs[%js] handle %p\n", &bufptr[len], name, handle);
} }
} }
else else
{ {
HCL_DEBUG3 (hcl, "Opened(ext) DL %hs[%js] handle %p\n", bufptr, name, handle); pfmod_open_ok:
HCL_DEBUG3 (hcl, "Opened(ext) PFMOD %hs[%js] handle %p\n", &bufptr[dlen], name, handle);
} }
} }
else else
@ -838,7 +933,7 @@ static void* dl_open (hcl_t* hcl, const hcl_ooch_t* name, int flags)
{ {
const hcl_bch_t* dl_errstr; const hcl_bch_t* dl_errstr;
dl_errstr = sys_dl_error(); dl_errstr = sys_dl_error();
HCL_DEBUG2 (hcl, "Failed to open DL %hs - %hs\n", bufptr, dl_errstr); HCL_DEBUG2 (hcl, "Unable to open DL %hs - %hs\n", bufptr, dl_errstr);
hcl_seterrbfmt (hcl, HCL_ESYSERR, "unable to open DL %js - %hs", name, dl_errstr); hcl_seterrbfmt (hcl, HCL_ESYSERR, "unable to open DL %js - %hs", name, dl_errstr);
} }
else HCL_DEBUG2 (hcl, "Opened DL %hs handle %p\n", bufptr, handle); else HCL_DEBUG2 (hcl, "Opened DL %hs handle %p\n", bufptr, handle);
@ -850,7 +945,7 @@ static void* dl_open (hcl_t* hcl, const hcl_ooch_t* name, int flags)
{ {
const hcl_bch_t* dl_errstr; const hcl_bch_t* dl_errstr;
dl_errstr = sys_dl_error(); dl_errstr = sys_dl_error();
HCL_DEBUG2 (hcl, "Failed to open(ext) DL %hs - %s\n", bufptr, dl_errstr); HCL_DEBUG2 (hcl, "Unable to open(ext) DL %hs - %s\n", bufptr, dl_errstr);
hcl_seterrbfmt (hcl, HCL_ESYSERR, "unable to open(ext) DL %js - %hs", name, dl_errstr); hcl_seterrbfmt (hcl, HCL_ESYSERR, "unable to open(ext) DL %js - %hs", name, dl_errstr);
} }
else HCL_DEBUG2 (hcl, "Opened(ext) DL %hs handle %p\n", bufptr, handle); else HCL_DEBUG2 (hcl, "Opened(ext) DL %hs handle %p\n", bufptr, handle);
@ -872,7 +967,7 @@ static void* dl_open (hcl_t* hcl, const hcl_ooch_t* name, int flags)
static void dl_close (hcl_t* hcl, void* handle) static void dl_close (hcl_t* hcl, void* handle)
{ {
#if defined(USE_LTDL) || defined(USE_DLFCN) #if defined(USE_LTDL) || defined(USE_DLFCN) || defined(USE_MACH_O)
HCL_DEBUG1 (hcl, "Closed DL handle %p\n", handle); HCL_DEBUG1 (hcl, "Closed DL handle %p\n", handle);
sys_dl_close (handle); sys_dl_close (handle);
@ -884,7 +979,7 @@ static void dl_close (hcl_t* hcl, void* handle)
static void* dl_getsym (hcl_t* hcl, void* handle, const hcl_ooch_t* name) static void* dl_getsym (hcl_t* hcl, void* handle, const hcl_ooch_t* name)
{ {
#if defined(USE_LTDL) || defined(USE_DLFCN) #if defined(USE_LTDL) || defined(USE_DLFCN) || defined(USE_MACH_O)
hcl_bch_t stabuf[64], * bufptr; hcl_bch_t stabuf[64], * bufptr;
hcl_oow_t bufcapa, ucslen, bcslen, i; hcl_oow_t bufcapa, ucslen, bcslen, i;
const hcl_bch_t* symname; const hcl_bch_t* symname;

View File

@ -210,6 +210,8 @@ static hcl_mmgr_t sys_mmgr =
# define IS_PATH_SEP(c) ((c) == '/') # define IS_PATH_SEP(c) ((c) == '/')
#endif #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 hcl_bch_t* get_base_name (const hcl_bch_t* path) static const hcl_bch_t* get_base_name (const hcl_bch_t* path)
{ {
@ -843,14 +845,6 @@ static const char* mach_dlerror (void)
} }
#endif #endif
#if defined(_WIN32) || defined(__DOS__) || defined(__OS2__)
/* TODO: handle drive letter and UNC notations? */
# define IS_PATH_ABSOLUTE(x) (x[0] == '/' || x[0] == '\\')
#else
# define IS_PATH_ABSOLUTE(x) (x[0] == '/')
#endif
static void* dl_open (hcl_t* hcl, const hcl_ooch_t* name, int flags) static void* dl_open (hcl_t* hcl, const hcl_ooch_t* name, int flags)
{ {
#if defined(USE_LTDL) || defined(USE_DLFCN) || defined(USE_MACH_O) #if defined(USE_LTDL) || defined(USE_DLFCN) || defined(USE_MACH_O)

View File

@ -9,14 +9,6 @@ CPPFLAGS_COMMON = \
-I$(abs_srcdir)/../lib \ -I$(abs_srcdir)/../lib \
-I$(includedir) -I$(includedir)
if WIN32
# you must adjust the value of DEFAULT_PFMODPOSTFIX according
# to the first number in -version-info above
CPPFLAGS_COMMON += -DHCL_DEFAULT_PFMODPREFIX=\"libhcl-\" -DHCL_DEFAULT_PFMODPOSTFIX=\"-1\"
else
CPPFLAGS_COMMON += -DHCL_DEFAULT_PFMODPREFIX=\"$(libdir)/libhcl-\" -DHCL_DEFAULT_PFMODPOSTFIX=\"\"
endif
if ENABLE_STATIC_MODULE if ENABLE_STATIC_MODULE
################################################## ##################################################

View File

@ -88,11 +88,6 @@ PRE_UNINSTALL = :
POST_UNINSTALL = : POST_UNINSTALL = :
build_triplet = @build@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
# you must adjust the value of DEFAULT_PFMODPOSTFIX according
# to the first number in -version-info above
@WIN32_TRUE@am__append_1 = -DHCL_DEFAULT_PFMODPREFIX=\"libhcl-\" -DHCL_DEFAULT_PFMODPOSTFIX=\"-1\"
@WIN32_FALSE@am__append_2 = -DHCL_DEFAULT_PFMODPREFIX=\"$(libdir)/libhcl-\" -DHCL_DEFAULT_PFMODPOSTFIX=\"\"
subdir = mod subdir = mod
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \
@ -377,7 +372,6 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@
@ -387,9 +381,13 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = nostdinc AUTOMAKE_OPTIONS = nostdinc
CPPFLAGS_COMMON = -I$(abs_builddir) -I$(abs_builddir)/../lib \ CPPFLAGS_COMMON = \
-I$(abs_srcdir) -I$(abs_srcdir)/../lib -I$(includedir) \ -I$(abs_builddir) \
$(am__append_1) $(am__append_2) -I$(abs_builddir)/../lib \
-I$(abs_srcdir) \
-I$(abs_srcdir)/../lib \
-I$(includedir)
################################################## ##################################################
# DYNAMIC MODULES # DYNAMIC MODULES