libtool 211 KB
Newer Older
1001
1002
1003
1004
1005
1006
1007
	  # Add the arguments to base_compile.
	  base_compile="$base_compile $lastarg"
	  continue
	  ;;

	* )
	  # Accept the current argument as the source file.
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
	  # The previous "srcfile" becomes the current argument.
	  #
	  lastarg="$srcfile"
	  srcfile="$arg"
	  ;;
	esac  #  case $arg
	;;
      esac    #  case $arg_mode

      # Aesthetically quote the previous argument.
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`

      case $lastarg in
      # Double-quote args containing other shell metacharacters.
      # Many Bourne shells cannot handle close brackets correctly
      # in scan sets, so we specify it separately.
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
	lastarg="\"$lastarg\""
	;;
      esac

      base_compile="$base_compile $lastarg"
1030
1031
1032
1033
    done # for arg

    case $arg_mode in
    arg)
1034
1035
      $echo "$modename: you must specify an argument for -Xcompile"
      exit $EXIT_FAILURE
1036
1037
      ;;
    target)
1038
1039
      $echo "$modename: you must specify a target with \`-o'" 1>&2
      exit $EXIT_FAILURE
1040
1041
1042
      ;;
    *)
      # Get the name of the library object.
1043
      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
1044
1045
1046
1047
1048
      ;;
    esac

    # Recognize several different file suffixes.
    # If the user specifies -o file.o, it is replaced with file.lo
1049
    xform='[cCFSifmso]'
1050
    case $libobj in
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
    *.ada) xform=ada ;;
    *.adb) xform=adb ;;
    *.ads) xform=ads ;;
    *.asm) xform=asm ;;
    *.c++) xform=c++ ;;
    *.cc) xform=cc ;;
    *.ii) xform=ii ;;
    *.class) xform=class ;;
    *.cpp) xform=cpp ;;
    *.cxx) xform=cxx ;;
    *.f90) xform=f90 ;;
    *.for) xform=for ;;
    *.java) xform=java ;;
1064
1065
    esac

1066
1067
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`

1068
    case $libobj in
1069
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
1070
    *)
1071
1072
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
      exit $EXIT_FAILURE
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
      ;;
    esac

    func_infer_tag $base_compile

    for arg in $later; do
      case $arg in
      -static)
	build_old_libs=yes
	continue
	;;

      -prefer-pic)
	pic_mode=yes
	continue
	;;

      -prefer-non-pic)
	pic_mode=no
	continue
	;;
      esac
    done

1097
1098
1099
1100
1101
1102
1103
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
    if test "X$xdir" = "X$obj"; then
      xdir=
    else
      xdir=$xdir/
    fi
1104
1105
    lobj=${xdir}$objdir/$objname

1106
1107
1108
1109
1110
    if test -z "$base_compile"; then
      $echo "$modename: you must specify a compilation command" 1>&2
      $echo "$help" 1>&2
      exit $EXIT_FAILURE
    fi
1111
1112
1113
1114
1115
1116
1117
1118

    # Delete any leftover library objects.
    if test "$build_old_libs" = yes; then
      removelist="$obj $lobj $libobj ${libobj}T"
    else
      removelist="$lobj $libobj ${libobj}T"
    fi

1119
1120
1121
    $run $rm $removelist
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15

1122
1123
    # On Cygwin there's no "real" PIC flag so we must build both object types
    case $host_os in
1124
    cygwin* | mingw* | pw32* | os2*)
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
      pic_mode=default
      ;;
    esac
    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
      # non-PIC code in shared libraries is not supported
      pic_mode=default
    fi

    # Calculate the filename of the output object if compiler does
    # not support -o with -c
    if test "$compiler_c_o" = no; then
1136
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1137
      lockfile="$output_obj.lock"
