#! /bin/sh

# Slightly hacked ltconfig -- ltconfig is the lean mean original machine

# ltconfig - Create a system-specific libtool.
# When updating this script, search for LINENUM and fix line number refs.
# Generated automatically from ltconfig.in by configure.
# Copyright (C) 1996, 1997, Free Software Foundation, Inc.
# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# 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.

# The name of this program.
progname=`echo "$0" | sed 's%^.*/%%'`

# Constants:
PROGRAM=ltconfig
PACKAGE=libtool
VERSION=1.0
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5'
rm="rm -f"

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

# Global variables:
can_build_shared=no
enable_shared=no
# All known linkers require a `.a' archive for static linking.
enable_static=yes
ltmain=./ltmain.sh
silent=
srcdir=.
ac_config_guess=
ac_config_sub=
host=i486-win95-gnu
nonopt=
verify_host=no
with_gcc=yes
with_gnu_ld=yes

old_AR="$AR"
old_CC="$CC"
old_CFLAGS="$CFLAGS"
old_CPPFLAGS="$CPPFLAGS"
old_LD="$LD"
old_LN_S="$LN_S"
old_RANLIB="$RANLIB"

test -z "$AR" && AR=ar

# 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
Usage: $progname [OPTION]... LTMAIN [HOST]

Generate a system-specific libtool script.

    --disable-shared       do not build shared libraries
    --disable-static       do not build static libraries
    --help                 display this help and exit
    --no-verify            do not verify that HOST is a valid host type
    --quiet                same as \`--silent'
    --silent               don't print informational messages
    --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

LTMAIN is the \`ltmain.sh' shell script fragment that provides basic libtool
functionality.

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

  --disable-shared) enable_shared=no ;;

  --disable-static) enable_static=no ;;

  --quiet | --silent) silent=yes ;;

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

  --no-verify) verify_host=no ;;

  --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION"; exit 0 ;;

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

  -*)
    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
# FIXME This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1
#      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

if test -f "$ltmain"; then :
else
  echo "$progname: warning: \`$ltmain' does not exist" 1>&2
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).
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi

ac_n=-n ac_c='
' ac_t='	'

if test -z "$srcdir"; then
  # Assume the source directory is the same one as the path to ltmain.sh.
  srcdir=`echo "$ltmain" | sed 's%/[^/]*$%%'`
  test "$srcdir" = "$ltmain" && srcdir=.
fi

host_alias=$host

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

# Determine commands to create old-style static archives.
old_archive_cmds='$AR cru $oldlib$oldobjs'
old_postinstall_cmds='chmod 644 $oldlib'

RANLIB=ranlib

if test -n "$RANLIB"; then
  old_archive_cmds="$old_archive_cmds;\$RANLIB \$oldlib"
  old_postinstall_cmds="$old_postinstall_cmds;\$RANLIB \$oldlib"
fi

pic_flag='-fPIC'
profile_flag_pattern='-pg?'
wl='-Wl,'
link_static_flag='-static'
LN_S="ln -s"

allow_undefined_flag=
archive_cmds=
export_dynamic_flag=
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
hardcode_runpath_var=no
hardcode_shlibpath_var=unsupported
runpath_var=
ld_shlibs=no
hardcode_action=unsupported
can_build_shared=no

reload_cmds='$LD$reload_flag -o $output$reload_objs'
reload_flag='-r'

# PORTME Fill in your ld.so characteristics
library_names_spec=
soname_spec=
postinstall_cmds=
finish_cmds=
shlibpath_var=
version_type=none
dynamic_linker=no

# FIXME need to add library stripping features
# strip -x works for most platforms, though not for static libraries on NetBSD
# HP-UX requires "-r" for library stripping
striplib=
old_striplib=

enable_shared=no
enable_static=yes

ofile=libtool
trap "$rm $ofile; exit 1" 1 2 15
echo creating $ofile
rm -fr $ofile
cat <<EOF > $ofile
#! /bin/sh

# libtool - Provide generalized library-building support services.
#
# Generated automatically by $PROGRAM - GNU $PACKAGE $VERSION
# This program was configured as follows,
# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
#
# CC="$old_CC" CFLAGS="$old_CFLAGS" CPPFLAGS="$old_CPPFLAGS" \\
# LD="$old_LD" RANLIB="$old_RANLIB" LN_S="$old_LN_S" \\
#   $0$ltconfig_args
#
# Compiler and other test output produced by $progname, useful for
# debugging $progname, is in ./config.log if it exists.

# The version of $progname that generated this script.
LTCONFIG_VERSION="$VERSION"

# Whether or not to build libtool libraries.
build_libtool_libs=$enable_shared

# Whether or not to build old-style libraries.
build_old_libs=$enable_static

# The host system.
host_alias="$host_alias"
host="$host"

# The archiver.
AR='$AR'

# The linker used to build libraries.
LD='$LD'

# Whether we need hard or soft links.
LN_S='$LN_S'

# How to create reloadable object files.
reload_flag='$reload_flag'
reload_cmds='$reload_cmds'

# How to pass a linker flag through the compiler.
wl='$wl'

# Additional compiler flags for building library objects.
pic_flag='$pic_flag'

# Compiler flag to prevent dynamic linking.
link_static_flag='$link_static_flag'

# Compiler flag to allow reflexive dlopens.
export_dynamic_flag='$export_dynamic_flag'

# Pattern to match compiler flags for creating libNAME_p libraries:
profile_flag_pattern='$profile_flag_pattern'

# Library versioning type.
version_type=$version_type

# List of archive names.  First name is the real one, the rest are links.
# The last name is the one that the linker finds with -lNAME.
library_names_spec='$library_names_spec'

# The coded name of the library, if different from the real name.
soname_spec='$soname_spec'

# Commands used to build and install an old-style archive.
RANLIB='$RANLIB'
old_archive_cmds='$old_archive_cmds'
old_postinstall_cmds='$old_postinstall_cmds'

# Commands used to build and install a shared archive.
archive_cmds='$archive_cmds'
postinstall_cmds='$postinstall_cmds'

# Flag that allows shared libraries with undefined symbols to be built.
allow_undefined_flag='$allow_undefined_flag'

# Commands used to finish a libtool library installation in a directory.
finish_cmds='$finish_cmds'

# How to strip a library file.
striplib='$striplib'
old_striplib='$old_striplib'

# This is the shared library runtime path variable.
runpath_var=$runpath_var

# This is the shared library path variable.
shlibpath_var=$shlibpath_var

# How to hardcode a shared library path into an executable.
hardcode_action=$hardcode_action

# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec='$hardcode_libdir_flag_spec'

# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator='$hardcode_libdir_separator'

# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct=$hardcode_direct

# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L=$hardcode_minus_L

# Set to yes if using RUNPATH_VAR=DIR during linking hardcodes DIR into the
# resulting binary.
hardcode_runpath_var=$hardcode_runpath_var

# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
# the resulting binary.
hardcode_shlibpath_var=$hardcode_shlibpath_var

EOF

# Detect if we are using a relative or absolute path to ltmain.sh.
case "$ltmain" in
/*) cat <<EOF2 >> $ofile
# Execute the libtool backend.
. $ltmain
EOF2
  ;;
*) cat <<EOF3 >> $ofile
# Find the path to this script.
thisdir=\`echo "\$0" | sed -e 's%/[^/]*\$%%'\`
test "X\$0" = "X\$thisdir" && thisdir=.

# Execute the libtool backend.
. \$thisdir/$ltmain
EOF3
  ;;
esac

echo 'exit 1' >> $ofile

chmod +x $ofile
exit 0

# Local Variables:
# mode:shell-script
# sh-indentation:2
# End:
