develooper Front page | perl.perl5.porters | Postings from March 2016

[Cygwin] Configure

From:
Achim Gratz
Date:
March 20, 2016 19:45
Subject:
[Cygwin] Configure
Message ID:
87shzlkk76.fsf@Rainer.invalid

I've been chasing an omission of a library that was correctly installed
on my system and realized that the library check doesn't work as
intended on Cygwin.  The issue here is how ld searches for libraries
vs. the search algorithm of Configure.  The search order for ld is
described here:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/win32.html

The salient part is this:

--8<---------------cut here---------------start------------->8---
libxxx.dll.a
xxx.dll.a
libxxx.a
cygxxx.dll (*)
libxxx.dll
xxx.dll

(*) Actually, this is not cygxxx.dll but in fact is <prefix>xxx.dll,
where <prefix> is set by the ld option -dll-search-prefix=<prefix>. In
the case of cygwin, the standard gcc spec file includes
-dll-search-prefix=cyg, so in effect we actually search for cygxxx.dll.
--8<---------------cut here---------------end--------------->8---

The patch inlined below (which is likely unsuitable as a general fix
because on other systems the ld search doesn't work like on Cygwin)
solves this problem for me (with setting ignore_versioned_solibs='true'
and libprefix='cyg' in cygwin.sh).

--8<---------------cut here---------------start------------->8---
--- origsrc/perl-5.22.1/Configure.orig
+++ src/perl-5.22.1/Configure
@@ -325,14 +325,15 @@
 sysroot=''
 _a=''
 _exe=''
 _o=''
 archobjs=''
 exe_ext=''
 firstmakefile=''
+libprefix='lib'
 lib_ext=''
 obj_ext=''
 path_sep=''
 rm_try=''
 afs=''
 afsroot=''
 alignbytes=''
@@ -5235,37 +5236,52 @@
 libspath=''
 for thisdir in $libpth $xlibpth; do
   test -d $thisdir && libspath="$libspath $thisdir"
 done
 for thislib in $libswanted; do
 	for thisdir in $libspath; do
 	    xxx=''
-	    if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
-		xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
-	        $test -f "$xxx" && eval $libscheck
-		$test -f "$xxx" && libstyle=shared
-		xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
-	        $test -f "$xxx" && eval $libscheck
-		$test -f "$xxx" && libstyle=shared
-	    fi
-	    if test ! -f "$xxx"; then
-		xxx=$thisdir/lib$thislib.$so
-	        $test -f "$xxx" && eval $libscheck
-		$test -f "$xxx" && libstyle=shared
-	    fi
-	    if test ! -f "$xxx"; then
-		xxx=$thisdir/lib$thislib$_a
-	        $test -f "$xxx" && eval $libscheck
-		$test -f "$xxx" && libstyle=static
-	    fi
-	    if test ! -f "$xxx"; then
-		xxx=$thisdir/$thislib$_a
-	        $test -f "$xxx" && eval $libscheck
-		$test -f "$xxx" && libstyle=static
-	    fi
+           if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
+               xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle=shared
+               xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle=shared
+           fi
+           if test ! -f "$xxx"; then
+               xxx=$thisdir/lib$thislib.$so$_a
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle="import"
+           fi
+           if test ! -f "$xxx"; then
+               xxx=$thisdir/$thislib.$so$_a
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle="import"
+           fi
+           if test ! -f "$xxx"; then
+               xxx=$thisdir/lib$thislib.$so
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle=shared
+           fi
+           if test ! -f "$xxx"; then
+               xxx=$thisdir/$libprefix$thislib.$so
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle="system"
+           fi
+           if test ! -f "$xxx"; then
+               xxx=$thisdir/lib$thislib$_a
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle=static
+           fi
+           if test ! -f "$xxx"; then
+               xxx=$thisdir/$thislib$_a
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle=static
+           fi
 	    if test ! -f "$xxx"; then
 		xxx=$thisdir/lib${thislib}_s$_a
 	        $test -f "$xxx" && eval $libscheck
 		$test -f "$xxx" && libstyle=static
 		$test -f "$xxx" && thislib=${thislib}_s
 	    fi
 	    if test ! -f "$xxx"; then
--8<---------------cut here---------------end--------------->8---


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Waldorf MIDI Implementation & additional documentation:
http://Synth.Stromeko.net/Downloads.html#WaldorfDocs




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About