ltmain.sh 194 KB
Newer Older
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2001

Emmanuel Bertin's avatar
Emmanuel Bertin committed
2002
    oldlibs=
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
    # calculate the name of the file, without its directory
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
    libobjs_save="$libobjs"

    if test -n "$shlibpath_var"; then
      # get the directories listed in $shlibpath_var
      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
    else
      shlib_search_path=
    fi
    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"

    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
    if test "X$output_objdir" = "X$output"; then
      output_objdir="$objdir"
    else
      output_objdir="$output_objdir/$objdir"
    fi
    # Create the object directory.
    if test ! -d "$output_objdir"; then
      $show "$mkdir $output_objdir"
      $run $mkdir $output_objdir
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2026
2027
2028
      exit_status=$?
      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
	exit $exit_status
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2029
2030
2031
2032
2033
2034
2035
2036
      fi
    fi

    # Determine the type of output
    case $output in
    "")
      $echo "$modename: you must specify an output file" 1>&2
      $echo "$help" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2037
      exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2038
2039
2040
2041
2042
2043
2044
      ;;
    *.$libext) linkmode=oldlib ;;
    *.lo | *.$objext) linkmode=obj ;;
    *.la) linkmode=lib ;;
    *) linkmode=prog ;; # Anything else should be a program.
    esac

Emmanuel Bertin's avatar
Emmanuel Bertin committed
2045
2046
2047
2048
2049
2050
2051
2052
2053
    case $host in
    *cygwin* | *mingw* | *pw32*)
      # don't eliminate duplications in $postdeps and $predeps
      duplicate_compiler_generated_deps=yes
      ;;
    *)
      duplicate_compiler_generated_deps=$duplicate_deps
      ;;
    esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2054
    specialdeplibs=
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2055

Emmanuel Bertin's avatar
Emmanuel Bertin committed
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
    libs=
    # Find all interdependent deplibs by searching for libraries
    # that are linked more than once (e.g. -la -lb -la)
    for deplib in $deplibs; do
      if test "X$duplicate_deps" = "Xyes" ; then
	case "$libs " in
	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
	esac
      fi
      libs="$libs $deplib"
    done

    if test "$linkmode" = lib; then
      libs="$predeps $libs $compiler_lib_search_path $postdeps"

      # Compute libraries that are listed more than once in $predeps
      # $postdeps and mark them as special (i.e., whose duplicates are
      # not to be eliminated).
      pre_post_deps=
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2075
      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
	for pre_post_dep in $predeps $postdeps; do
	  case "$pre_post_deps " in
	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
	  esac
	  pre_post_deps="$pre_post_deps $pre_post_dep"
	done
      fi
      pre_post_deps=
    fi

    deplibs=
    newdependency_libs=
    newlib_search_path=
    need_relink=no # whether we're linking any uninstalled libtool libraries
    notinst_deplibs= # not-installed libtool libraries
    case $linkmode in
    lib)
	passes="conv link"
	for file in $dlfiles $dlprefiles; do
	  case $file in
	  *.la) ;;
	  *)
	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2099
	    exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
	    ;;
	  esac
	done
	;;
    prog)
	compile_deplibs=
	finalize_deplibs=
	alldeplibs=no
	newdlfiles=
	newdlprefiles=
	passes="conv scan dlopen dlpreopen link"
	;;
    *)  passes="conv"
	;;
    esac
    for pass in $passes; do
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2116
2117
2118
2119
2120
      if test "$linkmode,$pass" = "lib,link" ||
	 test "$linkmode,$pass" = "prog,scan"; then
	libs="$deplibs"
	deplibs=
      fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2121
2122
      if test "$linkmode" = prog; then
	case $pass in
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2123
	dlopen) libs="$dlfiles" ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2124
2125
2126
2127
	dlpreopen) libs="$dlprefiles" ;;
	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
	esac
      fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2128
2129
2130
2131
2132
      if test "$pass" = dlopen; then
	# Collect dlpreopened libraries
	save_deplibs="$deplibs"
	deplibs=
      fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2133
2134
2135
2136
      for deplib in $libs; do
	lib=
	found=no
	case $deplib in
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2137
2138
2139
2140
2141
2142
	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
	  if test "$linkmode,$pass" = "prog,link"; then
	    compile_deplibs="$deplib $compile_deplibs"
	    finalize_deplibs="$deplib $finalize_deplibs"
	  else
	    compiler_flags="$compiler_flags $deplib"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2143
	  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2144
2145
2146
2147
2148
	  continue
	  ;;
	-l*)
	  if test "$linkmode" != lib && test "$linkmode" != prog; then
	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2149
2150
2151
2152
	    continue
	  fi
	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
	    for search_ext in .la $std_shrext .so .a; do
	      # Search the libtool library
	      lib="$searchdir/lib${name}${search_ext}"
	      if test -f "$lib"; then
		if test "$search_ext" = ".la"; then
		  found=yes
		else
		  found=no
		fi
		break 2
	      fi
	    done
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
	  done
	  if test "$found" != yes; then
	    # deplib doesn't seem to be a libtool library
	    if test "$linkmode,$pass" = "prog,link"; then
	      compile_deplibs="$deplib $compile_deplibs"
	      finalize_deplibs="$deplib $finalize_deplibs"
	    else
	      deplibs="$deplib $deplibs"
	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
	    fi
	    continue
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
	  else # deplib is a libtool library
	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
	    # We need to do some special things here, and not later.
	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
	      case " $predeps $postdeps " in
	      *" $deplib "*)
		if (${SED} -e '2q' $lib |
                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
		  library_names=
		  old_library=
		  case $lib in
		  */* | *\\*) . $lib ;;
		  *) . ./$lib ;;
		  esac
		  for l in $old_library $library_names; do
		    ll="$l"
		  done
		  if test "X$ll" = "X$old_library" ; then # only static version available
		    found=no
		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
		    test "X$ladir" = "X$lib" && ladir="."
		    lib=$ladir/$old_library
		    if test "$linkmode,$pass" = "prog,link"; then
		      compile_deplibs="$deplib $compile_deplibs"
		      finalize_deplibs="$deplib $finalize_deplibs"
		    else
		      deplibs="$deplib $deplibs"
		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
		    fi
		    continue
		  fi
		fi
	        ;;
	      *) ;;
	      esac
	    fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
	  fi
	  ;; # -l
	-L*)
	  case $linkmode in
	  lib)
	    deplibs="$deplib $deplibs"
	    test "$pass" = conv && continue
	    newdependency_libs="$deplib $newdependency_libs"
	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
	    ;;
	  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
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2233
	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2234
2235
	    ;;
	  *)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2236
	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
	    ;;
	  esac # linkmode
	  continue
	  ;; # -L
	-R*)
	  if test "$pass" = link; then
	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
	    # Make sure the xrpath contains only unique directories.
	    case "$xrpath " in
	    *" $dir "*) ;;
	    *) xrpath="$xrpath $dir" ;;
	    esac
	  fi
	  deplibs="$deplib $deplibs"
	  continue
	  ;;
	*.la) lib="$deplib" ;;
	*.$libext)
	  if test "$pass" = conv; then
	    deplibs="$deplib $deplibs"
	    continue
	  fi
	  case $linkmode in
	  lib)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
	    valid_a_lib=no
	    case $deplibs_check_method in
	      match_pattern*)
		set dummy $deplibs_check_method
	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
		if eval $echo \"$deplib\" 2>/dev/null \
		    | $SED 10q \
		    | $EGREP "$match_pattern_regex" > /dev/null; then
		  valid_a_lib=yes
		fi
		;;
	      pass_all)
		valid_a_lib=yes
		;;
            esac
	    if test "$valid_a_lib" != yes; then
	      $echo
	      $echo "*** Warning: Trying to link with static lib archive $deplib."
	      $echo "*** I have the capability to make that library automatically link in when"
	      $echo "*** you link to this library.  But I can only do this if you have a"
	      $echo "*** shared version of the library, which you do not appear to have"
	      $echo "*** because the file extensions .$libext of this argument makes me believe"
	      $echo "*** that it is just a static archive that I should not used here."
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2284
	    else
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2285
2286
2287
	      $echo
	      $echo "*** Warning: Linking the shared library $output against the"
	      $echo "*** static library $deplib is not portable!"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
	      deplibs="$deplib $deplibs"
	    fi
	    continue
	    ;;
	  prog)
	    if test "$pass" != link; then
	      deplibs="$deplib $deplibs"
	    else
	      compile_deplibs="$deplib $compile_deplibs"
	      finalize_deplibs="$deplib $finalize_deplibs"
	    fi
	    continue
	    ;;
	  esac # linkmode
	  ;; # *.$libext
	*.lo | *.$objext)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
	  if test "$pass" = conv; then
	    deplibs="$deplib $deplibs"
	  elif test "$linkmode" = prog; then
	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
	      # If there is no dlopen support or we're linking statically,
	      # we need to preload.
	      newdlprefiles="$newdlprefiles $deplib"
	      compile_deplibs="$deplib $compile_deplibs"
	      finalize_deplibs="$deplib $finalize_deplibs"
	    else
	      newdlfiles="$newdlfiles $deplib"
	    fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
	  fi
	  continue
	  ;;
	%DEPLIBS%)
	  alldeplibs=yes
	  continue
	  ;;
	esac # case $deplib
	if test "$found" = yes || test -f "$lib"; then :
	else
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2326
2327
	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
	  exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2328
2329
2330
	fi

	# Check to see that this really is a libtool archive.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2331
	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2332
2333
	else
	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2334
	  exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
	fi

	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
	test "X$ladir" = "X$lib" && ladir="."

	dlname=
	dlopen=
	dlpreopen=
	libdir=
	library_names=
	old_library=
	# If the library was installed with an old release of libtool,
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2347
	# it will not redefine variables installed, or shouldnotlink
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2348
	installed=yes
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2349
2350
2351
	shouldnotlink=no
	avoidtemprpath=

Emmanuel Bertin's avatar
Emmanuel Bertin committed
2352
2353
2354
2355
2356
2357
2358
2359
2360

	# Read the .la file
	case $lib in
	*/* | *\\*) . $lib ;;
	*) . ./$lib ;;
	esac

	if test "$linkmode,$pass" = "lib,link" ||
	   test "$linkmode,$pass" = "prog,scan" ||
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2361
	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
	fi

	if test "$pass" = conv; then
	  # Only check for convenience libraries
	  deplibs="$lib $deplibs"
	  if test -z "$libdir"; then
	    if test -z "$old_library"; then
	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2372
	      exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
	    fi
	    # It is a libtool convenience library, so add in its objects.
	    convenience="$convenience $ladir/$objdir/$old_library"
	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
	    tmp_libs=
	    for deplib in $dependency_libs; do
	      deplibs="$deplib $deplibs"
              if test "X$duplicate_deps" = "Xyes" ; then
	        case "$tmp_libs " in
	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
	        esac
              fi
	      tmp_libs="$tmp_libs $deplib"
	    done
	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2389
	    exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2390
2391
2392
2393
	  fi
	  continue
	fi # $pass = conv

Emmanuel Bertin's avatar
Emmanuel Bertin committed
2394

Emmanuel Bertin's avatar
Emmanuel Bertin committed
2395
2396
2397
2398
2399
2400
2401
	# Get the name of the library we link against.
	linklib=
	for l in $old_library $library_names; do
	  linklib="$l"
	done
	if test -z "$linklib"; then
	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2402
	  exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2403
2404
2405
2406
2407
2408
	fi

	# This library was specified with -dlopen.
	if test "$pass" = dlopen; then
	  if test -z "$libdir"; then
	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2409
	    exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2410
	  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2411
2412
2413
	  if test -z "$dlname" ||
	     test "$dlopen_support" != yes ||
	     test "$build_libtool_libs" = no; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2414
	    # If there is no dlname, no dlopen support or we're linking
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2415
2416
2417
2418
	    # statically, we need to preload.  We also need to preload any
	    # dependent libraries so libltdl's deplib preloader doesn't
	    # bomb out in the load deplibs phase.
	    dlprefiles="$dlprefiles $lib $dependency_libs"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
	  else
	    newdlfiles="$newdlfiles $lib"
	  fi
	  continue
	fi # $pass = dlopen

	# We need an absolute path.
	case $ladir in
	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
	*)
	  abs_ladir=`cd "$ladir" && pwd`
	  if test -z "$abs_ladir"; then
	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
	    abs_ladir="$ladir"
	  fi
	  ;;
	esac
	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`

	# Find the relevant object directory and library name.
	if test "X$installed" = Xyes; then
	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
	    dir="$ladir"
	    absdir="$abs_ladir"
	    libdir="$abs_ladir"
	  else
	    dir="$libdir"
	    absdir="$libdir"
	  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2450
	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2451
	else
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
	    dir="$ladir"
	    absdir="$abs_ladir"
	    # Remove this search path later
	    notinst_path="$notinst_path $abs_ladir"
	  else
	    dir="$ladir/$objdir"
	    absdir="$abs_ladir/$objdir"
	    # Remove this search path later
	    notinst_path="$notinst_path $abs_ladir"
	  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2463
2464
2465
2466
2467
2468
2469
	fi # $installed = yes
	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`

	# This library was specified with -dlpreopen.
	if test "$pass" = dlpreopen; then
	  if test -z "$libdir"; then
	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2470
	    exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
	  fi
	  # Prefer using a static library (so that no silly _DYNAMIC symbols
	  # are required to link).
	  if test -n "$old_library"; then
	    newdlprefiles="$newdlprefiles $dir/$old_library"
	  # Otherwise, use the dlname, so that lt_dlopen finds it.
	  elif test -n "$dlname"; then
	    newdlprefiles="$newdlprefiles $dir/$dlname"
	  else
	    newdlprefiles="$newdlprefiles $dir/$linklib"
	  fi
	fi # $pass = dlpreopen

	if test -z "$libdir"; then
	  # Link the convenience library
	  if test "$linkmode" = lib; then
	    deplibs="$dir/$old_library $deplibs"
	  elif test "$linkmode,$pass" = "prog,link"; then
	    compile_deplibs="$dir/$old_library $compile_deplibs"
	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
	  else
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2492
	    deplibs="$lib $deplibs" # used for prog,scan pass
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2493
2494
2495
2496
	  fi
	  continue
	fi

Emmanuel Bertin's avatar
Emmanuel Bertin committed
2497

Emmanuel Bertin's avatar
Emmanuel Bertin committed
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
	if test "$linkmode" = prog && test "$pass" != link; then
	  newlib_search_path="$newlib_search_path $ladir"
	  deplibs="$lib $deplibs"

	  linkalldeplibs=no
	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
	     test "$build_libtool_libs" = no; then
	    linkalldeplibs=yes
	  fi

	  tmp_libs=
	  for deplib in $dependency_libs; do
	    case $deplib in
	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
	    esac
	    # Need to link against all dependency_libs?
	    if test "$linkalldeplibs" = yes; then
	      deplibs="$deplib $deplibs"
	    else
	      # Need to hardcode shared library paths
	      # or/and link against static libraries
	      newdependency_libs="$deplib $newdependency_libs"
	    fi
	    if test "X$duplicate_deps" = "Xyes" ; then
	      case "$tmp_libs " in
	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
	      esac
	    fi
	    tmp_libs="$tmp_libs $deplib"
	  done # for deplib
	  continue
	fi # $linkmode = prog...

Emmanuel Bertin's avatar
Emmanuel Bertin committed
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
	if test "$linkmode,$pass" = "prog,link"; then
	  if test -n "$library_names" &&
	     { { test "$prefer_static_libs" = no ||
		 test "$prefer_static_libs,$installed" = "built,yes"; } ||
	       test -z "$old_library"; }; then
	    # We need to hardcode the library path
	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
	      # Make sure the rpath contains only unique directories.
	      case "$temp_rpath " in
	      *" $dir "*) ;;
	      *" $absdir "*) ;;
	      *) temp_rpath="$temp_rpath $absdir" ;;
	      esac
	    fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575

	    # Hardcode the library path.
	    # Skip directories that are in the system default run-time
	    # search path.
	    case " $sys_lib_dlsearch_path " in
	    *" $absdir "*) ;;
	    *)
	      case "$compile_rpath " in
	      *" $absdir "*) ;;
	      *) compile_rpath="$compile_rpath $absdir"
	      esac
	      ;;
	    esac
	    case " $sys_lib_dlsearch_path " in
	    *" $libdir "*) ;;
	    *)
	      case "$finalize_rpath " in
	      *" $libdir "*) ;;
	      *) finalize_rpath="$finalize_rpath $libdir"
	      esac
	      ;;
	    esac
	  fi # $linkmode,$pass = prog,link...

	  if test "$alldeplibs" = yes &&
	     { test "$deplibs_check_method" = pass_all ||
	       { test "$build_libtool_libs" = yes &&
		 test -n "$library_names"; }; }; then
	    # We only need to search for static libraries
	    continue
	  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2576
	fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2577

Emmanuel Bertin's avatar
Emmanuel Bertin committed
2578
2579
2580
2581
2582
2583
2584
	link_static=no # Whether the deplib will be linked statically
	use_static_libs=$prefer_static_libs
	if test "$use_static_libs" = built && test "$installed" = yes ; then
	  use_static_libs=no
	fi
	if test -n "$library_names" &&
	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2585
2586
2587
2588
	  if test "$installed" = no; then
	    notinst_deplibs="$notinst_deplibs $lib"
	    need_relink=yes
	  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
	  # This is a shared library

	  # Warn about portability, can't link against -module's on
	  # some systems (darwin)
	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
	    $echo
	    if test "$linkmode" = prog; then
	      $echo "*** Warning: Linking the executable $output against the loadable module"
	    else
	      $echo "*** Warning: Linking the shared library $output against the loadable module"
	    fi
	    $echo "*** $linklib is not portable!"
	  fi
	  if test "$linkmode" = lib &&
	     test "$hardcode_into_libs" = yes; then
	    # Hardcode the library path.
	    # Skip directories that are in the system default run-time
	    # search path.
	    case " $sys_lib_dlsearch_path " in
	    *" $absdir "*) ;;
	    *)
	      case "$compile_rpath " in
	      *" $absdir "*) ;;
	      *) compile_rpath="$compile_rpath $absdir"
	      esac
	      ;;
	    esac
	    case " $sys_lib_dlsearch_path " in
	    *" $libdir "*) ;;
	    *)
	      case "$finalize_rpath " in
	      *" $libdir "*) ;;
	      *) finalize_rpath="$finalize_rpath $libdir"
	      esac
	      ;;
	    esac
	  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638

	  if test -n "$old_archive_from_expsyms_cmds"; then
	    # figure out the soname
	    set dummy $library_names
	    realname="$2"
	    shift; shift
	    libname=`eval \\$echo \"$libname_spec\"`
	    # use dlname if we got it. it's perfectly good, no?
	    if test -n "$dlname"; then
	      soname="$dlname"
	    elif test -n "$soname_spec"; then
	      # bleh windows
	      case $host in
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2639
	      *cygwin* | mingw*)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
		major=`expr $current - $age`
		versuffix="-$major"
		;;
	      esac
	      eval soname=\"$soname_spec\"
	    else
	      soname="$realname"
	    fi

	    # Make a new name for the extract_expsyms_cmds to use
	    soroot="$soname"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2651
2652
	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2653
2654
2655
2656
2657
2658

	    # If the library has no export list, then create one now
	    if test -f "$output_objdir/$soname-def"; then :
	    else
	      $show "extracting exported symbol list from \`$soname'"
	      save_ifs="$IFS"; IFS='~'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2659
	      cmds=$extract_expsyms_cmds
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2660
2661
	      for cmd in $cmds; do
		IFS="$save_ifs"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2662
		eval cmd=\"$cmd\"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
		$show "$cmd"
		$run eval "$cmd" || exit $?
	      done
	      IFS="$save_ifs"
	    fi

	    # Create $newlib
	    if test -f "$output_objdir/$newlib"; then :; else
	      $show "generating import library for \`$soname'"
	      save_ifs="$IFS"; IFS='~'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2673
	      cmds=$old_archive_from_expsyms_cmds
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2674
2675
	      for cmd in $cmds; do
		IFS="$save_ifs"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2676
		eval cmd=\"$cmd\"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
		$show "$cmd"
		$run eval "$cmd" || exit $?
	      done
	      IFS="$save_ifs"
	    fi
	    # make sure the library variables are pointing to the new library
	    dir=$output_objdir
	    linklib=$newlib
	  fi # test -n "$old_archive_from_expsyms_cmds"

	  if test "$linkmode" = prog || test "$mode" != relink; then
	    add_shlibpath=
	    add_dir=
	    add=
	    lib_linked=yes
	    case $hardcode_action in
	    immediate | unsupported)
	      if test "$hardcode_direct" = no; then
		add="$dir/$linklib"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
		case $host in
		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
		    *-*-unixware7*) add_dir="-L$dir" ;;
		  *-*-darwin* )
		    # if the lib is a module then we can not link against
		    # it, someone is ignoring the new warnings I added
		    if /usr/bin/file -L $add 2> /dev/null |
                      $EGREP ": [^:]* bundle" >/dev/null ; then
		      $echo "** Warning, lib $linklib is a module, not a shared library"
		      if test -z "$old_library" ; then
		        $echo
		        $echo "** And there doesn't seem to be a static archive available"
		        $echo "** The link will probably fail, sorry"
		      else
		        add="$dir/$old_library"
		      fi
		    fi
		esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
	      elif test "$hardcode_minus_L" = no; then
		case $host in
		*-*-sunos*) add_shlibpath="$dir" ;;
		esac
		add_dir="-L$dir"
		add="-l$name"
	      elif test "$hardcode_shlibpath_var" = no; then
		add_shlibpath="$dir"
		add="-l$name"
	      else
		lib_linked=no
	      fi
	      ;;
	    relink)
	      if test "$hardcode_direct" = yes; then
		add="$dir/$linklib"
	      elif test "$hardcode_minus_L" = yes; then
		add_dir="-L$dir"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2734
