Web lists-archives.com

Re: [MPlayer-dev-eng] [PATCH] configure: linking against static libraries is preferred on OS/2





Reimar Döffinger wrote:
> On Tue, Dec 02, 2014 at 12:16:39PM +0900, KO Myung-Hun wrote:
>> Hi/2.
>>
>> Reimar Döffinger wrote:
>>> On Mon, Dec 01, 2014 at 12:15:21PM +0900, KO Myung-Hun wrote:
>>>> ---
>>>>  configure | 5 ++++-
>>>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/configure b/configure
>>>> index fd2b115..81a2e18 100755
>>>> --- a/configure
>>>> +++ b/configure
>>>> @@ -4338,7 +4338,7 @@ fi #if linux
>>>>  echocheck "pkg-config"
>>>>  _pkg_config=pkg-config
>>>>  if $($_pkg_config --version > /dev/null 2>&1); then
>>>> -  if test "$ld_static"; then
>>>> +  if test "$ld_static" || os2 ; then
>>>>      _pkg_config="$_pkg_config --static"
>>>>    fi
>>>>    echores "yes"
>>>> @@ -8063,6 +8063,9 @@ echores "$_dvdnav"
>>>>  
>>>>  extra_ldflags="$extra_ldflags $libm"
>>>>  
>>>> +# Linking against static libraries is preferred on OS/2
>>>> +os2 && extra_ldflags="-Wl,-static $extra_ldflags"
>>>
>>> Why, what is special about OS/2 that it should default to static?
>>
>> Without this, OS/2 ld tries to link against DLLs. Then DLL hells wait
>> for us. I don't want to fall into those hells.
> 
> That isn't any different from Windows.
> 
>>> Especially compared to e.g. Windows (where people for distribution
>>> will basically always link statically, too).
>>
>> Even if they have both static and shared libraries ? And without any
>> additional flags ?
> 
> I mean, on Windows people have to explicitly specify if they want to
> use static libraries, and I just don't see a convincing reason why
> OS/2 should behave differently from everything else.
> There is both the option of not installing shared libraries and
> --enable-static, I am just not convinced the minor convenience
> of a different default is worth extra code and making OS/2 behave
> differently from everything else, including Windows.

First --enable-static does not work on OS/2. Because gcc with -static
fails at linking time. It's on purpose to prevent libc runtime from
being linked statically. Due to this, I tried this.

However, it would be better to fix --enable-static issues than forcing
to link statically.

I attach the updated patch.


-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr

>From 4a4286ba1d17d9510c0a00272556f80c0241ae49 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <komh@xxxxxxxxxxxx>
Date: Sun, 7 Dec 2014 21:01:15 +0900
Subject: [PATCH] configure: fix that linking with --enable-static fails on
 OS/2

On OS/2, passing -static to gcc fails at linking time because linking
statically against libc runtime is prevented on purpose. To avoid this,
pass -static to a linker directly.
And ensure that $ld_static should be at first in a library list because it
has effects only libraries after it.
---
 configure | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index fd2b115..20688ee 100755
--- a/configure
+++ b/configure
@@ -1812,6 +1812,12 @@ if os2 ; then
   def_dos_paths="#define HAVE_DOS_PATHS 1"
   def_priority="#define CONFIG_PRIORITY 1"
   def_path_max_check="#define CONFIG_PATH_MAX_CHECK 1"
+  # On OS/2, passing -static to gcc fails at linking time because linking
+  # statically against libc runtime is prevented on purpose. To avoid this,
+  # pass -static to a linker directly.
+  # And ensure that $ld_static should be at first in a library list because it
+  # has effects only libraries after it.
+  test -n "$ld_static" && ld_static='-Wl,-static'
 fi
 
 if wine ; then
@@ -8310,7 +8316,7 @@ CFLAGS_NO_OMIT_LEAF_FRAME_POINTER = $cflags_no_omit_leaf_frame_pointer
 CFLAGS_STACKREALIGN      = $cflags_stackrealign
 CFLAGS_SVGALIB_HELPER    = $cflags_svgalib_helper
 
-EXTRALIBS          = $extra_ldflags $ld_static $timer_libs $extra_libs
+EXTRALIBS          = $ld_static $extra_ldflags $timer_libs $extra_libs
 EXTRALIBS_MPLAYER  = $libs_mplayer
 EXTRALIBS_MENCODER = $libs_mencoder
 
-- 
1.8.5.2

_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng