Index: .fossil-settings/ignore-glob ================================================================== --- .fossil-settings/ignore-glob +++ .fossil-settings/ignore-glob @@ -25,5 +25,7 @@ libconfig.dll.def libconfig.so test-lc test-lc.exe test.cfg +libconfig.vers +libconfig.syms Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -34,15 +34,18 @@ # The following two lines need to be kept syncronised. OBJS = libconfig.o conf_space.o conf_section.o conf_apache.o conf_colon.o conf_equal.o conf_xml.o @LIBOBJS@ SHOBJS = libconfig_shr.o conf_space_shr.o conf_section_shr.o conf_apache_shr.o conf_colon_shr.o conf_equal_shr.o conf_xml_shr.o @SHLIBOBJS@ all: $(LIBS) $(BINS) -libconfig.$(SHOBJEXT): $(SHOBJS) - $(CC) $(CPPFLAGS) $(CFLAGS) $(SHOBJFLAGS) $(SHOBJLDFLAGS) -o $@ $^ $(LDFLAGS) + +libconfig.$(SHOBJEXT): $(SHOBJS) libconfig.vers libconfig.syms + $(CC) $(CPPFLAGS) $(CFLAGS) $(SHOBJFLAGS) $(SHOBJLDFLAGS) -o $@ $(SHOBJS) $(LDFLAGS) + -@WEAKENSYMS@ libconfig.$(SHOBJEXT) + -@REMOVESYMS@ libconfig.$(SHOBJEXT) libconfig.$(AREXT): $(OBJS) - $(AR) rcu $@ $^ + $(AR) rcu $@ $(OBJS) -$(RANLIB) $@ libconfig.o: $(srcdir)/libconfig.c $(srcdir)/compat.h $(srcdir)/win32.h $(srcdir)/config.h libconfig.h libconfig_shr.o: $(srcdir)/libconfig.c $(srcdir)/compat.h $(srcdir)/win32.h $(srcdir)/config.h libconfig.h @@ -49,10 +52,19 @@ %_shr.o: $(srcdir)/%.c $(CC) $(CPPFLAGS) $(CFLAGS) $(SHOBJFLAGS) -c -o $@ "$(filter %.c, $^)" %.o: $(srcdir)/%.c $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ "$(filter %.c, $^)" + +libconfig.vers: libconfig.syms.in + rm -f libconfig.vers + echo 'LIBCONFIG_0.3.0 {' > '$@' + echo ' global:' >> '$@' + cat libconfig.syms.in | sed 's/^@SYMPREFIX@//;s/^/ /;s/$$/;/' >> '$@' + echo ' local:' >> '$@' + echo ' *;' >> '$@' + echo '};' >> '$@' test-lc$(EXEEXT): $(LIBS) $(srcdir)/test-lc.c $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $(filter %.c, $^) $(LDFLAGS) -Wl,-R -Wl,. -L. -lconfig install: all libconfig.h @@ -80,11 +92,11 @@ clean: rm -f *.o $(BINS) $(LIBS) *~ test-lc$(EXEEXT) *.dll.a *.dll.def *.dll distclean: clean - rm -f Makefile config.h config.status config.log lc_geterrno.3 lc_process.3 lc_cleanup.3 lc_process_file.3 lc_register_var.3 lc_geterrstr.3 lc_register_callback.3 libconfig.3 + rm -f Makefile config.h config.status config.log lc_geterrno.3 lc_process.3 lc_cleanup.3 lc_process_file.3 lc_register_var.3 lc_geterrstr.3 lc_register_callback.3 libconfig.3 libconfig.syms mrproper: distclean rm -f aclocal.m4 config.guess config.sub install-sh configure .PHONY: all clean distclean install Index: aclocal/libconfig.m4 ================================================================== --- aclocal/libconfig.m4 +++ aclocal/libconfig.m4 @@ -48,5 +48,28 @@ DC_ASK_OPTLIB(opennet, fopen_net, opennet.h, [ Enable opennet support (auto)], libopennet, HAVE_LIBOPENNET, HAVE_OPENNET_H) else AC_DEFINE(ENABLE_SMALL, [1], [Define to 1 if you want to produce a minimalistic build.]) fi ]) + +AC_DEFUN(LC_SET_SONAME, [ + SAVE_LDFLAGS="$LDFLAGS" + + AC_MSG_CHECKING([how to specify soname]) + + for try in "-Wl,--soname,$1" '__fail__'; do + LDFLAGS="$SAVE_LDFLAGS" + + if test "${try}" = '__fail__'; then + AC_MSG_RESULT([can't]) + + break + fi + + LDFLAGS="${LDFLAGS} ${try}" + AC_TRY_LINK([void TestTest(void) { return; }], [], [ + AC_MSG_RESULT([$try]) + + break + ]) + done +]) Index: build/prep.sh ================================================================== --- build/prep.sh +++ build/prep.sh @@ -22,10 +22,13 @@ autoconf automake -fca rm -rf autom4te.cache +rm -f libconfig.vers +make -f Makefile.in libconfig.vers + # Add Linux/MUSL support if missing if ! grep '[-]musl' config.sub >/dev/null 2>/dev/null; then sed 's@\(-*\)linux-gnu\* @\1linux-musl | &@g' config.sub > config.sub.new cat config.sub.new > config.sub rm -f config.sub.new Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -37,9 +37,15 @@ AC_HEADER_TIME AC_REPLACE_FUNCS(strsep strtoll getuid) AC_CHECK_FUNCS(getpwuid strtof) +dnl Setup stable API +DC_SETUP_STABLE_API(libconfig.vers, libconfig.syms) + +dnl Set a soname +LC_SET_SONAME([libconfig.so.$PACKAGE_VERSION]) + dnl This MUST be last. DC_SYNC_SHLIBOBJS -AC_OUTPUT(Makefile lc_geterrno.3 lc_process.3 lc_register_var.3 lc_geterrstr.3 lc_seterrstr.3 lc_register_callback.3 lc_cleanup.3 lc_process_file.3 libconfig.3 lc_handle_type.3) +AC_OUTPUT(Makefile lc_geterrno.3 lc_process.3 lc_register_var.3 lc_geterrstr.3 lc_seterrstr.3 lc_register_callback.3 lc_cleanup.3 lc_process_file.3 libconfig.3 lc_handle_type.3 libconfig.syms) ADDED libconfig.syms.in Index: libconfig.syms.in ================================================================== --- /dev/null +++ libconfig.syms.in @@ -0,0 +1,21 @@ +@SYMPREFIX@lc_cleanup +@SYMPREFIX@lc_geterrno +@SYMPREFIX@lc_geterrstr +@SYMPREFIX@lc_handle_type +@SYMPREFIX@lc_process +@SYMPREFIX@lc_process_conf_apache +@SYMPREFIX@lc_process_conf_colon +@SYMPREFIX@lc_process_conf_equal +@SYMPREFIX@lc_process_conf_section +@SYMPREFIX@lc_process_conf_space +@SYMPREFIX@lc_process_conf_xml +@SYMPREFIX@lc_process_file +@SYMPREFIX@lc_process_var +@SYMPREFIX@lc_register_callback +@SYMPREFIX@lc_register_var +@SYMPREFIX@lc_seterrstr +@SYMPREFIX@lc_err_usererrmsg +@SYMPREFIX@lc_errfile +@SYMPREFIX@lc_errline +@SYMPREFIX@lc_errno +@SYMPREFIX@lc_optind