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

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1002
1003
1004
      # Allow error messages only from the first compilation.
      if test "$suppress_opt" = yes; then
        suppress_output=' >/dev/null 2>&1'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1005
      fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1006
1007
1008
1009
1010
    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
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1011

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1012
EOF
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1013
1014
1015
1016
1017
1018
    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
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1019
	command="$base_compile $qsrcfile"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1020
      else
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1021
	command="$base_compile $qsrcfile $pic_flag"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1022
1023
1024
1025
1026
1027
1028
      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"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1029
      $run $rm "$obj" "$output_obj"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1030
1031
1032
1033
      $show "$command"
      if $run eval "$command"; then :
      else
	$run $rm $removelist
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1034
	exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1035
1036
1037
      fi

      if test "$need_locks" = warn &&
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1038
1039
	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
	$echo "\
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
*** 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."

	$run $rm $removelist
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1054
	exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1055
1056
1057
      fi

      # Just move the object if needed
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1058
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1059
1060
1061
1062
1063
1064
1065
1066
1067
	$show "$mv $output_obj $obj"
	if $run $mv $output_obj $obj; then :
	else
	  error=$?
	  $run $rm $removelist
	  exit $error
	fi
      fi

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
      # 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'

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

EOF
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1083
1084
    fi

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1085
1086
    $run $mv "${libobj}T" "${libobj}"

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1087
1088
1089
1090
1091
    # Unlock the critical section if it was locked
    if test "$need_locks" != no; then
      $run $rm "$lockfile"
    fi

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1092
    exit $EXIT_SUCCESS
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
    ;;

  # 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
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1103
      # flag for every libtool invocation.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
      # allow_undefined=no

      # 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"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1118
    base_compile="$nonopt $@"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
    compile_command="$nonopt"
    finalize_command="$nonopt"

    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=

    avoid_version=no
    dlfiles=
    dlprefiles=
    dlself=no
    export_dynamic=no
    export_symbols=
    export_symbols_regex=
    generated=
    libobjs=
    ltlibs=
    module=no
    no_install=no
    objs=
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1149
1150
1151
    non_pic_objects=
    notinst_path= # paths that contain not-installed libtool libraries
    precious_files_regex=
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
    prefer_static_libs=no
    preload=no
    prev=
    prevarg=
    release=
    rpath=
    xrpath=
    perm_rpath=
    temp_rpath=
    thread_safe=no
    vinfo=
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1163
1164
1165
    vinfo_number=no

    func_infer_tag $base_compile
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1166
1167
1168
1169
1170

    # We need to know -static, to get the right output filenames.
    for arg
    do
      case $arg in
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1171
1172
1173
      -all-static | -static | -static-libtool-libs)
	case $arg in
	-all-static)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1174
1175
1176
1177
1178
1179
	  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
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1180
1181
1182
	  prefer_static_libs=yes
	  ;;
	-static)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1183
1184
1185
	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
	    dlopen_self=$dlopen_self_static
	  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1186
1187
1188
1189
1190
1191
1192
1193
1194
	  prefer_static_libs=built
	  ;;
	-static-libtool-libs)
	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
	    dlopen_self=$dlopen_self_static
	  fi
	  prefer_static_libs=yes
	  ;;
	esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
	build_libtool_libs=no
	build_old_libs=yes
	break
	;;
      esac
    done

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

    # Go through the arguments, transforming them on the way.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1206
    while test "$#" -gt 0; do
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
      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"

      # 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

	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"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1271
	    exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1272
1273
1274
1275
1276
1277
1278
1279
1280
	  fi
	  prev=
	  continue
	  ;;
	expsyms_regex)
	  export_symbols_regex="$arg"
	  prev=
	  continue
	  ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1281
	inst_prefix)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1282
1283
1284
1285
	  inst_prefix_dir="$arg"
	  prev=
	  continue
	  ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1286
1287
1288
1289
1290
	precious_regex)
	  precious_files_regex="$arg"
	  prev=
	  continue
	  ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1291