2735
2736
2737
2738
2739
2740
2741
		# Try looking first in the location we're being installed to.
		if test -n "$inst_prefix_dir"; then
		  case $libdir in
		    [\\/]*)
		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
		      ;;
		  esac
		fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
		add="-l$name"
	      elif test "$hardcode_shlibpath_var" = yes; then
		add_shlibpath="$dir"
		add="-l$name"
	      else
		lib_linked=no
	      fi
	      ;;
	    *) lib_linked=no ;;
	    esac

	    if test "$lib_linked" != yes; then
	      $echo "$modename: configuration error: unsupported hardcode properties"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2755
	      exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
	    fi

	    if test -n "$add_shlibpath"; then
	      case :$compile_shlibpath: in
	      *":$add_shlibpath:"*) ;;
	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
	      esac
	    fi
	    if test "$linkmode" = prog; then
	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
	    else
	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
	      test -n "$add" && deplibs="$add $deplibs"
	      if test "$hardcode_direct" != yes && \
		 test "$hardcode_minus_L" != yes && \
		 test "$hardcode_shlibpath_var" = yes; then
		case :$finalize_shlibpath: in
		*":$libdir:"*) ;;
		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
		esac
	      fi
	    fi
	  fi

	  if test "$linkmode" = prog || test "$mode" = relink; then
	    add_shlibpath=
	    add_dir=
	    add=
	    # Finalize command for both is simple: just hardcode it.
	    if test "$hardcode_direct" = yes; then
	      add="$libdir/$linklib"
	    elif test "$hardcode_minus_L" = yes; then
	      add_dir="-L$libdir"
	      add="-l$name"
	    elif test "$hardcode_shlibpath_var" = yes; then
	      case :$finalize_shlibpath: in
	      *":$libdir:"*) ;;
	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
	      esac
	      add="-l$name"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2797
2798
2799
2800
2801
2802
2803
	    elif test "$hardcode_automatic" = yes; then
	      if test -n "$inst_prefix_dir" &&
		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
	        add="$inst_prefix_dir$libdir/$linklib"
	      else
	        add="$libdir/$linklib"
	      fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2804
2805
2806
	    else
	      # We cannot seem to hardcode it, guess we'll fake it.
	      add_dir="-L$libdir"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2807
2808
2809
2810
2811
2812
2813
2814
	      # Try looking first in the location we're being installed to.
	      if test -n "$inst_prefix_dir"; then
		case $libdir in
		  [\\/]*)
		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
		    ;;
		esac
	      fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
	      add="-l$name"
	    fi

	    if test "$linkmode" = prog; then
	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
	    else
	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
	      test -n "$add" && deplibs="$add $deplibs"
	    fi
	  fi
	elif test "$linkmode" = prog; then
	  # Here we assume that one of hardcode_direct or hardcode_minus_L
	  # is not unsupported.  This is valid on all known static and
	  # shared platforms.
	  if test "$hardcode_direct" != unsupported; then
	    test -n "$old_library" && linklib="$old_library"
	    compile_deplibs="$dir/$linklib $compile_deplibs"
	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
	  else
	    compile_deplibs="-l$name -L$dir $compile_deplibs"
	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
	  fi
	elif test "$build_libtool_libs" = yes; then
	  # Not a shared library
	  if test "$deplibs_check_method" != pass_all; then
	    # We're trying link a shared library against a static one
	    # but the system doesn't support it.

	    # Just print a warning and add the library to dependency_libs so
	    # that the program can be linked against the static library.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2846
2847
2848
2849
2850
	    $echo
	    $echo "*** Warning: This system can not link to static lib archive $lib."
	    $echo "*** I have the capability to make that library automatically link in when"
	    $echo "*** you link to this library.  But I can only do this if you have a"
	    $echo "*** shared version of the library, which you do not appear to have."
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2851
	    if test "$module" = yes; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2852
2853
2854
	      $echo "*** But as you try to build a module library, libtool will still create "
	      $echo "*** a static module, that should work as long as the dlopening application"
	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2855
	      if test -z "$global_symbol_pipe"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2856
