ltconfig 95.5 KB
Newer Older
Elliot Lee's avatar
Elliot Lee committed
1 2 3
#! /bin/sh

# ltconfig - Create a system-specific libtool.
4
# Copyright (C) 1996-1999 Free Software Foundation, Inc.
Manish Singh's avatar
Manish Singh committed
5
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
Elliot Lee's avatar
Elliot Lee committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

# A lot of this script is taken from autoconf-2.10.

Manish Singh's avatar
Manish Singh committed
28 29 30 31 32 33
# Check that we are running under the correct shell.
SHELL=${CONFIG_SHELL-/bin/sh}
echo=echo
if test "X$1" = X--no-reexec; then
  # Discard the --no-reexec flag, and continue.
  shift
34
elif test "X$1" = X--fallback-echo; then
Manish Singh's avatar
Manish Singh committed
35 36
  # Avoid inline document here, it may be left over
  :
Manish Singh's avatar
Manish Singh committed
37 38 39 40 41 42 43 44
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
  # Yippee, $echo works!
  :
else
  # Restart under the correct shell.
  exec "$SHELL" "$0" --no-reexec ${1+"$@"}
fi

Manish Singh's avatar
Manish Singh committed
45 46 47 48 49 50 51 52 53
if test "X$1" = X--fallback-echo; then
  # used as fallback echo
  shift
  cat <<EOF
$*
EOF
  exit 0
fi

54 55
# Find the correct PATH separator.  Usually this is `:', but
# DJGPP uses `;' like DOS.
56
if test "X${PATH_SEPARATOR+set}" != Xset; then
57 58 59 60 61 62 63
  UNAME=${UNAME-`uname 2>/dev/null`}
  case X$UNAME in
    *-DOS) PATH_SEPARATOR=';' ;;
    *)     PATH_SEPARATOR=':' ;;
  esac
fi

64 65
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
66
if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
67

68
if test "X${echo_test_string+set}" != Xset; then
69 70 71 72 73 74 75 76 77 78 79 80 81
  # find a string as large as possible, as long as the shell can cope with it
  for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
    if (echo_test_string="`eval $cmd`") 2>/dev/null &&
       echo_test_string="`eval $cmd`" &&
       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then
      break
    fi
  done
fi

if test "X`($echo '\t') 2>/dev/null`" != 'X\t' ||
   test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then
Manish Singh's avatar
Manish Singh committed
82 83
  # The Solaris, AIX, and Digital Unix default echo programs unquote
  # backslashes.  This makes it impossible to quote backslashes using
84
  #   echo "$something" | sed 's/\\/\\\\/g'
Manish Singh's avatar
Manish Singh committed
85 86
  #
  # So, first we look for a working echo in the user's PATH.
87

88
  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
Manish Singh's avatar
Manish Singh committed
89
  for dir in $PATH /usr/ucb; do
Manish Singh's avatar
Manish Singh committed
90
    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
91 92
       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
       test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
Manish Singh's avatar
Manish Singh committed
93 94 95 96 97 98 99 100
      echo="$dir/echo"
      break
    fi
  done
  IFS="$save_ifs"

  if test "X$echo" = Xecho; then
    # We didn't find a better echo, so look for alternatives.
101 102
    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
       test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
Manish Singh's avatar
Manish Singh committed
103 104
      # This shell has a builtin print -r that does the trick.
      echo='print -r'
Manish Singh's avatar
Manish Singh committed
105 106
    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
	 test "X$CONFIG_SHELL" != X/bin/ksh; then
Manish Singh's avatar
Manish Singh committed
107
      # If we have ksh, try running ltconfig again with it.
108 109
      ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}"
      export ORIGINAL_CONFIG_SHELL
Manish Singh's avatar
Manish Singh committed
110 111 112
      CONFIG_SHELL=/bin/ksh
      export CONFIG_SHELL
      exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"}
Manish Singh's avatar
Manish Singh committed
113 114
    else
      # Try using printf.
115
      echo='printf "%s\n"'
116
      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
117 118
	 test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
	# Cool, printf works
119 120 121 122 123 124 125 126 127 128
	:
      elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
	   test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
	CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL"
	export CONFIG_SHELL
	SHELL="$CONFIG_SHELL"
	export SHELL
	echo="$CONFIG_SHELL $0 --fallback-echo"
      elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
	   test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
129
	echo="$CONFIG_SHELL $0 --fallback-echo"
130
      else
131
	# maybe with a smaller string...
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
	prev=:

	for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then
	    break
	  fi
	  prev="$cmd"
	done

	if test "$prev" != 'sed 50q "$0"'; then
	  echo_test_string=`eval $prev`
	  export echo_test_string
	  exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"}
	else
	  # Oops.  We lost completely, so just stick with echo.
	  echo=echo
	fi
149
      fi
Manish Singh's avatar
Manish Singh committed
150
    fi
151 152 153 154 155 156 157 158 159 160 161
  fi
fi

# Sed substitution that helps us do robust quoting.  It backslashifies
# metacharacters that are still active within double-quoted strings.
Xsed='sed -e s/^X//'
sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'

# Same as above, but do not quote variable references.
double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'

162 163 164 165
# Sed substitution to delay expansion of an escaped shell variable in a
# double_quote_subst'ed string.
delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'

Elliot Lee's avatar
Elliot Lee committed
166
# The name of this program.
167
progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'`
Elliot Lee's avatar
Elliot Lee committed
168 169 170 171

# Constants:
PROGRAM=ltconfig
PACKAGE=libtool
Manish Singh's avatar
Manish Singh committed
172 173
VERSION=1.3.5
TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)"
174 175
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
Elliot Lee's avatar
Elliot Lee committed
176 177 178 179 180
rm="rm -f"

help="Try \`$progname --help' for more information."

# Global variables:
Manish Singh's avatar
Manish Singh committed
181
default_ofile=libtool
Elliot Lee's avatar
Elliot Lee committed
182 183
can_build_shared=yes
enable_shared=yes
Manish Singh's avatar
Manish Singh committed
184 185
# All known linkers require a `.a' archive for static linking (except M$VC,
# which needs '.lib').
Elliot Lee's avatar
Elliot Lee committed
186
enable_static=yes
187 188
enable_fast_install=yes
enable_dlopen=unknown
Manish Singh's avatar
Manish Singh committed
189
enable_win32_dll=no
Elliot Lee's avatar
Elliot Lee committed
190 191 192 193 194 195 196
ltmain=
silent=
srcdir=
ac_config_guess=
ac_config_sub=
host=
nonopt=
Manish Singh's avatar
Manish Singh committed
197
ofile="$default_ofile"
Elliot Lee's avatar
Elliot Lee committed
198 199 200
verify_host=yes
with_gcc=no
with_gnu_ld=no
201
need_locks=yes
202
ac_ext=c
203 204
objext=o
libext=a
Manish Singh's avatar
Manish Singh committed
205
exeext=
206
cache_file=
Elliot Lee's avatar
Elliot Lee committed
207 208 209 210 211

old_AR="$AR"
old_CC="$CC"
old_CFLAGS="$CFLAGS"
old_CPPFLAGS="$CPPFLAGS"
Manish Singh's avatar
Manish Singh committed
212
old_LDFLAGS="$LDFLAGS"
Elliot Lee's avatar
Elliot Lee committed
213 214
old_LD="$LD"
old_LN_S="$LN_S"
Manish Singh's avatar
Manish Singh committed
215
old_LIBS="$LIBS"
Elliot Lee's avatar
Elliot Lee committed
216 217
old_NM="$NM"
old_RANLIB="$RANLIB"
218
old_DLLTOOL="$DLLTOOL"
Manish Singh's avatar
Manish Singh committed
219
old_OBJDUMP="$OBJDUMP"
220
old_AS="$AS"
Elliot Lee's avatar
Elliot Lee committed
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240

# Parse the command line options.
args=
prev=
for option
do
  case "$option" in
  -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  *) optarg= ;;
  esac

  # If the previous option needs an argument, assign it.
  if test -n "$prev"; then
    eval "$prev=\$option"
    prev=
    continue
  fi

  case "$option" in
  --help) cat <<EOM
241
Usage: $progname [OPTION]... [HOST [LTMAIN]]
Elliot Lee's avatar
Elliot Lee committed
242 243 244

Generate a system-specific libtool script.

Manish Singh's avatar
Manish Singh committed
245
    --debug                enable verbose shell tracing
Elliot Lee's avatar
Elliot Lee committed
246 247
    --disable-shared       do not build shared libraries
    --disable-static       do not build static libraries
248 249
    --disable-fast-install do not optimize for fast installation
    --enable-dlopen        enable dlopen support
Manish Singh's avatar
Manish Singh committed
250
    --enable-win32-dll     enable building dlls on win32 hosts
Elliot Lee's avatar
Elliot Lee committed
251 252
    --help                 display this help and exit
    --no-verify            do not verify that HOST is a valid host type
Manish Singh's avatar
Manish Singh committed
253
-o, --output=FILE          specify the output file [default=$default_ofile]
Elliot Lee's avatar
Elliot Lee committed
254
    --quiet                same as \`--silent'
255
    --silent               do not print informational messages
Elliot Lee's avatar
Elliot Lee committed
256 257 258 259
    --srcdir=DIR           find \`config.guess' in DIR
    --version              output version information and exit
    --with-gcc             assume that the GNU C compiler will be used
    --with-gnu-ld          assume that the C compiler uses the GNU linker
260
    --disable-lock         disable file locking
261
    --cache-file=FILE      configure cache file
Elliot Lee's avatar
Elliot Lee committed
262

263 264
LTMAIN is the \`ltmain.sh' shell script fragment or \`ltmain.c' program
that provides basic libtool functionality.
Elliot Lee's avatar
Elliot Lee committed
265 266 267 268 269 270

HOST is the canonical host system name [default=guessed].
EOM
  exit 0
  ;;

Manish Singh's avatar
Manish Singh committed
271 272 273 274 275
  --debug)
    echo "$progname: enabling shell trace mode"
    set -x
    ;;

Elliot Lee's avatar
Elliot Lee committed
276 277 278 279
  --disable-shared) enable_shared=no ;;

  --disable-static) enable_static=no ;;

280 281 282 283
  --disable-fast-install) enable_fast_install=no ;;

  --enable-dlopen) enable_dlopen=yes ;;

Manish Singh's avatar
Manish Singh committed
284 285
  --enable-win32-dll) enable_win32_dll=yes ;;

Elliot Lee's avatar
Elliot Lee committed
286 287 288 289 290 291 292
  --quiet | --silent) silent=yes ;;

  --srcdir) prev=srcdir ;;
  --srcdir=*) srcdir="$optarg" ;;

  --no-verify) verify_host=no ;;

Manish Singh's avatar
Manish Singh committed
293 294 295
  --output | -o) prev=ofile ;;
  --output=*) ofile="$optarg" ;;

296
  --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"; exit 0 ;;
Elliot Lee's avatar
Elliot Lee committed
297 298 299 300

  --with-gcc) with_gcc=yes ;;
  --with-gnu-ld) with_gnu_ld=yes ;;

301 302
  --disable-lock) need_locks=no ;;

303 304
  --cache-file=*) cache_file="$optarg" ;;

Elliot Lee's avatar
Elliot Lee committed
305 306 307 308 309 310 311 312 313 314
  -*)
    echo "$progname: unrecognized option \`$option'" 1>&2
    echo "$help" 1>&2
    exit 1
    ;;

  *)
    if test -z "$ltmain"; then
      ltmain="$option"
    elif test -z "$host"; then
315
# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1
Elliot Lee's avatar
Elliot Lee committed
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333
#      if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then
#        echo "$progname: warning \`$option' is not a valid host type" 1>&2
#      fi
      host="$option"
    else
      echo "$progname: too many arguments" 1>&2
      echo "$help" 1>&2
      exit 1
    fi ;;
  esac
done

if test -z "$ltmain"; then
  echo "$progname: you must specify a LTMAIN file" 1>&2
  echo "$help" 1>&2
  exit 1
fi

Manish Singh's avatar
Manish Singh committed
334
if test ! -f "$ltmain"; then
335 336 337
  echo "$progname: \`$ltmain' does not exist" 1>&2
  echo "$help" 1>&2
  exit 1
Elliot Lee's avatar
Elliot Lee committed
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371
fi

# Quote any args containing shell metacharacters.
ltconfig_args=
for arg
do
  case "$arg" in
  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
  ltconfig_args="$ltconfig_args '$arg'" ;;
  *) ltconfig_args="$ltconfig_args $arg" ;;
  esac
done

# A relevant subset of AC_INIT.

# File descriptor usage:
# 0 standard input
# 1 file creation
# 2 errors and warnings
# 3 some systems may open it to /dev/tty
# 4 used on the Kubota Titan
# 5 compiler messages saved in config.log
# 6 checking for... messages and results
if test "$silent" = yes; then
  exec 6>/dev/null
else
  exec 6>&1
fi
exec 5>>./config.log

# NLS nuisances.
# Only set LANG and LC_ALL to C if already set.
# These must not be set unconditionally because not all systems understand
# e.g. LANG=C (notably SCO).
372 373
if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi
if test "X${LANG+set}"   = Xset; then LANG=C;   export LANG;   fi
Elliot Lee's avatar
Elliot Lee committed
374

375 376 377 378 379
if test -n "$cache_file" && test -r "$cache_file"; then
  echo "loading cache $cache_file within ltconfig"
  . $cache_file
fi

Elliot Lee's avatar
Elliot Lee committed
380 381 382 383 384 385 386 387 388 389 390 391 392
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
    ac_n= ac_c='
' ac_t='	'
  else
    ac_n=-n ac_c= ac_t=
  fi
else
  ac_n= ac_c='\c' ac_t=
fi

if test -z "$srcdir"; then
393
  # Assume the source directory is the same one as the path to LTMAIN.
394
  srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'`
Elliot Lee's avatar
Elliot Lee committed
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416
  test "$srcdir" = "$ltmain" && srcdir=.
fi

trap "$rm conftest*; exit 1" 1 2 15
if test "$verify_host" = yes; then
  # Check for config.guess and config.sub.
  ac_aux_dir=
  for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
    if test -f $ac_dir/config.guess; then
      ac_aux_dir=$ac_dir
      break
    fi
  done
  if test -z "$ac_aux_dir"; then
    echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2
    echo "$help" 1>&2
    exit 1
  fi
  ac_config_guess=$ac_aux_dir/config.guess
  ac_config_sub=$ac_aux_dir/config.sub

  # Make sure we can run config.sub.
Manish Singh's avatar
Manish Singh committed
417
  if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then :
Elliot Lee's avatar
Elliot Lee committed
418 419 420 421 422 423 424 425 426 427 428
  else
    echo "$progname: cannot run $ac_config_sub" 1>&2
    echo "$help" 1>&2
    exit 1
  fi

  echo $ac_n "checking host system type""... $ac_c" 1>&6

  host_alias=$host
  case "$host_alias" in
  "")
Manish Singh's avatar
Manish Singh committed
429
    if host_alias=`$SHELL $ac_config_guess`; then :
Elliot Lee's avatar
Elliot Lee committed
430 431 432 433 434 435
    else
      echo "$progname: cannot guess host type; you must specify one" 1>&2
      echo "$help" 1>&2
      exit 1
    fi ;;
  esac
Manish Singh's avatar
Manish Singh committed
436
  host=`$SHELL $ac_config_sub $host_alias`
Manish Singh's avatar
Manish Singh committed
437 438 439 440
  echo "$ac_t$host" 1>&6

  # Make sure the host verified.
  test -z "$host" && exit 1
Elliot Lee's avatar
Elliot Lee committed
441 442 443 444 445 446 447 448 449

elif test -z "$host"; then
  echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2
  echo "$help" 1>&2
  exit 1
else
  host_alias=$host
fi

450 451 452 453
# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
case "$host_os" in
linux-gnu*) ;;
linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
Elliot Lee's avatar
Elliot Lee committed
454 455 456 457 458 459
esac

host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`

Manish Singh's avatar
Manish Singh committed
460
case "$host_os" in
461
aix3*)
Manish Singh's avatar
Manish Singh committed
462 463 464
  # AIX sometimes has problems with the GCC collect2 program.  For some
  # reason, if we set the COLLECT_NAMES environment variable, the problems
  # vanish in a puff of smoke.
465
  if test "X${COLLECT_NAMES+set}" != Xset; then
Manish Singh's avatar
Manish Singh committed
466 467 468 469 470 471
    COLLECT_NAMES=
    export COLLECT_NAMES
  fi
  ;;
esac

Elliot Lee's avatar
Elliot Lee committed
472 473 474
# Determine commands to create old-style static archives.
old_archive_cmds='$AR cru $oldlib$oldobjs'
old_postinstall_cmds='chmod 644 $oldlib'
475
old_postuninstall_cmds=
Elliot Lee's avatar
Elliot Lee committed
476 477 478 479

# Set a sane default for `AR'.
test -z "$AR" && AR=ar

Manish Singh's avatar
Manish Singh committed
480 481 482
# Set a sane default for `OBJDUMP'.
test -z "$OBJDUMP" && OBJDUMP=objdump

Elliot Lee's avatar
Elliot Lee committed
483 484 485 486 487
# If RANLIB is not set, then run the test.
if test "${RANLIB+set}" != "set"; then
  result=no

  echo $ac_n "checking for ranlib... $ac_c" 1>&6
488
  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
Elliot Lee's avatar
Elliot Lee committed
489 490
  for dir in $PATH; do
    test -z "$dir" && dir=.
Manish Singh's avatar
Manish Singh committed
491
    if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then
Elliot Lee's avatar
Elliot Lee committed
492 493 494 495 496 497 498
      RANLIB="ranlib"
      result="ranlib"
      break
    fi
  done
  IFS="$save_ifs"

Manish Singh's avatar
Manish Singh committed
499
  echo "$ac_t$result" 1>&6
Elliot Lee's avatar
Elliot Lee committed
500 501 502
fi

if test -n "$RANLIB"; then
503 504
  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
  old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
Elliot Lee's avatar
Elliot Lee committed
505 506
fi

Manish Singh's avatar
Manish Singh committed
507
# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin.
508
test -z "$DLLTOOL" && DLLTOOL=dlltool
Manish Singh's avatar
Manish Singh committed
509
test -z "$OBJDUMP" && OBJDUMP=objdump
510 511
test -z "$AS" && AS=as

Elliot Lee's avatar
Elliot Lee committed
512 513 514 515 516
# Check to see if we are using GCC.
if test "$with_gcc" != yes || test -z "$CC"; then
  # If CC is not set, then try to find GCC or a usable CC.
  if test -z "$CC"; then
    echo $ac_n "checking for gcc... $ac_c" 1>&6
517
    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
Elliot Lee's avatar
Elliot Lee committed
518 519
    for dir in $PATH; do
      test -z "$dir" && dir=.
Manish Singh's avatar
Manish Singh committed
520
      if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then
Elliot Lee's avatar
Elliot Lee committed
521 522 523 524 525 526 527
	CC="gcc"
	break
      fi
    done
    IFS="$save_ifs"

    if test -n "$CC"; then
Manish Singh's avatar
Manish Singh committed
528
      echo "$ac_t$CC" 1>&6
Elliot Lee's avatar
Elliot Lee committed
529
    else
Manish Singh's avatar
Manish Singh committed
530
      echo "$ac_t"no 1>&6
Elliot Lee's avatar
Elliot Lee committed
531 532 533 534 535 536
    fi
  fi

  # Not "gcc", so try "cc", rejecting "/usr/ucb/cc".
  if test -z "$CC"; then
    echo $ac_n "checking for cc... $ac_c" 1>&6
537
    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
Elliot Lee's avatar
Elliot Lee committed
538 539 540
    cc_rejected=no
    for dir in $PATH; do
      test -z "$dir" && dir=.
Manish Singh's avatar
Manish Singh committed
541
      if test -f $dir/cc || test -f $dir/cc$ac_exeext; then
Elliot Lee's avatar
Elliot Lee committed
542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566
	if test "$dir/cc" = "/usr/ucb/cc"; then
	  cc_rejected=yes
	  continue
	fi
	CC="cc"
	break
      fi
    done
    IFS="$save_ifs"
    if test $cc_rejected = yes; then
      # We found a bogon in the path, so make sure we never use it.
      set dummy $CC
      shift
      if test $# -gt 0; then
	# We chose a different compiler from the bogus one.
	# However, it has the same name, so the bogon will be chosen
	# first if we set CC to just the name; use the full file name.
	shift
	set dummy "$dir/cc" "$@"
	shift
	CC="$@"
      fi
    fi

    if test -n "$CC"; then
Manish Singh's avatar
Manish Singh committed
567
      echo "$ac_t$CC" 1>&6
Elliot Lee's avatar
Elliot Lee committed
568
    else
Manish Singh's avatar
Manish Singh committed
569
      echo "$ac_t"no 1>&6
Elliot Lee's avatar
Elliot Lee committed
570 571 572 573 574 575 576 577 578 579 580
    fi

    if test -z "$CC"; then
      echo "$progname: error: no acceptable cc found in \$PATH" 1>&2
      exit 1
    fi
  fi

  # Now see if the compiler is really GCC.
  with_gcc=no
  echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6
Manish Singh's avatar
Manish Singh committed
581
  echo "$progname:581: checking whether we are using GNU C" >&5
Elliot Lee's avatar
Elliot Lee committed
582 583 584 585 586 587 588

  $rm conftest.c
  cat > conftest.c <<EOF
#ifdef __GNUC__
  yes;
#endif
EOF
Manish Singh's avatar
Manish Singh committed
589
  if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:589: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
Elliot Lee's avatar
Elliot Lee committed
590 591 592
    with_gcc=yes
  fi
  $rm conftest.c
Manish Singh's avatar
Manish Singh committed
593
  echo "$ac_t$with_gcc" 1>&6
Elliot Lee's avatar
Elliot Lee committed
594 595 596 597 598 599
fi

# Allow CC to be a program name with arguments.
set dummy $CC
compiler="$2"

600 601 602
echo $ac_n "checking for object suffix... $ac_c" 1>&6
$rm conftest*
echo 'int i = 1;' > conftest.c
Manish Singh's avatar
Manish Singh committed
603 604
echo "$progname:603: checking for object suffix" >& 5
if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621
  # Append any warnings to the config.log.
  cat conftest.err 1>&5

  for ac_file in conftest.*; do
    case $ac_file in
    *.c) ;;
    *) objext=`echo $ac_file | sed -e s/conftest.//` ;;
    esac
  done
else
  cat conftest.err 1>&5
  echo "$progname: failed program was:" >&5
  cat conftest.c >&5
fi
$rm conftest*
echo "$ac_t$objext" 1>&6

Manish Singh's avatar
Manish Singh committed
622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653
echo $ac_n "checking for executable suffix... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  ac_cv_exeext="no"
  $rm conftest*
  echo 'main () { return 0; }' > conftest.c
  echo "$progname:629: checking for executable suffix" >& 5
  if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then
    # Append any warnings to the config.log.
    cat conftest.err 1>&5

    for ac_file in conftest.*; do
      case $ac_file in
      *.c | *.err | *.$objext ) ;;
      *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;;
      esac
    done
  else
    cat conftest.err 1>&5
    echo "$progname: failed program was:" >&5
    cat conftest.c >&5
  fi
  $rm conftest*
fi
if test "X$ac_cv_exeext" = Xno; then
  exeext=""
else
  exeext="$ac_cv_exeext"
fi
echo "$ac_t$ac_cv_exeext" 1>&6

Elliot Lee's avatar
Elliot Lee committed
654 655 656 657 658 659 660 661 662 663 664 665
echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
pic_flag=
special_shlib_compile_flags=
wl=
link_static_flag=
no_builtin_flag=

if test "$with_gcc" = yes; then
  wl='-Wl,'
  link_static_flag='-static'

  case "$host_os" in
666
  beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
Elliot Lee's avatar
Elliot Lee committed
667
    # PIC is the default for these OSes.
Manish Singh's avatar
Manish Singh committed
668
    ;;
669 670 671 672 673 674 675 676 677
  aix*)
    # Below there is a dirty hack to force normal static linking with -ldl
    # The problem is because libdl dynamically linked with both libc and
    # libC (AIX C++ library), which obviously doesn't included in libraries
    # list by gcc. This cause undefined symbols with -static flags.
    # This hack allows C programs to be linked with "-static -ldl", but
    # we not sure about C++ programs.
    link_static_flag="$link_static_flag ${wl}-lC"
    ;;
678
  cygwin* | mingw* | os2*)
Manish Singh's avatar
Manish Singh committed
679 680
    # We can build DLLs from non-PIC.
    ;;
681 682 683 684 685 686
  amigaos*)
    # FIXME: we need at least 68020 code to build shared libraries, but
    # adding the `-m68020' flag to GCC prevents building anything better,
    # like `-m68040'.
    pic_flag='-m68020 -resident32 -malways-restore-a4'
    ;;
687 688 689 690 691
  sysv4*MP*)
    if test -d /usr/nec; then
       pic_flag=-Kconform_pic
    fi
    ;;
Elliot Lee's avatar
Elliot Lee committed
692 693 694 695 696 697 698 699
  *)
    pic_flag='-fPIC'
    ;;
  esac
else
  # PORTME Check for PIC flags for the system compiler.
  case "$host_os" in
  aix3* | aix4*)
Manish Singh's avatar
Manish Singh committed
700
    # All AIX code is PIC.
Elliot Lee's avatar
Elliot Lee committed
701 702 703
    link_static_flag='-bnso -bI:/lib/syscalls.exp'
    ;;

Manish Singh's avatar
Manish Singh committed
704
  hpux9* | hpux10* | hpux11*)
Manish Singh's avatar
Manish Singh committed
705
    # Is there a better link_static_flag that works with the bundled CC?
Elliot Lee's avatar
Elliot Lee committed
706
    wl='-Wl,'
707
    link_static_flag="${wl}-a ${wl}archive"
Manish Singh's avatar
Manish Singh committed
708
    pic_flag='+Z'
Elliot Lee's avatar
Elliot Lee committed
709 710 711 712 713 714
    ;;

  irix5* | irix6*)
    wl='-Wl,'
    link_static_flag='-non_shared'
    # PIC (with -KPIC) is the default.
Manish Singh's avatar
Manish Singh committed
715 716
    ;;

717
  cygwin* | mingw* | os2*)
Manish Singh's avatar
Manish Singh committed
718
    # We can build DLLs from non-PIC.
Elliot Lee's avatar
Elliot Lee committed
719 720
    ;;

721
  osf3* | osf4* | osf5*)
Manish Singh's avatar
Manish Singh committed
722
    # All OSF/1 code is PIC.
Elliot Lee's avatar
Elliot Lee committed
723 724 725 726 727 728 729 730 731 732
    wl='-Wl,'
    link_static_flag='-non_shared'
    ;;

  sco3.2v5*)
    pic_flag='-Kpic'
    link_static_flag='-dn'
    special_shlib_compile_flags='-belf'
    ;;

733
  solaris*)
Elliot Lee's avatar
Elliot Lee committed
734 735 736 737 738 739 740 741 742 743 744
    pic_flag='-KPIC'
    link_static_flag='-Bstatic'
    wl='-Wl,'
    ;;

  sunos4*)
    pic_flag='-PIC'
    link_static_flag='-Bstatic'
    wl='-Qoption ld '
    ;;

Manish Singh's avatar
Manish Singh committed
745
  sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
746 747 748 749 750
    pic_flag='-KPIC'
    link_static_flag='-Bstatic'
    wl='-Wl,'
    ;;

Manish Singh's avatar
Manish Singh committed
751 752 753 754
  uts4*)
    pic_flag='-pic'
    link_static_flag='-Bstatic'
    ;;
755 756 757 758 759 760
  sysv4*MP*)
    if test -d /usr/nec ;then
      pic_flag='-Kconform_pic'
      link_static_flag='-Bstatic'
    fi
    ;;
Elliot Lee's avatar
Elliot Lee committed
761 762 763 764 765 766 767
  *)
    can_build_shared=no
    ;;
  esac
fi

if test -n "$pic_flag"; then
Manish Singh's avatar
Manish Singh committed
768
  echo "$ac_t$pic_flag" 1>&6
Elliot Lee's avatar
Elliot Lee committed
769 770 771 772

  # Check to make sure the pic_flag actually works.
  echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6
  $rm conftest*
773
  echo "int some_variable = 0;" > conftest.c
Elliot Lee's avatar
Elliot Lee committed
774 775
  save_CFLAGS="$CFLAGS"
  CFLAGS="$CFLAGS $pic_flag -DPIC"
Manish Singh's avatar
Manish Singh committed
776 777
  echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5
  if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
Manish Singh's avatar
Manish Singh committed
778
    # Append any warnings to the config.log.
Elliot Lee's avatar
Elliot Lee committed
779
    cat conftest.err 1>&5
780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795
    
    case "$host_os" in
    hpux9* | hpux10* | hpux11*)
      # On HP-UX, both CC and GCC only warn that PIC is supported... then they
      # create non-PIC objects.  So, if there were any warnings, we assume that
      # PIC is not supported.
      if test -s conftest.err; then
	echo "$ac_t"no 1>&6
	can_build_shared=no
	pic_flag=
      else
	echo "$ac_t"yes 1>&6
	pic_flag=" $pic_flag"
      fi
      ;;
    *)
Manish Singh's avatar
Manish Singh committed
796
      echo "$ac_t"yes 1>&6
Elliot Lee's avatar
Elliot Lee committed
797
      pic_flag=" $pic_flag"
798 799
      ;;
    esac
Elliot Lee's avatar
Elliot Lee committed
800 801 802 803 804
  else
    # Append any errors to the config.log.
    cat conftest.err 1>&5
    can_build_shared=no
    pic_flag=
Manish Singh's avatar
Manish Singh committed
805
    echo "$ac_t"no 1>&6
Elliot Lee's avatar
Elliot Lee committed
806 807 808 809
  fi
  CFLAGS="$save_CFLAGS"
  $rm conftest*
else
Manish Singh's avatar
Manish Singh committed
810
  echo "$ac_t"none 1>&6
Elliot Lee's avatar
Elliot Lee committed
811 812
fi

813 814
# Check to see if options -o and -c are simultaneously supported by compiler
echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6
Manish Singh's avatar
Manish Singh committed
815 816 817
$rm -r conftest 2>/dev/null
mkdir conftest
cd conftest
818 819
$rm conftest*
echo "int some_variable = 0;" > conftest.c
Manish Singh's avatar
Manish Singh committed
820 821 822 823 824 825 826
mkdir out
# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
# that will create temporary files in the current directory regardless of
# the output directory.  Thus, making CWD read-only will cause this test
# to fail, enabling locking or at least warning the user not to do parallel
# builds.
chmod -w .
827
save_CFLAGS="$CFLAGS"
Manish Singh's avatar
Manish Singh committed
828
CFLAGS="$CFLAGS -o out/conftest2.o"
Manish Singh's avatar
Manish Singh committed
829 830
echo "$progname:829: checking if $compiler supports -c -o file.o" >&5
if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then
831 832 833

  # The compiler can only warn and ignore the option if not recognized
  # So say no if there are warnings
