diff options
Diffstat (limited to 'buildlib')
-rw-r--r-- | buildlib/environment.mak.in | 2 | ||||
-rw-r--r-- | buildlib/library.mak | 18 | ||||
-rw-r--r-- | buildlib/tools.m4 | 45 |
3 files changed, 56 insertions, 9 deletions
diff --git a/buildlib/environment.mak.in b/buildlib/environment.mak.in index 76d6cda32..9ec0f4b41 100644 --- a/buildlib/environment.mak.in +++ b/buildlib/environment.mak.in @@ -7,6 +7,8 @@ CPPFLAGS+= @CPPFLAGS@ @DEFS@ -D_REENTRANT CXX = @CXX@ CXXFLAGS+= @CXXFLAGS@ NUM_PROCS = @NUM_PROCS@ +GLIBC_VER = @GLIBC_VER@ +LIBSTDCPP_VER = @LIBSTDCPP_VER@ # Linker stuff PICFLAGS+= -fPIC -DPIC diff --git a/buildlib/library.mak b/buildlib/library.mak index 229479fa2..fb944cfbc 100644 --- a/buildlib/library.mak +++ b/buildlib/library.mak @@ -15,17 +15,17 @@ # See defaults.mak for information about LOCAL # Some local definitions -LOCAL := lib$(LIBRARY).so.$(MAJOR).$(MINOR) +LOCAL := lib$(LIBRARY)$(LIBEXT).so.$(MAJOR).$(MINOR) $(LOCAL)-OBJS := $(addprefix $(OBJ)/,$(addsuffix .opic,$(notdir $(basename $(SOURCE))))) $(LOCAL)-DEP := $(addprefix $(DEP)/,$(addsuffix .opic.d,$(notdir $(basename $(SOURCE))))) $(LOCAL)-HEADERS := $(addprefix $(INCLUDE)/,$(HEADERS)) -$(LOCAL)-SONAME := lib$(LIBRARY).so.$(MAJOR) +$(LOCAL)-SONAME := lib$(LIBRARY)$(LIBEXT).so.$(MAJOR) $(LOCAL)-SLIBS := $(SLIBS) $(LOCAL)-LIBRARY := $(LIBRARY) # Install the command hooks headers: $($(LOCAL)-HEADERS) -library: $(LIB)/lib$(LIBRARY).so $(LIB)/lib$(LIBRARY).so.$(MAJOR) +library: $(LIB)/lib$(LIBRARY).so $(LIB)/lib$(LIBRARY)$(LIBEXT).so.$(MAJOR) clean: clean/$(LOCAL) veryclean: veryclean/$(LOCAL) @@ -37,18 +37,18 @@ MKDIRS += $(OBJ) $(DEP) $(LIB) $(dir $($(LOCAL)-HEADERS)) clean/$(LOCAL): -rm -f $($(@F)-OBJS) $($(@F)-DEP) veryclean/$(LOCAL): clean/$(LOCAL) - -rm -f $($(@F)-HEADERS) $(LIB)/lib$($(@F)-LIBRARY).so* + -rm -f $($(@F)-HEADERS) $(LIB)/lib$($(@F)-LIBRARY)*.so* # Build rules for the two symlinks -.PHONY: $(LIB)/lib$(LIBRARY).so.$(MAJOR) $(LIB)/lib$(LIBRARY).so -$(LIB)/lib$(LIBRARY).so.$(MAJOR): $(LIB)/lib$(LIBRARY).so.$(MAJOR).$(MINOR) +.PHONY: $(LIB)/lib$(LIBRARY)$(LIBEXT).so.$(MAJOR) $(LIB)/lib$(LIBRARY).so +$(LIB)/lib$(LIBRARY)$(LIBEXT).so.$(MAJOR): $(LIB)/lib$(LIBRARY)$(LIBEXT).so.$(MAJOR).$(MINOR) ln -sf $(<F) $@ -$(LIB)/lib$(LIBRARY).so: $(LIB)/lib$(LIBRARY).so.$(MAJOR).$(MINOR) +$(LIB)/lib$(LIBRARY).so: $(LIB)/lib$(LIBRARY)$(LIBEXT).so.$(MAJOR).$(MINOR) ln -sf $(<F) $@ # The binary build rule -$(LIB)/lib$(LIBRARY).so.$(MAJOR).$(MINOR): $($(LOCAL)-HEADERS) $($(LOCAL)-OBJS) - -rm -f $(LIB)/lib$($(@F)-LIBRARY).so* 2> /dev/null +$(LIB)/lib$(LIBRARY)$(LIBEXT).so.$(MAJOR).$(MINOR): $($(LOCAL)-HEADERS) $($(LOCAL)-OBJS) + -rm -f $(LIB)/lib$($(@F)-LIBRARY)*.so* 2> /dev/null echo Building shared library $@ $(CXX) $(CXXFLAGS) $(LDFLAGS) $(PICFLAGS) $(LFLAGS) $(LFLAGS_SO)\ -o $@ $(SONAME_MAGIC)$($(@F)-SONAME) -shared \ diff --git a/buildlib/tools.m4 b/buildlib/tools.m4 index d47d79e7e..281a4ec1d 100644 --- a/buildlib/tools.m4 +++ b/buildlib/tools.m4 @@ -88,3 +88,48 @@ AC_DEFUN(ah_NUM_PROCS, AC_MSG_RESULT([$NUM_PROCS]) AC_SUBST(NUM_PROCS) ]) + +AC_DEFUN(ah_GLIBC_VER, + [AC_MSG_CHECKING([glibc version]) + dummy=if$$ + cat <<_GLIBC_>$dummy.c +#include <features.h> +#include <stdio.h> +int main(int argc, char **argv) { printf("libc6.%d",__GLIBC_MINOR__); exit(0); } +_GLIBC_ + ${CC-cc} $dummy.c -o $dummy + if test "$?" = 0; then + GLIBC_VER=`./$dummy` + AC_MSG_RESULT([$GLIBC_VER]) + GLIBC_VER="-$GLIBC_VER" + else + AC_MSG_WARN([cannot determine GNU C library minor version number]) + fi + rm -f $dummy $dummy.c + AC_SUBST(GLIBC_VER) +]) + +AC_DEFUN(ah_LIBSTDCPP_VER, + [AC_MSG_CHECKING([libstdc++ version]) + dummy=if$$ + cat <<_LIBSTDCPP_>$dummy.cc +#include <features.h> +#include <stdio.h> +int main(int argc, char **argv) { exit(0); } +_LIBSTDCPP_ + ${CXX-c++} $dummy.cc -o $dummy + + if test "$?" = 0; then + soname=`objdump -p ./$dummy |grep NEEDED|grep libstd` + LIBSTDCPP_VER=`echo $soname | sed -e 's/.*NEEDED.*libstdc++-libc.*-\(.*\).so.\(.*\)/\2-\1/'` + fi + rm -f $dummy $dummy.cc + + if test -z "$LIBSTDCPP_VER"; then + AC_MSG_WARN([cannot determine standard C++ library version number]) + else + AC_MSG_RESULT([$LIBSTDCPP_VER]) + LIBSTDCPP_VER="-$LIBSTDCPP_VER" + fi + AC_SUBST(LIBSTDCPP_VER) +]) |