1292
1293
1294
1295
	release)
	  release="-$arg"
	  prev=
	  continue
	  ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
	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.

	      # 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=

		# Read the .lo file
		# If there is no directory component, then add one.
		case $arg in
		*/* | *\\*) . $arg ;;
		*) . ./$arg ;;
		esac

		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

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

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

		  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

		  # CHECK ME:  I think I busted this.  -Ossama
		  if test "$prev" = dlprefiles; then
		    # Preload the old-style object.
		    dlprefiles="$dlprefiles $pic_object"
		    prev=
		  fi

		  # A PIC object.
		  libobjs="$libobjs $pic_object"
		  arg="$pic_object"
		fi

		# 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"

		  # 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
		else
		  # If the PIC object exists, use it instead.
		  # $xdir was prepended to $pic_object above.
		  non_pic_object="$pic_object"
		  non_pic_objects="$non_pic_objects $non_pic_object"
		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.

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

		  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
	  ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1408
1409
1410
1411
1412
1413
	rpath | xrpath)
	  # We need an absolute path.
	  case $arg in
	  [\\/]* | [A-Za-z]:[\\/]*) ;;
	  *)
	    $echo "$modename: only absolute run-paths are allowed" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1414
	    exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
	    ;;
	  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
	  ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
	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
	  ;;
	darwin_framework|darwin_framework_skip)
	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
	  compile_command="$compile_command $arg"
	  finalize_command="$finalize_command $arg"
	  prev=
	  continue
	  ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1466
1467
1468
1469
1470
1471
	*)
	  eval "$prev=\"\$arg\""
	  prev=
	  continue
	  ;;
	esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1472
      fi # test -n "$prev"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1473
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

      prevarg="$arg"

      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
	;;

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

      -avoid-version)
	avoid_version=yes
	continue
	;;

      -dlopen)
	prev=dlfiles
	continue
	;;

      -dlpreopen)
	prev=dlprefiles
	continue
	;;

      -export-dynamic)
	export_dynamic=yes
	continue
	;;

      -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"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1514
	  exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1515
1516
1517
1518
1519
1520
1521
1522
1523
	fi
	if test "X$arg" = "X-export-symbols"; then
	  prev=expsyms
	else
	  prev=expsyms_regex
	fi
	continue
	;;

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
      -framework|-arch|-isysroot)
	case " $CC " in
	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
		prev=darwin_framework_skip ;;
	  *) compiler_flags="$compiler_flags $arg"
	     prev=darwin_framework ;;
	esac
	compile_command="$compile_command $arg"
	finalize_command="$finalize_command $arg"
	continue
	;;

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1536
1537
1538
1539
1540
1541
1542
1543
1544
      -inst-prefix-dir)
	prev=inst_prefix
	continue
	;;

      # 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
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1545
	no/*-*-irix* | /*-*-irix*)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
	  compile_command="$compile_command $arg"
	  finalize_command="$finalize_command $arg"
	  ;;
	esac
	continue
	;;

      -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
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1562
1563
	    absdir="$dir"
	    notinst_path="$notinst_path $dir"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
	  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*)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1577
	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1578
1579
1580
1581
	  case :$dllsearchpath: in
	  *":$dir:"*) ;;
	  *) dllsearchpath="$dllsearchpath:$dir";;
	  esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1582
1583
1584
1585
	  case :$dllsearchpath: in
	  *":$testbindir:"*) ;;
	  *) dllsearchpath="$dllsearchpath:$testbindir";;
	  esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1586
1587
1588
1589
1590
1591
1592
1593
	  ;;
	esac
	continue
	;;

      -l*)
	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
	  case $host in
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1594
	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1595
1596
1597
	    # These systems don't actually have a C or math library (as such)
	    continue
	    ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1598
	  *-*-os2*)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1599
1600
1601
	    # These systems don't actually have a C library (as such)
	    test "X$arg" = "X-lc" && continue
	    ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1602
	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1603
1604
1605
	    # Do not include libc due to us having libc/libc_r.
	    test "X$arg" = "X-lc" && continue
	    ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1606
1607
1608
	  *-*-rhapsody* | *-*-darwin1.[012])
	    # Rhapsody C and math libraries are in the System framework
	    deplibs="$deplibs -framework System"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1609
1610
	    continue
	    ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1611
1612
1613
1614
1615
1616
1617
1618
	  *-*-sco3.2v5* | *-*-sco5v6*)
	    # Causes problems with __ctype
	    test "X$arg" = "X-lc" && continue
	    ;;
	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
	    # Compiler inserts libc in the correct place for threads to work
	    test "X$arg" = "X-lc" && continue
	    ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1619
	  esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1620
1621
1622
1623
1624
1625
1626
	elif test "X$arg" = "X-lc_r"; then
	 case $host in
	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
	   # Do not include libc_r directly, use -pthread flag.
	   continue
	   ;;
	 esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1627
1628
1629
1630
1631
	fi
	deplibs="$deplibs $arg"
	continue
	;;

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
      # Tru64 UNIX uses -model [arg] to determine the layout of C++
      # classes, name mangling, and exception handling.
      -model)
	compile_command="$compile_command $arg"
	compiler_flags="$compiler_flags $arg"
	finalize_command="$finalize_command $arg"
	prev=xcompiler
	continue
	;;

     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
	compiler_flags="$compiler_flags $arg"
	compile_command="$compile_command $arg"
	finalize_command="$finalize_command $arg"
	continue
	;;

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1649
1650
1651
1652
1653
      -module)
	module=yes
	continue
	;;

Emmanuel Bertin's avatar
Emmanuel Bertin committed
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
      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
      # -r[0-9][0-9]* specifies the processor on the SGI compiler
      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
      # +DA*, +DD* enable 64-bit mode on the HP compiler
      # -q* pass through compiler args for the IBM compiler
      # -m* pass through architecture-specific compiler args for GCC
      # -m*, -t[45]*, -txscale* pass through architecture-specific
      # compiler args for GCC
      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
      # -F/path gives path to uninstalled frameworks, gcc on darwin
      # @file GCC response files
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)

	# 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"
        compiler_flags="$compiler_flags $arg"
        continue
        ;;

      -shrext)
	prev=shrext
	continue
	;;

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1687
1688
1689
1690
1691
1692
1693
      -no-fast-install)
	fast_install=no
	continue
	;;

      -no-install)
	case $host in
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1694
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1695
	  # The PATH hackery in wrapper scripts is required on Windows
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1696
	  # and Darwin in order for the loader to find any dlls it needs.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
	  $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
	;;

      -no-undefined)
	allow_undefined=no
	continue
	;;

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1711
1712
1713
1714
1715
      -objectlist)
	prev=objectlist
	continue
	;;

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1716
1717
      -o) prev=output ;;

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1718
1719
1720
1721
1722
      -precious-files-regex)
	prev=precious_regex
	continue
	;;

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
      -release)
	prev=release
	continue
	;;

      -rpath)
	prev=rpath
	continue
	;;

      -R)
	prev=xrpath
	continue
	;;

      -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
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1745
	  exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1746
1747
1748
1749
1750
1751
1752
1753
1754
	  ;;
	esac
	case "$xrpath " in
	*" $dir "*) ;;
	*) xrpath="$xrpath $dir" ;;
	esac
	continue
	;;

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1755
      -static | -static-libtool-libs)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
	# 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
	;;

      -thread-safe)
	thread_safe=yes
	continue
	;;

      -version-info)
	prev=vinfo
	continue
	;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1773
1774
1775
1776
1777
      -version-number)
	prev=vinfo
	vinfo_number=yes
	continue
	;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
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
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825

      -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/^ //"`
	;;

      -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
	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
	    flag="\"$flag\""
	    ;;
	  esac
	  arg="$arg $wl$flag"
	  compiler_flags="$compiler_flags $wl$flag"
	  linker_flags="$linker_flags $flag"
	done
	IFS="$save_ifs"
	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
	;;

      -Xcompiler)
	prev=xcompiler
	continue
	;;

      -Xlinker)
	prev=xlinker
	continue
	;;

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1826
1827
1828
1829
1830
      -XCClinker)
	prev=xcclinker
	continue
	;;

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
      # Some other compiler flag.
      -* | +*)
	# 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
	;;

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1843
1844
1845
1846
      *.$objext)
	# A standard object.
	objs="$objs $arg"
	;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1847

Emmanuel Bertin's avatar
Emmanuel Bertin committed
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
      *.lo)
	# A libtool-controlled object.

	# 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=

	  # Read the .lo file
	  # If there is no directory component, then add one.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1858
	  case $arg in
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1859
1860
	  */* | *\\*) . $arg ;;
	  *) . ./$arg ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1861
	  esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942

	  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

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

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

	    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

	    # CHECK ME:  I think I busted this.  -Ossama
	    if test "$prev" = dlprefiles; then
	      # Preload the old-style object.
	      dlprefiles="$dlprefiles $pic_object"
	      prev=
	    fi

	    # A PIC object.
	    libobjs="$libobjs $pic_object"
	    arg="$pic_object"
	  fi

	  # 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"

	    # 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
	  else
	    # If the PIC object exists, use it instead.
	    # $xdir was prepended to $pic_object above.
	    non_pic_object="$pic_object"
	    non_pic_objects="$non_pic_objects $non_pic_object"
	  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.

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

	    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
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
	fi
	;;

      *.$libext)
	# An archive.
	deplibs="$deplibs $arg"
	old_deplibs="$old_deplibs $arg"
	continue
	;;

      *.la)
	# A libtool-controlled library.

	if test "$prev" = dlfiles; then
	  # This library was specified with -dlopen.
	  dlfiles="$dlfiles $arg"
	  prev=
	elif test "$prev" = dlprefiles; then
	  # The library was specified with -dlpreopen.
	  dlprefiles="$dlprefiles $arg"
	  prev=
	else
	  deplibs="$deplibs $arg"
	fi
	continue
	;;

      # Some other compiler argument.
      *)
	# 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
	;;
      esac # arg

      # Now actually substitute the argument into the commands.
      if test -n "$arg"; then
	compile_command="$compile_command $arg"
	finalize_command="$finalize_command $arg"
      fi
    done # argument parsing loop

    if test -n "$prev"; then
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
      $echo "$help" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1993
      exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1994
1995
1996
1997
1998
1999
2000
    fi

    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
      eval arg=\"$export_dynamic_flag_spec\"
      compile_command="$compile_command $arg"
      finalize_command="$finalize_command $arg"
    fi
For faster browsing, not all history is shown. View entire blame