Manish Singh's avatar
Manish Singh committed
834
    if test -s out/conftest.err; then
835 836 837 838 839 840 841 842
      echo "$ac_t"no 1>&6
      compiler_c_o=no
    else
      echo "$ac_t"yes 1>&6
      compiler_c_o=yes
    fi
else
  # Append any errors to the config.log.
Manish Singh's avatar
Manish Singh committed
843
  cat out/conftest.err 1>&5
844 845 846 847
  compiler_c_o=no
  echo "$ac_t"no 1>&6
fi
CFLAGS="$save_CFLAGS"
Manish Singh's avatar
Manish Singh committed
848 849 850 851 852 853
chmod u+w .
$rm conftest* out/*
rmdir out
cd ..
rmdir conftest
$rm -r conftest 2>/dev/null
854 855 856 857 858 859 860 861

if test x"$compiler_c_o" = x"yes"; then
  # Check to see if we can write to a .lo
  echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6
  $rm conftest*
  echo "int some_variable = 0;" > conftest.c
  save_CFLAGS="$CFLAGS"
  CFLAGS="$CFLAGS -c -o conftest.lo"
Manish Singh's avatar
Manish Singh committed
862 863
  echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5
if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then
864 865 866 867 868 869 870

    # The compiler can only warn and ignore the option if not recognized
    # So say no if there are warnings
      if test -s conftest.err; then
	echo "$ac_t"no 1>&6
	compiler_o_lo=no
      else
871 872
	echo "$ac_t"yes 1>&6
	compiler_o_lo=yes
873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913
      fi
  else
    # Append any errors to the config.log.
    cat conftest.err 1>&5
    compiler_o_lo=no
    echo "$ac_t"no 1>&6
  fi
  CFLAGS="$save_CFLAGS"
  $rm conftest*
else
  compiler_o_lo=no
fi

# Check to see if we can do hard links to lock some files if needed
hard_links="nottested"
if test "$compiler_c_o" = no && test "$need_locks" != no; then
  # do not overwrite the value of need_locks provided by the user
  echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6
  hard_links=yes
  $rm conftest*
  ln conftest.a conftest.b 2>/dev/null && hard_links=no
  touch conftest.a
  ln conftest.a conftest.b 2>&5 || hard_links=no
  ln conftest.a conftest.b 2>/dev/null && hard_links=no
  echo "$ac_t$hard_links" 1>&6
  $rm conftest*
  if test "$hard_links" = no; then
    echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2
    need_locks=warn
  fi
else
  need_locks=no
fi

if test "$with_gcc" = yes; then
  # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
  echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6
  $rm conftest*
  echo "int some_variable = 0;" > conftest.c
  save_CFLAGS="$CFLAGS"
  CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c"
Manish Singh's avatar
Manish Singh committed
914 915
  echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
  if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then
916 917 918 919

    # The compiler can only warn and ignore the option if not recognized
    # So say no if there are warnings
      if test -s conftest.err; then
920 921
	echo "$ac_t"no 1>&6
	compiler_rtti_exceptions=no
922
      else
923 924
	echo "$ac_t"yes 1>&6
	compiler_rtti_exceptions=yes
925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942
      fi
  else
    # Append any errors to the config.log.
    cat conftest.err 1>&5
    compiler_rtti_exceptions=no
    echo "$ac_t"no 1>&6
  fi
  CFLAGS="$save_CFLAGS"
  $rm conftest*

  if test "$compiler_rtti_exceptions" = "yes"; then
    no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
  else
    no_builtin_flag=' -fno-builtin'
  fi
  
fi

Elliot Lee's avatar
Elliot Lee committed
943 944 945 946 947 948 949 950 951 952 953 954 955 956 957
# Check for any special shared library compilation flags.
if test -n "$special_shlib_compile_flags"; then
  echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2
  if echo "$old_CC $old_CFLAGS " | egrep -e "[ 	]$special_shlib_compile_flags[ 	]" >/dev/null; then :
  else
    echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2
    can_build_shared=no
  fi
fi

echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6
$rm conftest*
echo 'main(){return(0);}' > conftest.c
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $link_static_flag"
Manish Singh's avatar
Manish Singh committed
958 959
echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5
if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
Manish Singh's avatar
Manish Singh committed
960
  echo "$ac_t$link_static_flag" 1>&6
Elliot Lee's avatar
Elliot Lee committed
961
else
Manish Singh's avatar
Manish Singh committed
962
  echo "$ac_t"none 1>&6
Elliot Lee's avatar
Elliot Lee committed
963 964 965 966 967 968 969 970
  link_static_flag=
fi
LDFLAGS="$save_LDFLAGS"
$rm conftest*

if test -z "$LN_S"; then
  # Check to see if we can use ln -s, or we need hard links.
  echo $ac_n "checking whether ln -s works... $ac_c" 1>&6
Manish Singh's avatar
Manish Singh committed
971 972 973
  $rm conftest.dat
  if ln -s X conftest.dat 2>/dev/null; then
    $rm conftest.dat
Elliot Lee's avatar
Elliot Lee committed
974 975 976 977 978 979 980 981 982 983 984 985
    LN_S="ln -s"
  else
    LN_S=ln
  fi
  if test "$LN_S" = "ln -s"; then
    echo "$ac_t"yes 1>&6
  else
    echo "$ac_t"no 1>&6
  fi
fi

# Make sure LD is an absolute path.
Manish Singh's avatar
Manish Singh committed
986
if test -z "$LD"; then
Elliot Lee's avatar
Elliot Lee committed
987 988 989 990
  ac_prog=ld
  if test "$with_gcc" = yes; then
    # Check if gcc -print-prog-name=ld gives a path.
    echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6
Manish Singh's avatar
Manish Singh committed
991
    echo "$progname:991: checking for ld used by GCC" >&5
Elliot Lee's avatar
Elliot Lee committed
992 993 994
    ac_prog=`($CC -print-prog-name=ld) 2>&5`
    case "$ac_prog" in
    # Accept absolute paths.
Manish Singh's avatar
Manish Singh committed
995
    [\\/]* | [A-Za-z]:[\\/]*)
996 997
      re_direlt='/[^/][^/]*/\.\./'
      # Canonicalize the path of ld
998
      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
999
      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
1000
	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
1001
      done
1002
      test -z "$LD" && LD="$ac_prog"
Manish Singh's avatar
Manish Singh committed
1003
      ;;
Elliot Lee's avatar
Elliot Lee committed
1004
    "")
1005
      # If it fails, then pretend we are not using GCC.
Elliot Lee's avatar
Elliot Lee committed
1006 1007 1008 1009 1010 1011 1012 1013 1014
      ac_prog=ld
      ;;
    *)
      # If it is relative, then search for the first ld in PATH.
      with_gnu_ld=unknown
      ;;
    esac
  elif test "$with_gnu_ld" = yes; then
    echo $ac_n "checking for GNU ld... $ac_c" 1>&6
Manish Singh's avatar
Manish Singh committed
1015
    echo "$progname:1015: checking for GNU ld" >&5
Elliot Lee's avatar
Elliot Lee committed
1016 1017
  else
    echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
Manish Singh's avatar
Manish Singh committed
1018
    echo "$progname:1018: checking for non-GNU ld" >&5
Elliot Lee's avatar
Elliot Lee committed
1019
  fi
Manish Singh's avatar
Manish Singh committed
1020 1021

  if test -z "$LD"; then
1022
    IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
Elliot Lee's avatar
Elliot Lee committed
1023 1024
    for ac_dir in $PATH; do
      test -z "$ac_dir" && ac_dir=.
Manish Singh's avatar
Manish Singh committed
1025
      if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
