[前][次][番号順一覧][スレッド一覧]

ruby-changes:50493

From: nobu <ko1@a...>
Date: Fri, 2 Mar 2018 10:37:58 +0900 (JST)
Subject: [ruby-changes:50493] nobu:r62627 (trunk): configure.ac: library options to MAINLIBS

nobu	2018-03-02 10:37:53 +0900 (Fri, 02 Mar 2018)

  New Revision: 62627

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62627

  Log:
    configure.ac: library options to MAINLIBS
    
    * configure.ac (MAINLIBS): moved library options for main program
      and static libruby, and append MAINLIBS to LIBRUBYARG_STATIC, as
      these libraries are not needed for linking to shared libruby.
      [ruby-core:85882] [Bug #14422]

  Modified files:
    trunk/configure.ac
    trunk/template/ruby.pc.in
    trunk/win32/Makefile.sub
Index: configure.ac
===================================================================
--- configure.ac	(revision 62626)
+++ configure.ac	(revision 62627)
@@ -18,6 +18,7 @@ AC_DISABLE_OPTION_CHECKING https://github.com/ruby/ruby/blob/trunk/configure.ac#L18
 AC_ARG_VAR([cflags], [additional CFLAGS])
 AC_ARG_VAR([cppflags], [additional CPPFLAGS])
 AC_ARG_VAR([cxxflags], [additional CXXFLAGS])
+ORIG_LIBS=$LIBS
 
 { # environment section
 
@@ -2245,13 +2246,11 @@ AS_IF([test x"$enable_pthread" = xyes], https://github.com/ruby/ruby/blob/trunk/configure.ac#L2246
 	AC_DEFINE(_THREAD_SAFE)
 	AC_DEFINE(HAVE_LIBPTHREAD)
 	AC_CHECK_HEADERS(pthread_np.h, [], [], [@%:@include <pthread.h>])
-	AS_CASE([$pthread_lib],
-	[c],    [],
-	[root], [],
-	[c_r],  [MAINLIBS="-pthread $MAINLIBS"],
-	        [AS_CASE(["$target_os"],
-		    [openbsd*|mirbsd*], [LIBS="-pthread $LIBS"],
-		    [LIBS="-l$pthread_lib $LIBS"])])
+	AS_CASE(["$pthread_lib:$target_os"],
+		[c:*], [],
+		[root:*], [],
+		[c_r:*|*:openbsd*|*:mirbsd*],  [LIBS="-pthread $LIBS"],
+		[LIBS="-l$pthread_lib $LIBS"])
     ], [
 	AC_MSG_WARN("Don't know how to find pthread library on your system -- thread support disabled")
     ])
@@ -2935,7 +2934,7 @@ LIBRUBY_A='lib$(RUBY_SO_NAME)-static.a' https://github.com/ruby/ruby/blob/trunk/configure.ac#L2934
 LIBRUBY='$(LIBRUBY_A)'
 LIBRUBYARG_STATIC='-l$(RUBY_SO_NAME)-static'
 LIBRUBYARG='$(LIBRUBYARG_STATIC)'
-SOLIBS=
+SOLIBS='$(MAINLIBS)'
 
 AS_CASE(["$target_os"],
   [cygwin*|mingw*|haiku*|darwin*], [
@@ -2999,9 +2998,6 @@ AS_CASE("$enable_shared", [yes], [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L2998
   LIBRUBY_RELATIVE=no
   test -z "$CCDLFLAGS" || CFLAGS="$CFLAGS $CCDLFLAGS"
   ENABLE_SHARED=yes
-  AS_IF([test "$rb_cv_binary_elf" = yes], [
-    SOLIBS='$(LIBS)'
-  ])
 
   # libdir can be overridden in config.site file (on OpenSUSE at least).
   libdir_basename=lib
@@ -3036,7 +3032,6 @@ AS_CASE("$enable_shared", [yes], [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L3032
 	])
 	],
     [freebsd*|dragonfly*], [
-	SOLIBS='$(LIBS)'
 	LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR)$(MINOR)'
 	LIBRUBY_SONAME='$(LIBRUBY_SO)'
 	AS_IF([test "$rb_cv_binary_elf" != "yes" ], [
@@ -3045,7 +3040,6 @@ AS_CASE("$enable_shared", [yes], [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L3040
 	])
 	],
     [netbsd*], [
-	SOLIBS='$(LIBS)'
 	LIBRUBY_SONAME='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR)$(MINOR)'
 	LIBRUBY_SO="${LIBRUBY_SONAME}"'.$(TEENY)'
 	RUBY_APPEND_OPTIONS(LIBRUBY_DLDFLAGS, ['-Wl,-soname,$(LIBRUBY_SONAME)' "$LDFLAGS_OPTDIR"])
@@ -3056,11 +3050,9 @@ AS_CASE("$enable_shared", [yes], [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L3050
 	])
 	],
     [openbsd*|mirbsd*], [
-	SOLIBS='$(LIBS)'
 	LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR).'`expr ${MINOR} \* 10 + ${TEENY}`
 	],
     [solaris*], [
-	SOLIBS='$(LIBS)'
 	LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR)'
 	LIBRUBY_SONAME='lib$(RUBY_SO_NAME).$(SOEXT).$(RUBY_PROGRAM_VERSION)'
 	LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_SO_NAME).$(SOEXT)'
@@ -3078,7 +3070,7 @@ AS_CASE("$enable_shared", [yes], [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L3070
     [aix*], [
 	RUBY_APPEND_OPTIONS(LIBRUBY_DLDFLAGS, ["${linker_flag}-bnoentry" "$XLDFLAGS" "$LDFLAGS_OPTDIR"])
 	LIBRUBYARG_SHARED='-L${libdir} -l${RUBY_SO_NAME}'
-	SOLIBS='-lm -lc'
+	LIBS="$LIBS -lm -lc"
 	],
     [darwin*], [
 	LIBRUBY_LDSHARED='$(CC) -dynamiclib'
@@ -3098,7 +3090,6 @@ AS_CASE("$enable_shared", [yes], [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L3090
 	LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT)'
 	LIBRUBY_SONAME='lib$(RUBY_BASE_NAME).$(RUBY_API_VERSION).$(SOEXT)'
 	LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_INSTALL_NAME).$(SOEXT)'
-	SOLIBS='$(LIBS)'
 	],
     [interix*], [
 	LIBRUBYARG_SHARED='-L. -L${libdir} -l$(RUBY_SO_NAME)'
@@ -3341,7 +3332,6 @@ AS_CASE(["$target_os"], https://github.com/ruby/ruby/blob/trunk/configure.ac#L3332
 	    ])
 	LIBRUBY_ALIASES=''
 	FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in
-	SOLIBS='$(LIBS)'
 	AS_IF([test x"$enable_shared" = xyes], [
 	    LIBRUBY='lib$(RUBY_SO_NAME).dll.a'
 	], [
@@ -3441,6 +3431,13 @@ AS_IF([test "${universal_binary-no}" = y https://github.com/ruby/ruby/blob/trunk/configure.ac#L3431
 		[rb_cv_architecture_available=yes], [rb_cv_architecture_available=no]))
 ])
 
+MAINLIBS="$LIBS"
+LIBS=$ORIG_LIBS
+AS_IF([test -n "${LIBS}"], [
+    libspat=`echo "${LIBS}" | sed 's/[[][|.*$^]]/\\&/g;s/^  */ /;s/^  *$/ /'`
+    MAINFLAGS=`echo " $MAINLIBS " | sed "s|$libspat"'||;s/^ *//;s/ *$//'`
+])
+LIBRUBYARG_STATIC="${LIBRUBYARG_STATIC} \$(MAINLIBS)"
 CPPFLAGS="$CPPFLAGS "'$(DEFS)'
 test -z "$CPPFLAGS" || CPPFLAGS="$CPPFLAGS "; CPPFLAGS="$CPPFLAGS"'${cppflags}'
 AS_IF([test -n "${cflags+set}"], [
Index: win32/Makefile.sub
===================================================================
--- win32/Makefile.sub	(revision 62626)
+++ win32/Makefile.sub	(revision 62627)
@@ -312,6 +312,7 @@ MJIT_DEBUGFLAGS = $(DEBUGFLAGS) https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L312
 !endif
 
 DLDFLAGS = $(LDFLAGS) -dll
+MAINLIBS = $(LIBS)
 SOLIBS =
 RCFILES = $(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(RUBY_SO_NAME).rc
 !ifndef RCFLAGS
@@ -865,7 +866,8 @@ s,@CPPFLAGS@,$(CPPFLAGS),;t t https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L866
 s,@CXXFLAGS@,$(CXXFLAGS),;t t
 s,@FFLAGS@,$(FFLAGS),;t t
 s,@LDFLAGS@,$(LDFLAGS),;t t
-s,@LIBS@,$(LIBS),;t t
+s,@LIBS@,,;t t
+s,@MAINLIBS@,$(MAINLIBS),;t t
 s,@exec_prefix@,$${prefix},;t t
 s,@prefix@,$(prefix),;t t
 s,@program_transform_name@,s,.*,$(PROGRAM_PREFIX)&$(PROGRAM_SUFFIX),,;t t
@@ -953,7 +955,7 @@ s,@LIBRUBY_SO@,$$(RUBY_SO_NAME).dll,;t t https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L955
 s,@LIBRUBY_ALIASES@,$(LIBRUBY_ALIASES),;t t
 s,@LIBRUBY@,$$(RUBY_SO_NAME).lib,;t t
 s,@LIBRUBYARG@,$$(LIBRUBYARG_SHARED),;t t
-s,@LIBRUBYARG_STATIC@,$$(LIBRUBY_A),;t t
+s,@LIBRUBYARG_STATIC@,$$(LIBRUBY_A) $$(MAINLIBS),;t t
 s,@LIBRUBYARG_SHARED@,$$(LIBRUBY),;t t
 s,@SOLIBS@,$(SOLIBS),;t t
 s,@DLDLIBS@,$(DLDLIBS),;t t
Index: template/ruby.pc.in
===================================================================
--- template/ruby.pc.in	(revision 62626)
+++ template/ruby.pc.in	(revision 62627)
@@ -38,6 +38,7 @@ sitehdrdir=@sitehdrdir@ https://github.com/ruby/ruby/blob/trunk/template/ruby.pc.in#L38
 rubyarchhdrdir=@rubyarchhdrdir@
 vendorarchhdrdir=@vendorarchhdrdir@
 sitearchhdrdir=@sitearchhdrdir@
+MAINLIBS=@MAINLIBS@
 SOEXT=@SOEXT@
 LIBPATH=@LIBPATH@
 LIBRUBY_A=@LIBRUBY_A@

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]