1138
1139
      removelist="$removelist $output_obj $lockfile"
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
1140
1141
1142
1143
1144
1145
1146
1147
1148
    else
      output_obj=
      need_locks=no
      lockfile=
    fi

    # Lock this critical section if it is needed
    # We use this script file to make the link, it avoids creating a new file
    if test "$need_locks" = yes; then
1149
1150
      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
	$show "Waiting for $lockfile to be removed"
1151
1152
1153
1154
	sleep 2
      done
    elif test "$need_locks" = warn; then
      if test -f "$lockfile"; then
1155
	$echo "\
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
*** ERROR, $lockfile exists and contains:
`cat $lockfile 2>/dev/null`

This indicates that another process is trying to use the same
temporary object file, and libtool could not work around it because
your compiler does not support \`-c' and \`-o' together.  If you
repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."

1166
	$run $rm $removelist
1167
1168
	exit $EXIT_FAILURE
      fi
1169
      $echo $srcfile > "$lockfile"
1170
1171
1172
1173
1174
    fi

    if test -n "$fix_srcfile_path"; then
      eval srcfile=\"$fix_srcfile_path\"
    fi
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188

    $run $rm "$libobj" "${libobj}T"

    # Create a libtool object file (analogous to a ".la" file),
    # but don't create it if we're doing a dry run.
    test -z "$run" && cat > ${libobj}T <<EOF
# $libobj - a libtool object file
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# Name of the PIC object.
EOF
1189
1190
1191
1192
1193
1194
1195

    # Only build a PIC object if we are building libtool libraries.
    if test "$build_libtool_libs" = yes; then
      # Without this assignment, base_compile gets emptied.
      fbsd_hideous_sh_bug=$base_compile

      if test "$pic_mode" != no; then
1196
	command="$base_compile $srcfile $pic_flag"
1197
1198
      else
	# Don't build PIC code
1199
	command="$base_compile $srcfile"
1200
1201
      fi

1202
1203
1204
1205
1206
1207
1208
1209
      if test ! -d "${xdir}$objdir"; then
	$show "$mkdir ${xdir}$objdir"
	$run $mkdir ${xdir}$objdir
	status=$?
	if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
	  exit $status
	fi
      fi
1210
1211
1212
1213
1214
1215

      if test -z "$output_obj"; then
	# Place PIC objects in $objdir
	command="$command -o $lobj"
      fi

1216
1217
1218
1219
1220
1221
1222
1223
      $run $rm "$lobj" "$output_obj"

      $show "$command"
      if $run eval "$command"; then :
      else
	test -n "$output_obj" && $run $rm $removelist
	exit $EXIT_FAILURE
      fi
1224
1225
1226

      if test "$need_locks" = warn &&
	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1227
	$echo "\
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
*** ERROR, $lockfile contains:
`cat $lockfile 2>/dev/null`

but it should contain:
$srcfile

This indicates that another process is trying to use the same
temporary object file, and libtool could not work around it because
your compiler does not support \`-c' and \`-o' together.  If you
repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."

1241
	$run $rm $removelist
1242
1243
1244
1245
1246
	exit $EXIT_FAILURE
      fi

      # Just move the object if needed, then go on to compile the next one
      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1247
1248
1249
1250
1251
1252
1253
	$show "$mv $output_obj $lobj"
	if $run $mv $output_obj $lobj; then :
	else
	  error=$?
	  $run $rm $removelist
	  exit $error
	fi
1254
1255
      fi

1256
1257
1258
1259
1260
1261
      # Append the name of the PIC object to the libtool object file.
      test -z "$run" && cat >> ${libobj}T <<EOF
pic_object='$objdir/$objname'

EOF

1262
1263
      # Allow error messages only from the first compilation.
      if test "$suppress_opt" = yes; then
1264
        suppress_output=' >/dev/null 2>&1'
1265
      fi
1266
1267
1268
1269
1270
1271
1272
    else
      # No PIC object so indicate it doesn't exist in the libtool
      # object file.
      test -z "$run" && cat >> ${libobj}T <<EOF
pic_object=none

EOF
1273
1274
1275
1276
1277
1278
    fi

    # Only build a position-dependent object if we build old libraries.
    if test "$build_old_libs" = yes; then
      if test "$pic_mode" != yes; then
	# Don't build PIC code
1279
	command="$base_compile $srcfile"
1280
      else
1281
	command="$base_compile $srcfile $pic_flag"
1282
1283
1284
1285
1286
1287
1288
      fi
      if test "$compiler_c_o" = yes; then
	command="$command -o $obj"
      fi

      # Suppress compiler output if we already did a PIC compilation.
      command="$command$suppress_output"
1289
1290
1291
1292
1293
1294
1295
      $run $rm "$obj" "$output_obj"
      $show "$command"
      if $run eval "$command"; then :
      else
	$run $rm $removelist
	exit $EXIT_FAILURE
      fi
1296
1297
1298

      if test "$need_locks" = warn &&
	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1299
	$echo "\
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
*** ERROR, $lockfile contains:
`cat $lockfile 2>/dev/null`

but it should contain:
$srcfile

This indicates that another process is trying to use the same
temporary object file, and libtool could not work around it because
your compiler does not support \`-c' and \`-o' together.  If you
repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."

1313
	$run $rm $removelist
1314
1315
1316
1317
1318
	exit $EXIT_FAILURE
      fi

      # Just move the object if needed
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1319
1320
1321
1322
1323
1324
1325
	$show "$mv $output_obj $obj"
	if $run $mv $output_obj $obj; then :
	else
	  error=$?
	  $run $rm $removelist
	  exit $error
	fi
1326
      fi
1327

1328
1329
1330
1331
1332
      # Append the name of the non-PIC object the libtool object file.
      # Only append if the libtool object file exists.
      test -z "$run" && cat >> ${libobj}T <<EOF
# Name of the non-PIC object.
non_pic_object='$objname'
1333

1334
1335
1336
1337
1338
1339
1340
EOF
    else
      # Append the name of the non-PIC object the libtool object file.
      # Only append if the libtool object file exists.
      test -z "$run" && cat >> ${libobj}T <<EOF
# Name of the non-PIC object.
non_pic_object=none
1341

1342
1343
EOF
    fi
1344

1345
    $run $mv "${libobj}T" "${libobj}"
1346

1347
1348
1349
1350
    # Unlock the critical section if it was locked
    if test "$need_locks" != no; then
      $run $rm "$lockfile"
    fi
1351

1352
1353
    exit $EXIT_SUCCESS
    ;;
1354

1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
  # libtool link mode
  link | relink)
    modename="$modename: link"
    case $host in
    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
      # It is impossible to link a dll without this setting, and
      # we shouldn't force the makefile maintainer to figure out
      # which system we are compiling for in order to pass an extra
      # flag for every libtool invocation.
      # allow_undefined=no
1365

1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
      # FIXME: Unfortunately, there are problems with the above when trying
      # to make a dll which has undefined symbols, in which case not
      # even a static library is built.  For now, we need to specify
      # -no-undefined on the libtool link line when we can be certain
      # that all symbols are satisfied, otherwise we get a static library.
      allow_undefined=yes
      ;;
    *)
      allow_undefined=yes
      ;;
    esac
    libtool_args="$nonopt"
    base_compile="$nonopt $@"
    compile_command="$nonopt"
    finalize_command="$nonopt"
1381

1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
    compile_rpath=
    finalize_rpath=
    compile_shlibpath=
    finalize_shlibpath=
    convenience=
    old_convenience=
    deplibs=
    old_deplibs=
    compiler_flags=
    linker_flags=
    dllsearchpath=
    lib_search_path=`pwd`
    inst_prefix_dir=
1395

1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
    avoid_version=no
    dlfiles=
    dlprefiles=
    dlself=no
    export_dynamic=no
    export_symbols=
    export_symbols_regex=
    generated=
    libobjs=
    ltlibs=
    module=no
    no_install=no
    objs=
    non_pic_objects=
    precious_files_regex=
    prefer_static_libs=no
    preload=no
    prev=
    prevarg=
    release=
    rpath=
    xrpath=
    perm_rpath=
    temp_rpath=
    thread_safe=no
    vinfo=
    vinfo_number=no
1423

1424
    func_infer_tag $base_compile
1425

1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
    # We need to know -static, to get the right output filenames.
    for arg
    do
      case $arg in
      -all-static | -static)
	if test "X$arg" = "X-all-static"; then
	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
	  fi
	  if test -n "$link_static_flag"; then
	    dlopen_self=$dlopen_self_static
	  fi
	else
	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
	    dlopen_self=$dlopen_self_static
	  fi
	fi
	build_libtool_libs=no
	build_old_libs=yes
	prefer_static_libs=yes
	break
	;;
      esac
    done
1450

1451
1452
    # See if our shared archives depend on static archives.
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1453

1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
    # Go through the arguments, transforming them on the way.
    while test "$#" -gt 0; do
      arg="$1"
      shift
      case $arg in
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
	;;
      *) qarg=$arg ;;
      esac
      libtool_args="$libtool_args $qarg"
1465

1466
1467
1468
1469
1470
1471
1472
1473
      # If the previous option needs an argument, assign it.
      if test -n "$prev"; then
	case $prev in
	output)
	  compile_command="$compile_command @OUTPUT@"
	  finalize_command="$finalize_command @OUTPUT@"
	  ;;
	esac
1474

1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
	case $prev in
	dlfiles|dlprefiles)
	  if test "$preload" = no; then
	    # Add the symbol object into the linking commands.
	    compile_command="$compile_command @SYMFILE@"
	    finalize_command="$finalize_command @SYMFILE@"
	    preload=yes
	  fi
	  case $arg in
	  *.la | *.lo) ;;  # We handle these cases below.
	  force)
	    if test "$dlself" = no; then
	      dlself=needless
	      export_dynamic=yes
	    fi
	    prev=
	    continue
	    ;;
	  self)
	    if test "$prev" = dlprefiles; then
	      dlself=yes
	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
	      dlself=yes
	    else
	      dlself=needless
	      export_dynamic=yes
	    fi
	    prev=
	    continue
	    ;;
	  *)
	    if test "$prev" = dlfiles; then
	      dlfiles="$dlfiles $arg"
	    else
	      dlprefiles="$dlprefiles $arg"
	    fi
	    prev=
	    continue
	    ;;
	  esac
	  ;;
	expsyms)
	  export_symbols="$arg"
	  if test ! -f "$arg"; then
	    $echo "$modename: symbol file \`$arg' does not exist"
	    exit $EXIT_FAILURE
	  fi
	  prev=
	  continue
	  ;;
	expsyms_regex)
	  export_symbols_regex="$arg"
	  prev=
	  continue
	  ;;
	inst_prefix)
	  inst_prefix_dir="$arg"
	  prev=
	  continue
	  ;;
	precious_regex)
	  precious_files_regex="$arg"
	  prev=
	  continue
	  ;;
	release)
	  release="-$arg"
	  prev=
	  continue
	  ;;
	objectlist)
	  if test -f "$arg"; then
	    save_arg=$arg
	    moreargs=
	    for fil in `cat $save_arg`
	    do
#	      moreargs="$moreargs $fil"
	      arg=$fil
	      # A libtool-controlled object.
1554

1555
1556
1557
1558
	      # Check to see that this really is a libtool object.
	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
		pic_object=
		non_pic_object=
1559

1560
1561
1562
1563
1564
1565
		# Read the .lo file
		# If there is no directory component, then add one.
		case $arg in
		*/* | *\\*) . $arg ;;
		*) . ./$arg ;;
		esac
1566

1567
1568
1569
1570
1571
1572
1573
		if test -z "$pic_object" || \
		   test -z "$non_pic_object" ||
		   test "$pic_object" = none && \
		   test "$non_pic_object" = none; then
		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
		  exit $EXIT_FAILURE
		fi
1574

1575
1576
1577
1578
1579
1580
1581
		# Extract subdirectory from the argument.
		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
		if test "X$xdir" = "X$arg"; then
		  xdir=
		else
		  xdir="$xdir/"
		fi
1582

1583
1584
1585
		if test "$pic_object" != none; then
		  # Prepend the subdirectory the object is found in.
		  pic_object="$xdir$pic_object"
1586

1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
		  if test "$prev" = dlfiles; then
		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
		      dlfiles="$dlfiles $pic_object"
		      prev=
		      continue
		    else
		      # If libtool objects are unsupported, then we need to preload.
		      prev=dlprefiles
		    fi
		  fi
1597

1598
1599
1600
1601
1602
1603
		  # CHECK ME:  I think I busted this.  -Ossama
		  if test "$prev" = dlprefiles; then
		    # Preload the old-style object.
		    dlprefiles="$dlprefiles $pic_object"
		    prev=
		  fi
1604

1605
1606
1607
1608
		  # A PIC object.
		  libobjs="$libobjs $pic_object"
		  arg="$pic_object"
		fi
1609

1610
1611
1612
1613
		# Non-PIC object.
		if test "$non_pic_object" != none; then
		  # Prepend the subdirectory the object is found in.
		  non_pic_object="$xdir$non_pic_object"
1614

1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
		  # A standard non-PIC object
		  non_pic_objects="$non_pic_objects $non_pic_object"
		  if test -z "$pic_object" || test "$pic_object" = none ; then
		    arg="$non_pic_object"
		  fi
		fi
	      else
		# Only an error if not doing a dry-run.
		if test -z "$run"; then
		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
		  exit $EXIT_FAILURE
		else
		  # Dry-run case.
1628

1629
1630
1631
1632
1633
1634
1635
		  # Extract subdirectory from the argument.
		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
		  if test "X$xdir" = "X$arg"; then
		    xdir=
		  else
		    xdir="$xdir/"
		  fi
1636

1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
		  libobjs="$libobjs $pic_object"
		  non_pic_objects="$non_pic_objects $non_pic_object"
		fi
	      fi
	    done
	  else
	    $echo "$modename: link input file \`$save_arg' does not exist"
	    exit $EXIT_FAILURE
	  fi
	  arg=$save_arg
	  prev=
	  continue
	  ;;
	rpath | xrpath)
	  # We need an absolute path.
	  case $arg in
	  [\\/]* | [A-Za-z]:[\\/]*) ;;
	  *)
	    $echo "$modename: only absolute run-paths are allowed" 1>&2
	    exit $EXIT_FAILURE
	    ;;
	  esac
	  if test "$prev" = rpath; then
	    case "$rpath " in
	    *" $arg "*) ;;
	    *) rpath="$rpath $arg" ;;
	    esac
	  else
	    case "$xrpath " in
	    *" $arg "*) ;;
	    *) xrpath="$xrpath $arg" ;;
	    esac
	  fi
	  prev=
	  continue
	  ;;
	xcompiler)
	  compiler_flags="$compiler_flags $qarg"
	  prev=
	  compile_command="$compile_command $qarg"
	  finalize_command="$finalize_command $qarg"
	  continue
	  ;;
	xlinker)
	  linker_flags="$linker_flags $qarg"
	  compiler_flags="$compiler_flags $wl$qarg"
	  prev=
	  compile_command="$compile_command $wl$qarg"
	  finalize_command="$finalize_command $wl$qarg"
	  continue
	  ;;
	xcclinker)
	  linker_flags="$linker_flags $qarg"
	  compiler_flags="$compiler_flags $qarg"
	  prev=
	  compile_command="$compile_command $qarg"
	  finalize_command="$finalize_command $qarg"
	  continue
	  ;;
	shrext)
  	  shrext_cmds="$arg"
	  prev=
	  continue
	  ;;
	*)
	  eval "$prev=\"\$arg\""
	  prev=
	  continue
	  ;;
	esac
      fi # test -n "$prev"
1710

1711
      prevarg="$arg"
1712

1713
1714
1715
1716
1717
1718
1719
1720
      case $arg in
      -all-static)
	if test -n "$link_static_flag"; then
	  compile_command="$compile_command $link_static_flag"
	  finalize_command="$finalize_command $link_static_flag"
	fi
	continue
	;;
1721

1722
1723
1724
1725
1726
      -allow-undefined)
	# FIXME: remove this flag sometime in the future.
	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
	continue
	;;
1727

1728
1729
1730
1731
      -avoid-version)
	avoid_version=yes
	continue
	;;
1732

1733
1734
1735
1736
      -dlopen)
	prev=dlfiles
	continue
	;;
1737

1738
1739
1740
1741
      -dlpreopen)
	prev=dlprefiles
	continue
	;;
1742

1743
1744
1745
1746
      -export-dynamic)
	export_dynamic=yes
	continue
	;;
1747

1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
      -export-symbols | -export-symbols-regex)
	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
	  $echo "$modename: more than one -exported-symbols argument is not allowed"
	  exit $EXIT_FAILURE
	fi
	if test "X$arg" = "X-export-symbols"; then
	  prev=expsyms
	else
	  prev=expsyms_regex
	fi
	continue
	;;
1760

1761
1762
1763
1764
      -inst-prefix-dir)
	prev=inst_prefix
	continue
	;;
1765

1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
      # so, if we see these flags be careful not to treat them like -L
      -L[A-Z][A-Z]*:*)
	case $with_gcc/$host in
	no/*-*-irix* | /*-*-irix*)
	  compile_command="$compile_command $arg"
	  finalize_command="$finalize_command $arg"
	  ;;
	esac
	continue
	;;
1777

1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
      -L*)
	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
	# We need an absolute path.
	case $dir in
	[\\/]* | [A-Za-z]:[\\/]*) ;;
	*)
	  absdir=`cd "$dir" && pwd`
	  if test -z "$absdir"; then
	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
	    exit $EXIT_FAILURE
	  fi
	  dir="$absdir"
	  ;;
	esac
	case "$deplibs " in
	*" -L$dir "*) ;;
	*)
	  deplibs="$deplibs -L$dir"
	  lib_search_path="$lib_search_path $dir"
	  ;;
	esac
	case $host in
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
	  case :$dllsearchpath: in
	  *":$dir:"*) ;;
	  *) dllsearchpath="$dllsearchpath:$dir";;
	  esac
	  ;;
	esac
	continue
	;;
1809

1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
      -l*)
	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
	  case $host in
	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
	    # These systems don't actually have a C or math library (as such)
	    continue
	    ;;
	  *-*-mingw* | *-*-os2*)
	    # These systems don't actually have a C library (as such)
	    test "X$arg" = "X-lc" && continue
	    ;;
	  *-*-openbsd* | *-*-freebsd*)
	    # Do not include libc due to us having libc/libc_r.
	    test "X$arg" = "X-lc" && continue
	    ;;
	  *-*-rhapsody* | *-*-darwin1.[012])
	    # Rhapsody C and math libraries are in the System framework
	    deplibs="$deplibs -framework System"
	    continue
	  esac
	elif test "X$arg" = "X-lc_r"; then
	 case $host in
	 *-*-openbsd* | *-*-freebsd*)
	   # Do not include libc_r directly, use -pthread flag.
	   continue
	   ;;
	 esac
	fi
	deplibs="$deplibs $arg"
	continue
	;;
1841

1842
1843
1844
1845
1846
1847
1848
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
        case "$archive_cmds" in
            *"\$LD"*) ;;
            *) deplibs="$deplibs $arg";;
        esac
	continue
	;;
1849

1850
1851
1852
1853
      -module)
	module=yes
	continue
	;;
1854

1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
      # gcc -m* arguments should be passed to the linker via $compiler_flags
      # in order to pass architecture information to the linker
      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
      # but this is not reliable with gcc because gcc may use -mfoo to
      # select a different linker, different libraries, etc, while
      # -Wl,-mfoo simply passes -mfoo to the linker.
      -m*)
	# Unknown arguments in both finalize_command and compile_command need
	# to be aesthetically quoted because they are evaled later.
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
	case $arg in
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
	  arg="\"$arg\""
	  ;;
	esac
        compile_command="$compile_command $arg"
        finalize_command="$finalize_command $arg"
        if test "$with_gcc" = "yes" ; then
          compiler_flags="$compiler_flags $arg"
        fi
        continue
1876
        ;;
1877

1878
1879
1880
1881
      -shrext)
	prev=shrext
	continue
	;;
1882

1883
1884
1885
1886
      -no-fast-install)
	fast_install=no
	continue
	;;
1887

1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
      -no-install)
	case $host in
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
	  # The PATH hackery in wrapper scripts is required on Windows
	  # in order for the loader to find any dlls it needs.
	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
	  fast_install=no
	  ;;
	*) no_install=yes ;;
	esac
	continue
	;;
1901

1902
1903
1904
1905
      -no-undefined)
	allow_undefined=no
	continue
	;;
1906

1907
1908
1909
1910
      -objectlist)
	prev=objectlist
	continue
	;;
1911

1912
      -o) prev=output ;;
1913

1914
1915
1916
1917
      -precious-files-regex)
	prev=precious_regex
	continue
	;;
1918

1919
1920
1921
1922
      -release)
	prev=release
	continue
	;;
1923

1924
1925
1926
1927
      -rpath)
	prev=rpath
	continue
	;;
1928

1929
1930
1931
1932
      -R)
	prev=xrpath
	continue
	;;
1933

1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
      -R*)
	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
	# We need an absolute path.
	case $dir in
	[\\/]* | [A-Za-z]:[\\/]*) ;;
	*)
	  $echo "$modename: only absolute run-paths are allowed" 1>&2
	  exit $EXIT_FAILURE
	  ;;
	esac
	case "$xrpath " in
	*" $dir "*) ;;
	*) xrpath="$xrpath $dir" ;;
	esac
	continue
1949
	;;
1950

1951
1952
1953
1954
1955
1956
1957
      -static)
	# The effects of -static are defined in a previous loop.
	# We used to do the same as -all-static on platforms that
	# didn't have a PIC flag, but the assumption that the effects
	# would be equivalent was wrong.  It would break on at least
	# Digital Unix and AIX.
	continue
1958
	;;
1959

1960
1961
      -thread-safe)
	thread_safe=yes
1962
1963
	continue
	;;
1964

1965
1966
1967
1968
1969
1970
1971
1972
1973
      -version-info)
	prev=vinfo
	continue
	;;
      -version-number)
	prev=vinfo
	vinfo_number=yes
	continue
	;;
1974

1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
      -Wc,*)
	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
	arg=
	save_ifs="$IFS"; IFS=','
	for flag in $args; do
	  IFS="$save_ifs"
	  case $flag in
	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
	    flag="\"$flag\""
	    ;;
	  esac
	  arg="$arg $wl$flag"
	  compiler_flags="$compiler_flags $flag"
	done
	IFS="$save_ifs"
	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
	;;
1992

1993
1994
1995
1996
1997
1998
1999
2000
      -Wl,*)
	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
	arg=
	save_ifs="$IFS"; IFS=','
	for flag in $args; do
	  IFS="$save_ifs"
	  case $flag in
	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
For faster browsing, not all history is shown. View entire blame