Elliot Lee's avatar
Elliot Lee committed
1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037
	LD="$ac_dir/$ac_prog"
	# Check to see if the program is GNU ld.  I'd rather use --version,
	# but apparently some GNU ld's only accept -v.
	# Break only if it was the GNU/non-GNU ld that we prefer.
	if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
	  test "$with_gnu_ld" != no && break
	else
	  test "$with_gnu_ld" != yes && break
	fi
      fi
    done
    IFS="$ac_save_ifs"
Manish Singh's avatar
Manish Singh committed
1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050
  fi

  if test -n "$LD"; then
    echo "$ac_t$LD" 1>&6
  else
    echo "$ac_t"no 1>&6
  fi

  if test -z "$LD"; then
    echo "$progname: error: no acceptable ld found in \$PATH" 1>&2
    exit 1
  fi
fi
Elliot Lee's avatar
Elliot Lee committed
1051

1052
# Check to see if it really is or is not GNU ld.
Elliot Lee's avatar
Elliot Lee committed
1053 1054 1055 1056 1057 1058 1059
echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6
# I'd rather use --version here, but apparently some GNU ld's only accept -v.
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
  with_gnu_ld=yes
else
  with_gnu_ld=no
fi
Manish Singh's avatar
Manish Singh committed
1060
echo "$ac_t$with_gnu_ld" 1>&6
Elliot Lee's avatar
Elliot Lee committed
1061 1062 1063 1064 1065

# See if the linker supports building shared libraries.
echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6

allow_undefined_flag=
1066
no_undefined_flag=
1067 1068
need_lib_prefix=unknown
need_version=unknown
1069 1070
# when you set need_version to no, make sure it does not cause -set_version
# flags to be left without arguments
Elliot Lee's avatar
Elliot Lee committed
1071
archive_cmds=
1072
archive_expsym_cmds=
Manish Singh's avatar
Manish Singh committed
1073
old_archive_from_new_cmds=
Elliot Lee's avatar
Elliot Lee committed
1074
export_dynamic_flag_spec=
Manish Singh's avatar
Manish Singh committed
1075
whole_archive_flag_spec=
1076
thread_safe_flag_spec=
Elliot Lee's avatar
Elliot Lee committed
1077 1078 1079 1080 1081 1082
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
hardcode_shlibpath_var=unsupported
runpath_var=
1083
always_export_symbols=no
Manish Singh's avatar
Manish Singh committed
1084
export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
1085 1086 1087 1088 1089 1090 1091
# include_expsyms should be a list of space-separated symbols to be *always*
# included in the symbol list
include_expsyms=
# exclude_expsyms can be an egrep regular expression of symbols to exclude
# it will be wrapped by ` (' and `)$', so one must not match beginning or
# end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
# as well as any symbol that contains `d'.
Manish Singh's avatar
Manish Singh committed
1092 1093 1094 1095 1096 1097
exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
# platforms (ab)use it in PIC code, but their linkers get confused if
# the symbol is explicitly referenced.  Since portable code cannot
# rely on this symbol name, it's probably fine to never include it in
# preloaded symbol tables.
Elliot Lee's avatar
Elliot Lee committed
1098

1099
case "$host_os" in
1100 1101 1102 1103 1104 1105 1106
cygwin* | mingw*)
  # FIXME: the MSVC++ port hasn't been tested in a loooong time
  # When not using gcc, we currently assume that we are using
  # Microsoft Visual C++.
  if test "$with_gcc" != yes; then
    with_gnu_ld=no
  fi
1107
  ;;
1108

1109 1110
esac

Elliot Lee's avatar
Elliot Lee committed
1111
ld_shlibs=yes
Manish Singh's avatar
Manish Singh committed
1112
if test "$with_gnu_ld" = yes; then
1113 1114
  # If archive_cmds runs LD, not CC, wlarc should be empty
  wlarc='${wl}'
1115

1116
  # See if GNU ld supports shared libraries.
Manish Singh's avatar
Manish Singh committed
1117
  case "$host_os" in
1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131
  aix3* | aix4*)
    # On AIX, the GNU linker is very broken
    ld_shlibs=no
    cat <<EOF 1>&2

*** Warning: the GNU linker, at least up to release 2.9.1, is reported
*** to be unable to reliably create shared libraries on AIX.
*** Therefore, libtool is disabling shared libraries support.  If you
*** really care for shared libraries, you may want to modify your PATH
*** so that a non-GNU linker is found, and then restart.

EOF
    ;;

Manish Singh's avatar
Manish Singh committed
1132
  amigaos*)
1133
    archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
Manish Singh's avatar
Manish Singh committed
1134 1135 1136
    hardcode_libdir_flag_spec='-L$libdir'
    hardcode_minus_L=yes

Manish Singh's avatar
Manish Singh committed
1137 1138 1139 1140 1141 1142 1143
    # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
    # that the semantics of dynamic libraries on AmigaOS, at least up
    # to version 4, is to share data among multiple programs linked
    # with the same dynamic library.  Since this doesn't match the
    # behavior of shared libraries on other platforms, we can use
    # them.
    ld_shlibs=no
Manish Singh's avatar
Manish Singh committed
1144 1145
    ;;

1146 1147
  beos*)
    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
Manish Singh's avatar
Manish Singh committed
1148 1149 1150
      allow_undefined_flag=unsupported
      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
      # support --undefined.  This deserves some investigation.  FIXME
1151
      archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
1152 1153 1154 1155 1156
    else
      ld_shlibs=no
    fi
    ;;

1157 1158 1159 1160 1161 1162
  cygwin* | mingw*)
    # hardcode_libdir_flag_spec is actually meaningless, as there is
    # no search path for DLLs.
    hardcode_libdir_flag_spec='-L$libdir'
    allow_undefined_flag=unsupported
    always_export_symbols=yes
1163

1164 1165 1166
    # Extract the symbol export list from an `--export-all' def file,
    # then regenerate the def file from the symbol export list, so that
    # the compiled dll only exports the symbol export list.
Manish Singh's avatar
Manish Singh committed
1167
    # Be careful not to strip the DATA tag left by newer dlltools.
Manish Singh's avatar
Manish Singh committed
1168 1169 1170
    export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
      test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
      $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def  $objdir/$soname-ltdll.$objext $libobjs $convenience~
Manish Singh's avatar
Manish Singh committed
1171
      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols'
1172

Manish Singh's avatar
Manish Singh committed
1173
    # If DATA tags from a recent dlltool are present, honour them!
1174 1175
    archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~
      _lt_hint=1;
Manish Singh's avatar
Manish Singh committed
1176 1177 1178 1179 1180 1181
      cat $export_symbols | while read symbol; do
        set dummy \$symbol;
        case \$# in
          2) echo "	\$2 @ \$_lt_hint ; " >> $objdir/$soname-def;;
          *) echo "     \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;;
        esac;
1182 1183
	_lt_hint=`expr 1 + \$_lt_hint`;
      done~
Manish Singh's avatar
Manish Singh committed
1184 1185
      test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
      test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
1186
      $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
1187
      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
1188
      $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
1189
      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
1190 1191
      $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts'

Manish Singh's avatar
Manish Singh committed
1192
      old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' 
Manish Singh's avatar
Manish Singh committed
1193 1194
    ;;

Manish Singh's avatar
Manish Singh committed
1195
  netbsd*)
1196
    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
Manish Singh's avatar
Manish Singh committed
1197 1198 1199 1200 1201 1202 1203 1204
      archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
      archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
    else
      archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib'
      # can we support soname and/or expsyms with a.out? -oliva
    fi
    ;;

1205
  solaris* | sysv5*)
1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225
    if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
      ld_shlibs=no
      cat <<EOF 1>&2

*** Warning: The releases 2.8.* of the GNU linker cannot reliably
*** create shared libraries on Solaris systems.  Therefore, libtool
*** is disabling shared libraries support.  We urge you to upgrade GNU
*** binutils to release 2.9.1 or newer.  Another option is to modify
*** your PATH or compiler configuration so that the native linker is
*** used, and then restart.

EOF
    elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
      archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
      archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
    else
      ld_shlibs=no
    fi
    ;;      

