ltmain.sh 194 KB
Newer Older
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4001
	      fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4002
4003
4004
	    done
	    IFS="$save_ifs"
	    if test -n "$export_symbols_regex"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4005
4006
	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
	    fi
	  fi
	fi

	if test -n "$export_symbols" && test -n "$include_expsyms"; then
	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
	fi

Emmanuel Bertin's avatar
Emmanuel Bertin committed
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
	tmp_deplibs=
	for test_deplib in $deplibs; do
		case " $convenience " in
		*" $test_deplib "*) ;;
		*)
			tmp_deplibs="$tmp_deplibs $test_deplib"
			;;
		esac
	done
	deplibs="$tmp_deplibs"

Emmanuel Bertin's avatar
Emmanuel Bertin committed
4028
4029
	if test -n "$convenience"; then
	  if test -n "$whole_archive_flag_spec"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4030
	    save_libobjs=$libobjs
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4031
4032
4033
4034
4035
	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
	  else
	    gentop="$output_objdir/${outputname}x"
	    generated="$generated $gentop"

Emmanuel Bertin's avatar
Emmanuel Bertin committed
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
	    func_extract_archives $gentop $convenience
	    libobjs="$libobjs $func_extract_archives_result"
	  fi
	fi
	
	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
	  eval flag=\"$thread_safe_flag_spec\"
	  linker_flags="$linker_flags $flag"
	fi

	# Make a backup of the uninstalled library when relinking
	if test "$mode" = relink; then
	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
	fi

	# Do each of the archive commands.
	if test "$module" = yes && test -n "$module_cmds" ; then
	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
	    eval test_cmds=\"$module_expsym_cmds\"
	    cmds=$module_expsym_cmds
	  else
	    eval test_cmds=\"$module_cmds\"
	    cmds=$module_cmds
	  fi
	else
	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
	  eval test_cmds=\"$archive_expsym_cmds\"
	  cmds=$archive_expsym_cmds
	else
	  eval test_cmds=\"$archive_cmds\"
	  cmds=$archive_cmds
	  fi
	fi

	if test "X$skipped_export" != "X:" &&
	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
	  :
	else
	  # The command line is too long to link in one step, link piecewise.
	  $echo "creating reloadable object files..."

	  # Save the value of $output and $libobjs because we want to
	  # use them later.  If we have whole_archive_flag_spec, we
	  # want to use save_libobjs as it was before
	  # whole_archive_flag_spec was expanded, because we can't
	  # assume the linker understands whole_archive_flag_spec.
	  # This may have to be revisited, in case too many
	  # convenience libraries get linked in and end up exceeding
	  # the spec.
	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
	    save_libobjs=$libobjs
	  fi
	  save_output=$output
	  output_la=`$echo "X$output" | $Xsed -e "$basename"`

	  # Clear the reloadable object creation command queue and
	  # initialize k to one.
	  test_cmds=
	  concat_cmds=
	  objlist=
	  delfiles=
	  last_robj=
	  k=1
	  output=$output_objdir/$output_la-${k}.$objext
	  # Loop over the list of objects to be linked.
	  for obj in $save_libobjs
	  do
	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
	    if test "X$objlist" = X ||
	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
		 test "$len" -le "$max_cmd_len"; }; then
	      objlist="$objlist $obj"
	    else
	      # The command $test_cmds is almost too long, add a
	      # command to the queue.
	      if test "$k" -eq 1 ; then
		# The first file doesn't have a previous command to add.
		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
	      else
		# All subsequent reloadable object files will link in
		# the last one created.
		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
	      fi
	      last_robj=$output_objdir/$output_la-${k}.$objext
	      k=`expr $k + 1`
	      output=$output_objdir/$output_la-${k}.$objext
	      objlist=$obj
	      len=1
	    fi
	  done
	  # Handle the remaining objects by creating one last
	  # reloadable object file.  All subsequent reloadable object
	  # files will link in the last one created.
	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"

	  if ${skipped_export-false}; then
	    $show "generating symbol list for \`$libname.la'"
	    export_symbols="$output_objdir/$libname.exp"
	    $run $rm $export_symbols
	    libobjs=$output
	    # Append the command to create the export file.
	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
          fi

	  # Set up a command to remove the reloadable object files
	  # after they are used.
	  i=0
	  while test "$i" -lt "$k"
	  do
	    i=`expr $i + 1`
	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
	  done

	  $echo "creating a temporary reloadable object file: $output"

	  # Loop through the commands generated above and execute them.
	  save_ifs="$IFS"; IFS='~'
	  for cmd in $concat_cmds; do
	    IFS="$save_ifs"
	    $show "$cmd"
	    $run eval "$cmd" || exit $?
	  done
	  IFS="$save_ifs"

	  libobjs=$output
	  # Restore the value of output.
	  output=$save_output
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4165

Emmanuel Bertin's avatar
Emmanuel Bertin committed
4166
4167
	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4168
	  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4169
4170
	  # Expand the library linking commands again to reset the
	  # value of $libobjs for piecewise linking.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4171

Emmanuel Bertin's avatar
Emmanuel Bertin committed
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
	  # Do each of the archive commands.
	  if test "$module" = yes && test -n "$module_cmds" ; then
	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
	      cmds=$module_expsym_cmds
	    else
	      cmds=$module_cmds
	    fi
	  else
	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
	    cmds=$archive_expsym_cmds
	  else
	    cmds=$archive_cmds
	    fi
	  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4186

Emmanuel Bertin's avatar
Emmanuel Bertin committed
4187
4188
4189
	  # Append the command to remove the reloadable object files
	  # to the just-reset $cmds.
	  eval cmds=\"\$cmds~\$rm $delfiles\"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4190
4191
4192
4193
	fi
	save_ifs="$IFS"; IFS='~'
	for cmd in $cmds; do
	  IFS="$save_ifs"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4194
	  eval cmd=\"$cmd\"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4195
	  $show "$cmd"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
	  $run eval "$cmd" || {
	    lt_exit=$?

	    # Restore the uninstalled library and exit
	    if test "$mode" = relink; then
	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
	    fi

	    exit $lt_exit
	  }
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4206
4207
4208
4209
4210
4211
	done
	IFS="$save_ifs"

	# Restore the uninstalled library and exit
	if test "$mode" = relink; then
	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4212
4213
4214
4215
4216
4217
4218
4219
4220

	  if test -n "$convenience"; then
	    if test -z "$whole_archive_flag_spec"; then
	      $show "${rm}r $gentop"
	      $run ${rm}r "$gentop"
	    fi
	  fi

	  exit $EXIT_SUCCESS
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
	fi

	# Create links to the real library.
	for linkname in $linknames; do
	  if test "$realname" != "$linkname"; then
	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
	  fi
	done

	# If -module or -export-dynamic was specified, set the dlname.
	if test "$module" = yes || test "$export_dynamic" = yes; then
	  # On all known operating systems, these are identical.
	  dlname="$soname"
	fi
      fi
      ;;

    obj)
      if test -n "$deplibs"; then
	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
      fi

      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
      fi

      if test -n "$rpath"; then
	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
      fi

      if test -n "$xrpath"; then
	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
      fi

      if test -n "$vinfo"; then
	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
      fi

      if test -n "$release"; then
	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
      fi

      case $output in
      *.lo)
	if test -n "$objs$old_deplibs"; then
	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4268
	  exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
	fi
	libobj="$output"
	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
	;;
      *)
	libobj=
	obj="$output"
	;;
      esac

      # Delete the old objects.
      $run $rm $obj $libobj

      # Objects from convenience libraries.  This assumes
      # single-version convenience libraries.  Whenever we create
      # different ones for PIC/non-PIC, this we'll have to duplicate
      # the extraction.
      reload_conv_objs=
      gentop=
      # reload_cmds runs $LD directly, so let us get rid of
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4289
4290
      # -Wl from whole_archive_flag_spec and hope we can get by with
      # turning comma into space..
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4291
4292
4293
4294
      wl=

      if test -n "$convenience"; then
	if test -n "$whole_archive_flag_spec"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4295
4296
	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
	  reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4297
4298
4299
4300
	else
	  gentop="$output_objdir/${obj}x"
	  generated="$generated $gentop"

Emmanuel Bertin's avatar
Emmanuel Bertin committed
4301
4302
	  func_extract_archives $gentop $convenience
	  reload_conv_objs="$reload_objs $func_extract_archives_result"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4303
4304
4305
4306
4307
4308
4309
	fi
      fi

      # Create the old-style object.
      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test

      output="$obj"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4310
      cmds=$reload_cmds
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4311
4312
4313
      save_ifs="$IFS"; IFS='~'
      for cmd in $cmds; do
	IFS="$save_ifs"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4314
	eval cmd=\"$cmd\"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
	$show "$cmd"
	$run eval "$cmd" || exit $?
      done
      IFS="$save_ifs"

      # Exit if we aren't doing a library object file.
      if test -z "$libobj"; then
	if test -n "$gentop"; then
	  $show "${rm}r $gentop"
	  $run ${rm}r $gentop
	fi

Emmanuel Bertin's avatar
Emmanuel Bertin committed
4327
	exit $EXIT_SUCCESS
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
      fi

      if test "$build_libtool_libs" != yes; then
	if test -n "$gentop"; then
	  $show "${rm}r $gentop"
	  $run ${rm}r $gentop
	fi

	# Create an invalid libtool object if no PIC, so that we don't
	# accidentally link it into a program.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4338
4339
4340
	# $show "echo timestamp > $libobj"
	# $run eval "echo timestamp > $libobj" || exit $?
	exit $EXIT_SUCCESS
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4341
4342
4343
4344
4345
4346
      fi

      if test -n "$pic_flag" || test "$pic_mode" != default; then
	# Only do commands if we really have different PIC objects.
	reload_objs="$libobjs $reload_conv_objs"
	output="$libobj"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4347
	cmds=$reload_cmds
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4348
4349
4350
	save_ifs="$IFS"; IFS='~'
	for cmd in $cmds; do
	  IFS="$save_ifs"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4351
	  eval cmd=\"$cmd\"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
	  $show "$cmd"
	  $run eval "$cmd" || exit $?
	done
	IFS="$save_ifs"
      fi

      if test -n "$gentop"; then
	$show "${rm}r $gentop"
	$run ${rm}r $gentop
      fi

Emmanuel Bertin's avatar
Emmanuel Bertin committed
4363
      exit $EXIT_SUCCESS
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4364
4365
4366
4367
      ;;

    prog)
      case $host in
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4368
	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
      esac
      if test -n "$vinfo"; then
	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
      fi

      if test -n "$release"; then
	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
      fi

      if test "$preload" = yes; then
	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
	   test "$dlopen_self_static" = unknown; then
	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
	fi
      fi

      case $host in
      *-*-rhapsody* | *-*-darwin1.[012])
	# On Rhapsody replace the C library is the System framework
	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
	;;
      esac

Emmanuel Bertin's avatar
Emmanuel Bertin committed
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
      case $host in
      *darwin*)
        # Don't allow lazy linking, it breaks C++ global constructors
        if test "$tagname" = CXX ; then
        compile_command="$compile_command ${wl}-bind_at_load"
        finalize_command="$finalize_command ${wl}-bind_at_load"
        fi
        ;;
      esac


      # move library search paths that coincide with paths to not yet
      # installed libraries to the beginning of the library search list
      new_libs=
      for path in $notinst_path; do
	case " $new_libs " in
	*" -L$path/$objdir "*) ;;
	*)
	  case " $compile_deplibs " in
	  *" -L$path/$objdir "*)
	    new_libs="$new_libs -L$path/$objdir" ;;
	  esac
	  ;;
	esac
      done
      for deplib in $compile_deplibs; do
	case $deplib in
	-L*)
	  case " $new_libs " in
	  *" $deplib "*) ;;
	  *) new_libs="$new_libs $deplib" ;;
	  esac
	  ;;
	*) new_libs="$new_libs $deplib" ;;
	esac
      done
      compile_deplibs="$new_libs"


Emmanuel Bertin's avatar
Emmanuel Bertin committed
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
      compile_command="$compile_command $compile_deplibs"
      finalize_command="$finalize_command $finalize_deplibs"

      if test -n "$rpath$xrpath"; then
	# If the user specified any rpath flags, then add them.
	for libdir in $rpath $xrpath; do
	  # This is the magic to use -rpath.
	  case "$finalize_rpath " in
	  *" $libdir "*) ;;
	  *) finalize_rpath="$finalize_rpath $libdir" ;;
	  esac
	done
      fi

      # Now hardcode the library paths
      rpath=
      hardcode_libdirs=
      for libdir in $compile_rpath $finalize_rpath; do
	if test -n "$hardcode_libdir_flag_spec"; then
	  if test -n "$hardcode_libdir_separator"; then
	    if test -z "$hardcode_libdirs"; then
	      hardcode_libdirs="$libdir"
	    else
	      # Just accumulate the unique libdirs.
	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
		;;
	      *)
		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
		;;
	      esac
	    fi
	  else
	    eval flag=\"$hardcode_libdir_flag_spec\"
	    rpath="$rpath $flag"
	  fi
	elif test -n "$runpath_var"; then
	  case "$perm_rpath " in
	  *" $libdir "*) ;;
	  *) perm_rpath="$perm_rpath $libdir" ;;
	  esac
	fi
	case $host in
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4476
	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4477
4478
4479
4480
	  case :$dllsearchpath: in
	  *":$libdir:"*) ;;
	  *) dllsearchpath="$dllsearchpath:$libdir";;
	  esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4481
4482
4483
4484
	  case :$dllsearchpath: in
	  *":$testbindir:"*) ;;
	  *) dllsearchpath="$dllsearchpath:$testbindir";;
	  esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
	  ;;
	esac
      done
      # Substitute the hardcoded libdirs into the rpath.
      if test -n "$hardcode_libdir_separator" &&
	 test -n "$hardcode_libdirs"; then
	libdir="$hardcode_libdirs"
	eval rpath=\" $hardcode_libdir_flag_spec\"
      fi
      compile_rpath="$rpath"

      rpath=
      hardcode_libdirs=
      for libdir in $finalize_rpath; do
	if test -n "$hardcode_libdir_flag_spec"; then
	  if test -n "$hardcode_libdir_separator"; then
	    if test -z "$hardcode_libdirs"; then
	      hardcode_libdirs="$libdir"
	    else
	      # Just accumulate the unique libdirs.
	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
		;;
	      *)
		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
		;;
	      esac
	    fi
	  else
	    eval flag=\"$hardcode_libdir_flag_spec\"
	    rpath="$rpath $flag"
	  fi
	elif test -n "$runpath_var"; then
	  case "$finalize_perm_rpath " in
	  *" $libdir "*) ;;
	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
	  esac
	fi
      done
      # Substitute the hardcoded libdirs into the rpath.
      if test -n "$hardcode_libdir_separator" &&
	 test -n "$hardcode_libdirs"; then
	libdir="$hardcode_libdirs"
	eval rpath=\" $hardcode_libdir_flag_spec\"
      fi
      finalize_rpath="$rpath"

      if test -n "$libobjs" && test "$build_old_libs" = yes; then
	# Transform all the library objects into standard objects.
	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
      fi

      dlsyms=
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
	if test -n "$NM" && test -n "$global_symbol_pipe"; then
	  dlsyms="${outputname}S.c"
	else
	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
	fi
      fi

      if test -n "$dlsyms"; then
	case $dlsyms in
	"") ;;
	*.c)
	  # Discover the nlist of each of the dlfiles.
	  nlist="$output_objdir/${outputname}.nm"

	  $show "$rm $nlist ${nlist}S ${nlist}T"
	  $run $rm "$nlist" "${nlist}S" "${nlist}T"

	  # Parse the name list into a source file.
	  $show "creating $output_objdir/$dlsyms"

	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */

#ifdef __cplusplus
extern \"C\" {
#endif

/* Prevent the only kind of declaration conflicts we can make. */
#define lt_preloaded_symbols some_other_symbol

/* External symbol declarations for the compiler. */\
"

	  if test "$dlself" = yes; then
	    $show "generating symbol list for \`$output'"

	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"

	    # Add our own program objects to the symbol list.
	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
	    for arg in $progfiles; do
	      $show "extracting global C symbols from \`$arg'"
	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
	    done

	    if test -n "$exclude_expsyms"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4587
	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4588
4589
4590
4591
	      $run eval '$mv "$nlist"T "$nlist"'
	    fi

	    if test -n "$export_symbols_regex"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4592
	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4593
4594
4595
4596
4597
	      $run eval '$mv "$nlist"T "$nlist"'
	    fi

	    # Prepare the list of exported symbols
	    if test -z "$export_symbols"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4598
	      export_symbols="$output_objdir/$outputname.exp"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4599
	      $run $rm $export_symbols
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4600
4601
4602
4603
4604
4605
4606
	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
              case $host in
              *cygwin* | *mingw* )
	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
                ;;
              esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4607
	    else
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4608
4609
	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4610
	      $run eval 'mv "$nlist"T "$nlist"'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4611
4612
4613
4614
4615
4616
              case $host in
              *cygwin* | *mingw* )
	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
                ;;
              esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4617
4618
4619
4620
4621
	    fi
	  fi

	  for arg in $dlprefiles; do
	    $show "extracting global C symbols from \`$arg'"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4622
4623
	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
	    $run eval '$echo ": $name " >> "$nlist"'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4624
4625
4626
4627
4628
4629
4630
4631
	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
	  done

	  if test -z "$run"; then
	    # Make sure we have at least an empty file.
	    test -f "$nlist" || : > "$nlist"

	    if test -n "$exclude_expsyms"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4632
	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4633
4634
4635
4636
	      $mv "$nlist"T "$nlist"
	    fi

	    # Try sorting and uniquifying the output.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4637
4638
4639
4640
4641
4642
4643
	    if grep -v "^: " < "$nlist" |
		if sort -k 3 </dev/null >/dev/null 2>&1; then
		  sort -k 3
		else
		  sort +2
		fi |
		uniq > "$nlist"S; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4644
4645
4646
4647
4648
4649
4650
4651
	      :
	    else
	      grep -v "^: " < "$nlist" > "$nlist"S
	    fi

	    if test -f "$nlist"S; then
	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
	    else
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4652
	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
	    fi

	    $echo >> "$output_objdir/$dlsyms" "\

#undef lt_preloaded_symbols

#if defined (__STDC__) && __STDC__
# define lt_ptr void *
#else
# define lt_ptr char *
# define const
#endif

/* The mapping between symbol names and symbols. */
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
"

	    case $host in
	    *cygwin* | *mingw* )
	  $echo >> "$output_objdir/$dlsyms" "\
/* DATA imports from DLLs on WIN32 can't be const, because
   runtime relocations are performed -- see ld's documentation
   on pseudo-relocs */
struct {
"
	      ;;
	    * )
	  $echo >> "$output_objdir/$dlsyms" "\
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4680
const struct {
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4681
4682
4683
4684
4685
4686
"
	      ;;
	    esac


	  $echo >> "$output_objdir/$dlsyms" "\
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
  const char *name;
  lt_ptr address;
}
lt_preloaded_symbols[] =
{\
"

	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"

	    $echo >> "$output_objdir/$dlsyms" "\
  {0, (lt_ptr) 0}
};

/* This works around a problem in FreeBSD linker */
#ifdef FREEBSD_WORKAROUND
static const void *lt_preloaded_setup() {
  return lt_preloaded_symbols;
}
#endif

#ifdef __cplusplus
}
#endif\
"
	  fi

	  pic_flag_for_symtable=
	  case $host in
	  # compiling the symbol table file with pic_flag works around
	  # a FreeBSD bug that causes programs to crash when -lm is
	  # linked before any other PIC object.  But we must not use
	  # pic_flag when linking with -static.  The problem exists in
	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
	    case "$compile_command " in
	    *" -static "*) ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4723
	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4724
4725
4726
4727
	    esac;;
	  *-*-hpux*)
	    case "$compile_command " in
	    *" -static "*) ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4728
	    *) pic_flag_for_symtable=" $pic_flag";;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4729
4730
4731
4732
	    esac
	  esac

	  # Now compile the dynamic symbol file.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4733
4734
	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4735
4736
4737
4738
4739
4740

	  # Clean up the generated files.
	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"

	  # Transform the symbol file into the correct name.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
          case $host in
          *cygwin* | *mingw* )
            if test -f "$output_objdir/${outputname}.def" ; then
              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
            else
              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
             fi
            ;;
          * )
            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
            ;;
          esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4756
4757
4758
	  ;;
	*)
	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4759
	  exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4760
4761
4762
4763
4764
4765
4766
4767
	  ;;
	esac
      else
	# We keep going just in case the user didn't refer to
	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
	# really was required.

	# Nullify the symbol file.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4768
4769
	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4770
4771
4772
4773
      fi

      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
	# Replace the output file specification.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4774
	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4775
4776
4777
4778
4779
	link_command="$compile_command$compile_rpath"

	# We have no uninstalled library dependencies, so finalize right now.
	$show "$link_command"
	$run eval "$link_command"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4780
	exit_status=$?
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4781
4782
4783
4784
4785
4786
4787

	# Delete the generated files.
	if test -n "$dlsyms"; then
	  $show "$rm $output_objdir/${outputname}S.${objext}"
	  $run $rm "$output_objdir/${outputname}S.${objext}"
	fi

Emmanuel Bertin's avatar
Emmanuel Bertin committed
4788
	exit $exit_status
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
      fi

      if test -n "$shlibpath_var"; then
	# We should set the shlibpath_var
	rpath=
	for dir in $temp_rpath; do
	  case $dir in
	  [\\/]* | [A-Za-z]:[\\/]*)
	    # Absolute path.
	    rpath="$rpath$dir:"
	    ;;
	  *)
	    # Relative path: add a thisdir entry.
	    rpath="$rpath\$thisdir/$dir:"
	    ;;
	  esac
	done
	temp_rpath="$rpath"
      fi

      if test -n "$compile_shlibpath$finalize_shlibpath"; then
	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
      fi
      if test -n "$finalize_shlibpath"; then
	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
      fi

      compile_var=
      finalize_var=
      if test -n "$runpath_var"; then
	if test -n "$perm_rpath"; then
	  # We should set the runpath_var.
	  rpath=
	  for dir in $perm_rpath; do
	    rpath="$rpath$dir:"
	  done
	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
	fi
	if test -n "$finalize_perm_rpath"; then
	  # We should set the runpath_var.
	  rpath=
	  for dir in $finalize_perm_rpath; do
	    rpath="$rpath$dir:"
	  done
	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
	fi
      fi

      if test "$no_install" = yes; then
	# We don't need to create a wrapper script.
	link_command="$compile_var$compile_command$compile_rpath"
	# Replace the output file specification.
	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
	# Delete the old output file.
	$run $rm $output
	# Link the executable and exit
	$show "$link_command"
	$run eval "$link_command" || exit $?
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4847
	exit $EXIT_SUCCESS
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
      fi

      if test "$hardcode_action" = relink; then
	# Fast installation is not supported
	link_command="$compile_var$compile_command$compile_rpath"
	relink_command="$finalize_var$finalize_command$finalize_rpath"

	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
	$echo "$modename: \`$output' will be relinked during installation" 1>&2
      else
	if test "$fast_install" != no; then
	  link_command="$finalize_var$compile_command$finalize_rpath"
	  if test "$fast_install" = yes; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4861
	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
	  else
	    # fast_install is set to needless
	    relink_command=
	  fi
	else
	  link_command="$compile_var$compile_command$compile_rpath"
	  relink_command="$finalize_var$finalize_command$finalize_rpath"
	fi
      fi

      # Replace the output file specification.
      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`

      # Delete the old output files.
      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname

      $show "$link_command"
      $run eval "$link_command" || exit $?

      # Now create the wrapper script.
      $show "creating $output"

      # Quote the relink command for shipping.
      if test -n "$relink_command"; then
	# Preserve any variables that may affect compiler behavior
	for var in $variables_saved_for_relink; do
	  if eval test -z \"\${$var+set}\"; then
	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
	  elif eval var_value=\$$var; test -z "$var_value"; then
	    relink_command="$var=; export $var; $relink_command"
	  else
	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
	  fi
	done
	relink_command="(cd `pwd`; $relink_command)"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4898
	relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4899
4900
4901
      fi

      # Quote $echo for shipping.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4902
4903
4904
4905
      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
	case $progpath in
	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
	esac
	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
      else
	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
      fi

      # Only actually do things if our run command is non-null.
      if test -z "$run"; then
	# win32 will think the script is a binary if it has
	# a .exe suffix, so we strip it off here.
	case $output in
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4917
	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4918
4919
4920
	esac
	# test for cygwin because mv fails w/o .exe extensions
	case $host in
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4921
4922
4923
	  *cygwin*)
	    exeext=.exe
	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4924
4925
	  *) exeext= ;;
	esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
	case $host in
	  *cygwin* | *mingw* )
            output_name=`basename $output`
            output_path=`dirname $output`
            cwrappersource="$output_path/$objdir/lt-$output_name.c"
            cwrapper="$output_path/$output_name.exe"
            $rm $cwrappersource $cwrapper
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15

	    cat > $cwrappersource <<EOF

/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP

   The $output program cannot be directly executed until all the libtool
   libraries that it depends on are installed.

   This wrapper executable should never be moved out of the build directory.
   If it is, it will not operate correctly.

   Currently, it simply execs the wrapper *script* "/bin/sh $output",
   but could eventually absorb all of the scripts functionality and
   exec $objdir/$outputname directly.
*/
EOF
	    cat >> $cwrappersource<<"EOF"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <malloc.h>
#include <stdarg.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <sys/stat.h>

#if defined(PATH_MAX)
# define LT_PATHMAX PATH_MAX
#elif defined(MAXPATHLEN)
# define LT_PATHMAX MAXPATHLEN
#else
# define LT_PATHMAX 1024
#endif

#ifndef DIR_SEPARATOR
# define DIR_SEPARATOR '/'
# define PATH_SEPARATOR ':'
#endif

#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
  defined (__OS2__)
# define HAVE_DOS_BASED_FILE_SYSTEM
# ifndef DIR_SEPARATOR_2
#  define DIR_SEPARATOR_2 '\\'
# endif
# ifndef PATH_SEPARATOR_2
#  define PATH_SEPARATOR_2 ';'
# endif
#endif

#ifndef DIR_SEPARATOR_2
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
#else /* DIR_SEPARATOR_2 */
# define IS_DIR_SEPARATOR(ch) \
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
#endif /* DIR_SEPARATOR_2 */

#ifndef PATH_SEPARATOR_2
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
#else /* PATH_SEPARATOR_2 */
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
#endif /* PATH_SEPARATOR_2 */

#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
#define XFREE(stale) do { \
For faster browsing, not all history is shown. View entire blame