2857
2858
2859
2860
		$echo
		$echo "*** However, this would only work if libtool was able to extract symbol"
		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
		$echo "*** not find such a program.  So, this module is probably useless."
		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
	      fi
	      if test "$build_old_libs" = no; then
		build_libtool_libs=module
		build_old_libs=yes
	      else
		build_libtool_libs=no
	      fi
	    fi
	  else
	    deplibs="$dir/$old_library $deplibs"
	    link_static=yes
	  fi
	fi # link shared/static library?

	if test "$linkmode" = lib; then
	  if test -n "$dependency_libs" &&
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2877
2878
	     { test "$hardcode_into_libs" != yes ||
	       test "$build_old_libs" = yes ||
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
	       test "$link_static" = yes; }; then
	    # Extract -R from dependency_libs
	    temp_deplibs=
	    for libdir in $dependency_libs; do
	      case $libdir in
	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
		   case " $xrpath " in
		   *" $temp_xrpath "*) ;;
		   *) xrpath="$xrpath $temp_xrpath";;
		   esac;;
	      *) temp_deplibs="$temp_deplibs $libdir";;
	      esac
	    done
	    dependency_libs="$temp_deplibs"
	  fi

	  newlib_search_path="$newlib_search_path $absdir"
	  # Link against this library
	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
	  # ... and its dependency_libs
	  tmp_libs=
	  for deplib in $dependency_libs; do
	    newdependency_libs="$deplib $newdependency_libs"
	    if test "X$duplicate_deps" = "Xyes" ; then
	      case "$tmp_libs " in
	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
	      esac
	    fi
	    tmp_libs="$tmp_libs $deplib"
	  done

	  if test "$link_all_deplibs" != no; then
	    # Add the search paths of all dependency libraries
	    for deplib in $dependency_libs; do
	      case $deplib in
	      -L*) path="$deplib" ;;
	      *.la)
		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
		test "X$dir" = "X$deplib" && dir="."
		# We need an absolute path.
		case $dir in
		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
		*)
		  absdir=`cd "$dir" && pwd`
		  if test -z "$absdir"; then
		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
		    absdir="$dir"
		  fi
		  ;;
		esac
		if grep "^installed=no" $deplib > /dev/null; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2930
		  path="$absdir/$objdir"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2931
		else
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2932
		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2933
2934
		  if test -z "$libdir"; then
		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2935
		    exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2936
2937
2938
2939
		  fi
		  if test "$absdir" != "$libdir"; then
		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
		  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2940
		  path="$absdir"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2941
		fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
		depdepl=
		case $host in
		*-*-darwin*)
		  # we do not want to link against static libs,
		  # but need to link against shared
		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
		  if test -n "$deplibrary_names" ; then
		    for tmp in $deplibrary_names ; do
		      depdepl=$tmp
		    done
		    if test -f "$path/$depdepl" ; then
		      depdepl="$path/$depdepl"
		    fi
		    # do not add paths which are already there
		    case " $newlib_search_path " in
		    *" $path "*) ;;
		    *) newlib_search_path="$newlib_search_path $path";;
		    esac
		  fi
		  path=""
		  ;;
		*)
		  path="-L$path"
		  ;;
		esac
		;;
	      -l*)
		case $host in
		*-*-darwin*)
		  # Again, we only want to link against shared libraries
		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
		  for tmp in $newlib_search_path ; do
		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
		      eval depdepl="$tmp/lib$tmp_libs.dylib"
		      break
		    fi
		  done
		  path=""
		  ;;
		*) continue ;;
		esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2983
2984
2985
2986
2987
		;;
	      *) continue ;;
	      esac
	      case " $deplibs " in
	      *" $path "*) ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2988
2989
2990
2991
2992
	      *) deplibs="$path $deplibs" ;;
	      esac
	      case " $deplibs " in
	      *" $depdepl "*) ;;
	      *) deplibs="$depdepl $deplibs" ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2993
2994
2995
2996
2997
	      esac
	    done
	  fi # link_all_deplibs != no
	fi # linkmode = lib
      done # for deplib in $libs
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2998
      dependency_libs="$newdependency_libs"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
2999
3000
      if test "$pass" = dlpreopen; then
	# Link the dlpreopened libraries before other libraries
For faster browsing, not all history is shown. View entire blame