Manish Singh's avatar
Manish Singh committed
1226 1227 1228 1229 1230 1231 1232
  sunos4*)
    archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts'
    wlarc=
    hardcode_direct=yes
    hardcode_shlibpath_var=no
    ;;

Manish Singh's avatar
Manish Singh committed
1233 1234
  *)
    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
1235 1236
      archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
      archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
Manish Singh's avatar
Manish Singh committed
1237 1238 1239 1240 1241
    else
      ld_shlibs=no
    fi
    ;;
  esac
Elliot Lee's avatar
Elliot Lee committed
1242

1243
  if test "$ld_shlibs" = yes; then
Manish Singh's avatar
Manish Singh committed
1244
    runpath_var=LD_RUN_PATH
1245 1246
    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
    export_dynamic_flag_spec='${wl}--export-dynamic'
1247 1248 1249 1250 1251 1252
    case $host_os in
    cygwin* | mingw*)
      # dlltool doesn't understand --whole-archive et. al.
      whole_archive_flag_spec=
      ;;
    *)
1253 1254 1255 1256 1257 1258
      # ancient GNU ld didn't support --whole-archive et. al.
      if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
        whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
      else
        whole_archive_flag_spec=
      fi
1259 1260
      ;;
    esac
Elliot Lee's avatar
Elliot Lee committed
1261 1262 1263 1264 1265 1266
  fi
else
  # PORTME fill in a description of your system's linker (not GNU ld)
  case "$host_os" in
  aix3*)
    allow_undefined_flag=unsupported
1267 1268
    always_export_symbols=yes
    archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname'
Elliot Lee's avatar
Elliot Lee committed
1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279
    # Note: this linker hardcodes the directories in LIBPATH if there
    # are no directories specified by -L.
    hardcode_minus_L=yes
    if test "$with_gcc" = yes && test -z "$link_static_flag"; then
      # Neither direct hardcoding nor static linking is supported with a
      # broken collect2.
      hardcode_direct=unsupported
    fi
    ;;

  aix4*)
Manish Singh's avatar
Manish Singh committed
1280 1281
    hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib'
    hardcode_libdir_separator=':'
1282
    if test "$with_gcc" = yes; then
Manish Singh's avatar
Manish Singh committed
1283 1284 1285
      collect2name=`${CC} -print-prog-name=collect2`
      if test -f "$collect2name" && \
	 strings "$collect2name" | grep resolve_lib_name >/dev/null
1286
      then
1287 1288
	# We have reworked collect2
	hardcode_direct=yes
1289
      else
1290 1291
	# We have old collect2
	hardcode_direct=unsupported
Manish Singh's avatar
Manish Singh committed
1292 1293 1294 1295 1296 1297
	# It fails to find uninstalled libraries when the uninstalled
	# path is not listed in the libpath.  Setting hardcode_minus_L
	# to unsupported forces relinking
	hardcode_minus_L=yes
	hardcode_libdir_flag_spec='-L$libdir'
	hardcode_libdir_separator=
1298
      fi
Manish Singh's avatar
Manish Singh committed
1299
      shared_flag='-shared'
1300
    else
Manish Singh's avatar
Manish Singh committed
1301
      shared_flag='${wl}-bM:SRE'
1302 1303
      hardcode_direct=yes
    fi
Manish Singh's avatar
Manish Singh committed
1304 1305 1306 1307 1308 1309 1310
    allow_undefined_flag=' ${wl}-berok'
    archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}'
    archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}'
    case "$host_os" in aix4.[01]|aix4.[01].*)
      # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on
      always_export_symbols=yes ;;
    esac
1311
   ;;
Elliot Lee's avatar
Elliot Lee committed
1312

1313
  amigaos*)
1314
    archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
1315 1316
    hardcode_libdir_flag_spec='-L$libdir'
    hardcode_minus_L=yes
Manish Singh's avatar
Manish Singh committed
1317 1318
    # see comment about different semantics on the GNU ld section
    ld_shlibs=no
1319 1320
    ;;

1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336
  cygwin* | mingw*)
    # When not using gcc, we currently assume that we are using
    # Microsoft Visual C++.
    # hardcode_libdir_flag_spec is actually meaningless, as there is
    # no search path for DLLs.
    hardcode_libdir_flag_spec=' '
    allow_undefined_flag=unsupported
    # Tell ltmain to make .lib files, not .a files.
    libext=lib
    # FIXME: Setting linknames here is a bad hack.
    archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
    # The linker will automatically build a .lib file if we build a DLL.
    old_archive_from_new_cmds='true'
    # FIXME: Should let the user specify the lib program.
    old_archive_cmds='lib /OUT:$oldlib$oldobjs'
    fix_srcfile_path='`cygpath -w $srcfile`'
1337 1338
    ;;

1339 1340 1341 1342
  freebsd1*)
    ld_shlibs=no
    ;;

Elliot Lee's avatar
Elliot Lee committed
1343 1344
  # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
  # support.  Future versions do this automatically, but an explicit c++rt0.o
1345
  # does not break anything, and helps significantly (at the cost of a little
Elliot Lee's avatar
Elliot Lee committed
1346 1347
  # extra space).
  freebsd2.2*)
1348
    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o'
1349
    hardcode_libdir_flag_spec='-R$libdir'
Elliot Lee's avatar
Elliot Lee committed
1350 1351 1352 1353
    hardcode_direct=yes
    hardcode_shlibpath_var=no
    ;;

1354
  # Unfortunately, older versions of FreeBSD 2 do not have this feature.
Elliot Lee's avatar
Elliot Lee committed
1355
  freebsd2*)
1356
    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
Elliot Lee's avatar
Elliot Lee committed
1357 1358 1359 1360 1361
    hardcode_direct=yes
    hardcode_minus_L=yes
    hardcode_shlibpath_var=no
    ;;

1362 1363 1364
  # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
  freebsd*)
    archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts'
Elliot Lee's avatar
Elliot Lee committed
1365 1366 1367 1368 1369
    hardcode_libdir_flag_spec='-R$libdir'
    hardcode_direct=yes
    hardcode_shlibpath_var=no
    ;;

Manish Singh's avatar
Manish Singh committed
1370 1371 1372 1373 1374
  hpux9* | hpux10* | hpux11*)
    case "$host_os" in
    hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;;
    *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;;
    esac
Elliot Lee's avatar
Elliot Lee committed
1375
    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
Manish Singh's avatar
Manish Singh committed
1376
    hardcode_libdir_separator=:
Elliot Lee's avatar
Elliot Lee committed
1377
    hardcode_direct=yes
Manish Singh's avatar
Manish Singh committed
1378 1379
    hardcode_minus_L=yes # Not in the search PATH, but as the default
			 # location of the library.
1380
    export_dynamic_flag_spec='${wl}-E'
Elliot Lee's avatar
Elliot Lee committed
1381 1382 1383
    ;;

  irix5* | irix6*)
Manish Singh's avatar
Manish Singh committed
1384
    if test "$with_gcc" = yes; then
Manish Singh's avatar
Manish Singh committed
1385
      archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
Manish Singh's avatar
Manish Singh committed
1386
    else
Manish Singh's avatar
Manish Singh committed
1387
      archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
Manish Singh's avatar
Manish Singh committed
1388
    fi
Elliot Lee's avatar
Elliot Lee committed
1389
    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
1390
    hardcode_libdir_separator=:
Elliot Lee's avatar
Elliot Lee committed
1391 1392
    ;;

Manish Singh's avatar
Manish Singh committed
1393
  netbsd*)
1394 1395 1396 1397 1398 1399
    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'  # a.out
    else
      archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts'      # ELF
    fi
    hardcode_libdir_flag_spec='${wl}-R$libdir'
Manish Singh's avatar
Manish Singh committed
1400 1401 1402 1403 1404
    hardcode_direct=yes
    hardcode_shlibpath_var=no
    ;;

  openbsd*)
1405
    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
