summaryrefslogtreecommitdiff
path: root/devel/libtool/patches/patch-ac
blob: 66a36d4ddacce31b165bbec4ee8260f29d257aa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
$NetBSD: patch-ac,v 1.19 2005/06/05 18:04:37 tv Exp $

--- ltmain.sh.orig	2005-05-16 05:39:29.000000000 -0400
+++ ltmain.sh
@@ -188,6 +188,31 @@ func_win32_libid ()
 # arg is usually of the form 'gcc ...'
 func_infer_tag ()
 {
+    # Set the commonly-used compilers for some tags.
+    tag_compilers_CC="*cc *xlc"
+    tag_compilers_CXX="*++ *CC"
+    tag_compilers_F77="*77 *fort"
+    base_compiler=`set -- "$@"; $echo $1`
+    # If $tagname still isn't set, then try to infer if the default
+    # "CC" tag applies by matching up the base compile command to some
+    # compilers commonly used for the "CC" tag.
+    if test -z "$tagname"; then
+        z=CC
+        eval "tag_compilers=\$tag_compilers_${z}"
+        if test -n "$tag_compilers"; then
+        for zp in $tag_compilers; do
+          case $base_compiler in
+            $zp)
+            # The compiler in the base compile command matches
+            # one of the common compilers for the current tag.
+            # Assume this is the tagged configuration we want.
+            tagname=$z
+            break
+            ;;
+          esac
+        done
+        fi
+    fi
     if test -n "$available_tags" && test -z "$tagname"; then
       CC_quoted=
       for arg in $CC; do
@@ -228,6 +253,27 @@ func_infer_tag ()
 	      break
 	      ;;
 	    esac
+	    # If $tagname still isn't set, then try to infer it by
+	    # matching up the base compile command to some compilers
+	    # commonly used for certain tags.
+	    base_compiler=`set -- "$@"; $echo $1`
+	    eval "tag_compilers=\$tag_compilers_${z}"
+	    if test -n "$tag_compilers"; then
+	      for zp in $tag_compilers; do
+		case $base_compiler in 
+		  $zp)
+		  # The compiler in the base compile command matches
+		  # one of the common compilers for the current tag.
+		  # Assume this is the tagged configuration we want.
+		  tagname=$z
+		  break
+		  ;;
+		esac
+	      done
+	      if test -n "$tagname"; then
+		break
+	      fi
+	    fi
 	  fi
 	done
 	# If $tagname still isn't set, then no tagged configuration
@@ -512,7 +558,7 @@ if test -z "$show_help"; then
     $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
     $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
     case $nonopt in
-    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
+    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc* | *CC)
       mode=link
       for arg
       do
@@ -1313,6 +1359,13 @@ EOF
 	    exit $EXIT_FAILURE
 	    ;;
 	  esac
+	  # Canonicalise the pathname
+	  tmp=""
+	  while test "$arg" != "$tmp"
+          do
+            tmp=$arg
+            arg=`$echo "X$arg" | $Xsed -e 's%[^/.][^/.]*/\.\.%%g' -e 's%/\./%/%g' -e 's%//*%/%g' -e 's%/$%%g'`
+          done
 	  if test "$prev" = rpath; then
 	    case "$rpath " in
 	    *" $arg "*) ;;
@@ -1523,6 +1576,12 @@ EOF
 	compiler_flags="$compiler_flags $arg"
 	compile_command="$compile_command $arg"
 	finalize_command="$finalize_command $arg"
+	case $host:$arg in
+	*-*-dragonfly*:-pthread)
+	  # pkgsrc hack to use -pthread in .la file for final linking
+	  deplibs="$deplibs $arg"
+	  ;;
+	esac
 	continue
 	;;
 
@@ -2013,6 +2072,30 @@ EOF
 	  else
 	    compiler_flags="$compiler_flags $deplib"
 	  fi
+	  case $host:$deplib in
+	  *-*-dragonfly*:-pthread)
+	    # pkgsrc hack to use -pthread in .la file for final linking
+	    case $linkmode in
+	    lib)
+	      deplibs="$deplib $deplibs"
+	      test "$pass" = conv && continue
+	      newdependency_libs="$deplib $newdependency_libs"
+	      ;;
+	    prog)
+	      if test "$pass" = conv; then
+		deplibs="$deplib $deplibs"
+		continue
+	      fi
+	      if test "$pass" = scan; then
+		deplibs="$deplib $deplibs"
+	      else
+		compile_deplibs="$deplib $compile_deplibs"
+		finalize_deplibs="$deplib $finalize_deplibs"
+	      fi
+	      ;;
+	    esac
+	    ;;
+	  esac
 	  continue
 	  ;;
 	-l*)
@@ -3202,6 +3285,7 @@ EOF
 	linux)
 	  major=.`expr $current - $age`
 	  versuffix="$major.$age.$revision"
+	  versuffix2="$major.$age"
 	  ;;
 
 	osf)
@@ -5462,8 +5546,16 @@ relink_command=\"$relink_command\""
       exit $EXIT_FAILURE
     fi
 
-    # Strip any trailing slash from the destination.
-    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+    # Canonicalise the pathname:
+    #   - remove foo/../
+    #   - replace //
+    #   - remove /./
+    #   - strip any trailing /
+    tmp=""
+    while test "$dest" != "$tmp";  do
+      tmp=$dest
+      dest=`$echo "X$dest" | $Xsed -e 's%[^/.][^/.]*/\.\.%%g' -e 's%/\./%/%g' -e 's%//*%/%g' -e 's%/$%%g'`
+    done
 
     # Check to see that the destination is a directory.
     test -d "$dest" && isdir=yes