Skip to content

Commit

Permalink
kkos#220: generate and install libonig.def file if LIBONIG_DEF_FILE v…
Browse files Browse the repository at this point in the history
…ariable is not empty
  • Loading branch information
kkos committed Oct 15, 2020
1 parent ec7a178 commit 619ae35
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
7 changes: 6 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,21 @@ AC_CONFIG_FILES([Makefile src/Makefile test/Makefile sample/Makefile onig-config
AC_CONFIG_COMMANDS([default],[chmod +x onig-config],[])

# for Issue #220
LIBONIG_DEF_FILE=
FIX_TO_LDFLAGS=
case $host_os in
cygwin* | mingw* )
if test X"$enable_shared" = Xyes; then
FIX_TO_LDFLAGS="-no-undefined -Wl,--output-def,libonig.def"
LIBONIG_DEF_FILE=libonig.def
FIX_TO_LDFLAGS="-no-undefined"
fi
;;
esac

EXTRA_LIBONIG_LDFLAGS="$EXTRA_LIBONIG_LDFLAGS $FIX_TO_LDFLAGS"
AC_SUBST(EXTRA_LIBONIG_LDFLAGS)

AM_CONDITIONAL(USE_LIBONIG_DEF_FILE, test -n "${LIBONIG_DEF_FILE}")
AC_SUBST(LIBONIG_DEF_FILE)

AC_OUTPUT
20 changes: 18 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,29 @@ libonig_la_SOURCES = regint.h regparse.h regenc.h st.h \
gb18030.c koi8_r.c cp1251.c \
onig_init.c

libonig_la_LDFLAGS = $(EXTRA_LIBONIG_LDFLAGS) -version-info $(LTVERSION)

EXTRA_DIST = koi8.c mktable.c \
unicode_fold_data.c unicode_property_data.c \
unicode_property_data_posix.c \
unicode_egcb_data.c unicode_wb_data.c


libonig_la_LDFLAGS = $(EXTRA_LIBONIG_LDFLAGS) -version-info $(LTVERSION)

if USE_LIBONIG_DEF_FILE

libonig_la_LDFLAGS += -Wl,--output-def,$(LIBONIG_DEF_FILE)

install-data-hook:
echo "$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_DATA) $(LIBONIG_DEF_FILE) $(DESTDIR)$(libdir)"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_DATA) $(LIBONIG_DEF_FILE) $(DESTDIR)$(libdir) || exit 1

uninstall-hook:
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$(LIBONIG_DEF_FILE)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$(LIBONIG_DEF_FILE)"

endif


dll:
$(CXX) -shared -Wl,--output-def,libonig.def -o libonig.dll *.o \
$(LIBS)
Expand Down

0 comments on commit 619ae35

Please sign in to comment.