Elliot Lee's avatar
Elliot Lee committed
1406 1407 1408 1409 1410
    hardcode_libdir_flag_spec='-R$libdir'
    hardcode_direct=yes
    hardcode_shlibpath_var=no
    ;;

Manish Singh's avatar
Manish Singh committed
1411 1412 1413 1414
  os2*)
    hardcode_libdir_flag_spec='-L$libdir'
    hardcode_minus_L=yes
    allow_undefined_flag=unsupported
1415
    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def'
Manish Singh's avatar
Manish Singh committed
1416 1417 1418
    old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
    ;;

1419
  osf3*)
1420 1421
    if test "$with_gcc" = yes; then
      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
Manish Singh's avatar
Manish Singh committed
1422
      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
1423 1424
    else
      allow_undefined_flag=' -expect_unresolved \*'
Manish Singh's avatar
Manish Singh committed
1425
      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
1426
    fi
Elliot Lee's avatar
Elliot Lee committed
1427 1428 1429 1430
    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
    hardcode_libdir_separator=:
    ;;

1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441
  osf4* | osf5*)  # As osf3* with the addition of the -msym flag
    if test "$with_gcc" = yes; then
      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
    else
      allow_undefined_flag=' -expect_unresolved \*'
      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
    fi
    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
    hardcode_libdir_separator=:
    ;;
Manish Singh's avatar
Manish Singh committed
1442 1443 1444 1445 1446 1447 1448
  rhapsody*)
    archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs $deplibs $linkopts'
    hardcode_libdir_flags_spec='-L$libdir'
    hardcode_direct=yes
    hardcode_shlibpath_var=no
    ;;
                                       
Elliot Lee's avatar
Elliot Lee committed
1449
  sco3.2v5*)
Manish Singh's avatar
Manish Singh committed
1450 1451 1452 1453
    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
    hardcode_shlibpath_var=no
    runpath_var=LD_RUN_PATH
    hardcode_runpath_var=yes
Elliot Lee's avatar
Elliot Lee committed
1454 1455
    ;;

1456
  solaris*)
1457
    no_undefined_flag=' -z text'
1458 1459
    # $CC -shared without GNU ld will not create a library from C++
    # object files and a static libstdc++, better avoid it by now
1460
    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
1461 1462
    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
Elliot Lee's avatar
Elliot Lee committed
1463 1464
    hardcode_libdir_flag_spec='-R$libdir'
    hardcode_shlibpath_var=no
Manish Singh's avatar
Manish Singh committed
1465 1466 1467
    case "$host_os" in
    solaris2.[0-5] | solaris2.[0-5].*) ;;
    *) # Supported since Solaris 2.6 (maybe 2.5.1?)
1468
      whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
Manish Singh's avatar
Manish Singh committed
1469
    esac
Elliot Lee's avatar
Elliot Lee committed
1470 1471 1472
    ;;

  sunos4*)
Manish Singh's avatar
Manish Singh committed
1473
    archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts'
Elliot Lee's avatar
Elliot Lee committed
1474 1475 1476 1477 1478 1479
    hardcode_libdir_flag_spec='-L$libdir'
    hardcode_direct=yes
    hardcode_minus_L=yes
    hardcode_shlibpath_var=no
    ;;

Manish Singh's avatar
Manish Singh committed
1480
  sysv4)
Manish Singh's avatar
Manish Singh committed
1481 1482 1483 1484 1485 1486 1487
    if test "x$host_vendor" = xsequent; then
      # Use $CC to link under sequent, because it throws in some extra .o 
      # files that make .init and .fini sections work.
      archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $linkopts'
    else
      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
    fi
Manish Singh's avatar
Manish Singh committed
1488 1489 1490 1491 1492
    runpath_var='LD_RUN_PATH'
    hardcode_shlibpath_var=no
    hardcode_direct=no #Motorola manual says yes, but my tests say they lie 
    ;;  

1493 1494 1495 1496 1497 1498
  sysv4.3*)
    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
    hardcode_shlibpath_var=no
    export_dynamic_flag_spec='-Bexport'
    ;;

1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510
  sysv5*)
    no_undefined_flag=' -z text'
    # $CC -shared without GNU ld will not create a library from C++
    # object files and a static libstdc++, better avoid it by now
    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
    hardcode_libdir_flag_spec=
    hardcode_shlibpath_var=no
    runpath_var='LD_RUN_PATH'
    ;;

1511
  uts4*)
1512
    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
1513 1514 1515 1516 1517
    hardcode_libdir_flag_spec='-L$libdir'
    hardcode_shlibpath_var=no
    ;;

  dgux*)
1518
    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
1519 1520 1521
    hardcode_libdir_flag_spec='-L$libdir'
    hardcode_shlibpath_var=no
    ;;
Manish Singh's avatar
Manish Singh committed
1522

1523
  sysv4*MP*)
1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536
    if test -d /usr/nec; then
      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
      hardcode_shlibpath_var=no
      runpath_var=LD_RUN_PATH
      hardcode_runpath_var=yes
      ld_shlibs=yes
    fi
    ;;

  sysv4.2uw2*)
    archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts'
    hardcode_direct=yes
    hardcode_minus_L=no
1537 1538
    hardcode_shlibpath_var=no
    hardcode_runpath_var=yes
1539 1540 1541 1542 1543 1544 1545
    runpath_var=LD_RUN_PATH
    ;;

  unixware7*)
    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
    runpath_var='LD_RUN_PATH'
    hardcode_shlibpath_var=no
1546 1547
    ;;

Elliot Lee's avatar
Elliot Lee committed
1548 1549 1550 1551 1552
  *)
    ld_shlibs=no
    ;;
  esac
fi
Manish Singh's avatar
Manish Singh committed
1553
echo "$ac_t$ld_shlibs" 1>&6
Manish Singh's avatar
Manish Singh committed
1554
test "$ld_shlibs" = no && can_build_shared=no
Elliot Lee's avatar
Elliot Lee committed
1555 1556 1557 1558

if test -z "$NM"; then
  echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6
  case "$NM" in
Manish Singh's avatar
Manish Singh committed
1559
  [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path.
Elliot Lee's avatar
Elliot Lee committed
1560
  *)
1561 1562
    IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
    for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do
1563
      test -z "$ac_dir" && ac_dir=.
Manish Singh's avatar
Manish Singh committed
1564
      if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then
1565 1566 1567 1568 1569 1570 1571 1572 1573
	# Check to see if the nm accepts a BSD-compat flag.
	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
	#   nm: unknown option "B" ignored
	if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
	  NM="$ac_dir/nm -B"
	  break
	elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
	  NM="$ac_dir/nm -p"
	  break
Elliot Lee's avatar
Elliot Lee committed
1574
	else
1575 1576
	  NM=${NM="$ac_dir/nm"} # keep the first match, but
	  continue # so that we can try to find one that supports BSD flags
Elliot Lee's avatar
Elliot Lee committed
1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593
	fi
      fi
    done
    IFS="$ac_save_ifs"
    test -z "$NM" && NM=nm
    ;;
  esac
  echo "$ac_t$NM" 1>&6
fi

# Check for command to grab the raw symbol name followed by C symbol from nm.
echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6

# These are sane defaults that work on at least a few old systems.
# [They come from Ultrix.  What could be older than Ultrix?!! ;)]

# Character class describing NM global symbol codes.
1594
symcode='[BCDEGRST]'
Elliot Lee's avatar
Elliot Lee committed
1595 1596 1597 1598 1599

# Regexp to match symbols that can be accessed directly from C.
sympat='\([_A-Za-z][_A-Za-z0-9]*\)'

# Transform the above into a raw symbol and a C symbol.
1600 1601 1602 1603
symxfrm='\1 \2\3 \3'

# Transform an extracted symbol line into a proper C declaration
global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
Elliot Lee's avatar
Elliot Lee committed
1604 1605 1606 1607

# Define system-specific variables.
case "$host_os" in
aix*)