This commit was manufactured by cvs2svn to create branch 'llvm-nightlytester'. llvm-svn: 28996
diff --git a/java/Makefile b/java/Makefile deleted file mode 100755 index ca59bb0..0000000 --- a/java/Makefile +++ /dev/null
@@ -1,14 +0,0 @@ -##===- ./Makefile ------------------------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## -LEVEL := . - -DIRS := lib tools runtime -EXTRA_DIST := Makefile.test - -include $(LEVEL)/Makefile.common
diff --git a/java/Makefile.common.in b/java/Makefile.common.in deleted file mode 100644 index 041bf54..0000000 --- a/java/Makefile.common.in +++ /dev/null
@@ -1,43 +0,0 @@ -#===-- Makefile.common - Common make rules for LLVM -------*- makefile -*---==== -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -#===-------------------------------------------------------------------------=== - -PROJECT_NAME = @PACKAGE_NAME@ -PROJ_VERSION = @PACKAGE_VERSION@ - -# Set this variable to the top of the LLVM source tree. -LLVM_SRC_ROOT = @LLVM_SRC@ - -# Set this variable to the top level directory where LLVM was built -# (this is *not* the same as OBJ_ROOT as defined in LLVM's Makefile.config). -LLVM_OBJ_ROOT = @LLVM_OBJ@ - -# Set the directory root of this project's source files -PROJ_SRC_ROOT := $(subst //,/,@abs_top_srcdir@) - -# Set the root directory of this project's object files -PROJ_OBJ_ROOT := $(subst //,/,@abs_top_builddir@) - -# Set the root directory of this project's install prefix -PROJ_INSTALL_ROOT := @prefix@ - -# Include LLVM's Master Makefile. -include $(LLVM_OBJ_ROOT)/Makefile.common - -# GNU classpath variables -CLASSPATH_JAVA_LIBRARY_PATH=@CLASSPATH_JAVA_LIBRARY_PATH@ -CLASSPATH_NATIVE_LIBRARY_PATH=@CLASSPATH_NATIVE_LIBRARY_PATH@ -CLASSPATH_NATIVE_LIBS=@CLASSPATH_NATIVE_LIBS@ - -# Additional utilities -JAVA=@JAVA@ -JAVAC=@JAVAC@ -JAVAH=@JAVAH@ - -# Include local build rules. -include $(PROJ_SRC_ROOT)/Makefile.rules
diff --git a/java/Makefile.rules b/java/Makefile.rules deleted file mode 100644 index 5eb82a2..0000000 --- a/java/Makefile.rules +++ /dev/null
@@ -1,11 +0,0 @@ -##==-- Makefile.rules - Common make rules for Java -------*- makefile -*--====## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -CLASS2LLVM := $(ToolDir)/class2llvm$(EXEEXT) -CLASSDUMP := $(ToolDir)/classdump$(EXEEXT)
diff --git a/java/TODO b/java/TODO deleted file mode 100644 index 8e13c66..0000000 --- a/java/TODO +++ /dev/null
@@ -1,16 +0,0 @@ -* Integrate GNU classpath to the build system: - This should involve unpacking it, and building the native parts - using llvm-gcc and the java sources using a java compiler. - -* Add exception support. - -* Implement the multinewarray opcode. - -* Build java/lang/String's out of the args passed to main and pass - them to the class's main function we are invoking. - -* Add garbage collection. - -* Implement monitorenter/monitorexit opcods. - -* Implement jsr/ret opcodes.
diff --git a/java/autoconf/AutoRegen.sh b/java/autoconf/AutoRegen.sh deleted file mode 100755 index 0a5a0b2..0000000 --- a/java/autoconf/AutoRegen.sh +++ /dev/null
@@ -1,41 +0,0 @@ -#!/bin/sh -die () { - echo "$@" 1>&2 - exit 1 -} -test -d autoconf && test -f autoconf/configure.ac && cd autoconf -test -f configure.ac || die "Can't find 'autoconf' dir; please cd into it first" -autoconf --version | egrep '2\.59' > /dev/null -if test $? -ne 0 ; then - die "Your autoconf was not detected as being 2.59" -fi -aclocal-1.9 --version | egrep '1\.9\.4' > /dev/null -if test $? -ne 0 ; then - die "Your aclocal was not detected as being 1.9.4" -fi -autoheader --version | egrep '2\.59' > /dev/null -if test $? -ne 0 ; then - die "Your autoheader was not detected as being 2.59" -fi -libtool --version | grep '1.5.14' > /dev/null -if test $? -ne 0 ; then - die "Your libtool was not detected as being 1.5.14" -fi -echo "" -echo "### NOTE: ############################################################" -echo "### If you get *any* warnings from autoconf below other than warnings" -echo "### about 'AC_CONFIG_SUBDIRS: you should use literals', you MUST fix" -echo "### the scripts in the m4 directory because there are future forward" -echo "### compatibility or platform support issues at risk. Please do NOT" -echo "### commit any configure.ac or configure script that was generated " -echo "### with warnings present." -echo "######################################################################" -echo "" -echo "Regenerating aclocal.m4 with aclocal" -save=`pwd` -cd ../../.. -m4dir=`pwd`/autoconf/m4 -cd $save -aclocal --force -I $m4dir || die "aclocal failed" -echo "Regenerating configure with autoconf 2.5x" -autoconf --force --warnings=all -o ../configure configure.ac || die "autoconf failed"
diff --git a/java/autoconf/configure.ac b/java/autoconf/configure.ac deleted file mode 100644 index 0ca829a..0000000 --- a/java/autoconf/configure.ac +++ /dev/null
@@ -1,117 +0,0 @@ -dnl ************************************************************************** -dnl * Initialize -dnl ************************************************************************** -AC_INIT([[Java]], [[0.0]], [llvmbugs@cs.uiuc.edu]) - -dnl Tell autoconf that the auxilliary files are actually located in -dnl the LLVM autoconf directory, not here. -AC_CONFIG_AUX_DIR([../../autoconf]) - -dnl Tell autoconf that this is an LLVM project being configured -dnl This provides the --with-llvmsrc and --with-llvmobj options -LLVM_CONFIG_PROJECT - -dnl Verify that the source directory is valid -AC_CONFIG_SRCDIR([Makefile.common.in]) - -dnl Configure a common Makefile -AC_CONFIG_FILES(Makefile.common) - -dnl Configure project makefiles -dnl List every Makefile that exists within your source tree -AC_CONFIG_MAKEFILE([Makefile]) -AC_CONFIG_MAKEFILE([lib/Makefile]) -AC_CONFIG_MAKEFILE([lib/ClassFile/Makefile]) -AC_CONFIG_MAKEFILE([test/Makefile]) -AC_CONFIG_MAKEFILE([test/Makefile.test]) -AC_CONFIG_MAKEFILE([test/Programs/SingleSource/UnitTests/Makefile]) -AC_CONFIG_MAKEFILE([test/Programs/SingleSource/Makefile]) -AC_CONFIG_MAKEFILE([test/Programs/SingleSource/Makefile.singlesrc]) -AC_CONFIG_MAKEFILE([test/Programs/Makefile]) -AC_CONFIG_MAKEFILE([test/Regression/ClassFile/Makefile]) -AC_CONFIG_MAKEFILE([test/Regression/Makefile]) -AC_CONFIG_MAKEFILE([tools/Makefile]) -AC_CONFIG_MAKEFILE([tools/classdump/Makefile]) - -dnl ************************************************************************** -dnl * Determine which system we are building on -dnl ************************************************************************** - -dnl ************************************************************************** -dnl * Check for programs. -dnl ************************************************************************** -AC_ARG_VAR(JAVA, [The Java Virtual Machine (used for testing)]) -AC_CHECK_PROG(JAVA, java, java) -AC_ARG_VAR(JAVAC, [The java compiler (used for testing)]) -AC_CHECK_PROG(JAVAC, javac, javac) -AC_ARG_VAR(JAVAH, [The java JNI header generator (used for testing)]) -AC_CHECK_PROG(JAVAH, javah, javah) - -if test -z "$JAVA" -then - AC_MSG_WARN([A Java Virtual Machine is required for the test suite, but it was not found]) -fi - -if test -z "$JAVAC" -then - AC_MSG_WARN([A Java compiler is required for the test suite, but it was not found]) -fi - -if test -z "$JAVAC" -then - AC_MSG_WARN([A Java JNI header generator is required for the test suite, but it was not found]) -fi - -dnl Verify that the source directory is valid -AC_CONFIG_SRCDIR(Makefile.common.in) - -dnl ************************************************************************** -dnl * Set the location of various third-party software packages -dnl ************************************************************************** -AC_ARG_WITH([classpathdir], - AS_HELP_STRING([--with-classpathdir], - [location of GNU classpath install dir (default /usr/local)]), - [ac_cv_classpathdir=$withval], - [ac_cv_classpathdir=/usr/local]) - -CLASSPATH_JAVA_LIBRARY_PATH=$ac_cv_classpathdir/share/classpath -AC_SUBST(CLASSPATH_JAVA_LIBRARY_PATH) - -CLASSPATH_NATIVE_LIBRARY_PATH=$ac_cv_classpathdir/lib/classpath -AC_SUBST(CLASSPATH_NATIVE_LIBRARY_PATH) - -CLASSPATH_NATIVE_LIBS="gtkpeer javaawt javaio javalang javalangreflect javanet javanio javautil" -AC_SUBST(CLASSPATH_NATIVE_LIBS) - -dnl ************************************************************************** -dnl * Check for libraries. -dnl ************************************************************************** -AC_MSG_CHECKING([for GNU classpath libraries]) -if test ! -f "$CLASSPATH_JAVA_LIBRARY_PATH/java/lang/Object.class" -then - AC_MSG_RESULT([no]) - AC_MSG_ERROR([A flat installation of GNU classpath is required]) -else - AC_MSG_RESULT([$CLASSPATH_JAVA_LIBRARY_PATH]) -fi - -dnl ************************************************************************** -dnl * Checks for header files. -dnl ************************************************************************** - -dnl ************************************************************************** -dnl * Checks for typedefs, structures, and compiler characteristics. -dnl ************************************************************************** - -dnl ************************************************************************** -dnl * Checks for library functions. -dnl ************************************************************************** - -dnl ************************************************************************** -dnl * Enable various compile-time options -dnl ************************************************************************** - -dnl ************************************************************************** -dnl * Create the output files -dnl ************************************************************************** -AC_OUTPUT
diff --git a/java/class b/java/class deleted file mode 100644 index 9f0bf9f..0000000 --- a/java/class +++ /dev/null
@@ -1,65 +0,0 @@ -# Java Configuration File For llvmc - -########################################################## -# Language definitions -########################################################## - lang.name=Java - lang.opt1=-simplifycfg -mem2reg -instcombine - lang.opt2= - lang.opt3= - lang.opt4= - lang.opt5= -# lang.libs=@LLVM_OBJ_ROOT@/projects/Java/Debug/lib - -########################################################## -# Pre-processor definitions -########################################################## - - # Java doesn't have a preprocessor but the following - # allows the -E option to be supported - preprocessor.command=cp %in% %out% - preprocessor.required=false - -########################################################## -# Translator definitions -########################################################## - - # To compile java class files, we just run the - # class2llvm compiler with the correct classpath. - translator.command=class2llvm \ - %in% %force% -o %out% %time% %stats% %args% - - # class2llvm doesn't preprocess but we set this to true - # so that we don't run the cp command by default. - translator.preprocesses=true - - # The translator is required to run. - translator.required=true - - # class2llvm outputs llvm bytecode - translator.output=bytecode - -########################################################## -# Optimizer definitions -########################################################## - - # For optimization, we use the LLVM "opt" program - optimizer.command=opt \ - %in% %force% -o %out% %opt% %time% %stats% %args% - - optimizer.required = true - - # opt doesn't translate - optimizer.translates=false - - # opt doesn't preprocess - optimizer.preprocesses=false - - # opt produces bytecode - optimizer.output=bytecode - -########################################################## -# Assembler definitions -########################################################## - assembler.command=llc \ - %in% %force% -o %out% %target% %time% %stats% %args%
diff --git a/java/configure b/java/configure deleted file mode 100755 index dba2bec..0000000 --- a/java/configure +++ /dev/null
@@ -1,2599 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for Java 0.0. -# -# Report bugs to <llvmbugs@cs.uiuc.edu>. -# -# Copyright (C) 2003 Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_config_libobj_dir=. -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Identity of this package. -PACKAGE_NAME='Java' -PACKAGE_TARNAME='-java-' -PACKAGE_VERSION='0.0' -PACKAGE_STRING='Java 0.0' -PACKAGE_BUGREPORT='llvmbugs@cs.uiuc.edu' - -ac_unique_file="Makefile.common.in" -ac_unique_file="Makefile.common.in" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_SRC LLVM_OBJ JAVA JAVAC JAVAH CLASSPATH_JAVA_LIBRARY_PATH CLASSPATH_NATIVE_LIBRARY_PATH CLASSPATH_NATIVE_LIBS LIBOBJS LTLIBOBJS' -ac_subst_files='' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -ac_prev= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_JAVA_set=${JAVA+set} -ac_env_JAVA_value=$JAVA -ac_cv_env_JAVA_set=${JAVA+set} -ac_cv_env_JAVA_value=$JAVA -ac_env_JAVAC_set=${JAVAC+set} -ac_env_JAVAC_value=$JAVAC -ac_cv_env_JAVAC_set=${JAVAC+set} -ac_cv_env_JAVAC_value=$JAVAC -ac_env_JAVAH_set=${JAVAH+set} -ac_env_JAVAH_value=$JAVAH -ac_cv_env_JAVAH_set=${JAVAH+set} -ac_cv_env_JAVAH_value=$JAVAH - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures Java 0.0 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -_ACEOF - - cat <<_ACEOF -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] -_ACEOF - - cat <<\_ACEOF -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of Java 0.0:";; - esac - cat <<\_ACEOF - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-llvmsrc Location of LLVM Source Code - --with-llvmobj Location of LLVM Object Code - --with-classpathdir location of GNU classpath install dir (default - /usr/local) - -Some influential environment variables: - JAVA The Java Virtual Machine (used for testing) - JAVAC The java compiler (used for testing) - JAVAH The java JNI header generator (used for testing) - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to <llvmbugs@cs.uiuc.edu>. -_ACEOF -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd "$ac_popdir" - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\_ACEOF -Java configure 0.0 -generated by GNU Autoconf 2.59 - -Copyright (C) 2003 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit 0 -fi -exec 5>config.log -cat >&5 <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by Java $as_me 0.0, which was -generated by GNU Autoconf 2.59. Invocation command line was - - $ $0 $@ - -_ACEOF -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_sep= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status - ' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ac_aux_dir= -for ac_dir in ../../autoconf $srcdir/../../autoconf; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f $ac_dir/shtool; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in ../../autoconf $srcdir/../../autoconf" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in ../../autoconf $srcdir/../../autoconf" >&2;} - { (exit 1); exit 1; }; } -fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - - - -# Check whether --with-llvmsrc or --without-llvmsrc was given. -if test "${with_llvmsrc+set}" = set; then - withval="$with_llvmsrc" - llvm_src="$withval" -else - llvm_src=`cd ${srcdir}/../..; pwd` -fi; - LLVM_SRC=$llvm_src - - -# Check whether --with-llvmobj or --without-llvmobj was given. -if test "${with_llvmobj+set}" = set; then - withval="$with_llvmobj" - llvm_obj="$withval" -else - llvm_obj=`cd ../..; pwd` -fi; - LLVM_OBJ=$llvm_obj - - ac_config_commands="$ac_config_commands setup" - - - - - - ac_config_files="$ac_config_files Makefile.common" - - - ac_config_commands="$ac_config_commands Makefile" - - - ac_config_commands="$ac_config_commands lib/Makefile" - - - ac_config_commands="$ac_config_commands lib/ClassFile/Makefile" - - - ac_config_commands="$ac_config_commands test/Makefile" - - - ac_config_commands="$ac_config_commands test/Makefile.test" - - - ac_config_commands="$ac_config_commands test/Programs/SingleSource/UnitTests/Makefile" - - - ac_config_commands="$ac_config_commands test/Programs/SingleSource/Makefile" - - - ac_config_commands="$ac_config_commands test/Programs/SingleSource/Makefile.singlesrc" - - - ac_config_commands="$ac_config_commands test/Programs/Makefile" - - - ac_config_commands="$ac_config_commands test/Regression/ClassFile/Makefile" - - - ac_config_commands="$ac_config_commands test/Regression/Makefile" - - - ac_config_commands="$ac_config_commands tools/Makefile" - - - ac_config_commands="$ac_config_commands tools/classdump/Makefile" - - - - - -# Extract the first word of "java", so it can be a program name with args. -set dummy java; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_JAVA+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$JAVA"; then - ac_cv_prog_JAVA="$JAVA" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_JAVA="java" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -JAVA=$ac_cv_prog_JAVA -if test -n "$JAVA"; then - echo "$as_me:$LINENO: result: $JAVA" >&5 -echo "${ECHO_T}$JAVA" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - -# Extract the first word of "javac", so it can be a program name with args. -set dummy javac; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_JAVAC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$JAVAC"; then - ac_cv_prog_JAVAC="$JAVAC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_JAVAC="javac" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -JAVAC=$ac_cv_prog_JAVAC -if test -n "$JAVAC"; then - echo "$as_me:$LINENO: result: $JAVAC" >&5 -echo "${ECHO_T}$JAVAC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - -# Extract the first word of "javah", so it can be a program name with args. -set dummy javah; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_JAVAH+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$JAVAH"; then - ac_cv_prog_JAVAH="$JAVAH" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_JAVAH="javah" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -JAVAH=$ac_cv_prog_JAVAH -if test -n "$JAVAH"; then - echo "$as_me:$LINENO: result: $JAVAH" >&5 -echo "${ECHO_T}$JAVAH" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - -if test -z "$JAVA" -then - { echo "$as_me:$LINENO: WARNING: A Java Virtual Machine is required for the test suite, but it was not found" >&5 -echo "$as_me: WARNING: A Java Virtual Machine is required for the test suite, but it was not found" >&2;} -fi - -if test -z "$JAVAC" -then - { echo "$as_me:$LINENO: WARNING: A Java compiler is required for the test suite, but it was not found" >&5 -echo "$as_me: WARNING: A Java compiler is required for the test suite, but it was not found" >&2;} -fi - -if test -z "$JAVAC" -then - { echo "$as_me:$LINENO: WARNING: A Java JNI header generator is required for the test suite, but it was not found" >&5 -echo "$as_me: WARNING: A Java JNI header generator is required for the test suite, but it was not found" >&2;} -fi - - - - -# Check whether --with-classpathdir or --without-classpathdir was given. -if test "${with_classpathdir+set}" = set; then - withval="$with_classpathdir" - ac_cv_classpathdir=$withval -else - ac_cv_classpathdir=/usr/local -fi; - -CLASSPATH_JAVA_LIBRARY_PATH=$ac_cv_classpathdir/share/classpath - - -CLASSPATH_NATIVE_LIBRARY_PATH=$ac_cv_classpathdir/lib/classpath - - -CLASSPATH_NATIVE_LIBS="gtkpeer javaawt javaio javalang javalangreflect javanet javanio javautil" - - -echo "$as_me:$LINENO: checking for GNU classpath libraries" >&5 -echo $ECHO_N "checking for GNU classpath libraries... $ECHO_C" >&6 -if test ! -f "$CLASSPATH_JAVA_LIBRARY_PATH/java/lang/Object.class" -then - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - { { echo "$as_me:$LINENO: error: A flat installation of GNU classpath is required" >&5 -echo "$as_me: error: A flat installation of GNU classpath is required" >&2;} - { (exit 1); exit 1; }; } -else - echo "$as_me:$LINENO: result: $CLASSPATH_JAVA_LIBRARY_PATH" >&5 -echo "${ECHO_T}$CLASSPATH_JAVA_LIBRARY_PATH" >&6 -fi - - - - - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then we branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -cat >confdef2opt.sed <<\_ACEOF -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g -t quote -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g -t quote -d -: quote -s,[ `~#$^&*(){}\\|;'"<>?],\\&,g -s,\[,\\&,g -s,\],\\&,g -s,\$,$$,g -p -_ACEOF -# We use echo to avoid assuming a particular line-breaking character. -# The extra dot is to prevent the shell from consuming trailing -# line-breaks from the sub-command output. A line-break within -# single-quotes doesn't work because, if this script is created in a -# platform that uses two characters for line-breaks (e.g., DOS), tr -# would break. -ac_LF_and_DOT=`echo; echo .` -DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` -rm -f confdef2opt.sed - - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by Java $as_me 0.0, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\_ACEOF - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Configuration commands: -$config_commands - -Report bugs to <bug-autoconf@gnu.org>." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -Java config.status 0.0 -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2003 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -# -# INIT-COMMANDS section. -# - -llvm_src="${LLVM_SRC}" - -_ACEOF - - - -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "Makefile.common" ) CONFIG_FILES="$CONFIG_FILES Makefile.common" ;; - "setup" ) CONFIG_COMMANDS="$CONFIG_COMMANDS setup" ;; - "Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; - "lib/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Makefile" ;; - "lib/ClassFile/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/ClassFile/Makefile" ;; - "test/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Makefile" ;; - "test/Makefile.test" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Makefile.test" ;; - "test/Programs/SingleSource/UnitTests/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/SingleSource/UnitTests/Makefile" ;; - "test/Programs/SingleSource/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/SingleSource/Makefile" ;; - "test/Programs/SingleSource/Makefile.singlesrc" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/SingleSource/Makefile.singlesrc" ;; - "test/Programs/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/Makefile" ;; - "test/Regression/ClassFile/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Regression/ClassFile/Makefile" ;; - "test/Regression/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Regression/Makefile" ;; - "tools/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS tools/Makefile" ;; - "tools/classdump/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS tools/classdump/Makefile" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@LLVM_SRC@,$LLVM_SRC,;t t -s,@LLVM_OBJ@,$LLVM_OBJ,;t t -s,@JAVA@,$JAVA,;t t -s,@JAVAC@,$JAVAC,;t t -s,@JAVAH@,$JAVAH,;t t -s,@CLASSPATH_JAVA_LIBRARY_PATH@,$CLASSPATH_JAVA_LIBRARY_PATH,;t t -s,@CLASSPATH_NATIVE_LIBRARY_PATH@,$CLASSPATH_NATIVE_LIBRARY_PATH,;t t -s,@CLASSPATH_NATIVE_LIBS@,$CLASSPATH_NATIVE_LIBS,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_COMMANDS section. -# -for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue - ac_dest=`echo "$ac_file" | sed 's,:.*,,'` - ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_dir=`(dirname "$ac_dest") 2>/dev/null || -$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_dest" : 'X\(//\)[^/]' \| \ - X"$ac_dest" : 'X\(//\)$' \| \ - X"$ac_dest" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_dest" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 -echo "$as_me: executing $ac_dest commands" >&6;} - case $ac_dest in - Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; - lib/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/lib/Makefile lib/Makefile ;; - lib/ClassFile/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/ClassFile/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/lib/ClassFile/Makefile lib/ClassFile/Makefile ;; - test/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Makefile test/Makefile ;; - test/Makefile.test ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Makefile.test` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Makefile.test test/Makefile.test ;; - test/Programs/SingleSource/UnitTests/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Programs/SingleSource/UnitTests/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Programs/SingleSource/UnitTests/Makefile test/Programs/SingleSource/UnitTests/Makefile ;; - test/Programs/SingleSource/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Programs/SingleSource/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Programs/SingleSource/Makefile test/Programs/SingleSource/Makefile ;; - test/Programs/SingleSource/Makefile.singlesrc ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Programs/SingleSource/Makefile.singlesrc` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Programs/SingleSource/Makefile.singlesrc test/Programs/SingleSource/Makefile.singlesrc ;; - test/Programs/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Programs/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Programs/Makefile test/Programs/Makefile ;; - test/Regression/ClassFile/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Regression/ClassFile/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Regression/ClassFile/Makefile test/Regression/ClassFile/Makefile ;; - test/Regression/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Regression/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Regression/Makefile test/Regression/Makefile ;; - tools/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname tools/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/tools/Makefile tools/Makefile ;; - tools/classdump/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname tools/classdump/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/tools/classdump/Makefile tools/classdump/Makefile ;; - esac -done -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi -
diff --git a/java/docs/TODO b/java/docs/TODO deleted file mode 100644 index efb9a36..0000000 --- a/java/docs/TODO +++ /dev/null
@@ -1,5 +0,0 @@ -* Exceptions. - -* Add GC hooks into the GC runtime. - -* Syncronization.
diff --git a/java/docs/java-frontend.txt b/java/docs/java-frontend.txt deleted file mode 100644 index 279da29..0000000 --- a/java/docs/java-frontend.txt +++ /dev/null
@@ -1,69 +0,0 @@ -The Java frontend translates Java bytecode (.class files) into LLVM -bytecode. This happens in two passes: a basic block building pass, -which creates and associates LLVM basic blocks to Java bytecode blocks -and a compilation pass, which builds the LLVM bytecode for the given -Java bytecode (in a sense: fill in the LLVM basic blocks with -instructions). - -Creating BasicBlocks --------------------- - -A pre-pass over the bytecode is performed that creates LLVM -BasicBlocks and associates them with their corresponding Java basic -block. This pass provides for a way to get the LLVM BasicBlock given a -bytecode index. It also provides a way to get the Java bytecode bounds -of the Java basic block given an LLVM BasicBlock. - -Modelling the operand stack ---------------------------- - -When compiling java bytecode to llvm we need to model the Java operand -stack, as this is the Java computation model. Some complication arises -though because longs and doubles are considered to take two slots in -the Java operand stack. - -In this frontend we don't use two slots on the operand stack for longs -or doubles. This simplyfies code generation for most instructions, but -untyped stack manipulation ones. There we need to know what is that -type of the poped items to figure out the final configuration of the -stack. - -The class2llvm compiler keeps a compile time stack of alloca's, which -loosly represent the slots of the java operand stack. These alloca's -are lazily created in the basic block they are first introduced. The -state of the stack is saved at the end of each basic block for its -successors to use it. Obviously the entry blocks gets an empty stack -as input. - -The type model is the obvious for the primitive types (int to int, -float to float, etc). For reference types the alloca is always of type -java.lang.Object*. - -Local variables ---------------- - -Similarly to the operand stack, the compiler keeps track of the local -variable slots. Again we use a single slot for doubles and longs. A -vector of sized to the max number of locals in the function is -initialized when a function is compiled and the alloca's are lazily -created on first use. - -Compilation ------------ - -In order to compile a Java method to an LLVM function we use a work -list of BasicBlocks to work through each basic block of the -function. This is required because for each java basic block we -compile we need to know the configuration of the operand stack and the -locals. This is knows iff at least one predecessor of this block is -compiled. - -So the work list is initialize with the entry basic block which has -known entry operand stack and locals. The operand stack is empty and -the locals contain the incoming arguments. When this basic block is -compiled the operand stack and locals are associated with all its -successors. For each successor this information is new (the operand -stack or locals was unknown) we add it to the work list. - -The above guarantees that all reachable java basic blocks are going to -be compiled.
diff --git a/java/docs/object-layout.txt b/java/docs/object-layout.txt deleted file mode 100644 index 07e1e79..0000000 --- a/java/docs/object-layout.txt +++ /dev/null
@@ -1,109 +0,0 @@ -Object layout for Java objects ------------------------------- - -Each Java object will have the following basic layout: - -struct llvm_java_object_base { - struct llvm_java_object_header header; - struct llvm_java_object_vtable* vtable; -}; - -Additional fields go to the end of the struct. - - - -The 'llvm_java_object_header' is not defined yet. - -struct llvm_java_object_header { - // gc info, hash info, locking -}; - - - -The vtable holds a nested struct of a 'llvm_java_object_typeinfo' -object. All methods are added after the nested struct and calls to -them are made by fetching the correct function pointer from the vtable -at runtime. - -struct llvm_java_object_vtable { - struct java_object_typeinfo typeinfo; -}; - - - -For each class we keep track of its depth and an array of vtables to -all its superclasses. The depth of a class is the number of -superclasses it has. So java.lang.Object has depth 0, class A (extends -java.lang.Object) has depth 1 and so on. We also keep an array of -pointers to interface vtables. Each interface (vtable) gets a unique -number and it is indexed to this array. This mostly empty array is -filled up to the last interface implemented (the interface with the -largest index in this array). Since interfaces cannot implement other -interfaces (they can only extend) the lastIface and interfaces are -used to differentiate between class typeinfo's and interface -typeinfo's. More specifically if interfaces == -1 then this typeinfo -is for an interface and the lastIface field is the unique number of -this interface in the objects interfaces array. The field lastIface is -the max index of all implemented interfaces. For a class that doesn't -implement any it is -1. An additional field describes the elementSize -of an array. This allows us to implement System.arraycopy(). - -struct llvm_java_object_typeinfo { - jint depth; - struct llvm_java_object_vtable** vtables; - jint lastIface; - union { - struct llvm_java_object_vtable** interfaces; - jint interfaceFlag; - }; - jint elementSize; -}; - -The structure of llvm_java_object_typeinfo allows constant time -dynamic type checks: - -int isInstanceOf(struct llvm_java_object_base* obj, - struct llvm_java_object_vtable* clazz) { - struct llvm_java_object_vtable* objClazz = obj->vtable; - if (objClazz == clazz) - return 1; - // we are checking against a class' typeinfo - if (clazz->typeinfo.interfaceFlag != -1) - return objClazz->typeinfo.depth > clazz->typeinfo.depth && - objClazz->typeinfo.vtables[clazz->typeinfo.depth] == clazz; - // otherwise we are checking against an interface's typeinfo - else - return objClazz->typeinfo.lastIface >= clazz->typeinfo.lastIface && - objClazz->typeinfo.interfaces[clazz->typeinfo.lastIface]; -} - -Object Layout for Java Arrays ------------------------------ - -Java primitive arrays inherit from java.lang.Object so they will at -minimum have a nested java.lang.Object struct as their first element. - -struct javaIntArray { - struct java_lang_Object; - int length; - int array[0]; -}; - -The typeinfo struct inside this class' vtable will be filled in the -same way as if this was a proper class. This will allow isInstanceOf -to work transparently for primitive java arrays. - -For reference type arrays we use the same struct for all types. The -only difference is the vtable (actually the vtables are identical but -they have different typeinfo structs to reflect the hierarchy of the -contained elements): - -struct javaObjectArray { - struct java_lang_Object; - int length; - java_lang_Object array[0]; -}; - -The typeinfo struct will reflect a hierarchy of array types as if B[] -derives from A[] if B derives from A. This will allow isInstanceOf to -work transparently for object arrays as well.
diff --git a/java/include/llvm/Java/Bytecode.h b/java/include/llvm/Java/Bytecode.h deleted file mode 100644 index 2661575..0000000 --- a/java/include/llvm/Java/Bytecode.h +++ /dev/null
@@ -1,276 +0,0 @@ -//===-- Bytecode.h - Java bytecode constants --------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains Java bytecode constants. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_JAVA_BYTECODE_H -#define LLVM_JAVA_BYTECODE_H - -#include <llvm/Support/DataTypes.h> - -namespace llvm { namespace Java { - - enum JType { - BOOLEAN = 4, - CHAR = 5, - FLOAT = 6, - DOUBLE = 7, - BYTE = 8, - SHORT = 9, - INT = 10, - LONG = 11, - }; - - enum Opcode { - NOP = 0x00, - ACONST_NULL = 0x01, - ICONST_M1 = 0x02, - ICONST_0 = 0x03, - ICONST_1 = 0x04, - ICONST_2 = 0x05, - ICONST_3 = 0x06, - ICONST_4 = 0x07, - ICONST_5 = 0x08, - LCONST_0 = 0x09, - LCONST_1 = 0x0A, - FCONST_0 = 0x0B, - FCONST_1 = 0x0C, - FCONST_2 = 0x0D, - DCONST_0 = 0x0E, - DCONST_1 = 0x0F, - BIPUSH = 0x10, - SIPUSH = 0x11, - LDC = 0x12, - LDC_W = 0x13, - LDC2_W = 0x14, - ILOAD = 0x15, - LLOAD = 0x16, - FLOAD = 0x17, - DLOAD = 0x18, - ALOAD = 0x19, - ILOAD_0 = 0x1A, - ILOAD_1 = 0x1B, - ILOAD_2 = 0x1C, - ILOAD_3 = 0x1D, - LLOAD_0 = 0x1E, - LLOAD_1 = 0x1F, - LLOAD_2 = 0x20, - LLOAD_3 = 0x21, - FLOAD_0 = 0x22, - FLOAD_1 = 0x23, - FLOAD_2 = 0x24, - FLOAD_3 = 0x25, - DLOAD_0 = 0x26, - DLOAD_1 = 0x27, - DLOAD_2 = 0x28, - DLOAD_3 = 0x29, - ALOAD_0 = 0x2A, - ALOAD_1 = 0x2B, - ALOAD_2 = 0x2C, - ALOAD_3 = 0x2D, - IALOAD = 0x2E, - LALOAD = 0x2F, - FALOAD = 0x30, - DALOAD = 0x31, - AALOAD = 0x32, - BALOAD = 0x33, - CALOAD = 0x34, - SALOAD = 0x35, - ISTORE = 0x36, - LSTORE = 0x37, - FSTORE = 0x38, - DSTORE = 0x39, - ASTORE = 0x3A, - ISTORE_0 = 0x3B, - ISTORE_1 = 0x3C, - ISTORE_2 = 0x3D, - ISTORE_3 = 0x3E, - LSTORE_0 = 0x3F, - LSTORE_1 = 0x40, - LSTORE_2 = 0x41, - LSTORE_3 = 0x42, - FSTORE_0 = 0x43, - FSTORE_1 = 0x44, - FSTORE_2 = 0x45, - FSTORE_3 = 0x46, - DSTORE_0 = 0x47, - DSTORE_1 = 0x48, - DSTORE_2 = 0x49, - DSTORE_3 = 0x4A, - ASTORE_0 = 0x4B, - ASTORE_1 = 0x4C, - ASTORE_2 = 0x4D, - ASTORE_3 = 0x4E, - IASTORE = 0x4F, - LASTORE = 0x50, - FASTORE = 0x51, - DASTORE = 0x52, - AASTORE = 0x53, - BASTORE = 0x54, - CASTORE = 0x55, - SASTORE = 0x56, - POP = 0x57, - POP2 = 0x58, - DUP = 0x59, - DUP_X1 = 0x5A, - DUP_X2 = 0x5B, - DUP2 = 0x5C, - DUP2_X1 = 0x5D, - DUP2_X2 = 0x5E, - SWAP = 0x5F, - IADD = 0x60, - LADD = 0x61, - FADD = 0x62, - DADD = 0x63, - ISUB = 0x64, - LSUB = 0x65, - FSUB = 0x66, - DSUB = 0x67, - IMUL = 0x68, - LMUL = 0x69, - FMUL = 0x6A, - DMUL = 0x6B, - IDIV = 0x6C, - LDIV = 0x6D, - FDIV = 0x6E, - DDIV = 0x6F, - IREM = 0x70, - LREM = 0x71, - FREM = 0x72, - DREM = 0x73, - INEG = 0x74, - LNEG = 0x75, - FNEG = 0x76, - DNEG = 0x77, - ISHL = 0x78, - LSHL = 0x79, - ISHR = 0x7A, - LSHR = 0x7B, - IUSHR = 0x7C, - LUSHR = 0x7D, - IAND = 0x7E, - LAND = 0x7F, - IOR = 0x80, - LOR = 0x81, - IXOR = 0x82, - LXOR = 0x83, - IINC = 0x84, - I2L = 0x85, - I2F = 0x86, - I2D = 0x87, - L2I = 0x88, - L2F = 0x89, - L2D = 0x8A, - F2I = 0x8B, - F2L = 0x8C, - F2D = 0x8D, - D2I = 0x8E, - D2L = 0x8F, - D2F = 0x90, - I2B = 0x91, - I2C = 0x92, - I2S = 0x93, - LCMP = 0x94, - FCMPL = 0x95, - FCMPG = 0x96, - DCMPL = 0x97, - DCMPG = 0x98, - IFEQ = 0x99, - IFNE = 0x9A, - IFLT = 0x9B, - IFGE = 0x9C, - IFGT = 0x9D, - IFLE = 0x9E, - IF_ICMPEQ = 0x9F, - IF_ICMPNE = 0xA0, - IF_ICMPLT = 0xA1, - IF_ICMPGE = 0xA2, - IF_ICMPGT = 0xA3, - IF_ICMPLE = 0xA4, - IF_IACMPEQ = 0xA5, - IF_IACMPNE = 0xA6, - GOTO = 0xA7, - JSR = 0xA8, - RET = 0xA9, - TABLESWITCH = 0xAA, - LOOKUPSWITCH = 0xAB, - IRETURN = 0xAC, - LRETURN = 0xAD, - FRETURN = 0xAE, - DRETURN = 0xAF, - ARETURN = 0xB0, - RETURN = 0xB1, - GETSTATIC = 0xB2, - PUTSTATIC = 0xB3, - GETFIELD = 0xB4, - PUTFIELD = 0xB5, - INVOKEVIRTUAL = 0xB6, - INVOKESPECIAL = 0xB7, - INVOKESTATIC = 0xB8, - INVOKEINTERFACE = 0xB9, - XXXUNUSEDXXX = 0xBA, - NEW = 0xBB, - NEWARRAY = 0xBC, - ANEWARRAY = 0xBD, - ARRAYLENGTH = 0xBE, - ATHROW = 0xBF, - CHECKCAST = 0xC0, - INSTANCEOF = 0xC1, - MONITORENTER = 0xC2, - MONITOREXIT = 0xC3, - WIDE = 0xC4, - MULTIANEWARRAY = 0xC5, - IFNULL = 0xC6, - IFNONNULL = 0xC7, - GOTO_W = 0xC8, - JSR_W = 0xC9, - BREAKPOINT = 0xCA, - IMPDEP1 = 0xFE, - IMPDEP2 = 0xFF, - }; - - inline int readSByte(const uint8_t* code, unsigned& i) { - return ((int8_t*)code)[++i]; - } - - inline unsigned readUByte(const uint8_t* code, unsigned& i) { - return code[++i]; - } - - inline int readSShort(const uint8_t* code, unsigned& i) { - int val = readSByte(code, i) << 8; - return val | readUByte(code, i); - } - - inline unsigned readUShort(const uint8_t* code, unsigned& i) { - unsigned val = readUByte(code, i) << 8; - return val | readUByte(code, i); - } - - inline int readSInt(const uint8_t* code, unsigned& i) { - int val = readUShort(code, i) << 16; - return val | readUShort(code, i); - } - - inline unsigned readUInt(const uint8_t* code, unsigned& i) { - return readSInt(code, i); - } - - inline void skipPadBytes(unsigned& i) { - ++i; - unsigned lastTwoBits = i & 0x3; - i += (4 - lastTwoBits) & 0x3; - --i; - } - -} } // namespace llvm::Java - -#endif//LLVM_JAVA_BYTECODE_H
diff --git a/java/include/llvm/Java/BytecodeParser.h b/java/include/llvm/Java/BytecodeParser.h deleted file mode 100644 index 352d168..0000000 --- a/java/include/llvm/Java/BytecodeParser.h +++ /dev/null
@@ -1,948 +0,0 @@ -//===-- BytecodeParser.h - Java bytecode parser -----------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains Java bytecode parser baseclass: a class that -// helps writing Java bytecode parsers. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_JAVA_BYTECODEPARSER_H -#define LLVM_JAVA_BYTECODEPARSER_H - -#include <llvm/Java/Bytecode.h> - -namespace llvm { namespace Java { - - /// @brief This class provides a base class that eases bytecode - /// parsing. - /// - /// By default all the do_* methods do nothing. A subclass can - /// override at will to provide specific behaviour. - template <typename SubClass> - class BytecodeParser { - protected: - typedef std::vector<std::pair<int, unsigned> > SwitchCases; - - private: - SwitchCases switchCases_; - - protected: -#define THIS ((SubClass*)this) - - /// @brief parse code pointed to by \c code beginning at \c start - /// bytecode and ending at \c end bytecode - /// - /// This function parses the code pointed to by \c code and calls - /// the subclass's do_<bytecode> method appropriately. When this - /// function returns all code in [start, end) is parsed. - void parse(const uint8_t* code, unsigned start, unsigned end) { - for (unsigned i = start; i < end; ++i) { - unsigned curBC = i; - bool wide = code[i] == WIDE; - i += wide; - THIS->pre_inst(curBC); - switch (code[i]) { - case ACONST_NULL: - THIS->do_aconst_null(); - break; - case ICONST_M1: - case ICONST_0: - case ICONST_1: - case ICONST_2: - case ICONST_3: - case ICONST_4: - case ICONST_5: - THIS->do_iconst(code[i]-ICONST_0); - break; - case LCONST_0: - case LCONST_1: - THIS->do_lconst(code[i]-LCONST_0); - break; - case FCONST_0: - case FCONST_1: - case FCONST_2: - THIS->do_fconst(code[i]-FCONST_0); - break; - case DCONST_0: - case DCONST_1: - THIS->do_dconst(code[i]-DCONST_0); - break; - case BIPUSH: - THIS->do_iconst(readSByte(code, i)); - break; - case SIPUSH: - THIS->do_iconst(readSShort(code, i)); - break; - case LDC: - THIS->do_ldc(readUByte(code, i)); - break; - case LDC_W: - THIS->do_ldc(readUShort(code, i)); - break; - case LDC2_W: - THIS->do_ldc2(readUShort(code, i)); - break; - case ILOAD: - THIS->do_iload(wide ? readUShort(code, i) : readUByte(code, i)); - break; - case LLOAD: - THIS->do_lload(wide ? readUShort(code, i) : readUByte(code, i)); - break; - case FLOAD: - THIS->do_fload(wide ? readUShort(code, i) : readUByte(code, i)); - break; - case DLOAD: - THIS->do_dload(wide ? readUShort(code, i) : readUByte(code, i)); - break; - case ALOAD: - THIS->do_aload(wide ? readUShort(code, i) : readUByte(code, i)); - break; - case ILOAD_0: - case ILOAD_1: - case ILOAD_2: - case ILOAD_3: - THIS->do_iload(code[i]-ILOAD_0); - break; - case LLOAD_0: - case LLOAD_1: - case LLOAD_2: - case LLOAD_3: - THIS->do_lload(code[i]-LLOAD_0); - break; - case FLOAD_0: - case FLOAD_1: - case FLOAD_2: - case FLOAD_3: - THIS->do_fload(code[i]-FLOAD_0); - break; - case DLOAD_0: - case DLOAD_1: - case DLOAD_2: - case DLOAD_3: - THIS->do_dload(code[i]-DLOAD_0); - break; - case ALOAD_0: - case ALOAD_1: - case ALOAD_2: - case ALOAD_3: - THIS->do_aload(code[i]-ALOAD_0); - break; - case IALOAD: - THIS->do_iaload(); - break; - case LALOAD: - THIS->do_laload(); - break; - case FALOAD: - THIS->do_faload(); - break; - case DALOAD: - THIS->do_daload(); - break; - case AALOAD: - THIS->do_aaload(); - break; - case BALOAD: - THIS->do_baload(); - break; - case CALOAD: - THIS->do_caload(); - break; - case SALOAD: - THIS->do_saload(); - break; - case ISTORE: - THIS->do_istore(wide ? readUShort(code, i) : readUByte(code, i)); - break; - case LSTORE: - THIS->do_lstore(wide ? readUShort(code, i) : readUByte(code, i)); - break; - case FSTORE: - THIS->do_fstore(wide ? readUShort(code, i) : readUByte(code, i)); - break; - case DSTORE: - THIS->do_dstore(wide ? readUShort(code, i) : readUByte(code, i)); - break; - case ASTORE: - THIS->do_astore(wide ? readUShort(code, i) : readUByte(code, i)); - break; - case ISTORE_0: - case ISTORE_1: - case ISTORE_2: - case ISTORE_3: - THIS->do_istore(code[i]-ISTORE_0); - break; - case LSTORE_0: - case LSTORE_1: - case LSTORE_2: - case LSTORE_3: - THIS->do_lstore(code[i]-LSTORE_0); - break; - case FSTORE_0: - case FSTORE_1: - case FSTORE_2: - case FSTORE_3: - THIS->do_fstore(code[i]-FSTORE_0); - break; - case DSTORE_0: - case DSTORE_1: - case DSTORE_2: - case DSTORE_3: - THIS->do_dstore(code[i]-DSTORE_0); - break; - case ASTORE_0: - case ASTORE_1: - case ASTORE_2: - case ASTORE_3: - THIS->do_astore(code[i]-ASTORE_0); - break; - case IASTORE: - THIS->do_iastore(); - break; - case LASTORE: - THIS->do_lastore(); - break; - case FASTORE: - THIS->do_fastore(); - break; - case DASTORE: - THIS->do_dastore(); - break; - case AASTORE: - THIS->do_aastore(); - break; - case BASTORE: - THIS->do_bastore(); - break; - case CASTORE: - THIS->do_castore(); - break; - case SASTORE: - THIS->do_sastore(); - break; - case POP: - THIS->do_pop(); - break; - case POP2: - THIS->do_pop2(); - break; - case DUP: - THIS->do_dup(); - break; - case DUP_X1: - THIS->do_dup_x1(); - break; - case DUP_X2: - THIS->do_dup_x2(); - break; - case DUP2: - THIS->do_dup2(); - break; - case DUP2_X1: - THIS->do_dup2_x1(); - break; - case DUP2_X2: - THIS->do_dup2_x2(); - break; - case SWAP: - THIS->do_swap(); - break; - case IADD: - THIS->do_iadd(); - break; - case LADD: - THIS->do_ladd(); - break; - case FADD: - THIS->do_fadd(); - break; - case DADD: - THIS->do_dadd(); - break; - case ISUB: - THIS->do_isub(); - break; - case LSUB: - THIS->do_lsub(); - break; - case FSUB: - THIS->do_fsub(); - break; - case DSUB: - THIS->do_dsub(); - break; - case IMUL: - THIS->do_imul(); - break; - case LMUL: - THIS->do_lmul(); - break; - case FMUL: - THIS->do_fmul(); - break; - case DMUL: - THIS->do_dmul(); - break; - case IDIV: - THIS->do_idiv(); - break; - case LDIV: - THIS->do_ldiv(); - break; - case FDIV: - THIS->do_fdiv(); - break; - case DDIV: - THIS->do_ddiv(); - break; - case IREM: - THIS->do_irem(); - break; - case LREM: - THIS->do_lrem(); - break; - case FREM: - THIS->do_frem(); - break; - case DREM: - THIS->do_drem(); - break; - case INEG: - THIS->do_ineg(); - break; - case LNEG: - THIS->do_lneg(); - break; - case FNEG: - THIS->do_fneg(); - break; - case DNEG: - THIS->do_dneg(); - break; - case ISHL: - THIS->do_ishl(); - break; - case LSHL: - THIS->do_lshl(); - break; - case ISHR: - THIS->do_ishr(); - break; - case LSHR: - THIS->do_lshr(); - break; - case IUSHR: - THIS->do_iushr(); - break; - case LUSHR: - THIS->do_lushr(); - break; - case IAND: - THIS->do_iand(); - break; - case LAND: - THIS->do_land(); - break; - case IOR: - THIS->do_ior(); - break; - case LOR: - THIS->do_lor(); - break; - case IXOR: - THIS->do_ixor(); - break; - case LXOR: - THIS->do_lxor(); - break; - case IINC: { - unsigned index = wide ? readUShort(code, i) : readUByte(code, i); - int amount = wide ? readSShort(code, i) : readSByte(code, i); - THIS->do_iinc(index, amount); - break; - } - case I2L: - THIS->do_i2l(); - break; - case I2F: - THIS->do_i2f(); - break; - case I2D: - THIS->do_i2d(); - break; - case L2I: - THIS->do_l2i(); - break; - case L2F: - THIS->do_l2f(); - break; - case L2D: - THIS->do_l2d(); - break; - case F2I: - THIS->do_f2i(); - break; - case F2L: - THIS->do_f2l(); - break; - case F2D: - THIS->do_f2d(); - break; - case D2I: - THIS->do_d2i(); - break; - case D2L: - THIS->do_d2l(); - break; - case D2F: - THIS->do_d2f(); - break; - case I2B: - THIS->do_i2b(); - break; - case I2C: - THIS->do_i2c(); - break; - case I2S: - THIS->do_i2s(); - break; - case LCMP: - THIS->do_lcmp(); - break; - case FCMPL: - THIS->do_fcmpl(); - break; - case FCMPG: - THIS->do_fcmpg(); - break; - case DCMPL: - THIS->do_dcmpl(); - break; - case DCMPG: - THIS->do_dcmpg(); - break; - case IFEQ: { - unsigned t = curBC + readSShort(code, i); - THIS->do_ifeq(t, i + 1); - break; - } - case IFNE: { - unsigned t = curBC + readSShort(code, i); - THIS->do_ifne(t, i + 1); - break; - } - case IFLT: { - unsigned t = curBC + readSShort(code, i); - THIS->do_iflt(t, i + 1); - break; - } - case IFGE: { - unsigned t = curBC + readSShort(code, i); - THIS->do_ifge(t, i + 1); - break; - } - case IFGT: { - unsigned t = curBC + readSShort(code, i); - THIS->do_ifgt(t, i + 1); - break; - } - case IFLE: { - unsigned t = curBC + readSShort(code, i); - THIS->do_ifle(t, i + 1); - break; - } - case IF_ICMPEQ: { - unsigned t = curBC + readSShort(code, i); - THIS->do_if_icmpeq(t, i + 1); - break; - } - case IF_ICMPNE: { - unsigned t = curBC + readSShort(code, i); - THIS->do_if_icmpne(t, i + 1); - break; - } - case IF_ICMPLT: { - unsigned t = curBC + readSShort(code, i); - THIS->do_if_icmplt(t, i + 1); - break; - } - case IF_ICMPGE: { - unsigned t = curBC + readSShort(code, i); - THIS->do_if_icmpge(t, i + 1); - break; - } - case IF_ICMPGT: { - unsigned t = curBC + readSShort(code, i); - THIS->do_if_icmpgt(t, i + 1); - break; - } - case IF_ICMPLE: { - unsigned t = curBC + readSShort(code, i); - THIS->do_if_icmple(t, i + 1); - break; - } - case IF_IACMPEQ: { - unsigned t = curBC + readSShort(code, i); - THIS->do_if_acmpeq(t, i + 1); - break; - } - case IF_IACMPNE: { - unsigned t = curBC + readSShort(code, i); - THIS->do_if_acmpne(t, i + 1); - break; - } - case GOTO: - THIS->do_goto(curBC + readSShort(code, i)); - break; - case JSR: { - unsigned t = curBC + readSShort(code, i); - THIS->do_jsr(t, i + 1); - break; - } - case RET: - THIS->do_ret(readUByte(code, i)); - break; - case TABLESWITCH: { - switchCases_.clear(); - skipPadBytes(i); - int def = readSInt(code, i); - int low = readSInt(code, i); - int high = readSInt(code, i); - switchCases_.reserve(high - low + 1); - while (low <= high) - switchCases_.push_back( - std::make_pair(low++, curBC + readSInt(code, i))); - THIS->do_tableswitch(curBC + def, switchCases_); - break; - } - case LOOKUPSWITCH: { - switchCases_.clear(); - skipPadBytes(i); - int def = readSInt(code, i); - int pairCount = readSInt(code, i); - switchCases_.reserve(pairCount); - while (pairCount--) { - int value = readSInt(code, i); - switchCases_.push_back( - std::make_pair(value, curBC + readSInt(code, i))); - } - THIS->do_lookupswitch(curBC + def, switchCases_); - break; - } - case IRETURN: - THIS->do_ireturn(); - break; - case LRETURN: - THIS->do_lreturn(); - break; - case FRETURN: - THIS->do_freturn(); - break; - case DRETURN: - THIS->do_dreturn(); - break; - case ARETURN: - THIS->do_areturn(); - break; - case RETURN: - THIS->do_return(); - break; - case GETSTATIC: - THIS->do_getstatic(readUShort(code, i)); - break; - case PUTSTATIC: - THIS->do_putstatic(readUShort(code, i)); - break; - case GETFIELD: - THIS->do_getfield(readUShort(code, i)); - break; - case PUTFIELD: - THIS->do_putfield(readUShort(code, i)); - break; - case INVOKEVIRTUAL: - THIS->do_invokevirtual(readUShort(code, i)); - break; - case INVOKESPECIAL: - THIS->do_invokespecial(readUShort(code, i)); - break; - case INVOKESTATIC: - THIS->do_invokestatic(readUShort(code, i)); - break; - case INVOKEINTERFACE: { - THIS->do_invokeinterface(readUShort(code, i)); - unsigned count = readUByte(code, i); - unsigned zero = readUByte(code, i); - break; - } - case XXXUNUSEDXXX: - // FIXME: must throw something - break; - case NEW: - THIS->do_new(readUShort(code, i)); - break; - case NEWARRAY: - THIS->do_newarray(static_cast<JType>(readUByte(code, i))); - break; - case ANEWARRAY: - THIS->do_anewarray(readUShort(code, i)); - break; - case ARRAYLENGTH: - THIS->do_arraylength(); - break; - case ATHROW: - THIS->do_athrow(); - break; - case CHECKCAST: - THIS->do_checkcast(readUShort(code, i)); - break; - case INSTANCEOF: - THIS->do_instanceof(readUShort(code, i)); - break; - case MONITORENTER: - THIS->do_monitorenter(); - break; - case MONITOREXIT: - THIS->do_monitorexit(); - break; - case WIDE: - // FIXME: must throw something - break; - case MULTIANEWARRAY: { - unsigned index = readUShort(code, i); - unsigned dims = readUByte(code, i); - THIS->do_multianewarray(index, dims); - break; - } - case IFNULL: { - unsigned t = curBC + readSShort(code, i); - THIS->do_ifnull(t, i + 1); - break; - } - case IFNONNULL: { - unsigned t = curBC + readSShort(code, i); - THIS->do_ifnonnull(t, i + 1); - break; - } - case GOTO_W: - THIS->do_goto(curBC + readSInt(code, i)); - break; - case JSR_W: { - unsigned t = curBC + readSInt(code, i); - THIS->do_jsr(t, i + 1); - break; - } - case BREAKPOINT: - case IMPDEP1: - case IMPDEP2: - case NOP: - break; - default: - // FIXME: must throw something - break; - } - } - } - -#undef THIS - - /// @brief called before every bytecode - void pre_inst(unsigned bcI) { } - /// @brief called on ACONST_NULL - void do_aconst_null() { } - /// @brief called on ICONST_<n>, SIPUSH and BIPUSH - void do_iconst(int value) { } - /// @brief called on LCONST_<n> - void do_lconst(long long value) { } - /// @brief called on FCONST_<n> - void do_fconst(float value) { } - /// @brief called on DCONST_<n> - void do_dconst(double value) { } - /// @brief called on LDC and LDC_W - void do_ldc(unsigned index) { } - /// @brief called on LDC2_W - void do_ldc2(unsigned index) { } - /// @brief called on ILOAD and ILOAD_<n> - void do_iload(unsigned index) { } - /// @brief called on LLOAD and LLOAD_<n> - void do_lload(unsigned index) { } - /// @brief called on FLOAD and FLOAD_<n> - void do_fload(unsigned index) { } - /// @brief called on DLOAD and DLOAD_<n> - void do_dload(unsigned index) { } - /// @brief called on ALOAD and ALOAD_<n> - void do_aload(unsigned index) { } - /// @brief called on IALOAD - void do_iaload() { } - /// @brief called on LALOAD - void do_laload() { } - /// @brief called on FALOAD - void do_faload() { } - /// @brief called on DALOAD - void do_daload() { } - /// @brief called on AALOAD - void do_aaload() { } - /// @brief called on BALOAD - void do_baload() { } - /// @brief called on CALOAD - void do_caload() { } - /// @brief called on SALOAD - void do_saload() { } - /// @brief called on ISTORE and ISTORE_<n> - void do_istore(unsigned index) { } - /// @brief called on LSTORE and LSTORE_<n> - void do_lstore(unsigned index) { } - /// @brief called on FSTORE and FSTORE_<n> - void do_fstore(unsigned index) { } - /// @brief called on DSTORE and DSTORE_<n> - void do_dstore(unsigned index) { } - /// @brief called on ASTORE and ASTORE_<n> - void do_astore(unsigned index) { } - /// @brief called on IASTORE - void do_iastore() { } - /// @brief called on LASTORE - void do_lastore() { } - /// @brief called on FASTORE - void do_fastore() { } - /// @brief called on DASTORE - void do_dastore() { } - /// @brief called on AASTORE - void do_aastore() { } - /// @brief called on BASTORE - void do_bastore() { } - /// @brief called on CASTORE - void do_castore() { } - /// @brief called on SASTORE - void do_sastore() { } - /// @brief called on POP - void do_pop() { } - /// @brief called on POP2 - void do_pop2() { } - /// @brief called on DUP - void do_dup() { } - /// @brief called on DUP_X1 - void do_dup_x1() { } - /// @brief called on DUP_X2 - void do_dup_x2() { } - /// @brief called on DUP2 - void do_dup2() { } - /// @brief called on DUP2_X1 - void do_dup2_x1() { } - /// @brief called on DUP2_X2 - void do_dup2_x2() { } - /// @brief called on SWAP - void do_swap() { } - /// @brief called on IADD - void do_iadd() { } - /// @brief called on LADD - void do_ladd() { } - /// @brief called on FADD - void do_fadd() { } - /// @brief called on DADD - void do_dadd() { } - /// @brief called on ISUB - void do_isub() { } - /// @brief called on LSUB - void do_lsub() { } - /// @brief called on FSUB - void do_fsub() { } - /// @brief called on DSUB - void do_dsub() { } - /// @brief called on IMUL - void do_imul() { } - /// @brief called on LMUL - void do_lmul() { } - /// @brief called on FMUL - void do_fmul() { } - /// @brief called on DMUL - void do_dmul() { } - /// @brief called on IDIV - void do_idiv() { } - /// @brief called on LDIV - void do_ldiv() { } - /// @brief called on FDIV - void do_fdiv() { } - /// @brief called on DDIV - void do_ddiv() { } - /// @brief called on IREM - void do_irem() { } - /// @brief called on LREM - void do_lrem() { } - /// @brief called on FREM - void do_frem() { } - /// @brief called on DREM - void do_drem() { } - /// @brief called on INEG - void do_ineg() { } - /// @brief called on LNEG - void do_lneg() { } - /// @brief called on FNEG - void do_fneg() { } - /// @brief called on DNEG - void do_dneg() { } - /// @brief called on ISHL - void do_ishl() { } - /// @brief called on LSHL - void do_lshl() { } - /// @brief called on ISHR - void do_ishr() { } - /// @brief called on LSHR - void do_lshr() { } - /// @brief called on IUSHR - void do_iushr() { } - /// @brief called on LUSHR - void do_lushr() { } - /// @brief called on IAND - void do_iand() { } - /// @brief called on LAND - void do_land() { } - /// @brief called on IOR - void do_ior() { } - /// @brief called on LOR - void do_lor() { } - /// @brief called on IXOR - void do_ixor() { } - /// @brief called on LXOR - void do_lxor() { } - /// @brief called on IINC - void do_iinc(unsigned index, int amount) { } - /// @brief called on I2L - void do_i2l() { } - /// @brief called on I2F - void do_i2f() { } - /// @brief called on I2D - void do_i2d() { } - /// @brief called on L2I - void do_l2i() { } - /// @brief called on L2F - void do_l2f() { } - /// @brief called on L2D - void do_l2d() { } - /// @brief called on F2I - void do_f2i() { } - /// @brief called on F2L - void do_f2l() { } - /// @brief called on F2D - void do_f2d() { } - /// @brief called on D2I - void do_d2i() { } - /// @brief called on D2L - void do_d2l() { } - /// @brief called on D2F - void do_d2f() { } - /// @brief called on I2B - void do_i2b() { } - /// @brief called on I2C - void do_i2c() { } - /// @brief called on I2S - void do_i2s() { } - /// @brief called on LCMP - void do_lcmp() { } - /// @brief called on FCMPL - void do_fcmpl() { } - /// @brief called on DCMPL - void do_dcmpl() { } - /// @brief called on FCMPG - void do_fcmpg() { } - /// @brief called on DCMPG - void do_dcmpg() { } - /// @brief called on IFEQ - void do_ifeq(unsigned t, unsigned f) { } - /// @brief called on IFNE - void do_ifne(unsigned t, unsigned f) { } - /// @brief called on IFLT - void do_iflt(unsigned t, unsigned f) { } - /// @brief called on IFGE - void do_ifge(unsigned t, unsigned f) { } - /// @brief called on IFGT - void do_ifgt(unsigned t, unsigned f) { } - /// @brief called on IFLE - void do_ifle(unsigned t, unsigned f) { } - /// @brief called on IF_ICMPEQ - void do_if_icmpeq(unsigned t, unsigned f) { } - /// @brief called on IF_ICMPNE - void do_if_icmpne(unsigned t, unsigned f) { } - /// @brief called on IF_ICMPLT - void do_if_icmplt(unsigned t, unsigned f) { } - /// @brief called on IF_ICMPGE - void do_if_icmpge(unsigned t, unsigned f) { } - /// @brief called on IF_ICMPGT - void do_if_icmpgt(unsigned t, unsigned f) { } - /// @brief called on IF_ICMPLE - void do_if_icmple(unsigned t, unsigned f) { } - /// @brief called on IF_ACMPEQ - void do_if_acmpeq(unsigned t, unsigned f) { } - /// @brief called on IF_ACMPNE - void do_if_acmpne(unsigned t, unsigned f) { } - /// @brief called on GOTO and GOTO_W - void do_goto(unsigned target) { } - /// @brief called on JSR and JSR_W - void do_jsr(unsigned target, unsigned retAddress) { } - /// @brief called on RET - void do_ret(unsigned index) { } - /// @brief called on TABLESWITCH - void do_tableswitch(unsigned defTarget, const SwitchCases& sw) { } - /// @brief called on LOOKUPSWITCH - void do_lookupswitch(unsigned defTarget, const SwitchCases& sw) { } - /// @brief called on IRETURN - void do_ireturn() { } - /// @brief called on LRETURN - void do_lreturn() { } - /// @brief called on FRETURN - void do_freturn() { } - /// @brief called on DRETURN - void do_dreturn() { } - /// @brief called on ARETURN - void do_areturn() { } - /// @brief called on RETURN - void do_return() { } - /// @brief called on GETSTATIC - void do_getstatic(unsigned index) { } - /// @brief called on PUTSTATIC - void do_putstatic(unsigned index) { } - /// @brief called on GETFIELD - void do_getfield(unsigned index) { } - /// @brief called on PUTFIELD - void do_putfield(unsigned index) { } - /// @brief called on INVOKEVIRTUAL - void do_invokevirtual(unsigned index) { } - /// @brief called on INVOKESPECIAL - void do_invokespecial(unsigned index) { } - /// @brief called on INVOKESTATIC - void do_invokestatic(unsigned index) { } - /// @brief called on INVOKEINTERFACE - void do_invokeinterface(unsigned index) { } - /// @brief called on NEW - void do_new(unsigned index) { } - /// @brief called on NEWARRAY - void do_newarray(JType type) { } - /// @brief called on ANEWARRAY - void do_anewarray(unsigned index) { } - /// @brief called on ARRAYLENGTH - void do_arraylength() { } - /// @brief called on ATHROW - void do_athrow() { } - /// @brief called on CHECKCAST - void do_checkcast(unsigned index) { } - /// @brief called on INSTANCEOF - void do_instanceof(unsigned index) { } - /// @brief called on MONITORENTER - void do_monitorenter() { } - /// @brief called on MONITOREXIT - void do_monitorexit() { } - /// @brief called on MULTIANEWARRAY - void do_multianewarray(unsigned index, unsigned dims) { } - /// @brief called on IFNULL - void do_ifnull(unsigned t, unsigned f) { } - /// @brief called on IFNONNULL - void do_ifnonnull(unsigned t, unsigned f) { } - }; - -} } // namespace llvm::Java - -#endif//LLVM_JAVA_BYTECODEPARSER_H
diff --git a/java/include/llvm/Java/ClassFile.h b/java/include/llvm/Java/ClassFile.h deleted file mode 100644 index 83ab6ae..0000000 --- a/java/include/llvm/Java/ClassFile.h +++ /dev/null
@@ -1,524 +0,0 @@ -//===-- ClassFile.h - ClassFile support library -----------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the declaration of the ClassFile and subordinate -// classes, which represent a parsed class file. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_JAVA_CLASSFILE_H -#define LLVM_JAVA_CLASSFILE_H - -#include <llvm/System/Path.h> - -#include <iosfwd> -#include <stdexcept> -#include <vector> - -#include <llvm/Support/DataTypes.h> - -namespace llvm { namespace Java { - - // Forward declarations - class Attribute; - class ConstantValueAttribute; - class CodeAttribute; - class ExceptionsAttribute; - class Constant; - class ConstantClass; - class ConstantFieldRef; - class ConstantInterfaceMethodRef; - class ConstantMemberRef; - class ConstantMethodRef; - class ConstantNameAndType; - class ConstantUtf8; - class ClassFile; - class Field; - class Method; - - enum AccessFlag { - ACC_PUBLIC = 0x0001, - ACC_PRIVATE = 0x0002, - ACC_PROTECTED = 0x0004, - ACC_STATIC = 0x0008, - ACC_FINAL = 0x0010, - ACC_SUPER = 0x0020, - ACC_SYNCHRONIZED = 0x0020, - ACC_VOLATILE = 0x0040, - ACC_TRANSIENT = 0x0080, - ACC_NATIVE = 0x0100, - ACC_INTERFACE = 0x0200, - ACC_ABSTRACT = 0x0400, - ACC_STRICT = 0x0800, - }; - - typedef std::vector<Constant*> ConstantPool; - typedef std::vector<Field*> Fields; - typedef std::vector<Method*> Methods; - typedef std::vector<Attribute*> Attributes; - - Attribute* getAttribute(const Attributes& attrs, - const std::string& name); - - class ClassFile { - static const ClassFile* readClassFile(std::istream& is); - static std::vector<llvm::sys::Path> getClassPath(); - static sys::Path getFileForClass(const std::string& classname); - - public: - static const ClassFile* get(const std::string& classname); - - ~ClassFile(); - - uint16_t getMinorVersion() const { return minorV_; } - uint16_t getMajorVersion() const { return majorV_; } - - unsigned getNumConstants() const { return cPool_.size(); } - Constant* getConstant(unsigned index) const { return cPool_[index]; } - ConstantClass* getConstantClass(unsigned index) const; - ConstantMemberRef* getConstantMemberRef(unsigned index) const; - ConstantFieldRef* getConstantFieldRef(unsigned index) const; - ConstantMethodRef* getConstantMethodRef(unsigned index) const; - ConstantInterfaceMethodRef* - getConstantInterfaceMethodRef(unsigned index) const; - ConstantNameAndType* getConstantNameAndType(unsigned index) const; - ConstantUtf8* getConstantUtf8(unsigned index) const; - - bool isPublic() const { return accessFlags_ & ACC_PUBLIC; } - bool isFinal() const { return accessFlags_ & ACC_FINAL; } - bool isSuper() const { return accessFlags_ & ACC_SUPER; } - bool isInterface() const { return accessFlags_ & ACC_INTERFACE; } - bool isAbstract() const { return accessFlags_ & ACC_ABSTRACT; } - - unsigned getThisClassIndex() const { return thisClassIdx_; } - ConstantClass* getThisClass() const { - return getConstantClass(thisClassIdx_); - } - unsigned getSuperClassIndex() const { return superClassIdx_; } - ConstantClass* getSuperClass() const { - return superClassIdx_ ? getConstantClass(superClassIdx_) : NULL; - } - - unsigned getNumInterfaces() const { return interfaces_.size(); } - unsigned getInterfaceIndex(unsigned i) const { return interfaces_[i]; } - ConstantClass* getInterface(unsigned i) const { - return getConstantClass(getInterfaceIndex(i)); - } - - const Fields& getFields() const { return fields_; } - - const Methods& getMethods() const { return methods_; } - - const Attributes& getAttributes() const { return attributes_; } - - bool isNativeMethodOverloaded(const Method& method) const; - - std::ostream& dump(std::ostream& os) const; - - private: - uint16_t majorV_; - uint16_t minorV_; - ConstantPool cPool_; - uint16_t accessFlags_; - uint16_t thisClassIdx_; - uint16_t superClassIdx_; - std::vector<uint16_t> interfaces_; - Fields fields_; - Methods methods_; - Attributes attributes_; - - ClassFile(std::istream& is); - }; - - inline std::ostream& operator<<(std::ostream& os, const ClassFile& c) { - return c.dump(os); - } - - class Constant { - protected: - const ClassFile* parent_; - - Constant(const ClassFile* cf) - : parent_(cf) { } - - public: - enum Tag { - CLASS = 7, - FIELD_REF = 9, - METHOD_REF = 10, - INTERFACE_METHOD_REF = 11, - STRING = 8, - INTEGER = 3, - FLOAT = 4, - LONG = 5, - DOUBLE = 6, - NAME_AND_TYPE = 12, - UTF8 = 1 - }; - - static Constant* readConstant(const ClassFile* cf, std::istream& is); - - virtual bool isSingleSlot() { return true; } - bool isDoubleSlot() { return !isSingleSlot(); } - const ClassFile* getParent() { return parent_; } - - virtual ~Constant(); - - virtual std::ostream& dump(std::ostream& os) const = 0; - }; - - inline std::ostream& operator<<(std::ostream& os, const Constant& c) { - return c.dump(os); - } - - class ConstantClass : public Constant { - uint16_t nameIdx_; - public: - ConstantClass(const ClassFile* cf, std::istream& is); - unsigned getNameIndex() const { return nameIdx_; } - ConstantUtf8* getName() const { - return parent_->getConstantUtf8(nameIdx_); - } - std::ostream& dump(std::ostream& os) const; - }; - - class ConstantMemberRef : public Constant { - protected: - uint16_t classIdx_; - uint16_t nameAndTypeIdx_; - ConstantMemberRef(const ClassFile* cf, std::istream& is); - - public: - unsigned getClassIndex() const { return classIdx_; } - ConstantClass* getClass() const { - return parent_->getConstantClass(classIdx_); - } - unsigned getNameAndTypeIndex() const { return nameAndTypeIdx_; } - ConstantNameAndType* getNameAndType() const { - return parent_->getConstantNameAndType(nameAndTypeIdx_); - } - }; - - class ConstantFieldRef : public ConstantMemberRef { - public: - ConstantFieldRef(const ClassFile* cf, std::istream& is) - : ConstantMemberRef(cf, is) { } - std::ostream& dump(std::ostream& os) const; - }; - - class ConstantMethodRef : public ConstantMemberRef { - public: - ConstantMethodRef(const ClassFile* cf, std::istream& is) - : ConstantMemberRef(cf, is) { } - std::ostream& dump(std::ostream& os) const; - }; - - class ConstantInterfaceMethodRef : public ConstantMemberRef { - public: - ConstantInterfaceMethodRef(const ClassFile* cf, std::istream& is) - : ConstantMemberRef(cf, is) { } - std::ostream& dump(std::ostream& os) const; - }; - - class ConstantString : public Constant { - uint16_t stringIdx_; - public: - ConstantString(const ClassFile* cf, std::istream& is); - unsigned getStringIndex() const { return stringIdx_; } - ConstantUtf8* getValue() const { - return parent_->getConstantUtf8(stringIdx_); - } - std::ostream& dump(std::ostream& os) const; - }; - - class ConstantInteger : public Constant { - int32_t value_; - public: - ConstantInteger(const ClassFile* cf, std::istream& is); - int32_t getValue() const { return value_; } - std::ostream& dump(std::ostream& os) const; - }; - - class ConstantFloat : public Constant { - float value_; - public: - ConstantFloat(const ClassFile* cf, std::istream& is); - float getValue() const { return value_; } - std::ostream& dump(std::ostream& os) const; - }; - - class ConstantLong : public Constant { - int64_t value_; - public: - ConstantLong(const ClassFile* cf, std::istream& is); - virtual bool isSingleSlot() { return false; } - int64_t getValue() const { return value_; } - std::ostream& dump(std::ostream& os) const; - }; - - class ConstantDouble : public Constant { - double value_; - public: - ConstantDouble(const ClassFile* cf, std::istream& is); - virtual bool isSingleSlot() { return false; } - double getValue() const { return value_; } - std::ostream& dump(std::ostream& os) const; - }; - - class ConstantNameAndType : public Constant { - uint16_t nameIdx_; - uint16_t descriptorIdx_; - public: - ConstantNameAndType(const ClassFile* cf, std::istream& is); - unsigned getNameIndex() const { return nameIdx_; } - ConstantUtf8* getName() const { - return parent_->getConstantUtf8(nameIdx_); - } - unsigned getDescriptorIndex() const { return descriptorIdx_; } - ConstantUtf8* getDescriptor() const { - return parent_->getConstantUtf8(descriptorIdx_); - } - std::ostream& dump(std::ostream& os) const; - }; - - class ConstantUtf8 : public Constant { - std::string utf8_; - public: - ConstantUtf8(const ClassFile* cf, std::istream& is); - const std::string& str() const { return utf8_; } - - std::ostream& dump(std::ostream& os) const; - }; - - class Member { - protected: - const ClassFile* parent_; - uint16_t accessFlags_; - uint16_t nameIdx_; - uint16_t descriptorIdx_; - Attributes attributes_; - - Member(const ClassFile* parent, std::istream& is); - ~Member(); - -public: - bool isPublic() const { return accessFlags_ & ACC_PUBLIC; } - bool isPrivate() const { return accessFlags_ & ACC_PRIVATE; } - bool isProtected() const { return accessFlags_ & ACC_PROTECTED; } - bool isStatic() const { return accessFlags_ & ACC_STATIC; } - bool isFinal() const { return accessFlags_ & ACC_FINAL; } - - const ClassFile* getParent() const { return parent_; } - unsigned getNameIndex() const { return nameIdx_; } - ConstantUtf8* getName() const { return parent_->getConstantUtf8(nameIdx_); } - unsigned getDescriptorIndex() const { return descriptorIdx_; } - ConstantUtf8* getDescriptor() const { - return parent_->getConstantUtf8(descriptorIdx_); - } - const Attributes& getAttributes() const { return attributes_; } - }; - - class Field : public Member { - private: - Field(const ClassFile* parent, std::istream& is); - - public: - static Field* readField(const ClassFile* parent, std::istream& is) { - return new Field(parent, is); - } - - ~Field(); - - bool isVolatile() const { return accessFlags_ & ACC_VOLATILE; } - bool isTransient() const { return accessFlags_ & ACC_TRANSIENT; } - - ConstantValueAttribute* getConstantValueAttribute() const; - - std::ostream& dump(std::ostream& os) const; - }; - - inline std::ostream& operator<<(std::ostream& os, const Field& f) { - return f.dump(os); - } - - class Method : public Member { - Method(const ClassFile* parent, std::istream& is); - - public: - static Method* readMethod(const ClassFile* parent, std::istream& is) { - return new Method(parent, is); - } - - ~Method(); - - bool isSynchronized() const { return accessFlags_ & ACC_SYNCHRONIZED; } - bool isNative() const { return accessFlags_ & ACC_NATIVE; } - bool isAbstract() const { return accessFlags_ & ACC_ABSTRACT; } - bool isStrict() const { return accessFlags_ & ACC_STRICT; } - - CodeAttribute* getCodeAttribute() const; - ExceptionsAttribute* getExceptionsAttribute() const; - - std::ostream& dump(std::ostream& os) const; - }; - - inline std::ostream& operator<<(std::ostream& os, const Method& m) { - return m.dump(os); - } - - class Attribute { - protected: - const ClassFile* parent_; - uint16_t nameIdx_; - - Attribute(const ClassFile* cf, uint16_t nameIdx, std::istream& is); - - public: - static Attribute* readAttribute(const ClassFile* cf, std::istream& is); - - virtual ~Attribute(); - - unsigned getNameIndex() const { return nameIdx_; } - ConstantUtf8* getName() const { return parent_->getConstantUtf8(nameIdx_); } - - virtual std::ostream& dump(std::ostream& os) const; - - static const std::string CONSTANT_VALUE; - static const std::string CODE; - static const std::string EXCEPTIONS; - static const std::string INNER_CLASSES; - static const std::string SYNTHETIC; - static const std::string SOURCE_FILE; - static const std::string LINE_NUMBER_TABLE; - static const std::string LOCAL_VARIABLE_TABLE; - static const std::string DEPRECATED; - }; - - inline std::ostream& operator<<(std::ostream& os, const Attribute& a) { - return a.dump(os); - } - - class ConstantValueAttribute : public Attribute { - uint16_t valueIdx_; - public: - ConstantValueAttribute(const ClassFile* cf, - uint16_t nameIdx, - std::istream& is); - - unsigned getValueIndex() const { return valueIdx_; } - Constant* getValue() const { return parent_->getConstant(valueIdx_); } - - std::ostream& dump(std::ostream& os) const; - }; - - class CodeAttribute : public Attribute { - public: - class Exception { - const ClassFile* parent_; - uint16_t startPc_; - uint16_t endPc_; - uint16_t handlerPc_; - uint16_t catchTypeIdx_; - - public: - Exception(const ClassFile* cf, std::istream& is); - - uint16_t getStartPc() const { return startPc_; } - uint16_t getEndPc() const { return endPc_; } - uint16_t getHandlerPc() const { return handlerPc_; } - uint16_t getCatchTypeIndex() const { return catchTypeIdx_; } - ConstantClass* getCatchType() const { - return catchTypeIdx_ ? NULL : parent_->getConstantClass(catchTypeIdx_); - } - - std::ostream& dump(std::ostream& os) const; - }; - - typedef std::vector<Exception*> Exceptions; - - private: - uint16_t maxStack_; - uint16_t maxLocals_; - uint32_t codeSize_; - uint8_t* code_; - Exceptions exceptions_; - Attributes attributes_; - - public: - CodeAttribute(const ClassFile* cf, uint16_t nameIdx, std::istream& is); - ~CodeAttribute(); - uint16_t getMaxStack() const { return maxStack_; } - uint16_t getMaxLocals() const { return maxLocals_; } - const uint8_t* getCode() const { return code_; } - uint32_t getCodeSize() const { return codeSize_; } - const Exceptions& getExceptions() const { return exceptions_; } - const Attributes& getAttributes() const { return attributes_; } - - std::ostream& dump(std::ostream& os) const; - }; - - inline std::ostream& operator<<(std::ostream& os, - const CodeAttribute::Exception& e) { - return e.dump(os); - } - - class ExceptionsAttribute : public Attribute { - private: - uint16_t nameIdx_; - std::vector<uint16_t> exceptions_; - - public: - ExceptionsAttribute(const ClassFile* cf, - uint16_t nameIdx, - std::istream& is); - - unsigned getNumExceptions() const { return exceptions_.size(); } - unsigned getExceptionIndex(unsigned i) const { return exceptions_[i]; } - ConstantClass* getException(unsigned i) const { - return parent_->getConstantClass(getExceptionIndex(i)); - } - - std::ostream& dump(std::ostream& os) const; - }; - - class ClassFileParseError : public std::exception { - std::string msg_; - public: - explicit ClassFileParseError(const std::string& msg) : msg_(msg) { } - virtual ~ClassFileParseError() throw(); - virtual const char* what() const throw() { return msg_.c_str(); } - }; - - class ClassFileSemanticError : public std::exception { - std::string msg_; - public: - explicit ClassFileSemanticError(const std::string& msg) : msg_(msg) { } - virtual ~ClassFileSemanticError() throw(); - virtual const char* what() const throw() { return msg_.c_str(); } - }; - - class ClassNotFoundException : public std::exception { - std::string msg_; - public: - explicit ClassNotFoundException(const std::string& msg) : msg_(msg) { } - virtual ~ClassNotFoundException() throw(); - virtual const char* what() const throw() { return msg_.c_str(); } - }; - - class InvocationTargetException : public std::exception { - std::string msg_; - public: - explicit InvocationTargetException(const std::string& msg) : msg_(msg) { } - virtual ~InvocationTargetException() throw(); - virtual const char* what() const throw() { return msg_.c_str(); } - }; - -} } // namespace llvm::Java - -#endif//LLVM_JAVA_CLASSFILE_H
diff --git a/java/include/llvm/Java/Compiler.h b/java/include/llvm/Java/Compiler.h deleted file mode 100644 index 03416d6..0000000 --- a/java/include/llvm/Java/Compiler.h +++ /dev/null
@@ -1,26 +0,0 @@ -//===-- Compiler.h - Java bytecode compiler ---------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains Java bytecode to LLVM bytecode compiler. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_JAVA_COMPILER_H -#define LLVM_JAVA_COMPILER_H - -#include <llvm/Module.h> -#include <memory> - -namespace llvm { namespace Java { - - std::auto_ptr<Module> compile(const std::string& className); - -} } // namespace llvm::Java - -#endif//LLVM_JAVA_COMPILER_H
diff --git a/java/include/llvm/Java/jni.h b/java/include/llvm/Java/jni.h deleted file mode 100644 index af3094c..0000000 --- a/java/include/llvm/Java/jni.h +++ /dev/null
@@ -1,1425 +0,0 @@ -/* jni.h - Copyright (C) 2001, 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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, or (at your option) -any later version. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -/* This file is based on jni.h from libgcj */ - -#ifndef __CLASSPATH_JNI_H__ -#define __CLASSPATH_JNI_H__ - -#include <stdarg.h> - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/* Define some defaults */ -#define JNICALL -#define JNIEXPORT - -typedef unsigned char jboolean; -typedef signed char jbyte; -typedef unsigned short jchar; -typedef short jshort; -typedef int jint; -typedef long long jlong; -typedef float jfloat; -typedef double jdouble; - -typedef jint jsize; - -#ifdef __cplusplus -} -#endif - -/* Define VM internal types */ -struct llvm_java_object_base; -typedef struct llvm_java_object_base* jobject; -typedef unsigned jfieldID; -typedef unsigned jmethodID; - -#ifdef __cplusplus - -class _jobject {}; -class _jclass : public _jobject {}; -class _jthrowable : public _jobject {}; -class _jstring : public _jobject {}; -class _jarray : public _jobject {}; -class _jbooleanArray : public _jarray {}; -class _jbyteArray : public _jarray {}; -class _jcharArray : public _jarray {}; -class _jshortArray : public _jarray {}; -class _jintArray : public _jarray {}; -class _jlongArray : public _jarray {}; -class _jfloatArray : public _jarray {}; -class _jdoubleArray : public _jarray {}; -class _jobjectArray : public _jarray {}; - -typedef _jobject *jobject; -typedef _jclass *jclass; -typedef _jthrowable *jthrowable; -typedef _jstring *jstring; -typedef _jarray *jarray; -typedef _jbooleanArray *jbooleanArray; -typedef _jbyteArray *jbyteArray; -typedef _jcharArray *jcharArray; -typedef _jshortArray *jshortArray; -typedef _jintArray *jintArray; -typedef _jlongArray *jlongArray; -typedef _jfloatArray *jfloatArray; -typedef _jdoubleArray *jdoubleArray; -typedef _jobjectArray *jobjectArray; - -typedef struct _Jv_JNIEnv JNIEnv; -typedef struct _Jv_JavaVM JavaVM; - -#else /* __cplusplus */ - - -typedef jobject jclass; -typedef jobject jstring; -typedef jobject jarray; -typedef jobject jthrowable; -typedef jobject jobjectArray; -typedef jobject jbyteArray; -typedef jobject jshortArray; -typedef jobject jintArray; -typedef jobject jlongArray; -typedef jobject jbooleanArray; -typedef jobject jcharArray; -typedef jobject jfloatArray; -typedef jobject jdoubleArray; - -/* Dummy defines. */ -typedef const struct JNINativeInterface *JNIEnv; -typedef const struct JNIInvokeInterface *JavaVM; - -#endif /* __cplusplus */ - -#define _Jv_va_list va_list - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -typedef union jvalue -{ - jboolean z; - jbyte b; - jchar c; - jshort s; - jint i; - jlong j; - jfloat f; - jdouble d; - jobject l; -} jvalue; - -/* Used for jboolean type */ -#define JNI_TRUE 1 -#define JNI_FALSE 0 - -/* Used when releasing array elements. */ -#define JNI_COMMIT 1 -#define JNI_ABORT 2 - -/* FIXME: Could be wrong */ -typedef jobject jweak; - -/* Version numbers. */ -#define JNI_VERSION_1_1 0x00010001 /* JNI version 1.1 */ -#define JNI_VERSION_1_2 0x00010002 /* JNI version 1.2 */ -#define JNI_VERSION_1_4 0x00010004 /* JNI version 1.4 */ - -/* Error codes */ -#define JNI_OK 0 -#define JNI_ERR (-1) -#define JNI_EDETACHED (-2) -#define JNI_EVERSION (-3) - -/* These functions might be defined in libraries which we load; the - JNI implementation calls them at the appropriate times. */ -JNIEXPORT jint JNICALL JNI_OnLoad (JavaVM *, void *); -JNIEXPORT void JNICALL JNI_OnUnload (JavaVM *, void *); - -/* These functions are called by user code to start using the - invocation API. */ -JNIEXPORT jint JNICALL JNI_GetDefaultJavaVMInitArgs (void *); -JNIEXPORT jint JNICALL JNI_CreateJavaVM (JavaVM **, void **, void *); -JNIEXPORT jint JNICALL JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *); - - -/* This structure is used when registering native methods. */ -typedef struct -{ - char *name; - char *signature; - void *fnPtr; -} JNINativeMethod; - -struct JNINativeInterface -{ - void *reserved0; /* 0 */ - void *reserved1; /* 1 */ - void *reserved2; /* 2 */ - void *reserved3; /* 3 */ - - jint (JNICALL *GetVersion) (JNIEnv *); /* 4 */ - jclass (JNICALL *DefineClass) (JNIEnv *, const char *, jobject, const jbyte *, jsize); /* 5 */ - jclass (JNICALL *FindClass) (JNIEnv *, const char *); /* 6 */ - - jmethodID (JNICALL *FromReflectedMethod) (JNIEnv *, jobject); /* 7 */ - jfieldID (JNICALL *FromReflectedField) (JNIEnv *, jobject); /* 8 */ - jobject (JNICALL *ToReflectedMethod) (JNIEnv *, jclass, jmethodID, jboolean); /* 9 */ - - jclass (JNICALL *GetSuperclass) (JNIEnv *, jclass); /* 10 */ - jboolean (JNICALL *IsAssignableFrom) (JNIEnv *, jclass, jclass); /* 11 */ - - jobject (JNICALL *ToReflectedField) (JNIEnv *, jclass, jfieldID, jboolean); /* 12 */ - - jint (JNICALL *Throw) (JNIEnv *, jthrowable); /* 13 */ - jint (JNICALL *ThrowNew) (JNIEnv *, jclass, const char *); /* 14 */ - jthrowable (JNICALL *ExceptionOccurred) (JNIEnv *); /* 15 */ - void (JNICALL *ExceptionDescribe) (JNIEnv *); /* 16 */ - void (JNICALL *ExceptionClear) (JNIEnv *); /* 17 */ - void (JNICALL *FatalError) (JNIEnv *, const char *); /* 18 */ - - jint (JNICALL *PushLocalFrame) (JNIEnv *, jint); /* 19 */ - jobject (JNICALL *PopLocalFrame) (JNIEnv *, jobject); /* 20 */ - - jobject (JNICALL *NewGlobalRef) (JNIEnv *, jobject); /* 21 */ - void (JNICALL *DeleteGlobalRef) (JNIEnv *, jobject); /* 22 */ - void (JNICALL *DeleteLocalRef) (JNIEnv *, jobject); /* 23 */ - jboolean (JNICALL *IsSameObject) (JNIEnv *, jobject, jobject); /* 24 */ - - jobject (JNICALL *NewLocalRef) (JNIEnv *, jobject); /* 25 */ - jint (JNICALL *EnsureLocalCapacity) (JNIEnv *, jint); /* 26 */ - - jobject (JNICALL *AllocObject) (JNIEnv *, jclass); /* 27 */ - jobject (JNICALL *NewObject) (JNIEnv *, jclass, jmethodID, ...); /* 28 */ - jobject (JNICALL *NewObjectV) (JNIEnv *, jclass, jmethodID, _Jv_va_list); /* 29 */ - jobject (JNICALL *NewObjectA) (JNIEnv *, jclass, jmethodID, jvalue *); /* 30 */ - - jclass (JNICALL *GetObjectClass) (JNIEnv *, jobject); /* 31 */ - jboolean (JNICALL *IsInstanceOf) (JNIEnv *, jobject, jclass); /* 32 */ - jmethodID (JNICALL *GetMethodID) (JNIEnv *, jclass, const char *, const char *); /* 33 */ - - jobject (JNICALL *CallObjectMethod) (JNIEnv *, jobject, jmethodID, ...); /* 34 */ - jobject (JNICALL *CallObjectMethodV) (JNIEnv *, jobject, jmethodID, _Jv_va_list); /* 35 */ - jobject (JNICALL *CallObjectMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); /* 36 */ - jboolean (JNICALL *CallBooleanMethod) (JNIEnv *, jobject, jmethodID, ...); /* 37 */ - jboolean (JNICALL *CallBooleanMethodV) (JNIEnv *, jobject, jmethodID, _Jv_va_list); /* 38 */ - jboolean (JNICALL *CallBooleanMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); /* 39 */ - jbyte (JNICALL *CallByteMethod) (JNIEnv *, jobject, jmethodID, ...); /* 40 */ - jbyte (JNICALL *CallByteMethodV) (JNIEnv *, jobject, jmethodID, _Jv_va_list); /* 41 */ - jbyte (JNICALL *CallByteMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); /* 42 */ - jchar (JNICALL *CallCharMethod) (JNIEnv *, jobject, jmethodID, ...); /* 43 */ - jchar (JNICALL *CallCharMethodV) (JNIEnv *, jobject, jmethodID, _Jv_va_list); /* 44 */ - jchar (JNICALL *CallCharMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); /* 45 */ - jshort (JNICALL *CallShortMethod) (JNIEnv *, jobject, jmethodID, ...); /* 46 */ - jshort (JNICALL *CallShortMethodV) (JNIEnv *, jobject, jmethodID, _Jv_va_list); /* 47 */ - jshort (JNICALL *CallShortMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); /* 48 */ - jint (JNICALL *CallIntMethod) (JNIEnv *, jobject, jmethodID, ...); /* 49 */ - jint (JNICALL *CallIntMethodV) (JNIEnv *, jobject, jmethodID, _Jv_va_list); /* 50 */ - jint (JNICALL *CallIntMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); /* 51 */ - jlong (JNICALL *CallLongMethod) (JNIEnv *, jobject, jmethodID, ...); /* 52 */ - jlong (JNICALL *CallLongMethodV) (JNIEnv *, jobject, jmethodID, _Jv_va_list); /* 53 */ - jlong (JNICALL *CallLongMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); /* 54 */ - jfloat (JNICALL *CallFloatMethod) (JNIEnv *, jobject, jmethodID, ...); /* 55 */ - jfloat (JNICALL *CallFloatMethodV) (JNIEnv *, jobject, jmethodID, _Jv_va_list); /* 56 */ - jfloat (JNICALL *CallFloatMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); /* 57 */ - jdouble (JNICALL *CallDoubleMethod) (JNIEnv *, jobject, jmethodID, ...); /* 58 */ - jdouble (JNICALL *CallDoubleMethodV) (JNIEnv *, jobject, jmethodID, _Jv_va_list); /* 59 */ - jdouble (JNICALL *CallDoubleMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); /* 60 */ - void (JNICALL *CallVoidMethod) (JNIEnv *, jobject, jmethodID, ...); /* 61 */ - void (JNICALL *CallVoidMethodV) (JNIEnv *, jobject, jmethodID, _Jv_va_list); /* 62 */ - void (JNICALL *CallVoidMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); /* 63 */ - - jobject (JNICALL *CallNonvirtualObjectMethod) (JNIEnv *, jobject, jclass, jmethodID, ...); /* 64 */ - jobject (JNICALL *CallNonvirtualObjectMethodV) (JNIEnv *, jobject, jclass, jmethodID, _Jv_va_list); /* 65 */ - jobject (JNICALL *CallNonvirtualObjectMethodA) (JNIEnv *, jobject, jclass, jmethodID, jvalue *); /* 66 */ - jboolean (JNICALL *CallNonvirtualBooleanMethod) (JNIEnv *, jobject, jclass, jmethodID, ...); /* 67 */ - jboolean (JNICALL *CallNonvirtualBooleanMethodV) (JNIEnv *, jobject, jclass, jmethodID, _Jv_va_list); /* 68 */ - jboolean (JNICALL *CallNonvirtualBooleanMethodA) (JNIEnv *, jobject, jclass, jmethodID, jvalue *); /* 69 */ - jbyte (JNICALL *CallNonvirtualByteMethod) (JNIEnv *, jobject, jclass, jmethodID, ...); /* 70 */ - jbyte (JNICALL *CallNonvirtualByteMethodV) (JNIEnv *, jobject, jclass, jmethodID, _Jv_va_list); /* 71 */ - jbyte (JNICALL *CallNonvirtualByteMethodA) (JNIEnv *, jobject, jclass, jmethodID, jvalue *); /* 72 */ - jchar (JNICALL *CallNonvirtualCharMethod) (JNIEnv *, jobject, jclass, jmethodID, ...); /* 73 */ - jchar (JNICALL *CallNonvirtualCharMethodV) (JNIEnv *, jobject, jclass, jmethodID, _Jv_va_list); /* 74 */ - jchar (JNICALL *CallNonvirtualCharMethodA) (JNIEnv *, jobject, jclass, jmethodID, jvalue *); /* 75 */ - jshort (JNICALL *CallNonvirtualShortMethod) (JNIEnv *, jobject, jclass, jmethodID, ...); /* 76 */ - jshort (JNICALL *CallNonvirtualShortMethodV) (JNIEnv *, jobject, jclass, jmethodID, _Jv_va_list); /* 77 */ - jshort (JNICALL *CallNonvirtualShortMethodA) (JNIEnv *, jobject, jclass, jmethodID, jvalue *); /* 78 */ - jint (JNICALL *CallNonvirtualIntMethod) (JNIEnv *, jobject, jclass, jmethodID, ...); /* 79 */ - jint (JNICALL *CallNonvirtualIntMethodV) (JNIEnv *, jobject, jclass, jmethodID, _Jv_va_list); /* 80 */ - jint (JNICALL *CallNonvirtualIntMethodA) (JNIEnv *, jobject, jclass, jmethodID, jvalue *); /* 81 */ - jlong (JNICALL *CallNonvirtualLongMethod) (JNIEnv *, jobject, jclass, jmethodID, ...); /* 82 */ - jlong (JNICALL *CallNonvirtualLongMethodV) (JNIEnv *, jobject, jclass, jmethodID, _Jv_va_list); /* 83 */ - jlong (JNICALL *CallNonvirtualLongMethodA) (JNIEnv *, jobject, jclass, jmethodID, jvalue *); /* 84 */ - jfloat (JNICALL *CallNonvirtualFloatMethod) (JNIEnv *, jobject, jclass, jmethodID, ...); /* 85 */ - jfloat (JNICALL *CallNonvirtualFloatMethodV) (JNIEnv *, jobject, jclass, jmethodID, _Jv_va_list); /* 86 */ - jfloat (JNICALL *CallNonvirtualFloatMethodA) (JNIEnv *, jobject, jclass, jmethodID, jvalue *); /* 87 */ - jdouble (JNICALL *CallNonvirtualDoubleMethod) (JNIEnv *, jobject, jclass, jmethodID, ...); /* 88 */ - jdouble (JNICALL *CallNonvirtualDoubleMethodV) (JNIEnv *, jobject, jclass, jmethodID, _Jv_va_list); /* 89 */ - jdouble (JNICALL *CallNonvirtualDoubleMethodA) (JNIEnv *, jobject, jclass, jmethodID, jvalue *); /* 90 */ - void (JNICALL *CallNonvirtualVoidMethod) (JNIEnv *, jobject, jclass, jmethodID, ...); /* 91 */ - void (JNICALL *CallNonvirtualVoidMethodV) (JNIEnv *, jobject, jclass, jmethodID, _Jv_va_list); /* 92 */ - void (JNICALL *CallNonvirtualVoidMethodA) (JNIEnv *, jobject, jclass, jmethodID, jvalue *); /* 93 */ - - jfieldID (JNICALL *GetFieldID) (JNIEnv *, jclass, const char *, const char *); /* 94 */ - - jobject (JNICALL *GetObjectField) (JNIEnv *, jobject, jfieldID); /* 95 */ - jboolean (JNICALL *GetBooleanField) (JNIEnv *, jobject, jfieldID); /* 96 */ - jbyte (JNICALL *GetByteField) (JNIEnv *, jobject, jfieldID); /* 97 */ - jchar (JNICALL *GetCharField) (JNIEnv *, jobject, jfieldID); /* 98 */ - jshort (JNICALL *GetShortField) (JNIEnv *, jobject, jfieldID); /* 99 */ - jint (JNICALL *GetIntField) (JNIEnv *, jobject, jfieldID); /* 100 */ - jlong (JNICALL *GetLongField) (JNIEnv *, jobject, jfieldID); /* 101 */ - jfloat (JNICALL *GetFloatField) (JNIEnv *, jobject, jfieldID); /* 102 */ - jdouble (JNICALL *GetDoubleField) (JNIEnv *, jobject, jfieldID); /* 103 */ - - void (JNICALL *SetObjectField) (JNIEnv *, jobject, jfieldID, jobject); /* 104 */ - void (JNICALL *SetBooleanField) (JNIEnv *, jobject, jfieldID, jboolean); /* 105 */ - void (JNICALL *SetByteField) (JNIEnv *, jobject, jfieldID, jbyte); /* 106 */ - void (JNICALL *SetCharField) (JNIEnv *, jobject, jfieldID, jchar); /* 107 */ - void (JNICALL *SetShortField) (JNIEnv *, jobject, jfieldID, jshort); /* 108 */ - void (JNICALL *SetIntField) (JNIEnv *, jobject, jfieldID, jint); /* 109 */ - void (JNICALL *SetLongField) (JNIEnv *, jobject, jfieldID, jlong); /* 110 */ - void (JNICALL *SetFloatField) (JNIEnv *, jobject, jfieldID, jfloat); /* 111 */ - void (JNICALL *SetDoubleField) (JNIEnv *, jobject, jfieldID, jdouble); /* 112 */ - - jmethodID (JNICALL *GetStaticMethodID) (JNIEnv *, jclass, const char *, const char *); /* 113 */ - - jobject (JNICALL *CallStaticObjectMethod) (JNIEnv *, jclass, jmethodID, ...); /* 114 */ - jobject (JNICALL *CallStaticObjectMethodV) (JNIEnv *, jclass, jmethodID, _Jv_va_list); /* 115 */ - jobject (JNICALL *CallStaticObjectMethodA) (JNIEnv *, jclass, jmethodID, jvalue *); /* 116 */ - jboolean (JNICALL *CallStaticBooleanMethod) (JNIEnv *, jclass, jmethodID, ...); /* 117 */ - jboolean (JNICALL *CallStaticBooleanMethodV) (JNIEnv *, jclass, jmethodID, _Jv_va_list); /* 118 */ - jboolean (JNICALL *CallStaticBooleanMethodA) (JNIEnv *, jclass, jmethodID, jvalue *); /* 119 */ - jbyte (JNICALL *CallStaticByteMethod) (JNIEnv *, jclass, jmethodID, ...); /* 120 */ - jbyte (JNICALL *CallStaticByteMethodV) (JNIEnv *, jclass, jmethodID, _Jv_va_list); /* 121 */ - jbyte (JNICALL *CallStaticByteMethodA) (JNIEnv *, jclass, jmethodID, jvalue *); /* 122 */ - jchar (JNICALL *CallStaticCharMethod) (JNIEnv *, jclass, jmethodID, ...); /* 123 */ - jchar (JNICALL *CallStaticCharMethodV) (JNIEnv *, jclass, jmethodID, _Jv_va_list); /* 124 */ - jchar (JNICALL *CallStaticCharMethodA) (JNIEnv *, jclass, jmethodID, jvalue *); /* 125 */ - jshort (JNICALL *CallStaticShortMethod) (JNIEnv *, jclass, jmethodID, ...); /* 126 */ - jshort (JNICALL *CallStaticShortMethodV) (JNIEnv *, jclass, jmethodID, _Jv_va_list); /* 127 */ - jshort (JNICALL *CallStaticShortMethodA) (JNIEnv *, jclass, jmethodID, jvalue *); /* 128 */ - jint (JNICALL *CallStaticIntMethod) (JNIEnv *, jclass, jmethodID, ...); /* 129 */ - jint (JNICALL *CallStaticIntMethodV) (JNIEnv *, jclass, jmethodID, _Jv_va_list); /* 130 */ - jint (JNICALL *CallStaticIntMethodA) (JNIEnv *, jclass, jmethodID, jvalue *); /* 131 */ - jlong (JNICALL *CallStaticLongMethod) (JNIEnv *, jclass, jmethodID, ...); /* 132 */ - jlong (JNICALL *CallStaticLongMethodV) (JNIEnv *, jclass, jmethodID, _Jv_va_list); /* 133 */ - jlong (JNICALL *CallStaticLongMethodA) (JNIEnv *, jclass, jmethodID, jvalue *); /* 134 */ - jfloat (JNICALL *CallStaticFloatMethod) (JNIEnv *, jclass, jmethodID, ...); /* 135 */ - jfloat (JNICALL *CallStaticFloatMethodV) (JNIEnv *, jclass, jmethodID, _Jv_va_list); /* 136 */ - jfloat (JNICALL *CallStaticFloatMethodA) (JNIEnv *, jclass, jmethodID, jvalue *); /* 137 */ - jdouble (JNICALL *CallStaticDoubleMethod) (JNIEnv *, jclass, jmethodID, ...); /* 138 */ - jdouble (JNICALL *CallStaticDoubleMethodV) (JNIEnv *, jclass, jmethodID, _Jv_va_list); /* 139 */ - jdouble (JNICALL *CallStaticDoubleMethodA) (JNIEnv *, jclass, jmethodID, jvalue *); /* 140 */ - void (JNICALL *CallStaticVoidMethod) (JNIEnv *, jclass, jmethodID, ...); /* 141 */ - void (JNICALL *CallStaticVoidMethodV) (JNIEnv *, jclass, jmethodID, _Jv_va_list); /* 142 */ - void (JNICALL *CallStaticVoidMethodA) (JNIEnv *, jclass, jmethodID, jvalue *); /* 143 */ - - jfieldID (JNICALL *GetStaticFieldID) (JNIEnv *, jclass, const char *, const char *); /* 144 */ - - jobject (JNICALL *GetStaticObjectField) (JNIEnv *, jclass, jfieldID); /* 145 */ - jboolean (JNICALL *GetStaticBooleanField) (JNIEnv *, jclass, jfieldID); /* 146 */ - jbyte (JNICALL *GetStaticByteField) (JNIEnv *, jclass, jfieldID); /* 147 */ - jchar (JNICALL *GetStaticCharField) (JNIEnv *, jclass, jfieldID); /* 148 */ - jshort (JNICALL *GetStaticShortField) (JNIEnv *, jclass, jfieldID); /* 149 */ - jint (JNICALL *GetStaticIntField) (JNIEnv *, jclass, jfieldID); /* 150 */ - jlong (JNICALL *GetStaticLongField) (JNIEnv *, jclass, jfieldID); /* 151 */ - jfloat (JNICALL *GetStaticFloatField) (JNIEnv *, jclass, jfieldID); /* 152 */ - jdouble (JNICALL *GetStaticDoubleField) (JNIEnv *, jclass, jfieldID); /* 153 */ - - void (JNICALL *SetStaticObjectField) (JNIEnv *, jclass, jfieldID, jobject); /* 154 */ - void (JNICALL *SetStaticBooleanField) (JNIEnv *, jclass, jfieldID, jboolean); /* 155 */ - void (JNICALL *SetStaticByteField) (JNIEnv *, jclass, jfieldID, jbyte); /* 156 */ - void (JNICALL *SetStaticCharField) (JNIEnv *, jclass, jfieldID, jchar); /* 157 */ - void (JNICALL *SetStaticShortField) (JNIEnv *, jclass, jfieldID, jshort); /* 158 */ - void (JNICALL *SetStaticIntField) (JNIEnv *, jclass, jfieldID, jint); /* 159 */ - void (JNICALL *SetStaticLongField) (JNIEnv *, jclass, jfieldID, jlong); /* 160 */ - void (JNICALL *SetStaticFloatField) (JNIEnv *, jclass, jfieldID, jfloat); /* 161 */ - void (JNICALL *SetStaticDoubleField) (JNIEnv *, jclass, jfieldID, jdouble); /* 162 */ - - jstring (JNICALL *NewString) (JNIEnv *, const jchar *, jsize); /* 163 */ - jsize (JNICALL *GetStringLength) (JNIEnv *, jstring); /* 164 */ - const jchar * (JNICALL *GetStringChars) (JNIEnv *, jstring, jboolean *); /* 165 */ - void (JNICALL *ReleaseStringChars) (JNIEnv *, jstring, const jchar *); /* 166 */ - jstring (JNICALL *NewStringUTF) (JNIEnv *, const char *); /* 167 */ - jsize (JNICALL *GetStringUTFLength) (JNIEnv *, jstring); /* 168 */ - const char * (JNICALL *GetStringUTFChars) (JNIEnv *, jstring, jboolean *); /* 169 */ - void (JNICALL *ReleaseStringUTFChars) (JNIEnv *, jstring, const char *); /* 170 */ - jsize (JNICALL *GetArrayLength) (JNIEnv *, jarray); /* 171 */ - jobjectArray (JNICALL *NewObjectArray) (JNIEnv *, jsize, jclass, jobject); /* 172 */ - jobject (JNICALL *GetObjectArrayElement) (JNIEnv *, jobjectArray, jsize); /* 173 */ - void (JNICALL *SetObjectArrayElement) (JNIEnv *, jobjectArray, jsize, jobject); /* 174 */ - - jbooleanArray (JNICALL *NewBooleanArray) (JNIEnv *, jsize); /* 175 */ - jbyteArray (JNICALL *NewByteArray) (JNIEnv *, jsize); /* 176 */ - jcharArray (JNICALL *NewCharArray) (JNIEnv *, jsize); /* 177 */ - jshortArray (JNICALL *NewShortArray) (JNIEnv *, jsize); /* 178 */ - jintArray (JNICALL *NewIntArray) (JNIEnv *, jsize); /* 179 */ - jlongArray (JNICALL *NewLongArray) (JNIEnv *, jsize); /* 180 */ - jfloatArray (JNICALL *NewFloatArray) (JNIEnv *, jsize); /* 181 */ - jdoubleArray (JNICALL *NewDoubleArray) (JNIEnv *, jsize); /* 182 */ - - jboolean * (JNICALL *GetBooleanArrayElements) (JNIEnv *, jbooleanArray, jboolean *); /* 183 */ - jbyte * (JNICALL *GetByteArrayElements) (JNIEnv *, jbyteArray, jboolean *); /* 184 */ - jchar * (JNICALL *GetCharArrayElements) (JNIEnv *, jcharArray, jboolean *); /* 185 */ - jshort * (JNICALL *GetShortArrayElements) (JNIEnv *, jshortArray, jboolean *); /* 186 */ - jint * (JNICALL *GetIntArrayElements) (JNIEnv *, jintArray, jboolean *); /* 187 */ - jlong * (JNICALL *GetLongArrayElements) (JNIEnv *, jlongArray, jboolean *); /* 188 */ - jfloat * (JNICALL *GetFloatArrayElements) (JNIEnv *, jfloatArray, jboolean *); /* 189 */ - jdouble * (JNICALL *GetDoubleArrayElements) (JNIEnv *, jdoubleArray, jboolean *); /* 190 */ - - void (JNICALL *ReleaseBooleanArrayElements) (JNIEnv *, jbooleanArray, jboolean *, jint); /* 191 */ - void (JNICALL *ReleaseByteArrayElements) (JNIEnv *, jbyteArray, jbyte *, jint); /* 192 */ - void (JNICALL *ReleaseCharArrayElements) (JNIEnv *, jcharArray, jchar *, jint); /* 193 */ - void (JNICALL *ReleaseShortArrayElements) (JNIEnv *, jshortArray, jshort *, jint); /* 194 */ - void (JNICALL *ReleaseIntArrayElements) (JNIEnv *, jintArray, jint *, jint); /* 195 */ - void (JNICALL *ReleaseLongArrayElements) (JNIEnv *, jlongArray, jlong *, jint); /* 196 */ - void (JNICALL *ReleaseFloatArrayElements) (JNIEnv *, jfloatArray, jfloat *, jint); /* 197 */ - void (JNICALL *ReleaseDoubleArrayElements) (JNIEnv *, jdoubleArray, jdouble *, jint); /* 198 */ - - void (JNICALL *GetBooleanArrayRegion) (JNIEnv *, jbooleanArray,jsize, jsize, jboolean *); /* 199 */ - void (JNICALL *GetByteArrayRegion) (JNIEnv *, jbyteArray, jsize, jsize, jbyte *); /* 200 */ - void (JNICALL *GetCharArrayRegion) (JNIEnv *, jcharArray, jsize, jsize, jchar *); /* 201 */ - void (JNICALL *GetShortArrayRegion) (JNIEnv *, jshortArray, jsize, jsize, jshort *); /* 202 */ - void (JNICALL *GetIntArrayRegion) (JNIEnv *, jintArray, jsize, jsize, jint *); /* 203 */ - void (JNICALL *GetLongArrayRegion) (JNIEnv *, jlongArray, jsize, jsize, jlong *); /* 204 */ - void (JNICALL *GetFloatArrayRegion) (JNIEnv *, jfloatArray, jsize, jsize, jfloat *); /* 205 */ - void (JNICALL *GetDoubleArrayRegion) (JNIEnv *, jdoubleArray, jsize, jsize, jdouble *); /* 206 */ - - void (JNICALL *SetBooleanArrayRegion) (JNIEnv *, jbooleanArray, jsize, jsize, jboolean *); /* 207 */ - void (JNICALL *SetByteArrayRegion) (JNIEnv *, jbyteArray, jsize, jsize, jbyte *); /* 208 */ - void (JNICALL *SetCharArrayRegion) (JNIEnv *, jcharArray, jsize, jsize, jchar *); /* 209 */ - void (JNICALL *SetShortArrayRegion) (JNIEnv *, jshortArray, jsize, jsize, jshort *); /* 210 */ - void (JNICALL *SetIntArrayRegion) (JNIEnv *, jintArray, jsize, jsize, jint *); /* 211 */ - void (JNICALL *SetLongArrayRegion) (JNIEnv *, jlongArray, jsize, jsize, jlong *); /* 212 */ - void (JNICALL *SetFloatArrayRegion) (JNIEnv *, jfloatArray, jsize, jsize, jfloat *); /* 213 */ - void (JNICALL *SetDoubleArrayRegion) (JNIEnv *, jdoubleArray, jsize, jsize, jdouble *); /* 214 */ - - jint (JNICALL *RegisterNatives) (JNIEnv *, jclass, const JNINativeMethod *, jint); /* 215 */ - jint (JNICALL *UnregisterNatives) (JNIEnv *, jclass); /* 216 */ - jint (JNICALL *MonitorEnter) (JNIEnv *, jobject); /* 217 */ - jint (JNICALL *MonitorExit) (JNIEnv *, jobject); /* 218 */ - jint (JNICALL *GetJavaVM) (JNIEnv *, JavaVM **); /* 219 */ - - /* ---- JNI 1.2 functions ---- */ - void (JNICALL *GetStringRegion) (JNIEnv *, jstring, jsize, jsize, jchar *); /* 220 */ - void (JNICALL *GetStringUTFRegion) (JNIEnv *, jstring, jsize, jsize, char *); /* 221 */ - - void * (JNICALL *GetPrimitiveArrayCritical) (JNIEnv *, jarray, jboolean *); /* 222 */ - void (JNICALL *ReleasePrimitiveArrayCritical) (JNIEnv *, jarray, void *, jint); /* 223 */ - - const jchar * (JNICALL *GetStringCritical) (JNIEnv *, jstring, jboolean *); /* 224 */ - void (JNICALL *ReleaseStringCritical) (JNIEnv *, jstring, const jchar *); /* 225 */ - - jweak (JNICALL *NewWeakGlobalRef) (JNIEnv *, jobject); /* 226 */ - void (JNICALL *DeleteWeakGlobalRef) (JNIEnv *, jweak); /* 227 */ - - jboolean (JNICALL *ExceptionCheck) (JNIEnv *); /* 228 */ - - /* ---- JNI 1.4 functions ---- */ - jobject (JNICALL *NewDirectByteBuffer) (JNIEnv *, void *, jlong); /* 229 */ - void * (JNICALL *GetDirectBufferAddress) (JNIEnv *, jobject); /* 230 */ - long (JNICALL *GetDirectBufferCapacity) (JNIEnv *, jobject); /* 231 */ - -}; - -#ifdef __cplusplus -} /* Extern "C" */ - -struct _Jv_JNIEnv -{ - /* The method table. */ - const struct JNINativeInterface *p; - - jint GetVersion () - { return p->GetVersion (this); } - - jclass DefineClass (const char* char0, jobject obj0, const jbyte * val1, jsize val2) - { return p->DefineClass (this, char0, obj0, val1, val2); } - - jclass FindClass (const char * val0) - { return p->FindClass (this, val0); } - - jmethodID FromReflectedMethod (jobject obj0) - { return p->FromReflectedMethod (this, obj0); } - - jfieldID FromReflectedField (jobject obj0) - { return p->FromReflectedField (this, obj0); } - - jobject ToReflectedMethod (jclass cl0, jmethodID meth1, jboolean val2) - { return p->ToReflectedMethod (this, cl0, meth1, val2); } - - jclass GetSuperclass (jclass cl0) - { return p->GetSuperclass (this, cl0); } - - jboolean IsAssignableFrom (jclass cl0, jclass cl1) - { return p->IsAssignableFrom (this, cl0, cl1); } - - jobject ToReflectedField (jclass cl0, jfieldID fld1, jboolean val2) - { return p->ToReflectedField (this, cl0, fld1, val2); } - - jint Throw (jthrowable val0) - { return p->Throw (this, val0); } - - jint ThrowNew (jclass cl0, const char * val1) - { return p->ThrowNew (this, cl0, val1); } - - jthrowable ExceptionOccurred () - { return p->ExceptionOccurred (this); } - - void ExceptionDescribe () - { p->ExceptionDescribe (this); } - - void ExceptionClear () - { p->ExceptionClear (this); } - - void FatalError (const char * val0) - { p->FatalError (this, val0); } - - jint PushLocalFrame (jint val0) - { return p->PushLocalFrame (this, val0); } - - jobject PopLocalFrame (jobject obj0) - { return p->PopLocalFrame (this, obj0); } - - jobject NewGlobalRef (jobject obj0) - { return p->NewGlobalRef (this, obj0); } - - void DeleteGlobalRef (jobject obj0) - { p->DeleteGlobalRef (this, obj0); } - - void DeleteLocalRef (jobject obj0) - { p->DeleteLocalRef (this, obj0); } - - jboolean IsSameObject (jobject obj0, jobject obj1) - { return p->IsSameObject (this, obj0, obj1); } - - jobject NewLocalRef (jobject obj0) - { return p->NewLocalRef (this, obj0); } - - jint EnsureLocalCapacity (jint val0) - { return p->EnsureLocalCapacity (this, val0); } - - jobject AllocObject (jclass cl0) - { return p->AllocObject (this, cl0); } - - jobject NewObject (jclass cl0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jobject result = p->NewObjectV (this, cl0, meth1, args); - va_end (args); - return result; - } - - jobject NewObjectV (jclass cl0, jmethodID meth1, _Jv_va_list val2) - { return p->NewObjectV (this, cl0, meth1, val2); } - - jobject NewObjectA (jclass cl0, jmethodID meth1, jvalue * val2) - { return p->NewObjectA (this, cl0, meth1, val2); } - - jclass GetObjectClass (jobject obj0) - { return p->GetObjectClass (this, obj0); } - - jboolean IsInstanceOf (jobject obj0, jclass cl1) - { return p->IsInstanceOf (this, obj0, cl1); } - - jmethodID GetMethodID (jclass cl0, const char * val1, const char * val2) - { return p->GetMethodID (this, cl0, val1, val2); } - - jobject CallObjectMethod (jobject obj0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jobject result = p->CallObjectMethodV (this, obj0, meth1, args); - va_end (args); - return result; - } - - jobject CallObjectMethodV (jobject obj0, jmethodID meth1, _Jv_va_list val2) - { return p->CallObjectMethodV (this, obj0, meth1, val2); } - - jobject CallObjectMethodA (jobject obj0, jmethodID meth1, jvalue * val2) - { return p->CallObjectMethodA (this, obj0, meth1, val2); } - - jboolean CallBooleanMethod (jobject obj0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jboolean result = p->CallBooleanMethodV (this, obj0, meth1, args); - va_end (args); - return result; - } - - jboolean CallBooleanMethodV (jobject obj0, jmethodID meth1, _Jv_va_list val2) - { return p->CallBooleanMethodV (this, obj0, meth1, val2); } - - jboolean CallBooleanMethodA (jobject obj0, jmethodID meth1, jvalue * val2) - { return p->CallBooleanMethodA (this, obj0, meth1, val2); } - - jbyte CallByteMethod (jobject obj0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jbyte result = p->CallByteMethodV (this, obj0, meth1, args); - va_end (args); - return result; - } - - jbyte CallByteMethodV (jobject obj0, jmethodID meth1, _Jv_va_list val2) - { return p->CallByteMethodV (this, obj0, meth1, val2); } - - jbyte CallByteMethodA (jobject obj0, jmethodID meth1, jvalue * val2) - { return p->CallByteMethodA (this, obj0, meth1, val2); } - - jchar CallCharMethod (jobject obj0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jchar result = p->CallCharMethodV (this, obj0, meth1, args); - va_end (args); - return result; - } - - jchar CallCharMethodV (jobject obj0, jmethodID meth1, _Jv_va_list val2) - { return p->CallCharMethodV (this, obj0, meth1, val2); } - - jchar CallCharMethodA (jobject obj0, jmethodID meth1, jvalue * val2) - { return p->CallCharMethodA (this, obj0, meth1, val2); } - - jshort CallShortMethod (jobject obj0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jshort result = p->CallShortMethodV (this, obj0, meth1, args); - va_end (args); - return result; - } - - jshort CallShortMethodV (jobject obj0, jmethodID meth1, _Jv_va_list val2) - { return p->CallShortMethodV (this, obj0, meth1, val2); } - - jshort CallShortMethodA (jobject obj0, jmethodID meth1, jvalue * val2) - { return p->CallShortMethodA (this, obj0, meth1, val2); } - - jint CallIntMethod (jobject obj0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jint result = p->CallIntMethodV (this, obj0, meth1, args); - va_end (args); - return result; - } - - jint CallIntMethodV (jobject obj0, jmethodID meth1, _Jv_va_list val2) - { return p->CallIntMethodV (this, obj0, meth1, val2); } - - jint CallIntMethodA (jobject obj0, jmethodID meth1, jvalue * val2) - { return p->CallIntMethodA (this, obj0, meth1, val2); } - - jlong CallLongMethod (jobject obj0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jlong result = p->CallLongMethodV (this, obj0, meth1, args); - va_end (args); - return result; - } - - jlong CallLongMethodV (jobject obj0, jmethodID meth1, _Jv_va_list val2) - { return p->CallLongMethodV (this, obj0, meth1, val2); } - - jlong CallLongMethodA (jobject obj0, jmethodID meth1, jvalue * val2) - { return p->CallLongMethodA (this, obj0, meth1, val2); } - - jfloat CallFloatMethod (jobject obj0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jfloat result = p->CallFloatMethodV (this, obj0, meth1, args); - va_end (args); - return result; - } - - jfloat CallFloatMethodV (jobject obj0, jmethodID meth1, _Jv_va_list val2) - { return p->CallFloatMethodV (this, obj0, meth1, val2); } - - jfloat CallFloatMethodA (jobject obj0, jmethodID meth1, jvalue * val2) - { return p->CallFloatMethodA (this, obj0, meth1, val2); } - - jdouble CallDoubleMethod (jobject obj0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jdouble result = p->CallDoubleMethodV (this, obj0, meth1, args); - va_end (args); - return result; - } - - jdouble CallDoubleMethodV (jobject obj0, jmethodID meth1, _Jv_va_list val2) - { return p->CallDoubleMethodV (this, obj0, meth1, val2); } - - jdouble CallDoubleMethodA (jobject obj0, jmethodID meth1, jvalue * val2) - { return p->CallDoubleMethodA (this, obj0, meth1, val2); } - - void CallVoidMethod (jobject obj0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - p->CallVoidMethodV (this, obj0, meth1, args); - va_end (args); - } - - void CallVoidMethodV (jobject obj0, jmethodID meth1, _Jv_va_list val2) - { p->CallVoidMethodV (this, obj0, meth1, val2); } - - void CallVoidMethodA (jobject obj0, jmethodID meth1, jvalue * val2) - { p->CallVoidMethodA (this, obj0, meth1, val2); } - - jobject CallNonvirtualObjectMethod (jobject obj0, jclass cl1, jmethodID meth2, ...) - { - _Jv_va_list args; - va_start (args, meth2); - jobject result = p->CallNonvirtualObjectMethodV (this, obj0, cl1, meth2, args); - va_end (args); - return result; - } - - jobject CallNonvirtualObjectMethodV (jobject obj0, jclass cl1, jmethodID meth2, _Jv_va_list val3) - { return p->CallNonvirtualObjectMethodV (this, obj0, cl1, meth2, val3); } - - jobject CallNonvirtualObjectMethodA (jobject obj0, jclass cl1, jmethodID meth2, jvalue * val3) - { return p->CallNonvirtualObjectMethodA (this, obj0, cl1, meth2, val3); } - - jboolean CallNonvirtualBooleanMethod (jobject obj0, jclass cl1, jmethodID meth2, ...) - { - _Jv_va_list args; - va_start (args, meth2); - jboolean result = p->CallNonvirtualBooleanMethodV (this, obj0, cl1, meth2, args); - va_end (args); - return result; - } - - jboolean CallNonvirtualBooleanMethodV (jobject obj0, jclass cl1, jmethodID meth2, _Jv_va_list val3) - { return p->CallNonvirtualBooleanMethodV (this, obj0, cl1, meth2, val3); } - - jboolean CallNonvirtualBooleanMethodA (jobject obj0, jclass cl1, jmethodID meth2, jvalue * val3) - { return p->CallNonvirtualBooleanMethodA (this, obj0, cl1, meth2, val3); } - - jbyte CallNonvirtualByteMethod (jobject obj0, jclass cl1, jmethodID meth2, ...) - { - _Jv_va_list args; - va_start (args, meth2); - jbyte result = p->CallNonvirtualByteMethodV (this, obj0, cl1, meth2, args); - va_end (args); - return result; - } - - jbyte CallNonvirtualByteMethodV (jobject obj0, jclass cl1, jmethodID meth2, _Jv_va_list val3) - { return p->CallNonvirtualByteMethodV (this, obj0, cl1, meth2, val3); } - - jbyte CallNonvirtualByteMethodA (jobject obj0, jclass cl1, jmethodID meth2, jvalue * val3) - { return p->CallNonvirtualByteMethodA (this, obj0, cl1, meth2, val3); } - - jchar CallNonvirtualCharMethod (jobject obj0, jclass cl1, jmethodID meth2, ...) - { - _Jv_va_list args; - va_start (args, meth2); - jchar result = p->CallNonvirtualCharMethodV (this, obj0, cl1, meth2, args); - va_end (args); - return result; - } - - jchar CallNonvirtualCharMethodV (jobject obj0, jclass cl1, jmethodID meth2, _Jv_va_list val3) - { return p->CallNonvirtualCharMethodV (this, obj0, cl1, meth2, val3); } - - jchar CallNonvirtualCharMethodA (jobject obj0, jclass cl1, jmethodID meth2, jvalue * val3) - { return p->CallNonvirtualCharMethodA (this, obj0, cl1, meth2, val3); } - - jshort CallNonvirtualShortMethod (jobject obj0, jclass cl1, jmethodID meth2, ...) - { - _Jv_va_list args; - va_start (args, meth2); - jshort result = p->CallNonvirtualShortMethodV (this, obj0, cl1, meth2, args); - va_end (args); - return result; - } - - jshort CallNonvirtualShortMethodV (jobject obj0, jclass cl1, jmethodID meth2, _Jv_va_list val3) - { return p->CallNonvirtualShortMethodV (this, obj0, cl1, meth2, val3); } - - jshort CallNonvirtualShortMethodA (jobject obj0, jclass cl1, jmethodID meth2, jvalue * val3) - { return p->CallNonvirtualShortMethodA (this, obj0, cl1, meth2, val3); } - - jint CallNonvirtualIntMethod (jobject obj0, jclass cl1, jmethodID meth2, ...) - { - _Jv_va_list args; - va_start (args, meth2); - jint result = p->CallNonvirtualIntMethodV (this, obj0, cl1, meth2, args); - va_end (args); - return result; - } - - jint CallNonvirtualIntMethodV (jobject obj0, jclass cl1, jmethodID meth2, _Jv_va_list val3) - { return p->CallNonvirtualIntMethodV (this, obj0, cl1, meth2, val3); } - - jint CallNonvirtualIntMethodA (jobject obj0, jclass cl1, jmethodID meth2, jvalue * val3) - { return p->CallNonvirtualIntMethodA (this, obj0, cl1, meth2, val3); } - - jlong CallNonvirtualLongMethod (jobject obj0, jclass cl1, jmethodID meth2, ...) - { - _Jv_va_list args; - va_start (args, meth2); - jlong result = p->CallNonvirtualLongMethodV (this, obj0, cl1, meth2, args); - va_end (args); - return result; - } - - jlong CallNonvirtualLongMethodV (jobject obj0, jclass cl1, jmethodID meth2, _Jv_va_list val3) - { return p->CallNonvirtualLongMethodV (this, obj0, cl1, meth2, val3); } - - jlong CallNonvirtualLongMethodA (jobject obj0, jclass cl1, jmethodID meth2, jvalue * val3) - { return p->CallNonvirtualLongMethodA (this, obj0, cl1, meth2, val3); } - - jfloat CallNonvirtualFloatMethod (jobject obj0, jclass cl1, jmethodID meth2, ...) - { - _Jv_va_list args; - va_start (args, meth2); - jfloat result = p->CallNonvirtualFloatMethodV (this, obj0, cl1, meth2, args); - va_end (args); - return result; - } - - jfloat CallNonvirtualFloatMethodV (jobject obj0, jclass cl1, jmethodID meth2, _Jv_va_list val3) - { return p->CallNonvirtualFloatMethodV (this, obj0, cl1, meth2, val3); } - - jfloat CallNonvirtualFloatMethodA (jobject obj0, jclass cl1, jmethodID meth2, jvalue * val3) - { return p->CallNonvirtualFloatMethodA (this, obj0, cl1, meth2, val3); } - - jdouble CallNonvirtualDoubleMethod (jobject obj0, jclass cl1, jmethodID meth2, ...) - { - _Jv_va_list args; - va_start (args, meth2); - jdouble result = p->CallNonvirtualDoubleMethodV (this, obj0, cl1, meth2, args); - va_end (args); - return result; - } - - jdouble CallNonvirtualDoubleMethodV (jobject obj0, jclass cl1, jmethodID meth2, _Jv_va_list val3) - { return p->CallNonvirtualDoubleMethodV (this, obj0, cl1, meth2, val3); } - - jdouble CallNonvirtualDoubleMethodA (jobject obj0, jclass cl1, jmethodID meth2, jvalue * val3) - { return p->CallNonvirtualDoubleMethodA (this, obj0, cl1, meth2, val3); } - - void CallNonvirtualVoidMethod (jobject obj0, jclass cl1, jmethodID meth2, ...) - { - _Jv_va_list args; - va_start (args, meth2); - p->CallNonvirtualVoidMethodV (this, obj0, cl1, meth2, args); - va_end (args); - } - - void CallNonvirtualVoidMethodV (jobject obj0, jclass cl1, jmethodID meth2, _Jv_va_list val3) - { p->CallNonvirtualVoidMethodV (this, obj0, cl1, meth2, val3); } - - void CallNonvirtualVoidMethodA (jobject obj0, jclass cl1, jmethodID meth2, jvalue * val3) - { p->CallNonvirtualVoidMethodA (this, obj0, cl1, meth2, val3); } - - jfieldID GetFieldID (jclass cl0, const char * val1, const char * val2) - { return p->GetFieldID (this, cl0, val1, val2); } - - jobject GetObjectField (jobject obj0, jfieldID fld1) - { return p->GetObjectField (this, obj0, fld1); } - - jboolean GetBooleanField (jobject obj0, jfieldID fld1) - { return p->GetBooleanField (this, obj0, fld1); } - - jbyte GetByteField (jobject obj0, jfieldID fld1) - { return p->GetByteField (this, obj0, fld1); } - - jchar GetCharField (jobject obj0, jfieldID fld1) - { return p->GetCharField (this, obj0, fld1); } - - jshort GetShortField (jobject obj0, jfieldID fld1) - { return p->GetShortField (this, obj0, fld1); } - - jint GetIntField (jobject obj0, jfieldID fld1) - { return p->GetIntField (this, obj0, fld1); } - - jlong GetLongField (jobject obj0, jfieldID fld1) - { return p->GetLongField (this, obj0, fld1); } - - jfloat GetFloatField (jobject obj0, jfieldID fld1) - { return p->GetFloatField (this, obj0, fld1); } - - jdouble GetDoubleField (jobject obj0, jfieldID fld1) - { return p->GetDoubleField (this, obj0, fld1); } - - void SetObjectField (jobject obj0, jfieldID fld1, jobject obj2) - { p->SetObjectField (this, obj0, fld1, obj2); } - - void SetBooleanField (jobject obj0, jfieldID fld1, jboolean val2) - { p->SetBooleanField (this, obj0, fld1, val2); } - - void SetByteField (jobject obj0, jfieldID fld1, jbyte val2) - { p->SetByteField (this, obj0, fld1, val2); } - - void SetCharField (jobject obj0, jfieldID fld1, jchar val2) - { p->SetCharField (this, obj0, fld1, val2); } - - void SetShortField (jobject obj0, jfieldID fld1, jshort val2) - { p->SetShortField (this, obj0, fld1, val2); } - - void SetIntField (jobject obj0, jfieldID fld1, jint val2) - { p->SetIntField (this, obj0, fld1, val2); } - - void SetLongField (jobject obj0, jfieldID fld1, jlong val2) - { p->SetLongField (this, obj0, fld1, val2); } - - void SetFloatField (jobject obj0, jfieldID fld1, jfloat val2) - { p->SetFloatField (this, obj0, fld1, val2); } - - void SetDoubleField (jobject obj0, jfieldID fld1, jdouble val2) - { p->SetDoubleField (this, obj0, fld1, val2); } - - jmethodID GetStaticMethodID (jclass cl0, const char * val1, const char * val2) - { return p->GetStaticMethodID (this, cl0, val1, val2); } - - jobject CallStaticObjectMethod (jclass cl0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jobject result = p->CallStaticObjectMethodV (this, cl0, meth1, args); - va_end (args); - return result; - } - - jobject CallStaticObjectMethodV (jclass cl0, jmethodID meth1, _Jv_va_list val2) - { return p->CallStaticObjectMethodV (this, cl0, meth1, val2); } - - jobject CallStaticObjectMethodA (jclass cl0, jmethodID meth1, jvalue * val2) - { return p->CallStaticObjectMethodA (this, cl0, meth1, val2); } - - jboolean CallStaticBooleanMethod (jclass cl0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jboolean result = p->CallStaticBooleanMethodV (this, cl0, meth1, args); - va_end (args); - return result; - } - - jboolean CallStaticBooleanMethodV (jclass cl0, jmethodID meth1, _Jv_va_list val2) - { return p->CallStaticBooleanMethodV (this, cl0, meth1, val2); } - - jboolean CallStaticBooleanMethodA (jclass cl0, jmethodID meth1, jvalue * val2) - { return p->CallStaticBooleanMethodA (this, cl0, meth1, val2); } - - jbyte CallStaticByteMethod (jclass cl0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jbyte result = p->CallStaticByteMethodV (this, cl0, meth1, args); - va_end (args); - return result; - } - - jbyte CallStaticByteMethodV (jclass cl0, jmethodID meth1, _Jv_va_list val2) - { return p->CallStaticByteMethodV (this, cl0, meth1, val2); } - - jbyte CallStaticByteMethodA (jclass cl0, jmethodID meth1, jvalue * val2) - { return p->CallStaticByteMethodA (this, cl0, meth1, val2); } - - jchar CallStaticCharMethod (jclass cl0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jchar result = p->CallStaticCharMethodV (this, cl0, meth1, args); - va_end (args); - return result; - } - - jchar CallStaticCharMethodV (jclass cl0, jmethodID meth1, _Jv_va_list val2) - { return p->CallStaticCharMethodV (this, cl0, meth1, val2); } - - jchar CallStaticCharMethodA (jclass cl0, jmethodID meth1, jvalue * val2) - { return p->CallStaticCharMethodA (this, cl0, meth1, val2); } - - jshort CallStaticShortMethod (jclass cl0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jshort result = p->CallStaticShortMethodV (this, cl0, meth1, args); - va_end (args); - return result; - } - - jshort CallStaticShortMethodV (jclass cl0, jmethodID meth1, _Jv_va_list val2) - { return p->CallStaticShortMethodV (this, cl0, meth1, val2); } - - jshort CallStaticShortMethodA (jclass cl0, jmethodID meth1, jvalue * val2) - { return p->CallStaticShortMethodA (this, cl0, meth1, val2); } - - jint CallStaticIntMethod (jclass cl0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jint result = p->CallStaticIntMethodV (this, cl0, meth1, args); - va_end (args); - return result; - } - - jint CallStaticIntMethodV (jclass cl0, jmethodID meth1, _Jv_va_list val2) - { return p->CallStaticIntMethodV (this, cl0, meth1, val2); } - - jint CallStaticIntMethodA (jclass cl0, jmethodID meth1, jvalue * val2) - { return p->CallStaticIntMethodA (this, cl0, meth1, val2); } - - jlong CallStaticLongMethod (jclass cl0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jlong result = p->CallStaticLongMethodV (this, cl0, meth1, args); - va_end (args); - return result; - } - - jlong CallStaticLongMethodV (jclass cl0, jmethodID meth1, _Jv_va_list val2) - { return p->CallStaticLongMethodV (this, cl0, meth1, val2); } - - jlong CallStaticLongMethodA (jclass cl0, jmethodID meth1, jvalue * val2) - { return p->CallStaticLongMethodA (this, cl0, meth1, val2); } - - jfloat CallStaticFloatMethod (jclass cl0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jfloat result = p->CallStaticFloatMethodV (this, cl0, meth1, args); - va_end (args); - return result; - } - - jfloat CallStaticFloatMethodV (jclass cl0, jmethodID meth1, _Jv_va_list val2) - { return p->CallStaticFloatMethodV (this, cl0, meth1, val2); } - - jfloat CallStaticFloatMethodA (jclass cl0, jmethodID meth1, jvalue * val2) - { return p->CallStaticFloatMethodA (this, cl0, meth1, val2); } - - jdouble CallStaticDoubleMethod (jclass cl0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - jdouble result = p->CallStaticDoubleMethodV (this, cl0, meth1, args); - va_end (args); - return result; - } - - jdouble CallStaticDoubleMethodV (jclass cl0, jmethodID meth1, _Jv_va_list val2) - { return p->CallStaticDoubleMethodV (this, cl0, meth1, val2); } - - jdouble CallStaticDoubleMethodA (jclass cl0, jmethodID meth1, jvalue * val2) - { return p->CallStaticDoubleMethodA (this, cl0, meth1, val2); } - - void CallStaticVoidMethod (jclass cl0, jmethodID meth1, ...) - { - _Jv_va_list args; - va_start (args, meth1); - p->CallStaticVoidMethodV (this, cl0, meth1, args); - va_end (args); - } - - void CallStaticVoidMethodV (jclass cl0, jmethodID meth1, _Jv_va_list val2) - { p->CallStaticVoidMethodV (this, cl0, meth1, val2); } - - void CallStaticVoidMethodA (jclass cl0, jmethodID meth1, jvalue * val2) - { p->CallStaticVoidMethodA (this, cl0, meth1, val2); } - - jfieldID GetStaticFieldID (jclass cl0, const char * val1, const char * val2) - { return p->GetStaticFieldID (this, cl0, val1, val2); } - - jobject GetStaticObjectField (jclass cl0, jfieldID fld1) - { return p->GetStaticObjectField (this, cl0, fld1); } - - jboolean GetStaticBooleanField (jclass cl0, jfieldID fld1) - { return p->GetStaticBooleanField (this, cl0, fld1); } - - jbyte GetStaticByteField (jclass cl0, jfieldID fld1) - { return p->GetStaticByteField (this, cl0, fld1); } - - jchar GetStaticCharField (jclass cl0, jfieldID fld1) - { return p->GetStaticCharField (this, cl0, fld1); } - - jshort GetStaticShortField (jclass cl0, jfieldID fld1) - { return p->GetStaticShortField (this, cl0, fld1); } - - jint GetStaticIntField (jclass cl0, jfieldID fld1) - { return p->GetStaticIntField (this, cl0, fld1); } - - jlong GetStaticLongField (jclass cl0, jfieldID fld1) - { return p->GetStaticLongField (this, cl0, fld1); } - - jfloat GetStaticFloatField (jclass cl0, jfieldID fld1) - { return p->GetStaticFloatField (this, cl0, fld1); } - - jdouble GetStaticDoubleField (jclass cl0, jfieldID fld1) - { return p->GetStaticDoubleField (this, cl0, fld1); } - - void SetStaticObjectField (jclass cl0, jfieldID fld1, jobject obj2) - { p->SetStaticObjectField (this, cl0, fld1, obj2); } - - void SetStaticBooleanField (jclass cl0, jfieldID fld1, jboolean val2) - { p->SetStaticBooleanField (this, cl0, fld1, val2); } - - void SetStaticByteField (jclass cl0, jfieldID fld1, jbyte val2) - { p->SetStaticByteField (this, cl0, fld1, val2); } - - void SetStaticCharField (jclass cl0, jfieldID fld1, jchar val2) - { p->SetStaticCharField (this, cl0, fld1, val2); } - - void SetStaticShortField (jclass cl0, jfieldID fld1, jshort val2) - { p->SetStaticShortField (this, cl0, fld1, val2); } - - void SetStaticIntField (jclass cl0, jfieldID fld1, jint val2) - { p->SetStaticIntField (this, cl0, fld1, val2); } - - void SetStaticLongField (jclass cl0, jfieldID fld1, jlong val2) - { p->SetStaticLongField (this, cl0, fld1, val2); } - - void SetStaticFloatField (jclass cl0, jfieldID fld1, jfloat val2) - { p->SetStaticFloatField (this, cl0, fld1, val2); } - - void SetStaticDoubleField (jclass cl0, jfieldID fld1, jdouble val2) - { p->SetStaticDoubleField (this, cl0, fld1, val2); } - - jstring NewString (const jchar * val0, jsize val1) - { return p->NewString (this, val0, val1); } - - jsize GetStringLength (jstring val0) - { return p->GetStringLength (this, val0); } - - const jchar * GetStringChars (jstring val0, jboolean * val1) - { return p->GetStringChars (this, val0, val1); } - - void ReleaseStringChars (jstring val0, const jchar * val1) - { p->ReleaseStringChars (this, val0, val1); } - - jstring NewStringUTF (const char * val0) - { return p->NewStringUTF (this, val0); } - - jsize GetStringUTFLength (jstring val0) - { return p->GetStringUTFLength (this, val0); } - - const char * GetStringUTFChars (jstring val0, jboolean * val1) - { return p->GetStringUTFChars (this, val0, val1); } - - void ReleaseStringUTFChars (jstring val0, const char * val1) - { p->ReleaseStringUTFChars (this, val0, val1); } - - jsize GetArrayLength (jarray val0) - { return p->GetArrayLength (this, val0); } - - jobjectArray NewObjectArray (jsize val0, jclass cl1, jobject obj2) - { return p->NewObjectArray (this, val0, cl1, obj2); } - - jobject GetObjectArrayElement (jobjectArray val0, jsize val1) - { return p->GetObjectArrayElement (this, val0, val1); } - - void SetObjectArrayElement (jobjectArray val0, jsize val1, jobject obj2) - { p->SetObjectArrayElement (this, val0, val1, obj2); } - - jbooleanArray NewBooleanArray (jsize val0) - { return p->NewBooleanArray (this, val0); } - - jbyteArray NewByteArray (jsize val0) - { return p->NewByteArray (this, val0); } - - jcharArray NewCharArray (jsize val0) - { return p->NewCharArray (this, val0); } - - jshortArray NewShortArray (jsize val0) - { return p->NewShortArray (this, val0); } - - jintArray NewIntArray (jsize val0) - { return p->NewIntArray (this, val0); } - - jlongArray NewLongArray (jsize val0) - { return p->NewLongArray (this, val0); } - - jfloatArray NewFloatArray (jsize val0) - { return p->NewFloatArray (this, val0); } - - jdoubleArray NewDoubleArray (jsize val0) - { return p->NewDoubleArray (this, val0); } - - jboolean * GetBooleanArrayElements (jbooleanArray val0, jboolean * val1) - { return p->GetBooleanArrayElements (this, val0, val1); } - - jbyte * GetByteArrayElements (jbyteArray val0, jboolean * val1) - { return p->GetByteArrayElements (this, val0, val1); } - - jchar * GetCharArrayElements (jcharArray val0, jboolean * val1) - { return p->GetCharArrayElements (this, val0, val1); } - - jshort * GetShortArrayElements (jshortArray val0, jboolean * val1) - { return p->GetShortArrayElements (this, val0, val1); } - - jint * GetIntArrayElements (jintArray val0, jboolean * val1) - { return p->GetIntArrayElements (this, val0, val1); } - - jlong * GetLongArrayElements (jlongArray val0, jboolean * val1) - { return p->GetLongArrayElements (this, val0, val1); } - - jfloat * GetFloatArrayElements (jfloatArray val0, jboolean * val1) - { return p->GetFloatArrayElements (this, val0, val1); } - - jdouble * GetDoubleArrayElements (jdoubleArray val0, jboolean * val1) - { return p->GetDoubleArrayElements (this, val0, val1); } - - void ReleaseBooleanArrayElements (jbooleanArray val0, jboolean * val1, jint val2) - { p->ReleaseBooleanArrayElements (this, val0, val1, val2); } - - void ReleaseByteArrayElements (jbyteArray val0, jbyte * val1, jint val2) - { p->ReleaseByteArrayElements (this, val0, val1, val2); } - - void ReleaseCharArrayElements (jcharArray val0, jchar * val1, jint val2) - { p->ReleaseCharArrayElements (this, val0, val1, val2); } - - void ReleaseShortArrayElements (jshortArray val0, jshort * val1, jint val2) - { p->ReleaseShortArrayElements (this, val0, val1, val2); } - - void ReleaseIntArrayElements (jintArray val0, jint * val1, jint val2) - { p->ReleaseIntArrayElements (this, val0, val1, val2); } - - void ReleaseLongArrayElements (jlongArray val0, jlong * val1, jint val2) - { p->ReleaseLongArrayElements (this, val0, val1, val2); } - - void ReleaseFloatArrayElements (jfloatArray val0, jfloat * val1, jint val2) - { p->ReleaseFloatArrayElements (this, val0, val1, val2); } - - void ReleaseDoubleArrayElements (jdoubleArray val0, jdouble * val1, jint val2) - { p->ReleaseDoubleArrayElements (this, val0, val1, val2); } - - void GetBooleanArrayRegion (jbooleanArray val0, jsize val1, jsize val2, jboolean * val3) - { p->GetBooleanArrayRegion (this, val0, val1, val2, val3); } - - void GetByteArrayRegion (jbyteArray val0, jsize val1, jsize val2, jbyte * val3) - { p->GetByteArrayRegion (this, val0, val1, val2, val3); } - - void GetCharArrayRegion (jcharArray val0, jsize val1, jsize val2, jchar * val3) - { p->GetCharArrayRegion (this, val0, val1, val2, val3); } - - void GetShortArrayRegion (jshortArray val0, jsize val1, jsize val2, jshort * val3) - { p->GetShortArrayRegion (this, val0, val1, val2, val3); } - - void GetIntArrayRegion (jintArray val0, jsize val1, jsize val2, jint * val3) - { p->GetIntArrayRegion (this, val0, val1, val2, val3); } - - void GetLongArrayRegion (jlongArray val0, jsize val1, jsize val2, jlong * val3) - { p->GetLongArrayRegion (this, val0, val1, val2, val3); } - - void GetFloatArrayRegion (jfloatArray val0, jsize val1, jsize val2, jfloat * val3) - { p->GetFloatArrayRegion (this, val0, val1, val2, val3); } - - void GetDoubleArrayRegion (jdoubleArray val0, jsize val1, jsize val2, jdouble * val3) - { p->GetDoubleArrayRegion (this, val0, val1, val2, val3); } - - void SetBooleanArrayRegion (jbooleanArray val0, jsize val1, jsize val2, jboolean * val3) - { p->SetBooleanArrayRegion (this, val0, val1, val2, val3); } - - void SetByteArrayRegion (jbyteArray val0, jsize val1, jsize val2, jbyte * val3) - { p->SetByteArrayRegion (this, val0, val1, val2, val3); } - - void SetCharArrayRegion (jcharArray val0, jsize val1, jsize val2, jchar * val3) - { p->SetCharArrayRegion (this, val0, val1, val2, val3); } - - void SetShortArrayRegion (jshortArray val0, jsize val1, jsize val2, jshort * val3) - { p->SetShortArrayRegion (this, val0, val1, val2, val3); } - - void SetIntArrayRegion (jintArray val0, jsize val1, jsize val2, jint * val3) - { p->SetIntArrayRegion (this, val0, val1, val2, val3); } - - void SetLongArrayRegion (jlongArray val0, jsize val1, jsize val2, jlong * val3) - { p->SetLongArrayRegion (this, val0, val1, val2, val3); } - - void SetFloatArrayRegion (jfloatArray val0, jsize val1, jsize val2, jfloat * val3) - { p->SetFloatArrayRegion (this, val0, val1, val2, val3); } - - void SetDoubleArrayRegion (jdoubleArray val0, jsize val1, jsize val2, jdouble * val3) - { p->SetDoubleArrayRegion (this, val0, val1, val2, val3); } - - jint RegisterNatives (jclass cl0, const JNINativeMethod * val1, jint val2) - { return p->RegisterNatives (this, cl0, val1, val2); } - - jint UnregisterNatives (jclass cl0) - { return p->UnregisterNatives (this, cl0); } - - jint MonitorEnter (jobject obj0) - { return p->MonitorEnter (this, obj0); } - - jint MonitorExit (jobject obj0) - { return p->MonitorExit (this, obj0); } - - jint GetJavaVM (JavaVM ** val0) - { return p->GetJavaVM (this, val0); } - - void GetStringRegion (jstring val0, jsize val1, jsize val2, jchar * val3) - { p->GetStringRegion (this, val0, val1, val2, val3); } - - void GetStringUTFRegion (jstring val0, jsize val1, jsize val2, char * val3) - { p->GetStringUTFRegion (this, val0, val1, val2, val3); } - - void * GetPrimitiveArrayCritical (jarray val0, jboolean * val1) - { return p->GetPrimitiveArrayCritical (this, val0, val1); } - - void ReleasePrimitiveArrayCritical (jarray val0, void * val1, jint val2) - { p->ReleasePrimitiveArrayCritical (this, val0, val1, val2); } - - const jchar * GetStringCritical (jstring val0, jboolean * val1) - { return p->GetStringCritical (this, val0, val1); } - - void ReleaseStringCritical (jstring val0, const jchar * val1) - { p->ReleaseStringCritical (this, val0, val1); } - - jweak NewWeakGlobalRef (jobject obj0) - { return p->NewWeakGlobalRef (this, obj0); } - - void DeleteWeakGlobalRef (jweak val0) - { p->DeleteWeakGlobalRef (this, val0); } - - jboolean ExceptionCheck () - { return p->ExceptionCheck (this); } - - jobject NewDirectByteBuffer (void * val1, jlong val2) - { return p->NewDirectByteBuffer (this, val1, val2); } - - void * GetDirectBufferAddress (jobject val1) - { return p->GetDirectBufferAddress (this, val1); } - - long GetDirectBufferCapacity (jobject val1) - { return p->GetDirectBufferCapacity (this, val1); } - -}; -#endif /* __cplusplus */ - -/* - * Invocation API. - */ - -struct JNIInvokeInterface -{ - void *reserved0; - void *reserved1; - void *reserved2; - - jint (JNICALL *DestroyJavaVM) (JavaVM *); - jint (JNICALL *AttachCurrentThread) (JavaVM *, void **, void *); - jint (JNICALL *DetachCurrentThread) (JavaVM *); - jint (JNICALL *GetEnv) (JavaVM *, void **, jint); - jint (JNICALL *AttachCurrentThreadAsDaemon) (JavaVM *, void **, void *); - -}; - -#ifdef __cplusplus - -struct _Jv_JavaVM -{ - const struct JNIInvokeInterface *functions; - - jint DestroyJavaVM () - { return functions->DestroyJavaVM (this); } - - jint AttachCurrentThread (void **penv, void *args) - { return functions->AttachCurrentThread (this, penv, args); } - - jint DetachCurrentThread () - { return functions->DetachCurrentThread (this); } - - jint GetEnv (void **penv, jint version) - { return functions->GetEnv (this, penv, version); } - - jint AttachCurrentThreadAsDaemon (void **penv, void *args) - { return functions->AttachCurrentThreadAsDaemon (this, penv, args); } -}; -#endif /* __cplusplus */ - -typedef struct JavaVMAttachArgs -{ - jint version; /* Must be JNI_VERSION_1_2. */ - char *name; /* The name of the thread (or NULL). */ - jobject group; /* Global ref of a ThreadGroup object - (or NULL). */ -} JavaVMAttachArgs; - -typedef struct JavaVMOption -{ - char *optionString; - void *extraInfo; -} JavaVMOption; - -typedef struct JavaVMInitArgs -{ - /* Must be JNI_VERSION_1_2. */ - jint version; - - /* Number of options. */ - jint nOptions; - - /* Options to the VM. */ - JavaVMOption *options; - - /* Whether we should ignore unrecognized options. */ - jboolean ignoreUnrecognized; -} JavaVMInitArgs; - - -/* Keep c-font-lock-extra-types in alphabetical order. */ -/* Local Variables: */ -/* c-font-lock-extra-types: ("\\sw+_t" - "JNIEnv" "JNINativeMethod" "JavaVM" "JavaVMOption" "jarray" - "jboolean" "jbooleanArray" "jbyte" "jbyteArray" "jchar" "jcharArray" - "jclass" "jdouble" "jdoubleArray" "jfieldID" "jfloat" "jfloatArray" - "jint" "jintArray" "jlong" "jlongArray" "jmethodID" "jobject" "jstring" "jthrowable" - "jvalue" "jweak") */ -/* End: */ -#endif /* __CLASSPATH_JNI_H__ */
diff --git a/java/include/llvm/Java/types.def b/java/include/llvm/Java/types.def deleted file mode 100644 index 21d9b12..0000000 --- a/java/include/llvm/Java/types.def +++ /dev/null
@@ -1,45 +0,0 @@ -//===-- llvm/Java/types.def - File that describes Java primitives -*- C++ -*-=// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains descriptions of the various Java primitive types. This -// is used as a central place for enumerating the different primitive types. -// -//===----------------------------------------------------------------------===// - -// NOTE: NO INCLUDE GUARD DESIRED! - -// Provide definitions of macros so that users of this file do not have to -// define everything to use it... - -#ifdef HANDLE_NATIVE_TYPE -HANDLE_NATIVE_TYPE(boolean) -HANDLE_NATIVE_TYPE(byte) -HANDLE_NATIVE_TYPE(char) -HANDLE_NATIVE_TYPE(short) -HANDLE_NATIVE_TYPE(int) -HANDLE_NATIVE_TYPE(long) -HANDLE_NATIVE_TYPE(float) -HANDLE_NATIVE_TYPE(double) - -#undef HANDLE_NATIVE_TYPE -#endif - -#ifdef HANDLE_TYPE -HANDLE_TYPE(object) -HANDLE_TYPE(boolean) -HANDLE_TYPE(byte) -HANDLE_TYPE(char) -HANDLE_TYPE(short) -HANDLE_TYPE(int) -HANDLE_TYPE(long) -HANDLE_TYPE(float) -HANDLE_TYPE(double) - -#undef HANDLE_TYPE -#endif
diff --git a/java/lib/ClassFile/ClassFile.cpp b/java/lib/ClassFile/ClassFile.cpp deleted file mode 100644 index 9cb9ba9..0000000 --- a/java/lib/ClassFile/ClassFile.cpp +++ /dev/null
@@ -1,767 +0,0 @@ -//===-- ClassFile.cpp - ClassFile class -----------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the implementation of the ClassFile library. It -// is used by the LLVM Java frontend to parse Java Class files. -// -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "classfile" - -#include <llvm/Java/ClassFile.h> -#include <llvm/ADT/STLExtras.h> -#include <llvm/Support/CommandLine.h> -#include <llvm/Support/Debug.h> -#include <llvm/Config/alloca.h> - -#include <algorithm> -#include <cassert> -#include <fstream> -#include <functional> -#include <iostream> -#include <iterator> -#include <map> - -using namespace llvm::Java; - -namespace { - - using namespace llvm; - - static cl::opt<std::string> - ClassPath("cp", - cl::desc("A : separated list of directories"), - cl::value_desc("class search path"), - cl::init(getenv("CLASSPATH") ? getenv("CLASSPATH") : "")); - static cl::alias - ClassPathA("classpath", - cl::desc("Alias for -cp"), - cl::aliasopt(ClassPath)); - -} - -//===----------------------------------------------------------------------===// -// Internal utility functions -namespace { - - uint8_t readU1(std::istream& is) { - char val; - if (!is.get(val)) - throw ClassFileParseError("unexpected end of input"); - return val; - } - - uint16_t readU2(std::istream& is) { - uint16_t val = readU1(is); - return (val << 8) | readU1(is); - } - - uint32_t readU4(std::istream& is) { - uint32_t val = readU2(is); - return (val << 16) | readU2(is); - } - - uint64_t readU8(std::istream& is) { - uint64_t hi = readU4(is), lo = readU4(is); - return hi << 32 | lo; - } - - float int2float(uint32_t v) { - union { uint32_t in; float out; } tmp; - tmp.in = v; - return tmp.out; - } - - double long2double(uint64_t v) { - union { uint64_t in; double out; } tmp; - tmp.in = v; - return tmp.out; - } - - void readFields(Fields& f, const ClassFile* parent, std::istream& is) - { - assert(f.empty() && "Should not call with a non-empty fields vector"); - uint16_t count = readU2(is); - f.reserve(count); - while(count--) - f.push_back(Field::readField(parent, is)); - } - - void readMethods(Methods& m, const ClassFile* parent, std::istream& is) - { - assert(m.empty() && "Should not call with a non-empty methods vector"); - uint16_t count = readU2(is); - m.reserve(count); - while(count--) - m.push_back(Method::readMethod(parent, is)); - } - - void readAttributes(Attributes& a, const ClassFile* cf, std::istream& is) - { - assert(a.empty() && - "Should not call with a non-empty attributes vector"); - uint16_t count = readU2(is); - a.reserve(count); - while(count--) - a.push_back(Attribute::readAttribute(cf, is)); - } - -} - -//===----------------------------------------------------------------------===// -// ClassFile implementation -const ClassFile* ClassFile::readClassFile(std::istream& is) -{ - if (readU1(is) != 0xCA) throw ClassFileParseError("bad magic"); - if (readU1(is) != 0xFE) throw ClassFileParseError("bad magic"); - if (readU1(is) != 0xBA) throw ClassFileParseError("bad magic"); - if (readU1(is) != 0xBE) throw ClassFileParseError("bad magic"); - - return new ClassFile(is); -} - -std::vector<sys::Path> ClassFile::getClassPath() -{ - DEBUG(std::cerr << "CLASSPATH=" << ClassPath << '\n'); - - std::vector<sys::Path> result; - sys::Path path; - unsigned b = 0, e = 0; - do { - e = ClassPath.find(':', b); - // FIXME: Currently we only support flat class file reading. When - // jar files are supported this chech has to change to not require - // that each CLASSPATH component is a directory. - if (path.set(ClassPath.substr(b, e - b)) && path.isDirectory()) { - result.push_back(path); - DEBUG(std::cerr << "Adding: " << path.toString() << " to CLASSPATH\n"); - } - b = e + 1; - } while (e != std::string::npos); - - return result; -} - -sys::Path ClassFile::getFileForClass(const std::string& classname) -{ - static const std::vector<sys::Path> classpath = getClassPath(); - DEBUG(std::cerr << "Looking up class: " << classname << '\n'); - - std::string clazz = classname; - // replace '.' with '/' - for (unsigned i = 0, e = clazz.size(); i != e; ++i) - if (clazz[i] == '.') - clazz[i] = '/'; - clazz += ".class"; - - for (unsigned i = 0, e = classpath.size(); i != e; ++i) { - sys::Path filename = classpath[i]; - assert(filename.isDirectory() && "CLASSPATH element not a directory!"); - filename.appendComponent(clazz); - DEBUG(std::cerr << "Trying file: " << filename.toString() << '\n'); - if (filename.exists()) - return filename; - } - - throw ClassNotFoundException("Class " + classname + " not found"); -} - -const ClassFile* ClassFile::get(const std::string& classname) -{ - typedef std::map<std::string, const ClassFile*> Name2ClassMap; - static Name2ClassMap n2cMap_; - - Name2ClassMap::iterator it = n2cMap_.lower_bound(classname); - - if (it == n2cMap_.end() || it->first != classname) { - std::ifstream in(getFileForClass(classname).c_str()); - it = n2cMap_.insert(it, std::make_pair(classname, readClassFile(in))); - } - - return it->second; -} - -ClassFile::ClassFile(std::istream& is) -{ - minorV_ = readU2(is); - majorV_ = readU2(is); - // Read constant pool. - uint16_t count = readU2(is); - cPool_.reserve(count); - cPool_.push_back(NULL); - while (cPool_.size() < count) { - cPool_.push_back(Constant::readConstant(this, is)); - if (cPool_.back()->isDoubleSlot()) - cPool_.push_back(NULL); - } - accessFlags_ = readU2(is); - thisClassIdx_ = readU2(is); - superClassIdx_ = readU2(is); - count = readU2(is); - interfaces_.reserve(count); - while (count--) - interfaces_.push_back(readU2(is)); - - readFields(fields_, this, is); - readMethods(methods_, this, is); - readAttributes(attributes_, this, is); -} - -ConstantClass* ClassFile::getConstantClass(unsigned index) const -{ - assert(dynamic_cast<ConstantClass*>(getConstant(index)) && - "Constant is not a ConstantClass!"); - return static_cast<ConstantClass*>(getConstant(index)); -} - -ConstantMemberRef* ClassFile::getConstantMemberRef(unsigned index) const -{ - assert(dynamic_cast<ConstantMemberRef*>(getConstant(index)) && - "Constant is not a ConstantMemberRef!"); - return static_cast<ConstantMemberRef*>(getConstant(index)); -} - -ConstantFieldRef* ClassFile::getConstantFieldRef(unsigned index) const -{ - assert(dynamic_cast<ConstantFieldRef*>(getConstant(index)) && - "Constant is not a ConstantFieldRef!"); - return static_cast<ConstantFieldRef*>(getConstant(index)); -} - -ConstantMethodRef* ClassFile::getConstantMethodRef(unsigned index) const -{ - assert(dynamic_cast<ConstantMethodRef*>(getConstant(index)) && - "Constant is not a ConstantMethodRef!"); - return static_cast<ConstantMethodRef*>(getConstant(index)); -} - -ConstantInterfaceMethodRef* -ClassFile::getConstantInterfaceMethodRef(unsigned index) const -{ - assert(dynamic_cast<ConstantInterfaceMethodRef*>(getConstant(index)) && - "Constant is not a ConstantInterfaceMethodRef!"); - return static_cast<ConstantInterfaceMethodRef*>(getConstant(index)); -} - -ConstantNameAndType* ClassFile::getConstantNameAndType(unsigned index) const -{ - assert(dynamic_cast<ConstantNameAndType*>(getConstant(index)) && - "Constant is not a ConstantNameAndType!"); - return static_cast<ConstantNameAndType*>(getConstant(index)); -} - -ConstantUtf8* ClassFile::getConstantUtf8(unsigned index) const -{ - assert(dynamic_cast<ConstantUtf8*>(getConstant(index)) && - "Constant is not a ConstantUtf8!"); - return static_cast<ConstantUtf8*>(getConstant(index)); -} - -bool ClassFile::isNativeMethodOverloaded(const Method& method) const -{ - unsigned count = 0; - for (Methods::const_iterator i = methods_.begin(), e = methods_.end(); - i != e; ++i) - if ((*i)->isNative() && (*i)->getName() == method.getName()) - ++count; - - return count > 1; -} - -ClassFile::~ClassFile() -{ - for_each(cPool_.begin(), cPool_.end(), deleter<Constant>); - for_each(fields_.begin(), fields_.end(), deleter<Field>); - for_each(methods_.begin(), methods_.end(), deleter<Method>); - for_each(attributes_.begin(), attributes_.end(), deleter<Attribute>); -} - -std::ostream& ClassFile::dump(std::ostream& os) const -{ - os << "Minor version: " << getMinorVersion() << '\n' - << "Major version: " << getMajorVersion() << "\n\n" - << "class " << *getThisClass(); - if (getSuperClass()) - os << " (" << *getSuperClass() << ")\n"; - - os << "Flags:"; - if (isPublic()) os << " public"; - if (isFinal()) os << " final"; - if (isSuper()) os << " super"; - if (isInterface()) os << " interface"; - if (isAbstract()) os << " abstract"; - -// dumpCollection(interfaces_, "Interface", os); -// dumpCollection(fields_, "Field", os); -// dumpCollection(methods_, "Method", os); -// dumpCollection(attributes_, "Attribute", os); - - return os; -} - -//===----------------------------------------------------------------------===// -// Utility functions -Attribute* llvm::Java::getAttribute(const Attributes& attrs, - const std::string& name) -{ - for (unsigned i = 0, e = attrs.size(); i != e; ++i) - if (attrs[i]->getName()->str() == name) - return attrs[i]; - - return NULL; -} - -//===----------------------------------------------------------------------===// -// ClassFileParseError implementation -ClassFileParseError::~ClassFileParseError() throw() -{ - -} - -//===----------------------------------------------------------------------===// -// ClassFileSemanticError implementation -ClassFileSemanticError::~ClassFileSemanticError() throw() -{ - -} - -//===----------------------------------------------------------------------===// -// ClassNotFoundException implementation -ClassNotFoundException::~ClassNotFoundException() throw() -{ - -} - -//===----------------------------------------------------------------------===// -// InvocationTargetException implementation -InvocationTargetException::~InvocationTargetException() throw() -{ - -} - -//===----------------------------------------------------------------------===// -// Constant implementation -Constant* Constant::readConstant(const ClassFile* cf, std::istream& is) -{ - Constant::Tag tag = static_cast<Constant::Tag>(readU1(is)); - switch (tag) { - case Constant::CLASS: - return new ConstantClass(cf, is); - case Constant::FIELD_REF: - return new ConstantFieldRef(cf, is); - case Constant::METHOD_REF: - return new ConstantMethodRef(cf, is); - case Constant::INTERFACE_METHOD_REF: - return new ConstantInterfaceMethodRef(cf, is); - case Constant::STRING: - return new ConstantString(cf, is); - case Constant::INTEGER: - return new ConstantInteger(cf, is); - case Constant::FLOAT: - return new ConstantFloat(cf, is); - case Constant::LONG: - return new ConstantLong(cf, is); - case Constant::DOUBLE: - return new ConstantDouble(cf, is); - case Constant::NAME_AND_TYPE: - return new ConstantNameAndType(cf, is); - case Constant::UTF8: - return new ConstantUtf8(cf, is); - default: - assert(0 && "Unknown constant tag"); - } - - return NULL; -} - -Constant::~Constant() -{ - -} - -ConstantClass::ConstantClass(const ClassFile* cf, std::istream& is) - : Constant(cf), - nameIdx_(readU2(is)) -{ - -} - -std::ostream& ConstantClass::dump(std::ostream& os) const -{ - return os << "class (Name=" << nameIdx_ << ')'; -} - -ConstantMemberRef::ConstantMemberRef(const ClassFile* cf, std::istream& is) - : Constant(cf), - classIdx_(readU2(is)), - nameAndTypeIdx_(readU2(is)) -{ - -} - -std::ostream& ConstantFieldRef::dump(std::ostream& os) const -{ - return os << "fieldRef (class=" << classIdx_ - << ", nameAndType=" << nameAndTypeIdx_ << ')'; -} - -std::ostream& ConstantMethodRef::dump(std::ostream& os) const -{ - return os << "methodRef (class=" << classIdx_ - << ", nameAndType=" << nameAndTypeIdx_ << ')'; -} - -std::ostream& ConstantInterfaceMethodRef::dump(std::ostream& os) const -{ - return os << "interfaceMethodRef (class=" << classIdx_ - << ", nameAndType=" << nameAndTypeIdx_ << ')'; -} - -ConstantString::ConstantString(const ClassFile* cf, std::istream& is) - : Constant(cf), - stringIdx_(readU2(is)) -{ - -} - -std::ostream& ConstantString::dump(std::ostream& os) const -{ - return os << "string (utf8=" << stringIdx_ << ')'; -} - -ConstantInteger::ConstantInteger(const ClassFile* cf, std::istream& is) - : Constant(cf), - value_(static_cast<int32_t>(readU4(is))) -{ - -} - -std::ostream& ConstantInteger::dump(std::ostream& os) const -{ - return os << "int " << value_; -} - -ConstantFloat::ConstantFloat(const ClassFile* cf, std::istream& is) - : Constant(cf), - value_(int2float(readU4(is))) -{ - -} - -std::ostream& ConstantFloat::dump(std::ostream& os) const -{ - return os << "float " << value_; -} - -ConstantLong::ConstantLong(const ClassFile* cf, std::istream& is) - : Constant(cf), - value_(static_cast<int64_t>(readU8(is))) -{ - -} - -std::ostream& ConstantLong::dump(std::ostream& os) const -{ - return os << "long " << value_ << 'l'; -} - -ConstantDouble::ConstantDouble(const ClassFile* cf, std::istream& is) - : Constant(cf), - value_(long2double(readU8(is))) -{ - -} - -std::ostream& ConstantDouble::dump(std::ostream& os) const -{ - return os << "double " << value_; -} - -ConstantNameAndType::ConstantNameAndType(const ClassFile* cf, std::istream& is) - : Constant(cf), - nameIdx_(readU2(is)), - descriptorIdx_(readU2(is)) -{ - -} - -std::ostream& ConstantNameAndType::dump(std::ostream& os) const -{ - return os << "nameAndType (name=" << nameIdx_ - << ", descriptor=" << descriptorIdx_ << ')'; -} - -ConstantUtf8::ConstantUtf8(const ClassFile* cf, std::istream& is) - : Constant(cf) -{ - uint16_t length = readU2(is); - char *buf = (char *)alloca(length); - std::streamsize s = is.rdbuf()->sgetn(buf, length); - if (s != length) - throw ClassFileParseError( - "Could not read string constant from input stream"); - utf8_.assign(buf, length); -} - -std::ostream& ConstantUtf8::dump(std::ostream& os) const -{ - return os << utf8_; -} - -//===----------------------------------------------------------------------===// -// Member implementation -Member::Member(const ClassFile* parent, std::istream& is) - : parent_(parent), - accessFlags_(readU2(is)), - nameIdx_(readU2(is)), - descriptorIdx_(readU2(is)) -{ - readAttributes(attributes_, parent_, is); -} - -Member::~Member() -{ - for_each(attributes_.begin(), attributes_.end(), deleter<Attribute>); -} - -//===----------------------------------------------------------------------===// -// Field implementation -Field::Field(const ClassFile* parent, std::istream& is) - : Member(parent, is) -{ - -} - -Field::~Field() -{ - -} - -std::ostream& Field::dump(std::ostream& os) const -{ - os << *getName() << ' ' << *getDescriptor() << '\n' - << "Flags:"; - if (isPublic()) os << " public"; - if (isPrivate()) os << " private"; - if (isProtected()) os << " protected"; - if (isStatic()) os << " static"; - if (isFinal()) os << " final"; - if (isVolatile()) os << " volatile"; - if (isTransient()) os << " transient"; - -// dumpCollection(attributes_, "Attribute", os); - - return os; -} - -ConstantValueAttribute* Field::getConstantValueAttribute() const -{ - if (!isStatic()) - return NULL; - - return (ConstantValueAttribute*) getAttribute(attributes_, - Attribute::CONSTANT_VALUE); -} - -//===----------------------------------------------------------------------===// -// Method implementation -Method::Method(const ClassFile* parent, std::istream& is) - : Member(parent, is) -{ - -} - -Method::~Method() -{ - -} - -std::ostream& Method::dump(std::ostream& os) const -{ - os << *getName() << ' ' << *getDescriptor() << '\n' - << "Flags:"; - if (isPublic()) os << " public"; - if (isPrivate()) os << " private"; - if (isProtected()) os << " protected"; - if (isStatic()) os << " static"; - if (isFinal()) os << " final"; - if (isSynchronized()) os << " synchronized"; - if (isNative()) os << " native"; - if (isStrict()) os << " strict"; - -// dumpCollection(attributes_, "Attribute", os); - - return os; -} - -CodeAttribute* Method::getCodeAttribute() const -{ - return (CodeAttribute*) getAttribute(attributes_, Attribute::CODE); -} - -ExceptionsAttribute* Method::getExceptionsAttribute() const -{ - return (ExceptionsAttribute*) getAttribute(attributes_, - Attribute::EXCEPTIONS); -} - -//===----------------------------------------------------------------------===// -// Attribute implementation -const std::string Attribute::CONSTANT_VALUE = "ConstantValue"; -const std::string Attribute::CODE = "Code"; -const std::string Attribute::EXCEPTIONS = "Exceptions"; -const std::string Attribute::INNER_CLASSES = "InnerClasses"; -const std::string Attribute::SYNTHETIC = "Synthetic"; -const std::string Attribute::SOURCE_FILE = "SourceFile"; -const std::string Attribute::LINE_NUMBER_TABLE = "LineNumberTable"; -const std::string Attribute::LOCAL_VARIABLE_TABLE = "LocalVariableTable"; -const std::string Attribute::DEPRECATED = "Deprecated"; - -Attribute* Attribute::readAttribute(const ClassFile* cf, std::istream& is) -{ - uint16_t nameIdx = readU2(is); - ConstantUtf8* name = cf->getConstantUtf8(nameIdx); - if (!name) - throw ClassFileSemanticError( - "Representation of attribute name is not of type ConstantUtf8"); - - if (CONSTANT_VALUE == name->str()) - return new ConstantValueAttribute(cf, nameIdx, is); - else if (CODE == name->str()) - return new CodeAttribute(cf, nameIdx, is); - else { - uint32_t length = readU4(is); - is.ignore(length); - return new Attribute(cf, nameIdx, is); - } -} - -Attribute::Attribute(const ClassFile* cf, uint16_t nameIdx, std::istream& is) - : parent_(cf), - nameIdx_(nameIdx) -{ - -} - -Attribute::~Attribute() -{ - -} - -std::ostream& Attribute::dump(std::ostream& os) const -{ - return os << *getName(); -} - -//===----------------------------------------------------------------------===// -// AttributeConstantValue implementation -ConstantValueAttribute::ConstantValueAttribute(const ClassFile* cf, - uint16_t nameIdx, - std::istream& is) - : Attribute(cf, nameIdx, is) -{ - uint32_t length = readU4(is); - if (length != 2) - throw ClassFileSemanticError( - "Length of ConstantValueAttribute is not 2"); - valueIdx_ = readU2(is); -} - -std::ostream& ConstantValueAttribute::dump(std::ostream& os) const -{ - return Attribute::dump(os) << ": " << *getValue(); -} - -//===----------------------------------------------------------------------===// -// AttributeCode implementation -CodeAttribute::CodeAttribute(const ClassFile* cf, - uint16_t nameIdx, - std::istream& is) - : Attribute(cf, nameIdx, is) -{ - uint32_t length = readU4(is); - maxStack_ = readU2(is); - maxLocals_ = readU2(is); - codeSize_ = readU4(is); - code_ = new uint8_t[codeSize_]; - std::streamsize s = is.rdbuf()->sgetn(reinterpret_cast<char*>(code_), codeSize_); - if (s != (std::streamsize) codeSize_) - throw ClassFileParseError( - "Could not read code from input stream"); - uint16_t exceptCount = readU2(is); - exceptions_.reserve(exceptCount); - while (exceptCount--) - exceptions_.push_back(new Exception(cf, is)); - readAttributes(attributes_, cf, is); -} - -CodeAttribute::~CodeAttribute() -{ - delete[] code_; - for_each(exceptions_.begin(), exceptions_.end(), deleter<Exception>); - for_each(attributes_.begin(), attributes_.end(), deleter<Attribute>); -} - -std::ostream& CodeAttribute::dump(std::ostream& os) const -{ - Attribute::dump(os) - << '\n' - << "Max stack: " << maxStack_ << '\n' - << "Max locals: " << maxLocals_ << '\n' - << "Code size: " << codeSize_ << '\n'; -// dumpCollection(exceptions_, "Exception", os); -// dumpCollection(attributes_, "Attribute", os); - - return os; -} - -CodeAttribute::Exception::Exception(const ClassFile* cf, std::istream& is) - : parent_(cf), - startPc_(readU2(is)), - endPc_(readU2(is)), - handlerPc_(readU2(is)), - catchTypeIdx_(readU2(is)) -{ - if (catchTypeIdx_ && !cf->getConstantClass(catchTypeIdx_)) - throw ClassFileSemanticError - ("Representation of catch type is not of type ConstantClass"); -} - -std::ostream& CodeAttribute::Exception::dump(std::ostream& os) const -{ - if (getCatchType()) - os << *getCatchType() << '\n'; - else - os << "catch-all\n"; - return os << "Start PC: " << startPc_ << '\n' - << "End PC: " << endPc_ << '\n' - << "Handler PC: " << handlerPc_; -} - -//===----------------------------------------------------------------------===// -// AttributeExceptions implementation -ExceptionsAttribute::ExceptionsAttribute(const ClassFile* cf, - uint16_t nameIdx, - std::istream& is) - : Attribute(cf, nameIdx, is) -{ - uint32_t length = readU4(is); - uint16_t count = readU2(is); - exceptions_.reserve(count); - while (count--) - exceptions_.push_back(readU2(is)); -} - -std::ostream& ExceptionsAttribute::dump(std::ostream& os) const -{ - os << Attribute::dump(os) << ": "; - for (unsigned i = 0, e = getNumExceptions(); i != e; ++i) - os << *getException(i) << ' '; - return os; -}
diff --git a/java/lib/ClassFile/Makefile b/java/lib/ClassFile/Makefile deleted file mode 100755 index ae4b8bb..0000000 --- a/java/lib/ClassFile/Makefile +++ /dev/null
@@ -1,15 +0,0 @@ -##===- lib/ClassFile/Makefile ------------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## -LEVEL := ../.. - -LIBRARYNAME := LLVMJavaClassfile - -BUILD_ARCHIVE = 1 - -include $(LEVEL)/Makefile.common
diff --git a/java/lib/Compiler/BasicBlockBuilder.h b/java/lib/Compiler/BasicBlockBuilder.h deleted file mode 100644 index ebecf58..0000000 --- a/java/lib/Compiler/BasicBlockBuilder.h +++ /dev/null
@@ -1,195 +0,0 @@ -//===-- BasicBlockBuilder.h - Java bytecode BasicBlock builder --*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains a BasicBlock builder that creates a LLVM -// BasicBlocks from Java bytecode. It also keeps track of the java -// bytecode indices that bound each basic block. -// -//===----------------------------------------------------------------------===// - -#include <llvm/Java/BytecodeParser.h> -#include <llvm/Java/ClassFile.h> -#include <llvm/ADT/STLExtras.h> -#include <llvm/ADT/StringExtras.h> -#include <llvm/Instructions.h> -#include <map> - -namespace llvm { namespace Java { - - class BasicBlockBuilder : public BytecodeParser<BasicBlockBuilder> { - Function* function_; - typedef std::map<unsigned, BasicBlock*> BC2BBMap; - BC2BBMap bc2bbMap_; - typedef std::map<BasicBlock*, std::pair<unsigned,unsigned> > BB2BCMap; - BB2BCMap bb2bcMap_; - - BasicBlock* getOrCreateBasicBlockAt(unsigned bcI) { - BC2BBMap::iterator it = bc2bbMap_.lower_bound(bcI); - if (it == bc2bbMap_.end() || it->first != bcI) { - bool inserted; - BasicBlock* newBB = new BasicBlock("bc" + utostr(bcI), function_); - tie(it, inserted) = bc2bbMap_.insert(std::make_pair(bcI, newBB)); - assert(inserted && "LLVM basic block multiply defined!"); - } - - return it->second; - } - - public: - BasicBlockBuilder(Function* f, CodeAttribute* c) - : function_(f) { - - // Create the entry block. - BasicBlock* entry = new BasicBlock("entry", function_); - - // Create the block for bytecode 0 (bb0). - BasicBlock* bb = getOrCreateBasicBlockAt(0); - - // Create basic blocks for exception handlers. - const CodeAttribute::Exceptions& exceptions = c->getExceptions(); - for (unsigned i = 0, e = exceptions.size(); i != e; ++i) - getOrCreateBasicBlockAt(exceptions[i]->getHandlerPc()); - - // Parse the bytecode and create basic blocks for all targets of - // control flow instructions. - parse(c->getCode(), 0, c->getCodeSize()); - - // Build the bytecode->basic block map. - for (BC2BBMap::const_iterator i = bc2bbMap_.begin(), e = bc2bbMap_.end(); - i != e; ++i) { - unsigned end = next(i) != e ? next(i)->first : c->getCodeSize(); - bb2bcMap_.insert( - std::make_pair(i->second, std::make_pair(i->first, end))); - } - - assert(function_->getEntryBlock().getName() == "entry"); - assert(bb2bcMap_.find(&function_->getEntryBlock()) == bb2bcMap_.end()); - } - - BasicBlock* getBasicBlock(unsigned bcI) const { - BC2BBMap::const_iterator i = bc2bbMap_.find(bcI); - assert(i != bc2bbMap_.end() && - "No block is mapped to this bytecode index!"); - return i->second; - } - - std::pair<unsigned,unsigned> getBytecodeIndices(BasicBlock* bb) const { - BB2BCMap::const_iterator i = bb2bcMap_.find(bb); - assert(i != bb2bcMap_.end() && - "BasicBlock was not created by this builder!"); - return i->second; - } - - void do_ifeq(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(f); - getOrCreateBasicBlockAt(t); - } - - void do_ifne(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(f); - getOrCreateBasicBlockAt(t); - } - - void do_iflt(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(f); - getOrCreateBasicBlockAt(t); - } - - void do_ifge(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(f); - getOrCreateBasicBlockAt(t); - } - - void do_ifgt(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(f); - getOrCreateBasicBlockAt(t); - } - - void do_ifle(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(f); - getOrCreateBasicBlockAt(t); - } - - void do_if_icmpeq(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(f); - getOrCreateBasicBlockAt(t); - } - - void do_if_icmpne(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(f); - getOrCreateBasicBlockAt(t); - } - - void do_if_icmplt(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(f); - getOrCreateBasicBlockAt(t); - } - - void do_if_icmpgt(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(f); - getOrCreateBasicBlockAt(t); - } - - void do_if_icmpge(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(f); - getOrCreateBasicBlockAt(t); - } - - void do_if_icmple(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(f); - getOrCreateBasicBlockAt(t); - } - - void do_if_acmpeq(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(f); - getOrCreateBasicBlockAt(t); - } - - void do_if_acmpne(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(f); - getOrCreateBasicBlockAt(t); - } - - void do_jsr(unsigned t, unsigned r) { - getOrCreateBasicBlockAt(r); - getOrCreateBasicBlockAt(t); - } - - void do_switch_common(unsigned defTarget, const SwitchCases& sw) { - for (unsigned i = 0, e = sw.size(); i != e; ++i) { - unsigned target = sw[i].second; - getOrCreateBasicBlockAt(target); - } - getOrCreateBasicBlockAt(defTarget); - } - - void do_tableswitch(unsigned defTarget, const SwitchCases& sw) { - do_switch_common(defTarget, sw); - } - - void do_lookupswitch(unsigned defTarget, const SwitchCases& sw) { - do_switch_common(defTarget, sw); - } - - void do_goto(unsigned target) { - getOrCreateBasicBlockAt(target); - } - - void do_ifnull(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(f); - getOrCreateBasicBlockAt(t); - } - - void do_ifnonnull(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(f); - getOrCreateBasicBlockAt(t); - } - }; - -} } // namespace llvm::Java
diff --git a/java/lib/Compiler/Compiler.cpp b/java/lib/Compiler/Compiler.cpp deleted file mode 100644 index a5aa90a..0000000 --- a/java/lib/Compiler/Compiler.cpp +++ /dev/null
@@ -1,1278 +0,0 @@ -//===-- Compiler.cpp - Java bytecode compiler -------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains Java bytecode to LLVM bytecode compiler. -// -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "javacompiler" - -#include <llvm/Java/Compiler.h> -#include "BasicBlockBuilder.h" -#include "Locals.h" -#include "OperandStack.h" -#include "Resolver.h" -#include <llvm/Java/Bytecode.h> -#include <llvm/Java/BytecodeParser.h> -#include <llvm/Java/ClassFile.h> -#include <llvm/Constants.h> -#include <llvm/DerivedTypes.h> -#include <llvm/Value.h> -#include <llvm/Type.h> -#include <llvm/ADT/STLExtras.h> -#include <llvm/ADT/SetVector.h> -#include <llvm/ADT/StringExtras.h> -#include <llvm/Support/CFG.h> -#include <llvm/Support/Debug.h> -#include <iostream> -#include <list> -#include <vector> - -using namespace llvm; -using namespace llvm::Java; - -namespace llvm { namespace Java { namespace { - - const std::string TMP("tmp"); - - llvm::Constant* ONE = ConstantSInt::get(Type::IntTy, 1); - llvm::Constant* ZERO = ConstantSInt::get(Type::IntTy, 0); - llvm::Constant* MINUS_ONE = ConstantSInt::get(Type::IntTy, -1); - - llvm::Constant* INT_SHIFT_MASK = ConstantUInt::get(Type::UByteTy, 0x1f); - llvm::Constant* LONG_SHIFT_MASK = ConstantUInt::get(Type::UByteTy, 0x3f); - - class Compiler : public BytecodeParser<Compiler> { - Module* module_; - std::auto_ptr<Resolver> resolver_; - GlobalVariable* JNIEnvPtr_; - const VMClass* class_; - std::auto_ptr<BasicBlockBuilder> bbBuilder_; - std::list<BasicBlock*> bbWorkList_; - typedef std::map<BasicBlock*, unsigned> OpStackDepthMap; - OpStackDepthMap opStackDepthMap_; - typedef std::map<std::string, GlobalVariable*> StringMap; - StringMap stringMap_; - BasicBlock* currentBB_; - Locals locals_; - OperandStack opStack_; - Function *getClassRecord_, *setClassRecord_, *throw_, *isInstanceOf_, - *memcpy_, *memset_; - std::vector<llvm::Constant*> classInitializers_; - - SetVector<const VMMethod*> toCompileMethods_; - - public: - Compiler(Module* m) - : module_(m), - resolver_(new Resolver(module_)), - locals_(resolver_.get(), 0), - opStack_(resolver_.get(), 0) { - Type* JNIEnvTy = OpaqueType::get(); - module_->addTypeName("JNIEnv", JNIEnvTy); - JNIEnvPtr_ = new GlobalVariable(JNIEnvTy, - true, - GlobalVariable::ExternalLinkage, - NULL, - "llvm_java_JNIEnv", - module_); - const Type* classRecordPtrType = resolver_->getClassRecordPtrType(); - const Type* objectBaseType = resolver_->getObjectBaseType(); - - getClassRecord_ = module_->getOrInsertFunction( - "llvm_java_get_class_record", classRecordPtrType, - objectBaseType, NULL); - setClassRecord_ = module_->getOrInsertFunction( - "llvm_java_set_class_record", Type::VoidTy, - objectBaseType, classRecordPtrType, NULL); - throw_ = module_->getOrInsertFunction( - "llvm_java_throw", Type::IntTy, - objectBaseType, NULL); - isInstanceOf_ = module_->getOrInsertFunction( - "llvm_java_is_instance_of", Type::IntTy, - objectBaseType, classRecordPtrType, NULL); - memcpy_ = module_->getOrInsertFunction( - "llvm.memcpy", Type::VoidTy, - PointerType::get(Type::SByteTy), - PointerType::get(Type::SByteTy), - Type::ULongTy, Type::UIntTy, NULL); - memset_ = module_->getOrInsertFunction( - "llvm.memset", Type::VoidTy, - PointerType::get(Type::SByteTy), - Type::UByteTy, Type::ULongTy, Type::UIntTy, NULL); - } - - private: - void push(Value* value) { - opStack_.push(value, currentBB_); - } - - Value* pop(const Type* type) { - return opStack_.pop(type, currentBB_); - } - - /// Schedule a method for compilation. Returns true if this is the - /// first time this function was scheduled. - bool scheduleMethod(const VMMethod* method) { - if (toCompileMethods_.insert(method)) { - DEBUG(std::cerr << "Scheduling function: " - << method->getFunction()->getName() << " for compilation\n"); - return true; - } - return false; - } - - template <typename InsertionPointTy> - void initializeString(Value* globalString, - const std::string& str, - InsertionPointTy* ip) { - // Create a new byte[] object and initialize it with the - // contents of this string constant. - Value* count = ConstantUInt::get(Type::UIntTy, str.size()); - Value* arrayRef = allocateArray(resolver_->getClass("[B"), count, ip); - // Copy string data. - std::vector<Value*> indices; - indices.reserve(3); - indices.push_back(ConstantUInt::get(Type::UIntTy, 0)); - indices.push_back(ConstantUInt::get(Type::UIntTy, 2)); - indices.push_back(ConstantUInt::get(Type::UIntTy, 0)); - Value* arrayData = new GetElementPtrInst(arrayRef, indices, TMP, ip); - llvm::Constant* init = ConstantArray::get(str); - GlobalVariable* chars = new GlobalVariable( - init->getType(), - true, - GlobalVariable::InternalLinkage, - init, - str + ".str", - module_); - - std::vector<Value*> params; - params.reserve(4); - params.clear(); - params.push_back(arrayData); - params.push_back(ConstantExpr::getPtrPtrFromArrayPtr(chars)); - params.push_back(new CastInst(count, Type::ULongTy, TMP, ip)); - params.push_back(ConstantUInt::get(Type::UIntTy, 0)); - new CallInst(memcpy_, params, "", ip); - - // Get class information for java/lang/String. - const VMClass* clazz = resolver_->getClass("java/lang/String"); - emitClassInitializers(clazz); - - // Install the class record. - Value* objBase = - new CastInst(globalString, resolver_->getObjectBaseType(), TMP, ip); - const Type* classRecordPtrType = resolver_->getClassRecordPtrType(); - Value* classRecord = - new CastInst(clazz->getClassRecord(), classRecordPtrType, TMP, ip); - new CallInst(setClassRecord_, objBase, classRecord, "", ip); - - // Initialize it: call java/lang/String/<init>(byte[],int) - const VMMethod* method = clazz->getMethod("<init>([BI)V"); - - params.reserve(3); - params.clear(); - params.push_back(objBase); - params.push_back( - new CastInst(arrayRef, resolver_->getObjectBaseType(), TMP, ip)); - params.push_back(ConstantSInt::get(Type::IntTy, 0)); - new CallInst(method->getFunction(), params, "", ip); - } - - /// Returns the type of the Java string descriptor for JNI. - const Type* getJNIType(const std::string& descr) { - unsigned i = 0; - return getJNITypeHelper(descr, i); - } - - const Type* getJNITypeHelper(const std::string& descr, unsigned& i) { - assert(i < descr.size()); - switch (descr[i++]) { - case 'B': return Type::SByteTy; - case 'C': return Type::UShortTy; - case 'D': return Type::DoubleTy; - case 'F': return Type::FloatTy; - case 'I': return Type::IntTy; - case 'J': return Type::LongTy; - case 'S': return Type::ShortTy; - case 'Z': return Type::BoolTy; - case 'V': return Type::VoidTy; - // Both array and object types are pointers to llvm_object_base - case 'L': { - unsigned e = descr.find(';', i); - i = e + 1; - return resolver_->getObjectBaseType(); - } - case '[': - // Skip '['s. - if (descr[i] == '[') - do { ++i; } while (descr[i] == '['); - // Consume the element type - getJNITypeHelper(descr, i); - return resolver_->getObjectBaseType(); - case '(': { - std::vector<const Type*> params; - // JNIEnv* - params.push_back(JNIEnvPtr_->getType()); - params.push_back(resolver_->getObjectBaseType()); - while (descr[i] != ')') - params.push_back(getJNITypeHelper(descr, i)); - return FunctionType::get(getJNITypeHelper(descr, ++i), params, false); - } - // FIXME: Throw something - default: assert(0 && "Cannot parse type descriptor!"); - } - return 0; // not reached - } - - std::string getMangledString(const std::string& str) { - std::string mangledStr; - - for (unsigned i = 0, e = str.size(); i != e; ++i) { - if (str[i] == '/') - mangledStr += '_'; - else if (str[i] == '_') - mangledStr += "_1"; - else if (str[i] == ';') - mangledStr += "_2"; - else if (str[i] == '[') - mangledStr += "_3"; - else - mangledStr += str[i]; - } - return mangledStr; - } - - /// Compiles the passed method only (it does not compile any - /// callers or methods of objects it creates). - void compileMethodOnly(const VMMethod* method) { - class_ = method->getParent(); - - Function* function = method->getFunction(); - if (!function->empty()) { - DEBUG(std::cerr << "Function: " << function->getName() - << " is already compiled!\n"); - return; - } - - if (method->isNative()) { - DEBUG(std::cerr << "Adding stub for natively implemented method: " - << function->getName() << '\n'); - const FunctionType* jniFuncTy = - cast<FunctionType>(getJNIType(method->getDescriptor())); - - std::string funcName = - "Java_" + - getMangledString(class_->getName()) + '_' + - getMangledString(method->getName()); - if (class_->getClassFile()->isNativeMethodOverloaded(*method->getMethod())) { - // We need to add two underscores and a mangled argument signature - funcName += "__"; - const std::string descr = method->getDescriptor(); - funcName += getMangledString( - std::string(descr.begin() + descr.find('(') + 1, - descr.begin() + descr.find(')'))); - } - - Function* jniFunction = - module_->getOrInsertFunction(funcName, jniFuncTy); - - BasicBlock* bb = new BasicBlock("entry", function); - std::vector<Value*> params; - params.push_back(JNIEnvPtr_); - if (method->isStatic()) - params.push_back( - new CastInst(method->getParent()->getClassRecord(), - resolver_->getObjectBaseType(), TMP, bb)); - for (Function::arg_iterator A = function->arg_begin(), - E = function->arg_end(); A != E; ++A) { - params.push_back( - new CastInst(A, jniFuncTy->getParamType(params.size()), TMP, bb)); - } - Value* result = new CallInst(jniFunction, params, "", bb); - if (result->getType() != Type::VoidTy) - result = new CastInst(result, function->getReturnType(), TMP,bb); - new ReturnInst(result, bb); - - return; - } - - assert (!method->isAbstract() && "Trying to compile an abstract method!"); - - // HACK: skip most of the class libraries. - const std::string& funcName = function->getName(); - if ((funcName.find("java/") == 0 && - funcName.find("java/lang/Object") != 0 && - (funcName.find("java/lang/Throwable") != 0 || - funcName.find("java/lang/Throwable$StaticData/<cl") == 0) && - funcName.find("java/lang/Exception") != 0 && - funcName.find("java/lang/IllegalArgumentException") != 0 && - funcName.find("java/lang/IllegalStateException") != 0 && - funcName.find("java/lang/IndexOutOfBoundsException") != 0 && - funcName.find("java/lang/RuntimeException") != 0 && - (funcName.find("java/lang/Math") != 0 || - funcName.find("java/lang/Math/<cl") == 0) && - funcName.find("java/lang/Number") != 0 && - funcName.find("java/lang/Byte") != 0 && - funcName.find("java/lang/Float") != 0 && - funcName.find("java/lang/Integer") != 0 && - funcName.find("java/lang/Long") != 0 && - funcName.find("java/lang/Short") != 0 && - (funcName.find("java/lang/String") != 0 || - funcName.find("java/lang/String/<cl") == 0) && - funcName.find("java/lang/StringBuffer") != 0 && - (funcName.find("java/lang/System") != 0 || - funcName.find("java/lang/System/loadLibrary") == 0) && - funcName.find("java/lang/VMSystem") != 0 && - (funcName.find("java/util/") != 0 || - funcName.find("java/util/Locale/<cl") == 0 || - funcName.find("java/util/ResourceBundle/<cl") == 0 || - funcName.find("java/util/Calendar/<cl") == 0) || - funcName.find("java/util/PropertyPermission/<cl") == 0) || - (funcName.find("gnu/") == 0)) { - DEBUG(std::cerr << "Skipping compilation of method: " - << funcName << '\n'); - return; - } - - DEBUG(std::cerr << "Compiling method: " << funcName << '\n'); - - Java::CodeAttribute* codeAttr = method->getMethod()->getCodeAttribute(); - - opStackDepthMap_.clear(); - bbBuilder_.reset(new BasicBlockBuilder(function, codeAttr)); - - // Put arguments into locals. - locals_ = Locals(resolver_.get(), codeAttr->getMaxLocals()); - - unsigned index = 0; - for (Function::arg_iterator a = function->arg_begin(), - ae = function->arg_end(); a != ae; ++a) { - locals_.store(index, a, &function->getEntryBlock()); - index += resolver_->isTwoSlotType(a->getType()) ? 2 : 1; - } - - BasicBlock* bb0 = bbBuilder_->getBasicBlock(0); - - // For bb0 the operand stack is empty and the locals contain the - // arguments to the function. - // - // NOTE: We create an operand stack one size too big because we - // push extra values on the stack to simplify code generation - // (see implementation of ifne). - opStack_ = OperandStack(resolver_.get(), codeAttr->getMaxStack()+2); - opStackDepthMap_.insert(std::make_pair(bb0, 0)); - - // Insert bb0 in the work list. - bbWorkList_.push_back(bb0); - - // Process the work list until we compile the whole function. - while (!bbWorkList_.empty()) { - currentBB_ = bbWorkList_.front(); - bbWorkList_.pop_front(); - - OpStackDepthMap::iterator opStackDepth = - opStackDepthMap_.find(currentBB_); - assert(opStackDepth != opStackDepthMap_.end() && - "Unknown operand stack depth for basic block in work list!"); - - opStack_.setDepth(opStackDepth->second); - - unsigned start, end; - tie(start, end) = bbBuilder_->getBytecodeIndices(currentBB_); - - // Compile this basic block. - parse(codeAttr->getCode(), start, end); - - // If this basic block does not have a terminator, it should - // have an unconditional branch to the next basic block - // (fallthrough). - if (!currentBB_->getTerminator()) - new BranchInst(bbBuilder_->getBasicBlock(end), currentBB_); - - // For each successor of this basic block we can compute its - // entry operand stack depth. We do so, and add it to the work - // list. If a successor already has an entry operand stack and - // locals we assume the computation was correct and do not add - // it to the work list. - for (succ_iterator - SI = succ_begin(currentBB_), SE = succ_end(currentBB_); - SI != SE; ++SI) { - BasicBlock* Succ = *SI; - OpStackDepthMap::iterator succOpStackDepth = - opStackDepthMap_.lower_bound(Succ); - if (succOpStackDepth == opStackDepthMap_.end() || - succOpStackDepth->first != Succ) { - opStackDepthMap_.insert(succOpStackDepth, - std::make_pair(Succ, opStack_.getDepth())); - bbWorkList_.push_back(Succ); - } - } - } - - // Add an unconditional branch from the entry block to bb0. - new BranchInst(bb0, &function->getEntryBlock()); - - // FIXME: remove empty basic blocks (we have empty basic blocks - // because of our lack of exception support). - for (Function::iterator bb = function->begin(), be = function->end(); - bb != be; ) - if (bb->empty()) - bb = function->getBasicBlockList().erase(bb); - else - ++bb; - - DEBUG(std::cerr << "Finished compilation of method: "<< funcName << '\n'); - // DEBUG(function->dump()); - } - - /// Emits static initializers for this class if not done already. - void emitClassInitializers(const VMClass* clazz) { - static SetVector<const VMClass*> toInitClasses; - - // If this is a primitive class we are done. - if (clazz->isPrimitive()) - return; - - // If this class is already initialized, we are done. - if (!toInitClasses.insert(clazz)) - return; - - // If this class has a super class, initialize that first. - if (const VMClass* superClass = clazz->getSuperClass()) - emitClassInitializers(superClass); - - // If this class is an array, initialize its component class now. - if (const VMClass* componentClass = clazz->getComponentClass()) - emitClassInitializers(componentClass); - - // Schedule all its dynamically bound non abstract methods for - // compilation. - for (unsigned i = 0, e = clazz->getNumDynamicMethods(); i != e; ++i) { - const VMMethod* method = clazz->getDynamicMethod(i); - if (!method->isAbstract()) - scheduleMethod(method); - } - - // Schedule all its statically bound non abstract methods for - // compilation. - for (unsigned i = 0, e = clazz->getNumStaticMethods(); i != e; ++i) { - const VMMethod* method = clazz->getStaticMethod(i); - if (!method->isAbstract()) - scheduleMethod(method); - } - - // If this class has a constant pool (was loaded from a - // classfile), create constant strings for it. - if (const ClassFile* classfile = clazz->getClassFile()) { - Function* stringConstructors = module_->getOrInsertFunction( - clazz->getName() + "<strinit>", - FunctionType::get(Type::VoidTy, std::vector<const Type*>(), false)); - Instruction* I = - new ReturnInst(NULL, new BasicBlock("entry", stringConstructors)); - for (unsigned i = 0, e = classfile->getNumConstants(); i != e; ++i) - if (ConstantString* s = dynamic_cast<ConstantString*>(classfile->getConstant(i))) - initializeString(clazz->getConstant(i), s->getValue()->str(), I); - - // Insert string constructors method in class initializers array. - classInitializers_.push_back(stringConstructors); - - // Call its class initialization method if it exists. - if (const VMMethod* method = clazz->getMethod("<clinit>()V")) - classInitializers_.push_back(method->getFunction()); - } - } - - public: - /// Compiles the specified method given a <class,method> - /// descriptor and the transitive closure of all methods - /// (possibly) called by it. - const VMMethod* compileMethod(const std::string& className, - const std::string& methodDesc) { - // Load the class. - const VMClass* clazz = resolver_->getClass(className); - emitClassInitializers(clazz); - - // Find the method. - const VMMethod* method = clazz->getMethod(methodDesc); - // Compile the transitive closure of methods called by this method. - for (unsigned i = 0; i != toCompileMethods_.size(); ++i) { - const VMMethod* m = toCompileMethods_[i]; - compileMethodOnly(m); - DEBUG(std::cerr << i+1 << '/' << toCompileMethods_.size() - << " functions compiled\n"); - } - - // Null terminate the static initializers array and add the - // global to the module. - Type* classInitializerType = PointerType::get( - FunctionType::get(Type::VoidTy, std::vector<const Type*>(), false)); - classInitializers_.push_back( - llvm::Constant::getNullValue(classInitializerType)); - - ArrayType* classInitializersType = - ArrayType::get(classInitializerType, classInitializers_.size()); - new GlobalVariable(classInitializersType, - true, - GlobalVariable::ExternalLinkage, - ConstantArray::get(classInitializersType, - classInitializers_), - "llvm_java_class_initializers", - module_); - - // Emit the array of all class records. - resolver_->emitClassRecordsArray(); - - return method; - } - - void do_aconst_null() { - push(llvm::Constant::getNullValue(resolver_->getObjectBaseType())); - } - - void do_iconst(int value) { - push(ConstantSInt::get(Type::IntTy, value)); - } - - void do_lconst(long long value) { - push(ConstantSInt::get(Type::LongTy, value)); - } - - void do_fconst(float value) { - push(ConstantFP::get(Type::FloatTy, value)); - } - - void do_dconst(double value) { - push(ConstantFP::get(Type::DoubleTy, value)); - } - - void do_ldc(unsigned index) { - llvm::Constant* c = class_->getConstant(index); - assert(c && "Java constant not handled!"); - push(c); - } - - void do_ldc2(unsigned index) { - do_ldc(index); - } - - void do_iload(unsigned index) { do_load_common(index, Type::IntTy); } - void do_lload(unsigned index) { do_load_common(index, Type::LongTy); } - void do_fload(unsigned index) { do_load_common(index, Type::FloatTy); } - void do_dload(unsigned index) { do_load_common(index, Type::DoubleTy); } - void do_aload(unsigned index) { do_load_common(index, resolver_->getObjectBaseType()); } - - void do_load_common(unsigned index, const Type* type) { - Value* val = locals_.load(index, type, currentBB_); - push(val); - } - - void do_iaload() { do_aload_common("[I"); } - void do_laload() { do_aload_common("[J"); } - void do_faload() { do_aload_common("[F"); } - void do_daload() { do_aload_common("[D"); } - void do_aaload() { do_aload_common("[Ljava/lang/Object;"); } - void do_baload() { do_aload_common("[B"); } - void do_caload() { do_aload_common("[C"); } - void do_saload() { do_aload_common("[S"); } - - void do_aload_common(const std::string& className) { - const VMClass* arrayClass = resolver_->getClass(className); - assert(arrayClass->isArray() && "Not an array class!"); - Value* index = pop(Type::IntTy); - Value* arrayRef = pop(arrayClass->getType()); - - std::vector<Value*> indices; - indices.reserve(3); - indices.push_back(ConstantUInt::get(Type::UIntTy, 0)); - indices.push_back(ConstantUInt::get(Type::UIntTy, 2)); - indices.push_back(index); - Value* elementPtr = - new GetElementPtrInst(arrayRef, indices, TMP, currentBB_); - Value* result = new LoadInst(elementPtr, TMP, currentBB_); - push(result); - } - - void do_istore(unsigned index) { do_store_common(index, Type::IntTy); } - void do_lstore(unsigned index) { do_store_common(index, Type::LongTy); } - void do_fstore(unsigned index) { do_store_common(index, Type::FloatTy); } - void do_dstore(unsigned index) { do_store_common(index, Type::DoubleTy); } - void do_astore(unsigned index) { do_store_common(index, resolver_->getObjectBaseType()); } - - void do_store_common(unsigned index, const Type* type) { - Value* val = pop(type); - locals_.store(index, val, currentBB_); - } - - void do_iastore() { do_astore_common("[I"); } - void do_lastore() { do_astore_common("[J"); } - void do_fastore() { do_astore_common("[F"); } - void do_dastore() { do_astore_common("[D"); } - void do_aastore() { do_astore_common("[Ljava/lang/Object;"); } - void do_bastore() { do_astore_common("[B"); } - void do_castore() { do_astore_common("[C"); } - void do_sastore() { do_astore_common("[S"); } - - void do_astore_common(const std::string& className) { - const VMClass* arrayClass = resolver_->getClass(className); - assert(arrayClass->isArray() && "Not an array class!"); - const VMClass* componentClass = arrayClass->getComponentClass(); - Value* value = pop(componentClass->getType()); - Value* index = pop(Type::IntTy); - Value* arrayRef = pop(arrayClass->getType()); - - std::vector<Value*> indices; - indices.reserve(3); - indices.push_back(ConstantUInt::get(Type::UIntTy, 0)); - indices.push_back(ConstantUInt::get(Type::UIntTy, 2)); - indices.push_back(index); - Value* elementPtr = - new GetElementPtrInst(arrayRef, indices, TMP, currentBB_); - - new StoreInst(value, elementPtr, currentBB_); - } - - void do_pop() { - opStack_.do_pop(currentBB_); - } - - void do_pop2() { - opStack_.do_pop2(currentBB_); - } - - void do_dup() { - opStack_.do_dup(currentBB_); - } - - void do_dup_x1() { - opStack_.do_dup_x1(currentBB_); - } - - void do_dup_x2() { - opStack_.do_dup_x2(currentBB_); - } - - void do_dup2() { - opStack_.do_dup2(currentBB_); - } - - void do_dup2_x1() { - opStack_.do_dup2_x1(currentBB_); - } - - void do_dup2_x2() { - opStack_.do_dup2_x2(currentBB_); - } - - void do_swap() { - opStack_.do_swap(currentBB_); - } - - void do_iadd() { do_binary_op_common(Instruction::Add, Type::IntTy); } - void do_ladd() { do_binary_op_common(Instruction::Add, Type::LongTy); } - void do_fadd() { do_binary_op_common(Instruction::Add, Type::FloatTy); } - void do_dadd() { do_binary_op_common(Instruction::Add, Type::DoubleTy); } - - void do_isub() { do_binary_op_common(Instruction::Sub, Type::IntTy); } - void do_lsub() { do_binary_op_common(Instruction::Sub, Type::LongTy); } - void do_fsub() { do_binary_op_common(Instruction::Sub, Type::FloatTy); } - void do_dsub() { do_binary_op_common(Instruction::Sub, Type::DoubleTy); } - - void do_imul() { do_binary_op_common(Instruction::Mul, Type::IntTy); } - void do_lmul() { do_binary_op_common(Instruction::Mul, Type::LongTy); } - void do_fmul() { do_binary_op_common(Instruction::Mul, Type::FloatTy); } - void do_dmul() { do_binary_op_common(Instruction::Mul, Type::DoubleTy); } - - void do_idiv() { do_binary_op_common(Instruction::Div, Type::IntTy); } - void do_ldiv() { do_binary_op_common(Instruction::Div, Type::LongTy); } - void do_fdiv() { do_binary_op_common(Instruction::Div, Type::FloatTy); } - void do_ddiv() { do_binary_op_common(Instruction::Div, Type::DoubleTy); } - - void do_irem() { do_binary_op_common(Instruction::Rem, Type::IntTy); } - void do_lrem() { do_binary_op_common(Instruction::Rem, Type::LongTy); } - void do_frem() { do_binary_op_common(Instruction::Rem, Type::FloatTy); } - void do_drem() { do_binary_op_common(Instruction::Rem, Type::DoubleTy); } - - void do_ineg() { do_neg_common(Type::IntTy); } - void do_lneg() { do_neg_common(Type::LongTy); } - void do_fneg() { do_neg_common(Type::FloatTy); } - void do_dneg() { do_neg_common(Type::DoubleTy); } - - void do_neg_common(const Type* type) { - Value* v1 = pop(type); - Value* r = BinaryOperator::createNeg(v1, TMP, currentBB_); - push(r); - } - - void do_ishl() { do_shift_common(Instruction::Shl, Type::IntTy); } - void do_lshl() { do_shift_common(Instruction::Shl, Type::LongTy); } - void do_ishr() { do_shift_common(Instruction::Shr, Type::IntTy); } - void do_lshr() { do_shift_common(Instruction::Shr, Type::LongTy); } - - void do_iushr() { do_shift_common(Instruction::Shr, Type::UIntTy); } - void do_lushr() { do_shift_common(Instruction::Shr, Type::ULongTy); } - - void do_shift_common(Instruction::OtherOps op, const Type* type) { - llvm::Constant* mask = - type == Type::IntTy ? INT_SHIFT_MASK : LONG_SHIFT_MASK; - Value* a = pop(Type::UByteTy); - a = BinaryOperator::create(Instruction::And, a, mask, TMP, currentBB_); - Value* v = pop(type); - Value* r = new ShiftInst(op, v, a, TMP, currentBB_); - push(r); - } - - void do_iand() { do_binary_op_common(Instruction::And, Type::IntTy); } - void do_land() { do_binary_op_common(Instruction::And, Type::LongTy); } - void do_ior() { do_binary_op_common(Instruction::Or, Type::IntTy); } - void do_lor() { do_binary_op_common(Instruction::Or, Type::LongTy); } - void do_ixor() { do_binary_op_common(Instruction::Xor, Type::IntTy); } - void do_lxor() { do_binary_op_common(Instruction::Xor, Type::LongTy); } - - void do_binary_op_common(Instruction::BinaryOps op, const Type* type) { - Value* v2 = pop(type); - Value* v1 = pop(type); - Value* r = BinaryOperator::create(op, v1, v2, TMP, currentBB_); - push(r); - } - - void do_iinc(unsigned index, int amount) { - Value* v = locals_.load(index, Type::IntTy, currentBB_); - Value* a = ConstantSInt::get(Type::IntTy, amount); - v = BinaryOperator::createAdd(v, a, TMP, currentBB_); - locals_.store(index, v, currentBB_); - } - - void do_i2l() { do_cast_common(Type::IntTy, Type::LongTy); } - void do_i2f() { do_cast_common(Type::IntTy, Type::FloatTy); } - void do_i2d() { do_cast_common(Type::IntTy, Type::DoubleTy); } - void do_l2i() { do_cast_common(Type::LongTy, Type::IntTy); } - void do_l2f() { do_cast_common(Type::LongTy, Type::FloatTy); } - void do_l2d() { do_cast_common(Type::LongTy, Type::DoubleTy); } - void do_f2i() { do_cast_common(Type::FloatTy, Type::IntTy); } - void do_f2l() { do_cast_common(Type::FloatTy, Type::LongTy); } - void do_f2d() { do_cast_common(Type::FloatTy, Type::DoubleTy); } - void do_d2i() { do_cast_common(Type::DoubleTy, Type::IntTy); } - void do_d2l() { do_cast_common(Type::DoubleTy, Type::LongTy); } - void do_d2f() { do_cast_common(Type::DoubleTy, Type::FloatTy); } - void do_i2b() { do_cast_common(Type::IntTy, Type::SByteTy); } - void do_i2c() { do_cast_common(Type::IntTy, Type::UShortTy); } - void do_i2s() { do_cast_common(Type::IntTy, Type::ShortTy); } - - void do_cast_common(const Type* from, const Type* to) { - Value* v1 = pop(from); - push(new CastInst(v1, to, TMP, currentBB_)); - } - - void do_lcmp() { - Value* v2 = pop(Type::LongTy); - Value* v1 = pop(Type::LongTy); - Value* c = BinaryOperator::createSetGT(v1, v2, TMP, currentBB_); - Value* r = new SelectInst(c, ONE, ZERO, TMP, currentBB_); - c = BinaryOperator::createSetLT(v1, v2, TMP, currentBB_); - r = new SelectInst(c, MINUS_ONE, r, TMP, currentBB_); - push(r); - } - - void do_fcmpl() { do_cmp_common(Type::FloatTy, false); } - void do_dcmpl() { do_cmp_common(Type::DoubleTy, false); } - void do_fcmpg() { do_cmp_common(Type::FloatTy, true); } - void do_dcmpg() { do_cmp_common(Type::DoubleTy, true); } - - void do_cmp_common(const Type* type, bool pushOne) { - Value* v2 = pop(type); - Value* v1 = pop(type); - Value* c = BinaryOperator::createSetGT(v1, v2, TMP, currentBB_); - Value* r = new SelectInst(c, ONE, ZERO, TMP, currentBB_); - c = BinaryOperator::createSetLT(v1, v2, TMP, currentBB_); - r = new SelectInst(c, MINUS_ONE, r, TMP, currentBB_); - c = new CallInst(module_->getOrInsertFunction - ("llvm.isunordered", - Type::BoolTy, v1->getType(), v2->getType(), NULL), - v1, v2, TMP, currentBB_); - r = new SelectInst(c, pushOne ? ONE : MINUS_ONE, r, TMP, currentBB_); - push(r); - } - - void do_ifeq(unsigned t, unsigned f) { - do_iconst(0); - do_if_common(Instruction::SetEQ, Type::IntTy, t, f); - } - void do_ifne(unsigned t, unsigned f) { - do_iconst(0); - do_if_common(Instruction::SetNE, Type::IntTy, t, f); - } - void do_iflt(unsigned t, unsigned f) { - do_iconst(0); - do_if_common(Instruction::SetLT, Type::IntTy, t, f); - } - void do_ifge(unsigned t, unsigned f) { - do_iconst(0); - do_if_common(Instruction::SetGE, Type::IntTy, t, f); - } - void do_ifgt(unsigned t, unsigned f) { - do_iconst(0); - do_if_common(Instruction::SetGT, Type::IntTy, t, f); - } - void do_ifle(unsigned t, unsigned f) { - do_iconst(0); - do_if_common(Instruction::SetLE, Type::IntTy, t, f); - } - void do_if_icmpeq(unsigned t, unsigned f) { - do_if_common(Instruction::SetEQ, Type::IntTy, t, f); - } - void do_if_icmpne(unsigned t, unsigned f) { - do_if_common(Instruction::SetNE, Type::IntTy, t, f); - } - void do_if_icmplt(unsigned t, unsigned f) { - do_if_common(Instruction::SetLT, Type::IntTy, t, f); - } - void do_if_icmpge(unsigned t, unsigned f) { - do_if_common(Instruction::SetGE, Type::IntTy, t, f); - } - void do_if_icmpgt(unsigned t, unsigned f) { - do_if_common(Instruction::SetGT, Type::IntTy, t, f); - } - void do_if_icmple(unsigned t, unsigned f) { - do_if_common(Instruction::SetLE, Type::IntTy, t, f); - } - void do_if_acmpeq(unsigned t, unsigned f) { - do_if_common(Instruction::SetEQ, resolver_->getObjectBaseType(), t, f); - } - void do_if_acmpne(unsigned t, unsigned f) { - do_if_common(Instruction::SetNE, resolver_->getObjectBaseType(), t, f); - } - void do_ifnull(unsigned t, unsigned f) { - do_aconst_null(); - do_if_common(Instruction::SetEQ, resolver_->getObjectBaseType(), t, f); - } - void do_ifnonnull(unsigned t, unsigned f) { - do_aconst_null(); - do_if_common(Instruction::SetNE, resolver_->getObjectBaseType(), t, f); - } - - void do_if_common(Instruction::BinaryOps cc, const Type* type, - unsigned t, unsigned f) { - Value* v2 = pop(type); - Value* v1 = pop(type); - Value* c = new SetCondInst(cc, v1, v2, TMP, currentBB_); - new BranchInst(bbBuilder_->getBasicBlock(t), - bbBuilder_->getBasicBlock(f), - c, currentBB_); - } - - void do_goto(unsigned target) { - new BranchInst(bbBuilder_->getBasicBlock(target), currentBB_); - } - - void do_ireturn() { do_return_common(Type::IntTy); } - void do_lreturn() { do_return_common(Type::LongTy); } - void do_freturn() { do_return_common(Type::FloatTy); } - void do_dreturn() { do_return_common(Type::DoubleTy); } - void do_areturn() { do_return_common(resolver_->getObjectBaseType()); } - - void do_return_common(const Type* type) { - Value* r = pop(type); - const Type* retTy = currentBB_->getParent()->getReturnType(); - if (retTy != r->getType()) - r = new CastInst(r, retTy, TMP, currentBB_); - new ReturnInst(r, currentBB_); - } - - void do_return() { - new ReturnInst(NULL, currentBB_); - } - - void do_jsr(unsigned target, unsigned retAddress) { - // FIXME: this is currently a noop. - push(llvm::Constant::getNullValue(Type::IntTy)); - } - - void do_ret(unsigned index) { - // FIXME: this is currently a noop. - } - - void do_tableswitch(unsigned defTarget, const SwitchCases& sw) { - do_switch_common(defTarget, sw); - } - - void do_lookupswitch(unsigned defTarget, const SwitchCases& sw) { - do_switch_common(defTarget, sw); - } - - void do_switch_common(unsigned defTarget, const SwitchCases& sw) { - Value* v = pop(Type::IntTy); - SwitchInst* in = - new SwitchInst(v, bbBuilder_->getBasicBlock(defTarget), sw.size(), - currentBB_); - for (unsigned i = 0, e = sw.size(); i != e; ++i) - in->addCase(ConstantSInt::get(Type::IntTy, sw[i].first), - bbBuilder_->getBasicBlock(sw[i].second)); - } - - void do_getstatic(unsigned index) { - const VMField* field = class_->getField(index); - emitClassInitializers(field->getParent()); - - Value* v = new LoadInst(field->getGlobal(), TMP, currentBB_); - push(v); - } - - void do_putstatic(unsigned index) { - const VMField* field = class_->getField(index); - emitClassInitializers(field->getParent()); - - Value* v = pop(field->getClass()->getType()); - new StoreInst(v, field->getGlobal(), currentBB_); - } - - void do_getfield(unsigned index) { - const VMField* field = class_->getField(index); - - Value* p = pop(field->getParent()->getType()); - std::vector<Value*> indices(2); - indices[0] = ConstantUInt::get(Type::UIntTy, 0); - indices[1] = ConstantUInt::get(Type::UIntTy, field->getMemberIndex()); - Value* fieldPtr = - new GetElementPtrInst(p, indices, field->getName()+'*', currentBB_); - Value* v = new LoadInst(fieldPtr, field->getName(), currentBB_); - push(v); - } - - void do_putfield(unsigned index) { - const VMField* field = class_->getField(index); - - Value* v = pop(field->getClass()->getType()); - Value* p = pop(field->getParent()->getType()); - std::vector<Value*> indices(2); - indices[0] = ConstantUInt::get(Type::UIntTy, 0); - indices[1] = ConstantUInt::get(Type::UIntTy, field->getMemberIndex()); - Value* fieldPtr = - new GetElementPtrInst(p, indices, field->getName()+'*', currentBB_); - new StoreInst(v, fieldPtr, currentBB_); - } - - void makeCall(Value* fun, const std::vector<Value*> params) { - const PointerType* funPtrTy = cast<PointerType>(fun->getType()); - const FunctionType* funTy = - cast<FunctionType>(funPtrTy->getElementType()); - - if (funTy->getReturnType() == Type::VoidTy) - new CallInst(fun, params, "", currentBB_); - else { - Value* r = new CallInst(fun, params, TMP, currentBB_); - push(r); - } - } - - std::vector<Value*> getParams(const FunctionType* funTy) { - unsigned numParams = funTy->getNumParams(); - std::vector<Value*> params(numParams); - while (numParams--) - params[numParams] = pop(funTy->getParamType(numParams)); - - return params; - } - - void do_invokevirtual(unsigned index) { - const VMMethod* method = class_->getMethod(index); - const VMClass* clazz = method->getParent(); - - Function* function = method->getFunction(); - std::vector<Value*> params(getParams(function->getFunctionType())); - - Value* objRef = params.front(); - objRef = new CastInst(objRef, clazz->getType(), "this", currentBB_); - Value* objBase = - new CastInst(objRef, resolver_->getObjectBaseType(), TMP, currentBB_); - Value* classRecord = - new CallInst(getClassRecord_, objBase, TMP, currentBB_); - classRecord = new CastInst(classRecord, - clazz->getClassRecord()->getType(), - clazz->getName() + ".classRecord", currentBB_); - std::vector<Value*> indices(1, ConstantUInt::get(Type::UIntTy, 0)); - assert(method->getMethodIndex() != -1 && - "Method index not found for dynamically bound method!"); - indices.push_back( - ConstantUInt::get(Type::UIntTy, method->getMethodIndex()+1)); - Value* funPtr = - new GetElementPtrInst(classRecord, indices, TMP, currentBB_); - Value* fun = new LoadInst(funPtr, function->getName(), currentBB_); - - makeCall(fun, params); - } - - void do_invokespecial(unsigned index) { - const VMMethod* method = class_->getMethod(index); - Function* function = method->getFunction(); - makeCall(function, getParams(function->getFunctionType())); - } - - void do_invokestatic(unsigned index) { - const VMMethod* method = class_->getMethod(index); - emitClassInitializers(method->getParent()); - Function* function = method->getFunction(); - makeCall(function, getParams(function->getFunctionType())); - } - - void do_invokeinterface(unsigned index) { - const VMMethod* method = class_->getMethod(index); - const VMClass* clazz = method->getParent(); - assert(clazz->isInterface() && "Class must be an interface!"); - - Function* function = method->getFunction(); - std::vector<Value*> params(getParams(function->getFunctionType())); - - Value* objRef = params.front(); - objRef = new CastInst(objRef, clazz->getType(), "this", currentBB_); - Value* objBase = - new CastInst(objRef, resolver_->getObjectBaseType(), TMP, currentBB_); - Value* classRecord = - new CallInst(getClassRecord_, objBase, TMP, currentBB_); - classRecord = new CastInst(classRecord, - resolver_->getClassRecordPtrType(), - TMP, currentBB_); - // get the interfaces array of class records - std::vector<Value*> indices(2, ConstantUInt::get(Type::UIntTy, 0)); - indices.push_back(ConstantUInt::get(Type::UIntTy, 4)); - Value* interfaceClassRecords = - new GetElementPtrInst(classRecord, indices, TMP, currentBB_); - interfaceClassRecords = - new LoadInst(interfaceClassRecords, TMP, currentBB_); - // Get the actual interface class record. - indices.clear(); - indices.push_back( - ConstantUInt::get(Type::UIntTy, clazz->getInterfaceIndex())); - Value* interfaceClassRecord = - new GetElementPtrInst(interfaceClassRecords, indices, TMP, currentBB_); - interfaceClassRecord = - new LoadInst(interfaceClassRecord, - clazz->getName() + ".classRecord", currentBB_); - interfaceClassRecord = - new CastInst(interfaceClassRecord, - clazz->getClassRecord()->getType(), TMP, currentBB_); - // Get the function pointer. - assert(method->getMethodIndex() != -1 && - "Method index not found for dynamically bound method!"); - indices.resize(2); - indices[0] = ConstantUInt::get(Type::UIntTy, 0); - indices[1] = ConstantUInt::get(Type::UIntTy, method->getMethodIndex()+1); - Value* funPtr = - new GetElementPtrInst(interfaceClassRecord, indices, TMP, currentBB_); - Value* fun = new LoadInst(funPtr, function->getName(), currentBB_); - - makeCall(fun, params); - } - - template<typename InsertionPointTy> - Value* allocateObject(const VMClass& clazz, InsertionPointTy* ip) { - static std::vector<Value*> params(4); - - Value* objRef = new MallocInst(clazz.getLayoutType(), NULL, TMP, ip); - params[0] = - new CastInst(objRef, PointerType::get(Type::SByteTy), TMP, ip); // dest - params[1] = ConstantUInt::get(Type::UByteTy, 0); // value - params[2] = ConstantExpr::getSizeOf(clazz.getLayoutType()); // size - params[3] = ConstantUInt::get(Type::UIntTy, 0); // alignment - new CallInst(memset_, params, "", ip); - - // Install the class record. - Value* objBase = - new CastInst(objRef, resolver_->getObjectBaseType(), TMP, ip); - const Type* classRecordPtrType = resolver_->getClassRecordPtrType(); - Value* classRecord = - new CastInst(clazz.getClassRecord(), classRecordPtrType, TMP, ip); - new CallInst(setClassRecord_, objBase, classRecord, "", ip); - - return objRef; - } - - void do_new(unsigned index) { - const VMClass* clazz = class_->getClass(index); - emitClassInitializers(clazz); - push(allocateObject(*clazz, currentBB_)); - } - - template <typename InsertionPointTy> - Value* getArrayLengthPtr(Value* arrayRef, InsertionPointTy* ip) const { - std::vector<Value*> indices; - indices.reserve(2); - indices.push_back(ConstantUInt::get(Type::UIntTy, 0)); - indices.push_back(ConstantUInt::get(Type::UIntTy, 1)); - - return new GetElementPtrInst(arrayRef, indices, TMP, ip); - } - - template <typename InsertionPointTy> - Value* getArrayObjectBasePtr(Value* arrayRef, InsertionPointTy* ip) const { - std::vector<Value*> indices; - indices.reserve(2); - indices.push_back(ConstantUInt::get(Type::UIntTy, 0)); - indices.push_back(ConstantUInt::get(Type::UIntTy, 0)); - - return new GetElementPtrInst(arrayRef, indices, TMP, ip); - } - - template<typename InsertionPointTy> - Value* allocateArray(const VMClass* clazz, - Value* count, - InsertionPointTy* ip) { - static std::vector<Value*> params(4); - - assert(clazz->isArray() && "Not an array class!"); - const VMClass* componentClass = clazz->getComponentClass(); - const Type* elementTy = componentClass->getType(); - - // The size of the element. - llvm::Constant* elementSize = - ConstantExpr::getCast(ConstantExpr::getSizeOf(elementTy), Type::UIntTy); - - // The size of the array part of the struct. - Value* size = BinaryOperator::create( - Instruction::Mul, count, elementSize, TMP, ip); - // The size of the rest of the array object. - llvm::Constant* arrayObjectSize = - ConstantExpr::getCast(ConstantExpr::getSizeOf(clazz->getLayoutType()), - Type::UIntTy); - - // Add the array part plus the object part together. - size = BinaryOperator::create( - Instruction::Add, size, arrayObjectSize, TMP, ip); - // Allocate memory for the object. - Value* objRef = new MallocInst(Type::SByteTy, size, TMP, ip); - params[0] = objRef; // dest - params[1] = ConstantUInt::get(Type::UByteTy, 0); // value - params[2] = new CastInst(size, Type::ULongTy, TMP, ip); // size - params[3] = ConstantUInt::get(Type::UIntTy, 0); // alignment - new CallInst(memset_, params, "", ip); - - // Cast back to array type. - objRef = new CastInst(objRef, clazz->getType(), TMP, ip); - - // Store the size. - Value* lengthPtr = getArrayLengthPtr(objRef, ip); - new StoreInst(count, lengthPtr, ip); - - // Install the class record. - Value* objBase = new CastInst(objRef, resolver_->getObjectBaseType(), TMP, ip); - const Type* classRecordPtrType = resolver_->getClassRecordPtrType(); - Value* classRecord = - new CastInst(clazz->getClassRecord(), classRecordPtrType, TMP, ip); - new CallInst(setClassRecord_, objBase, classRecord, "", ip); - - return objRef; - } - - void do_newarray(JType type) { - Value* count = pop(Type::UIntTy); - - const VMClass* clazz = resolver_->getClass(type); - const VMClass* arrayClass = resolver_->getArrayClass(clazz); - emitClassInitializers(arrayClass); - - push(allocateArray(arrayClass, count, currentBB_)); - } - - void do_anewarray(unsigned index) { - Value* count = pop(Type::UIntTy); - - const VMClass* clazz = class_->getClass(index); - const VMClass* arrayClass = resolver_->getArrayClass(clazz); - emitClassInitializers(arrayClass); - - push(allocateArray(arrayClass, count, currentBB_)); - } - - void do_arraylength() { - const VMClass* clazz = resolver_->getClass("[Ljava/lang/Object;"); - Value* arrayRef = pop(clazz->getType()); - Value* lengthPtr = getArrayLengthPtr(arrayRef, currentBB_); - Value* length = new LoadInst(lengthPtr, TMP, currentBB_); - push(length); - } - - void do_athrow() { - Value* objRef = pop(resolver_->getObjectBaseType()); - new CallInst(throw_, objRef, "", currentBB_); - new UnreachableInst(currentBB_); - } - - void do_checkcast(unsigned index) { - const VMClass* clazz = class_->getClass(index); - - Value* objRef = pop(resolver_->getObjectBaseType()); - const Type* classRecordPtrType = resolver_->getClassRecordPtrType(); - Value* classRecord = new CastInst(clazz->getClassRecord(), - classRecordPtrType, TMP, currentBB_); - Value* r = - new CallInst(isInstanceOf_, objRef, classRecord, TMP, currentBB_); - - Value* b = new SetCondInst(Instruction::SetEQ, - r, ConstantSInt::get(Type::IntTy, 1), - TMP, currentBB_); - // FIXME: if b is false we must throw a ClassCast exception - push(objRef); - } - - void do_instanceof(unsigned index) { - const VMClass* clazz = class_->getClass(index); - - Value* objRef = pop(resolver_->getObjectBaseType()); - const Type* classRecordPtrType = resolver_->getClassRecordPtrType(); - Value* classRecord = new CastInst(clazz->getClassRecord(), - classRecordPtrType, TMP, currentBB_); - Value* r = - new CallInst(isInstanceOf_, objRef, classRecord, TMP, currentBB_); - push(r); - } - - void do_monitorenter() { - // FIXME: This is currently a noop. - pop(resolver_->getObjectBaseType()); - } - - void do_monitorexit() { - // FIXME: This is currently a noop. - pop(resolver_->getObjectBaseType()); - } - - void do_multianewarray(unsigned index, unsigned dims) { - assert(0 && "not implemented"); - } - }; - -} } } // namespace llvm::Java:: - -std::auto_ptr<Module> llvm::Java::compile(const std::string& className) -{ - DEBUG(std::cerr << "Compiling class: " << className << '\n'); - - std::auto_ptr<Module> m(new Module(className)); - // Require the Java runtime. - m->addLibrary("jrt"); - - Compiler c(m.get()); - const VMMethod* main = - c.compileMethod(className, "main([Ljava/lang/String;)V"); - - Function* javaMain = m->getOrInsertFunction - ("llvm_java_main", Type::VoidTy, - Type::IntTy, PointerType::get(PointerType::get(Type::SByteTy)), NULL); - - BasicBlock* bb = new BasicBlock("entry", javaMain); - const FunctionType* mainTy = main->getFunction()->getFunctionType(); - new CallInst(main->getFunction(), - // FIXME: Forward correct params from llvm_java_main - llvm::Constant::getNullValue(mainTy->getParamType(0)), - "", - bb); - new ReturnInst(NULL, bb); - - return m; -}
diff --git a/java/lib/Compiler/Locals.cpp b/java/lib/Compiler/Locals.cpp deleted file mode 100644 index 47307c0..0000000 --- a/java/lib/Compiler/Locals.cpp +++ /dev/null
@@ -1,67 +0,0 @@ -//===-- Locals.h - Java locals ----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the abstraction of Java locals. We model the -// locals as an array of lazily created allocas. -// -//===----------------------------------------------------------------------===// - -#include "Locals.h" -#include <llvm/BasicBlock.h> -#include <llvm/DerivedTypes.h> -#include <llvm/Function.h> -#include <llvm/Instructions.h> -#include <llvm/ADT/StringExtras.h> -#include <llvm/Java/Compiler.h> - -using namespace llvm; -using namespace llvm::Java; - -Locals::Locals(const Resolver* resolver, unsigned maxLocals) - : resolver_(resolver), - locals_(maxLocals) -{ - -} - -void Locals::store(unsigned i, Value* value, BasicBlock* insertAtEnd) -{ - const Type* valueTy = value->getType(); - const Type* storageTy = resolver_->getStorageType(valueTy); - if (valueTy != storageTy) - value = new CastInst(value, storageTy, "to-storage-type", insertAtEnd); - - SlotMap& slotMap = locals_[i]; - SlotMap::iterator it = slotMap.find(storageTy); - - if (it == slotMap.end()) { - // Insert the alloca at the end of the entry block. - BasicBlock* entry = &insertAtEnd->getParent()->getEntryBlock(); - AllocaInst* alloca = - new AllocaInst(storageTy, NULL, "local"+utostr(i), entry); - it = slotMap.insert(it, std::make_pair(storageTy, alloca)); - } - - new StoreInst(value, it->second, insertAtEnd); -} - -llvm::Value* Locals::load(unsigned i, const Type* valueTy, - BasicBlock* insertAtEnd) -{ - const Type* storageTy = resolver_->getStorageType(valueTy); - - SlotMap& slotMap = locals_[i]; - SlotMap::iterator it = slotMap.find(storageTy); - - assert(it != slotMap.end() && "Attempt to load a non initialized global!"); - Value* value = new LoadInst(it->second, "load", insertAtEnd); - if (valueTy != storageTy) - value = new CastInst(value, valueTy, "from-storage-type", insertAtEnd); - return value; -}
diff --git a/java/lib/Compiler/Locals.h b/java/lib/Compiler/Locals.h deleted file mode 100644 index 763619d..0000000 --- a/java/lib/Compiler/Locals.h +++ /dev/null
@@ -1,55 +0,0 @@ -//===-- Locals.h - Java locals ----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the abstraction of Java locals. We model the -// locals as an array of lazily created allocas. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_JAVA_LOCALS_H -#define LLVM_JAVA_LOCALS_H - -#include "Resolver.h" -#include <map> -#include <vector> - -namespace llvm { - - class AllocaInst; - class BasicBlock; - class Instruction; - class Type; - class Value; - -} // namespace llvm - -namespace llvm { namespace Java { - - class Locals { - const Resolver* resolver_; - typedef std::map<const Type*, AllocaInst*> SlotMap; - std::vector<SlotMap> locals_; - - public: - Locals(const Resolver* resolver, unsigned maxLocals); - - /// @brief - Stores the value \c value on the \c i'th local - /// variable and appends any instructions to implement this to \c - /// insertAtEnd BasicBlock - void store(unsigned i, Value* value, BasicBlock* insertAtEnd); - - /// @brief - Loads the value of the \c i'th local variable of type - /// \c type and appends any instructions to implement this to \c - /// insertAtEnd BasicBlock - Value* load(unsigned i, const Type* type, BasicBlock* insertAtEnd); - }; - -} } // namespace llvm::Java - -#endif//LLVM_JAVA_LOCALS_H
diff --git a/java/lib/Compiler/Makefile b/java/lib/Compiler/Makefile deleted file mode 100644 index b79e2d8..0000000 --- a/java/lib/Compiler/Makefile +++ /dev/null
@@ -1,15 +0,0 @@ -##===- lib/Compiler/Makefile -------------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## -LEVEL := ../.. - -LIBRARYNAME := LLVMJavaCompiler - -BUILD_ARCHIVE = 1 - -include $(LEVEL)/Makefile.common
diff --git a/java/lib/Compiler/OperandStack.cpp b/java/lib/Compiler/OperandStack.cpp deleted file mode 100644 index 5763d4e..0000000 --- a/java/lib/Compiler/OperandStack.cpp +++ /dev/null
@@ -1,179 +0,0 @@ -//===-- OperandStack.cpp - Java operand stack -----------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the abstraction of a Java operand stack. We -// model the java operand stack as a stack of LLVM allocas. -// -//===----------------------------------------------------------------------===// - -#include "OperandStack.h" -#include <llvm/BasicBlock.h> -#include <llvm/DerivedTypes.h> -#include <llvm/Function.h> -#include <llvm/Instructions.h> -#include <llvm/ADT/StringExtras.h> -#include <llvm/Java/Compiler.h> - -using namespace llvm; -using namespace llvm::Java; - -void OperandStack::copySlots(const SlotMap& src, - SlotMap& dst, - BasicBlock* insertAtEnd) -{ - SlotMap::const_iterator it = src.begin(); - SlotMap::const_iterator end = src.end(); - - for (; it != end; ++it) { - AllocaInst* srcSlot = it->second; - AllocaInst* dstSlot = getOrCreateSlot(dst, it->first, insertAtEnd); - Value* value = new LoadInst(srcSlot, "tmp", insertAtEnd); - new StoreInst(value, dstSlot, insertAtEnd); - } -} - -llvm::AllocaInst* OperandStack::getOrCreateSlot(SlotMap& slotMap, - const Type* type, - BasicBlock* bb) -{ - SlotMap::iterator it = slotMap.find(type); - - if (it == slotMap.end()) { - // Insert the alloca at the beginning of the entry block. - BasicBlock* entry = &bb->getParent()->getEntryBlock(); - AllocaInst* alloca = new AllocaInst(type, NULL, "opStack", entry); - it = slotMap.insert(it, std::make_pair(type, alloca)); - } - - return it->second; -} - -void OperandStack::push(Value* value, BasicBlock* insertAtEnd) -{ - assert(currentDepth_ < stack_.size() && "Pushing to a full stack!"); - const Type* valueTy = value->getType(); -// std::cerr << "PUSH(" << insertAtEnd << "/" -// << insertAtEnd->getParent()->getName() << " " << stack_.size() -// << ") Depth: " << currentDepth_ << " type: " << *valueTy << '\n'; - const Type* storageTy = resolver_->getStorageType(valueTy); - if (valueTy != storageTy) - value = new CastInst(value, storageTy, "to-storage-type", insertAtEnd); - - SlotMap& slotMap = stack_[currentDepth_]; - AllocaInst* slot = getOrCreateSlot(slotMap, storageTy, insertAtEnd); - new StoreInst(value, slot, insertAtEnd); - currentDepth_ += 1 + resolver_->isTwoSlotType(storageTy); - assert(currentDepth_ < stack_.size() && "Pushed more than max stack depth!"); -} - -llvm::Value* OperandStack::pop(const Type* valueTy, BasicBlock* insertAtEnd) -{ - const Type* storageTy = resolver_->getStorageType(valueTy); - - assert(currentDepth_ != 0 && "Popping from an empty stack!"); - currentDepth_ -= 1 + resolver_->isTwoSlotType(storageTy); -// std::cerr << "POP(" << insertAtEnd->getName() << "/" -// << insertAtEnd->getParent()->getName() << " " << stack_.size() -// << ") Depth: " << currentDepth_ << " type: " << *valueTy << '\n'; - - SlotMap& slotMap = stack_[currentDepth_]; - SlotMap::iterator it = slotMap.find(storageTy); - - assert(it != slotMap.end() && "Type mismatch on operand stack!"); - Value* value = new LoadInst(it->second, "pop", insertAtEnd); - if (valueTy != storageTy) - value = new CastInst(value, valueTy, "from-storage-type", insertAtEnd); - return value; -} - -/// ..., value -> ... -void OperandStack::do_pop(BasicBlock* insertAtEnd) -{ - assert(currentDepth_ != 0 && "Popping from an empty stack!"); - --currentDepth_; -} - -/// ..., value2, value1 -> ... -/// ..., value -> ... -void OperandStack::do_pop2(BasicBlock* insertAtEnd) -{ - do_pop(insertAtEnd); - do_pop(insertAtEnd); -} - -/// ..., value -> ..., value, value -void OperandStack::do_dup(BasicBlock* insertAtEnd) -{ - assert(currentDepth_ != 0 && "Popping from an empty stack!"); - copySlots(stack_[currentDepth_-1], stack_[currentDepth_], insertAtEnd); - ++currentDepth_; -} - -/// ..., value2, value1 -> ..., value1, value2, value1 -void OperandStack::do_dup_x1(BasicBlock* insertAtEnd) -{ - copySlots(stack_[currentDepth_-1], stack_[currentDepth_], insertAtEnd); - copySlots(stack_[currentDepth_-2], stack_[currentDepth_-1], insertAtEnd); - copySlots(stack_[currentDepth_], stack_[currentDepth_-2], insertAtEnd); - ++currentDepth_; -} - -/// ..., value3, value2, value1 -> ..., value1, value3, value2, value1 -/// ..., value2, value1 -> ..., value1, value2, value1 -void OperandStack::do_dup_x2(BasicBlock* insertAtEnd) -{ - copySlots(stack_[currentDepth_-1], stack_[currentDepth_], insertAtEnd); - copySlots(stack_[currentDepth_-2], stack_[currentDepth_-1], insertAtEnd); - copySlots(stack_[currentDepth_-3], stack_[currentDepth_-2], insertAtEnd); - copySlots(stack_[currentDepth_], stack_[currentDepth_-3], insertAtEnd); - ++currentDepth_; -} - -/// ..., value2, value1 -> ..., value2, value1, value2, value1 -void OperandStack::do_dup2(BasicBlock* insertAtEnd) -{ - copySlots(stack_[currentDepth_-2], stack_[currentDepth_], insertAtEnd); - copySlots(stack_[currentDepth_-1], stack_[currentDepth_+1], insertAtEnd); - currentDepth_ += 2; -} - -/// ..., value3, value2, value1 -> ..., value2, value1, value3, value2, value1 -/// ..., value2, value1 -> ..., value1, value2, value1 -void OperandStack::do_dup2_x1(BasicBlock* insertAtEnd) -{ - copySlots(stack_[currentDepth_-1], stack_[currentDepth_+1], insertAtEnd); - copySlots(stack_[currentDepth_-2], stack_[currentDepth_], insertAtEnd); - copySlots(stack_[currentDepth_-3], stack_[currentDepth_-1], insertAtEnd); - copySlots(stack_[currentDepth_+1], stack_[currentDepth_-2], insertAtEnd); - copySlots(stack_[currentDepth_], stack_[currentDepth_-3], insertAtEnd); - currentDepth_ += 2; -} - -/// ..., value4, value3, value2, value1 -> ..., value2, value1, value4, value3, value2, value1 -/// ..., value3, value2, value1 -> ..., value1, value3, value2, value1 -/// ..., value3, value2, value1 -> ..., value2, value1, value3, value2, value1 -/// ..., value2, value1 -> ..., value1, value2, value1 -void OperandStack::do_dup2_x2(BasicBlock* insertAtEnd) -{ - copySlots(stack_[currentDepth_-1], stack_[currentDepth_+1], insertAtEnd); - copySlots(stack_[currentDepth_-2], stack_[currentDepth_], insertAtEnd); - copySlots(stack_[currentDepth_-3], stack_[currentDepth_-1], insertAtEnd); - copySlots(stack_[currentDepth_-4], stack_[currentDepth_-2], insertAtEnd); - copySlots(stack_[currentDepth_+1], stack_[currentDepth_-3], insertAtEnd); - copySlots(stack_[currentDepth_], stack_[currentDepth_-4], insertAtEnd); - currentDepth_ += 2; -} - -void OperandStack::do_swap(BasicBlock* insertAtEnd) -{ - SlotMap tmp; - copySlots(stack_[currentDepth_-1], tmp, insertAtEnd); - copySlots(stack_[currentDepth_-2], stack_[currentDepth_-1], insertAtEnd); - copySlots(tmp, stack_[currentDepth_-2], insertAtEnd); -}
diff --git a/java/lib/Compiler/OperandStack.h b/java/lib/Compiler/OperandStack.h deleted file mode 100644 index b987d36..0000000 --- a/java/lib/Compiler/OperandStack.h +++ /dev/null
@@ -1,82 +0,0 @@ -//===-- OperandStack.h - Java operand stack ---------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the abstraction of a Java operand stack. We -// model the java operand stack as a stack of LLVM allocas. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_JAVA_OPERANDSTACK_H -#define LLVM_JAVA_OPERANDSTACK_H - -#include "Resolver.h" -#include <llvm/Value.h> -#include <llvm/Instruction.h> -#include <map> -#include <vector> - -namespace llvm { - - class AllocaInst; - class Instruction; - class Value; - -} // namespace llvm - -namespace llvm { namespace Java { - - class OperandStack { - const Resolver* resolver_; - unsigned currentDepth_; - typedef std::map<const Type*, AllocaInst*> SlotMap; - std::vector<SlotMap> stack_; - - public: - explicit OperandStack(const Resolver* resolver, unsigned maxDepth) - : resolver_(resolver), - currentDepth_(0), - stack_(maxDepth) { } - - unsigned getDepth() const { return currentDepth_; } - void setDepth(unsigned newDepth) { - assert(newDepth < stack_.size() && - "Cannot set depth greater than the max depth!"); - currentDepth_ = newDepth; - } - - /// @brief - Pushes the value \c value on the virtual operand - /// stack and appends any instructions to implement this to \c - /// insertAtEnd BasicBlock - void push(Value* value, BasicBlock* insertAtEnd); - - /// @brief - Pops a value of type \c type from the virtual operand - /// stack and appends any instructions to implement this to \c - /// insertAtEnd BasicBlock - Value* pop(const Type* type, BasicBlock* insertAtEnd); - - void do_pop(BasicBlock* insertAtEnd); - void do_pop2(BasicBlock* insertAtEnd); - void do_dup(BasicBlock* insertAtEnd); - void do_dup_x1(BasicBlock* insertAtEnd); - void do_dup_x2(BasicBlock* insertAtEnd); - void do_dup2(BasicBlock* insertAtEnd); - void do_dup2_x1(BasicBlock* insertAtEnd); - void do_dup2_x2(BasicBlock* insertAtEnd); - void do_swap(BasicBlock* insertAtEnd); - - private: - AllocaInst* getOrCreateSlot(SlotMap& slotMap, - const Type* type, - BasicBlock* bb); - void copySlots(const SlotMap& src, SlotMap& dst, BasicBlock* insertAtEnd); - }; - -} } // namespace llvm::Java - -#endif//LLVM_JAVA_OPERANDSTACK_H
diff --git a/java/lib/Compiler/Resolver.cpp b/java/lib/Compiler/Resolver.cpp deleted file mode 100644 index ac5d6a1..0000000 --- a/java/lib/Compiler/Resolver.cpp +++ /dev/null
@@ -1,252 +0,0 @@ -//===-- Resolver.cpp - Class resolver for Java classes ----------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the implementation of the Java class resolver. -// -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "javaresolver" - -#include "Resolver.h" -#include <llvm/Java/ClassFile.h> -#include <llvm/Constants.h> -#include <llvm/DerivedTypes.h> -#include <llvm/Support/Debug.h> -#include <iostream> - -using namespace llvm; -using namespace llvm::Java; - -Resolver::Resolver(Module* module) - : module_(module), - nextInterfaceIndex_(0), - objectBaseLayoutType_(OpaqueType::get()), - objectBaseType_(PointerType::get(objectBaseLayoutType_)), - classRecordType_(OpaqueType::get()), - classRecordPtrType_(PointerType::get(classRecordType_)) -{ - module_->addTypeName("struct.llvm_java_object_base", - getObjectBaseLayoutType()); - - // Compute the class record type. A class record looks like: - // - // struct class_record { - // struct type_info; - // }; - // - // struct type_info { - // char* name; - // int depth; - // struct class_record** superclasses; - // int interfaceIndex; - // struct class_record** interfaces; - // struct class_record* component; - // int elementSize; - // char** fieldDescriptors; - // unsigned* fieldOffsets; - // char** staticFieldDescriptors; - // void** staticFields; - // char** MethodDescriptors; - // void** Methods; - // char** staticMethodDescriptors; - // void** staticMethods; - // }; - - // Compute the type_info type. - std::vector<const Type*> elements; - elements.push_back(PointerType::get(Type::SByteTy)); - elements.push_back(Type::IntTy); - elements.push_back(PointerType::get(PointerType::get(classRecordType_))); - elements.push_back(Type::IntTy); - elements.push_back(PointerType::get(PointerType::get(classRecordType_))); - elements.push_back(PointerType::get(classRecordType_)); - elements.push_back(Type::IntTy); - elements.push_back(PointerType::get(PointerType::get(Type::SByteTy))); - elements.push_back(PointerType::get(Type::UIntTy)); - elements.push_back(PointerType::get(PointerType::get(Type::SByteTy))); - elements.push_back(PointerType::get(PointerType::get(Type::SByteTy))); - elements.push_back(PointerType::get(PointerType::get(Type::SByteTy))); - elements.push_back(PointerType::get(PointerType::get(Type::SByteTy))); - elements.push_back(PointerType::get(PointerType::get(Type::SByteTy))); - elements.push_back(PointerType::get(PointerType::get(Type::SByteTy))); - typeInfoType_ = StructType::get(elements); - - module_->addTypeName("struct.llvm_java_typeinfo", getTypeInfoType()); - - // Compute the class_record type. - PATypeHolder holder = classRecordType_; - cast<OpaqueType>(const_cast<Type*>(classRecordType_))->refineAbstractTypeTo( - StructType::get(std::vector<const Type*>(1, getTypeInfoType()))); - classRecordType_ = holder.get(); - - module_->addTypeName("struct.llvm_java_class_record", getClassRecordType()); - - classRecordPtrType_ = PointerType::get(classRecordType_); -} - -const Type* Resolver::getType(const std::string& descriptor, - bool memberMethod) const -{ - unsigned i = 0; - return getTypeHelper(descriptor, i, memberMethod); -} - -const Type* Resolver::getTypeHelper(const std::string& descr, - unsigned& i, - bool memberMethod) const -{ - assert(i < descr.size()); - switch (descr[i++]) { - case 'B': return Type::SByteTy; - case 'C': return Type::UShortTy; - case 'D': return Type::DoubleTy; - case 'F': return Type::FloatTy; - case 'I': return Type::IntTy; - case 'J': return Type::LongTy; - case 'S': return Type::ShortTy; - case 'Z': return Type::BoolTy; - case 'V': return Type::VoidTy; - case 'L': { - unsigned e = descr.find(';', i); - i = e + 1; - return getObjectBaseType(); - } - case '[': - // Skip '['s. - if (descr[i] == '[') - do { ++i; } while (descr[i] == '['); - // Consume the element type - getTypeHelper(descr, i); - return getObjectBaseType(); - case '(': { - std::vector<const Type*> params; - if (memberMethod) - params.push_back(getObjectBaseType()); - while (descr[i] != ')') - params.push_back(getTypeHelper(descr, i)); - return FunctionType::get(getTypeHelper(descr, ++i), params, false); - } - // FIXME: Throw something - default: assert(0 && "Cannot parse type descriptor!"); - } - return 0; // not reached -} - -const VMClass* Resolver::getClassForDesc(const std::string& descriptor) -{ - ClassMap::iterator it = classMap_.lower_bound(descriptor); - if (it == classMap_.end() || it->first != descriptor) { - switch (descriptor[0]) { - case 'B': - it = insertClass(it, VMClass(this, Type::SByteTy)); - break; - case 'C': - it = insertClass(it, VMClass(this, Type::UShortTy)); - break; - case 'D': - it = insertClass(it, VMClass(this, Type::DoubleTy)); - break; - case 'F': - it = insertClass(it, VMClass(this, Type::FloatTy)); - break; - case 'I': - it = insertClass(it, VMClass(this, Type::IntTy)); - break; - case 'J': - it = insertClass(it, VMClass(this, Type::LongTy)); - break; - case 'S': - it = insertClass(it, VMClass(this, Type::ShortTy)); - break; - case 'Z': - it = insertClass(it, VMClass(this, Type::BoolTy)); - break; - case 'V': - it = insertClass(it, VMClass(this, Type::VoidTy)); - break; - case 'L': { - unsigned pos = descriptor.find(';', 1); - const std::string& className = descriptor.substr(1, pos - 1); - it = insertClass(it, VMClass(this, className)); - break; - } - case '[': { - const std::string& componentDescriptor = descriptor.substr(1); - it = insertClass(it, VMClass(this, getClassForDesc(componentDescriptor))); - break; - } - default: - assert(0 && "Cannot parse type descriptor!"); - abort(); - } - it->second.link(); - if (!it->second.isPrimitive() && !it->second.isInterface()) - module_->addTypeName("struct." + descriptor, it->second.getLayoutType()); - DEBUG(std::cerr << "Loaded class: " << it->second.getName()); - DEBUG(std::cerr << " (" << it->second.getInterfaceIndex() << ")\n"); - } - - return &it->second; -} - -const VMClass* Resolver::getClass(JType type) -{ - switch (type) { - case BOOLEAN: return getClassForDesc("Z"); - case CHAR: return getClassForDesc("C"); - case FLOAT: return getClassForDesc("F"); - case DOUBLE: return getClassForDesc("D"); - case BYTE: return getClassForDesc("B"); - case SHORT: return getClassForDesc("S"); - case INT: return getClassForDesc("I"); - case LONG: return getClassForDesc("J"); - default: assert(0 && "Unhandled JType!"); abort(); - } -} - -const Type* Resolver::getStorageType(const Type* type) const -{ - if (isa<PointerType>(type)) - return getObjectBaseType(); - else if (type == Type::BoolTy || - type == Type::UByteTy || - type == Type::SByteTy || - type == Type::UShortTy || - type == Type::ShortTy || - type == Type::UIntTy) - return Type::IntTy; - else if (type == Type::ULongTy) - return Type::LongTy; - else - return type; -} - -void Resolver::emitClassRecordsArray() const -{ - std::vector<llvm::Constant*> init; - init.reserve(classMap_.size() + 1); - - for (ClassMap::const_iterator i = classMap_.begin(), e = classMap_.end(); - i != e; ++i) - init.push_back(ConstantExpr::getCast(i->second.getClassRecord(), - classRecordPtrType_)); - - // Null terminate the array. - init.push_back(llvm::Constant::getNullValue(classRecordPtrType_)); - - const ArrayType* arrayType = ArrayType::get(classRecordPtrType_, init.size()); - - new GlobalVariable( - arrayType, - true, - GlobalVariable::ExternalLinkage, - ConstantArray::get(arrayType, init), - "llvm_java_class_records", - module_); -}
diff --git a/java/lib/Compiler/Resolver.h b/java/lib/Compiler/Resolver.h deleted file mode 100644 index c48f2f3..0000000 --- a/java/lib/Compiler/Resolver.h +++ /dev/null
@@ -1,95 +0,0 @@ -//===-- Resolver.h - Class resolver for Java classes ------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the declaration of a Java class resolver. This -// object creates Class objects out of loaded ClassFiles. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_JAVA_RESOLVER_H -#define LLVM_JAVA_RESOLVER_H - -#include "VMClass.h" -#include <llvm/Java/Bytecode.h> -#include <llvm/Module.h> -#include <llvm/Type.h> -#include <map> -#include <string> - -namespace llvm { namespace Java { - - class Resolver { - Module* module_; - typedef std::map<std::string, VMClass> ClassMap; - ClassMap classMap_; - unsigned nextInterfaceIndex_; - const Type* objectBaseLayoutType_; - const Type* objectBaseType_; - const Type* typeInfoType_; - const Type* classRecordType_; - const Type* classRecordPtrType_; - - const VMClass* getClassForDesc(const std::string& descriptor); - - const Type* getTypeHelper(const std::string&, - unsigned& i, - bool memberMethod = false) const; - - ClassMap::iterator insertClass(ClassMap::iterator i, const VMClass& clazz) { - return classMap_.insert(i, std::make_pair(clazz.getDescriptor(), clazz)); - } - - friend class VMClass; - - public: - static std::string canonicalizeClassName(const std::string& className) { - if (className[0] == '[') - return className; - else - return 'L' + className + ';'; - } - - Resolver(Module* module); - - const Type* getObjectBaseLayoutType() const {return objectBaseLayoutType_; } - const Type* getObjectBaseType() const { return objectBaseType_; } - const Type* getTypeInfoType() const { return typeInfoType_; } - const Type* getClassRecordType() const { return classRecordType_; } - const Type* getClassRecordPtrType() const { return classRecordPtrType_; } - - const Type* getType(const std::string& descriptor, - bool memberMethod = false) const; - const Type* getStorageType(const Type* type) const; - - inline bool isTwoSlotType(const Type* type) const { - return type == Type::LongTy || type == Type::DoubleTy; - } - - inline bool isOneSlotType(const Type* type) const { - return !isTwoSlotType(type); - } - - const VMClass* getClass(const std::string& className) { - return getClassForDesc(canonicalizeClassName(className)); - } - - const VMClass* getClass(JType type); - - const VMClass* getArrayClass(const VMClass* clazz) { - return getClassForDesc('[' + clazz->getDescriptor()); - } - - unsigned getNextInterfaceIndex() { return nextInterfaceIndex_++; } - Module* getModule() { return module_; } - void emitClassRecordsArray() const; - }; - -} } // namespace llvm::Java - -#endif//LLVM_JAVA_RESOLVER_H
diff --git a/java/lib/Compiler/VMClass.cpp b/java/lib/Compiler/VMClass.cpp deleted file mode 100644 index 7467289..0000000 --- a/java/lib/Compiler/VMClass.cpp +++ /dev/null
@@ -1,781 +0,0 @@ -//===-- VMClass.cpp - Compiler representation of a Java class ---*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the declaration of the Class class that represents a -// compile time representation of a Java class (java.lang.Class). This unlike -// a classfile representation, it resolves the constant pool, creates global -// variables for the static members of this class and also creates the class -// record (vtable) of this class. -// -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "javaclass" - -#include "VMClass.h" -#include "Resolver.h" -#include <llvm/DerivedTypes.h> -#include <llvm/Constants.h> -#include <llvm/Java/ClassFile.h> -#include <llvm/Support/Debug.h> -#include <iostream> - -using namespace llvm; -using namespace llvm::Java; - -// On initialization we create a placeholder global for the class -// record that will be patched later when the class record is -// computed. -void VMClass::init() -{ - classRecord_ = new GlobalVariable( - OpaqueType::get(), - false, - GlobalVariable::ExternalLinkage, - NULL, - getName() + "<class_record>", - resolver_->getModule()); -} - -VMClass::VMClass(Resolver* resolver, const std::string& className) - : name_(className), - descriptor_(Resolver::canonicalizeClassName(className)), - resolver_(resolver), - classFile_(ClassFile::get(className)), - componentClass_(NULL), - layoutType_(OpaqueType::get()), - type_(PointerType::get(layoutType_)), - interfaceIndex_(INVALID_INTERFACE_INDEX), - resolvedConstantPool_(classFile_->getNumConstants()) -{ - init(); -} - -VMClass::VMClass(Resolver* resolver, const VMClass* componentClass) - : name_('[' + componentClass->getDescriptor()), - descriptor_(name_), - resolver_(resolver), - classFile_(NULL), - componentClass_(componentClass), - layoutType_(OpaqueType::get()), - type_(PointerType::get(layoutType_)), - interfaceIndex_(INVALID_INTERFACE_INDEX) -{ - init(); -} - -VMClass::VMClass(Resolver* resolver, const Type* type) - : name_(type == Type::SByteTy ? "byte" : - type == Type::UShortTy ? "char" : - type == Type::DoubleTy ? "double" : - type == Type::FloatTy ? "float" : - type == Type::IntTy ? "int" : - type == Type::LongTy ? "long" : - type == Type::ShortTy ? "short" : - type == Type::BoolTy ? "boolean" : "void"), - descriptor_(type == Type::SByteTy ? "B" : - type == Type::UShortTy ? "C" : - type == Type::DoubleTy ? "D" : - type == Type::FloatTy ? "F" : - type == Type::IntTy ? "I" : - type == Type::LongTy ? "J" : - type == Type::ShortTy ? "S" : - type == Type::BoolTy ? "Z" : "V"), - resolver_(resolver), - classFile_(NULL), - componentClass_(NULL), - layoutType_(const_cast<Type*>(type)), - type_(type), - interfaceIndex_(INVALID_INTERFACE_INDEX) -{ - init(); -} - -const VMField* VMClass::lookupField(const std::string& name) const -{ - if (const VMField* field = getField(name)) - return field; - - for (unsigned i = 0, e = getNumInterfaces(); i != e; ++i) { - const VMClass* interface = getInterface(i); - if (const VMField* field = interface->getField(name)) - return field; - } - - for (unsigned i = 0, e = getNumSuperClasses(); i != e; ++i) { - const VMClass* superClass = getSuperClass(i); - if (const VMField* field = superClass->getField(name)) - return field; - } - - return NULL; -} - -const VMMethod* VMClass::lookupMethod(const std::string& nameAndType) const -{ - if (const VMMethod* method = getMethod(nameAndType)) - return method; - - if (isInterface()) - for (unsigned i = 0, e = getNumInterfaces(); i != e; ++i) { - const VMClass* interface = getInterface(i); - if (const VMMethod* method = interface->getMethod(nameAndType)) - return method; - } - else - for (unsigned i = 0, e = getNumSuperClasses(); i != e; ++i) { - const VMClass* superClass = getSuperClass(i); - if (const VMMethod* method = superClass->getMethod(nameAndType)) - return method; - } - - return NULL; -} - -void VMClass::computeLayout() -{ - DEBUG(std::cerr << "Computing layout for: " << getName() << '\n'); - // The layout of primitive classes is already computed. - if (isPrimitive()) { - DEBUG(std::cerr << "Computed layout for: " << getName() << '\n'); - return; - } - - std::vector<const Type*> layout; - if (isArray()) { - layout.reserve(3); - layout.push_back(resolver_->getClass("java/lang/Object")->getLayoutType()); - layout.push_back(Type::UIntTy); - layout.push_back(ArrayType::get(componentClass_->getType(), 0)); - } - else { - if (const VMClass* superClass = getSuperClass()) - layout.push_back(superClass->getLayoutType()); - else // This is java/lang/Object - layout.push_back(resolver_->getObjectBaseLayoutType()); - // Now add the fields. - const Fields& fields = classFile_->getFields(); - for (unsigned i = 0, e = fields.size(); i != e; ++i) { - Field* field = fields[i]; - const std::string& name = field->getName()->str(); - if (field->isStatic()) { - FieldMap::iterator i = fieldMap_.insert( - std::make_pair(name, VMField(this, field))).first; - staticFields_.push_back(&i->second); - } - else { - unsigned index = memberFields_.size() + 1; - FieldMap::iterator i = fieldMap_.insert( - std::make_pair(name, VMField(this, field, index))).first; - const VMField* vmf = &i->second; - memberFields_.push_back(vmf); - layout.push_back(vmf->getClass()->getType()); - } - } - } - - PATypeHolder holder = layoutType_; - Type* resolvedType = StructType::get(layout); - cast<OpaqueType>(layoutType_)->refineAbstractTypeTo(resolvedType); - layoutType_ = holder.get(); - type_ = PointerType::get(layoutType_); - - DEBUG(std::cerr << "Computed layout for: " << getName() << '\n'); -} - -llvm::Constant* VMClass::buildSuperClassRecords() const -{ - std::vector<llvm::Constant*> init; - init.reserve(getNumSuperClasses()); - for (unsigned i = getNumSuperClasses(); i--; ) - init.push_back(ConstantExpr::getCast( - getSuperClass(i)->getClassRecord(), - resolver_->getClassRecordPtrType())); - - const ArrayType* superClassRecordsType = - ArrayType::get(resolver_->getClassRecordPtrType(), init.size()); - - return ConstantExpr::getPtrPtrFromArrayPtr( - new GlobalVariable( - superClassRecordsType, - true, - GlobalVariable::ExternalLinkage, - ConstantArray::get(superClassRecordsType, init), - getName() + "<super_class_records>", - resolver_->getModule())); -} - -llvm::Constant* -VMClass::buildInterfaceClassRecord(const VMClass* interface) const -{ - assert(interface->isInterface() && "Must be passed an interface!"); - - std::vector<llvm::Constant*> init; - init.reserve(interface->getNumDynamicMethods() + 1); - // Insert a null type info for this interface. - init.push_back(llvm::Constant::getNullValue(resolver_->getTypeInfoType())); - // For each method this interface declares, find the corresponding - // method in this class and put it in its slot. - for (unsigned i = 0, e = interface->getNumDynamicMethods(); i != e; ++i) { - assert(init.size() == i+1 && "Interface method not found in class!"); - const VMMethod* interfaceMethod = interface->getDynamicMethod(i); - for (unsigned j = 0, f = getNumDynamicMethods(); j != f; ++j) { - const VMMethod* method = getDynamicMethod(j); - if (method->getName() == interfaceMethod->getName() && - method->getDescriptor() == interfaceMethod->getDescriptor()) { - init.push_back(method->getFunction()); - break; - } - } - } - - llvm::Constant* classRecordInit = ConstantStruct::get(init); - - return ConstantExpr::getCast( - new GlobalVariable( - classRecordInit->getType(), - true, - GlobalVariable::ExternalLinkage, - classRecordInit, - getName() + '+' + interface->getName() + "<class_record>", - resolver_->getModule()), - resolver_->getClassRecordPtrType()); -} - -llvm::Constant* VMClass::buildInterfaceClassRecords() const -{ - // This is an interface or primitive class record so it doesn't - // implement any interfaces. Thus the pointer to the array of - // implemented interfaces is null. - if (isInterface() || isPrimitive()) { - const Type* classRecordPtrPtrType = - PointerType::get(resolver_->getClassRecordPtrType()); - - return llvm::Constant::getNullValue(classRecordPtrPtrType); - } - - // Otherwise this is a class or array class record so we have to - // fill in the array of implemented interfaces up the max interface - // index and build each individual interface class record for this - // class. - llvm::Constant* nullClassRecord = - llvm::Constant::getNullValue(resolver_->getClassRecordPtrType()); - std::vector<llvm::Constant*> init(getInterfaceIndex()+1, nullClassRecord); - - for (unsigned i = 0, e = getNumInterfaces(); i != e; ++i) { - const VMClass* interface = getInterface(i); - init[interface->getInterfaceIndex()] = buildInterfaceClassRecord(interface); - } - - const ArrayType* interfaceClassRecordsType = - ArrayType::get(resolver_->getClassRecordPtrType(), init.size()); - - return ConstantExpr::getPtrPtrFromArrayPtr( - new GlobalVariable( - interfaceClassRecordsType, - true, - GlobalVariable::ExternalLinkage, - ConstantArray::get(interfaceClassRecordsType, init), - getName() + "<interface_class_records>", - resolver_->getModule())); -} - -llvm::Constant* VMClass::buildClassName() const -{ - llvm::Constant* name = ConstantArray::get(getName()); - - return ConstantExpr::getPtrPtrFromArrayPtr( - new GlobalVariable( - name->getType(), - true, - GlobalVariable::ExternalLinkage, - name, - getName() + "<classname>", - resolver_->getModule())); -} - -llvm::Constant* VMClass::buildFieldDescriptors() const -{ - std::vector<llvm::Constant*> init; - init.reserve(memberFields_.size()+1); - - for (unsigned i = 0, e = memberFields_.size(); i != e; ++i) { - const VMField* field = memberFields_[i]; - init.push_back(field->buildFieldDescriptor()); - } - // Null terminate. - init.push_back(llvm::Constant::getNullValue(PointerType::get(Type::SByteTy))); - - const ArrayType* arrayType = - ArrayType::get(init.back()->getType(), init.size()); - - return ConstantExpr::getPtrPtrFromArrayPtr( - new GlobalVariable( - arrayType, - true, - GlobalVariable::ExternalLinkage, - ConstantArray::get(arrayType, init), - getName() + "<field_descriptors>", - resolver_->getModule())); -} - -llvm::Constant* VMClass::buildFieldOffsets() const -{ - std::vector<llvm::Constant*> init; - init.reserve(memberFields_.size()); - - for (unsigned i = 0, e = memberFields_.size(); i != e; ++i) { - const VMField* field = memberFields_[i]; - init.push_back(field->buildFieldOffset()); - } - - const ArrayType* arrayType = ArrayType::get(Type::UIntTy, init.size()); - - return ConstantExpr::getPtrPtrFromArrayPtr( - new GlobalVariable( - arrayType, - true, - GlobalVariable::ExternalLinkage, - ConstantArray::get(arrayType, init), - getName() + "<field_offsets>", - resolver_->getModule())); -} - -llvm::Constant* VMClass::buildStaticFieldDescriptors() const -{ - std::vector<llvm::Constant*> init; - init.reserve(staticFields_.size()+1); - - for (unsigned i = 0, e = staticFields_.size(); i != e; ++i) { - const VMField* field = staticFields_[i]; - init.push_back(field->buildFieldDescriptor()); - } - // Null terminate. - init.push_back(llvm::Constant::getNullValue(PointerType::get(Type::SByteTy))); - - const ArrayType* arrayType = - ArrayType::get(init.back()->getType(), init.size()); - - return ConstantExpr::getPtrPtrFromArrayPtr( - new GlobalVariable( - arrayType, - true, - GlobalVariable::ExternalLinkage, - ConstantArray::get(arrayType, init), - getName() + "<static_field_descriptors>", - resolver_->getModule())); -} - -llvm::Constant* VMClass::buildStaticFieldPointers() const -{ - std::vector<llvm::Constant*> init; - init.reserve(staticFields_.size()); - - const Type* pointerType = PointerType::get(Type::SByteTy); - for (unsigned i = 0, e = staticFields_.size(); i != e; ++i) { - const VMField* field = staticFields_[i]; - init.push_back(ConstantExpr::getCast(field->getGlobal(), pointerType)); - } - - const ArrayType* arrayType = ArrayType::get(pointerType, init.size()); - - return ConstantExpr::getPtrPtrFromArrayPtr( - new GlobalVariable( - arrayType, - true, - GlobalVariable::ExternalLinkage, - ConstantArray::get(arrayType, init), - getName() + "<static_field_pointers>", - resolver_->getModule())); -} - -llvm::Constant* VMClass::buildMethodDescriptors() const -{ - std::vector<llvm::Constant*> init; - init.reserve(getNumStaticMethods() + 1); - - for (unsigned i = 0, e = getNumDynamicMethods(); i != e; ++i) { - const VMMethod* method = getDynamicMethod(i); - init.push_back(method->buildMethodDescriptor()); - } - // Null terminate. - init.push_back(llvm::Constant::getNullValue(PointerType::get(Type::SByteTy))); - - const ArrayType* arrayType = - ArrayType::get(init.back()->getType(), init.size()); - - return ConstantExpr::getPtrPtrFromArrayPtr( - new GlobalVariable( - arrayType, - true, - GlobalVariable::ExternalLinkage, - ConstantArray::get(arrayType, init), - getName() + "<method_descriptors>", - resolver_->getModule())); -} - -llvm::Constant* VMClass::buildMethodPointers() const -{ - std::vector<llvm::Constant*> init; - init.reserve(getNumStaticMethods()); - - const Type* pointerType = PointerType::get(Type::SByteTy); - for (unsigned i = 0, e = getNumDynamicMethods(); i != e; ++i) { - const VMMethod* method = getDynamicMethod(i); - init.push_back(ConstantExpr::getCast(method->getBridgeFunction(), - pointerType)); - } - - const ArrayType* arrayType = ArrayType::get(pointerType, init.size()); - - return ConstantExpr::getPtrPtrFromArrayPtr( - new GlobalVariable( - arrayType, - true, - GlobalVariable::ExternalLinkage, - ConstantArray::get(arrayType, init), - getName() + "<method_pointers>", - resolver_->getModule())); -} - -llvm::Constant* VMClass::buildStaticMethodDescriptors() const -{ - std::vector<llvm::Constant*> init; - init.reserve(getNumStaticMethods() + 1); - - for (unsigned i = 0, e = getNumStaticMethods(); i != e; ++i) { - const VMMethod* method = getStaticMethod(i); - init.push_back(method->buildMethodDescriptor()); - } - // Null terminate. - init.push_back(llvm::Constant::getNullValue(PointerType::get(Type::SByteTy))); - - const ArrayType* arrayType = - ArrayType::get(init.back()->getType(), init.size()); - - return ConstantExpr::getPtrPtrFromArrayPtr( - new GlobalVariable( - arrayType, - true, - GlobalVariable::ExternalLinkage, - ConstantArray::get(arrayType, init), - getName() + "<static_method_descriptors>", - resolver_->getModule())); -} - -llvm::Constant* VMClass::buildStaticMethodPointers() const -{ - std::vector<llvm::Constant*> init; - init.reserve(getNumStaticMethods()); - - const Type* pointerType = PointerType::get(Type::SByteTy); - for (unsigned i = 0, e = getNumStaticMethods(); i != e; ++i) { - const VMMethod* method = getStaticMethod(i); - init.push_back(ConstantExpr::getCast(method->getBridgeFunction(), - pointerType)); - } - - const ArrayType* arrayType = ArrayType::get(pointerType, init.size()); - - return ConstantExpr::getPtrPtrFromArrayPtr( - new GlobalVariable( - arrayType, - true, - GlobalVariable::ExternalLinkage, - ConstantArray::get(arrayType, init), - getName() + "<static_method_pointers>", - resolver_->getModule())); -} - -llvm::Constant* VMClass::buildClassTypeInfo() const -{ - std::vector<llvm::Constant*> init; - init.reserve(5); - - init.push_back(buildClassName()); - init.push_back(ConstantSInt::get(Type::IntTy, getNumSuperClasses())); - init.push_back(buildSuperClassRecords()); - init.push_back(ConstantSInt::get(Type::IntTy, getInterfaceIndex())); - init.push_back(buildInterfaceClassRecords()); - if (isArray()) - init.push_back(ConstantExpr::getCast(getComponentClass()->getClassRecord(), - resolver_->getClassRecordPtrType())); - else - init.push_back( - llvm::Constant::getNullValue(resolver_->getClassRecordPtrType())); - if (isArray()) - init.push_back( - ConstantExpr::getCast( - ConstantExpr::getSizeOf(getComponentClass()->getType()), Type::IntTy)); - else if (isPrimitive()) - init.push_back(ConstantSInt::get(Type::IntTy, -2)); - else if (isInterface()) - init.push_back(ConstantSInt::get(Type::IntTy, -1)); - else // A class. - init.push_back(ConstantSInt::get(Type::IntTy, 0)); - - init.push_back(buildFieldDescriptors()); - init.push_back(buildFieldOffsets()); - init.push_back(buildStaticFieldDescriptors()); - init.push_back(buildStaticFieldPointers()); - init.push_back(buildMethodDescriptors()); - init.push_back(buildMethodPointers()); - init.push_back(buildStaticMethodDescriptors()); - init.push_back(buildStaticMethodPointers()); - - return ConstantStruct::get(init); -} - -void VMClass::computeClassRecord() -{ - DEBUG(std::cerr << "Computing class record for: " << getName() << '\n'); - // Find dynamically bound methods. - if (!isPrimitive()) { - if (const VMClass* superClass = getSuperClass()) - dynamicMethods_ = superClass->dynamicMethods_; - - if (getClassFile()) { - const Methods& methods = classFile_->getMethods(); - for (unsigned i = 0, e = methods.size(); i != e; ++i) { - Method* method = methods[i]; - const std::string& name = method->getName()->str(); - const std::string& descriptor = method->getDescriptor()->str(); - - // If method is statically bound just create it. - if (method->isPrivate() || method->isStatic() || name[0] == '<') { - MethodMap::iterator i = - methodMap_.insert( - std::make_pair(name + descriptor, VMMethod(this, method))).first; - staticMethods_.push_back(&i->second); - } - // Otherwise we need to assign an index for it and update the - // dynamicMethods_ vector. - else { - const VMMethod* overridenMethod = NULL; - for (unsigned i = 0, e = getNumDynamicMethods(); i != e; ++i) { - const VMMethod* m = getDynamicMethod(i); - if (m->getName() == name && m->getDescriptor() == descriptor) - overridenMethod = m; - } - - // If this is an overriden method reuse the method index - // with the overriding one. - if (overridenMethod) { - int index = overridenMethod->getMethodIndex(); - MethodMap::iterator i = methodMap_.insert( - std::make_pair(name + descriptor, - VMMethod(this, method, index))).first; - dynamicMethods_[index] = &i->second; - } - // Otherwise assign it a new index. - else { - int index = dynamicMethods_.size(); - MethodMap::iterator i = methodMap_.insert( - std::make_pair( - name + descriptor, VMMethod(this, method, index))).first; - dynamicMethods_.push_back(&i->second); - } - } - } - } - } - - std::vector<llvm::Constant*> init; - init.reserve(1 + getNumDynamicMethods()); - init.push_back(buildClassTypeInfo()); - for (unsigned i = 0, e = getNumDynamicMethods(); i != e; ++i) { - const VMMethod* method = getDynamicMethod(i); - init.push_back( - method->isAbstract() ? - llvm::Constant::getNullValue(method->getFunction()->getType()) : - method->getFunction()); - } - - llvm::Constant* classRecordInit = ConstantStruct::get(init); - resolver_->getModule()->addTypeName("classRecord." + getName(), - classRecordInit->getType()); - - // Now resolve the opaque type of the placeholder class record. - const Type* classRecordType = - cast<PointerType>(classRecord_->getType())->getElementType(); - OpaqueType* opaqueType = cast<OpaqueType>(const_cast<Type*>(classRecordType)); - opaqueType->refineAbstractTypeTo(classRecordInit->getType()); - // Set the initializer of the class record. - classRecord_->setInitializer(classRecordInit); - // Mark the class record as constant. - classRecord_->setConstant(true); - - DEBUG(std::cerr << "Computed class record for: " << getName() << '\n'); -} - -void VMClass::link() -{ - // Primitive classes require no linking. - if (isPrimitive()) - ; - else if (isArray()) { - superClasses_.reserve(1); - superClasses_.push_back(resolver_->getClass("java/lang/Object")); - - interfaces_.reserve(2); - interfaces_.push_back(resolver_->getClass("java/lang/Cloneable")); - interfaces_.push_back(resolver_->getClass("java/io/Serializable")); - } - else { - // This is any class but java/lang/Object. - if (classFile_->getSuperClass()) { - // Our direct super class. - const VMClass* superClass = getClass(classFile_->getSuperClassIndex()); - - // Add the interfaces of our direct superclass. - for (unsigned i = 0, e = superClass->getNumInterfaces(); i != e; ++i) - interfaces_.push_back(superClass->getInterface(i)); - - // The first class is the direct super class of this class. - superClasses_.reserve(superClass->getNumSuperClasses() + 1); - superClasses_.push_back(superClass); - for (unsigned i = 0, e = superClass->getNumSuperClasses(); i != e; ++i) - superClasses_.push_back(superClass->getSuperClass(i)); - } - - // For each of the interfaces we implement, load it and add that - // interface and all the interfaces it inherits from. - for (unsigned i = 0, e = classFile_->getNumInterfaces(); i != e; ++i) { - const VMClass* interface = getClass(classFile_->getInterfaceIndex(i)); - interfaces_.push_back(interface); - for (unsigned j = 0, f = interface->getNumInterfaces(); j != f; ++j) - interfaces_.push_back(interface->getInterface(j)); - } - - // Sort the interfaces array and remove duplicates. - std::sort(interfaces_.begin(), interfaces_.end()); - interfaces_.erase(std::unique(interfaces_.begin(), interfaces_.end()), - interfaces_.end()); - } - - // The interface index for an interface is a unique number generated - // from the resolver. - if (isInterface()) - interfaceIndex_ = resolver_->getNextInterfaceIndex(); - // For a class it is the max index of all the interfaces it implements. - else { - for (unsigned i = 0, e = getNumInterfaces(); i != e; ++i) - interfaceIndex_ = - std::max(interfaceIndex_, getInterface(i)->getInterfaceIndex()); - } - - computeLayout(); - computeClassRecord(); - - assert(!isa<OpaqueType>(getLayoutType()) &&"Class not initialized properly!"); -} - -llvm::Constant* VMClass::getConstant(unsigned index) const -{ - assert(classFile_ && "No constant pool!"); - assert((dynamic_cast<ConstantString*>(classFile_->getConstant(index)) || - dynamic_cast<ConstantInteger*>(classFile_->getConstant(index)) || - dynamic_cast<ConstantFloat*>(classFile_->getConstant(index)) || - dynamic_cast<ConstantLong*>(classFile_->getConstant(index)) || - dynamic_cast<ConstantDouble*>(classFile_->getConstant(index))) && - "Not an index to a constant!"); - - // If we haven't resolved this constant already, do so now. - if (!resolvedConstantPool_[index]) { - Constant* jc = classFile_->getConstant(index); - if (ConstantString* s = dynamic_cast<ConstantString*>(jc)) { - const VMClass* stringClass = resolver_->getClass("java/lang/String"); - const Type* stringType = stringClass->getLayoutType(); - resolvedConstantPool_[index] = - new GlobalVariable(stringType, - false, - GlobalVariable::LinkOnceLinkage, - llvm::Constant::getNullValue(stringType), - s->getValue()->str() + ".java/lang/String", - resolver_->getModule()); - } - else if (ConstantInteger* i = dynamic_cast<ConstantInteger*>(jc)) - resolvedConstantPool_[index] = - ConstantSInt::get(Type::IntTy, i->getValue()); - else if (ConstantFloat* f = dynamic_cast<ConstantFloat*>(jc)) - resolvedConstantPool_[index] = - ConstantFP::get(Type::FloatTy, f->getValue()); - else if (ConstantLong* l = dynamic_cast<ConstantLong*>(jc)) - resolvedConstantPool_[index] = - ConstantSInt::get(Type::LongTy, l->getValue()); - else if (ConstantDouble* d = dynamic_cast<ConstantDouble*>(jc)) - resolvedConstantPool_[index] = - ConstantFP::get(Type::DoubleTy, d->getValue()); - else - assert(0 && "Not a constant!"); - } - - return static_cast<llvm::Constant*>(resolvedConstantPool_[index]); -} - -const VMClass* VMClass::getClass(unsigned index) const -{ - assert(classFile_ && "No constant pool!"); - assert((dynamic_cast<ConstantClass*>(classFile_->getConstant(index)) || - dynamic_cast<ConstantUtf8*>(classFile_->getConstant(index))) && - "Not an index to a class or descriptor reference!"); - - // If we haven't resolved this constant already, do so now. - if (!resolvedConstantPool_[index]) { - Constant* jc = classFile_->getConstant(index); - if (ConstantClass* c = dynamic_cast<ConstantClass*>(jc)) - resolvedConstantPool_[index] = - const_cast<VMClass*>(resolver_->getClass(c->getName()->str())); - else if (ConstantUtf8* d = dynamic_cast<ConstantUtf8*>(jc)) - resolvedConstantPool_[index] = - const_cast<VMClass*>(resolver_->getClassForDesc(d->str())); - else - assert(0 && "Not a class!"); - } - - return static_cast<const VMClass*>(resolvedConstantPool_[index]); -} - -const VMField* VMClass::getField(unsigned index) const -{ - assert(classFile_ && "No constant pool!"); - assert(dynamic_cast<ConstantFieldRef*>(classFile_->getConstant(index)) && - "Not an index to a field reference!"); - - // If we haven't resolved this constant already, do so now. - if (!resolvedConstantPool_[index]) { - ConstantFieldRef* jc = classFile_->getConstantFieldRef(index); - const VMClass* clazz = getClass(jc->getClassIndex()); - const std::string& name = jc->getNameAndType()->getName()->str(); - resolvedConstantPool_[index] = - const_cast<VMField*>(clazz->lookupField(name)); - } - - return static_cast<const VMField*>(resolvedConstantPool_[index]); -} - -const VMMethod* VMClass::getMethod(unsigned index) const -{ - assert(classFile_ && "No constant pool!"); - assert((dynamic_cast<ConstantMethodRef*>(classFile_->getConstant(index)) || - dynamic_cast<ConstantInterfaceMethodRef*>(classFile_->getConstant(index))) && - "Not an index to a method reference!"); - - // If we haven't resolved this constant already, do so now. - if (!resolvedConstantPool_[index]) { - ConstantMemberRef* jc = classFile_->getConstantMemberRef(index); - const VMClass* clazz = getClass(jc->getClassIndex()); - ConstantNameAndType* ntc = jc->getNameAndType(); - const std::string& name = ntc->getName()->str(); - const std::string& descriptor = ntc->getDescriptor()->str(); - resolvedConstantPool_[index] = - const_cast<VMMethod*>(clazz->lookupMethod(name + descriptor)); - } - - return static_cast<const VMMethod*>(resolvedConstantPool_[index]); -}
diff --git a/java/lib/Compiler/VMClass.h b/java/lib/Compiler/VMClass.h deleted file mode 100644 index c420f60..0000000 --- a/java/lib/Compiler/VMClass.h +++ /dev/null
@@ -1,147 +0,0 @@ -//===-- VMClass.h - Compiler representation of a Java class -----*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the declaration of the VMClass class that represents a -// compile time representation of a Java class (java.lang.Class). -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_JAVA_VMCLASS_H -#define LLVM_JAVA_VMCLASS_H - -#include "VMField.h" -#include "VMMethod.h" -#include <llvm/Constant.h> -#include <llvm/Module.h> -#include <llvm/Type.h> -#include <llvm/Java/ClassFile.h> -#include <map> -#include <string> -#include <vector> - -namespace llvm { namespace Java { - - class Resolver; - - class VMClass { - static const int INVALID_INTERFACE_INDEX = -1; - - const std::string name_; - const std::string descriptor_; - Resolver* resolver_; - const ClassFile* classFile_; - const VMClass* componentClass_; - Type* layoutType_; - const Type* type_; - int interfaceIndex_; - typedef std::map<std::string, VMField> FieldMap; - FieldMap fieldMap_; - typedef std::map<std::string, VMMethod> MethodMap; - MethodMap methodMap_; - mutable std::vector<void*> resolvedConstantPool_; - std::vector<const VMClass*> superClasses_; - std::vector<const VMClass*> interfaces_; - std::vector<const VMField*> memberFields_; - std::vector<const VMField*> staticFields_; - std::vector<const VMMethod*> dynamicMethods_; - std::vector<const VMMethod*> staticMethods_; - GlobalVariable* classRecord_; - - void init(); - - void computeLayout(); - void computeClassRecord(); - - llvm::Constant* buildClassName() const; - llvm::Constant* buildSuperClassRecords() const; - llvm::Constant* buildInterfaceClassRecord(const VMClass* interface) const; - llvm::Constant* buildInterfaceClassRecords() const; - llvm::Constant* buildFieldDescriptors() const; - llvm::Constant* buildFieldOffsets() const; - llvm::Constant* buildStaticFieldDescriptors() const; - llvm::Constant* buildStaticFieldPointers() const; - llvm::Constant* buildMethodDescriptors() const; - llvm::Constant* buildMethodPointers() const; - llvm::Constant* buildStaticMethodDescriptors() const; - llvm::Constant* buildStaticMethodPointers() const; - llvm::Constant* buildClassTypeInfo() const; - - const VMField* lookupField(const std::string& name) const; - const VMMethod* lookupMethod(const std::string& nameAndType) const; - - friend class Resolver; - - // Resolver interface. - - // Load primitive class for type. - VMClass(Resolver* resolver, const Type* type); - - // Load class by name. - VMClass(Resolver* resolver, const std::string& className); - - // Load array class of component the passed class. - VMClass(Resolver* resolver, const VMClass* componentClass); - - // Link the class. - void link(); - // Resolve the class. - void resolve(); - // Initialize the class. - void initialize(); - - public: - const std::string& getName() const { return name_; } - const std::string& getDescriptor() const { return descriptor_; } - Resolver* getResolver() const { return resolver_; } - const Type* getLayoutType() const { return layoutType_; } - const Type* getType() const { return type_; } - const ClassFile* getClassFile() const { return classFile_; } - unsigned getNumSuperClasses() const { return superClasses_.size(); } - const VMClass* getSuperClass(unsigned i) const { return superClasses_[i]; } - const VMClass* getSuperClass() const { - return getNumSuperClasses() ? getSuperClass(0) : NULL; - } - unsigned getNumInterfaces() const { return interfaces_.size(); } - const VMClass* getInterface(unsigned i) const { return interfaces_[i]; } - const VMClass* getComponentClass() const { return componentClass_; } - bool isArray() const { return getComponentClass(); } - bool isPrimitive() const { return getType() == getLayoutType(); } - bool isInterface() const { return classFile_ && classFile_->isInterface(); } - int getInterfaceIndex() const { return interfaceIndex_; } - unsigned getNumDynamicMethods() const { - return dynamicMethods_.size(); - } - const VMMethod* getDynamicMethod(unsigned i) const { - return dynamicMethods_[i]; - } - unsigned getNumStaticMethods() const { - return staticMethods_.size(); - } - const VMMethod* getStaticMethod(unsigned i) const { - return staticMethods_[i]; - } - llvm::Constant* getClassRecord() const { return classRecord_; } - - llvm::Constant* getConstant(unsigned index) const; - const VMClass* getClass(unsigned index) const; - const VMField* getField(unsigned index) const; - const VMField* getField(const std::string& name) const { - FieldMap::const_iterator it = fieldMap_.find(name); - return it == fieldMap_.end() ? NULL : &it->second; - } - const VMMethod* getMethod(unsigned index) const; - const VMMethod* getMethod(const std::string& nameAndType) const { - MethodMap::const_iterator it = methodMap_.find(nameAndType); - return it == methodMap_.end() ? NULL : &it->second; - } - }; - -} } // namespace llvm::Java - -#endif//LLVM_JAVA_VMCLASS_H
diff --git a/java/lib/Compiler/VMField.cpp b/java/lib/Compiler/VMField.cpp deleted file mode 100644 index 823da90..0000000 --- a/java/lib/Compiler/VMField.cpp +++ /dev/null
@@ -1,90 +0,0 @@ -//===-- VMField.cpp - Compiler representation of a Java field ---*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the implementation of the Field class that represents a -// compile time representation of a Java class field (java.lang.Field). -// -//===----------------------------------------------------------------------===// - -#include "VMField.h" -#include "Resolver.h" -#include "VMClass.h" -#include <llvm/Constants.h> -#include <llvm/DerivedTypes.h> - -using namespace llvm; -using namespace llvm::Java; - -VMField::VMField(const VMClass* parent, const Field* field) - : parent_(parent), - class_(parent->getClass(field->getDescriptorIndex())), - field_(field) -{ - assert(isStatic() && "This should be a static field!"); - - // A java static field is constant if it is marked final and has a - // static initializer. - bool isConstant = field_->isFinal() && field->getConstantValueAttribute(); - - llvm::Constant* init = NULL; - if (ConstantValueAttribute* attr = field_->getConstantValueAttribute()) { - init = parent_->getConstant(attr->getValueIndex()); - if (init->getType() != class_->getType()) - init = ConstantExpr::getCast(init, class_->getType()); - } - else - init = llvm::Constant::getNullValue(class_->getType()); - - data_.global = new GlobalVariable(class_->getType(), - isConstant, - GlobalVariable::ExternalLinkage, - init, - parent_->getName() + '/' + getName(), - parent_->getResolver()->getModule()); -} - -VMField::VMField(const VMClass* parent, const Field* field, int index) - : parent_(parent), - class_(parent->getClass(field->getDescriptorIndex())), - field_(field) -{ - assert(!isStatic() && "This should be a member field!"); - data_.index = index; -} - -llvm::Constant* VMField::buildFieldDescriptor() const -{ - llvm::Constant* fd = ConstantArray::get(getName() + getDescriptor()); - - return ConstantExpr::getPtrPtrFromArrayPtr( - new GlobalVariable( - fd->getType(), - true, - GlobalVariable::ExternalLinkage, - fd, - getName() + getDescriptor(), - parent_->getResolver()->getModule())); -} - -llvm::Constant* VMField::buildFieldOffset() const -{ - assert(!isStatic() && "This should be a member field!"); - - assert(!isa<OpaqueType>(getParent()->getType()) && - "Should not be called before its owning class layout is computed!"); - llvm::Constant* nullRef = - llvm::Constant::getNullValue(getParent()->getType()); - std::vector<llvm::Constant*> indices; - indices.reserve(2); - indices.push_back(ConstantInt::get(Type::UIntTy, 0)); - indices.push_back(ConstantInt::get(Type::UIntTy, getMemberIndex())); - - return ConstantExpr::getCast( - ConstantExpr::getGetElementPtr(nullRef, indices), Type::UIntTy); -}
diff --git a/java/lib/Compiler/VMField.h b/java/lib/Compiler/VMField.h deleted file mode 100644 index e482814..0000000 --- a/java/lib/Compiler/VMField.h +++ /dev/null
@@ -1,74 +0,0 @@ -//===-- VMField.h - Compiler representation of a Java field -----*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the declaration of the Field class that represents a -// compile time representation of a Java class field (java.lang.Field). -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_JAVA_VMFIELD_H -#define LLVM_JAVA_VMFIELD_H - -#include <llvm/Java/ClassFile.h> -#include <cassert> - -namespace llvm { - - class Constant; - class GlobalVariable; - -} - -namespace llvm { namespace Java { - - class VMClass; - - class VMField { - const VMClass* parent_; - const VMClass* class_; - const Field* field_; - union { - int index; - GlobalVariable* global; - } data_; - - friend class VMClass; - // Interface for VMClass. - - // Create static field reference. - VMField(const VMClass* parent, const Field* field); - - // Create member field reference. - VMField(const VMClass* parent, const Field* field, int index); - - public: - const std::string& getName() const { return field_->getName()->str(); } - const std::string& getDescriptor() const { - return field_->getDescriptor()->str(); - } - bool isStatic() const { return field_->isStatic(); } - - const VMClass* getParent() const { return parent_; } - const VMClass* getClass() const { return class_; } - int getMemberIndex() const { - assert(!isStatic() && "Field should not be static!"); - return data_.index; - } - GlobalVariable* getGlobal() const { - assert(isStatic() && "Field should be static!"); - return data_.global; - } - - llvm::Constant* buildFieldDescriptor() const; - llvm::Constant* buildFieldOffset() const; - }; - -} } // namespace llvm::Java - -#endif//LLVM_JAVA_VMFIELD_H
diff --git a/java/lib/Compiler/VMMethod.cpp b/java/lib/Compiler/VMMethod.cpp deleted file mode 100644 index 8c1548e..0000000 --- a/java/lib/Compiler/VMMethod.cpp +++ /dev/null
@@ -1,115 +0,0 @@ -//===-- VMMethod.cpp - Compiler representation of a Java method -*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the implementation of the Method class that represents a -// compile time representation of a Java class method (java.lang.Method). -// -//===----------------------------------------------------------------------===// - -#include "VMMethod.h" -#include "Resolver.h" -#include "VMClass.h" -#include <llvm/Constants.h> -#include <llvm/DerivedTypes.h> -#include <llvm/Function.h> -#include <llvm/Instructions.h> -#include <llvm/ADT/STLExtras.h> - -using namespace llvm; -using namespace llvm::Java; - -void VMMethod::init() -{ - const std::string& methodName = method_->getName()->str(); - const std::string& methodDescriptor = method_->getDescriptor()->str(); - const std::string& functionName = - parent_->getName() + '/' + methodName + methodDescriptor; - - Resolver* resolver = parent_->getResolver(); - // FIXME: This type should be taken from the owning class's constant - // pool (parsed only once per class). This means the - // Resolver::getType() should be moved in VMClass and its return - // value should be cached in the constant pool along with the - // others. - const FunctionType* functionType = cast<FunctionType>( - resolver->getType(methodDescriptor, !method_->isStatic())); - Module* module = resolver->getModule(); - function_ = module->getOrInsertFunction(functionName, functionType); - - std::vector<const Type*> argTypes; - argTypes.reserve(2); - argTypes.push_back(resolver->getObjectBaseType()); - argTypes.push_back(PointerType::get(Type::SByteTy)); - const FunctionType* bridgeFunctionType = - FunctionType::get(functionType->getReturnType(), argTypes, false); - bridgeFunction_ = module->getOrInsertFunction("bridge_to_" + functionName, - bridgeFunctionType); - BasicBlock* bb = new BasicBlock("entry", bridgeFunction_); - std::vector<Value*> params; - params.reserve(functionType->getNumParams()); - Value* objectArg = bridgeFunction_->arg_begin(); - Value* vaList = next(bridgeFunction_->arg_begin()); - - if (!method_->isStatic()) - params.push_back(objectArg); - for (unsigned i = !method_->isStatic(), e = functionType->getNumParams(); - i != e; ++i) { - const Type* paramType = functionType->getParamType(i); - const Type* argType = paramType->getVAArgsPromotedType(); - Value* arg = new VAArgInst(vaList, argType, "tmp", bb); - if (paramType != argType) - arg = new CastInst(arg, paramType, "tmp", bb); - params.push_back(arg); - } - if (functionType->getReturnType() == Type::VoidTy) { - new CallInst(function_, params, "", bb); - new ReturnInst(bb); - } - else { - Value* result = new CallInst(function_, params, "result", bb); - new ReturnInst(result, bb); - } -} - -VMMethod::VMMethod(const VMClass* parent, const Method* method) - : parent_(parent), - method_(method), - index_(-1) -{ - assert(isStaticallyBound() && "This should be a statically bound method!"); - init(); -} - -VMMethod::VMMethod(const VMClass* parent, const Method* method, int index) - : parent_(parent), - method_(method), - index_(index) -{ - assert(isDynamicallyBound() && "This should be a dynamically bound method!"); - init(); -} - -llvm::Constant* VMMethod::buildMethodDescriptor() const -{ - llvm::Constant* fd = ConstantArray::get(getName() + getDescriptor()); - - return ConstantExpr::getPtrPtrFromArrayPtr( - new GlobalVariable( - fd->getType(), - true, - GlobalVariable::ExternalLinkage, - fd, - getName() + getDescriptor(), - parent_->getResolver()->getModule())); -} - -llvm::Constant* VMMethod::getBridgeFunction() const -{ - return bridgeFunction_; -}
diff --git a/java/lib/Compiler/VMMethod.h b/java/lib/Compiler/VMMethod.h deleted file mode 100644 index 62e13b0..0000000 --- a/java/lib/Compiler/VMMethod.h +++ /dev/null
@@ -1,81 +0,0 @@ -//===-- VMMethod.h - Compiler representation of a Java method ---*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the declaration of the Method class that represents a -// compile time representation of a Java class method (java.lang.Method). -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_JAVA_VMMETHOD_H -#define LLVM_JAVA_VMMETHOD_H - -#include <llvm/Java/ClassFile.h> - -namespace llvm { - - class Constant; - class Function; - class FunctionType; - -} - -namespace llvm { namespace Java { - - class VMClass; - - class VMMethod { - const VMClass* parent_; - const Method* method_; - Function* function_; - Function* bridgeFunction_; - - int index_; - - void init(); - - friend class VMClass; - // Interface for VMClass. - - // Create statically bound method reference. - VMMethod(const VMClass* parent, const Method* method); - - // Create dynamically bound method reference. - VMMethod(const VMClass* parent, const Method* method, int index); - - public: - const VMClass* getParent() const { return parent_; } - const Method* getMethod() const { return method_; } - Function* getFunction() const { return function_; } - int getMethodIndex() const { return index_; } - - bool isStaticallyBound() const { - return isStatic() || isPrivate() || getName()[0] == '<'; - } - bool isDynamicallyBound() const { return !isStaticallyBound(); } - bool isAbstract() const { return method_->isAbstract(); } - bool isNative() const { return method_->isNative(); } - bool isPrivate() const { return method_->isPrivate(); } - bool isStatic() const { return method_->isStatic(); } - - // FIXME: remove when transition is complete. - const std::string& getName() const { return method_->getName()->str(); } - const std::string& getDescriptor() const { - return method_->getDescriptor()->str(); - } - std::string getNameAndDescriptor() const { - return getName() + getDescriptor(); - } - - llvm::Constant* buildMethodDescriptor() const; - llvm::Constant* getBridgeFunction() const; - }; - -} } // namespace llvm::Java - -#endif//LLVM_JAVA_VMMETHOD_H
diff --git a/java/lib/Makefile b/java/lib/Makefile deleted file mode 100755 index 9448a33..0000000 --- a/java/lib/Makefile +++ /dev/null
@@ -1,13 +0,0 @@ -##===- lib/Makefile ----------------------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## -LEVEL := .. - -PARALLEL_DIRS := ClassFile Compiler Transforms - -include $(LEVEL)/Makefile.common
diff --git a/java/lib/Transforms/AddStubs.cpp b/java/lib/Transforms/AddStubs.cpp deleted file mode 100644 index efb50ca..0000000 --- a/java/lib/Transforms/AddStubs.cpp +++ /dev/null
@@ -1,52 +0,0 @@ -//===- AddStubs.cpp - Add Stubs Pass --------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements a stub adder pass. Because class2llvm is not able to -// compile all of java at the moment, this pass is used to add dummy returns -// to those functions. -// -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "addstubs" - -#include <llvm/Pass.h> -#include <llvm/Function.h> -#include <llvm/Module.h> -#include <llvm/Type.h> -#include <llvm/Instructions.h> -#include <llvm/Constants.h> -#include <llvm/Support/Debug.h> -#include <iostream> - -using namespace llvm; - -namespace { - - static Constant* ALL_ONES = ConstantUInt::getAllOnesValue(Type::ULongTy); - - struct AddStubs : public ModulePass { - virtual bool runOnModule(Module &M) { - for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) - if (F->empty() && - (F->getName().find("java") != std::string::npos || - F->getName().find("gnu") != std::string::npos)) { - DEBUG(std::cerr << "Stubbing out: " << F->getName() << '\n'); - BasicBlock* entry = new BasicBlock("entry", F); - if (F->getReturnType() == Type::VoidTy) - new ReturnInst(NULL, entry); - else - new ReturnInst( - new CastInst(ALL_ONES, F->getReturnType(), "dummy-value", entry), - entry); - } - return true; - } - }; - RegisterOpt<AddStubs> X("addstubs", "Add Stubs pass"); -}
diff --git a/java/lib/Transforms/Makefile b/java/lib/Transforms/Makefile deleted file mode 100644 index d6ccfc7..0000000 --- a/java/lib/Transforms/Makefile +++ /dev/null
@@ -1,14 +0,0 @@ -##===- lib/Transforms/Makefile -----------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## -LEVEL = ../.. -LIBRARYNAME = LLVMJavaTransforms -SHARED_LIBRARY = 1 -LOADABLE_MODULE = 1 - -include $(LEVEL)/Makefile.common
diff --git a/java/runtime/Makefile b/java/runtime/Makefile deleted file mode 100644 index 506203e..0000000 --- a/java/runtime/Makefile +++ /dev/null
@@ -1,15 +0,0 @@ -##==-- runtime/Makefile ----------------------------- -*- makefile -*--====## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## -LEVEL := .. - -CPPFLAGS+=-I$(PROJ_SRC_ROOT)/include/llvm/Java -BYTECODE_LIBRARY=1 -LIBRARYNAME=jrt - -include $(LEVEL)/Makefile.common
diff --git a/java/runtime/jni.c b/java/runtime/jni.c deleted file mode 100644 index 60f5b22..0000000 --- a/java/runtime/jni.c +++ /dev/null
@@ -1,559 +0,0 @@ -#include "runtime.h" -#include <stdlib.h> -#include <string.h> - -/* The implementation of JNI functions */ - -/* Class operations */ - -static jclass find_class(JNIEnv* env, const char* name) { - return GET_CLASS(llvm_java_find_class_record(name)); -} - -static jclass get_superclass(JNIEnv* env, jclass clazz) { - return GET_CLASS(llvm_java_get_superclass_record(GET_CLASS_RECORD(clazz))); -} - -static jboolean is_assignable_from(JNIEnv* env, jclass c1, jclass c2) { - return llvm_java_is_assignable_from(GET_CLASS_RECORD(c1), - GET_CLASS_RECORD(c2)); -} - -/* Exceptions */ - -static jint throw(JNIEnv* env, jthrowable obj) { - return llvm_java_throw(obj); -} - -/* Global and local references */ - -/* Weak global references */ - -/* Object operations */ - -static jboolean is_same_object(JNIEnv* env, jobject o1, jobject o2) { - return o1 == o2; -} - -static jclass get_object_class(JNIEnv* env, jobject obj) { - return GET_CLASS(llvm_java_get_class_record(obj)); -} - -static jboolean is_instance_of(JNIEnv* env, jobject obj, jclass c) { - return llvm_java_is_instance_of(obj, GET_CLASS_RECORD(c)); -} - -/* Accessing fields of objects */ - -static jfieldID get_fieldid(JNIEnv *env, - jclass clazz, - const char *name, - const char *sig) { - int nameLength; - int i; - const char* fieldDescriptor; - struct llvm_java_class_record* cr = GET_CLASS_RECORD(clazz); - - /* lookup the name+sig in the fieldDescriptors array and retrieve - * the offset of the field */ - nameLength = strlen(name); - for (i = 0; (fieldDescriptor = cr->typeinfo.fieldDescriptors[i]); ++i) - if (strncmp(name, fieldDescriptor, nameLength) == 0 && - strcmp(sig, fieldDescriptor+nameLength) == 0) - return cr->typeinfo.fieldOffsets[i]; - - return 0; -} - -#define HANDLE_TYPE(TYPE) \ - static j##TYPE get_##TYPE##_field(JNIEnv* env, \ - jobject obj, \ - jfieldID fid) { \ - return *(j##TYPE*) (((char*)obj) + fid); \ - } -#include "types.def" - -#define HANDLE_TYPE(TYPE) \ - static void set_##TYPE##_field(JNIEnv* env, \ - jobject obj, \ - jfieldID fid, \ - j##TYPE value) { \ - *(j##TYPE*) (((char*)obj) + fid) = value; \ - } -#include "types.def" - -/* Calling instance methods */ - -static jmethodID get_methodid(JNIEnv *env, - jclass clazz, - const char *name, - const char *sig) { - int nameLength; - int i; - const char* methodDescriptor; - struct llvm_java_class_record* cr = GET_CLASS_RECORD(clazz); - - /* lookup the name+sig in the staticFieldDescriptors array and - * retrieve the index of the field */ - nameLength = strlen(name); - for (i = 0; (methodDescriptor = cr->typeinfo.methodDescriptors[i]); ++i) - if (strncmp(name, methodDescriptor, nameLength) == 0 && - strcmp(sig, methodDescriptor+nameLength) == 0) - return i; - - return 0; -} - -static void call_void_method_v(JNIEnv* env, - jobject obj, - jmethodID methodID, - va_list args) { - typedef void (*BridgeFunPtr)(jobject obj, va_list); - struct llvm_java_class_record* cr = llvm_java_get_class_record(obj); - - BridgeFunPtr f = (BridgeFunPtr) cr->typeinfo.methodBridges[methodID]; - f(obj, args); -} - -static void call_void_method(JNIEnv* env, - jobject obj, - jmethodID methodID, - ...) { - va_list args; - va_start(args, methodID); - call_void_method_v(env, obj, methodID, args); - va_end(args); -} - -#define HANDLE_TYPE(TYPE) \ - static j##TYPE call_##TYPE##_method_v(JNIEnv* env, \ - jobject obj, \ - jmethodID methodID, \ - va_list args) { \ - typedef j##TYPE (*BridgeFunPtr)(jobject obj, va_list); \ - struct llvm_java_class_record* cr = llvm_java_get_class_record(obj); \ - BridgeFunPtr f = \ - (BridgeFunPtr) cr->typeinfo.methodBridges[methodID]; \ - return f(obj, args); \ - } -#include "types.def" - -#define HANDLE_TYPE(TYPE) \ - static j##TYPE call_##TYPE##_method(JNIEnv* env, \ - jobject obj, \ - jmethodID methodID, \ - ...) { \ - va_list args; \ - va_start(args, methodID); \ - j##TYPE result = \ - call_##TYPE##_method_v(env, obj, methodID, args); \ - va_end(args); \ - return result; \ - } -#include "types.def" - -/* Accessing static fields */ - -static jfieldID get_static_fieldid(JNIEnv *env, - jclass clazz, - const char *name, - const char *sig) { - int nameLength; - int i; - const char* fieldDescriptor; - struct llvm_java_class_record* cr = GET_CLASS_RECORD(clazz); - - /* lookup the name+sig in the staticFieldDescriptors array and - * retrieve the index of the field */ - nameLength = strlen(name); - for (i = 0; (fieldDescriptor = cr->typeinfo.staticFieldDescriptors[i]); ++i) - if (strncmp(name, fieldDescriptor, nameLength) == 0 && - strcmp(sig, fieldDescriptor+nameLength) == 0) - return i; - - return 0; -} - -#define HANDLE_TYPE(TYPE) \ - static j##TYPE get_static_##TYPE##_field(JNIEnv* env, \ - jclass clazz, \ - jfieldID fid) { \ - struct llvm_java_class_record* cr = GET_CLASS_RECORD(clazz); \ - return *(j##TYPE*) cr->typeinfo.staticFields[fid]; \ - } -#include "types.def" - -#define HANDLE_TYPE(TYPE) \ - static void set_static_##TYPE##_field(JNIEnv* env, \ - jclass clazz, \ - jfieldID fid, \ - j##TYPE value) { \ - struct llvm_java_class_record* cr = GET_CLASS_RECORD(clazz); \ - *(j##TYPE*) cr->typeinfo.staticFields[fid] = value; \ - } -#include "types.def" - -/* Calling static methods */ - -static jmethodID get_static_methodid(JNIEnv *env, - jclass clazz, - const char *name, - const char *sig) { - int nameLength; - int i; - const char* methodDescriptor; - struct llvm_java_class_record* cr = GET_CLASS_RECORD(clazz); - - /* lookup the name+sig in the staticFieldDescriptors array and - * retrieve the index of the field */ - nameLength = strlen(name); - for (i = 0; (methodDescriptor = cr->typeinfo.staticMethodDescriptors[i]); ++i) - if (strncmp(name, methodDescriptor, nameLength) == 0 && - strcmp(sig, methodDescriptor+nameLength) == 0) - return i; - - return 0; -} - -static void call_static_void_method_v(JNIEnv* env, - jclass clazz, - jmethodID methodID, - va_list args) { - typedef void (*BridgeFunPtr)(jclass clazz, va_list); - struct llvm_java_class_record* cr = GET_CLASS_RECORD(clazz); - - BridgeFunPtr f = (BridgeFunPtr) cr->typeinfo.staticMethodBridges[methodID]; - f(clazz, args); -} - -static void call_static_void_method(JNIEnv* env, - jclass clazz, - jmethodID methodID, - ...) { - va_list args; - va_start(args, methodID); - call_static_void_method_v(env, clazz, methodID, args); - va_end(args); -} - -#define HANDLE_TYPE(TYPE) \ - static j##TYPE call_static_##TYPE##_method_v(JNIEnv* env, \ - jclass clazz, \ - jmethodID methodID, \ - va_list args) { \ - typedef j##TYPE (*BridgeFunPtr)(jclass clazz, va_list); \ - struct llvm_java_class_record* cr = GET_CLASS_RECORD(clazz); \ - BridgeFunPtr f = \ - (BridgeFunPtr) cr->typeinfo.staticMethodBridges[methodID]; \ - return f(clazz, args); \ - } -#include "types.def" - -#define HANDLE_TYPE(TYPE) \ - static j##TYPE call_static_##TYPE##_method(JNIEnv* env, \ - jclass clazz, \ - jmethodID methodID, \ - ...) { \ - va_list args; \ - va_start(args, methodID); \ - j##TYPE result = \ - call_static_##TYPE##_method_v(env, clazz, methodID, args); \ - va_end(args); \ - return result; \ - } -#include "types.def" - -/* String operations */ - -/* Array operations */ - -static jint get_array_length(JNIEnv* env, jarray array) { - return ((struct llvm_java_booleanarray*) array)->length; -} - -static jobject get_object_array_element(JNIEnv* env, jarray array, jsize i) { - return ((struct llvm_java_objectarray*) array)->data[i]; -} - -static void set_object_array_element(JNIEnv* env, - jarray array, - jsize i, - jobject value) { - ((struct llvm_java_objectarray*) array)->data[i] = value; -} - -#define HANDLE_NATIVE_TYPE(TYPE) \ - static j ## TYPE* get_##TYPE##_array_elements( \ - JNIEnv* env, \ - jarray array, \ - jboolean* isCopy) { \ - if (isCopy) \ - *isCopy = JNI_FALSE; \ - return ((struct llvm_java_ ##TYPE## array*) array)->data; \ - } -#include "types.def" - -#define HANDLE_NATIVE_TYPE(TYPE) \ - static void release_ ##TYPE## _array_elements( \ - JNIEnv* env, \ - jarray array, \ - j##TYPE* elements, \ - jint mode) { \ - switch (mode) { \ - case 0: \ - case JNI_COMMIT: \ - case JNI_ABORT: \ - return; \ - default: \ - abort(); \ - } \ - } -#include "types.def" - -/* Register native methods */ - -/* Monitor operations */ - -/* NIO support */ - -/* Reflection support */ - -/* Java VM interface */ - -/* The JNI interface definition */ -static const struct JNINativeInterface llvm_java_JNINativeInterface = { - NULL, /* 0 */ - NULL, - NULL, - NULL, - NULL, - NULL, - &find_class, - NULL, - NULL, - NULL, - &get_superclass, - &is_assignable_from, - NULL, - &throw, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, /* 20 */ - NULL, - NULL, - NULL, - &is_same_object, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, /* 30 */ - &get_object_class, - &is_instance_of, - &get_methodid, - &call_object_method, - &call_object_method_v, - NULL, - &call_boolean_method, - &call_boolean_method_v, - NULL, - &call_byte_method, - &call_byte_method_v, - NULL, - &call_char_method, - &call_char_method_v, - NULL, - &call_short_method, - &call_short_method_v, - NULL, - &call_int_method, - &call_int_method_v, - NULL, - &call_long_method, - &call_long_method_v, - NULL, - &call_float_method, - &call_float_method_v, - NULL, - &call_double_method, - &call_double_method_v, - NULL, /* 60 */ - &call_void_method, - &call_void_method_v, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, /* 70 */ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, /* 80 */ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, /* 90 */ - NULL, - NULL, - NULL, - &get_fieldid, - &get_object_field, - &get_boolean_field, - &get_byte_field, - &get_char_field, - &get_short_field, - &get_int_field, - &get_long_field, - &get_float_field, - &get_double_field, - &set_object_field, - &set_boolean_field, - &set_byte_field, - &set_char_field, - &set_short_field, - &set_int_field, - &set_long_field, - &set_float_field, - &set_double_field, - &get_static_methodid, - &call_static_object_method, - &call_static_object_method_v, - NULL, - &call_static_boolean_method, - &call_static_boolean_method_v, - NULL, - &call_static_byte_method, - &call_static_byte_method_v, - NULL, - &call_static_char_method, - &call_static_char_method_v, - NULL, - &call_static_short_method, - &call_static_short_method_v, - NULL, - &call_static_int_method, - &call_static_int_method_v, - NULL, - &call_static_long_method, - &call_static_long_method_v, - NULL, - &call_static_float_method, - &call_static_float_method_v, - NULL, - &call_static_double_method, - &call_static_double_method_v, - NULL, /* 140 */ - NULL, - NULL, - NULL, - &get_static_fieldid, - &get_static_object_field, - &get_static_boolean_field, - &get_static_byte_field, - &get_static_char_field, - &get_static_short_field, - &get_static_int_field, - &get_static_long_field, - &get_static_float_field, - &get_static_double_field, - &set_static_object_field, - &set_static_boolean_field, - &set_static_byte_field, - &set_static_char_field, - &set_static_short_field, - &set_static_int_field, - &set_static_long_field, - &set_static_float_field, - &set_static_double_field, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, /* 170 */ - &get_array_length, - NULL, - &get_object_array_element, - &set_object_array_element, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, /* 180 */ - NULL, - NULL, - &get_boolean_array_elements, - &get_byte_array_elements, - &get_char_array_elements, - &get_short_array_elements, - &get_int_array_elements, - &get_long_array_elements, - &get_float_array_elements, - &get_double_array_elements, - &release_boolean_array_elements, - &release_byte_array_elements, - &release_char_array_elements, - &release_short_array_elements, - &release_int_array_elements, - &release_long_array_elements, - &release_float_array_elements, - &release_double_array_elements, - NULL, - NULL, /* 200 */ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, /* 210 */ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, /* 220 */ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, /* 230 */ - NULL, -}; - -const JNIEnv llvm_java_JNIEnv = &llvm_java_JNINativeInterface;
diff --git a/java/runtime/runtime.c b/java/runtime/runtime.c deleted file mode 100644 index 07c620d..0000000 --- a/java/runtime/runtime.c +++ /dev/null
@@ -1,138 +0,0 @@ -#include "runtime.h" -#include <stdlib.h> -#include <string.h> - -jint llvm_java_is_primitive_class(struct llvm_java_class_record* cr) -{ - return cr->typeinfo.elementSize == -2; -} - -jint llvm_java_is_interface_class(struct llvm_java_class_record* cr) -{ - return cr->typeinfo.elementSize == -1; -} - -jint llvm_java_is_array_class(struct llvm_java_class_record* cr) -{ - return cr->typeinfo.elementSize > 0; -} - -struct llvm_java_class_record* llvm_java_get_class_record(jobject obj) { - return obj->classRecord; -} - -void llvm_java_set_class_record(jobject obj, - struct llvm_java_class_record* cr) { - obj->classRecord = cr; -} - -struct llvm_java_class_record* -llvm_java_get_superclass_record(struct llvm_java_class_record* cr) { - /* If this is an interface or java/lang/Object return NULL. */ - if (llvm_java_is_interface_class(cr) || cr->typeinfo.depth == 0) - return NULL; - - return cr->typeinfo.superclasses[cr->typeinfo.depth - 1]; -} - -jboolean llvm_java_is_assignable_from(struct llvm_java_class_record* cr, - struct llvm_java_class_record* from) { - /* trivial case: class records are the same */ - if (cr == from) - return JNI_TRUE; - - /* if from is a primitive class then they must be of the same class */ - if (llvm_java_is_primitive_class(from)) - return cr == from; - - /* if from is an interface class then the current class must - * implement that interface */ - if (llvm_java_is_interface_class(from)) { - int index = from->typeinfo.interfaceIndex; - return (cr->typeinfo.interfaceIndex >= index && - cr->typeinfo.interfaces[index]); - } - - /* if from is an array class then the component types of must be - * assignable from */ - if (llvm_java_is_array_class(from)) - return (cr->typeinfo.component && - llvm_java_is_assignable_from(cr->typeinfo.component, - from->typeinfo.component)); - - /* otherwise this is a class, check if from is a superclass of this - * class */ - if (cr->typeinfo.depth > from->typeinfo.depth) { - int index = from->typeinfo.depth; - return cr->typeinfo.superclasses[index] == from; - } - - return JNI_FALSE; -} - -jboolean llvm_java_is_instance_of(jobject obj, - struct llvm_java_class_record* cr) { - /* trivial case: a null object can be cast to any type */ - if (!obj) - return JNI_TRUE; - - return llvm_java_is_assignable_from(obj->classRecord, cr); -} - -jint llvm_java_throw(jthrowable obj) { - abort(); -} - -extern struct llvm_java_class_record* llvm_java_class_records; - -struct llvm_java_class_record* -llvm_java_find_class_record(const char* name) { - struct llvm_java_class_record** cr = &llvm_java_class_records; - for (; *cr; ++cr) - if (strcmp((*cr)->typeinfo.name, name) == 0) - return *cr; - - return NULL; -} - -void Java_java_lang_VMSystem_arraycopy(JNIEnv *env, jobject clazz, - jobject srcObj, jint srcStart, - jobject dstObj, jint dstStart, - jint length) { - struct llvm_java_bytearray* srcArray = (struct llvm_java_bytearray*) srcObj; - struct llvm_java_bytearray* dstArray = (struct llvm_java_bytearray*) dstObj; - unsigned nbytes = length * srcObj->classRecord->typeinfo.elementSize; - - jbyte* src = srcArray->data; - jbyte* dst = dstArray->data; - - // FIXME: Need to perform a proper type check here. - if (srcObj->classRecord->typeinfo.elementSize != - dstObj->classRecord->typeinfo.elementSize) - llvm_java_throw(NULL); - - src += srcStart * srcObj->classRecord->typeinfo.elementSize; - dst += dstStart * dstObj->classRecord->typeinfo.elementSize; - - memmove(dst, src, nbytes); -} - -void Java_gnu_classpath_VMSystemProperties_preInit(JNIEnv *env, jobject clazz, - jobject properties) { - -} - -typedef void (*ClassInitializerFunction)(void); - -extern const ClassInitializerFunction llvm_java_class_initializers; - -extern void llvm_java_main(int, char**); - -int main(int argc, char** argv) { - const ClassInitializerFunction* classInit = &llvm_java_class_initializers; - for (; *classInit; ++classInit) - (*classInit)(); - - llvm_java_main(argc, argv); - return 0; -}
diff --git a/java/runtime/runtime.h b/java/runtime/runtime.h deleted file mode 100644 index 411ba7d..0000000 --- a/java/runtime/runtime.h +++ /dev/null
@@ -1,109 +0,0 @@ -#include <llvm/Java/jni.h> - -/* For now we cast a java/lang/Class reference to a class record. When - * we get proper java/lang/Class representation this will be a field - * access. */ -#define GET_CLASS_RECORD(clazz) ((struct llvm_java_class_record*) clazz) -#define GET_CLASS(classRecord) ((jclass) classRecord) - -const JNIEnv llvm_java_JNIEnv; - -struct llvm_java_object_base; -struct llvm_java_object_header; -struct llvm_java_class_record; -struct llvm_java_typeinfo; - -struct llvm_java_object_header { - /* gc info, hash info, locking */ - int dummy; -}; - -struct llvm_java_object_base { - struct llvm_java_object_header header; - struct llvm_java_class_record* classRecord; -}; - -struct llvm_java_typeinfo { - /* The name of this class */ - const char* name; - - /* The number of super classes to java.lang.Object. */ - jint depth; - - /* The super class records up to java.lang.Object. */ - struct llvm_java_class_record** superclasses; - - /* If an interface its interface index, otherwise the last interface - * index implemented by this class. */ - jint interfaceIndex; - - /* The interface class records this class implements. */ - struct llvm_java_class_record** interfaces; - - /* The component class record if this is an array class, null - * otherwise. */ - struct llvm_java_class_record* component; - - /* If an array the size of its elements, otherwise 0 for classes, -1 - * for interfaces and -2 for primitive classes. */ - jint elementSize; - - /* A null terminated array of strings describing the member fields - * of this class. A field description is the concatenation of its - * name with its descriptor. */ - const char** fieldDescriptors; - - /* An array of offsets to fields. This is indexed the same way as - * the field descriptor array. */ - unsigned* fieldOffsets; - - /* A null terminated array of strings describing the static fields - * of this class. A field description is the concatenation of its - * name with its descriptor. */ - const char** staticFieldDescriptors; - - /* An array of pointers to static fields. This is indexed the - * same way as the static field descriptor array. */ - void** staticFields; - - /* A null terminated array of strings describing the dynamic methods - of this class. A method descriptor is the concatenation of its - name with its descriptor. */ - const char** methodDescriptors; - - /* An array of pointers to bridge functions. This is indexed the - * same way as the dynamic method descriptor array. */ - void** methodBridges; - - /* A null terminated array of strings describing the static methods - of this class. A method descriptor is the concatenation of its - name with its descriptor. */ - const char** staticMethodDescriptors; - - /* An array of pointers to bridge functions. This is indexed the - * same way as the static method descriptor array. */ - void** staticMethodBridges; -}; - -struct llvm_java_class_record { - struct llvm_java_typeinfo typeinfo; -}; - -#define HANDLE_TYPE(TYPE) \ - struct llvm_java_##TYPE##array { \ - struct llvm_java_object_base object_base; \ - jint length; \ - j##TYPE data[0]; \ - }; -#include "types.def" - -struct llvm_java_class_record* llvm_java_find_class_record(const char* name); -struct llvm_java_class_record* llvm_java_get_class_record(jobject obj); -void llvm_java_set_class_record(jobject obj, struct llvm_java_class_record* cr); -jboolean llvm_java_is_instance_of(jobject obj, - struct llvm_java_class_record* cr); -struct llvm_java_class_record* llvm_java_get_superclass_record( - struct llvm_java_class_record* cr); -jboolean llvm_java_is_assignable_from(struct llvm_java_class_record* cr, - struct llvm_java_class_record* from); -jint llvm_java_throw(jthrowable obj);
diff --git a/java/test/Makefile b/java/test/Makefile deleted file mode 100755 index 9bea413..0000000 --- a/java/test/Makefile +++ /dev/null
@@ -1,13 +0,0 @@ -##===- test/Makefile ---------------------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## -LEVEL := .. - -PARALLEL_DIRS := Programs Regression - -include $(LEVEL)/Makefile.common
diff --git a/java/test/Makefile.test b/java/test/Makefile.test deleted file mode 100644 index bb0c8e6..0000000 --- a/java/test/Makefile.test +++ /dev/null
@@ -1,120 +0,0 @@ -##==-- test/Makefile.test - Common make rules Java tests -*- makefile -*--====## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -.PHONY: clean - -clean:: - $(Verb)$(RM) -f a.out core - $(Verb)$(RM) -rf Output/ - -# we don't want these files to be deleted by make, even if they are -# intermediate results -.PRECIOUS: %.linked.bc %.raw.bc %.ll %.llvm.bc %.llc - -# rule to link bytecode with runtime -%.llvm %.llvm.bc: %.linked.bc $(LibDir)/libjrt.bca $(EXTRA_OBJS) $(LOPT) - $(Echo) Linking $< with the Java runtime - -$(Verb)$(GCCLD) -o=$*.llvm $< -L $(CFERuntimeLibDir) -L $(LibDir) $(EXTRA_OBJS) - -$(Verb)$(LOPT) -load $(LibDir)/LLVMJavaTransforms -addstubs -f -o=$*.stubbed.llvm.bc $*.llvm.bc - -$(Verb)$(MV) -f $*.stubbed.llvm.bc $*.llvm.bc - -# rule to link raw bytecode with runtime -%.raw.llvm %.raw.llvm.bc: %.linked.bc $(LibDir)/libjrt.bca $(EXTRA_OBJS) $(LOPT) - $(Echo) Linking $< with the Java runtime \(no optimizations\) - -$(Verb)$(GCCLD) -disable-opt -o=$*.raw.llvm $< -L $(CFERuntimeLibDir) -L $(LibDir) $(EXTRA_OBJS) - -$(Verb)$(LOPT) -load $(LibDir)/LLVMJavaTransforms -addstubs -f -o=$*.stubbed.raw.llvm.bc $*.raw.llvm.bc - -$(Verb)$(MV) -f $*.stubbed.raw.llvm.bc $*.raw.llvm.bc - -# rule to make native executable -%.llc.s: %.llvm.bc - -$(Verb)$(LLC) -f $< -o $@ - -%.llc: %.llc.s - -$(Verb)$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@ - -# add function trace code -%.tracef.llvm %.tracef.llvm.bc: %.llvm %.llvm.bc $(LOPT) - $(Echo) Adding function trace code to $< - $(Verb)$(CP) $*.llvm $*.tracef.llvm - $(Verb)$(LOPT) -tracem -tracedisablehashdisable -f -o=$*.tracef.llvm.bc $*.llvm.bc - -# rule to make assembly from bytecode -%.dis-ll: %.bc - $(Echo) Disassembling $< - $(Verb)$(LDIS) -f -o=$@ $< - -# rule to compile java sources -ifdef BUILD_JAVA_SOURCES -JAVA_SOURCES := $(wildcard *.java) -JAVA_TESTS := $(basename $(JAVA_SOURCES)) -PREFIXED_JAVA_TESTS := $(addprefix Output/, $(JAVA_TESTS)) -PREFIXED_CLASS_FILES := $(addsuffix .class/, $(PREFIXED_JAVA_TESTS)) - -$(PREFIXED_CLASS_FILES): $(addsuffix .java,$(JAVA_TESTS)) - $(Echo) Compiling $? - $(Verb)mkdir -p Output - $(Verb)$(JAVAC) -classpath Output -d Output $? - $(Verb)touch $@ - -# Compiled bytecode for tests -BYTECODE := $(addsuffix .llvm.bc, $(PREFIXED_JAVA_TESTS)) - -# Output produced by tests -NATIVE_OUTPUT := $(addsuffix .out-nat, $(PREFIXED_JAVA_TESTS)) -JIT_OUTPUT := $(addsuffix .out-jit, $(PREFIXED_JAVA_TESTS)) -LLC_OUTPUT := $(addsuffix .out-llc, $(PREFIXED_JAVA_TESTS)) - -# Diffs of output produced by native and llvm-java runs -JIT_DIFFS := $(addsuffix .diff-jit, $(PREFIXED_JAVA_TESTS)) -LLC_DIFFS := $(addsuffix .diff-llc, $(PREFIXED_JAVA_TESTS)) - -# Keep the output and diffs -.PRECIOUS: %.out-nat %.out-jit %.out-llc %.diff-jit %.diff-llc - -# rule to run a .class file with the jvm -%.out-nat: %.class - -$(Verb)LD_LIBRARY_PATH=$(LibDir) $(JAVA) -cp Output $(notdir $*) \ - > $*.out-nat 2>&1 - -# rule to run a .class file with the llvm jit -%.out-jit: %.llvm.bc - -$(Verb)$(LLI) $< > $*.out-jit 2>&1 - -# rule to run a .class file with llc -%.out-llc: %.llc - -$(Verb)./$< > $*.out-llc 2>&1 - -# rule to diff test output -%.diff-jit: %.out-nat %.out-jit - $(Verb)diff $*.out-nat $*.out-jit > $@ \ - && echo "PASS(jit): $(notdir $*)" \ - || echo "FAIL(jit): $(notdir $*)" - -%.diff-llc: %.out-nat %.out-llc - $(Verb)diff $*.out-nat $*.out-llc > $@ \ - && echo "PASS(llc): $(notdir $*)" \ - || echo "FAIL(llc): $(notdir $*)" - -GCCLD_PASS_ARGS := $(shell $(GCCLD) /dev/null -debug-pass=Arguments 2>&1 | \ - grep 'Pass Arguments' | \ - sed 's/Pass Arguments: //') - -# rules to invoke bugpoint -%.bugpoint.lli: %.llvm.bc %.out-nat - $(LBUGPOINT) $< -run-lli -output=$*.out-nat - -%.bugpoint.llc: %.llvm.bc %.out-nat - $(LBUGPOINT) $< -run-llc -output=$*.out-nat - -%.bugpoint.gccld: %.raw.llvm.bc %.out-nat - $(LBUGPOINT) $< $(GCCLD_PASS_ARGS) -output=$*.out-nat - -all-local:: $(JIT_DIFFS) - -endif
diff --git a/java/test/Programs/Makefile b/java/test/Programs/Makefile deleted file mode 100644 index 781e211..0000000 --- a/java/test/Programs/Makefile +++ /dev/null
@@ -1,13 +0,0 @@ -##===- test/Programs/Makefile ------------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## -LEVEL := ../.. - -PARALLEL_DIRS := SingleSource - -include $(LEVEL)/Makefile.common
diff --git a/java/test/Programs/SingleSource/Makefile b/java/test/Programs/SingleSource/Makefile deleted file mode 100644 index 5416487..0000000 --- a/java/test/Programs/SingleSource/Makefile +++ /dev/null
@@ -1,15 +0,0 @@ -##===- test/Programs/SingleSource/Makefile -----------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## -LEVEL := ../../.. - -PARALLEL_DIRS := UnitTests - -EXTRA_DIST := Makefile.singlesrc - -include $(LEVEL)/Makefile.common
diff --git a/java/test/Programs/SingleSource/Makefile.singlesrc b/java/test/Programs/SingleSource/Makefile.singlesrc deleted file mode 100644 index c071047..0000000 --- a/java/test/Programs/SingleSource/Makefile.singlesrc +++ /dev/null
@@ -1,27 +0,0 @@ -##==-- test/Programs/SingleSource/Makefile.singlesrc -----*- makefile -*--====## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -# rule to build raw bytecode from a classfile -%.raw.bc: %.class $(CLASS2LLVM) - $(Echo) Compiling $< to bytecode - -$(Verb)$(CLASS2LLVM) \ - -cp $(CLASSPATH_JAVA_LIBRARY_PATH):$(CLASSPATH):Output \ - $(subst /,.,$(*F)) -o=$@ - -GCCAS_PASS_ARGS := $(shell \ - $(GCCAS) 2>&1 < /dev/null > /dev/null -debug-pass=Arguments | \ - grep 'Pass Arguments' | \ - sed 's/Pass Arguments: //') - -# rule to run gccas passes on raw bytecode -%.linked.bc: %.raw.bc $(GCCAS) - $(Echo) Optimizing $< - -$(Verb)$(LOPT) $(GCCAS_PASS_ARGS) -f -o=$@ $< - -include $(LEVEL)/test/Makefile.test
diff --git a/java/test/Programs/SingleSource/UnitTests/AbstractCall.java b/java/test/Programs/SingleSource/UnitTests/AbstractCall.java deleted file mode 100644 index 12ec869..0000000 --- a/java/test/Programs/SingleSource/UnitTests/AbstractCall.java +++ /dev/null
@@ -1,17 +0,0 @@ -public class AbstractCall -{ - private static abstract class Abstract { - abstract int abstractMethod(); - - int concreteMethod() { return abstractMethod(); } - } - - private static class Concrete extends Abstract { - int abstractMethod() { return 5; } - } - - public static void main(String[] args) { - Abstract a = new Concrete(); - Test.println(a.concreteMethod()); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/AbstractClassDoesNotImplementInterface.java b/java/test/Programs/SingleSource/UnitTests/AbstractClassDoesNotImplementInterface.java deleted file mode 100644 index 5df3ffb..0000000 --- a/java/test/Programs/SingleSource/UnitTests/AbstractClassDoesNotImplementInterface.java +++ /dev/null
@@ -1,19 +0,0 @@ -public class AbstractClassDoesNotImplementInterface { - - private static interface Interface { - public void iMethod(); - } - - private static abstract class Abstract implements Interface { - - } - - private static class Concrete extends Abstract { - public void iMethod() { Test.println(12345); } - } - - public static void main(String[] args) { - Interface i = new Concrete(); - i.iMethod(); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Arithm.java b/java/test/Programs/SingleSource/UnitTests/Arithm.java deleted file mode 100644 index aac7ed5..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Arithm.java +++ /dev/null
@@ -1,19 +0,0 @@ -public class Arithm -{ - public static void main(String[] args) { - int i = 53; - - i += 53; - i *= 53; - i -= 53; - i >>= 3; - i /= 53; - i %= 53; - i = -i; - i <<= 3; - i |= 53; - i ^= 35; - i &= 53; - Test.println(i); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Array.java b/java/test/Programs/SingleSource/UnitTests/Array.java deleted file mode 100644 index cada4cf..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Array.java +++ /dev/null
@@ -1,20 +0,0 @@ -public class Array -{ - public static void main(String[] args) { - int[] intArray = new int[10]; - - for (int i = 0, e = intArray.length; i != e; ++i) - intArray[i] = intArray.length - i; - - Util.printlnElements(intArray); - - - Object[] objectArray = new Object[10]; - - for (int i = 0, e = objectArray.length; i != e; ++i) - objectArray[i] = intArray; - - intArray = (int[]) objectArray[4]; - Util.printlnElements(intArray); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/ArrayCopy.java b/java/test/Programs/SingleSource/UnitTests/ArrayCopy.java deleted file mode 100644 index a8c9d2e..0000000 --- a/java/test/Programs/SingleSource/UnitTests/ArrayCopy.java +++ /dev/null
@@ -1,60 +0,0 @@ -import java.util.*; - -public class ArrayCopy -{ - public static Random rand = new Random(0); - - public static int min(int a, int b) { - return a < b ? a : b; - } - - public static void fillArray(Object dst, int dstLength, Object src, int srcLength) { - for (int i = 0; i < dstLength; i += srcLength) - System.arraycopy(src, 0, dst, i, min(dstLength - i, srcLength)); - } - - public static void main(String[] args) { - int[] isrc = new int[10]; - byte[] bsrc = new byte[10]; - float[] fsrc = new float[10]; - double[] dsrc = new double[10]; - boolean[] zsrc = new boolean[10]; - long[] lsrc = new long[10]; - Object[] osrc = new Object[10]; - - for (int i = 0; i < 10; ++i) { - isrc[i] = rand.nextInt(); - bsrc[i] = (byte) rand.nextInt(); - fsrc[i] = rand.nextFloat(); - dsrc[i] = rand.nextDouble(); - zsrc[i] = rand.nextBoolean(); - lsrc[i] = rand.nextLong(); - osrc[i] = new Integer(rand.nextInt()); - } - - int[] idst = new int[7]; - byte[] bdst = new byte[19]; - float[] fdst = new float[28]; - double[] ddst = new double[23]; - boolean[] zdst = new boolean[17]; - long[] ldst = new long[6]; - Object[] odst = new Object[22]; - - fillArray(idst, idst.length, isrc, isrc.length); - fillArray(bdst, bdst.length, bsrc, bsrc.length); - fillArray(fdst, fdst.length, fsrc, fsrc.length); - fillArray(ddst, ddst.length, dsrc, dsrc.length); - fillArray(zdst, zdst.length, zsrc, zsrc.length); - fillArray(ldst, ldst.length, lsrc, lsrc.length); - fillArray(odst, odst.length, osrc, osrc.length); - - Util.printlnElements(idst); - Util.printlnElements(bdst); - Util.printlnElements(fdst); - Util.printlnElements(ddst); - Util.printlnElements(zdst); - Util.printlnElements(ldst); - for (int i = 0; i < odst.length; ++i) - Test.println(((Integer)odst[i]).intValue()); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/ArrayCopyOverlap.java b/java/test/Programs/SingleSource/UnitTests/ArrayCopyOverlap.java deleted file mode 100644 index 0839375..0000000 --- a/java/test/Programs/SingleSource/UnitTests/ArrayCopyOverlap.java +++ /dev/null
@@ -1,18 +0,0 @@ -import java.util.*; - -public class ArrayCopyOverlap -{ - public static Random rand = new Random(0); - - public static void main(String[] args) { - byte[] array = new byte[100]; - - for (int i = 0; i < array.length; ++i) { - array[i] = (byte) rand.nextInt(); - } - - System.arraycopy(array, 0, array, 23, 59); - - Util.printlnElements(array); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/ArrayInstanceOf.java b/java/test/Programs/SingleSource/UnitTests/ArrayInstanceOf.java deleted file mode 100644 index 146fd66..0000000 --- a/java/test/Programs/SingleSource/UnitTests/ArrayInstanceOf.java +++ /dev/null
@@ -1,47 +0,0 @@ -public class ArrayInstanceOf -{ - private static class Base - { - int foo() { return 0; } - int bar() { return 0; } - } - - interface Interface - { - public int baz(); - } - - private static class Derived extends Base implements Interface - { - int foo() { return 1; } - public int baz() { return foo(); } - - } - - public static void main(String[] args) { - Object o = new Object[10]; - Object b = new Base[10]; - Object d = new Derived[10]; - Object i = new Interface[10]; - - Test.println(o instanceof Object[]); - Test.println(o instanceof Base[]); - Test.println(o instanceof Interface[]); - Test.println(o instanceof Derived[]); - - Test.println(b instanceof Object[]); - Test.println(b instanceof Base[]); - Test.println(b instanceof Interface[]); - Test.println(b instanceof Derived[]); - - Test.println(d instanceof Object[]); - Test.println(d instanceof Base[]); - Test.println(d instanceof Interface[]); - Test.println(d instanceof Derived[]); - - Test.println(i instanceof Object[]); - Test.println(i instanceof Base[]); - Test.println(i instanceof Interface[]); - Test.println(i instanceof Derived[]); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/BigConstants.java b/java/test/Programs/SingleSource/UnitTests/BigConstants.java deleted file mode 100644 index 09d7647..0000000 --- a/java/test/Programs/SingleSource/UnitTests/BigConstants.java +++ /dev/null
@@ -1,14 +0,0 @@ -public class BigConstants -{ - public static void main(String[] args) { - int i = 1234567890; - long l = 1234567890123456789L; - float f = -1.23456789e10F; - double d = 1.23456789e100; - - Test.println(i); - Test.println(l); - Test.println(f); - Test.println(d); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Call.java b/java/test/Programs/SingleSource/UnitTests/Call.java deleted file mode 100644 index 35dc071..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Call.java +++ /dev/null
@@ -1,26 +0,0 @@ -public class Call -{ - interface Interface { - public int i1(); - } - - private static abstract class Abstract { - protected abstract int a1(); - public int c1() { return a1() * a2(); } - protected abstract int a2(); - } - - private static class Concrete extends Abstract implements Interface { - private int i; - - Concrete(int i) { this.i = i; } - public int a1() { return i; } - public int a2() { return i + i; } - public int i1() { return c1(); } - } - - public static void main(String[] args) { - Interface i = new Concrete(10); - Test.println(i.i1()); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Collections.java b/java/test/Programs/SingleSource/UnitTests/Collections.java deleted file mode 100644 index 7aa0c73..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Collections.java +++ /dev/null
@@ -1,33 +0,0 @@ -import java.util.*; - -public class Collections -{ - public static Random rand = new Random(0); - - public static void addRandomIntsToCollection(Collection c) { - int size = rand.nextInt(45) + 5; - for (int i = 0; i < size; ++i) - c.add(new Integer(rand.nextInt())); - } - - public static void printIntCollection(Collection c) { - for (Iterator i = c.iterator(); i.hasNext(); ) - Test.println(((Integer)i.next()).intValue()); - } - - public static void main(String[] args) { - Collection c1 = new TreeSet(); - addRandomIntsToCollection(c1); - Collection c2 = new TreeSet(c1); - - Test.println(c1.remove(new Integer(5))); - Test.println(c1.equals(c2)); - Test.println(c2.remove(new Integer(5))); - Test.println(c1.equals(c2)); - - Test.println(c1.remove(new Integer(5))); - Test.println(c1.equals(c2)); - Test.println(c2.remove(new Integer(5))); - Test.println(c1.equals(c2)); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Collections1.java b/java/test/Programs/SingleSource/UnitTests/Collections1.java deleted file mode 100644 index 0e13a2e..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Collections1.java +++ /dev/null
@@ -1,10 +0,0 @@ -import java.util.*; - -public class Collections1 -{ - public static void main(String[] args) { - Collection c1 = new LinkedList(); - Collections.addRandomIntsToCollection(c1); - Collections.printIntCollection(c1); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Collections2.java b/java/test/Programs/SingleSource/UnitTests/Collections2.java deleted file mode 100644 index 40f145d..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Collections2.java +++ /dev/null
@@ -1,10 +0,0 @@ -import java.util.*; - -public class Collections2 -{ - public static void main(String[] args) { - Collection c1 = new TreeSet(); - Collections.addRandomIntsToCollection(c1); - Collections.printIntCollection(c1); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Collections3.java b/java/test/Programs/SingleSource/UnitTests/Collections3.java deleted file mode 100644 index 837d15a..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Collections3.java +++ /dev/null
@@ -1,10 +0,0 @@ -import java.util.*; - -public class Collections3 -{ - public static void main(String[] args) { - Collection c1 = new ArrayList(); - Collections.addRandomIntsToCollection(c1); - Collections.printIntCollection(c1); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Collections4.java b/java/test/Programs/SingleSource/UnitTests/Collections4.java deleted file mode 100644 index 933fcaf..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Collections4.java +++ /dev/null
@@ -1,20 +0,0 @@ -import java.util.*; - -public class Collections4 -{ - public static void main(String[] args) { - Collection c1 = new ArrayList(); - Collections.addRandomIntsToCollection(c1); - Collection c2 = new TreeSet(c1); - Collection c3 = new LinkedList(); - Collections.addRandomIntsToCollection(c3); - Test.println(c1.containsAll(c2)); - Test.println(c1.containsAll(c3)); - Collections.addRandomIntsToCollection(c1); - Test.println(c1.containsAll(c2)); - Test.println(c1.containsAll(c3)); - Collections.printIntCollection(c1); - Collections.printIntCollection(c2); - Collections.printIntCollection(c3); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Collections5.java b/java/test/Programs/SingleSource/UnitTests/Collections5.java deleted file mode 100644 index 96fb430..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Collections5.java +++ /dev/null
@@ -1,20 +0,0 @@ -import java.util.*; - -public class Collections5 -{ - public static void testList(List l) { - Collections.addRandomIntsToCollection(l); - Collections.printIntCollection(l); - java.util.Collections.rotate(l, Collections.rand.nextInt(50000)); - Collections.printIntCollection(l); - java.util.Collections.shuffle(l, Collections.rand); - Collections.printIntCollection(l); - java.util.Collections.sort(l); - Collections.printIntCollection(l); - } - - public static void main(String[] args) { - testList(new LinkedList()); - testList(new ArrayList()); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Equals.java b/java/test/Programs/SingleSource/UnitTests/Equals.java deleted file mode 100644 index 3644ae9..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Equals.java +++ /dev/null
@@ -1,20 +0,0 @@ -public class Equals -{ - public static void main(String[] args) { - Object i1 = new Integer(123); - Object i2 = new Integer(123); - Object i3 = new Long(123); - - Test.println(i1.equals(i1)); - Test.println(i1 == i1); - - Test.println(i1.equals(i2)); - Test.println(i1 == i2); - - Test.println(i1.equals(i3)); - Test.println(i1 == i3); - - Test.println(i1.equals(new Integer(123))); - Test.println(i1 == new Integer(123)); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/FieldAccess.java b/java/test/Programs/SingleSource/UnitTests/FieldAccess.java deleted file mode 100644 index 77e5822..0000000 --- a/java/test/Programs/SingleSource/UnitTests/FieldAccess.java +++ /dev/null
@@ -1,27 +0,0 @@ -public class FieldAccess -{ - private static class Base { - int i = 1; - float f = 1.0F; - } - - private static class Derived extends Base { - int i = -1; - double d = -1.0; - } - - public static void main(String[] args) { - Derived b = new Derived(); - b.d = 4.0; - b.i = 3; - b.f = 2.0F; - ((Base) b).i = 4; - ((Base) b).f = 1.0F; - - Test.println(((Base)b).i); - Test.println(b.i); - Test.println(((Base)b).f); - Test.println(b.f); - Test.println(b.d); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/FloatCompare.java b/java/test/Programs/SingleSource/UnitTests/FloatCompare.java deleted file mode 100644 index 1fbbe66..0000000 --- a/java/test/Programs/SingleSource/UnitTests/FloatCompare.java +++ /dev/null
@@ -1,35 +0,0 @@ -public class FloatCompare -{ - private static float[] doubles = - new float[]{ -1.0f, 0.0f, -0.0f, 1.0f, - Float.NaN, - Float.NEGATIVE_INFINITY, - Float.POSITIVE_INFINITY }; - - public static void main(String[] args) { - int greater = 0; - int equal = 0; - int less = 0; - int unordered = 0; - - for (int i = 0; i < doubles.length; ++i) { - double a = doubles[i]; - for (int j = 0; j < doubles.length; ++j) { - double b = doubles[j]; - if (a > b) - ++greater; - else if (a < b) - ++less; - else if (a == b) - ++equal; - else - ++unordered; - } - } - - Test.println(greater); - Test.println(equal); - Test.println(less); - Test.println(unordered); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/ForLoop.java b/java/test/Programs/SingleSource/UnitTests/ForLoop.java deleted file mode 100644 index 492912f..0000000 --- a/java/test/Programs/SingleSource/UnitTests/ForLoop.java +++ /dev/null
@@ -1,10 +0,0 @@ -public class ForLoop -{ - public static void main(String[] args) { - int sum = 0; - for (int i = 0; i < 100; ++i) - sum += i; - - Test.println(sum); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/If.java b/java/test/Programs/SingleSource/UnitTests/If.java deleted file mode 100644 index 595549f..0000000 --- a/java/test/Programs/SingleSource/UnitTests/If.java +++ /dev/null
@@ -1,14 +0,0 @@ -public class If -{ - private static boolean isZero(int i) { - return i == 0; - } - - public static void main(String[] args) { - int i = 0; - if (isZero(i)) - Test.println(0); - else - Test.println(1); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/InnerClass.java b/java/test/Programs/SingleSource/UnitTests/InnerClass.java deleted file mode 100644 index dedc6b2..0000000 --- a/java/test/Programs/SingleSource/UnitTests/InnerClass.java +++ /dev/null
@@ -1,34 +0,0 @@ -public class InnerClass -{ - private int i = 1024; - private boolean b = true; - - public int i1() { return i; } - public boolean b1() { return b; } - - InnerClassInner getInner() { - return new InnerClassInner(); - } - - public class InnerClassInner { - private int i = 512; - private boolean b = false; - - public int ii1() { return i1(); } - public int ii2() { return i; } - public boolean bb1() { return b1(); } - public boolean bb2() { return b; } - } - - public static void main(String[] args) { - InnerClass i = new InnerClass(); - Test.println(i.i1()); - Test.println(i.b1()); - - InnerClassInner ii = i.getInner(); - Test.println(ii.ii1()); - Test.println(ii.bb1()); - Test.println(ii.ii2()); - Test.println(ii.bb2()); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/InstanceOf.java b/java/test/Programs/SingleSource/UnitTests/InstanceOf.java deleted file mode 100644 index 6458df4..0000000 --- a/java/test/Programs/SingleSource/UnitTests/InstanceOf.java +++ /dev/null
@@ -1,38 +0,0 @@ -public class InstanceOf -{ - private static class Base - { - int foo() { return 0; } - int bar() { return 0; } - } - - interface Interface - { - public int baz(); - } - - private static class Derived extends Base implements Interface - { - int foo() { return 1; } - public int baz() { return foo(); } - - } - - public static void main(String[] args) { - Base aa = new Base(); - Base ab = new Derived(); - Interface bb = new Derived(); - - Test.println(aa instanceof Base); - Test.println(aa instanceof Derived); - Test.println(aa instanceof Interface); - - Test.println(ab instanceof Base); - Test.println(ab instanceof Derived); - Test.println(ab instanceof Interface); - - Test.println(bb instanceof Base); - Test.println(bb instanceof Derived); - Test.println(bb instanceof Interface); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/InterfaceCall.java b/java/test/Programs/SingleSource/UnitTests/InterfaceCall.java deleted file mode 100644 index 2500a7a..0000000 --- a/java/test/Programs/SingleSource/UnitTests/InterfaceCall.java +++ /dev/null
@@ -1,27 +0,0 @@ -public class InterfaceCall -{ - private static class Base implements Interface - { - public int foo() { return 1; } - public int bar() { return 2; } - } - - private static class Derived extends Base - { - public int foo() { return 100; } - public int bar() { return super.bar() + super.foo(); } - } - - interface Interface - { - public int bar(); - } - - public static void main(String[] args) { - Interface i = new Base(); - Test.println(i.bar()); - - i = new Derived(); - Test.println(i.bar()); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/InterfaceStaticInitializers.java b/java/test/Programs/SingleSource/UnitTests/InterfaceStaticInitializers.java deleted file mode 100644 index 773b036..0000000 --- a/java/test/Programs/SingleSource/UnitTests/InterfaceStaticInitializers.java +++ /dev/null
@@ -1,12 +0,0 @@ -public class InterfaceStaticInitializers -{ - public static class I1 { - public static int i1 = 1; - public static int i2 = 2; - } - - public static void main(String[] args) { - Test.println(I1.i1); - Test.println(I1.i2); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Lists.java b/java/test/Programs/SingleSource/UnitTests/Lists.java deleted file mode 100644 index 0d80087..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Lists.java +++ /dev/null
@@ -1,16 +0,0 @@ -import java.util.*; - -public class Lists -{ - public static void main(String[] args) { - LinkedList llist = new LinkedList(); - for (int i = 0; i < 10; ++i) { - llist.add(new Integer(i)); - } - - while (!llist.isEmpty()) { - Integer I = (Integer) llist.removeFirst(); - Test.println(I.intValue()); - } - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Lists1.java b/java/test/Programs/SingleSource/UnitTests/Lists1.java deleted file mode 100644 index 1556dec..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Lists1.java +++ /dev/null
@@ -1,22 +0,0 @@ -import java.util.*; - -public class Lists1 -{ - public static void main(String[] args) { - List list = new LinkedList(); - for (int i = 0; i < 17; ++i) { - list.add(new Integer(i)); - } - - Test.println(list.isEmpty()); - Object[] array = list.toArray(); - - for (int i = 0; i < array.length; ++i) { - Test.println(((Integer) array[i]).equals(list.get(i))); - } - - list.clear(); - - Test.println(list.isEmpty()); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Lists2.java b/java/test/Programs/SingleSource/UnitTests/Lists2.java deleted file mode 100644 index de9c5e5..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Lists2.java +++ /dev/null
@@ -1,20 +0,0 @@ -import java.util.*; - -public class Lists2 -{ - public static void main(String[] args) { - List llist = new LinkedList(); - Test.println(llist.isEmpty()); - - for (int i = 0; i < 10; ++i) { - llist.add(new Integer(i)); - } - Test.println(llist.isEmpty()); - - while (!llist.isEmpty()) { - Integer I = (Integer) llist.remove(0); - Test.println(I.intValue()); - } - Test.println(llist.isEmpty()); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Lists3.java b/java/test/Programs/SingleSource/UnitTests/Lists3.java deleted file mode 100644 index 6f8d2ea..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Lists3.java +++ /dev/null
@@ -1,25 +0,0 @@ -import java.util.*; - -public class Lists3 -{ - public static void main(String[] args) { - LinkedList llist = new LinkedList(); - for (int i = 0; i < 10; ++i) { - llist.add(new Integer(i)); - } - - Test.println(llist.contains(new Integer(5))); - Test.println(llist.getFirst().equals(new Integer(0))); - Test.println(llist.getLast().equals(new Integer(9))); - Test.println(llist.indexOf(new Integer(3))); - Test.println(llist.remove(new Integer(3))); - Test.println(llist.indexOf(new Integer(3))); - Test.println(((Integer)llist.removeFirst()).intValue()); - Test.println(((Integer)llist.removeLast()).intValue()); - Test.println(llist.size()); - - for (int i = 0; i < llist.size(); ++i) { - Test.println(((Integer)llist.get(i)).intValue()); - } - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Lists4.java b/java/test/Programs/SingleSource/UnitTests/Lists4.java deleted file mode 100644 index 5bea3df..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Lists4.java +++ /dev/null
@@ -1,12 +0,0 @@ -import java.util.*; - -public class Lists4 -{ - public static void main(String[] args) { - LinkedList llist = new LinkedList(); - llist.add(null); - Test.println(llist.getFirst() == null); - Test.println(llist.contains(null)); - Test.println(llist.get(0) == null); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Lists5.java b/java/test/Programs/SingleSource/UnitTests/Lists5.java deleted file mode 100644 index ab508fc..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Lists5.java +++ /dev/null
@@ -1,10 +0,0 @@ -import java.util.*; - -public class Lists5 -{ - public static void main(String[] args) { - LinkedList llist = new LinkedList(); - Iterator i = llist.iterator(); - Test.println(i.hasNext()); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Lists6.java b/java/test/Programs/SingleSource/UnitTests/Lists6.java deleted file mode 100644 index 5b6d952..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Lists6.java +++ /dev/null
@@ -1,16 +0,0 @@ -import java.util.*; - -public class Lists6 -{ - public static void main(String[] args) { - List llist = new ArrayList(); - for (int i = 0; i < 15; ++i) { - llist.add(new Integer(i)); - } - - for (Iterator i = llist.iterator(); i.hasNext(); ) { - Integer I = (Integer) i.next(); - Test.println(I.intValue()); - } - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/LongCompare.java b/java/test/Programs/SingleSource/UnitTests/LongCompare.java deleted file mode 100644 index 93c2ff4..0000000 --- a/java/test/Programs/SingleSource/UnitTests/LongCompare.java +++ /dev/null
@@ -1,11 +0,0 @@ -public class LongCompare -{ - public static void main(String[] args) { - long l1 = 123456789123456789L; - long l2 = 987654321987654321L; - - Test.println(l1); - Test.println(l2); - Test.println(l1 == l2); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/LookupSwitch.java b/java/test/Programs/SingleSource/UnitTests/LookupSwitch.java deleted file mode 100644 index 1a2cb0e..0000000 --- a/java/test/Programs/SingleSource/UnitTests/LookupSwitch.java +++ /dev/null
@@ -1,11 +0,0 @@ -public class LookupSwitch -{ - public static void main(String[] args) { - switch (128) { - case 0: Test.println(255); - case 128: Test.println(128); - case 255: Test.println(0); - default: Test.println(-1); - } - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Makefile b/java/test/Programs/SingleSource/UnitTests/Makefile deleted file mode 100644 index 8c85dda..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Makefile +++ /dev/null
@@ -1,31 +0,0 @@ -##===- test/Programs/SingleSource/UnitTests/Makefile -------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## -LEVEL := ../../../.. - -CPPFLAGS+=-I$(PROJ_SRC_ROOT)/include/llvm/Java -BYTECODE_LIBRARY=1 -SHARED_LIBRARY=1 -LIBRARYNAME=test -BUILT_SOURCES = Test.h - -include $(LEVEL)/Makefile.common - -EXTRA_OBJS = $(LibName.BCA) - -BUILD_JAVA_SOURCES=1 - -include ../Makefile.singlesrc - -Test.h: Output/Test.class - $(Verb)$(Echo) Creating JNI header for class $(basename $(notdir $<)) - $(Verb)$(RM) -f $@ - $(Verb)$(JAVAH) -classpath Output Test - -clean:: - $(Verb)rm -f Test.h
diff --git a/java/test/Programs/SingleSource/UnitTests/Maps.java b/java/test/Programs/SingleSource/UnitTests/Maps.java deleted file mode 100644 index 8a2a5a4..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Maps.java +++ /dev/null
@@ -1,25 +0,0 @@ -import java.util.*; - -public class Maps -{ - public static Random rand = new Random(0); - - public static void fillMapWithRandomInts(Map m) { - int size = rand.nextInt(45) + 5; - for (int i = 0; i < size; ++i) - m.put(new Integer(i), new Integer(rand.nextInt())); - } - - public static void printIntMap(Map m) { - for (int i = 0; i < m.size(); ++i) { - Integer I = (Integer) m.get(new Integer(i)); - Test.println(I.intValue()); - } - } - - public static void main(String[] args) { - TreeMap map = new TreeMap(); - fillMapWithRandomInts(map); - printIntMap(map); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Maps1.java b/java/test/Programs/SingleSource/UnitTests/Maps1.java deleted file mode 100644 index d7c1025..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Maps1.java +++ /dev/null
@@ -1,12 +0,0 @@ -import java.util.*; - -public class Maps1 -{ - public static Random rand = new Random(0); - - public static void main(String[] args) { - HashMap map = new HashMap(); - Maps.fillMapWithRandomInts(map); - Maps.printIntMap(map); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/MultiArray.java b/java/test/Programs/SingleSource/UnitTests/MultiArray.java deleted file mode 100644 index aacaf6e..0000000 --- a/java/test/Programs/SingleSource/UnitTests/MultiArray.java +++ /dev/null
@@ -1,14 +0,0 @@ -public class MultiArray -{ - public static void main(String[] args) { - int[][] intArray = new int[10][10]; - - for (int i = 0; i != intArray.length; ++i) - for (int j = 0; j != intArray[i].length; ++j) - intArray[i][j] = (j+1) * (i+1); - - for (int i = 0; i != intArray.length; ++i) - for (int j = 0; j != intArray[i].length; ++j) - Test.println(intArray[i][j]); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/MultipleInterfaces.java b/java/test/Programs/SingleSource/UnitTests/MultipleInterfaces.java deleted file mode 100644 index cbe3425..0000000 --- a/java/test/Programs/SingleSource/UnitTests/MultipleInterfaces.java +++ /dev/null
@@ -1,43 +0,0 @@ -public class MultipleInterfaces -{ - interface I1 - { - public boolean i1(); - } - - interface I2 - { - public int i2(); - } - - interface I3 extends I1, I2 - { - public float i3(); - } - - private static class C1 implements I3 - { - public boolean i1() { return true; } - public int i2() { return 2; } - public float i3() { return 3.0F; } - } - - public static void main(String[] args) { - C1 o = new C1(); - I1 i1 = o; - I2 i2 = o; - I3 i3 = o; - - Test.println(o.i1()); - Test.println(o.i2()); - Test.println(o.i3()); - - Test.println(i1.i1()); - - Test.println(i2.i2()); - - Test.println(i3.i1()); - Test.println(i3.i2()); - Test.println(i3.i3()); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Numbers.java b/java/test/Programs/SingleSource/UnitTests/Numbers.java deleted file mode 100644 index 54615b7..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Numbers.java +++ /dev/null
@@ -1,17 +0,0 @@ -public class Numbers -{ - public static void main(String[] args) { - Number[] numbers = new Number[4]; - - numbers[0] = new Byte((byte)123); - numbers[1] = new Integer(1234567890); - numbers[2] = new Long(1234567890987654321L); - numbers[3] = new Short((short)12345); - - for (int i = 0; i != numbers.length; ++i) { - Number n = numbers[i]; - Test.println(n.longValue()); - Test.println(n.doubleValue()); - } - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/PrivateCall.java b/java/test/Programs/SingleSource/UnitTests/PrivateCall.java deleted file mode 100644 index 8f4bb9a..0000000 --- a/java/test/Programs/SingleSource/UnitTests/PrivateCall.java +++ /dev/null
@@ -1,17 +0,0 @@ -public class PrivateCall -{ - private int a; - - public PrivateCall(int i) { - a = i; - } - - private int foo(int i) { - return i * i / a; - } - - public static void main(String[] args) { - PrivateCall p = new PrivateCall(7); - Test.println(p.foo(123)); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/RandomTest.java b/java/test/Programs/SingleSource/UnitTests/RandomTest.java deleted file mode 100644 index 82393f7..0000000 --- a/java/test/Programs/SingleSource/UnitTests/RandomTest.java +++ /dev/null
@@ -1,11 +0,0 @@ -import java.util.*; - -public class RandomTest -{ - public static Random rand = new Random(0); - - public static void main(String[] args) { - for (int i = 0; i < 1000; ++i) - Test.println(rand.nextInt()); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/StaticInitializers.java b/java/test/Programs/SingleSource/UnitTests/StaticInitializers.java deleted file mode 100644 index 10aac27..0000000 --- a/java/test/Programs/SingleSource/UnitTests/StaticInitializers.java +++ /dev/null
@@ -1,16 +0,0 @@ -public class StaticInitializers -{ - static int foo = 0; - static int bar = init(); - static int baz = init(); - - static int init() { - return ++foo; - } - - public static void main(String[] args) { - Test.println(foo); - Test.println(bar); - Test.println(baz); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Strings.java b/java/test/Programs/SingleSource/UnitTests/Strings.java deleted file mode 100644 index 92b498e..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Strings.java +++ /dev/null
@@ -1,11 +0,0 @@ -public class Strings -{ - public static void main(String[] args) { - String foo = "foo"; - String bar = "bar"; - String foobar = "foobar"; - - Test.println(foobar == foo + bar); - Test.println(foobar.equals(foo + bar)); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/TableSwitch.java b/java/test/Programs/SingleSource/UnitTests/TableSwitch.java deleted file mode 100644 index bb32edb..0000000 --- a/java/test/Programs/SingleSource/UnitTests/TableSwitch.java +++ /dev/null
@@ -1,13 +0,0 @@ -public class TableSwitch -{ - public static void main(String[] args) { - switch (4) { - case 0: Test.println(4); - case 1: Test.println(3); - case 2: Test.println(2); - case 3: Test.println(1); - case 4: Test.println(0); - default: Test.println(-1); - } - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Test.java b/java/test/Programs/SingleSource/UnitTests/Test.java deleted file mode 100644 index 908861b..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Test.java +++ /dev/null
@@ -1,86 +0,0 @@ -public class Test -{ - // Fields to test JNI getFieldID and get<TYPE>Field functions. - public boolean z = false; - public int i = 123; - public long l = 1234567890123456789L; - public float f = 753.46F; - public double d = -46.75346; - public short s = 456; - public byte b = 78; - - // Fields to test JNI getStaticFieldID and getStatic<TYPE>Field functions. - public static boolean Z = true; - public static int I = 321; - public static long L = 1234567890987654321L; - public static float F = 46.753F; - public static double D = -75346.46; - public static short S = 654; - public static byte B = 87; - - // Methods to test JNI getMethodID and call<TYPE>Method functions. - public boolean z() { return z; } - public int i(int ii) { return i + ii; } - public long j(byte bb, short ss) { return l + bb + ss; } - public float f(byte bb) { return f + bb; } - public double d(int ii, long ll) { return d + ii + ll; } - public short s(double dd, byte bb) { return (short) (s + dd + bb); } - public byte b(short ss, float ff) { return (byte)(B + ff + ss); } - - // Methods to test JNI getStaticMethodID and - // callStatic<TYPE>Method functions. - public static boolean Z() { return Z; } - public static int I(int jj) { return I + jj; } - public static long J(byte bb, short ss) { return L + bb + ss; } - public static float F(byte bb) { return F + bb; } - public static double D(int ii, long ll) { return D + ii + ll; } - public static short S(double dd, byte bb) { return (short) (S + dd + bb); } - public static byte B(short ss, float ff) { return (byte)(B + ff + ss); } - - static { - System.loadLibrary("test"); - } - - public static native void println(boolean b); - public static native void println(int i); - public static native void println(long l); - public static native void println(float f); - public static native void println(double d); - public static void println(Object o) { - println(o.toString()); - } - public static void println(String s) { - byte[] bytes = new byte[s.length()]; - s.getBytes(0, s.length(), bytes, 0); - println(bytes); - } - private static native void println(byte[] a); - - public native void printFields(); - public static native void printStaticFields(); - public native void printMethods(); - public static native void printStaticMethods(); - - public static void main(String[] args) { - println(true); - println(false); - println(123); - println(-321); - println(1234567890123456789L); - println(-1234567890123456789L); - println(753.46F); - println(-753.46F); - println(753.46); - println(-753.46); - println(new byte[] { 'H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd' }); - println("Hello world"); - println("Printing static fields:"); - printStaticFields(); - println("Printing member fields:"); - new Test().printFields(); - println("Calling static methods:"); - printStaticMethods(); - println("Calling member methods:"); - new Test().printMethods(); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/Util.java b/java/test/Programs/SingleSource/UnitTests/Util.java deleted file mode 100644 index a949fd8..0000000 --- a/java/test/Programs/SingleSource/UnitTests/Util.java +++ /dev/null
@@ -1,184 +0,0 @@ -import java.util.*; - -public class Util -{ - private static Random rand = new Random(0); - - public static void randomFill(boolean[] a) { - randomFill(a, 0, a.length); - } - - public static void randomFill(boolean[] a, int from, int to) { - for (; from < to; ++from) - a[from] = rand.nextBoolean(); - } - - public static void randomFill(byte[] a) { - randomFill(a, 0, a.length); - } - - public static void randomFill(byte[] a, int from, int to) { - for (; from < to; ++from) - a[from] = (byte) rand.nextInt(); - } - - public static void randomFill(char[] a) { - randomFill(a, 0, a.length); - } - - public static void randomFill(char[] a, int from, int to) { - for (; from < to; ++from) - a[from] = (char) rand.nextInt(); - } - - public static void randomFill(double[] a) { - randomFill(a, 0, a.length); - } - - public static void randomFill(double[] a, int from, int to) { - for (; from < to; ++from) - a[from] = rand.nextDouble(); - } - - public static void randomFill(float[] a) { - randomFill(a, 0, a.length); - } - - public static void randomFill(float[] a, int from, int to) { - for (; from < to; ++from) - a[from] = rand.nextFloat(); - } - - public static void randomFill(int[] a) { - randomFill(a, 0, a.length); - } - - public static void randomFill(int[] a, int from, int to) { - for (; from < to; ++from) - a[from] = rand.nextInt(); - } - - public static void randomFill(long[] a) { - randomFill(a, 0, a.length); - } - - public static void randomFill(long[] a, int from, int to) { - for (; from < to; ++from) - a[from] = rand.nextLong(); - } - - public static void randomFill(short[] a) { - randomFill(a, 0, a.length); - } - - public static void randomFill(short[] a, int from, int to) { - for (; from < to; ++from) - a[from] = (short) rand.nextInt(); - } - - public static void printlnElements(boolean[] a) { - printlnElements(a, 0, a.length); - } - - public static void printlnElements(boolean[] a, int from, int to) { - for (; from < to; ++from) - Test.println(a[from]); - } - - public static void printlnElements(byte[] a) { - printlnElements(a, 0, a.length); - } - - public static void printlnElements(byte[] a, int from, int to) { - for (; from < to; ++from) - Test.println(a[from]); - } - - public static void printlnElements(char[] a) { - printlnElements(a, 0, a.length); - } - - public static void printlnElements(char[] a, int from, int to) { - for (; from < to; ++from) - Test.println(a[from]); - } - - public static void printlnElements(double[] a) { - printlnElements(a, 0, a.length); - } - - public static void printlnElements(double[] a, int from, int to) { - for (; from < to; ++from) - Test.println(a[from]); - } - - public static void printlnElements(float[] a) { - printlnElements(a, 0, a.length); - } - - public static void printlnElements(float[] a, int from, int to) { - for (; from < to; ++from) - Test.println(a[from]); - } - - public static void printlnElements(int[] a) { - printlnElements(a, 0, a.length); - } - - public static void printlnElements(int[] a, int from, int to) { - for (; from < to; ++from) - Test.println(a[from]); - } - - public static void printlnElements(long[] a) { - printlnElements(a, 0, a.length); - } - - public static void printlnElements(long[] a, int from, int to) { - for (; from < to; ++from) - Test.println(a[from]); - } - - public static void printlnElements(short[] a) { - printlnElements(a, 0, a.length); - } - - public static void printlnElements(short[] a, int from, int to) { - for (; from < to; ++from) - Test.println(a[from]); - } - - public static void main(String[] args) { - boolean[] az = new boolean[rand.nextInt(100)]; - randomFill(az); - printlnElements(az); - - byte[] ab = new byte[rand.nextInt(100)]; - randomFill(ab); - printlnElements(ab); - - char[] ac = new char[rand.nextInt(100)]; - randomFill(ac); - printlnElements(ac); - - double[] ad = new double[rand.nextInt(100)]; - randomFill(ad); - printlnElements(ad); - - float[] af = new float[rand.nextInt(100)]; - randomFill(af); - printlnElements(af); - - int[] ai = new int[rand.nextInt(100)]; - randomFill(ai); - printlnElements(ai); - - long[] al = new long[rand.nextInt(100)]; - randomFill(al); - printlnElements(al); - - short[] as = new short[rand.nextInt(100)]; - randomFill(as); - printlnElements(as); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/VTable.java b/java/test/Programs/SingleSource/UnitTests/VTable.java deleted file mode 100644 index 2bbda18..0000000 --- a/java/test/Programs/SingleSource/UnitTests/VTable.java +++ /dev/null
@@ -1,30 +0,0 @@ -class VTableBase -{ - public int foo() { return 0; } - public int bar() { return 1; } -} - -interface VTableInterface -{ - public int baz(); -} - -public class VTable extends VTableBase implements VTableInterface -{ - public int foo() { return 2; } - public int baz() { return 3; } - - public static void main(String[] args) { - VTableBase a = new VTableBase(); - Test.println(a.foo()); - Test.println(a.bar()); - - a = new VTable(); - Test.println(a.foo()); - Test.println(a.bar()); - Test.println(((VTableInterface)a).baz()); - - VTableInterface i = new VTable(); - Test.println(i.baz()); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/VirtualCall.java b/java/test/Programs/SingleSource/UnitTests/VirtualCall.java deleted file mode 100644 index 9e18f9d..0000000 --- a/java/test/Programs/SingleSource/UnitTests/VirtualCall.java +++ /dev/null
@@ -1,37 +0,0 @@ -public class VirtualCall -{ - static class A - { - public void m1() { Test.println(1); m2(); m3(); } - public void m2() { Test.println(2); m3(); } - public void m3() { Test.println(3); } - } - - static class B extends A - { - public void m2() { Test.println(22); } - public void m3() { Test.println(33); } - } - - static class C extends B - { - public void m2() { Test.println(222); m3(); } - } - - public static void main(String[] args) { - A a = new A(); - a.m1(); - a.m2(); - a.m3(); - - a = new B(); - a.m1(); - a.m2(); - a.m3(); - - a = new C(); - a.m1(); - a.m2(); - a.m3(); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/ackermann.java b/java/test/Programs/SingleSource/UnitTests/ackermann.java deleted file mode 100644 index 2fe3ab3..0000000 --- a/java/test/Programs/SingleSource/UnitTests/ackermann.java +++ /dev/null
@@ -1,9 +0,0 @@ -public class ackermann { - public static void main(String[] args) { - Test.println(Ack(3, 10)); - } - public static int Ack(int m, int n) { - return (m == 0) ? (n + 1) : ((n == 0) ? Ack(m-1, 1) : - Ack(m-1, Ack(m, n - 1))); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/ary.java b/java/test/Programs/SingleSource/UnitTests/ary.java deleted file mode 100644 index 86f1f60..0000000 --- a/java/test/Programs/SingleSource/UnitTests/ary.java +++ /dev/null
@@ -1,16 +0,0 @@ -public class ary { - public static void main(String args[]) { - int i, j, k, n = 9000; - int x[] = new int[n]; - int y[] = new int[n]; - - for (i = 0; i < n; i++) - x[i] = i + 1; - for (k = 0; k < 1000; k++ ) - for (j = n-1; j >= 0; j--) - y[j] += x[j]; - - Test.println(y[0]); - Test.println(y[n-1]); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/fibo.java b/java/test/Programs/SingleSource/UnitTests/fibo.java deleted file mode 100644 index 335a42a..0000000 --- a/java/test/Programs/SingleSource/UnitTests/fibo.java +++ /dev/null
@@ -1,10 +0,0 @@ -public class fibo { - public static void main(String args[]) { - int N = 32; - Test.println(fib(N)); - } - public static int fib(int n) { - if (n < 2) return(1); - return( fib(n-2) + fib(n-1) ); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/heapsort.java b/java/test/Programs/SingleSource/UnitTests/heapsort.java deleted file mode 100644 index 7ae87ee..0000000 --- a/java/test/Programs/SingleSource/UnitTests/heapsort.java +++ /dev/null
@@ -1,53 +0,0 @@ -public class heapsort { - - public static final long IM = 139968; - public static final long IA = 3877; - public static final long IC = 29573; - - public static void main(String args[]) { - int N = 100000; - double []ary = new double[N+1]; - for (int i=1; i<=N; i++) { - ary[i] = gen_random(1); - } - heapsort(N, ary); - Test.println(ary[N]); - } - - public static long last = 42; - public static double gen_random(double max) { - return( max * (last = (last * IA + IC) % IM) / IM ); - } - - public static void heapsort(int n, double ra[]) { - int l, j, ir, i; - double rra; - - l = (n >> 1) + 1; - ir = n; - for (;;) { - if (l > 1) { - rra = ra[--l]; - } else { - rra = ra[ir]; - ra[ir] = ra[1]; - if (--ir == 1) { - ra[1] = rra; - return; - } - } - i = l; - j = l << 1; - while (j <= ir) { - if (j < ir && ra[j] < ra[j+1]) { ++j; } - if (rra < ra[j]) { - ra[i] = ra[j]; - j += (i = j); - } else { - j = ir + 1; - } - } - ra[i] = rra; - } - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/methcall.java b/java/test/Programs/SingleSource/UnitTests/methcall.java deleted file mode 100644 index 00e57cc..0000000 --- a/java/test/Programs/SingleSource/UnitTests/methcall.java +++ /dev/null
@@ -1,52 +0,0 @@ -public class methcall { - private static class Toggle { - boolean state = true; - public Toggle(boolean start_state) { - this.state = start_state; - } - public boolean value() { - return(this.state); - } - public Toggle activate() { - this.state = !this.state; - return(this); - } - } - - private static class NthToggle extends Toggle { - int count_max = 0; - int counter = 0; - - public NthToggle(boolean start_state, int max_counter) { - super(start_state); - this.count_max = max_counter; - this.counter = 0; - } - public Toggle activate() { - this.counter += 1; - if (this.counter >= this.count_max) { - this.state = !this.state; - this.counter = 0; - } - return(this); - } - } - - public static void main(String args[]) { - int n = 1000000; - - boolean val = true; - Toggle toggle = new Toggle(val); - for (int i=0; i<n; i++) { - val = toggle.activate().value(); - } - Test.println(val); - - val = true; - NthToggle ntoggle = new NthToggle(true, 3); - for (int i=0; i<n; i++) { - val = ntoggle.activate().value(); - } - Test.println(val); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/nestedloop.java b/java/test/Programs/SingleSource/UnitTests/nestedloop.java deleted file mode 100644 index 61df19e..0000000 --- a/java/test/Programs/SingleSource/UnitTests/nestedloop.java +++ /dev/null
@@ -1,14 +0,0 @@ -public class nestedloop { - public static void main(String args[]) { - int n = 18; - int x = 0; - for (int a=0; a<n; a++) - for (int b=0; b<n; b++) - for (int c=0; c<n; c++) - for (int d=0; d<n; d++) - for (int e=0; e<n; e++) - for (int f=0; f<n; f++) - x++; - Test.println(x); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/objinst.java b/java/test/Programs/SingleSource/UnitTests/objinst.java deleted file mode 100644 index 3be4949..0000000 --- a/java/test/Programs/SingleSource/UnitTests/objinst.java +++ /dev/null
@@ -1,53 +0,0 @@ -public class objinst { - private static class Toggle { - boolean state = true; - public Toggle(boolean start_state) { - this.state = start_state; - } - public boolean value() { - return(this.state); - } - public Toggle activate() { - this.state = !this.state; - return(this); - } - } - - private static class NthToggle extends Toggle { - int count_max = 0; - int counter = 0; - - public NthToggle(boolean start_state, int max_counter) { - super(start_state); - this.count_max = max_counter; - this.counter = 0; - } - public Toggle activate() { - this.counter += 1; - if (this.counter >= this.count_max) { - this.state = !this.state; - this.counter = 0; - } - return(this); - } - } - - public static void main(String args[]) { - int n = 1500000; - Toggle toggle1 = new Toggle(true); - for (int i=0; i<5; i++) { - Test.println(toggle1.activate().value()); - } - for (int i=0; i<n; i++) { - Toggle toggle = new Toggle(true); - } - - NthToggle ntoggle1 = new NthToggle(true, 3); - for (int i=0; i<8; i++) { - Test.println(ntoggle1.activate().value()); - } - for (int i=0; i<n; i++) { - NthToggle toggle = new NthToggle(true, 3); - } - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/random.java b/java/test/Programs/SingleSource/UnitTests/random.java deleted file mode 100644 index b5f83e6..0000000 --- a/java/test/Programs/SingleSource/UnitTests/random.java +++ /dev/null
@@ -1,20 +0,0 @@ -public class random { - - public static final int IM = 139968; - public static final int IA = 3877; - public static final int IC = 29573; - - public static void main(String args[]) { - int N = 900000; - - while (--N > 0) { - gen_random(100); - } - Test.println(gen_random(100)); - } - - public static int last = 42; - public static double gen_random(double max) { - return( max * (last = (last * IA + IC) % IM) / IM ); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/sieve.java b/java/test/Programs/SingleSource/UnitTests/sieve.java deleted file mode 100644 index da1841b..0000000 --- a/java/test/Programs/SingleSource/UnitTests/sieve.java +++ /dev/null
@@ -1,23 +0,0 @@ -public class sieve { - public static void main(String args[]) { - int NUM = 1200; - boolean [] flags = new boolean[8192 + 1]; - int count = 0; - while (NUM-- > 0) { - count = 0; - for (int i=2; i <= 8192; i++) { - flags[i] = true; - } - for (int i=2; i <= 8192; i++) { - if (flags[i]) { - // remove all multiples of prime: i - for (int k=i+i; k <= 8192; k+=i) { - flags[k] = false; - } - count++; - } - } - } - Test.println(count); - } -}
diff --git a/java/test/Programs/SingleSource/UnitTests/takfp.java b/java/test/Programs/SingleSource/UnitTests/takfp.java deleted file mode 100644 index e716ac1..0000000 --- a/java/test/Programs/SingleSource/UnitTests/takfp.java +++ /dev/null
@@ -1,11 +0,0 @@ -public class takfp { - public static void main(String args[]) { - int n = 10; - Test.println( Tak(n*3.0f, n*2.0f, n*1.0f) ); - } - - public static float Tak (float x, float y, float z) { - if (y >= x) return z; - else return Tak(Tak(x-1.0f,y,z), Tak(y-1.0f,z,x), Tak(z-1.0f,x,y)); - } -} \ No newline at end of file
diff --git a/java/test/Programs/SingleSource/UnitTests/test.c b/java/test/Programs/SingleSource/UnitTests/test.c deleted file mode 100644 index 83438f1..0000000 --- a/java/test/Programs/SingleSource/UnitTests/test.c +++ /dev/null
@@ -1,240 +0,0 @@ -#include <stdio.h> - -#include "Test.h" - -void Java_Test_println__Z(JNIEnv *env, jclass clazz, jboolean aBoolean) -{ - if (aBoolean) - puts("true"); - else - puts("false"); -} - -void Java_Test_println__I(JNIEnv *env, jclass clazz, jint aInt) -{ - printf("%d\n", aInt); -} - -void Java_Test_println__J(JNIEnv *env, jclass clazz, jlong aLong) -{ - printf("%Ld\n", aLong); -} - -void Java_Test_println__F(JNIEnv *env, jclass clazz, jfloat aFloat) -{ - printf("%f\n", aFloat); -} - -void Java_Test_println__D(JNIEnv *env, jclass clazz, jdouble aDouble) -{ - printf("%f\n", aDouble); -} - -void Java_Test_println___3B(JNIEnv *env, jclass clazz, jbyteArray array) -{ - jint size = (*env)->GetArrayLength(env, array); - jbyte* elements = (*env)->GetByteArrayElements(env, array, NULL); - printf("%.*s\n", size, elements); - // Since we didn't modify the array there is no point in copying it back - (*env)->ReleaseByteArrayElements(env, array, elements, JNI_ABORT); -} - -void Java_Test_printFields(JNIEnv *env, jobject obj) -{ - jclass classTest; - jclass objClass; - jfieldID id; - jboolean z; - jint i; - jlong l; - jfloat f; - jdouble d; - jshort s; - jbyte b; - - classTest = (*env)->FindClass(env, "Test"); - if (!classTest) - printf("ERROR: Class Test not found!\n"); - - if (!(*env)->IsInstanceOf(env, obj, classTest)) - printf("ERROR: IsInstanceOf\n"); - objClass = (*env)->GetObjectClass(env, obj); - if (!(*env)->IsAssignableFrom(env, objClass, classTest)) - printf("ERROR: IsAssignableFrom\n"); - - id = (*env)->GetFieldID(env, objClass, "z", "Z"); - z = (*env)->GetBooleanField(env, obj, id); - Java_Test_println__Z(env, objClass, z); - - id = (*env)->GetFieldID(env, objClass, "i", "I"); - i = (*env)->GetIntField(env, obj, id); - Java_Test_println__I(env, objClass, i); - - id = (*env)->GetFieldID(env, objClass, "l", "J"); - l = (*env)->GetLongField(env, obj, id); - Java_Test_println__J(env, objClass, l); - - id = (*env)->GetFieldID(env, objClass, "f", "F"); - f = (*env)->GetFloatField(env, obj, id); - Java_Test_println__F(env, objClass, f); - - id = (*env)->GetFieldID(env, objClass, "d", "D"); - d = (*env)->GetDoubleField(env, obj, id); - Java_Test_println__D(env, objClass, d); - - id = (*env)->GetFieldID(env, objClass, "s", "S"); - s = (*env)->GetShortField(env, obj, id); - Java_Test_println__I(env, objClass, s); - - id = (*env)->GetFieldID(env, objClass, "b", "B"); - b = (*env)->GetByteField(env, obj, id); - Java_Test_println__I(env, objClass, b); -} - -void Java_Test_printStaticFields(JNIEnv *env, jclass clazz) -{ - jclass classTest; - jfieldID id; - jboolean z; - jint i; - jlong l; - jfloat f; - jdouble d; - jshort s; - jbyte b; - - classTest = (*env)->FindClass(env, "Test"); - if (!classTest) - printf("ERROR: Class Test not found!\n"); - - if (!(*env)->IsAssignableFrom(env, clazz, classTest)) - printf("ERROR: IsAssignableFrom\n"); - - id = (*env)->GetStaticFieldID(env, clazz, "Z", "Z"); - z = (*env)->GetStaticBooleanField(env, clazz, id); - Java_Test_println__Z(env, clazz, z); - - id = (*env)->GetStaticFieldID(env, clazz, "I", "I"); - i = (*env)->GetStaticIntField(env, clazz, id); - Java_Test_println__I(env, clazz, i); - - id = (*env)->GetStaticFieldID(env, clazz, "L", "J"); - l = (*env)->GetStaticLongField(env, clazz, id); - Java_Test_println__J(env, clazz, l); - - id = (*env)->GetStaticFieldID(env, clazz, "F", "F"); - f = (*env)->GetStaticFloatField(env, clazz, id); - Java_Test_println__F(env, clazz, f); - - id = (*env)->GetStaticFieldID(env, clazz, "D", "D"); - d = (*env)->GetStaticDoubleField(env, clazz, id); - Java_Test_println__D(env, clazz, d); - - id = (*env)->GetStaticFieldID(env, clazz, "S", "S"); - s = (*env)->GetStaticShortField(env, clazz, id); - Java_Test_println__I(env, clazz, s); - - id = (*env)->GetStaticFieldID(env, clazz, "B", "B"); - b = (*env)->GetStaticByteField(env, clazz, id); - Java_Test_println__I(env, clazz, b); -} - -void Java_Test_printMethods(JNIEnv *env, jobject obj) -{ - jclass classTest; - jclass objClass; - jfieldID id; - jboolean z; - jint i; - jlong l; - jfloat f; - jdouble d; - jshort s; - jbyte b; - - classTest = (*env)->FindClass(env, "Test"); - if (!classTest) - printf("ERROR: Class Test not found!\n"); - - if (!(*env)->IsInstanceOf(env, obj, classTest)) - printf("ERROR: IsInstanceOf\n"); - objClass = (*env)->GetObjectClass(env, obj); - if (!(*env)->IsAssignableFrom(env, objClass, classTest)) - printf("ERROR: IsAssignableFrom\n"); - - id = (*env)->GetMethodID(env, objClass, "z", "()Z"); - z = (*env)->CallBooleanMethod(env, obj, id); - Java_Test_println__Z(env, objClass, z); - - id = (*env)->GetMethodID(env, objClass, "i", "(I)I"); - i = (*env)->CallIntMethod(env, obj, id, 2); - Java_Test_println__I(env, objClass, i); - - id = (*env)->GetMethodID(env, objClass, "j", "(BS)J"); - l = (*env)->CallLongMethod(env, obj, id, 23, 45); - Java_Test_println__J(env, objClass, l); - - id = (*env)->GetMethodID(env, objClass, "f", "(B)F"); - f = (*env)->CallFloatMethod(env, obj, id, 123); - Java_Test_println__F(env, objClass, f); - - id = (*env)->GetMethodID(env, objClass, "d", "(IJ)D"); - d = (*env)->CallDoubleMethod(env, obj, id, 654, 123ll); - Java_Test_println__D(env, objClass, d); - - id = (*env)->GetMethodID(env, objClass, "s", "(DB)S"); - s = (*env)->CallShortMethod(env, obj, id, 2.0, 123); - Java_Test_println__I(env, objClass, s); - - id = (*env)->GetMethodID(env, objClass, "b", "(SF)B"); - b = (*env)->CallByteMethod(env, obj, id, 23, -2.0); - Java_Test_println__I(env, objClass, b); -} - -void Java_Test_printStaticMethods(JNIEnv *env, jobject clazz) -{ - jclass classTest; - jfieldID id; - jboolean z; - jint i; - jlong l; - jfloat f; - jdouble d; - jshort s; - jbyte b; - - classTest = (*env)->FindClass(env, "Test"); - if (!classTest) - printf("ERROR: Class Test not found!\n"); - - if (!(*env)->IsAssignableFrom(env, clazz, classTest)) - printf("ERROR: IsAssignableFrom\n"); - - id = (*env)->GetStaticMethodID(env, clazz, "Z", "()Z"); - z = (*env)->CallStaticBooleanMethod(env, clazz, id); - Java_Test_println__Z(env, clazz, z); - - id = (*env)->GetStaticMethodID(env, clazz, "I", "(I)I"); - i = (*env)->CallStaticIntMethod(env, clazz, id, 2); - Java_Test_println__I(env, clazz, i); - - id = (*env)->GetStaticMethodID(env, clazz, "J", "(BS)J"); - l = (*env)->CallStaticLongMethod(env, clazz, id, 23, 45); - Java_Test_println__J(env, clazz, l); - - id = (*env)->GetStaticMethodID(env, clazz, "F", "(B)F"); - f = (*env)->CallStaticFloatMethod(env, clazz, id, 123); - Java_Test_println__F(env, clazz, f); - - id = (*env)->GetStaticMethodID(env, clazz, "D", "(IJ)D"); - d = (*env)->CallStaticDoubleMethod(env, clazz, id, 654, 12354123ll); - Java_Test_println__D(env, clazz, d); - - id = (*env)->GetStaticMethodID(env, clazz, "S", "(DB)S"); - s = (*env)->CallStaticShortMethod(env, clazz, id, 2.0, 123); - Java_Test_println__I(env, clazz, s); - - id = (*env)->GetStaticMethodID(env, clazz, "B", "(SF)B"); - b = (*env)->CallStaticByteMethod(env, clazz, id, 21, -58.0); - Java_Test_println__I(env, clazz, b); -}
diff --git a/java/test/Regression/ClassFile/Catch.java b/java/test/Regression/ClassFile/Catch.java deleted file mode 100644 index b0a417b..0000000 --- a/java/test/Regression/ClassFile/Catch.java +++ /dev/null
@@ -1,16 +0,0 @@ -public class Catch -{ - public static int main(String[] args) { - int i = 0; - - try { - i += 10; - } - catch (Exception e) { - System.err.println("caught exception: " + e); - i += 20; - } - - return i; - } -}
diff --git a/java/test/Regression/ClassFile/Finally.java b/java/test/Regression/ClassFile/Finally.java deleted file mode 100644 index f65e3d5..0000000 --- a/java/test/Regression/ClassFile/Finally.java +++ /dev/null
@@ -1,20 +0,0 @@ -public class Finally -{ - public static int main(String[] args) { - int i = 0; - - try { - i += 10; - } - catch (Exception e) { - System.err.println("caught exception: " + e); - i += 20; - } - finally { - System.err.println("executing finally clause"); - i += 30; - } - - return 0; - } -}
diff --git a/java/test/Regression/ClassFile/Hello.java b/java/test/Regression/ClassFile/Hello.java deleted file mode 100644 index 737a219..0000000 --- a/java/test/Regression/ClassFile/Hello.java +++ /dev/null
@@ -1,8 +0,0 @@ -public class Hello -{ - public static int main(String[] args) { - System.out.println("Hello world"); - return 0; - } -} -
diff --git a/java/test/Regression/ClassFile/Makefile b/java/test/Regression/ClassFile/Makefile deleted file mode 100644 index 7b10fe0..0000000 --- a/java/test/Regression/ClassFile/Makefile +++ /dev/null
@@ -1,13 +0,0 @@ -##===- test/Regression/ClassFile/Makefile ------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## -LEVEL := ../../.. - -JAVAFILES := $(wildcard *.java) - -include $(LEVEL)/test/Makefile.test
diff --git a/java/test/Regression/ClassFile/Simple.java b/java/test/Regression/ClassFile/Simple.java deleted file mode 100644 index 370f0d4..0000000 --- a/java/test/Regression/ClassFile/Simple.java +++ /dev/null
@@ -1,6 +0,0 @@ -public class Simple -{ - public static int main(String[] args) { - return 0; - } -}
diff --git a/java/test/Regression/Makefile b/java/test/Regression/Makefile deleted file mode 100644 index 58520dd..0000000 --- a/java/test/Regression/Makefile +++ /dev/null
@@ -1,13 +0,0 @@ -##===- test/Regression/Makefile ----------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## -LEVEL := ../.. - -PARALLEL_DIRS := ClassFile - -include $(LEVEL)/test/Makefile.test
diff --git a/java/tools/Makefile b/java/tools/Makefile deleted file mode 100755 index a5d15b6..0000000 --- a/java/tools/Makefile +++ /dev/null
@@ -1,13 +0,0 @@ -##===- tools/Makefile --------------------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## -LEVEL := .. - -PARALLEL_DIRS := classdump class2llvm - -include $(LEVEL)/Makefile.common
diff --git a/java/tools/class2llvm/Makefile b/java/tools/class2llvm/Makefile deleted file mode 100644 index abbca4f..0000000 --- a/java/tools/class2llvm/Makefile +++ /dev/null
@@ -1,16 +0,0 @@ -#===- tools/class2llvm/Makefile ----------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## -LEVEL := ../.. - -TOOLNAME := class2llvm - -USEDLIBS := LLVMJavaCompiler.a LLVMJavaClassfile.a -LLVMLIBS := LLVMBCWriter LLVMCore LLVMSupport.a LLVMbzip2 LLVMSystem.a - -include $(LEVEL)/Makefile.common
diff --git a/java/tools/class2llvm/class2llvm.cpp b/java/tools/class2llvm/class2llvm.cpp deleted file mode 100644 index 5e5d1a6..0000000 --- a/java/tools/class2llvm/class2llvm.cpp +++ /dev/null
@@ -1,65 +0,0 @@ -//===-- class2llvm.cpp - class2llvm utility ---------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This is a sample class reader driver. It is used to drive class -// reader tests. -// -//===----------------------------------------------------------------------===// - -#include <llvm/Java/ClassFile.h> -#include <llvm/Java/Compiler.h> -#include <llvm/PassManager.h> -#include <llvm/Analysis/Verifier.h> -#include <llvm/Bytecode/WriteBytecodePass.h> -#include <llvm/Support/CommandLine.h> -#include <llvm/System/Signals.h> - -#include <cstddef> -#include <fstream> -#include <iostream> - -using namespace llvm; - -static cl::opt<std::string> -InputClass(cl::Positional, cl::desc("<input class>")); - -static cl::opt<std::string> -OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename")); - -int main(int argc, char* argv[]) -{ - sys::PrintStackTraceOnErrorSignal(); - cl::ParseCommandLineOptions(argc, argv, - "classfile to llvm utility"); - - std::ostream* out = &std::cout; - if (!OutputFilename.empty()) { - sys::RemoveFileOnSignal(sys::Path(OutputFilename)); - out = new std::ofstream(OutputFilename.c_str()); - } - - try { - std::auto_ptr<Module> module = Java::compile(InputClass); - - PassManager passes; - passes.add(createVerifierPass()); - passes.add(new WriteBytecodePass(out)); - passes.run(*module); - } - catch (std::exception& e) { - std::cerr << e.what() << '\n'; - sys::Path(OutputFilename).eraseFromDisk(); - return EXIT_FAILURE; - } - - if (!OutputFilename.empty()) - delete out; - - return EXIT_SUCCESS; -}
diff --git a/java/tools/classdump/Makefile b/java/tools/classdump/Makefile deleted file mode 100755 index 576fe65..0000000 --- a/java/tools/classdump/Makefile +++ /dev/null
@@ -1,16 +0,0 @@ -#===- tools/classdump/Makefile -----------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## -LEVEL := ../.. - -TOOLNAME := classdump - -USEDLIBS := LLVMJavaClassfile.a -LLVMLIBS := LLVMCore LLVMSupport.a LLVMbzip2 LLVMSystem.a - -include $(LEVEL)/Makefile.common
diff --git a/java/tools/classdump/classdump.cpp b/java/tools/classdump/classdump.cpp deleted file mode 100644 index e65ef44..0000000 --- a/java/tools/classdump/classdump.cpp +++ /dev/null
@@ -1,683 +0,0 @@ -//===-- classdump.cpp - classdump utility -----------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This is a sample class reader driver. It is used to drive class -// reader tests. -// -//===----------------------------------------------------------------------===// - -#include <llvm/Java/ClassFile.h> -#include <llvm/Java/BytecodeParser.h> -#include <llvm/Support/CommandLine.h> -#include <llvm/System/Signals.h> - -#include <cstddef> -#include <iostream> - -using namespace llvm; - -namespace { - - enum DumpType { code, constantPool }; - - cl::opt<std::string> - InputClass(cl::Positional, cl::desc("<input class>")); - - cl::opt<DumpType> - DumpMode( - "dumptype", - cl::desc("Dump type: (default = code)"), - cl::Prefix, - cl::values( - clEnumVal(code, "code"), - clEnumVal(constantPool, "constant pool"), - clEnumValEnd), - cl::init(code)); - - using namespace llvm::Java; - - class ClassDump : public BytecodeParser<ClassDump> { - const ClassFile* CF; - std::ostream& Out; - - public: - ClassDump(const ClassFile* cf, std::ostream& out) - : CF(cf), Out(out) { - - if (CF->isPublic()) - Out << "public "; - if (CF->isFinal()) - Out << "final "; - - Out << "class " << CF->getThisClass()->getName()->str() << ' '; - - if (ConstantClass* super = CF->getSuperClass()) - Out << "extends " << super->getName()->str() << ' '; - - if (CF->getNumInterfaces()) { - Out << "implements " << CF->getInterface(0)->getName()->str(); - for (unsigned i = 1, e = CF->getNumInterfaces(); i != e; ++i) - Out << ", " << CF->getInterface(i)->getName()->str(); - Out << ' '; - } - Out << "{\n"; - - const Fields& fields = CF->getFields(); - // Dump static fields. - for (unsigned i = 0, e = fields.size(); i != e; ++i) - if (fields[i]->isStatic()) - dumpField(fields[i]); - // Dump instance fields. - for (unsigned i = 0, e = fields.size(); i != e; ++i) - if (!fields[i]->isStatic()) - dumpField(fields[i]); - - const Methods& methods = CF->getMethods(); - for (unsigned i = 0, e = methods.size(); i != e; ++i) - dumpMethod(methods[i]); - - Out << "\n}\n"; - } - - void dumpField(const Field* F) { - Out << '\n'; - if (F->isPublic()) - Out << "public "; - else if (F->isProtected()) - Out << "protected "; - else if (F->isPrivate()) - Out << "private "; - - if (F->isStatic()) - Out << "static "; - - if (F->isFinal()) - Out << "final "; - - if (F->isTransient()) - Out << "transient "; - - Out << getPrettyString(F->getDescriptor()->str()) << ' ' - << F->getName()->str() << ";\n"; - } - - void dumpMethod(const Method* M) { - Out << '\n'; - if (M->isPublic()) - Out << "public "; - else if (M->isProtected()) - Out << "protected "; - else if (M->isPrivate()) - Out << "private "; - - if (M->isStatic()) - Out << "static "; - - if (M->isAbstract()) - Out << "abstract "; - - if (M->isFinal()) - Out << "final "; - - if (M->isSynchronized()) - Out << "synchronized "; - - std::string Signature = getPrettyString(M->getDescriptor()->str()); - Signature.insert(Signature.find('('), M->getName()->str()); - - Out << Signature << ";\n"; - if (CodeAttribute* CodeAttr = M->getCodeAttribute()) { - Out << "\tCode:"; - parse(CodeAttr->getCode(), 0, CodeAttr->getCodeSize()); - Out << '\n'; - } - } - - std::string getPrettyString(const std::string& Desc) { - unsigned I = 0; - std::string prettyString = getPrettyStringHelper(Desc, I); - for (unsigned i = 0, e = prettyString.size(); i != e; ++i) - if (prettyString[i] == '/') - prettyString[i] = '.'; - return prettyString; - } - - std::string getPrettyStringHelper(const std::string& Desc, unsigned& I) { - if (Desc.size() == I) - return ""; - - switch (Desc[I++]) { - case 'B': return "byte"; - case 'C': return "char"; - case 'D': return "double"; - case 'F': return "float"; - case 'I': return "int"; - case 'J': return "long"; - case 'S': return "short"; - case 'Z': return "boolean"; - case 'V': return "void"; - case 'L': { - unsigned E = Desc.find(';', I); - std::string ClassName = Desc.substr(I, E - I); - I = E + 1; - return ClassName; - } - case '[': { - std::string ArrayPart; - ArrayPart += "[]"; - while (Desc[I] == '[') { - ArrayPart += "[]"; - ++I; - } - - return getPrettyStringHelper(Desc, I) + ArrayPart; - } - case '(': { - std::string Params; - while (Desc[I] != ')') { - if (Desc[I-1] != '(') - Params += ','; - Params += getPrettyStringHelper(Desc, I); - } - return getPrettyStringHelper(Desc, ++I) + " (" + Params + ')'; - } - } - - return ""; - } - - /// @brief called before every bytecode - void pre_inst(unsigned bcI) { Out << "\n\t " << bcI << ":\t"; } - /// @brief called on ACONST_NULL - void do_aconst_null() { Out << "aconst_null"; } - /// @brief called on ICONST_<n>, SIPUSH and BIPUSH - void do_iconst(int value) { - if (value == -1) - Out << "iconst_m1"; - else if (value >=0 && value <= 5) - Out << "iconst_" << value; - else if (value >= -128 && value <= 127) - Out << "bipush " << value; - else - Out << "sipush " << value; - } - /// @brief called on LCONST_<n> - void do_lconst(long long value) { - if (value == 0 || value == 1) - Out << "lconst_" << value; - else - Out << "lconst " << value; - } - /// @brief called on FCONST_<n> - void do_fconst(float value) { - if (value >= 0 && value <= 2) - Out << "fconst_" << value; - else - Out << "fconst " << value; - } - /// @brief called on DCONST_<n> - void do_dconst(double value) { - if (value == 0 || value == 1) - Out << "dconst_" << value; - else - Out << "dconst " << value; - } - /// @brief called on LDC and LDC_W - void do_ldc(unsigned index) { - if (index <= 255) - Out << "ldc"; - else - Out << "ldc_w"; - Out << "\t#" << index << "; //" << *CF->getConstant(index); - } - /// @brief called on LDC2_W - void do_ldc2(unsigned index) { - Out << "ldc2_w \t#" << index << "; //" << *CF->getConstant(index); - } - /// @brief called on ILOAD and ILOAD_<n> - void do_iload(unsigned index) { - if (index <= 3) - Out << "iload_" << index; - else - Out << "iload " << index; - } - /// @brief called on LLOAD and LLOAD_<n> - void do_lload(unsigned index) { - if (index <= 3) - Out << "lload_" << index; - else - Out << "lload " << index; - } - /// @brief called on FLOAD and FLOAD_<n> - void do_fload(unsigned index) { - if (index <= 3) - Out << "fload_" << index; - else - Out << "fload " << index; - } - /// @brief called on DLOAD and DLOAD_<n> - void do_dload(unsigned index) { - if (index <= 3) - Out << "dload_" << index; - else - Out << "dload " << index; - } - /// @brief called on ALOAD and ALOAD_<n> - void do_aload(unsigned index) { - if (index <= 3) - Out << "aload_" << index; - else - Out << "aload " << index; - } - /// @brief called on IALOAD - void do_iaload() { Out << "iaload"; } - /// @brief called on LALOAD - void do_laload() { Out << "laload"; } - /// @brief called on FALOAD - void do_faload() { Out << "faload"; } - /// @brief called on DALOAD - void do_daload() { Out << "daload"; } - /// @brief called on AALOAD - void do_aaload() { Out << "aaload"; } - /// @brief called on BALOAD - void do_baload() { Out << "baload"; } - /// @brief called on CALOAD - void do_caload() { Out << "caload"; } - /// @brief called on SALOAD - void do_saload() { Out << "saload"; } - /// @brief called on ISTORE and ISTORE_<n> - void do_istore(unsigned index) { - if (index <= 3) - Out << "istore_" << index; - else - Out << "istore " << index; - } - /// @brief called on LSTORE and LSTORE_<n> - void do_lstore(unsigned index) { - if (index <= 3) - Out << "lstore_" << index; - else - Out << "lstore " << index; - } - /// @brief called on FSTORE and FSTORE_<n> - void do_fstore(unsigned index) { - if (index <= 3) - Out << "fstore_" << index; - else - Out << "fstore " << index; - } - /// @brief called on DSTORE and DSTORE_<n> - void do_dstore(unsigned index) { - if (index <= 3) - Out << "dstore_" << index; - else - Out << "dstore " << index; - } - /// @brief called on ASTORE and ASTORE_<n> - void do_astore(unsigned index) { - if (index <= 3) - Out << "astore_" << index; - else - Out << "astore " << index; - } - /// @brief called on IASTORE - void do_iastore() { Out << "iastore"; } - /// @brief called on LASTORE - void do_lastore() { Out << "lastore"; } - /// @brief called on FASTORE - void do_fastore() { Out << "fastore"; } - /// @brief called on DASTORE - void do_dastore() { Out << "dastore"; } - /// @brief called on AASTORE - void do_aastore() { Out << "aastore"; } - /// @brief called on BASTORE - void do_bastore() { Out << "bastore"; } - /// @brief called on CASTORE - void do_castore() { Out << "castore"; } - /// @brief called on SASTORE - void do_sastore() { Out << "sastore"; } - /// @brief called on POP - void do_pop() { Out << "pop"; } - /// @brief called on POP2 - void do_pop2() { Out << "pop2"; } - /// @brief called on DUP - void do_dup() { Out << "dup"; } - /// @brief called on DUP_X1 - void do_dup_x1() { Out << "dup_x1"; } - /// @brief called on DUP_X2 - void do_dup_x2() { Out << "dup_x2"; } - /// @brief called on DUP2 - void do_dup2() { Out << "dup2"; } - /// @brief called on DUP2_X1 - void do_dup2_x1() { Out << "dup2_x1"; } - /// @brief called on DUP2_X2 - void do_dup2_x2() { Out << "dup2_x2"; } - /// @brief called on SWAP - void do_swap() { Out << "swap"; } - /// @brief called on IADD - void do_iadd() { Out << "iadd"; } - /// @brief called on LADD - void do_ladd() { Out << "ladd"; } - /// @brief called on FADD - void do_fadd() { Out << "fadd"; } - /// @brief called on DADD - void do_dadd() { Out << "dadd"; } - /// @brief called on ISUB - void do_isub() { Out << "isub"; } - /// @brief called on LSUB - void do_lsub() { Out << "lsub"; } - /// @brief called on FSUB - void do_fsub() { Out << "fsub"; } - /// @brief called on DSUB - void do_dsub() { Out << "dsub"; } - /// @brief called on IMUL - void do_imul() { Out << "imul"; } - /// @brief called on LMUL - void do_lmul() { Out << "lmul"; } - /// @brief called on FMUL - void do_fmul() { Out << "fmul"; } - /// @brief called on DMUL - void do_dmul() { Out << "dmul"; } - /// @brief called on IDIV - void do_idiv() { Out << "idiv"; } - /// @brief called on LDIV - void do_ldiv() { Out << "ldiv"; } - /// @brief called on FDIV - void do_fdiv() { Out << "fdiv"; } - /// @brief called on DDIV - void do_ddiv() { Out << "ddiv"; } - /// @brief called on IREM - void do_irem() { Out << "irem"; } - /// @brief called on LREM - void do_lrem() { Out << "lrem"; } - /// @brief called on FREM - void do_frem() { Out << "frem"; } - /// @brief called on DREM - void do_drem() { Out << "drem"; } - /// @brief called on INEG - void do_ineg() { Out << "ineg"; } - /// @brief called on LNEG - void do_lneg() { Out << "lneg"; } - /// @brief called on FNEG - void do_fneg() { Out << "fneg"; } - /// @brief called on DNEG - void do_dneg() { Out << "dneg"; } - /// @brief called on ISHL - void do_ishl() { Out << "ishl"; } - /// @brief called on LSHL - void do_lshl() { Out << "lshl"; } - /// @brief called on ISHR - void do_ishr() { Out << "ishr"; } - /// @brief called on LSHR - void do_lshr() { Out << "lshr"; } - /// @brief called on IUSHR - void do_iushr() { Out << "iushr"; } - /// @brief called on LUSHR - void do_lushr() { Out << "lushr"; } - /// @brief called on IAND - void do_iand() { Out << "iand"; } - /// @brief called on LAND - void do_land() { Out << "land"; } - /// @brief called on IOR - void do_ior() { Out << "ior"; } - /// @brief called on LOR - void do_lor() { Out << "lor"; } - /// @brief called on IXOR - void do_ixor() { Out << "ixor"; } - /// @brief called on LXOR - void do_lxor() { Out << "lxor"; } - /// @brief called on IINC - void do_iinc(unsigned index, int amount) { - Out << "iinc " << index << ", " << amount; - } - /// @brief called on I2L - void do_i2l() { Out << "i2l"; } - /// @brief called on I2F - void do_i2f() { Out << "i2f"; } - /// @brief called on I2D - void do_i2d() { Out << "i2d"; } - /// @brief called on L2I - void do_l2i() { Out << "l2i"; } - /// @brief called on L2F - void do_l2f() { Out << "l2f"; } - /// @brief called on L2D - void do_l2d() { Out << "l2d"; } - /// @brief called on F2I - void do_f2i() { Out << "f2i"; } - /// @brief called on F2L - void do_f2l() { Out << "f2l"; } - /// @brief called on F2D - void do_f2d() { Out << "f2d"; } - /// @brief called on D2I - void do_d2i() { Out << "d2i"; } - /// @brief called on D2L - void do_d2l() { Out << "d2l"; } - /// @brief called on D2F - void do_d2f() { Out << "d2f"; } - /// @brief called on I2B - void do_i2b() { Out << "i2b"; } - /// @brief called on I2C - void do_i2c() { Out << "i2c"; } - /// @brief called on I2S - void do_i2s() { Out << "i2s"; } - /// @brief called on LCMP - void do_lcmp() { Out << "lcmp"; } - /// @brief called on FCMPL - void do_fcmpl() { Out << "fcmpl"; } - /// @brief called on DCMPL - void do_dcmpl() { Out << "dcmpl"; } - /// @brief called on FCMPG - void do_fcmpg() { Out << "fcmpg"; } - /// @brief called on DCMPG - void do_dcmpg() { Out << "dcmpg"; } - /// @brief called on IFEQ - void do_ifeq(unsigned t, unsigned f) { Out << "ifeq " << t; } - /// @brief called on IFNE - void do_ifne(unsigned t, unsigned f) { Out << "ifne " << t; } - /// @brief called on IFLT - void do_iflt(unsigned t, unsigned f) { Out << "iflt " << t; } - /// @brief called on IFGE - void do_ifge(unsigned t, unsigned f) { Out << "ifge " << t; } - /// @brief called on IFGT - void do_ifgt(unsigned t, unsigned f) { Out << "ifgt " << t; } - /// @brief called on IFLE - void do_ifle(unsigned t, unsigned f) { Out << "ifle " << t; } - /// @brief called on IF_ICMPEQ - void do_if_icmpeq(unsigned t, unsigned f) { Out << "if_icmpeq " << t; } - /// @brief called on IF_ICMPNE - void do_if_icmpne(unsigned t, unsigned f) { Out << "if_icmpne " << t; } - /// @brief called on IF_ICMPLT - void do_if_icmplt(unsigned t, unsigned f) { Out << "if_icmplt " << t; } - /// @brief called on IF_ICMPGE - void do_if_icmpge(unsigned t, unsigned f) { Out << "if_icmpge " << t; } - /// @brief called on IF_ICMPGT - void do_if_icmpgt(unsigned t, unsigned f) { Out << "if_icmpgt " << t; } - /// @brief called on IF_ICMPLE - void do_if_icmple(unsigned t, unsigned f) { Out << "if_icmple " << t; } - /// @brief called on IF_ACMPEQ - void do_if_acmpeq(unsigned t, unsigned f) { Out << "if_acmpeq " << t; } - /// @brief called on IF_ACMPNE - void do_if_acmpne(unsigned t, unsigned f) { Out << "if_acmpne " << t; } - /// @brief called on GOTO and GOTO_W - void do_goto(unsigned target) { Out << "goto " << target; } - /// @brief called on JSR and JSR_W - void do_jsr(unsigned target, unsigned retAddress) { abort(); } - /// @brief called on RET - void do_ret(unsigned index) { abort(); } - /// @brief called on TABLESWITCH - void do_tableswitch(unsigned defTarget, const SwitchCases& sw) { - Out << "tableswitch{ //" << sw.front().first << " to " << sw.back().first; - for (unsigned i = 0, e = sw.size(); i != e; ++i) - Out << "\n\t\t\t" << sw[i].first << ": " << sw[i].second << ';'; - Out << ";\n\t\t\tdefault: " << defTarget << " }"; - } - /// @brief called on LOOKUPSWITCH - void do_lookupswitch(unsigned defTarget, const SwitchCases& sw) { abort(); } - /// @brief called on IRETURN - void do_ireturn() { Out << "ireturn"; } - /// @brief called on LRETURN - void do_lreturn() { Out << "lreturn"; } - /// @brief called on FRETURN - void do_freturn() { Out << "freturn"; } - /// @brief called on DRETURN - void do_dreturn() { Out << "dreturn"; } - /// @brief called on ARETURN - void do_areturn() { Out << "areturn"; } - /// @brief called on RETURN - void do_return() { Out << "return"; } - /// @brief called on GETSTATIC - void do_getstatic(unsigned index) { - Out << "getstatic #" << index << "; //Field "; - printMemberRef(index); - } - /// @brief called on PUTSTATIC - void do_putstatic(unsigned index) { - Out << "putstatic #" << index << "; //Field "; - printMemberRef(index); - } - /// @brief called on GETFIELD - void do_getfield(unsigned index) { - Out << "getfield #" << index << "; //Field "; - printMemberRef(index); - } - /// @brief called on PUTFIELD - void do_putfield(unsigned index) { - Out << "putfield #" << index << "; //Field "; - printMemberRef(index); - } - /// @brief called on INVOKEVIRTUAL - void do_invokevirtual(unsigned index) { - Out << "invokevirtual #" << index << "; //Method "; - printMemberRef(index); - } - /// @brief called on INVOKESPECIAL - void do_invokespecial(unsigned index) { - Out << "invokespecial #" << index << "; //Method "; - printMemberRef(index); - } - /// @brief called on INVOKESTATIC - void do_invokestatic(unsigned index) { - Out << "invokestatic #" << index << "; //Method "; - printMemberRef(index); - } - /// @brief called on INVOKEINTERFACE - void do_invokeinterface(unsigned index) { - Out << "invokeinterface #" << index << "; //InterfaceMethod "; - printMemberRef(index); - } - /// @brief called on NEW - void do_new(unsigned index) { - Out << "new #" << index << "; //class "; - printClassRef(index); - } - /// @brief called on NEWARRAY - void do_newarray(JType type) { - Out << "newarray "; - switch (type) { - case BOOLEAN: Out << "boolean"; break; - case CHAR: Out << "char"; break; - case FLOAT: Out << "float"; break; - case DOUBLE: Out << "double"; break; - case BYTE: Out << "byte"; break; - case SHORT: Out << "short"; break; - case INT: Out << "int"; break; - case LONG: Out << "long"; break; - default: assert(0 && "Unknown type for newarray!"); - } - } - - /// @brief called on ANEWARRAY - void do_anewarray(unsigned index) { - Out << "anewarray #" << index << "; //class "; - printClassRef(index); - } - /// @brief called on ARRAYLENGTH - void do_arraylength() { Out << "arraylength"; } - /// @brief called on ATHROW - void do_athrow() { Out << "athrow"; } - /// @brief called on CHECKCAST - void do_checkcast(unsigned index) { - Out << "checkcast #" << index - << "; //class "; - printClassRef(index); - } - /// @brief called on INSTANCEOF - void do_instanceof(unsigned index) { - Out << "instanceof #" << index - << "; //class "; - printClassRef(index); - } - /// @brief called on MONITORENTER - void do_monitorenter() { Out << "monitorenter"; } - /// @brief called on MONITOREXIT - void do_monitorexit() { Out << "monitorexit"; } - /// @brief called on MULTIANEWARRAY - void do_multianewarray(unsigned index, unsigned dims) { } - /// @brief called on IFNULL - void do_ifnull(unsigned t, unsigned f) { Out << "ifnull " << t; } - /// @brief called on IFNONNULL - void do_ifnonnull(unsigned t, unsigned f) { Out << "ifnonnull " << t; } - - void printMemberRef(unsigned index) { - ConstantMemberRef* Ref = CF->getConstantMemberRef(index); - ConstantClass* Class = Ref->getClass(); - if (Class != CF->getThisClass()) - Out << Class->getName()->str() << '.'; - Out << Ref->getNameAndType()->getName()->str() - << ':' - << Ref->getNameAndType()->getDescriptor()->str(); - } - - void printClassRef(unsigned index) { - const std::string& FQCN = CF->getConstantClass(index)->getName()->str(); - Out << FQCN.substr(FQCN.rfind('/')+1); - } - }; -} - -int main(int argc, char* argv[]) -{ - sys::PrintStackTraceOnErrorSignal(); - cl::ParseCommandLineOptions(argc, argv, - "class dump utility"); - - try { - const Java::ClassFile* cf(Java::ClassFile::get(InputClass)); - - switch (DumpMode) { - default: - std::cerr << "no dump type selected"; - abort(); - case code: { - ClassDump(cf, std::cout); - break; - } - case constantPool: { - for (unsigned i = 0, e = cf->getNumConstants(); i != e; ++i) { - Constant* c = cf->getConstant(i); - std::cout.width(6); - std::cout << i << ": "; - std::cout.width(0); - if (c) - std::cout << *cf->getConstant(i); - else - std::cout << "empty"; - std::cout << '\n'; - } - break; - } - } - } - catch (std::exception& e) { - std::cerr << e.what() << '\n'; - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -}
diff --git a/poolalloc/LICENSE.TXT b/poolalloc/LICENSE.TXT deleted file mode 100644 index cb1b0d3..0000000 --- a/poolalloc/LICENSE.TXT +++ /dev/null
@@ -1,44 +0,0 @@ -============================================================================== -LLVM Pool Allocator Release License -============================================================================== -University of Illinois/NCSA -Open Source License - -Copyright (c) 2003, 2004, 2005 University of Illinois at Urbana-Champaign. -All rights reserved. - -Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.cs.uiuc.edu - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. -
diff --git a/poolalloc/Makefile b/poolalloc/Makefile deleted file mode 100644 index 1f85962..0000000 --- a/poolalloc/Makefile +++ /dev/null
@@ -1,26 +0,0 @@ -# -# This is a sample Makefile for a project that uses LLVM. -# - -# -# Indicates our relative path to the top of the project's root directory. -# -LEVEL = . - -# -# Directories that needs to be built. -# -DIRS = lib runtime - -# -# Include the Master Makefile that knows how to build all. -# --include $(LEVEL)/Makefile.common - -notconfigured: - @echo "ERROR: You must configure this project before you can use it!" - @exit 1 - -distclean:: clean - ${RM} -f Makefile.common Makefile.config -
diff --git a/poolalloc/Makefile.common.in b/poolalloc/Makefile.common.in deleted file mode 100644 index 1648375..0000000 --- a/poolalloc/Makefile.common.in +++ /dev/null
@@ -1,24 +0,0 @@ -PROJECT_NAME := poolalloc -PROJ_VERSION := 1.0 - -# Set this variable to the top of the LLVM source tree. -LLVM_SRC_ROOT = @LLVM_SRC@ - -# Set this variable to the top level directory where LLVM was built -# (this is *not* the same as OBJ_ROOT as defined in LLVM's Makefile.config). -LLVM_OBJ_ROOT = @LLVM_OBJ@ - -# Set the source root and source directory pathnames -####PROJ_SRC_DIR := $(subst //,/,@abs_top_srcdir@/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR))) - -PROJ_SRC_ROOT := $(subst //,/,@abs_top_srcdir@) - -# Set the root directory of this project's object files -PROJ_OBJ_ROOT := $(subst //,/,@abs_top_objdir@) - -# Set the root directory of this project's install prefix -PROJ_INSTALL_ROOT := @prefix@ - -# Include LLVM's Master Makefile. -include $(LLVM_SRC_ROOT)/Makefile.common -
diff --git a/poolalloc/README b/poolalloc/README deleted file mode 100644 index c89215e..0000000 --- a/poolalloc/README +++ /dev/null
@@ -1,71 +0,0 @@ -Welcome to the Pre-Release of the Automatic Pool Allocator! - -LICENSE: -======== -Before using the Automatic Pool Allocator, you should read the pre-release -license in LICENSE.TXT. - -BUILDING: -========= -To build the Automatic Pool Allocator, you will need to have installed and -compiled LLVM. - -Once that is done, you can build the Automatic Pool Allocator using the -following steps: - - 1. Run the configure script to tell the build system LLVM has been - installed. Use the --with-llvmsrc=<dir> option to specify the - location of the LLVM source code, and use the --with-llvmobj=<dir> - option to specify the location of the LLVM object code. - - For example, if the user joe with home directory of /usr/home/joe - has the LLVM source in /usr/home/joe/llvm, and it was configured - with ./configure --with-objroot=/tmp, then the Automatic Pool - Allocator should be configured with: - - > ./configure --with-llvmsrc=/usr/home/joe/llvm \ - --with-llvmobj=/tmp/llvm - - 2. Using GNU Make (sometimes called gmake), type "make" to build the - Automatic Pool Allocator: - - > make - - 3. To install the pool allocator bytecode libraries into the C front - end, use make with the install target: - - > make install - -USING THE POOL ALLOCATOR: -========================= -To use the Automatic Pool Allocator optimization pass, you will need to -explicitly load it into the opt program: - - > opt -load <path to pool allocator> -poolalloc <other opt options> - -To link and run programs with the pool allocator, you will need to have the -poolalloc bytecode library in your LLVM_LIB_SEARCH_PATH. If you have followed -the directions in the "Getting Started Guide" for LLVM, your -LLVM_LIB_SEARCH_PATH environment variable already points to the C front end's -directory of bytecode libraries. Just use the install target (mentioned above) -of make to install the poolalloc library into that directory. - -To link a bytecode file once it has been optimized, you can do the following: - - > llvmgcc -o <output file> <optimized bytecode file> -lpoolalloc - -...where llvmgcc is an alias to the GCC C front end. - -This will generate a bytecode file that can be executed. - -BUGS: -===== -Please see our website for information on how to report bugs -(http://llvm.cs.uiuc.edu/docs/HowToSubmitABug.html). - -LLVM DEVELOPER'S MAILING LIST -============================= -The LLVM Developer's Mailing List provides announcements and general discussion -about LLVM. The list is low volume. You can subscribe to it at -http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev. -
diff --git a/poolalloc/Regressions/2006-02-13.ArrayOfObjects.ll b/poolalloc/Regressions/2006-02-13.ArrayOfObjects.ll deleted file mode 100644 index e274042..0000000 --- a/poolalloc/Regressions/2006-02-13.ArrayOfObjects.ll +++ /dev/null
@@ -1,20 +0,0 @@ -; This causes a segfault in pointer compression -; The pool type is struct.DLL, but the result of malloc is an array of struct.DLL -; the GEP rewrite assumed that a pointer would have the pool type which isn't true here - -target endian = little -target pointersize = 64 -target triple = "alphaev6-unknown-linux-gnu" -deplibs = [ "c", "crtend" ] - %struct.DLL = type { int, %struct.DLL*, %struct.DLL* } - -implementation ; Functions: - -void %main() { -entry: - %tmp.12.i.i = malloc [101 x %struct.DLL] ; <[101 x %struct.DLL]*> [#uses=2] - %tmp.37.i.i = getelementptr [101 x %struct.DLL]* %tmp.12.i.i, int 0, int 0, uint 2 ; <%struct.DLL**> [#uses=1] - %tmp.42.i.i = getelementptr [101 x %struct.DLL]* %tmp.12.i.i, int 0, int 0 ; <%struct.DLL*> [#uses=1] - store %struct.DLL* %tmp.42.i.i, %struct.DLL** %tmp.37.i.i - unreachable -}
diff --git a/poolalloc/Regressions/2006-02-23.memcpy.ll b/poolalloc/Regressions/2006-02-23.memcpy.ll deleted file mode 100644 index 09acb3c..0000000 --- a/poolalloc/Regressions/2006-02-23.memcpy.ll +++ /dev/null
@@ -1,35 +0,0 @@ -; pointer compression tries to turn the llvm.memcpy into llvm.memcpy_pc -; this is of course bad. It should materialize the pointers. -target endian = little -target pointersize = 64 -target triple = "alphaev6-unknown-linux-gnu" -deplibs = [ "c", "crtend" ] - %struct.spec_fd_t = type { int, int, int, ubyte* } -%spec_fd = external global [3 x %struct.spec_fd_t] ; <[3 x %struct.spec_fd_t]*> [#uses=2] - -implementation ; Functions: - -declare void %llvm.memcpy(sbyte*, sbyte*, ulong, uint) - -void %main() { -entry: - br bool false, label %no_exit.0.i161, label %endif.0 - -endif.0: ; preds = %entry - ret void - -no_exit.0.i161: ; preds = %entry - %tmp.25.i = getelementptr [3 x %struct.spec_fd_t]* %spec_fd, long 0, int 0, uint 3 ; <ubyte**> [#uses=1] - %tmp.26.i = malloc ubyte, uint 0 ; <ubyte*> [#uses=1] - store ubyte* %tmp.26.i, ubyte** %tmp.25.i - br bool false, label %no_exit.1.i, label %then.4 - -no_exit.1.i: ; preds = %no_exit.0.i161 - %tmp.103.i = load ubyte** getelementptr ([3 x %struct.spec_fd_t]* %spec_fd, long 0, int 0, uint 3) ; <ubyte*> [#uses=1] - %tmp.118.i = cast ubyte* %tmp.103.i to sbyte* ; <sbyte*> [#uses=1] - tail call void %llvm.memcpy( sbyte* null, sbyte* %tmp.118.i, ulong 0, uint 1 ) - ret void - -then.4: ; preds = %no_exit.0.i161 - ret void -}
diff --git a/poolalloc/Regressions/2006-03-04.undefArg.ll b/poolalloc/Regressions/2006-03-04.undefArg.ll deleted file mode 100644 index 82f0c9b..0000000 --- a/poolalloc/Regressions/2006-03-04.undefArg.ll +++ /dev/null
@@ -1,96 +0,0 @@ -; ModuleID = 'bugpoint-reduced-simplified.bc' -target endian = little -target pointersize = 64 -target triple = "alphaev6-unknown-linux-gnu" -deplibs = [ "c", "crtend" ] - %struct..TorRec = type { int, void ()* } - %struct.CON_list_struct = type { %struct.CON_list_struct*, %struct.CON_node_struct* } - %struct.CON_node_struct = type { %struct.DIS_list_struct*, %struct.DIS_list_struct*, int } - %struct.Connector_struct = type { short, short, sbyte, sbyte, %struct.Connector_struct*, sbyte* } - %struct.DIS_list_struct = type { %struct.DIS_list_struct*, %struct.DIS_node_struct* } - %struct.DIS_node_struct = type { %struct.CON_list_struct*, %struct.List_o_links_struct*, int } - %struct.D_type_list_struct = type { %struct.D_type_list_struct*, int } - %struct.Dict_node_struct = type { sbyte*, %struct.Word_file_struct*, %struct.Exp_struct*, %struct.Dict_node_struct*, %struct.Dict_node_struct* } - %struct.Disjunct_struct = type { %struct.Disjunct_struct*, short, sbyte, sbyte*, %struct.Connector_struct*, %struct.Connector_struct* } - %struct.E_list_struct = type { %struct.E_list_struct*, %struct.Exp_struct* } - %struct.Exp_struct = type { sbyte, ubyte, sbyte, sbyte, { sbyte* } } - %struct.Image_node_struct = type { %struct.Image_node_struct*, %struct.Connector_struct*, int } - %struct.Link_struct = type { int, int, %struct.Connector_struct*, %struct.Connector_struct*, sbyte* } - %struct.Linkage_info_struct = type { int, short, short, short, short, short } - %struct.Links_to_patch_struct = type { %struct.Links_to_patch_struct*, int, sbyte, int } - %struct.List_o_links_struct = type { int, int, int, %struct.List_o_links_struct* } - %struct.Match_node_struct = type { %struct.Match_node_struct*, %struct.Disjunct_struct* } - %struct.PP_node_struct = type { %struct.D_type_list_struct**, %struct.Violation_list_struct* } - %struct.Table_connector = type { short, short, %struct.Connector_struct*, %struct.Connector_struct*, short, int, %struct.Table_connector* } - %struct.Tconnector_struct = type { sbyte, sbyte, %struct.Tconnector_struct*, sbyte* } - %struct.TorRec = type { int, void ()* } - %struct.Violation_list_struct = type { %struct.Violation_list_struct*, sbyte* } - %struct.Word_file_struct = type { [60 x sbyte], int, %struct.Word_file_struct* } - %struct.Word_struct = type { [60 x sbyte], %struct.X_node_struct*, %struct.Disjunct_struct* } - %struct.X_node_struct = type { sbyte*, %struct.Exp_struct*, %struct.X_node_struct* } - %struct._IO_FILE = type { int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct._IO_marker*, %struct._IO_FILE*, int, int, long, ushort, sbyte, [1 x sbyte], sbyte*, long, sbyte*, sbyte*, int, [44 x sbyte] } - %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, int } - %struct.__va_list_tag = type { sbyte*, int } - %struct.c_list_struct = type { %struct.Connector_struct*, int, %struct.c_list_struct* } - %struct.clause_struct = type { %struct.clause_struct*, int, int, %struct.Tconnector_struct* } - %struct.d_tree_leaf_struct = type { %struct.domain_struct*, int, %struct.d_tree_leaf_struct* } - %struct.domain_struct = type { sbyte*, int, %struct.List_o_links_struct*, int, int, %struct.d_tree_leaf_struct*, %struct.domain_struct* } - %struct.label_node_struct = type { int, %struct.label_node_struct* } - %struct.patch_element_struct = type { sbyte, sbyte, int, int } - %struct.string_node_struct = type { sbyte*, int, %struct.string_node_struct* } -%sentence = external global [250 x %struct.Word_struct] ; <[250 x %struct.Word_struct]*> [#uses=2] -%mn_free_list = external global %struct.Match_node_struct* ; <%struct.Match_node_struct**> [#uses=1] - -implementation ; Functions: - -declare fastcc %struct.Match_node_struct* %form_match_list(%struct.Connector_struct*) - -internal fastcc void %prune() { -entry: - %tmp.15 = getelementptr [250 x %struct.Word_struct]* %sentence, long 0, int 0, uint 2 ; <%struct.Disjunct_struct**> [#uses=1] - %tmp.16 = load %struct.Disjunct_struct** %tmp.15 ; <%struct.Disjunct_struct*> [#uses=1] - %tmp.44 = getelementptr %struct.Disjunct_struct* %tmp.16, long 0, uint 5 ; <%struct.Connector_struct**> [#uses=1] - %tmp.45 = load %struct.Connector_struct** %tmp.44 ; <%struct.Connector_struct*> [#uses=1] - free %struct.Connector_struct* %tmp.45 - ret void -} - -int %main(int %argc, sbyte** %argv) { -entry: - %tmp.2 = load %struct.Disjunct_struct** getelementptr ([250 x %struct.Word_struct]* %sentence, long 0, long 0, uint 2) ; <%struct.Disjunct_struct*> [#uses=1] - %tmp.16 = getelementptr %struct.Disjunct_struct* %tmp.2, long 0, uint 5 ; <%struct.Connector_struct**> [#uses=1] - %tmp.17 = load %struct.Connector_struct** %tmp.16 ; <%struct.Connector_struct*> [#uses=1] - %tmp.13 = tail call fastcc int %count( %struct.Connector_struct* %tmp.17 ) ; <int> [#uses=0] - %tmp.24 = tail call fastcc int %count( %struct.Connector_struct* null ) ; <int> [#uses=0] - ret int 0 -} - -internal fastcc int %count(%struct.Connector_struct* %le) { -no_exit.0: ; preds = %endif.4 - %tmp.101 = tail call fastcc %struct.Match_node_struct* %form_match_list( %struct.Connector_struct* %le) - br label %no_exit.1 - -no_exit.1: ; preds = %loopexit.2, %no_exit.0 - %m.2.0 = phi %struct.Match_node_struct* [ %tmp.101, %no_exit.0 ], [ %tmp.542, %loopexit.2 ] ; <%struct.Match_node_struct*> [#uses=2] - %tmp.112 = getelementptr %struct.Match_node_struct* %m.2.0, long 0, uint 1 ; <%struct.Disjunct_struct**> [#uses=1] - %tmp.113 = load %struct.Disjunct_struct** %tmp.112 ; <%struct.Disjunct_struct*> [#uses=1] - br bool false, label %loopexit.2, label %no_exit.2.preheader - -no_exit.2.preheader: ; preds = %no_exit.1 - %tmp.141 = getelementptr %struct.Disjunct_struct* %tmp.113, long 0, uint 5 ; <%struct.Connector_struct**> [#uses=1] - %tmp.432 = load %struct.Connector_struct** %tmp.141 ; <%struct.Connector_struct*> [#uses=1] - %tmp.427 = tail call fastcc int %count( %struct.Connector_struct* %tmp.432 ) ; <int> [#uses=0] - ret int 0 - -loopexit.2: ; preds = %no_exit.1 - %tmp.541 = getelementptr %struct.Match_node_struct* %m.2.0, long 0, uint 0 ; <%struct.Match_node_struct**> [#uses=1] - %tmp.542 = load %struct.Match_node_struct** %tmp.541 ; <%struct.Match_node_struct*> [#uses=1] - br bool false, label %no_exit.i.preheader, label %no_exit.1 - -no_exit.i.preheader: ; preds = %loopexit.2 - %mn_free_list.promoted = load %struct.Match_node_struct** %mn_free_list ; <%struct.Match_node_struct*> [#uses=1] - %tmp.5.i = getelementptr %struct.Match_node_struct* %tmp.101, long 0, uint 0 ; <%struct.Match_node_struct**> [#uses=1] - store %struct.Match_node_struct* %mn_free_list.promoted, %struct.Match_node_struct** %tmp.5.i - ret int 0 -} -
diff --git a/poolalloc/Regressions/2006-03-05.vaargCall.ll b/poolalloc/Regressions/2006-03-05.vaargCall.ll deleted file mode 100644 index 5e334c9..0000000 --- a/poolalloc/Regressions/2006-03-05.vaargCall.ll +++ /dev/null
@@ -1,406 +0,0 @@ -; ModuleID = 'bugpoint-reduced-simplified.bc' -target endian = little -target pointersize = 64 -target triple = "alphaev6-unknown-linux-gnu" -deplibs = [ "c", "crtend" ] - %struct.arg_list = type { int, %struct.arg_list* } - %typedef.YYSTYPE = type { sbyte*, sbyte, int, %struct.arg_list* } -%yyv = external global [150 x %typedef.YYSTYPE] ; <[150 x %typedef.YYSTYPE]*> [#uses=1] -%.str_11 = external global [26 x sbyte] ; <[26 x sbyte]*> [#uses=0] - -implementation ; Functions: - -void %warn(int, ...) { -entry: - ret void -} - -fastcc void %lookup(sbyte* %name) { -entry: - br bool false, label %then.0, label %no_exit.i - -no_exit.i: ; preds = %entry - ret void - -then.0: ; preds = %entry - tail call void (int, ...)* %warn( int 0, sbyte* %name ) - ret void -} - -fastcc void %addbyte() { -entry: - ret void -} - -void %main() { -entry: - switch int 0, label %switchexit [ - int -1, label %loopexit - int 118, label %label.5 - int 115, label %label.4 - int 119, label %label.3 - int 105, label %label.2 - int 108, label %label.1 - int 99, label %label.0 - ] - -label.0: ; preds = %entry - ret void - -label.1: ; preds = %entry - ret void - -label.2: ; preds = %entry - ret void - -label.3: ; preds = %entry - ret void - -label.4: ; preds = %entry - ret void - -label.5: ; preds = %entry - ret void - -switchexit: ; preds = %entry - ret void - -loopexit: ; preds = %entry - %tmp.11.i = getelementptr %typedef.YYSTYPE* getelementptr ([150 x %typedef.YYSTYPE]* %yyv, long 0, long -1), long 1, uint 0 ; <sbyte**> [#uses=2] - br bool false, label %yydefault.preheader.i, label %endif.1.i2 - -yystack.i: ; preds = %endif.15.i - ret void - -endif.1.i2: ; preds = %loopexit - ret void - -yydefault.preheader.i: ; preds = %loopexit - switch short 0, label %endif.12.i [ - short -2, label %then.7.i - short 0, label %then.12.i - ] - -then.7.i: ; preds = %yydefault.preheader.i - ret void - -then.12.i: ; preds = %yydefault.preheader.i - ret void - -endif.12.i: ; preds = %yydefault.preheader.i - br bool false, label %endif.15.i, label %then.15.i - -then.15.i: ; preds = %endif.12.i - ret void - -endif.15.i: ; preds = %endif.12.i - switch int 0, label %yystack.i [ - int 97, label %label.86.i - int 96, label %label.85.i - int 95, label %label.84.i - int 94, label %label.83.i - int 93, label %label.82.i - int 92, label %label.81.i - int 91, label %label.80.i - int 90, label %label.79.i - int 89, label %label.78.i - int 88, label %label.77.i - int 87, label %label.76.i - int 86, label %label.75.i - int 85, label %label.74.i - int 84, label %label.73.i - int 83, label %label.72.i - int 82, label %label.71.i - int 81, label %label.70.i - int 80, label %label.69.i - int 79, label %label.68.i - int 78, label %label.67.i - int 77, label %label.66.i - int 76, label %label.61.i - int 75, label %label.60.i - int 74, label %label.59.i - int 73, label %label.58.i - int 72, label %label.57.i - int 71, label %label.56.i - int 70, label %label.55.i - int 69, label %label.54.i - int 68, label %label.53.i - int 67, label %label.52.i - int 65, label %label.51.i - int 64, label %label.50.i - int 63, label %label.49.i - int 62, label %label.48.i - int 61, label %label.47.i - int 59, label %label.46.i - int 54, label %label.41.i - int 53, label %label.40.i - int 52, label %label.39.i - int 50, label %label.38.i - int 49, label %else.i796.i - int 48, label %label.36.i - int 46, label %label.35.i - int 44, label %label.34.i - int 43, label %label.33.i - int 39, label %label.32.i - int 38, label %label.31.i - int 37, label %label.30.i - int 36, label %label.29.i - int 35, label %label.28.i - int 34, label %label.27.i - int 32, label %label.25.i - int 31, label %label.24.i - int 30, label %label.23.i - int 29, label %label.22.i - int 28, label %label.21.i - int 27, label %label.20.i - int 26, label %else.i586.i - int 25, label %else.i558.i - int 23, label %else.2.i - int 22, label %label.15.i - int 21, label %label.14.i - int 20, label %then.17.i - int 19, label %label.12.i - int 18, label %label.11.i - int 17, label %label.10.i - int 10, label %label.9.i - int 6, label %label.8.i - int 5, label %label.7.i - int 4, label %label.6.i - int 3, label %label.5.i - int 1, label %label.4.i - ] - -label.4.i: ; preds = %endif.15.i - ret void - -label.5.i: ; preds = %endif.15.i - ret void - -label.6.i: ; preds = %endif.15.i - ret void - -label.7.i: ; preds = %endif.15.i - ret void - -label.8.i: ; preds = %endif.15.i - ret void - -label.9.i: ; preds = %endif.15.i - ret void - -label.10.i: ; preds = %endif.15.i - ret void - -label.11.i: ; preds = %endif.15.i - ret void - -label.12.i: ; preds = %endif.15.i - ret void - -then.17.i: ; preds = %endif.15.i - ret void - -label.14.i: ; preds = %endif.15.i - ret void - -label.15.i: ; preds = %endif.15.i - ret void - -else.2.i: ; preds = %endif.15.i - ret void - -else.i558.i: ; preds = %endif.15.i - ret void - -else.i586.i: ; preds = %endif.15.i - ret void - -label.20.i: ; preds = %endif.15.i - ret void - -label.21.i: ; preds = %endif.15.i - ret void - -label.22.i: ; preds = %endif.15.i - ret void - -label.23.i: ; preds = %endif.15.i - ret void - -label.24.i: ; preds = %endif.15.i - ret void - -label.25.i: ; preds = %endif.15.i - ret void - -label.27.i: ; preds = %endif.15.i - ret void - -label.28.i: ; preds = %endif.15.i - ret void - -label.29.i: ; preds = %endif.15.i - ret void - -label.30.i: ; preds = %endif.15.i - ret void - -label.31.i: ; preds = %endif.15.i - ret void - -label.32.i: ; preds = %endif.15.i - ret void - -label.33.i: ; preds = %endif.15.i - br bool false, label %else.i912.i, label %else.i884.i - -else.i884.i: ; preds = %label.33.i - ret void - -else.i912.i: ; preds = %label.33.i - %tmp.4961260.i = load sbyte** %tmp.11.i ; <sbyte*> [#uses=1] - free sbyte* %tmp.4961260.i - ret void - -label.34.i: ; preds = %endif.15.i - ret void - -label.35.i: ; preds = %endif.15.i - ret void - -label.36.i: ; preds = %endif.15.i - ret void - -else.i796.i: ; preds = %endif.15.i - ret void - -label.38.i: ; preds = %endif.15.i - ret void - -label.39.i: ; preds = %endif.15.i - ret void - -label.40.i: ; preds = %endif.15.i - ret void - -label.41.i: ; preds = %endif.15.i - ret void - -label.46.i: ; preds = %endif.15.i - ret void - -label.47.i: ; preds = %endif.15.i - ret void - -label.48.i: ; preds = %endif.15.i - ret void - -label.49.i: ; preds = %endif.15.i - ret void - -label.50.i: ; preds = %endif.15.i - ret void - -label.51.i: ; preds = %endif.15.i - ret void - -label.52.i: ; preds = %endif.15.i - ret void - -label.53.i: ; preds = %endif.15.i - ret void - -label.54.i: ; preds = %endif.15.i - ret void - -label.55.i: ; preds = %endif.15.i - ret void - -label.56.i: ; preds = %endif.15.i - ret void - -label.57.i: ; preds = %endif.15.i - ret void - -label.58.i: ; preds = %endif.15.i - ret void - -label.59.i: ; preds = %endif.15.i - ret void - -label.60.i: ; preds = %endif.15.i - ret void - -label.61.i: ; preds = %endif.15.i - ret void - -label.66.i: ; preds = %endif.15.i - ret void - -label.67.i: ; preds = %endif.15.i - ret void - -label.68.i: ; preds = %endif.15.i - ret void - -label.69.i: ; preds = %endif.15.i - ret void - -label.70.i: ; preds = %endif.15.i - ret void - -label.71.i: ; preds = %endif.15.i - ret void - -label.72.i: ; preds = %endif.15.i - ret void - -label.73.i: ; preds = %endif.15.i - ret void - -label.74.i: ; preds = %endif.15.i - ret void - -label.75.i: ; preds = %endif.15.i - ret void - -label.76.i: ; preds = %endif.15.i - ret void - -label.77.i: ; preds = %endif.15.i - ret void - -label.78.i: ; preds = %endif.15.i - ret void - -label.79.i: ; preds = %endif.15.i - ret void - -label.80.i: ; preds = %endif.15.i - ret void - -label.81.i: ; preds = %endif.15.i - %tmp.1165.i = load sbyte** %tmp.11.i ; <sbyte*> [#uses=1] - call fastcc void %lookup( sbyte* %tmp.1165.i ) - ret void - -label.82.i: ; preds = %endif.15.i - ret void - -label.83.i: ; preds = %endif.15.i - ret void - -label.84.i: ; preds = %endif.15.i - ret void - -label.85.i: ; preds = %endif.15.i - ret void - -label.86.i: ; preds = %endif.15.i - ret void -} - -fastcc void %more_functions() { -entry: - ret void -}
diff --git a/poolalloc/Regressions/2006-04-13.MixedAllocaGlobals.ll b/poolalloc/Regressions/2006-04-13.MixedAllocaGlobals.ll deleted file mode 100644 index 8c3f158..0000000 --- a/poolalloc/Regressions/2006-04-13.MixedAllocaGlobals.ll +++ /dev/null
@@ -1,41 +0,0 @@ -; ModuleID = 'bugpoint-reduced-simplified.bc' -target endian = little -target pointersize = 32 -target triple = "i686-pc-linux-gnu" -deplibs = [ "c", "crtend" ] - %struct.MT = type { int, [100 x [3 x [3 x int]]], [3 x [3 x int]], [3 x [3 x int]] } - %struct._IO_FILE = type { int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct._IO_marker*, %struct._IO_FILE*, int, int, int, ushort, sbyte, [1 x sbyte], sbyte*, long, sbyte*, sbyte*, int, [52 x sbyte] } - %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, int } - %struct.cellbox = type { sbyte*, sbyte, sbyte, int, int, short, short, short, short, short, short, short, %struct.tilebox* } - %struct.netbox = type { %struct.netbox*, int, int, int, int, int, int, short, short, short, sbyte, sbyte, sbyte, sbyte } - %struct.termbox = type { %struct.termbox*, %struct.netbox*, int, int, short, [2 x short], [2 x short], short } - %struct.tilebox = type { short, short, short, short, %struct.termbox* } -%carray = external global %struct.cellbox** ; <%struct.cellbox***> [#uses=1] -%foo = external global sbyte* - -implementation ; Functions: - -void %main() { -entry: - call fastcc void %readcell( ) - ret void -} - -;fastcc sbyte* %safe_malloc(uint %size) { -;entry: -; %tmp.0 = malloc sbyte, uint %size ; <sbyte*> [#uses=1] -; ret sbyte* %tmp.0 -;} - -fastcc void %readcell() { -entry: - %input = alloca [1024 x sbyte] ; <[1024 x sbyte]*> [#uses=1] - %tmp.48384 = getelementptr [1024 x sbyte]* %input, int 0, int 0 ; <sbyte*> [#uses=1] -; %tmp.7314 = call fastcc sbyte* %safe_malloc( uint 0 ) ; <sbyte*> [#uses=2] - %tmp.7314 = malloc sbyte, uint 0 - store sbyte* %tmp.7314, sbyte** %foo - call void %llvm.memcpy.i32( sbyte* %tmp.7314, sbyte* %tmp.48384, uint 0, uint 1 ) - ret void -} - -declare void %llvm.memcpy.i32(sbyte*, sbyte*, uint, uint)
diff --git a/poolalloc/autoconf/aclocal.m4 b/poolalloc/autoconf/aclocal.m4 deleted file mode 100644 index 1fb7210..0000000 --- a/poolalloc/autoconf/aclocal.m4 +++ /dev/null
@@ -1,6189 +0,0 @@ -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -## Copyright 1996, 1997, 1998, 1999, 2000, 2001 -## Free Software Foundation, Inc. -## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 -## -## This program 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. - -# serial 47 AC_PROG_LIBTOOL - - -# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) -# ----------------------------------------------------------- -# If this macro is not defined by Autoconf, define it here. -m4_ifdef([AC_PROVIDE_IFELSE], - [], - [m4_define([AC_PROVIDE_IFELSE], - [m4_ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - - -# AC_PROG_LIBTOOL -# --------------- -AC_DEFUN([AC_PROG_LIBTOOL], -[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl -dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX -dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. - AC_PROVIDE_IFELSE([AC_PROG_CXX], - [AC_LIBTOOL_CXX], - [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX - ])]) -dnl And a similar setup for Fortran 77 support - AC_PROVIDE_IFELSE([AC_PROG_F77], - [AC_LIBTOOL_F77], - [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 -])]) - -dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. -dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run -dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. - AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [ifdef([AC_PROG_GCJ], - [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([A][M_PROG_GCJ], - [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([LT_AC_PROG_GCJ], - [define([LT_AC_PROG_GCJ], - defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) -])])# AC_PROG_LIBTOOL - - -# _AC_PROG_LIBTOOL -# ---------------- -AC_DEFUN([_AC_PROG_LIBTOOL], -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl -AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/mklib' -AC_SUBST(LIBTOOL)dnl - -# Prevent multiple expansion -define([AC_PROG_LIBTOOL], []) -])# _AC_PROG_LIBTOOL - - -# AC_LIBTOOL_SETUP -# ---------------- -AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.50)dnl -AC_REQUIRE([AC_ENABLE_SHARED])dnl -AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_LD])dnl -AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl -AC_REQUIRE([AC_PROG_NM])dnl - -AC_REQUIRE([AC_PROG_LN_S])dnl -AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! -AC_REQUIRE([AC_OBJEXT])dnl -AC_REQUIRE([AC_EXEEXT])dnl -dnl - -AC_LIBTOOL_SYS_MAX_CMD_LEN -AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -AC_LIBTOOL_OBJDIR - -AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -_LT_AC_PROG_ECHO_BACKSLASH - -case $host_os in -aix3*) - # 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. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# 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'] - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=mklib -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -AC_CHECK_TOOL(AR, ar, false) -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - AC_PATH_MAGIC - fi - ;; -esac - -AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -enable_win32_dll=yes, enable_win32_dll=no) - -AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -AC_ARG_WITH([pic], - [AC_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) -test -z "$pic_mode" && pic_mode=default - -# Use C for the default configuration in the libtool script -tagname= -AC_LIBTOOL_LANG_C_CONFIG -_LT_AC_TAGCONFIG -])# AC_LIBTOOL_SETUP - - -# _LT_AC_SYS_COMPILER -# ------------------- -AC_DEFUN([_LT_AC_SYS_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_AC_SYS_COMPILER - - -# _LT_AC_SYS_LIBPATH_AIX -# ---------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], -[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_AC_SYS_LIBPATH_AIX - - -# _LT_AC_SHELL_INIT(ARG) -# ---------------------- -AC_DEFUN([_LT_AC_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_AC_SHELL_INIT - - -# _LT_AC_PROG_ECHO_BACKSLASH -# -------------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. -AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[_LT_AC_SHELL_INIT([ -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; -esac - -echo=${ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -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 - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<EOF -[$]* -EOF - exit 0 -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -if test -z "$ECHO"; then -if test "X${echo_test_string+set}" != Xset; then -# 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' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : -else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "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 echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - 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-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -ECHO=$echo -if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi - -AC_SUBST(ECHO) -])])# _LT_AC_PROG_ECHO_BACKSLASH - - -# _LT_AC_LOCK -# ----------- -AC_DEFUN([_LT_AC_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -[*-*-cygwin* | *-*-mingw* | *-*-pw32*) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; - ]) -esac - -need_locks="$enable_libtool_lock" - -])# _LT_AC_LOCK - - -# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # 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 - $2=yes - fi - fi - $rm conftest* -]) - -if test x"[$]$2" = xyes; then - ifelse([$5], , :, [$5]) -else - ifelse([$6], , :, [$6]) -fi -])# AC_LIBTOOL_COMPILER_OPTION - - -# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ------------------------------------------------------------ -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # 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 - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - else - $2=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - ifelse([$4], , :, [$4]) -else - ifelse([$5], , :, [$5]) -fi -])# AC_LIBTOOL_LINKER_OPTION - - -# AC_LIBTOOL_SYS_MAX_CMD_LEN -# -------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], -[# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - testring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ - = "XX$testring") >/dev/null 2>&1 && - new_result=`expr "X$testring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - testring=$testring$testring - done - testring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -])# AC_LIBTOOL_SYS_MAX_CMD_LEN - - -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h)dnl -])# _LT_AC_CHECK_DLFCN - - -# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ------------------------------------------------------------------ -AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<EOF -[#line __oline__ "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include <dlfcn.h> -#endif - -#include <stdio.h> - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -}] -EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_unknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_AC_TRY_DLOPEN_SELF - - -# AC_LIBTOOL_DLOPEN_SELF -# ------------------- -AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -])# AC_LIBTOOL_DLOPEN_SELF - - -# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) -# --------------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler -AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - # 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 . - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . - $rm conftest* out/* - rmdir out - cd .. - rmdir conftest - $rm conftest* -]) -])# AC_LIBTOOL_PROG_CC_C_O - - -# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) -# ----------------------------------------- -# Check to see if we can do hard links to lock some files if needed -AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], -[AC_REQUIRE([_LT_AC_LOCK])dnl - -hard_links="nottested" -if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - 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 - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS - - -# AC_LIBTOOL_OBJDIR -# ----------------- -AC_DEFUN([AC_LIBTOOL_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -])# AC_LIBTOOL_OBJDIR - - -# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) -# ---------------------------------------------- -# Check hardcoding attributes. -AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_AC_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ - test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ - test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then - - # We can hardcode non-existant directories. - if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_AC_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_AC_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_AC_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH - - -# AC_LIBTOOL_SYS_LIB_STRIP -# ------------------------ -AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], -[striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) -fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -])# AC_LIBTOOL_SYS_LIB_STRIP - - -# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# ----------------------------- -# PORTME Fill in your ld.so characteristics -AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], -[AC_MSG_CHECKING([dynamic linker characteristics]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib<name>.so - # instead of lib<name>.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no -])# AC_LIBTOOL_SYS_DYNAMIC_LINKER - - -# _LT_AC_TAGCONFIG -# ---------------- -AC_DEFUN([_LT_AC_TAGCONFIG], -[AC_ARG_WITH([tags], - [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], - [include additional configurations @<:@automatic@:>@])], - [tagnames="$withval"]) - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - AC_MSG_WARN([output file `$ofile' does not exist]) - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) - else - AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in - "") ;; - *) AC_MSG_ERROR([invalid tag name: $tagname]) - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - AC_MSG_ERROR([tag name \"$tagname\" already exists]) - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then - AC_LIBTOOL_LANG_CXX_CONFIG - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - AC_LIBTOOL_LANG_F77_CONFIG - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - AC_LIBTOOL_LANG_GCJ_CONFIG - else - tagname="" - fi - ;; - - RC) - AC_LIBTOOL_LANG_RC_CONFIG - ;; - - *) - AC_MSG_ERROR([Unsupported tag name: $tagname]) - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - AC_MSG_ERROR([unable to update list of available tagged configurations.]) - fi -fi -])# _LT_AC_TAGCONFIG - - -# AC_LIBTOOL_DLOPEN -# ----------------- -# enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], - [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_DLOPEN - - -# AC_LIBTOOL_WIN32_DLL -# -------------------- -# declare package support for building win32 dll's -AC_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_WIN32_DLL - - -# AC_ENABLE_SHARED([DEFAULT]) -# --------------------------- -# implement the --enable-shared flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_SHARED], -[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([shared], - [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]AC_ENABLE_SHARED_DEFAULT) -])# AC_ENABLE_SHARED - - -# AC_DISABLE_SHARED -# ----------------- -#- set the default shared flag to --disable-shared -AC_DEFUN([AC_DISABLE_SHARED], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_SHARED(no) -])# AC_DISABLE_SHARED - - -# AC_ENABLE_STATIC([DEFAULT]) -# --------------------------- -# implement the --enable-static flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_STATIC], -[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([static], - [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]AC_ENABLE_STATIC_DEFAULT) -])# AC_ENABLE_STATIC - - -# AC_DISABLE_STATIC -# ----------------- -# set the default static flag to --disable-static -AC_DEFUN([AC_DISABLE_STATIC], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_STATIC(no) -])# AC_DISABLE_STATIC - - -# AC_ENABLE_FAST_INSTALL([DEFAULT]) -# --------------------------------- -# implement the --enable-fast-install flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_FAST_INSTALL], -[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([fast-install], - [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) -])# AC_ENABLE_FAST_INSTALL - - -# AC_DISABLE_FAST_INSTALL -# ----------------------- -# set the default to --disable-fast-install -AC_DEFUN([AC_DISABLE_FAST_INSTALL], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_FAST_INSTALL(no) -])# AC_DISABLE_FAST_INSTALL - - -# AC_LIBTOOL_PICMODE([MODE]) -# -------------------------- -# implement the --with-pic flag -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -AC_DEFUN([AC_LIBTOOL_PICMODE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -pic_mode=ifelse($#,1,$1,default) -])# AC_LIBTOOL_PICMODE - - -# AC_PROG_EGREP -# ------------- -# This is predefined starting with Autoconf 2.54, so this conditional -# definition can be removed once we require Autoconf 2.54 or later. -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], -[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], - [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi]) - EGREP=$ac_cv_prog_egrep - AC_SUBST([EGREP]) -])]) - - -# AC_PATH_TOOL_PREFIX -# ------------------- -# find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="ifelse([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -])# AC_PATH_TOOL_PREFIX - - -# AC_PATH_MAGIC -# ------------- -# find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# AC_PATH_MAGIC - - -# AC_PROG_LD -# ---------- -# find the path to the GNU or non-GNU linker -AC_DEFUN([AC_PROG_LD], -[AC_ARG_WITH([gnu-ld], - [AC_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], - [with_gnu_ld=no]) -AC_REQUIRE([LT_AC_PROG_SED])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - 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 - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_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. - case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in - *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break - ;; - *) - test "$with_gnu_ld" != yes && break - ;; - esac - fi - done - IFS="$lt_save_ifs" -else - lt_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$lt_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_PROG_LD_GNU -])# AC_PROG_LD - - -# AC_PROG_LD_GNU -# -------------- -AC_DEFUN([AC_PROG_LD_GNU], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -case `"$LD" -v 2>&1 </dev/null` in -*GNU* | *'with BFD'*) - lt_cv_prog_gnu_ld=yes - ;; -*) - lt_cv_prog_gnu_ld=no - ;; -esac]) -with_gnu_ld=$lt_cv_prog_gnu_ld -])# AC_PROG_LD_GNU - - -# AC_PROG_LD_RELOAD_FLAG -# ---------------------- -# find reload flag for linker -# -- PORTME Some linkers may need a different reload flag. -AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], -[AC_CACHE_CHECK([for $LD option to reload object files], - lt_cv_ld_reload_flag, - [lt_cv_ld_reload_flag='-r']) -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -])# AC_PROG_LD_RELOAD_FLAG - - -# AC_DEPLIBS_CHECK_METHOD -# ----------------------- -# how to check for library dependencies -# -- PORTME fill in with the dynamic library characteristics -AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], -[AC_CACHE_CHECK([how to recognise dependent libraries], -lt_cv_deplibs_check_method, -[lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix4* | aix5*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi4*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin* | mingw* | pw32*) - # win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='win32_libid' - ;; - -darwin* | rhapsody*) - # this will be overwritten by pass_all, but leave it in just in case - lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' - lt_cv_file_magic_cmd='/usr/bin/file -L' - case "$host_os" in - rhapsody* | darwin1.[[012]]) - lt_cv_file_magic_test_file=`/System/Library/Frameworks/System.framework/System` - ;; - *) # Darwin 1.3 on - lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' - ;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - irix5* | nonstopux*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" - ;; - *) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" - ;; - esac - lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux*) - case $host_cpu in - alpha* | hppa* | i*86 | ia64* | m68* | mips | mipsel | powerpc* | sparc* | s390* | sh*) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -nto-qnx) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' - else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' - fi - ;; - -osf3* | osf4* | osf5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' - lt_cv_file_magic_test_file=/shlib/libc.so - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - lt_cv_file_magic_test_file=/lib/libc.so - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown -])# AC_DEPLIBS_CHECK_METHOD - - -# AC_PROG_NM -# ---------- -# find the path to a BSD-compatible name lister -AC_DEFUN([AC_PROG_NM], -[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/${ac_tool_prefix}nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # 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 - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - esac - fi - done - IFS="$lt_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -])# AC_PROG_NM - - -# AC_CHECK_LIBM -# ------------- -# check for math library -AC_DEFUN([AC_CHECK_LIBM], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -])# AC_CHECK_LIBM - - -# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl convenience library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with -# '${top_srcdir}/' (note the single quotes!). If your package is not -# flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -AC_DEFUN([AC_LIBLTDL_CONVENIENCE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - case $enable_ltdl_convenience in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; - esac - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_CONVENIENCE - - -# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl installable library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-install to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided and an installed libltdl is not found, it is -# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' -# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single -# quotes!). If your package is not flat and you're not using automake, -# define top_builddir and top_srcdir appropriately in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -AC_DEFUN([AC_LIBLTDL_INSTALLABLE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - AC_CHECK_LIB(ltdl, lt_dlinit, - [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], - [if test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - else - enable_ltdl_install=yes - fi - ]) - if test x"$enable_ltdl_install" = x"yes"; then - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_INSTALLABLE - - -# AC_LIBTOOL_CXX -# -------------- -# enable support for C++ libraries -AC_DEFUN([AC_LIBTOOL_CXX], -[AC_REQUIRE([_LT_AC_LANG_CXX]) -])# AC_LIBTOOL_CXX - - -# _LT_AC_LANG_CXX -# --------------- -AC_DEFUN([_LT_AC_LANG_CXX], -[AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,CXX" | sed 's/^,//'`]) -])# _LT_AC_LANG_CXX - - -# AC_LIBTOOL_F77 -# -------------- -# enable support for Fortran 77 libraries -AC_DEFUN([AC_LIBTOOL_F77], -[AC_REQUIRE([_LT_AC_LANG_F77]) -])# AC_LIBTOOL_F77 - - -# _LT_AC_LANG_F77 -# --------------- -AC_DEFUN([_LT_AC_LANG_F77], -[AC_REQUIRE([AC_PROG_F77]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,F77" | sed 's/^,//'`]) -])# _LT_AC_LANG_F77 - - -# AC_LIBTOOL_GCJ -# -------------- -# enable support for GCJ libraries -AC_DEFUN([AC_LIBTOOL_GCJ], -[AC_REQUIRE([_LT_AC_LANG_GCJ]) -])# AC_LIBTOOL_GCJ - - -# _LT_AC_LANG_GCJ -# --------------- -AC_DEFUN([_LT_AC_LANG_GCJ], -[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], - [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], - [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], - [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,GCJ" | sed 's/^,//'`]) -])# _LT_AC_LANG_GCJ - - -# AC_LIBTOOL_RC -# -------------- -# enable support for Windows resource files -AC_DEFUN([AC_LIBTOOL_RC], -[AC_REQUIRE([LT_AC_PROG_RC]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,RC" | sed 's/^,//'`]) -])# AC_LIBTOOL_RC - - -# AC_LIBTOOL_LANG_C_CONFIG -# ------------------------ -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) -AC_DEFUN([_LT_AC_LANG_C_CONFIG], -[lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - -_LT_AC_SYS_COMPILER - -# -# Check for any special shared library compilation flags. -# -_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' - ;; - esac -fi -if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then - AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$]_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) - _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), - $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), - [], - [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) - - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_DLOPEN_SELF($1) - -# Report which librarie types wil actually be built -AC_MSG_CHECKING([if libtool supports shared libraries]) -AC_MSG_RESULT([$can_build_shared]) - -AC_MSG_CHECKING([whether to build shared libraries]) -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi - ;; -esac -AC_MSG_RESULT([$enable_shared]) - -AC_MSG_CHECKING([whether to build static libraries]) -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -AC_MSG_RESULT([$enable_static]) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_C_CONFIG - - -# AC_LIBTOOL_LANG_CXX_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) -AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], -[AC_LANG_PUSH(C++) -AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) - -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(allow_undefined_flag, $1)= -_LT_AC_TAGVAR(always_export_symbols, $1)=no -_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_direct, $1)=no -_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -_LT_AC_TAGVAR(hardcode_automatic, $1)=no -_LT_AC_TAGVAR(module_cmds, $1)= -_LT_AC_TAGVAR(module_expsym_cmds, $1)= -_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_AC_TAGVAR(no_undefined_flag, $1)= -_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Dependencies to place before and after the object being linked: -_LT_AC_TAGVAR(predep_objects, $1)= -_LT_AC_TAGVAR(postdep_objects, $1)= -_LT_AC_TAGVAR(predeps, $1)= -_LT_AC_TAGVAR(postdeps, $1)= -_LT_AC_TAGVAR(compiler_lib_search_path, $1)= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' -else - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - AC_PROG_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -_LT_AC_TAGVAR(ld_shlibs, $1)=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' - - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi - ;; - - dgux*) - case $cc_basename in - ec++) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - freebsd[12]*) - # C++ shared libraries reported to be fairly broken before switch to ELF - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - freebsd-elf*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - freebsd*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - ;; - gnu*) - ;; - hpux9*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - cxx) - # Compaq C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - m88k*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - sco*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; -esac -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_AC_TAGVAR(GCC, $1)="$GXX" -_LT_AC_TAGVAR(LD, $1)="$LD" - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -AC_LIBTOOL_POSTDEP_PREDEP($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -])# AC_LIBTOOL_LANG_CXX_CONFIG - -# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) -# ------------------------ -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -ifelse([$1],[],[cat > conftest.$ac_ext <<EOF -int a; -void foo (void) { a = 0; } -EOF -],[$1],[CXX],[cat > conftest.$ac_ext <<EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -EOF -],[$1],[F77],[cat > conftest.$ac_ext <<EOF - subroutine foo - implicit none - integer*4 a - a=0 - return - end -EOF -],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF -public class foo { - private int a; - public void bar (void) { - a = 0; - } -}; -EOF -]) -dnl Parse the compiler output and extract the necessary -dnl objects, libraries and library flags. -if AC_TRY_EVAL(ac_compile); then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - # The `*' in the case matches for architectures that use `case' in - # $output_verbose_cmd can trigger glob expansion during the loop - # eval without this substitution. - output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" - - for p in `eval $output_verbose_link_cmd`; do - case $p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" \ - || test $p = "-R"; then - prev=$p - continue - else - prev= - fi - - if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then - _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" - else - _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then - _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}" - else - _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}" - fi - fi - ;; - - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then - _LT_AC_TAGVAR(predep_objects, $1)="$p" - else - _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p" - fi - else - if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then - _LT_AC_TAGVAR(postdep_objects, $1)="$p" - else - _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling $1 test program" -fi - -$rm -f confest.$objext - -case " $_LT_AC_TAGVAR(postdeps, $1) " in -*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; -esac -])# AC_LIBTOOL_POSTDEP_PREDEP - -# AC_LIBTOOL_LANG_F77_CONFIG -# ------------------------ -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)]) -AC_DEFUN([_LT_AC_LANG_F77_CONFIG], -[AC_REQUIRE([AC_PROG_F77]) -AC_LANG_PUSH(Fortran 77) - -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(allow_undefined_flag, $1)= -_LT_AC_TAGVAR(always_export_symbols, $1)=no -_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_direct, $1)=no -_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -_LT_AC_TAGVAR(hardcode_automatic, $1)=no -_LT_AC_TAGVAR(module_cmds, $1)= -_LT_AC_TAGVAR(module_expsym_cmds, $1)= -_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_AC_TAGVAR(no_undefined_flag, $1)= -_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code=" subroutine t\n return\n end\n" - -# Code to be used in simple link tests -lt_simple_link_test_code=" program t\n end\n" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${F77-"f77"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -AC_MSG_CHECKING([if libtool supports shared libraries]) -AC_MSG_RESULT([$can_build_shared]) - -AC_MSG_CHECKING([whether to build shared libraries]) -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; -aix4*) - test "$enable_shared" = yes && enable_static=no - ;; -esac -AC_MSG_RESULT([$enable_shared]) - -AC_MSG_CHECKING([whether to build static libraries]) -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -AC_MSG_RESULT([$enable_static]) - -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_AC_TAGVAR(GCC, $1)="$G77" -_LT_AC_TAGVAR(LD, $1)="$LD" - -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_F77_CONFIG - - -# AC_LIBTOOL_LANG_GCJ_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) -AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], -[AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${GCJ-"gcj"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_RESTORE -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_GCJ_CONFIG - - -# AC_LIBTOOL_LANG_RC_CONFIG -# -------------------------- -# Ensure that the configuration vars for the Windows resource compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) -AC_DEFUN([_LT_AC_LANG_RC_CONFIG], -[AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${RC-"windres"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_RESTORE -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_RC_CONFIG - - -# AC_LIBTOOL_CONFIG([TAGNAME]) -# ---------------------------- -# If TAGNAME is not passed, then create an initial libtool script -# with a default configuration from the untagged config vars. Otherwise -# add code to config.status for appending the configuration named by -# TAGNAME from the matching tagged config vars. -AC_DEFUN([AC_LIBTOOL_CONFIG], -[# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM SED SHELL \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - _LT_AC_TAGVAR(compiler, $1) \ - _LT_AC_TAGVAR(CC, $1) \ - _LT_AC_TAGVAR(LD, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ - _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ - _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \ - _LT_AC_TAGVAR(old_archive_cmds, $1) \ - _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ - _LT_AC_TAGVAR(predep_objects, $1) \ - _LT_AC_TAGVAR(postdep_objects, $1) \ - _LT_AC_TAGVAR(predeps, $1) \ - _LT_AC_TAGVAR(postdeps, $1) \ - _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ - _LT_AC_TAGVAR(archive_cmds, $1) \ - _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ - _LT_AC_TAGVAR(postinstall_cmds, $1) \ - _LT_AC_TAGVAR(postuninstall_cmds, $1) \ - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ - _LT_AC_TAGVAR(allow_undefined_flag, $1) \ - _LT_AC_TAGVAR(no_undefined_flag, $1) \ - _LT_AC_TAGVAR(export_symbols_cmds, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ - _LT_AC_TAGVAR(hardcode_automatic, $1) \ - _LT_AC_TAGVAR(module_cmds, $1) \ - _LT_AC_TAGVAR(module_expsym_cmds, $1) \ - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ - _LT_AC_TAGVAR(exclude_expsyms, $1) \ - _LT_AC_TAGVAR(include_expsyms, $1); do - - case $var in - _LT_AC_TAGVAR(old_archive_cmds, $1) | \ - _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ - _LT_AC_TAGVAR(archive_cmds, $1) | \ - _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ - _LT_AC_TAGVAR(module_cmds, $1) | \ - _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ - _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\[$]0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` - ;; - esac - -ifelse([$1], [], - [cfgfile="${ofile}T" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - $rm -f "$cfgfile" - AC_MSG_NOTICE([creating $ofile])], - [cfgfile="$ofile"]) - - cat <<__EOF__ >> "$cfgfile" -ifelse([$1], [], -[#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: -# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 -# -# This program 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 sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG], -[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) - -# Is the compiler the GNU C compiler? -with_gcc=$_LT_AC_TAGVAR(GCC, $1) - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_[]_LT_AC_TAGVAR(LD, $1) - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext='$shrext' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# 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=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) - -# Commands used to build and install a shared archive. -archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) -archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) -module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" - -# Set to yes if exported symbols are required. -always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) - -# The commands to list exported symbols. -export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) - -# Symbols that must always be exported. -include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) - -ifelse([$1],[], -[# ### END LIBTOOL CONFIG], -[# ### END LIBTOOL TAG CONFIG: $tagname]) - -__EOF__ - -ifelse([$1],[], [ - case $host_os in - aix3*) - cat <<\EOF >> "$cfgfile" - -# 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. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -]) -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - test -f Makefile && make "$ltmain" -fi -])# AC_LIBTOOL_CONFIG - - -# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl - -_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - - AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI - - -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# 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. -symcode='[[BCDEGRST]]' - -# 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. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGISTW]]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -EOF - - if AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat <<EOF > conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <<EOF >> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[[]] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - - -# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) -# --------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], -[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) - ifelse([$1],[CXX],[ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - 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'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - icpc) - # Intel C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx) - # Digital/Compaq C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc) - # Lucid - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - 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'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - newsos6) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - linux*) - case $CC in - icc|ecc) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - ccc) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' - ;; - - solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sunos4*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - uts4*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then - AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), - [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" - ;; -esac -]) - - -# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) -# ------------------------------------ -# See if the linker supports building shared libraries. -AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], -[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -ifelse([$1],[CXX],[ - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -],[ - runpath_var= - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)= - _LT_AC_TAGVAR(archive_expsym_cmds, $1)= - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown - _LT_AC_TAGVAR(hardcode_automatic, $1)=no - _LT_AC_TAGVAR(module_cmds, $1)= - _LT_AC_TAGVAR(module_expsym_cmds, $1)= - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_AC_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp 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'. - _LT_AC_TAGVAR(exclude_expsyms, $1)="_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. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # 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 "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(ld_shlibs, $1)=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 - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - - # 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't use - # them. - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach <jrb3@best.com> says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - _LT_AC_TAGVAR(ld_shlibs, $1)=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 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sunos4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - # see comment about different semantics on the GNU ld section - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - bsdi4*) - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # 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. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi - ;; - - dgux*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - # 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 - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$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 $linker_flags~$rm $lib.exp' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - 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. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4.2uw2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv5*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -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 - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$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 $linker_flags~$rm $lib.exp' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_AC_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) - ;; - esac - fi - ;; -esac -])# AC_LIBTOOL_PROG_LD_SHLIBS - - -# _LT_AC_FILE_LTDLL_C -# ------------------- -# Be careful that the start marker always follows a newline. -AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include <windows.h> -# #undef WIN32_LEAN_AND_MEAN -# #include <stdio.h> -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include <cygwin/cygwin_dll.h> -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ -])# _LT_AC_FILE_LTDLL_C - - -# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) -# --------------------------------- -AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) - - -# old names -AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) -AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) -AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) -AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) -AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) - -# This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL]) - -AC_DEFUN([LT_AC_PROG_GCJ], -[AC_CHECK_TOOL(GCJ, gcj, no) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS) -]) - -AC_DEFUN([LT_AC_PROG_RC], -[AC_CHECK_TOOL(RC, windres, no) -]) - -############################################################ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -############################################################ -# LT_AC_PROG_SED -# -------------- -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -AC_DEFUN([LT_AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && break - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -SED=$lt_cv_path_SED -]) -AC_MSG_RESULT([$SED]) -]) -############################################################################# -# Additional Macros -############################################################################# - -# -# Check for C++ namespace support. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_namespaces.html -# -AC_DEFUN([AC_CXX_NAMESPACES], -[AC_CACHE_CHECK(whether the compiler implements namespaces, -ac_cv_cxx_namespaces, -[AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], - [using namespace Outer::Inner; return i;], - ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_namespaces" = yes; then - AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces]) -fi -]) - -# -# Check for hash_map extension. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_map.html -# -AC_DEFUN([AC_CXX_HAVE_EXT_HASH_MAP], -[AC_CACHE_CHECK(whether the compiler has ext/hash_map, -ac_cv_cxx_have_ext_hash_map, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include <ext/hash_map> -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[hash_map<int, int> t; return 0;], - ac_cv_cxx_have_ext_hash_map=std, ac_cv_cxx_have_ext_hash_map=no) - AC_TRY_COMPILE([#include <ext/hash_map> -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif],[hash_map<int, int> t; return 0;], - ac_cv_cxx_have_ext_hash_map=gnu, ac_cv_cxx_have_ext_hash_map=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_ext_hash_map" = std; then - AC_DEFINE(HAVE_STD_EXT_HASH_MAP,,[define if the compiler has ext/hash_map]) -fi -if test "$ac_cv_cxx_have_ext_hash_map" = gnu; then - AC_DEFINE(HAVE_GNU_EXT_HASH_MAP,,[define if the compiler has ext/hash_map]) -fi -]) - -# -# Check for hash_set extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_EXT_HASH_SET], -[AC_CACHE_CHECK(whether the compiler has ext/hash_set, -ac_cv_cxx_have_ext_hash_set, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include <ext/hash_set> -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[hash_set<int> t; return 0;], - ac_cv_cxx_have_ext_hash_set=std, ac_cv_cxx_have_ext_hash_set=no) - AC_TRY_COMPILE([#include <ext/hash_set> -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif],[hash_set<int> t; return 0;], - ac_cv_cxx_have_ext_hash_set=gnu, ac_cv_cxx_have_ext_hash_set=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_ext_hash_set" = std; then - AC_DEFINE(HAVE_STD_EXT_HASH_SET,,[define if the compiler has ext/hash_set in std]) -fi -if test "$ac_cv_cxx_have_ext_hash_set" = gnu; then - AC_DEFINE(HAVE_GNU_EXT_HASH_SET,,[define if the compiler has ext/hash_set in __gnu_cc]) -fi -]) - -# -# Check for standard iterator extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_STD_ITERATOR], -[AC_CACHE_CHECK(whether the compiler has the standard iterator, -ac_cv_cxx_have_std_iterator, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include <iterator> -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[iterator<int,int,int> t; return 0;], - ac_cv_cxx_have_std_iterator=yes, ac_cv_cxx_have_std_iterator=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_std_iterator" = yes; then - AC_DEFINE(HAVE_STD_ITERATOR,,[define if the compiler has STL iterators]) -fi -]) - -# -# Check for bidirectional iterator extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_BI_ITERATOR], -[AC_CACHE_CHECK(whether the compiler has the bidirectional iterator, -ac_cv_cxx_have_bi_iterator, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include <iterator> -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[bidirectional_iterator<int,int> t; return 0;], - ac_cv_cxx_have_bi_iterator=yes, ac_cv_cxx_have_bi_iterator=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_bi_iterator" = yes; then - AC_DEFINE(HAVE_BI_ITERATOR,,[define if the compiler has bidirectional iterator]) -fi -]) - -# -# Check for forward iterator extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_FWD_ITERATOR], -[AC_CACHE_CHECK(whether the compiler has forward iterators, -ac_cv_cxx_have_fwd_iterator, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include <iterator> -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[forward_iterator<int,int> t; return 0;], - ac_cv_cxx_have_fwd_iterator=yes, ac_cv_cxx_have_fwd_iterator=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_fwd_iterator" = yes; then - AC_DEFINE(HAVE_FWD_ITERATOR,,[define if the compiler has STL iterators]) -fi -]) - -# -# Check for slist extension. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html -# -AC_DEFUN([AC_CXX_HAVE_EXT_SLIST], -[AC_CACHE_CHECK(whether the compiler has ext/slist, -ac_cv_cxx_have_ext_slist, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include <ext/slist> -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[slist<int> s; return 0;], - ac_cv_cxx_have_ext_slist=std, ac_cv_cxx_have_ext_slist=no) - AC_TRY_COMPILE([#include <ext/slist> -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif],[slist<int> s; return 0;], - ac_cv_cxx_have_ext_slist=gnu, ac_cv_cxx_have_ext_slist=no) - - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_ext_slist" = std; then - AC_DEFINE(HAVE_EXT_SLIST,std,[define if the compiler has ext/slist]) -fi -if test "$ac_cv_cxx_have_ext_slist" = gnu; then - AC_DEFINE(HAVE_EXT_SLIST,gnu,[define if the compiler has ext/slist]) -fi -]) - -# -# Check for FLEX. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_namespaces.html -# -AC_DEFUN([AC_PROG_FLEX], -[AC_CACHE_CHECK(, -ac_cv_has_flex, -[AC_PROG_LEX() -]) -if test "$LEX" != "flex"; then - AC_MSG_ERROR([flex not found but required]) -fi -]) - -# -# Check for Bison. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_namespaces.html -# -AC_DEFUN([AC_PROG_BISON], -[AC_CACHE_CHECK(, -ac_cv_has_bison, -[AC_PROG_YACC() -]) -if test "$YACC" != "bison -y"; then - AC_MSG_ERROR([bison not found but required]) -else - AC_SUBST(YACC,[bison],[location of bison]) -fi -]) - -# -# Check for GNU Make. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/check_gnu_make.html -# -AC_DEFUN( - [CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command, - _cv_gnu_make_command='' ; -dnl Search all the common names for GNU make - for a in "$MAKE" make gmake gnumake ; do - if test -z "$a" ; then continue ; fi ; - if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then - _cv_gnu_make_command=$a ; - break; - fi - done ; - ) ; -dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise - if test "x$_cv_gnu_make_command" != "x" ; then - ifGNUmake='' ; - else - ifGNUmake='#' ; - AC_MSG_RESULT("Not found"); - fi - AC_SUBST(ifGNUmake) -] ) - -# -# Check for the ability to mmap a file. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html -# -AC_DEFUN([AC_FUNC_MMAP_FILE], -[AC_CACHE_CHECK(for mmap of files, -ac_cv_func_mmap_file, -[AC_LANG_SAVE - AC_LANG_C - AC_TRY_RUN([ -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif - -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - -#ifdef HAVE_FCNTL_H -#include <fcntl.h> -#endif - - int fd; - int main () { - fd = creat ("foo",0777); fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); unlink ("foo"); return (fd != MAP_FAILED);}], - ac_cv_func_mmap_file=yes, ac_cv_func_mmap_file=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_func_mmap_file" = yes; then - AC_DEFINE(HAVE_MMAP_FILE) - AC_SUBST(MMAP_FILE,[yes]) -fi -]) - -# -# Check for anonymous mmap macros. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html -# -AC_DEFUN([AC_HEADER_MMAP_ANONYMOUS], -[AC_CACHE_CHECK(for MAP_ANONYMOUS vs. MAP_ANON, -ac_cv_header_mmap_anon, -[AC_LANG_SAVE - AC_LANG_C - AC_TRY_COMPILE([#include <sys/mman.h> - #include <unistd.h> - #include <fcntl.h>], - [mmap (0, 1, PROT_READ, MAP_ANONYMOUS, -1, 0); return (0);], - ac_cv_header_mmap_anon=yes, ac_cv_header_mmap_anon=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_header_mmap_anon" = yes; then - AC_DEFINE(HAVE_MMAP_ANONYMOUS) -fi -]) - -# -# Configure a Makefile without clobbering it if it exists and is not out of -# date. This is modified from: -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html -# -AC_DEFUN([AC_CONFIG_MAKEFILE], -[AC_CONFIG_COMMANDS($1,${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/$1 $1,${srcdir}/autoconf/mkinstalldirs `dirname $1`) -]) - -# -# When allocating RWX memory, check whether we need to use /dev/zero -# as the file descriptor or not. -# -# Note: -# Originally from llvm/autoconf/m4/need_dev_zero_for_mmap.m4, written by -# Reid Spencer. -# -AC_DEFUN([AC_NEED_DEV_ZERO_FOR_MMAP], -[AC_CACHE_CHECK([if /dev/zero is needed for mmap], -ac_cv_need_dev_zero_for_mmap, -[if test "$llvm_cv_os_type" = "Interix" ; then - ac_cv_need_dev_zero_for_mmap=yes - else - ac_cv_need_dev_zero_for_mmap=no - fi -]) -if test "$ac_cv_need_dev_zero_for_mmap" = yes; then - AC_DEFINE([NEED_DEV_ZERO_FOR_MMAP],[1], - [Define if /dev/zero should be used when mapping RWX memory, or undefine if its not necessary]) -fi]) -
diff --git a/poolalloc/autoconf/config.guess b/poolalloc/autoconf/config.guess deleted file mode 100755 index cc726cd..0000000 --- a/poolalloc/autoconf/config.guess +++ /dev/null
@@ -1,1388 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - -timestamp='2003-02-22' - -# 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. - -# Originally written by Per Bothner <per@bothner.com>. -# Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to <config-patches@gnu.org>." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit 0;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit 0;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit 0 ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit 0 ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit 0 ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include <stdio.h> /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit 0 ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit 0 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit 0 ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit 0 ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit 0 ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit 0 ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit 0 ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit 0 ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit 0 ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit 0 ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit 0 ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <sys/systemcfg.h> - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo rs6000-ibm-aix3.2.5 - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit 0 ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit 0 ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit 0 ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit 0 ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit 0 ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit 0 ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include <stdlib.h> - #include <unistd.h> - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <unistd.h> - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo unknown-hitachi-hiuxwe2 - exit 0 ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit 0 ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit 0 ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit 0 ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit 0 ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit 0 ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit 0 ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit 0 ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit 0 ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit 0 ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit 0 ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit 0 ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <features.h> - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:3*) - echo i586-pc-interix3 - exit 0 ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit 0 ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit 0 ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit 0 ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - *:GNU:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 - ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit 0 ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit 0 ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit 0 ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit 0 ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit 0 ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <features.h> - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #ifdef __INTEL_COMPILER - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit 0 ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit 0 ;; - i*86:*:5:[78]*) - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` - echo ${UNAME_MACHINE}-pc-isc$UNAME_REL - elif /bin/uname -X 2>/dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit 0 ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit 0 ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit 0 ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit 0 ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit 0 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit 0 ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit 0 ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit 0 ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Richard.M.Bartel@ccMail.Census.GOV> - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes <hewes@openmarket.com>. - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit 0 ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit 0 ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit 0 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit 0 ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit 0 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit 0 ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit 0 ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit 0 ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Darwin:*:*) - case `uname -p` in - *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit 0 ;; - NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit 0 ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit 0 ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit 0 ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit 0 ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit 0 ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit 0 ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit 0 ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit 0 ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c <<EOF -#ifdef _SEQUENT_ -# include <sys/types.h> -# include <sys/utsname.h> -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include <sys/param.h> - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include <sys/param.h> -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit 0 ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - c34*) - echo c34-convex-bsd - exit 0 ;; - c38*) - echo c38-convex-bsd - exit 0 ;; - c4*) - echo c4-convex-bsd - exit 0 ;; - esac -fi - -cat >&2 <<EOF -$0: unable to guess system type - -This script, last modified $timestamp, has failed to recognize -the operating system you are using. It is advised that you -download the most up to date version of the config scripts from - - ftp://ftp.gnu.org/pub/gnu/config/ - -If the version you run ($0) is already up to date, please -send the following data and any information you think might be -pertinent to <config-patches@gnu.org> in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End:
diff --git a/poolalloc/autoconf/config.sub b/poolalloc/autoconf/config.sub deleted file mode 100755 index 9772e87..0000000 --- a/poolalloc/autoconf/config.sub +++ /dev/null
@@ -1,1489 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - -timestamp='2003-02-22' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# 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. - -# Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to <config-patches@gnu.org>." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit 0;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k \ - | m32r | m68000 | m68k | m88k | mcore \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64vr | mips64vrel \ - | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | msp430 \ - | ns16k | ns32k \ - | openrisc | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ - | strongarm \ - | tahoe | thumb | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xscale | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* \ - | m32r-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - crds | unos) - basic_machine=m68k-crds - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - or32 | or32-*) - basic_machine=or32-unknown - os=-coff - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2) - basic_machine=i686-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic4x | c4x*) - basic_machine=tic4x-unknown - os=-coff - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv9 | sparcv9b) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-ibm) - os=-aix - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End:
diff --git a/poolalloc/autoconf/configure.ac b/poolalloc/autoconf/configure.ac deleted file mode 100644 index 1ac6d8e..0000000 --- a/poolalloc/autoconf/configure.ac +++ /dev/null
@@ -1,90 +0,0 @@ -dnl Autoconf requirements -dnl AC_INIT(package, version, bug-report-address) -dnl information on the package -dnl checks for programs -dnl checks for libraries -dnl checks for header files -dnl checks for types -dnl checks for structures -dnl checks for compiler characteristics -dnl checks for library functions -dnl checks for system services -dnl AC_CONFIG_FILES([file...]) -dnl AC_OUTPUT - -dnl ************************************************************************** -dnl * Initialize -dnl ************************************************************************** -AC_INIT([[[Pool Allocation]]],[[[1.0]]],[llvmbugs@cs.uiuc.edu]) - -dnl Place all of the extra autoconf files into the config subdirectory -AC_CONFIG_AUX_DIR([autoconf]) - -dnl Configure Makefiles -AC_CONFIG_MAKEFILE(Makefile) -AC_CONFIG_MAKEFILE(lib/Makefile) -AC_CONFIG_MAKEFILE(lib/PoolAllocate/Makefile) -AC_CONFIG_MAKEFILE(runtime/Makefile) -AC_CONFIG_MAKEFILE(runtime/PoolAllocator/Makefile) -AC_CONFIG_MAKEFILE(runtime/FreeListAllocator/Makefile) -AC_CONFIG_MAKEFILE(test/Makefile) - -dnl ************************************************************************** -dnl * Determine which system we are building on -dnl ************************************************************************** - -dnl ************************************************************************** -dnl * Check for programs. -dnl ************************************************************************** - -dnl Verify that the source directory is valid -AC_CONFIG_SRCDIR(["Makefile.common.in"]) - -dnl ************************************************************************** -dnl * Check for libraries. -dnl ************************************************************************** - -dnl ************************************************************************** -dnl * Checks for header files. -dnl * Chances are, if the standard C or POSIX type header files are missing, -dnl * then LLVM just isn't going to compile. However, it is possible that -dnl * the necessary functions/macros will be included from other -dnl * (non-standard and non-obvious) header files. -dnl * -dnl * So, we'll be gracious, give it a chance, and try to go on without -dnl * them. -dnl ************************************************************************** -AC_HEADER_MMAP_ANONYMOUS -AC_HEADER_STAT -AC_CHECK_HEADERS([fcntl.h sys/mman.h]) - -dnl ************************************************************************** -dnl * Checks for typedefs, structures, and compiler characteristics. -dnl ************************************************************************** - -dnl ************************************************************************** -dnl * Checks for library functions. -dnl ************************************************************************** -AC_FUNC_MMAP -AC_FUNC_MMAP_FILE -AC_NEED_DEV_ZERO_FOR_MMAP - -dnl ************************************************************************** -dnl * Enable various compile-time options -dnl ************************************************************************** - -dnl ************************************************************************** -dnl * Set the location of various third-party software packages -dnl ************************************************************************** - -dnl Location of LLVM source code -AC_ARG_WITH(llvmsrc,AC_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]),AC_SUBST(LLVM_SRC,[$withval]),AC_SUBST(LLVM_SRC,[`cd ${srcdir}/../..; pwd`])) - -dnl Location of LLVM object code -AC_ARG_WITH(llvmobj,AC_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]),AC_SUBST(LLVM_OBJ,[$withval]),AC_SUBST(LLVM_OBJ,[`cd ../..; pwd`])) - -dnl ************************************************************************** -dnl * Create the output files -dnl ************************************************************************** -AC_CONFIG_HEADERS(include/poolalloc/Config/config.h) -AC_OUTPUT(Makefile.common)
diff --git a/poolalloc/autoconf/install-sh b/poolalloc/autoconf/install-sh deleted file mode 100644 index 398a88e..0000000 --- a/poolalloc/autoconf/install-sh +++ /dev/null
@@ -1,251 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - : -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - chmodcmd="" - else - instcmd=$mkdirprog - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - : - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - : - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - : - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' - ' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - : - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - : - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0
diff --git a/poolalloc/autoconf/ltmain.sh b/poolalloc/autoconf/ltmain.sh deleted file mode 100644 index fe83ff4..0000000 --- a/poolalloc/autoconf/ltmain.sh +++ /dev/null
@@ -1,6290 +0,0 @@ -# ltmain.sh - Provide generalized library-building support services. -# NOTE: Changing this file will not affect anything until you rerun configure. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 -# Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 -# -# This program 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. - -# Check that we have a working $echo. -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<EOF -$* -EOF - exit 0 -fi - -# The name of this program. -progname=`$echo "$0" | ${SED} 's%^.*/%%'` -modename="$progname" - -# Constants. -PROGRAM=ltmain.sh -PACKAGE=libtool -VERSION=1.5 -TIMESTAMP=" (1.1220 2003/04/05 19:32:58)" - -default_mode= -help="Try \`$progname --help' for more information." -magic="%%%MAGIC variable%%%" -mkdir="mkdir" -mv="mv -f" -rm="rm -f" - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' -sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' -# test EBCDIC or ASCII -case `echo A|od -x` in - *[Cc]1*) # EBCDIC based system - SP2NL="tr '\100' '\n'" - NL2SP="tr '\r\n' '\100\100'" - ;; - *) # Assume ASCII based system - SP2NL="tr '\040' '\012'" - NL2SP="tr '\015\012' '\040\040'" - ;; -esac - -# 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). -# We save the old values to restore during execute mode. -if test "${LC_ALL+set}" = set; then - save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL -fi -if test "${LANG+set}" = set; then - save_LANG="$LANG"; LANG=C; export LANG -fi - -# Make sure IFS has a sensible default -: ${IFS=" "} - -if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - $echo "$modename: not configured to build any kind of library" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 -fi - -# Global variables. -mode=$default_mode -nonopt= -prev= -prevopt= -run= -show="$echo" -show_help= -execute_dlfiles= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" - -##################################### -# Shell function definitions: -# This seems to be the best place for them - -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -win32_libid () { - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ - grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | \ - sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` - if test "X$win32_nmres" = "Ximport" ; then - win32_libid_type="x86 archive import" - else - win32_libid_type="x86 archive static" - fi - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $echo $win32_libid_type -} - -# End of Shell function definitions -##################################### - -# Parse our command line options once, thoroughly. -while test "$#" -gt 0 -do - arg="$1" - shift - - case $arg in - -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - execute_dlfiles) - execute_dlfiles="$execute_dlfiles $arg" - ;; - tag) - tagname="$arg" - - # Check whether tagname contains only valid characters - case $tagname in - *[!-_A-Za-z0-9,/]*) - $echo "$progname: invalid tag name: $tagname" 1>&2 - exit 1 - ;; - esac - - case $tagname in - CC) - # Don't test for the "default" C tag, as we know, it's there, but - # not specially marked. - ;; - *) - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then - taglist="$taglist $tagname" - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" - else - $echo "$progname: ignoring unknown tag $tagname" 1>&2 - fi - ;; - esac - ;; - *) - eval "$prev=\$arg" - ;; - esac - - prev= - prevopt= - continue - fi - - # Have we seen a non-optional argument yet? - case $arg in - --help) - show_help=yes - ;; - - --version) - $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - $echo - $echo "Copyright (C) 2003 Free Software Foundation, Inc." - $echo "This is free software; see the source for copying conditions. There is NO" - $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit 0 - ;; - - --config) - ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 - # Now print the configurations for the tags. - for tagname in $taglist; do - ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0" - done - exit 0 - ;; - - --debug) - $echo "$progname: enabling shell trace mode" - set -x - ;; - - --dry-run | -n) - run=: - ;; - - --features) - $echo "host: $host" - if test "$build_libtool_libs" = yes; then - $echo "enable shared libraries" - else - $echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - $echo "enable static libraries" - else - $echo "disable static libraries" - fi - exit 0 - ;; - - --finish) mode="finish" ;; - - --mode) prevopt="--mode" prev=mode ;; - --mode=*) mode="$optarg" ;; - - --preserve-dup-deps) duplicate_deps="yes" ;; - - --quiet | --silent) - show=: - ;; - - --tag) prevopt="--tag" prev=tag ;; - --tag=*) - set tag "$optarg" ${1+"$@"} - shift - prev=tag - ;; - - -dlopen) - prevopt="-dlopen" - prev=execute_dlfiles - ;; - - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - - *) - nonopt="$arg" - break - ;; - esac -done - -if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 -fi - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - -if test -z "$show_help"; then - - # Infer the operation mode. - if test -z "$mode"; then - $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 - $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 - case $nonopt in - *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) - mode=link - for arg - do - case $arg in - -c) - mode=compile - break - ;; - esac - done - ;; - *db | *dbx | *strace | *truss) - mode=execute - ;; - *install*|cp|mv) - mode=install - ;; - *rm) - mode=uninstall - ;; - *) - # If we have no mode, but dlfiles were specified, then do execute mode. - test -n "$execute_dlfiles" && mode=execute - - # Just use the default operation mode. - if test -z "$mode"; then - if test -n "$nonopt"; then - $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 - else - $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 - fi - fi - ;; - esac - fi - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - $echo "$modename: unrecognized option \`-dlopen'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$modename --help --mode=$mode' for more information." - - # These modes are in order of execution frequency so that they run quickly. - case $mode in - # libtool compile mode - compile) - modename="$modename: compile" - # Get the compilation command and the source file. - base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_output= - arg_mode=normal - libobj= - - for arg - do - case "$arg_mode" in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; - - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. - case $arg in - -o) - if test -n "$libobj" ; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit 1 - fi - arg_mode=target - continue - ;; - - -static) - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # Add the arguments to base_compile. - base_compile="$base_compile $lastarg" - continue - ;; - - * ) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - case $lastarg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" - ;; - esac - - base_compile="$base_compile $lastarg" - done # for arg - - case $arg_mode in - arg) - $echo "$modename: you must specify an argument for -Xcompile" - exit 1 - ;; - target) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit 1 - ;; - *) - # Get the name of the library object. - [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSifmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.ii) xform=ii ;; - *.class) xform=class ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - *.java) xform=java ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit 1 - ;; - esac - - # Infer tagged configuration to use if any are available and - # if one wasn't chosen via the "--tag" command line option. - # Only attempt this if the compiler in the base compile - # command doesn't match the default compiler. - if test -n "$available_tags" && test -z "$tagname"; then - case $base_compile in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" - case "$base_compile " in - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit 1 -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi - - objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir= - else - xdir=$xdir/ - fi - lobj=${xdir}$objdir/$objname - - if test -z "$base_compile"; then - $echo "$modename: you must specify a compilation command" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - $run $rm $removelist - trap "$run $rm $removelist; exit 1" 1 2 15 - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit 1" 1 2 15 - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $run ln "$0" "$lockfile" 2>/dev/null; do - $show "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - $echo "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - $echo $srcfile > "$lockfile" - fi - - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi - - $run $rm "$libobj" "${libobj}T" - - # Create a libtool object file (analogous to a ".la" file), - # but don't create it if we're doing a dry run. - test -z "$run" && cat > ${libobj}T <<EOF -# $libobj - a libtool object file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# Name of the PIC object. -EOF - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - if test "$pic_mode" != no; then - command="$base_compile $srcfile $pic_flag" - else - # Don't build PIC code - command="$base_compile $srcfile" - fi - - if test ! -d "${xdir}$objdir"; then - $show "$mkdir ${xdir}$objdir" - $run $mkdir ${xdir}$objdir - status=$? - if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then - exit $status - fi - fi - - if test -z "$output_obj"; then - # Place PIC objects in $objdir - command="$command -o $lobj" - fi - - $run $rm "$lobj" "$output_obj" - - $show "$command" - if $run eval "$command"; then : - else - test -n "$output_obj" && $run $rm $removelist - exit 1 - fi - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - $show "$mv $output_obj $lobj" - if $run $mv $output_obj $lobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Append the name of the PIC object to the libtool object file. - test -z "$run" && cat >> ${libobj}T <<EOF -pic_object='$objdir/$objname' - -EOF - - # Allow error messages only from the first compilation. - suppress_output=' >/dev/null 2>&1' - else - # No PIC object so indicate it doesn't exist in the libtool - # object file. - test -z "$run" && cat >> ${libobj}T <<EOF -pic_object=none - -EOF - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - if test "$pic_mode" != yes; then - # Don't build PIC code - command="$base_compile $srcfile" - else - command="$base_compile $srcfile $pic_flag" - fi - if test "$compiler_c_o" = yes; then - command="$command -o $obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - command="$command$suppress_output" - $run $rm "$obj" "$output_obj" - $show "$command" - if $run eval "$command"; then : - else - $run $rm $removelist - exit 1 - fi - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - $show "$mv $output_obj $obj" - if $run $mv $output_obj $obj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Append the name of the non-PIC object the libtool object file. - # Only append if the libtool object file exists. - test -z "$run" && cat >> ${libobj}T <<EOF -# Name of the non-PIC object. -non_pic_object='$objname' - -EOF - else - # Append the name of the non-PIC object the libtool object file. - # Only append if the libtool object file exists. - test -z "$run" && cat >> ${libobj}T <<EOF -# Name of the non-PIC object. -non_pic_object=none - -EOF - fi - - $run $mv "${libobj}T" "${libobj}" - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - $run $rm "$lockfile" - fi - - exit 0 - ;; - - # libtool link mode - link | relink) - modename="$modename: link" - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - # It is impossible to link a dll without this setting, and - # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra - # flag for every libtool invocation. - # allow_undefined=no - - # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not - # even a static library is built. For now, we need to specify - # -no-undefined on the libtool link line when we can be certain - # that all symbols are satisfied, otherwise we get a static library. - allow_undefined=yes - ;; - *) - allow_undefined=yes - ;; - esac - libtool_args="$nonopt" - base_compile="$nonopt" - compile_command="$nonopt" - finalize_command="$nonopt" - - compile_rpath= - finalize_rpath= - compile_shlibpath= - finalize_shlibpath= - convenience= - old_convenience= - deplibs= - old_deplibs= - compiler_flags= - linker_flags= - dllsearchpath= - lib_search_path=`pwd` - inst_prefix_dir= - - avoid_version=no - dlfiles= - dlprefiles= - dlself=no - export_dynamic=no - export_symbols= - export_symbols_regex= - generated= - libobjs= - ltlibs= - module=no - no_install=no - objs= - non_pic_objects= - prefer_static_libs=no - preload=no - prev= - prevarg= - release= - rpath= - xrpath= - perm_rpath= - temp_rpath= - thread_safe=no - vinfo= - vinfo_number=no - - # We need to know -static, to get the right output filenames. - for arg - do - case $arg in - -all-static | -static) - if test "X$arg" = "X-all-static"; then - if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - else - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - fi - build_libtool_libs=no - build_old_libs=yes - prefer_static_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - base_compile="$base_compile $arg" - shift - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test - ;; - *) qarg=$arg ;; - esac - libtool_args="$libtool_args $qarg" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - compile_command="$compile_command @OUTPUT@" - finalize_command="$finalize_command @OUTPUT@" - ;; - esac - - case $prev in - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - compile_command="$compile_command @SYMFILE@" - finalize_command="$finalize_command @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - else - dlprefiles="$dlprefiles $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - if test ! -f "$arg"; then - $echo "$modename: symbol file \`$arg' does not exist" - exit 1 - fi - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat $save_arg` - do -# moreargs="$moreargs $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit 1 - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit 1 - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - done - else - $echo "$modename: link input file \`$save_arg' does not exist" - exit 1 - fi - arg=$save_arg - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) rpath="$rpath $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; - esac - fi - prev= - continue - ;; - xcompiler) - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" - prev= - compile_command="$compile_command $wl$qarg" - finalize_command="$finalize_command $wl$qarg" - continue - ;; - xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 - continue - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: more than one -exported-symbols argument is not allowed" - exit 1 - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - ;; - esac - continue - ;; - - -L*) - dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit 1 - fi - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "*) ;; - *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - case :$dllsearchpath: in - *":$dir:"*) ;; - *) dllsearchpath="$dllsearchpath:$dir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-pw32* | *-*-beos*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-mingw* | *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs -framework System" - continue - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - deplibs="$deplibs $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # gcc -m* arguments should be passed to the linker via $compiler_flags - # in order to pass architecture information to the linker - # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo - # but this is not reliable with gcc because gcc may use -mfoo to - # select a different linker, different libraries, etc, while - # -Wl,-mfoo simply passes -mfoo to the linker. - -m*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - if test "$with_gcc" = "yes" ; then - compiler_flags="$compiler_flags $arg" - fi - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - # The PATH hackery in wrapper scripts is required on Windows - # in order for the loader to find any dlls it needs. - $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 - $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - - -static) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Wl,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $wl$flag" - linker_flags="$linker_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # Some other compiler flag. - -* | +*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - - *.$objext) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit 1 - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit 1 - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - ;; - - *.$libext) - # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" - prev= - else - deplibs="$deplibs $arg" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - done # argument parsing loop - - if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Infer tagged configuration to use if any are available and - # if one wasn't chosen via the "--tag" command line option. - # Only attempt this if the compiler in the base link - # command doesn't match the default compiler. - if test -n "$available_tags" && test -z "$tagname"; then - case $base_compile in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" - case $base_compile in - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) - # The compiler in $compile_command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit 1 -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi - # Create the object directory. - if test ! -d "$output_objdir"; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test "$status" -ne 0 && test ! -d "$output_objdir"; then - exit $status - fi - fi - - # Determine the type of output - case $output in - "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - case $host in - *cygwin* | *mingw* | *pw32*) - # don't eliminate duplcations in $postdeps and $predeps - duplicate_compiler_generated_deps=yes - ;; - *) - duplicate_compiler_generated_deps=$duplicate_deps - ;; - esac - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if test "X$duplicate_deps" = "Xyes" ; then - case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - libs="$libs $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; - esac - pre_post_deps="$pre_post_deps $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - case $linkmode in - lib) - passes="conv link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit 1 - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - for pass in $passes; do - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; - esac - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - for deplib in $libs; do - lib= - found=no - case $deplib in - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 - continue - fi - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` - for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - # Search the libtool library - lib="$searchdir/lib${name}.la" - if test -f "$lib"; then - found=yes - break - fi - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if (${SED} -e '2q' $lib | - grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - library_names= - old_library= - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - ;; - *) - $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) lib="$deplib" ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - if test "$deplibs_check_method" != pass_all; then - $echo - $echo "*** Warning: Trying to link with static lib archive $deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because the file extensions .$libext of this argument makes me believe" - $echo "*** that it is just a static archive that I should not used here." - else - $echo - $echo "*** Warning: Linking the shared library $output against the" - $echo "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - if test "$found" = yes || test -f "$lib"; then : - else - $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit 1 - fi - - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 - fi - - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - - # Read the .la file - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 - fi - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - elif test "$linkmode" != prog && test "$linkmode" != lib; then - $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit 1 - fi - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 - exit 1 - fi - if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" - else - newdlfiles="$newdlfiles $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - abs_ladir="$ladir" - fi - ;; - esac - laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - $echo "$modename: warning: library \`$lib' was moved." 1>&2 - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$libdir" - absdir="$libdir" - fi - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - fi # $installed = yes - name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit 1 - fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" - fi - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" - need_relink=yes - fi - # This is a shared library - - # Warn about portability, can't link against -module's on some systems (darwin) - if test "$shouldnotlink" = yes && test "$pass" = link ; then - $echo - if test "$linkmode" = prog; then - $echo "*** Warning: Linking the executable $output against the loadable module" - else - $echo "*** Warning: Linking the shared library $output against the loadable module" - fi - $echo "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - realname="$2" - shift; shift - libname=`eval \\$echo \"$libname_spec\"` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw*) - major=`expr $current - $age` - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - soname=`$echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - $show "extracting exported symbol list from \`$soname'" - save_ifs="$IFS"; IFS='~' - eval cmds=\"$extract_expsyms_cmds\" - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - $show "generating import library for \`$soname'" - save_ifs="$IFS"; IFS='~' - eval cmds=\"$old_archive_from_expsyms_cmds\" - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5* ) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a module then we can not link against it, someone - # is ignoring the new warnings I added - if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then - $echo "** Warning, lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - $echo - $echo "** And there doesn't seem to be a static archive available" - $echo "** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="-L$inst_prefix_dir$libdir $add_dir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit 1 - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && \ - test "$hardcode_minus_L" != yes && \ - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="-L$inst_prefix_dir$libdir $add_dir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - $echo - $echo "*** Warning: This system can not link to static lib archive $lib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - $echo "*** But as you try to build a module library, libtool will still create " - $echo "*** a static module, that should work as long as the dlopening application" - $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - convenience="$convenience $dir/$old_library" - old_convenience="$old_convenience $dir/$old_library" - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - *) temp_deplibs="$temp_deplibs $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - newlib_search_path="$newlib_search_path $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - case $deplib in - -L*) path="$deplib" ;; - *.la) - dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$deplib" && dir="." - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 - absdir="$dir" - fi - ;; - esac - if grep "^installed=no" $deplib > /dev/null; then - path="$absdir/$objdir" - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit 1 - fi - if test "$absdir" != "$libdir"; then - $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 - fi - path="$absdir" - fi - depdepl= - case $host in - *-*-darwin*) - # we do not want to link against static libs, but need to link against shared - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$path/$depdepl" ; then - depdepl="$path/$depdepl" - fi - newlib_search_path="$newlib_search_path $path" - path="" - fi - ;; - *) - path="-L$path" - ;; - esac - - ;; - -l*) - case $host in - *-*-darwin*) - # Again, we only want to link against shared libraries - eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` - for tmp in $newlib_search_path ; do - if test -f "$tmp/lib$tmp_libs.dylib" ; then - eval depdepl="$tmp/lib$tmp_libs.dylib" - break - fi - done - path="" - ;; - *) continue ;; - esac - ;; - *) continue ;; - esac - case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$deplibs $depdepl" ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$deplibs $path" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - tmp_libs="$tmp_libs $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 - fi - - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 - fi - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - objs="$objs$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval shared_ext=\"$shrext\" - eval libname=\"$libname_spec\" - ;; - *) - if test "$module" = no; then - $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - eval shared_ext=\"$shrext\" - eval libname=\"$libname_spec\" - else - libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 - exit 1 - else - $echo - $echo "*** Warning: Linking the shared library $output against the non-libtool" - $echo "*** objects $objs is not portable!" - libobjs="$libobjs $objs" - fi - fi - - if test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 - fi - - set dummy $rpath - if test "$#" -gt 2; then - $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 - fi - install_libdir="$2" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 - fi - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - IFS="$save_ifs" - - if test -n "$8"; then - $echo "$modename: too many parameters to \`-version-info'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$2" - number_minor="$3" - number_revision="$4" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows) - current=`expr $number_major + $number_minor` - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - current=`expr $number_major + $number_minor - 1` - age="$number_minor" - revision="$number_minor" - ;; - esac - ;; - no) - current="$2" - revision="$3" - age="$4" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; - *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case $revision in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; - *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case $age in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; - *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - if test "$age" -gt "$current"; then - $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - minor_current=`expr $current + 1` - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current"; - ;; - - irix | nonstopux) - major=`expr $current - $age + 1` - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - iface=`expr $revision - $loop` - loop=`expr $loop - 1` - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - ;; - - osf) - major=.`expr $current - $age` - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - iface=`expr $current - $loop` - loop=`expr $loop - 1` - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - major=`expr $current - $age` - versuffix="-$major" - ;; - - *) - $echo "$modename: unknown library version type \`$version_type'" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - fi - - if test "$mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$echo "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - removelist="$removelist $p" - ;; - *) ;; - esac - done - if test -n "$removelist"; then - $show "${rm}r $removelist" - $run ${rm}r $removelist - fi - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - for path in $notinst_path; do - lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` - deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` - dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` - done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - deplibs="$deplibs -framework System" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $rm conftest.c - cat > conftest.c <<EOF - int main() { return 0; } -EOF - $rm conftest - $LTCC -o conftest conftest.c $deplibs - if test "$?" -eq 0 ; then - ldd_output=`ldd conftest` - for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" -ne "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $i "*) - newdeplibs="$newdeplibs $i" - i="" - ;; - esac - fi - if test -n "$i" ; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - $echo - $echo "*** Warning: dynamic linker does not accept needed library $i." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which I believe you do not have" - $echo "*** because a test_compile did reveal that the linker did not use it for" - $echo "*** its dynamic dependency list that programs get resolved with at runtime." - fi - fi - else - newdeplibs="$newdeplibs $i" - fi - done - else - # Error occurred in the first compile. Let's try to salvage - # the situation: Compile a separate program for each library. - for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then - $rm conftest - $LTCC -o conftest conftest.c $i - # Did it work? - if test "$?" -eq 0 ; then - ldd_output=`ldd conftest` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $i "*) - newdeplibs="$newdeplibs $i" - i="" - ;; - esac - fi - if test -n "$i" ; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - $echo - $echo "*** Warning: dynamic linker does not accept needed library $i." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because a test_compile did reveal that the linker did not use this one" - $echo "*** as a dynamic dependency that programs can get resolved with at runtime." - fi - fi - else - droppeddeps=yes - $echo - $echo "*** Warning! Library $i is needed by this library but I was not able to" - $echo "*** make it link in! You will probably need to install it or some" - $echo "*** library that it depends on before this library will be fully" - $echo "*** functional. Installing it before continuing would be even better." - fi - else - newdeplibs="$newdeplibs $i" - fi - done - fi - ;; - file_magic*) - set dummy $deplibs_check_method - file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - for a_deplib in $deplibs; do - name="`expr $a_deplib : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null \ - | grep " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for file magic test)" - else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a file magic. Last file checked: $potlib" - fi - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - for a_deplib in $deplibs; do - name="`expr $a_deplib : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval $echo \"$potent_lib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a regex pattern. Last file checked: $potlib" - fi - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` - done - fi - if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ - | grep . >/dev/null; then - $echo - if test "X$deplibs_check_method" = "Xnone"; then - $echo "*** Warning: inter-library dependencies are not supported in this platform." - else - $echo "*** Warning: inter-library dependencies are not known to be supported." - fi - $echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - fi - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - $echo - $echo "*** Warning: libtool could not satisfy all declared inter-library" - $echo "*** dependencies of module $libname. Therefore, libtool will create" - $echo "*** a static module, that should work as long as the dlopening" - $echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - $echo "*** The inter-library dependencies that have been dropped here will be" - $echo "*** automatically added whenever a program is linked with this library" - $echo "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - $echo - $echo "*** Since this library must not contain undefined symbols," - $echo "*** because either the platform does not support them or" - $echo "*** it was explicitly requested with -no-undefined," - $echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $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\" - dep_rpath="$dep_rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$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" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - realname="$2" - shift; shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - for link - do - linknames="$linknames $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - eval cmds=\"$export_symbols_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - if len=`expr "X$cmd" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - $show "$cmd" - $run eval "$cmd" || exit $? - skipped_export=false - else - # The command line is too long to execute in one step. - $show "using reloadable object file for export list..." - skipped_export=: - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex"; then - $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - $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 - - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - tmp_deplibs="$tmp_deplibs $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - 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 cmds=\"$module_expsym_cmds\" - else - eval cmds=\"$module_cmds\" - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" - else - eval cmds=\"$archive_cmds\" - fi - fi - - if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` && - 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 - - # 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/$save_output-${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" : ".*"` && - 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/$save_output-${k}.$objext - k=`expr $k + 1` - output=$output_objdir/$save_output-${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 reloadale object files - # after they are used. - i=0 - while test "$i" -lt "$k" - do - i=`expr $i + 1` - delfiles="$delfiles $output_objdir/$save_output-${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 - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" - else - eval cmds=\"$archive_cmds\" - fi - - # Append the command to remove the reloadable object files - # to the just-reset $cmds. - eval cmds=\"\$cmds~$rm $delfiles\" - fi - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - 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 $? - exit 0 - 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 - exit 1 - 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 - # -Wl from whole_archive_flag_spec - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${obj}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - 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" - eval cmds=\"$reload_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $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 - - exit 0 - 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. - # $show "echo timestamp > $libobj" - # $run eval "echo timestamp > $libobj" || exit $? - exit 0 - 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" - eval cmds=\"$reload_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $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 - - exit 0 - ;; - - prog) - case $host in - *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; - 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 - - 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 - - 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*) - case :$dllsearchpath: in - *":$libdir:"*) ;; - *) dllsearchpath="$dllsearchpath:$libdir";; - esac - ;; - 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 - $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - if test -n "$export_symbols_regex"; then - $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$output.exp" - $run $rm $export_symbols - $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - else - $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' - $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' - $run eval 'mv "$nlist"T "$nlist"' - fi - fi - - for arg in $dlprefiles; do - $show "extracting global C symbols from \`$arg'" - name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval '$echo ": $name " >> "$nlist"' - $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 - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $mv "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - 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 - : - else - grep -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' - else - $echo '/* NONE */' >> "$output_objdir/$dlsyms" - 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. */ -const struct { - 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 "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; - esac;; - *-*-hpux*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag";; - esac - esac - - # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? - - # 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. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - ;; - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit 1 - ;; - 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. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - $show "$link_command" - $run eval "$link_command" - status=$? - - # Delete the generated files. - if test -n "$dlsyms"; then - $show "$rm $output_objdir/${outputname}S.${objext}" - $run $rm "$output_objdir/${outputname}S.${objext}" - fi - - exit $status - 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 $? - exit 0 - 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 - relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` - 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)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $0 --fallback-echo"; then - case $0 in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; - *) qecho="$SHELL `pwd`/$0 --fallback-echo";; - 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 - *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - cwrappersource=`$echo ${objdir}/lt-${output}.c` - cwrapper=`$echo ${output}.exe` - $rm $cwrappersource $cwrapper - trap "$rm $cwrappersource $cwrapper; exit 1" 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> - -#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 '/' -#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 -#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 */ - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -const char *program_name = NULL; - -void * xmalloc (size_t num); -char * xstrdup (const char *string); -char * basename (const char *name); -char * fnqualify(const char *path); -char * strendzap(char *str, const char *pat); -void lt_fatal (const char *message, ...); - -int -main (int argc, char *argv[]) -{ - char **newargz; - int i; - - program_name = (char *) xstrdup ((char *) basename (argv[0])); - newargz = XMALLOC(char *, argc+2); -EOF - - cat >> $cwrappersource <<EOF - newargz[0] = "$SHELL"; -EOF - - cat >> $cwrappersource <<"EOF" - newargz[1] = fnqualify(argv[0]); - /* we know the script has the same name, without the .exe */ - /* so make sure newargz[1] doesn't end in .exe */ - strendzap(newargz[1],".exe"); - for (i = 1; i < argc; i++) - newargz[i+1] = xstrdup(argv[i]); - newargz[argc+1] = NULL; -EOF - - cat >> $cwrappersource <<EOF - execv("$SHELL",newargz); -EOF - - cat >> $cwrappersource <<"EOF" -} - -void * -xmalloc (size_t num) -{ - void * p = (void *) malloc (num); - if (!p) - lt_fatal ("Memory exhausted"); - - return p; -} - -char * -xstrdup (const char *string) -{ - return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL -; -} - -char * -basename (const char *name) -{ - const char *base; - -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha (name[0]) && name[1] == ':') - name += 2; -#endif - - for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) - base = name + 1; - return (char *) base; -} - -char * -fnqualify(const char *path) -{ - size_t size; - char *p; - char tmp[LT_PATHMAX + 1]; - - assert(path != NULL); - - /* Is it qualified already? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha (path[0]) && path[1] == ':') - return xstrdup (path); -#endif - if (IS_DIR_SEPARATOR (path[0])) - return xstrdup (path); - - /* prepend the current directory */ - /* doesn't handle '~' */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ - p = XMALLOC(char, size); - sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); - return p; -} - -char * -strendzap(char *str, const char *pat) -{ - size_t len, patlen; - - assert(str != NULL); - assert(pat != NULL); - - len = strlen(str); - patlen = strlen(pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp(str, pat) == 0) - *str = '\0'; - } - return str; -} - -static void -lt_error_core (int exit_status, const char * mode, - const char * message, va_list ap) -{ - fprintf (stderr, "%s: %s: ", program_name, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); - va_end (ap); -} -EOF - # we should really use a build-platform specific compiler - # here, but OTOH, the wrappers (shell script and this C one) - # are only useful if you want to execute the "real" binary. - # Since the "real" binary is built for $host, then this - # wrapper might as well be built for $host, too. - $run $LTCC -s -o $cwrapper $cwrappersource - ;; - esac - $rm $output - trap "$rm $output; exit 1" 1 2 15 - - $echo > $output "\ -#! $SHELL - -# $output - temporary wrapper script 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 script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' -sed_quote_subst='$sed_quote_subst' - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variable: - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$echo are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - echo=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$echo works! - : - else - # Restart under the correct shell, and then maybe \$echo will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ -" - $echo >> $output "\ - - # Find the directory that this script lives in. - thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` - done - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $echo >> $output "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || \\ - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $mkdir \"\$progdir\" - else - $rm \"\$progdir/\$file\" - fi" - - $echo >> $output "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $echo \"\$relink_command_output\" >&2 - $rm \"\$progdir/\$file\" - exit 1 - fi - fi - - $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $rm \"\$progdir/\$program\"; - $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $rm \"\$progdir/\$file\" - fi" - else - $echo >> $output "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $echo >> $output "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $echo >> $output "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $echo >> $output "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $echo >> $output "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2*) - $echo >> $output "\ - exec \$progdir\\\\\$program \${1+\"\$@\"} -" - ;; - - *) - $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} -" - ;; - esac - $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit 1 - fi - else - # The program doesn't exist. - \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 - \$echo \"This script is just a wrapper for \$program.\" 1>&2 - $echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" - chmod +x $output - fi - exit 0 - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - # Add in members from convenience archives. - for xlib in $addlibs; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` - done - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - eval cmds=\"$old_archive_from_new_cmds\" - else - eval cmds=\"$old_archive_cmds\" - - if len=`expr "X$cmds" : ".*"` && - 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 in parts - $echo "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - # GNU ar 2.10+ was changed to match POSIX; thus no paths are - # encoded into archives. This makes 'ar r' malfunction in - # this piecewise linking case whenever conflicting object - # names appear in distinct ar calls; check, warn and compensate. - if (for obj in $save_oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 - $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 - AR_FLAGS=cq - fi - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - for obj in $save_oldobjs - do - oldobjs="$objlist $obj" - objlist="$objlist $obj" - eval test_cmds=\"$old_archive_cmds\" - if len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~$old_archive_cmds\" - fi - fi - fi - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$generated"; then - $show "${rm}r$generated" - $run ${rm}r$generated - fi - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - $show "creating $output" - - # 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 - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - - # Only create the output if not a dry run. - if test -z "$run"; then - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit 1 - fi - newdependency_libs="$newdependency_libs $libdir/$name" - ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - for lib in $dlfiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 - fi - newdlfiles="$newdlfiles $libdir/$name" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 - fi - newdlprefiles="$newdlprefiles $libdir/$name" - done - dlprefiles="$newdlprefiles" - fi - $rm $output - # place dlname in correct position for cygwin - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; - esac - $echo > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $echo >> $output "\ -relink_command=\"$relink_command\"" - fi - done - fi - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" - $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? - ;; - esac - exit 0 - ;; - - # libtool install mode - install) - modename="$modename: install" - - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then - # Aesthetically quote it. - arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$arg " - arg="$1" - shift - else - install_prog= - arg="$nonopt" - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog$arg" - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - for arg - do - if test -n "$dest"; then - files="$files $dest" - dest="$arg" - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) prev="-f" ;; - -g) prev="-g" ;; - -m) prev="-m" ;; - -o) prev="-o" ;; - -s) - stripme=" -s" - continue - ;; - -*) ;; - - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - prev= - else - dest="$arg" - continue - fi - ;; - esac - - # Aesthetically quote the argument. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog $arg" - done - - if test -z "$install_prog"; then - $echo "$modename: you must specify an install program" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -z "$files"; then - if test -z "$dest"; then - $echo "$modename: no file or destination specified" 1>&2 - else - $echo "$modename: you must specify a destination" 1>&2 - fi - $echo "$help" 1>&2 - exit 1 - fi - - # Strip any trailing slash from the destination. - dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` - test "X$destdir" = "X$dest" && destdir=. - destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` - - # Not a directory, so check to see that there is only one file specified. - set dummy $files - if test "$#" -gt 2; then - $echo "$modename: \`$dest' is not a directory" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - library_names= - old_library= - relink_command= - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ - test "X$dir" = "X$file/" && dir= - dir="$dir$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - if test "$inst_prefix_dir" = "$destdir"; then - $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 - exit 1 - fi - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - $echo "$modename: warning: relinking \`$file'" 1>&2 - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - exit 1 - fi - fi - - # See the names of the shared library. - set dummy $library_names - if test -n "$2"; then - realname="$2" - shift - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - $show "$install_prog $dir/$srcname $destdir/$realname" - $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? - if test -n "$stripme" && test -n "$striplib"; then - $show "$striplib $destdir/$realname" - $run eval "$striplib $destdir/$realname" || exit $? - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - for linkname - do - if test "$linkname" != "$realname"; then - $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - fi - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - eval cmds=\"$postinstall_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Install the pseudo-library for information purposes. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - instname="$dir/$name"i - $show "$install_prog $instname $destdir/$name" - $run eval "$install_prog $instname $destdir/$name" || exit $? - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - - # Install the libtool object if requested. - if test -n "$destfile"; then - $show "$install_prog $file $destfile" - $run eval "$install_prog $file $destfile" || exit $? - fi - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` - - $show "$install_prog $staticobj $staticdest" - $run eval "$install_prog \$staticobj \$staticdest" || exit $? - fi - exit 0 - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - file=`$echo $file|${SED} 's,.exe$,,'` - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin*|*mingw*) - wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` - ;; - *) - wrapper=$file - ;; - esac - if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then - notinst_deplibs= - relink_command= - - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac - # If there is no directory component, then add one. - case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; - esac - - # Check the variables that should have been set. - if test -z "$notinst_deplibs"; then - $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 - exit 1 - fi - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - # If there is no directory component, then add one. - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - fi - libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 - finalize=no - fi - done - - relink_command= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac - # If there is no directory component, then add one. - case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; - esac - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - if test "$finalize" = yes && test -z "$run"; then - tmpdir="/tmp" - test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir="$tmpdir/libtool-$$" - if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : - else - $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 - continue - fi - file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` - - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - ${rm}r "$tmpdir" - continue - fi - file="$outputname" - else - $echo "$modename: warning: cannot relink \`$file'" 1>&2 - fi - else - # Install the binary that we compiled earlier. - file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyways - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` - ;; - esac - ;; - esac - $show "$install_prog$stripme $file $destfile" - $run eval "$install_prog\$stripme \$file \$destfile" || exit $? - test -n "$outputname" && ${rm}r "$tmpdir" - ;; - esac - done - - for file in $staticlibs; do - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - $show "$install_prog $file $oldlib" - $run eval "$install_prog \$file \$oldlib" || exit $? - - if test -n "$stripme" && test -n "$striplib"; then - $show "$old_striplib $oldlib" - $run eval "$old_striplib $oldlib" || exit $? - fi - - # Do each command in the postinstall commands. - eval cmds=\"$old_postinstall_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$future_libdirs"; then - $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 - fi - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $0 --finish$current_libdirs' - else - exit 0 - fi - ;; - - # libtool finish mode - finish) - modename="$modename: finish" - libdirs="$nonopt" - admincmds= - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - eval cmds=\"$finish_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || admincmds="$admincmds - $cmd" - done - IFS="$save_ifs" - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $run eval "$cmds" || admincmds="$admincmds - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - test "$show" = : && exit 0 - - $echo "----------------------------------------------------------------------" - $echo "Libraries have been installed in:" - for libdir in $libdirs; do - $echo " $libdir" - done - $echo - $echo "If you ever happen to want to link against installed libraries" - $echo "in a given directory, LIBDIR, you must either use libtool, and" - $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - $echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - $echo " during execution" - fi - if test -n "$runpath_var"; then - $echo " - add LIBDIR to the \`$runpath_var' environment variable" - $echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $echo " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $echo " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - $echo - $echo "See any operating system documentation about shared libraries for" - $echo "more information, such as the ld(1) and ld.so(8) manual pages." - $echo "----------------------------------------------------------------------" - exit 0 - ;; - - # libtool execute mode - execute) - modename="$modename: execute" - - # The first argument is the command name. - cmd="$nonopt" - if test -z "$cmd"; then - $echo "$modename: you must specify a COMMAND" 1>&2 - $echo "$help" - exit 1 - fi - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - if test ! -f "$file"; then - $echo "$modename: \`$file' is not a file" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - dir= - case $file in - *.la) - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Read the libtool library. - dlname= - library_names= - - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" - continue - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit 1 - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - ;; - - *) - $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -*) ;; - *) - # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` - args="$args \"$file\"" - done - - if test -z "$run"; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - if test "${save_LC_ALL+set}" = set; then - LC_ALL="$save_LC_ALL"; export LC_ALL - fi - if test "${save_LANG+set}" = set; then - LANG="$save_LANG"; export LANG - fi - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" - fi - $echo "$cmd$args" - exit 0 - fi - ;; - - # libtool clean and uninstall mode - clean | uninstall) - modename="$modename: $mode" - rm="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) rm="$rm $arg"; rmforce=yes ;; - -*) rm="$rm $arg" ;; - *) files="$files $arg" ;; - esac - done - - if test -z "$rm"; then - $echo "$modename: you must specify an RM program" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - rmdirs= - - origobjdir="$objdir" - for file in $files; do - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$file"; then - dir=. - objdir="$origobjdir" - else - objdir="$dir/$origobjdir" - fi - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test "$mode" = uninstall && objdir="$dir" - - # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then - case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if (test -L "$file") >/dev/null 2>&1 \ - || (test -h "$file") >/dev/null 2>&1 \ - || test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - . $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" - done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - - if test "$mode" = uninstall; then - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - eval cmds=\"$postuninstall_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - eval cmds=\"$old_postuninstall_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - # FIXME: should reinstall the best remaining shared library. - fi - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - - # Read the .lo file - . $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" \ - && test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" \ - && test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$mode" = clean ; then - noexename=$name - case $file in - *.exe) - file=`$echo $file|${SED} 's,.exe$,,'` - noexename=`$echo $name|${SED} 's,.exe$,,'` - # $file with .exe has already been added to rmfiles, - # add $file without .exe - rmfiles="$rmfiles $file" - ;; - esac - # Do a test to see if this is a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$noexename - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - $show "$rm $rmfiles" - $run $rm $rmfiles || exit_status=1 - done - objdir="$origobjdir" - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - $show "rmdir $dir" - $run rmdir $dir >/dev/null 2>&1 - fi - done - - exit $exit_status - ;; - - "") - $echo "$modename: you must specify a MODE" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 - ;; - esac - - if test -z "$exec_cmd"; then - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 - fi -fi # test -z "$show_help" - -if test -n "$exec_cmd"; then - eval exec $exec_cmd - exit 1 -fi - -# We need to display help for each of the modes. -case $mode in -"") $echo \ -"Usage: $modename [OPTION]... [MODE-ARG]... - -Provide generalized library-building support services. - - --config show all configuration variables - --debug enable verbose shell tracing --n, --dry-run display commands without modifying any files - --features display basic configuration information and exit - --finish same as \`--mode=finish' - --help display this help message and exit - --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] - --quiet same as \`--silent' - --silent don't print informational messages - --tag=TAG use configuration variables from tag TAG - --version print version information - -MODE must be one of the following: - - clean remove files from the build directory - compile compile a source file into a libtool object - execute automatically set library path, then run a program - finish complete the installation of libtool libraries - install install libraries or executables - link create a library or an executable - uninstall remove libraries from an installed directory - -MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE. - -Report bugs to <bug-libtool@gnu.org>." - exit 0 - ;; - -clean) - $echo \ -"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - -compile) - $echo \ -"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -prefer-pic try to building PIC objects only - -prefer-non-pic try to building non-PIC objects only - -static always build a \`.o' file suitable for static linking - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - -execute) - $echo \ -"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - -finish) - $echo \ -"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - -install) - $echo \ -"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - -link) - $echo \ -"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -static do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - -uninstall) - $echo \ -"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - -*) - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; -esac - -$echo -$echo "Try \`$modename --help' for more information about other modes." - -exit 0 - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End:
diff --git a/poolalloc/autoconf/mkinstalldirs b/poolalloc/autoconf/mkinstalldirs deleted file mode 100755 index 994d71c..0000000 --- a/poolalloc/autoconf/mkinstalldirs +++ /dev/null
@@ -1,101 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman <friedman@prep.ai.mit.edu> -# Created: 1993-05-16 -# Public domain - -# $Id$ - -errstatus=0 -dirmode="" - -usage="\ -Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." - -# process command line arguments -while test $# -gt 0 ; do - case "${1}" in - -h | --help | --h* ) # -h for help - echo "${usage}" 1>&2; exit 0 ;; - -m ) # -m PERM arg - shift - test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } - dirmode="${1}" - shift ;; - -- ) shift; break ;; # stop option processing - -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option - * ) break ;; # first non-opt arg - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in -0) exit 0 ;; -esac - -case $dirmode in -'') - if mkdir -p -- . 2>/dev/null; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - fi ;; -*) - if mkdir -m "$dirmode" -p -- . 2>/dev/null; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - fi ;; -esac - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" - - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# Local Variables: -# mode: shell-script -# sh-indentation: 3 -# End: -# mkinstalldirs ends here
diff --git a/poolalloc/configure b/poolalloc/configure deleted file mode 100755 index ae64413..0000000 --- a/poolalloc/configure +++ /dev/null
@@ -1,4644 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for [Pool Allocation] [1.0]. -# -# Report bugs to <llvmbugs@cs.uiuc.edu>. -# -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi - -# Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_config_libobj_dir=. -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Identity of this package. -PACKAGE_NAME='[Pool Allocation]' -PACKAGE_TARNAME='--pool-allocation--' -PACKAGE_VERSION='[1.0]' -PACKAGE_STRING='[Pool Allocation] [1.0]' -PACKAGE_BUGREPORT='llvmbugs@cs.uiuc.edu' - -ac_unique_file=""Makefile.common.in"" -# Factoring default headers for most tests. -ac_includes_default="\ -#include <stdio.h> -#if HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif -#if HAVE_SYS_STAT_H -# include <sys/stat.h> -#endif -#if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#else -# if HAVE_STDLIB_H -# include <stdlib.h> -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include <memory.h> -# endif -# include <string.h> -#endif -#if HAVE_STRINGS_H -# include <strings.h> -#endif -#if HAVE_INTTYPES_H -# include <inttypes.h> -#else -# if HAVE_STDINT_H -# include <stdint.h> -# endif -#endif -#if HAVE_UNISTD_H -# include <unistd.h> -#endif" - -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP MMAP_FILE LLVM_SRC LLVM_OBJ LIBOBJS LTLIBOBJS' -ac_subst_files='' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -ac_prev= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures [Pool Allocation] [1.0] to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -_ACEOF - - cat <<_ACEOF -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] -_ACEOF - - cat <<\_ACEOF -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of [Pool Allocation] [1.0]:";; - esac - cat <<\_ACEOF - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-llvmsrc Location of LLVM Source Code - --with-llvmobj Location of LLVM Object Code - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a - nonstandard directory <lib dir> - CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have - headers in a nonstandard directory <include dir> - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to <llvmbugs@cs.uiuc.edu>. -_ACEOF -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd $ac_popdir - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\_ACEOF -[Pool Allocation] configure [1.0] -generated by GNU Autoconf 2.57 - -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit 0 -fi -exec 5>config.log -cat >&5 <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by [Pool Allocation] $as_me [1.0], which was -generated by GNU Autoconf 2.57. Invocation command line was - - $ $0 $@ - -_ACEOF -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_sep= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core core.* *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status - ' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ac_aux_dir= -for ac_dir in autoconf $srcdir/autoconf; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f $ac_dir/shtool; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&2;} - { (exit 1); exit 1; }; } -fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - - - ac_config_commands="$ac_config_commands Makefile" - - - ac_config_commands="$ac_config_commands lib/Makefile" - - - ac_config_commands="$ac_config_commands lib/PoolAllocate/Makefile" - - - ac_config_commands="$ac_config_commands runtime/Makefile" - - - ac_config_commands="$ac_config_commands runtime/PoolAllocator/Makefile" - - - ac_config_commands="$ac_config_commands runtime/FreeListAllocator/Makefile" - - - ac_config_commands="$ac_config_commands test/Makefile" - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 - (eval $ac_compiler --version </dev/null >&5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 - (eval $ac_compiler -v </dev/null >&5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 - (eval $ac_compiler -V </dev/null >&5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -echo "$as_me:$LINENO: checking for C compiler default output" >&5 -echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; - * ) - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <stdarg.h> -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - ''\ - '#include <stdlib.h>' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <stdlib.h> -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest.$ac_ext -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -echo "$as_me:$LINENO: checking for MAP_ANONYMOUS vs. MAP_ANON" >&5 -echo $ECHO_N "checking for MAP_ANONYMOUS vs. MAP_ANON... $ECHO_C" >&6 -if test "${ac_cv_header_mmap_anon+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <sys/mman.h> - #include <unistd.h> - #include <fcntl.h> -int -main () -{ -mmap (0, 1, PROT_READ, MAP_ANONYMOUS, -1, 0); return (0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_mmap_anon=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_mmap_anon=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -fi -echo "$as_me:$LINENO: result: $ac_cv_header_mmap_anon" >&5 -echo "${ECHO_T}$ac_cv_header_mmap_anon" >&6 -if test "$ac_cv_header_mmap_anon" = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_MMAP_ANONYMOUS 1 -_ACEOF - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <ac_nonexistent.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <ac_nonexistent.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - -echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5 -echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6 -if test "${ac_cv_header_stat_broken+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <sys/types.h> -#include <sys/stat.h> - -#if defined(S_ISBLK) && defined(S_IFDIR) -# if S_ISBLK (S_IFDIR) -You lose. -# endif -#endif - -#if defined(S_ISBLK) && defined(S_IFCHR) -# if S_ISBLK (S_IFCHR) -You lose. -# endif -#endif - -#if defined(S_ISLNK) && defined(S_IFREG) -# if S_ISLNK (S_IFREG) -You lose. -# endif -#endif - -#if defined(S_ISSOCK) && defined(S_IFREG) -# if S_ISSOCK (S_IFREG) -You lose. -# endif -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "You lose" >/dev/null 2>&1; then - ac_cv_header_stat_broken=yes -else - ac_cv_header_stat_broken=no -fi -rm -f conftest* - -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stat_broken" >&5 -echo "${ECHO_T}$ac_cv_header_stat_broken" >&6 -if test $ac_cv_header_stat_broken = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STAT_MACROS_BROKEN 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <float.h> - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdc=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <string.h> - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <stdlib.h> - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <ctype.h> -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6 -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - -for ac_header in fcntl.h sys/mman.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - no:yes ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - - -for ac_header in stdlib.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - no:yes ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_func in getpagesize -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -echo "$as_me:$LINENO: checking for working mmap" >&5 -echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 -if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_mmap_fixed_mapped=no -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -/* malloc might have been renamed as rpl_malloc. */ -#undef malloc - -/* Thanks to Mike Haertel and Jim Avera for this test. - Here is a matrix of mmap possibilities: - mmap private not fixed - mmap private fixed at somewhere currently unmapped - mmap private fixed at somewhere already mapped - mmap shared not fixed - mmap shared fixed at somewhere currently unmapped - mmap shared fixed at somewhere already mapped - For private mappings, we should verify that changes cannot be read() - back from the file, nor mmap's back from the file at a different - address. (There have been systems where private was not correctly - implemented like the infamous i386 svr4.0, and systems where the - VM page cache was not coherent with the file system buffer cache - like early versions of FreeBSD and possibly contemporary NetBSD.) - For shared mappings, we should conversely verify that changes get - propagated back to all the places they're supposed to be. - - Grep wants private fixed already mapped. - The main things grep needs to know about mmap are: - * does it exist and is it safe to write into the mmap'd area - * how to use it (BSD variants) */ - -#include <fcntl.h> -#include <sys/mman.h> - -#if !STDC_HEADERS && !HAVE_STDLIB_H -char *malloc (); -#endif - -/* This mess was copied from the GNU getpagesize.h. */ -#if !HAVE_GETPAGESIZE -/* Assume that all systems that can run configure have sys/param.h. */ -# if !HAVE_SYS_PARAM_H -# define HAVE_SYS_PARAM_H 1 -# endif - -# ifdef _SC_PAGESIZE -# define getpagesize() sysconf(_SC_PAGESIZE) -# else /* no _SC_PAGESIZE */ -# if HAVE_SYS_PARAM_H -# include <sys/param.h> -# ifdef EXEC_PAGESIZE -# define getpagesize() EXEC_PAGESIZE -# else /* no EXEC_PAGESIZE */ -# ifdef NBPG -# define getpagesize() NBPG * CLSIZE -# ifndef CLSIZE -# define CLSIZE 1 -# endif /* no CLSIZE */ -# else /* no NBPG */ -# ifdef NBPC -# define getpagesize() NBPC -# else /* no NBPC */ -# ifdef PAGESIZE -# define getpagesize() PAGESIZE -# endif /* PAGESIZE */ -# endif /* no NBPC */ -# endif /* no NBPG */ -# endif /* no EXEC_PAGESIZE */ -# else /* no HAVE_SYS_PARAM_H */ -# define getpagesize() 8192 /* punt totally */ -# endif /* no HAVE_SYS_PARAM_H */ -# endif /* no _SC_PAGESIZE */ - -#endif /* no HAVE_GETPAGESIZE */ - -int -main () -{ - char *data, *data2, *data3; - int i, pagesize; - int fd; - - pagesize = getpagesize (); - - /* First, make a file with some known garbage in it. */ - data = (char *) malloc (pagesize); - if (!data) - exit (1); - for (i = 0; i < pagesize; ++i) - *(data + i) = rand (); - umask (0); - fd = creat ("conftest.mmap", 0600); - if (fd < 0) - exit (1); - if (write (fd, data, pagesize) != pagesize) - exit (1); - close (fd); - - /* Next, try to mmap the file at a fixed address which already has - something else allocated at it. If we can, also make sure that - we see the same garbage. */ - fd = open ("conftest.mmap", O_RDWR); - if (fd < 0) - exit (1); - data2 = (char *) malloc (2 * pagesize); - if (!data2) - exit (1); - data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); - if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) - exit (1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - exit (1); - - /* Finally, make sure that changes to the mapped area do not - percolate back to the file as seen by read(). (This is a bug on - some variants of i386 svr4.0.) */ - for (i = 0; i < pagesize; ++i) - *(data2 + i) = *(data2 + i) + 1; - data3 = (char *) malloc (pagesize); - if (!data3) - exit (1); - if (read (fd, data3, pagesize) != pagesize) - exit (1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - exit (1); - close (fd); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_mmap_fixed_mapped=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_mmap_fixed_mapped=no -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 -echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 -if test $ac_cv_func_mmap_fixed_mapped = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_MMAP 1 -_ACEOF - -fi -rm -f conftest.mmap - -echo "$as_me:$LINENO: checking for mmap of files" >&5 -echo $ECHO_N "checking for mmap of files... $ECHO_C" >&6 -if test "${ac_cv_func_mmap_file+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif - -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - -#ifdef HAVE_FCNTL_H -#include <fcntl.h> -#endif - - int fd; - int main () { - fd = creat ("foo",0777); fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); unlink ("foo"); return (fd != MAP_FAILED);} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_mmap_file=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_mmap_file=no -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -fi -echo "$as_me:$LINENO: result: $ac_cv_func_mmap_file" >&5 -echo "${ECHO_T}$ac_cv_func_mmap_file" >&6 -if test "$ac_cv_func_mmap_file" = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_MMAP_FILE 1 -_ACEOF - - MMAP_FILE=yes - -fi - -echo "$as_me:$LINENO: checking if /dev/zero is needed for mmap" >&5 -echo $ECHO_N "checking if /dev/zero is needed for mmap... $ECHO_C" >&6 -if test "${ac_cv_need_dev_zero_for_mmap+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$llvm_cv_os_type" = "Interix" ; then - ac_cv_need_dev_zero_for_mmap=yes - else - ac_cv_need_dev_zero_for_mmap=no - fi - -fi -echo "$as_me:$LINENO: result: $ac_cv_need_dev_zero_for_mmap" >&5 -echo "${ECHO_T}$ac_cv_need_dev_zero_for_mmap" >&6 -if test "$ac_cv_need_dev_zero_for_mmap" = yes; then - -cat >>confdefs.h <<\_ACEOF -#define NEED_DEV_ZERO_FOR_MMAP 1 -_ACEOF - -fi - - - - -# Check whether --with-llvmsrc or --without-llvmsrc was given. -if test "${with_llvmsrc+set}" = set; then - withval="$with_llvmsrc" - LLVM_SRC=$withval - -else - LLVM_SRC=`cd ${srcdir}/../..; pwd` - -fi; - - -# Check whether --with-llvmobj or --without-llvmobj was given. -if test "${with_llvmobj+set}" = set; then - withval="$with_llvmobj" - LLVM_OBJ=$withval - -else - LLVM_OBJ=`cd ../..; pwd` - -fi; - - ac_config_headers="$ac_config_headers include/poolalloc/Config/config.h" - - ac_config_files="$ac_config_files Makefile.common" -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi - -# Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by [Pool Allocation] $as_me [1.0], which was -generated by GNU Autoconf 2.57. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\_ACEOF - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to <bug-autoconf@gnu.org>." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -[Pool Allocation] config.status [1.0] -configured by $0, generated by GNU Autoconf 2.57, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -# -# INIT-COMMANDS section. -# - -${srcdir}/autoconf/mkinstalldirs `dirname Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname lib/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname lib/PoolAllocate/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname runtime/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname runtime/PoolAllocator/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname runtime/FreeListAllocator/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname test/Makefile` - -_ACEOF - - - -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "Makefile.common" ) CONFIG_FILES="$CONFIG_FILES Makefile.common" ;; - "Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; - "lib/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Makefile" ;; - "lib/PoolAllocate/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/PoolAllocate/Makefile" ;; - "runtime/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS runtime/Makefile" ;; - "runtime/PoolAllocator/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS runtime/PoolAllocator/Makefile" ;; - "runtime/FreeListAllocator/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS runtime/FreeListAllocator/Makefile" ;; - "test/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Makefile" ;; - "include/poolalloc/Config/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/poolalloc/Config/config.h" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@MMAP_FILE@,$MMAP_FILE,;t t -s,@LLVM_SRC@,$LLVM_SRC,;t t -s,@LLVM_OBJ@,$LLVM_OBJ,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` - - - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; - *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; - *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -_ACEOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_COMMANDS section. -# -for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue - ac_dest=`echo "$ac_file" | sed 's,:.*,,'` - ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_dir=`(dirname "$ac_dest") 2>/dev/null || -$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_dest" : 'X\(//\)[^/]' \| \ - X"$ac_dest" : 'X\(//\)$' \| \ - X"$ac_dest" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_dest" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` - - - { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 -echo "$as_me: executing $ac_dest commands" >&6;} - case $ac_dest in - Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; - lib/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/Makefile lib/Makefile ;; - lib/PoolAllocate/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/PoolAllocate/Makefile lib/PoolAllocate/Makefile ;; - runtime/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/runtime/Makefile runtime/Makefile ;; - runtime/PoolAllocator/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/runtime/PoolAllocator/Makefile runtime/PoolAllocator/Makefile ;; - runtime/FreeListAllocator/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/runtime/FreeListAllocator/Makefile runtime/FreeListAllocator/Makefile ;; - test/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Makefile test/Makefile ;; - esac -done -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi -
diff --git a/poolalloc/include/dsa/CallTargets.h b/poolalloc/include/dsa/CallTargets.h deleted file mode 100644 index d4f56e8..0000000 --- a/poolalloc/include/dsa/CallTargets.h +++ /dev/null
@@ -1,54 +0,0 @@ -//=- llvm/Analysis/CallTargets.h - Resolve Indirect Call Targets --*- C++ -*-=// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This pass uses DSA to map targets of all calls, and reports on if it -// thinks it knows all targets of a given call. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ANALYSIS_CALLTARGETS_H -#define LLVM_ANALYSIS_CALLTARGETS_H - -#include "llvm/Pass.h" -#include "llvm/Support/CallSite.h" - -#include <set> -#include <list> - -namespace llvm { - - class CallTargetFinder : public ModulePass { - std::map<CallSite, std::vector<Function*> > IndMap; - std::set<CallSite> CompleteSites; - std::list<CallSite> AllSites; - - void findIndTargets(Module &M); - public: - virtual bool runOnModule(Module &M); - - virtual void getAnalysisUsage(AnalysisUsage &AU) const; - - virtual void print(std::ostream &O, const Module *M) const; - - // Given a CallSite, get an iterator of callees - std::vector<Function*>::iterator begin(CallSite cs); - std::vector<Function*>::iterator end(CallSite cs); - - // Iterate over CallSites in program - std::list<CallSite>::iterator cs_begin(); - std::list<CallSite>::iterator cs_end(); - - // Do we think we have complete knowledge of this site? - // That is, do we think there are no missing callees - bool isComplete(CallSite cs) const; - }; - -} - -#endif
diff --git a/poolalloc/include/dsa/DSGraph.h b/poolalloc/include/dsa/DSGraph.h deleted file mode 100644 index eb4388b..0000000 --- a/poolalloc/include/dsa/DSGraph.h +++ /dev/null
@@ -1,581 +0,0 @@ -//===- DSGraph.h - Represent a collection of data structures ----*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This header defines the data structure graph (DSGraph) and the -// ReachabilityCloner class. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ANALYSIS_DSGRAPH_H -#define LLVM_ANALYSIS_DSGRAPH_H - -#include "llvm/Analysis/DataStructure/DSNode.h" -#include "llvm/ADT/hash_map" -#include "llvm/ADT/EquivalenceClasses.h" -#include <list> - -namespace llvm { - -class GlobalValue; - -//===----------------------------------------------------------------------===// -/// DSScalarMap - An instance of this class is used to keep track of all of -/// which DSNode each scalar in a function points to. This is specialized to -/// keep track of globals with nodes in the function, and to keep track of the -/// unique DSNodeHandle being used by the scalar map. -/// -/// This class is crucial to the efficiency of DSA with some large SCC's. In -/// these cases, the cost of iterating over the scalar map dominates the cost -/// of DSA. In all of these cases, the DSA phase is really trying to identify -/// globals or unique node handles active in the function. -/// -class DSScalarMap { - typedef hash_map<Value*, DSNodeHandle> ValueMapTy; - ValueMapTy ValueMap; - - typedef hash_set<GlobalValue*> GlobalSetTy; - GlobalSetTy GlobalSet; - - EquivalenceClasses<GlobalValue*> &GlobalECs; -public: - DSScalarMap(EquivalenceClasses<GlobalValue*> &ECs) : GlobalECs(ECs) {} - - EquivalenceClasses<GlobalValue*> &getGlobalECs() const { return GlobalECs; } - - // Compatibility methods: provide an interface compatible with a map of - // Value* to DSNodeHandle's. - typedef ValueMapTy::const_iterator const_iterator; - typedef ValueMapTy::iterator iterator; - iterator begin() { return ValueMap.begin(); } - iterator end() { return ValueMap.end(); } - const_iterator begin() const { return ValueMap.begin(); } - const_iterator end() const { return ValueMap.end(); } - - GlobalValue *getLeaderForGlobal(GlobalValue *GV) const { - EquivalenceClasses<GlobalValue*>::iterator ECI = GlobalECs.findValue(GV); - if (ECI == GlobalECs.end()) return GV; - return *GlobalECs.findLeader(ECI); - } - - - iterator find(Value *V) { - iterator I = ValueMap.find(V); - if (I != ValueMap.end()) return I; - - if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) { - // If this is a global, check to see if it is equivalenced to something - // in the map. - GlobalValue *Leader = getLeaderForGlobal(GV); - if (Leader != GV) - I = ValueMap.find((Value*)Leader); - } - return I; - } - const_iterator find(Value *V) const { - const_iterator I = ValueMap.find(V); - if (I != ValueMap.end()) return I; - - if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) { - // If this is a global, check to see if it is equivalenced to something - // in the map. - GlobalValue *Leader = getLeaderForGlobal(GV); - if (Leader != GV) - I = ValueMap.find((Value*)Leader); - } - return I; - } - - /// getRawEntryRef - This method can be used by clients that are aware of the - /// global value equivalence class in effect. - DSNodeHandle &getRawEntryRef(Value *V) { - std::pair<iterator,bool> IP = - ValueMap.insert(std::make_pair(V, DSNodeHandle())); - if (IP.second) // Inserted the new entry into the map. - if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) - GlobalSet.insert(GV); - return IP.first->second; - } - - unsigned count(Value *V) const { return ValueMap.find(V) != ValueMap.end(); } - - void erase(Value *V) { erase(ValueMap.find(V)); } - - void eraseIfExists(Value *V) { - iterator I = find(V); - if (I != end()) erase(I); - } - - /// replaceScalar - When an instruction needs to be modified, this method can - /// be used to update the scalar map to remove the old and insert the new. - /// - void replaceScalar(Value *Old, Value *New) { - iterator I = find(Old); - assert(I != end() && "Old value is not in the map!"); - ValueMap.insert(std::make_pair(New, I->second)); - erase(I); - } - - /// copyScalarIfExists - If Old exists in the scalar map, make New point to - /// whatever Old did. - void copyScalarIfExists(Value *Old, Value *New) { - iterator I = find(Old); - if (I != end()) - ValueMap.insert(std::make_pair(New, I->second)); - } - - /// operator[] - Return the DSNodeHandle for the specified value, creating a - /// new null handle if there is no entry yet. - DSNodeHandle &operator[](Value *V) { - iterator I = ValueMap.find(V); - if (I != ValueMap.end()) - return I->second; // Return value if already exists. - - if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) - return AddGlobal(GV); - - return ValueMap.insert(std::make_pair(V, DSNodeHandle())).first->second; - } - - void erase(iterator I) { - assert(I != ValueMap.end() && "Cannot erase end!"); - if (GlobalValue *GV = dyn_cast<GlobalValue>(I->first)) - GlobalSet.erase(GV); - ValueMap.erase(I); - } - - void clear() { - ValueMap.clear(); - GlobalSet.clear(); - } - - /// spliceFrom - Copy all entries from RHS, then clear RHS. - /// - void spliceFrom(DSScalarMap &RHS); - - // Access to the global set: the set of all globals currently in the - // scalar map. - typedef GlobalSetTy::const_iterator global_iterator; - global_iterator global_begin() const { return GlobalSet.begin(); } - global_iterator global_end() const { return GlobalSet.end(); } - unsigned global_size() const { return GlobalSet.size(); } - unsigned global_count(GlobalValue *GV) const { return GlobalSet.count(GV); } -private: - DSNodeHandle &AddGlobal(GlobalValue *GV); -}; - - -//===----------------------------------------------------------------------===// -/// DSGraph - The graph that represents a function. -/// -class DSGraph { -public: - // Public data-type declarations... - typedef DSScalarMap ScalarMapTy; - typedef hash_map<Function*, DSNodeHandle> ReturnNodesTy; - typedef ilist<DSNode> NodeListTy; - - /// NodeMapTy - This data type is used when cloning one graph into another to - /// keep track of the correspondence between the nodes in the old and new - /// graphs. - typedef hash_map<const DSNode*, DSNodeHandle> NodeMapTy; - - // InvNodeMapTy - This data type is used to represent the inverse of a node - // map. - typedef hash_multimap<DSNodeHandle, const DSNode*> InvNodeMapTy; -private: - DSGraph *GlobalsGraph; // Pointer to the common graph of global objects - bool PrintAuxCalls; // Should this graph print the Aux calls vector? - - NodeListTy Nodes; - ScalarMapTy ScalarMap; - - // ReturnNodes - A return value for every function merged into this graph. - // Each DSGraph may have multiple functions merged into it at any time, which - // is used for representing SCCs. - // - ReturnNodesTy ReturnNodes; - - // FunctionCalls - This list maintains a single entry for each call - // instruction in the current graph. The first entry in the vector is the - // scalar that holds the return value for the call, the second is the function - // scalar being invoked, and the rest are pointer arguments to the function. - // This vector is built by the Local graph and is never modified after that. - // - std::list<DSCallSite> FunctionCalls; - - // AuxFunctionCalls - This vector contains call sites that have been processed - // by some mechanism. In pratice, the BU Analysis uses this vector to hold - // the _unresolved_ call sites, because it cannot modify FunctionCalls. - // - std::list<DSCallSite> AuxFunctionCalls; - - /// TD - This is the target data object for the machine this graph is - /// constructed for. - const TargetData &TD; - - void operator=(const DSGraph &); // DO NOT IMPLEMENT - DSGraph(const DSGraph&); // DO NOT IMPLEMENT -public: - // Create a new, empty, DSGraph. - DSGraph(EquivalenceClasses<GlobalValue*> &ECs, const TargetData &td) - : GlobalsGraph(0), PrintAuxCalls(false), ScalarMap(ECs), TD(td) {} - - // Compute the local DSGraph - DSGraph(EquivalenceClasses<GlobalValue*> &ECs, const TargetData &TD, - Function &F, DSGraph *GlobalsGraph); - - // Copy ctor - If you want to capture the node mapping between the source and - // destination graph, you may optionally do this by specifying a map to record - // this into. - // - // Note that a copied graph does not retain the GlobalsGraph pointer of the - // source. You need to set a new GlobalsGraph with the setGlobalsGraph - // method. - // - DSGraph(const DSGraph &DSG, EquivalenceClasses<GlobalValue*> &ECs, - unsigned CloneFlags = 0); - ~DSGraph(); - - DSGraph *getGlobalsGraph() const { return GlobalsGraph; } - void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; } - - /// getGlobalECs - Return the set of equivalence classes that the global - /// variables in the program form. - EquivalenceClasses<GlobalValue*> &getGlobalECs() const { - return ScalarMap.getGlobalECs(); - } - - /// getTargetData - Return the TargetData object for the current target. - /// - const TargetData &getTargetData() const { return TD; } - - /// setPrintAuxCalls - If you call this method, the auxillary call vector will - /// be printed instead of the standard call vector to the dot file. - /// - void setPrintAuxCalls() { PrintAuxCalls = true; } - bool shouldPrintAuxCalls() const { return PrintAuxCalls; } - - /// node_iterator/begin/end - Iterate over all of the nodes in the graph. Be - /// extremely careful with these methods because any merging of nodes could - /// cause the node to be removed from this list. This means that if you are - /// iterating over nodes and doing something that could cause _any_ node to - /// merge, your node_iterators into this graph can be invalidated. - typedef NodeListTy::iterator node_iterator; - node_iterator node_begin() { return Nodes.begin(); } - node_iterator node_end() { return Nodes.end(); } - - typedef NodeListTy::const_iterator node_const_iterator; - node_const_iterator node_begin() const { return Nodes.begin(); } - node_const_iterator node_end() const { return Nodes.end(); } - - /// getFunctionNames - Return a space separated list of the name of the - /// functions in this graph (if any) - /// - std::string getFunctionNames() const; - - /// addNode - Add a new node to the graph. - /// - void addNode(DSNode *N) { Nodes.push_back(N); } - void unlinkNode(DSNode *N) { Nodes.remove(N); } - - /// getScalarMap - Get a map that describes what the nodes the scalars in this - /// function point to... - /// - ScalarMapTy &getScalarMap() { return ScalarMap; } - const ScalarMapTy &getScalarMap() const { return ScalarMap; } - - /// getFunctionCalls - Return the list of call sites in the original local - /// graph... - /// - const std::list<DSCallSite> &getFunctionCalls() const { return FunctionCalls;} - std::list<DSCallSite> &getFunctionCalls() { return FunctionCalls;} - - /// getAuxFunctionCalls - Get the call sites as modified by whatever passes - /// have been run. - /// - std::list<DSCallSite> &getAuxFunctionCalls() { return AuxFunctionCalls; } - const std::list<DSCallSite> &getAuxFunctionCalls() const { - return AuxFunctionCalls; - } - - // Function Call iteration - typedef std::list<DSCallSite>::const_iterator fc_iterator; - fc_iterator fc_begin() const { return FunctionCalls.begin(); } - fc_iterator fc_end() const { return FunctionCalls.end(); } - - - // Aux Function Call iteration - typedef std::list<DSCallSite>::const_iterator afc_iterator; - afc_iterator afc_begin() const { return AuxFunctionCalls.begin(); } - afc_iterator afc_end() const { return AuxFunctionCalls.end(); } - - /// getNodeForValue - Given a value that is used or defined in the body of the - /// current function, return the DSNode that it points to. - /// - DSNodeHandle &getNodeForValue(Value *V) { return ScalarMap[V]; } - - const DSNodeHandle &getNodeForValue(Value *V) const { - ScalarMapTy::const_iterator I = ScalarMap.find(V); - assert(I != ScalarMap.end() && - "Use non-const lookup function if node may not be in the map"); - return I->second; - } - - /// retnodes_* iterator methods: expose iteration over return nodes in the - /// graph, which are also the set of functions incorporated in this graph. - typedef ReturnNodesTy::const_iterator retnodes_iterator; - retnodes_iterator retnodes_begin() const { return ReturnNodes.begin(); } - retnodes_iterator retnodes_end() const { return ReturnNodes.end(); } - - - /// getReturnNodes - Return the mapping of functions to their return nodes for - /// this graph. - /// - const ReturnNodesTy &getReturnNodes() const { return ReturnNodes; } - ReturnNodesTy &getReturnNodes() { return ReturnNodes; } - - /// getReturnNodeFor - Return the return node for the specified function. - /// - DSNodeHandle &getReturnNodeFor(Function &F) { - ReturnNodesTy::iterator I = ReturnNodes.find(&F); - assert(I != ReturnNodes.end() && "F not in this DSGraph!"); - return I->second; - } - - const DSNodeHandle &getReturnNodeFor(Function &F) const { - ReturnNodesTy::const_iterator I = ReturnNodes.find(&F); - assert(I != ReturnNodes.end() && "F not in this DSGraph!"); - return I->second; - } - - /// containsFunction - Return true if this DSGraph contains information for - /// the specified function. - bool containsFunction(Function *F) const { - return ReturnNodes.count(F); - } - - /// getGraphSize - Return the number of nodes in this graph. - /// - unsigned getGraphSize() const { - return Nodes.size(); - } - - /// addObjectToGraph - This method can be used to add global, stack, and heap - /// objects to the graph. This can be used when updating DSGraphs due to the - /// introduction of new temporary objects. The new object is not pointed to - /// and does not point to any other objects in the graph. Note that this - /// method initializes the type of the DSNode to the declared type of the - /// object if UseDeclaredType is true, otherwise it leaves the node type as - /// void. - DSNode *addObjectToGraph(Value *Ptr, bool UseDeclaredType = true); - - - /// print - Print a dot graph to the specified ostream... - /// - void print(std::ostream &O) const; - - /// dump - call print(std::cerr), for use from the debugger... - /// - void dump() const; - - /// viewGraph - Emit a dot graph, run 'dot', run gv on the postscript file, - /// then cleanup. For use from the debugger. - /// - void viewGraph() const; - - void writeGraphToFile(std::ostream &O, const std::string &GraphName) const; - - /// maskNodeTypes - Apply a mask to all of the node types in the graph. This - /// is useful for clearing out markers like Incomplete. - /// - void maskNodeTypes(unsigned Mask) { - for (node_iterator I = node_begin(), E = node_end(); I != E; ++I) - I->maskNodeTypes(Mask); - } - void maskIncompleteMarkers() { maskNodeTypes(~DSNode::Incomplete); } - - // markIncompleteNodes - Traverse the graph, identifying nodes that may be - // modified by other functions that have not been resolved yet. This marks - // nodes that are reachable through three sources of "unknownness": - // Global Variables, Function Calls, and Incoming Arguments - // - // For any node that may have unknown components (because something outside - // the scope of current analysis may have modified it), the 'Incomplete' flag - // is added to the NodeType. - // - enum MarkIncompleteFlags { - MarkFormalArgs = 1, IgnoreFormalArgs = 0, - IgnoreGlobals = 2, MarkGlobalsIncomplete = 0 - }; - void markIncompleteNodes(unsigned Flags); - - // removeDeadNodes - Use a reachability analysis to eliminate subgraphs that - // are unreachable. This often occurs because the data structure doesn't - // "escape" into it's caller, and thus should be eliminated from the caller's - // graph entirely. This is only appropriate to use when inlining graphs. - // - enum RemoveDeadNodesFlags { - RemoveUnreachableGlobals = 1, KeepUnreachableGlobals = 0 - }; - void removeDeadNodes(unsigned Flags); - - /// CloneFlags enum - Bits that may be passed into the cloneInto method to - /// specify how to clone the function graph. - enum CloneFlags { - StripAllocaBit = 1 << 0, KeepAllocaBit = 0, - DontCloneCallNodes = 1 << 1, CloneCallNodes = 0, - DontCloneAuxCallNodes = 1 << 2, CloneAuxCallNodes = 0, - StripModRefBits = 1 << 3, KeepModRefBits = 0, - StripIncompleteBit = 1 << 4, KeepIncompleteBit = 0 - }; - - void updateFromGlobalGraph(); - - /// computeNodeMapping - Given roots in two different DSGraphs, traverse the - /// nodes reachable from the two graphs, computing the mapping of nodes from - /// the first to the second graph. - /// - static void computeNodeMapping(const DSNodeHandle &NH1, - const DSNodeHandle &NH2, NodeMapTy &NodeMap, - bool StrictChecking = true); - - /// computeGToGGMapping - Compute the mapping of nodes in the graph to nodes - /// in the globals graph. - void computeGToGGMapping(NodeMapTy &NodeMap); - - /// computeGGToGMapping - Compute the mapping of nodes in the global - /// graph to nodes in this graph. - void computeGGToGMapping(InvNodeMapTy &InvNodeMap); - - /// computeCalleeCallerMapping - Given a call from a function in the current - /// graph to the 'Callee' function (which lives in 'CalleeGraph'), compute the - /// mapping of nodes from the callee to nodes in the caller. - void computeCalleeCallerMapping(DSCallSite CS, const Function &Callee, - DSGraph &CalleeGraph, NodeMapTy &NodeMap); - - /// spliceFrom - Logically perform the operation of cloning the RHS graph into - /// this graph, then clearing the RHS graph. Instead of performing this as - /// two seperate operations, do it as a single, much faster, one. - /// - void spliceFrom(DSGraph &RHS); - - /// cloneInto - Clone the specified DSGraph into the current graph. - /// - /// The CloneFlags member controls various aspects of the cloning process. - /// - void cloneInto(const DSGraph &G, unsigned CloneFlags = 0); - - /// getFunctionArgumentsForCall - Given a function that is currently in this - /// graph, return the DSNodeHandles that correspond to the pointer-compatible - /// function arguments. The vector is filled in with the return value (or - /// null if it is not pointer compatible), followed by all of the - /// pointer-compatible arguments. - void getFunctionArgumentsForCall(Function *F, - std::vector<DSNodeHandle> &Args) const; - - /// mergeInGraph - This graph merges in the minimal number of - /// nodes from G2 into 'this' graph, merging the bindings specified by the - /// call site (in this graph) with the bindings specified by the vector in G2. - /// If the StripAlloca's argument is 'StripAllocaBit' then Alloca markers are - /// removed from nodes. - /// - void mergeInGraph(const DSCallSite &CS, std::vector<DSNodeHandle> &Args, - const DSGraph &G2, unsigned CloneFlags); - - /// mergeInGraph - This method is the same as the above method, but the - /// argument bindings are provided by using the formal arguments of F. - /// - void mergeInGraph(const DSCallSite &CS, Function &F, const DSGraph &Graph, - unsigned CloneFlags); - - /// getCallSiteForArguments - Get the arguments and return value bindings for - /// the specified function in the current graph. - /// - DSCallSite getCallSiteForArguments(Function &F) const; - - /// getDSCallSiteForCallSite - Given an LLVM CallSite object that is live in - /// the context of this graph, return the DSCallSite for it. - DSCallSite getDSCallSiteForCallSite(CallSite CS) const; - - // Methods for checking to make sure graphs are well formed... - void AssertNodeInGraph(const DSNode *N) const { - assert((!N || N->getParentGraph() == this) && - "AssertNodeInGraph: Node is not in graph!"); - } - void AssertNodeContainsGlobal(const DSNode *N, GlobalValue *GV) const; - - void AssertCallSiteInGraph(const DSCallSite &CS) const; - void AssertCallNodesInGraph() const; - void AssertAuxCallNodesInGraph() const; - - void AssertGraphOK() const; - - /// removeTriviallyDeadNodes - After the graph has been constructed, this - /// method removes all unreachable nodes that are created because they got - /// merged with other nodes in the graph. This is used as the first step of - /// removeDeadNodes. - /// - void removeTriviallyDeadNodes(); -}; - - -/// ReachabilityCloner - This class is used to incrementally clone and merge -/// nodes from a non-changing source graph into a potentially mutating -/// destination graph. Nodes are only cloned over on demand, either in -/// responds to a merge() or getClonedNH() call. When a node is cloned over, -/// all of the nodes reachable from it are automatically brought over as well. -/// -class ReachabilityCloner { - DSGraph &Dest; - const DSGraph &Src; - - /// BitsToKeep - These bits are retained from the source node when the - /// source nodes are merged into the destination graph. - unsigned BitsToKeep; - unsigned CloneFlags; - - // NodeMap - A mapping from nodes in the source graph to the nodes that - // represent them in the destination graph. - DSGraph::NodeMapTy NodeMap; -public: - ReachabilityCloner(DSGraph &dest, const DSGraph &src, unsigned cloneFlags) - : Dest(dest), Src(src), CloneFlags(cloneFlags) { - assert(&Dest != &Src && "Cannot clone from graph to same graph!"); - BitsToKeep = ~DSNode::DEAD; - if (CloneFlags & DSGraph::StripAllocaBit) - BitsToKeep &= ~DSNode::AllocaNode; - if (CloneFlags & DSGraph::StripModRefBits) - BitsToKeep &= ~(DSNode::Modified | DSNode::Read); - if (CloneFlags & DSGraph::StripIncompleteBit) - BitsToKeep &= ~DSNode::Incomplete; - } - - DSNodeHandle getClonedNH(const DSNodeHandle &SrcNH); - - void merge(const DSNodeHandle &NH, const DSNodeHandle &SrcNH); - - /// mergeCallSite - Merge the nodes reachable from the specified src call - /// site into the nodes reachable from DestCS. - /// - void mergeCallSite(DSCallSite &DestCS, const DSCallSite &SrcCS); - - bool clonedAnyNodes() const { return !NodeMap.empty(); } - - /// hasClonedNode - Return true if the specified node has been cloned from - /// the source graph into the destination graph. - bool hasClonedNode(const DSNode *N) { - return NodeMap.count(N); - } - - void destroy() { NodeMap.clear(); } -}; - -} // End llvm namespace - -#endif
diff --git a/poolalloc/include/dsa/DSGraphTraits.h b/poolalloc/include/dsa/DSGraphTraits.h deleted file mode 100644 index 6febf34..0000000 --- a/poolalloc/include/dsa/DSGraphTraits.h +++ /dev/null
@@ -1,153 +0,0 @@ -//===- DSGraphTraits.h - Provide generic graph interface --------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file provides GraphTraits specializations for the DataStructure graph -// nodes, allowing datastructure graphs to be processed by generic graph -// algorithms. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ANALYSIS_DSGRAPHTRAITS_H -#define LLVM_ANALYSIS_DSGRAPHTRAITS_H - -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/ADT/GraphTraits.h" -#include "llvm/ADT/iterator" -#include "llvm/ADT/STLExtras.h" - -namespace llvm { - -template<typename NodeTy> -class DSNodeIterator : public forward_iterator<const DSNode, ptrdiff_t> { - friend class DSNode; - NodeTy * const Node; - unsigned Offset; - - typedef DSNodeIterator<NodeTy> _Self; - - DSNodeIterator(NodeTy *N) : Node(N), Offset(0) {} // begin iterator - DSNodeIterator(NodeTy *N, bool) : Node(N) { // Create end iterator - if (N != 0) { - Offset = N->getNumLinks() << DS::PointerShift; - if (Offset == 0 && Node->getForwardNode() && - Node->isDeadNode()) // Model Forward link - Offset += DS::PointerSize; - } else { - Offset = 0; - } - } -public: - DSNodeIterator(const DSNodeHandle &NH) - : Node(NH.getNode()), Offset(NH.getOffset()) {} - - bool operator==(const _Self& x) const { - return Offset == x.Offset; - } - bool operator!=(const _Self& x) const { return !operator==(x); } - - const _Self &operator=(const _Self &I) { - assert(I.Node == Node && "Cannot assign iterators to two different nodes!"); - Offset = I.Offset; - return *this; - } - - pointer operator*() const { - if (Node->isDeadNode()) - return Node->getForwardNode(); - else - return Node->getLink(Offset).getNode(); - } - pointer operator->() const { return operator*(); } - - _Self& operator++() { // Preincrement - Offset += (1 << DS::PointerShift); - return *this; - } - _Self operator++(int) { // Postincrement - _Self tmp = *this; ++*this; return tmp; - } - - unsigned getOffset() const { return Offset; } - const DSNode *getNode() const { return Node; } -}; - -// Provide iterators for DSNode... -inline DSNode::iterator DSNode::begin() { - return DSNode::iterator(this); -} -inline DSNode::iterator DSNode::end() { - return DSNode::iterator(this, false); -} -inline DSNode::const_iterator DSNode::begin() const { - return DSNode::const_iterator(this); -} -inline DSNode::const_iterator DSNode::end() const { - return DSNode::const_iterator(this, false); -} - -template <> struct GraphTraits<DSNode*> { - typedef DSNode NodeType; - typedef DSNode::iterator ChildIteratorType; - - static NodeType *getEntryNode(NodeType *N) { return N; } - static ChildIteratorType child_begin(NodeType *N) { return N->begin(); } - static ChildIteratorType child_end(NodeType *N) { return N->end(); } -}; - -template <> struct GraphTraits<const DSNode*> { - typedef const DSNode NodeType; - typedef DSNode::const_iterator ChildIteratorType; - - static NodeType *getEntryNode(NodeType *N) { return N; } - static ChildIteratorType child_begin(NodeType *N) { return N->begin(); } - static ChildIteratorType child_end(NodeType *N) { return N->end(); } -}; - -static DSNode &dereference ( DSNode *N) { return *N; } -static const DSNode &dereferenceC(const DSNode *N) { return *N; } - -template <> struct GraphTraits<DSGraph*> { - typedef DSNode NodeType; - typedef DSNode::iterator ChildIteratorType; - - typedef std::pointer_to_unary_function<DSNode *, DSNode&> DerefFun; - - // nodes_iterator/begin/end - Allow iteration over all nodes in the graph - typedef mapped_iterator<DSGraph::node_iterator, DerefFun> nodes_iterator; - static nodes_iterator nodes_begin(DSGraph *G) { - return map_iterator(G->node_begin(), DerefFun(dereference)); - } - static nodes_iterator nodes_end(DSGraph *G) { - return map_iterator(G->node_end(), DerefFun(dereference)); - } - - static ChildIteratorType child_begin(NodeType *N) { return N->begin(); } - static ChildIteratorType child_end(NodeType *N) { return N->end(); } -}; - -template <> struct GraphTraits<const DSGraph*> { - typedef const DSNode NodeType; - typedef DSNode::const_iterator ChildIteratorType; - - // nodes_iterator/begin/end - Allow iteration over all nodes in the graph - typedef DSGraph::node_const_iterator nodes_iterator; - static nodes_iterator nodes_begin(const DSGraph *G) { - return G->node_begin(); - } - static nodes_iterator nodes_end(const DSGraph *G) { - return G->node_end(); - } - - static ChildIteratorType child_begin(const NodeType *N) { return N->begin(); } - static ChildIteratorType child_end(const NodeType *N) { return N->end(); } -}; - -} // End llvm namespace - -#endif
diff --git a/poolalloc/include/dsa/DSNode.h b/poolalloc/include/dsa/DSNode.h deleted file mode 100644 index 45937a4..0000000 --- a/poolalloc/include/dsa/DSNode.h +++ /dev/null
@@ -1,507 +0,0 @@ -//===- DSNode.h - Node definition for datastructure graphs ------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Data structure graph nodes and some implementation of DSNodeHandle. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ANALYSIS_DSNODE_H -#define LLVM_ANALYSIS_DSNODE_H - -#include "llvm/Analysis/DataStructure/DSSupport.h" -#include "llvm/ADT/hash_map" - -namespace llvm { - -template<typename BaseType> -class DSNodeIterator; // Data structure graph traversal iterator -class TargetData; - -//===----------------------------------------------------------------------===// -/// DSNode - Data structure node class -/// -/// This class represents an untyped memory object of Size bytes. It keeps -/// track of any pointers that have been stored into the object as well as the -/// different types represented in this object. -/// -class DSNode { - /// NumReferrers - The number of DSNodeHandles pointing to this node... if - /// this is a forwarding node, then this is the number of node handles which - /// are still forwarding over us. - /// - unsigned NumReferrers; - - /// ForwardNH - This NodeHandle contain the node (and offset into the node) - /// that this node really is. When nodes get folded together, the node to be - /// eliminated has these fields filled in, otherwise ForwardNH.getNode() is - /// null. - /// - DSNodeHandle ForwardNH; - - /// Next, Prev - These instance variables are used to keep the node on a - /// doubly-linked ilist in the DSGraph. - /// - DSNode *Next, *Prev; - friend struct ilist_traits<DSNode>; - - /// Size - The current size of the node. This should be equal to the size of - /// the current type record. - /// - unsigned Size; - - /// ParentGraph - The graph this node is currently embedded into. - /// - DSGraph *ParentGraph; - - /// Ty - Keep track of the current outer most type of this object, in addition - /// to whether or not it has been indexed like an array or not. If the - /// isArray bit is set, the node cannot grow. - /// - const Type *Ty; // The type itself... - - /// Links - Contains one entry for every sizeof(void*) bytes in this memory - /// object. Note that if the node is not a multiple of size(void*) bytes - /// large, that there is an extra entry for the "remainder" of the node as - /// well. For this reason, nodes of 1 byte in size do have one link. - /// - std::vector<DSNodeHandle> Links; - - /// Globals - The list of global values that are merged into this node. - /// - std::vector<GlobalValue*> Globals; - - void operator=(const DSNode &); // DO NOT IMPLEMENT - DSNode(const DSNode &); // DO NOT IMPLEMENT -public: - enum NodeTy { - ShadowNode = 0, // Nothing is known about this node... - AllocaNode = 1 << 0, // This node was allocated with alloca - HeapNode = 1 << 1, // This node was allocated with malloc - GlobalNode = 1 << 2, // This node was allocated by a global var decl - UnknownNode = 1 << 3, // This node points to unknown allocated memory - Incomplete = 1 << 4, // This node may not be complete - - Modified = 1 << 5, // This node is modified in this context - Read = 1 << 6, // This node is read in this context - - Array = 1 << 7, // This node is treated like an array - //#ifndef NDEBUG - DEAD = 1 << 8, // This node is dead and should not be pointed to - //#endif - - Composition = AllocaNode | HeapNode | GlobalNode | UnknownNode - }; - - /// NodeType - A union of the above bits. "Shadow" nodes do not add any flags - /// to the nodes in the data structure graph, so it is possible to have nodes - /// with a value of 0 for their NodeType. - /// -private: - unsigned short NodeType; -public: - - /// DSNode ctor - Create a node of the specified type, inserting it into the - /// specified graph. - /// - DSNode(const Type *T, DSGraph *G); - - /// DSNode "copy ctor" - Copy the specified node, inserting it into the - /// specified graph. If NullLinks is true, then null out all of the links, - /// but keep the same number of them. This can be used for efficiency if the - /// links are just going to be clobbered anyway. - /// - DSNode(const DSNode &, DSGraph *G, bool NullLinks = false); - - ~DSNode() { - dropAllReferences(); - assert(hasNoReferrers() && "Referrers to dead node exist!"); - } - - // Iterator for graph interface... Defined in DSGraphTraits.h - typedef DSNodeIterator<DSNode> iterator; - typedef DSNodeIterator<const DSNode> const_iterator; - inline iterator begin(); - inline iterator end(); - inline const_iterator begin() const; - inline const_iterator end() const; - - //===-------------------------------------------------- - // Accessors - - /// getSize - Return the maximum number of bytes occupied by this object... - /// - unsigned getSize() const { return Size; } - - /// getType - Return the node type of this object... - /// - const Type *getType() const { return Ty; } - - bool isArray() const { return NodeType & Array; } - - /// hasNoReferrers - Return true if nothing is pointing to this node at all. - /// - bool hasNoReferrers() const { return getNumReferrers() == 0; } - - /// getNumReferrers - This method returns the number of referrers to the - /// current node. Note that if this node is a forwarding node, this will - /// return the number of nodes forwarding over the node! - unsigned getNumReferrers() const { return NumReferrers; } - - DSGraph *getParentGraph() const { return ParentGraph; } - void setParentGraph(DSGraph *G) { ParentGraph = G; } - - - /// getTargetData - Get the target data object used to construct this node. - /// - const TargetData &getTargetData() const; - - /// getForwardNode - This method returns the node that this node is forwarded - /// to, if any. - /// - DSNode *getForwardNode() const { return ForwardNH.getNode(); } - - /// isForwarding - Return true if this node is forwarding to another. - /// - bool isForwarding() const { return !ForwardNH.isNull(); } - - /// stopForwarding - When the last reference to this forwarding node has been - /// dropped, delete the node. - /// - void stopForwarding() { - assert(isForwarding() && - "Node isn't forwarding, cannot stopForwarding()!"); - ForwardNH.setTo(0, 0); - assert(ParentGraph == 0 && - "Forwarding nodes must have been removed from graph!"); - delete this; - } - - /// hasLink - Return true if this memory object has a link in slot LinkNo - /// - bool hasLink(unsigned Offset) const { - assert((Offset & ((1 << DS::PointerShift)-1)) == 0 && - "Pointer offset not aligned correctly!"); - unsigned Index = Offset >> DS::PointerShift; - assert(Index < Links.size() && "Link index is out of range!"); - return Links[Index].getNode(); - } - - /// getLink - Return the link at the specified offset. - /// - DSNodeHandle &getLink(unsigned Offset) { - assert((Offset & ((1 << DS::PointerShift)-1)) == 0 && - "Pointer offset not aligned correctly!"); - unsigned Index = Offset >> DS::PointerShift; - assert(Index < Links.size() && "Link index is out of range!"); - return Links[Index]; - } - const DSNodeHandle &getLink(unsigned Offset) const { - assert((Offset & ((1 << DS::PointerShift)-1)) == 0 && - "Pointer offset not aligned correctly!"); - unsigned Index = Offset >> DS::PointerShift; - assert(Index < Links.size() && "Link index is out of range!"); - return Links[Index]; - } - - /// getNumLinks - Return the number of links in a node... - /// - unsigned getNumLinks() const { return Links.size(); } - - /// edge_* - Provide iterators for accessing outgoing edges. Some outgoing - /// edges may be null. - typedef std::vector<DSNodeHandle>::iterator edge_iterator; - typedef std::vector<DSNodeHandle>::const_iterator const_edge_iterator; - edge_iterator edge_begin() { return Links.begin(); } - edge_iterator edge_end() { return Links.end(); } - const_edge_iterator edge_begin() const { return Links.begin(); } - const_edge_iterator edge_end() const { return Links.end(); } - - - /// mergeTypeInfo - This method merges the specified type into the current - /// node at the specified offset. This may update the current node's type - /// record if this gives more information to the node, it may do nothing to - /// the node if this information is already known, or it may merge the node - /// completely (and return true) if the information is incompatible with what - /// is already known. - /// - /// This method returns true if the node is completely folded, otherwise - /// false. - /// - bool mergeTypeInfo(const Type *Ty, unsigned Offset, - bool FoldIfIncompatible = true); - - /// foldNodeCompletely - If we determine that this node has some funny - /// behavior happening to it that we cannot represent, we fold it down to a - /// single, completely pessimistic, node. This node is represented as a - /// single byte with a single TypeEntry of "void" with isArray = true. - /// - void foldNodeCompletely(); - - /// isNodeCompletelyFolded - Return true if this node has been completely - /// folded down to something that can never be expanded, effectively losing - /// all of the field sensitivity that may be present in the node. - /// - bool isNodeCompletelyFolded() const; - - /// setLink - Set the link at the specified offset to the specified - /// NodeHandle, replacing what was there. It is uncommon to use this method, - /// instead one of the higher level methods should be used, below. - /// - void setLink(unsigned Offset, const DSNodeHandle &NH) { - assert((Offset & ((1 << DS::PointerShift)-1)) == 0 && - "Pointer offset not aligned correctly!"); - unsigned Index = Offset >> DS::PointerShift; - assert(Index < Links.size() && "Link index is out of range!"); - Links[Index] = NH; - } - - /// getPointerSize - Return the size of a pointer for the current target. - /// - unsigned getPointerSize() const { return DS::PointerSize; } - - /// addEdgeTo - Add an edge from the current node to the specified node. This - /// can cause merging of nodes in the graph. - /// - void addEdgeTo(unsigned Offset, const DSNodeHandle &NH); - - /// mergeWith - Merge this node and the specified node, moving all links to - /// and from the argument node into the current node, deleting the node - /// argument. Offset indicates what offset the specified node is to be merged - /// into the current node. - /// - /// The specified node may be a null pointer (in which case, nothing happens). - /// - void mergeWith(const DSNodeHandle &NH, unsigned Offset); - - /// addGlobal - Add an entry for a global value to the Globals list. This - /// also marks the node with the 'G' flag if it does not already have it. - /// - void addGlobal(GlobalValue *GV); - - /// removeGlobal - Remove the specified global that is explicitly in the - /// globals list. - void removeGlobal(GlobalValue *GV); - - void mergeGlobals(const std::vector<GlobalValue*> &RHS); - void clearGlobals() { std::vector<GlobalValue*>().swap(Globals); } - - /// getGlobalsList - Return the set of global leaders that are represented by - /// this node. Note that globals that are in this equivalence class but are - /// not leaders are not returned: for that, use addFullGlobalsList(). - const std::vector<GlobalValue*> &getGlobalsList() const { return Globals; } - - /// addFullGlobalsList - Compute the full set of global values that are - /// represented by this node. Unlike getGlobalsList(), this requires fair - /// amount of work to compute, so don't treat this method call as free. - void addFullGlobalsList(std::vector<GlobalValue*> &List) const; - - /// addFullFunctionList - Identical to addFullGlobalsList, but only return the - /// functions in the full list. - void addFullFunctionList(std::vector<Function*> &List) const; - - /// globals_iterator/begin/end - Provide iteration methods over the global - /// value leaders set that is merged into this node. Like the getGlobalsList - /// method, these iterators do not return globals that are part of the - /// equivalence classes for globals in this node, but aren't leaders. - typedef std::vector<GlobalValue*>::const_iterator globals_iterator; - globals_iterator globals_begin() const { return Globals.begin(); } - globals_iterator globals_end() const { return Globals.end(); } - - - /// maskNodeTypes - Apply a mask to the node types bitfield. - /// - void maskNodeTypes(unsigned Mask) { - NodeType &= Mask; - } - - void mergeNodeFlags(unsigned RHS) { - NodeType |= RHS; - } - - /// getNodeFlags - Return all of the flags set on the node. If the DEAD flag - /// is set, hide it from the caller. - /// - unsigned getNodeFlags() const { return NodeType & ~DEAD; } - - bool isAllocaNode() const { return NodeType & AllocaNode; } - bool isHeapNode() const { return NodeType & HeapNode; } - bool isGlobalNode() const { return NodeType & GlobalNode; } - bool isUnknownNode() const { return NodeType & UnknownNode; } - - bool isModified() const { return NodeType & Modified; } - bool isRead() const { return NodeType & Read; } - - bool isIncomplete() const { return NodeType & Incomplete; } - bool isComplete() const { return !isIncomplete(); } - bool isDeadNode() const { return NodeType & DEAD; } - - DSNode *setAllocaNodeMarker() { NodeType |= AllocaNode; return this; } - DSNode *setHeapNodeMarker() { NodeType |= HeapNode; return this; } - DSNode *setGlobalNodeMarker() { NodeType |= GlobalNode; return this; } - DSNode *setUnknownNodeMarker() { NodeType |= UnknownNode; return this; } - - DSNode *setIncompleteMarker() { NodeType |= Incomplete; return this; } - DSNode *setModifiedMarker() { NodeType |= Modified; return this; } - DSNode *setReadMarker() { NodeType |= Read; return this; } - DSNode *setArrayMarker() { NodeType |= Array; return this; } - - void makeNodeDead() { - Globals.clear(); - assert(hasNoReferrers() && "Dead node shouldn't have refs!"); - NodeType = DEAD; - } - - /// forwardNode - Mark this node as being obsolete, and all references to it - /// should be forwarded to the specified node and offset. - /// - void forwardNode(DSNode *To, unsigned Offset); - - void print(std::ostream &O, const DSGraph *G) const; - void dump() const; - - void assertOK() const; - - void dropAllReferences() { - Links.clear(); - if (isForwarding()) - ForwardNH.setTo(0, 0); - } - - /// remapLinks - Change all of the Links in the current node according to the - /// specified mapping. - /// - void remapLinks(hash_map<const DSNode*, DSNodeHandle> &OldNodeMap); - - /// markReachableNodes - This method recursively traverses the specified - /// DSNodes, marking any nodes which are reachable. All reachable nodes it - /// adds to the set, which allows it to only traverse visited nodes once. - /// - void markReachableNodes(hash_set<const DSNode*> &ReachableNodes) const; - -private: - friend class DSNodeHandle; - - // static mergeNodes - Helper for mergeWith() - static void MergeNodes(DSNodeHandle& CurNodeH, DSNodeHandle& NH); -}; - -//===----------------------------------------------------------------------===// -// Define the ilist_traits specialization for the DSGraph ilist. -// -template<> -struct ilist_traits<DSNode> { - static DSNode *getPrev(const DSNode *N) { return N->Prev; } - static DSNode *getNext(const DSNode *N) { return N->Next; } - - static void setPrev(DSNode *N, DSNode *Prev) { N->Prev = Prev; } - static void setNext(DSNode *N, DSNode *Next) { N->Next = Next; } - - static DSNode *createSentinel() { return new DSNode(0,0); } - static void destroySentinel(DSNode *N) { delete N; } - //static DSNode *createNode(const DSNode &V) { return new DSNode(V); } - - - void addNodeToList(DSNode *NTy) {} - void removeNodeFromList(DSNode *NTy) {} - void transferNodesFromList(iplist<DSNode, ilist_traits> &L2, - ilist_iterator<DSNode> first, - ilist_iterator<DSNode> last) {} -}; - -template<> -struct ilist_traits<const DSNode> : public ilist_traits<DSNode> {}; - -//===----------------------------------------------------------------------===// -// Define inline DSNodeHandle functions that depend on the definition of DSNode -// -inline DSNode *DSNodeHandle::getNode() const { - // Disabling this assertion because it is failing on a "magic" struct - // in named (from bind). The fourth field is an array of length 0, - // presumably used to create struct instances of different sizes. - // In a variable length struct, Offset could exceed Size when getNode() - // is called before such a node is folded. In this case, the DS Analysis now - // correctly folds this node after calling getNode. - /* assert((!N || - N->isNodeCompletelyFolded() || - (N->Size == 0 && Offset == 0) || - (int(Offset) >= 0 && Offset < N->Size) || - (int(Offset) < 0 && -int(Offset) < int(N->Size)) || - N->isForwarding()) && "Node handle offset out of range!"); - */ - if (N == 0 || !N->isForwarding()) - return N; - - return HandleForwarding(); -} - -inline void DSNodeHandle::setTo(DSNode *n, unsigned NewOffset) const { - assert(!n || !n->isForwarding() && "Cannot set node to a forwarded node!"); - if (N) getNode()->NumReferrers--; - N = n; - Offset = NewOffset; - if (N) { - N->NumReferrers++; - if (Offset >= N->Size) { - assert((Offset == 0 || N->Size == 1) && - "Pointer to non-collapsed node with invalid offset!"); - Offset = 0; - } - } - assert(!N || ((N->NodeType & DSNode::DEAD) == 0)); - assert((!N || Offset < N->Size || (N->Size == 0 && Offset == 0) || - N->isForwarding()) && "Node handle offset out of range!"); -} - -inline bool DSNodeHandle::hasLink(unsigned Num) const { - assert(N && "DSNodeHandle does not point to a node yet!"); - return getNode()->hasLink(Num+Offset); -} - - -/// getLink - Treat this current node pointer as a pointer to a structure of -/// some sort. This method will return the pointer a mem[this+Num] -/// -inline const DSNodeHandle &DSNodeHandle::getLink(unsigned Off) const { - assert(N && "DSNodeHandle does not point to a node yet!"); - return getNode()->getLink(Offset+Off); -} -inline DSNodeHandle &DSNodeHandle::getLink(unsigned Off) { - assert(N && "DSNodeHandle does not point to a node yet!"); - return getNode()->getLink(Off+Offset); -} - -inline void DSNodeHandle::setLink(unsigned Off, const DSNodeHandle &NH) { - assert(N && "DSNodeHandle does not point to a node yet!"); - getNode()->setLink(Off+Offset, NH); -} - -/// addEdgeTo - Add an edge from the current node to the specified node. This -/// can cause merging of nodes in the graph. -/// -inline void DSNodeHandle::addEdgeTo(unsigned Off, const DSNodeHandle &Node) { - assert(N && "DSNodeHandle does not point to a node yet!"); - getNode()->addEdgeTo(Off+Offset, Node); -} - -/// mergeWith - Merge the logical node pointed to by 'this' with the node -/// pointed to by 'N'. -/// -inline void DSNodeHandle::mergeWith(const DSNodeHandle &Node) const { - if (!isNull()) - getNode()->mergeWith(Node, Offset); - else { // No node to merge with, so just point to Node - Offset = 0; - DSNode *NN = Node.getNode(); - setTo(NN, Node.getOffset()); - } -} - -} // End llvm namespace - -#endif
diff --git a/poolalloc/include/dsa/DSSupport.h b/poolalloc/include/dsa/DSSupport.h deleted file mode 100644 index dc4c31f..0000000 --- a/poolalloc/include/dsa/DSSupport.h +++ /dev/null
@@ -1,338 +0,0 @@ -//===- DSSupport.h - Support for datastructure graphs -----------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Support for graph nodes, call sites, and types. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ANALYSIS_DSSUPPORT_H -#define LLVM_ANALYSIS_DSSUPPORT_H - -#include <functional> -#include "llvm/ADT/hash_map" -#include "llvm/ADT/hash_set" -#include "llvm/Support/CallSite.h" - -namespace llvm { - -class Function; -class CallInst; -class Value; -class GlobalValue; -class Type; - -class DSNode; // Each node in the graph -class DSGraph; // A graph for a function -class ReachabilityCloner; - -namespace DS { // FIXME: After the paper, this should get cleaned up - enum { PointerShift = 2, // 64bit ptrs = 3, 32 bit ptrs = 2 - PointerSize = 1 << PointerShift - }; - - /// isPointerType - Return true if this first class type is big enough to hold - /// a pointer. - /// - bool isPointerType(const Type *Ty); -} - -//===----------------------------------------------------------------------===// -/// DSNodeHandle - Implement a "handle" to a data structure node that takes care -/// of all of the add/un'refing of the node to prevent the backpointers in the -/// graph from getting out of date. This class represents a "pointer" in the -/// graph, whose destination is an indexed offset into a node. -/// -/// Note: some functions that are marked as inline in DSNodeHandle are actually -/// defined in DSNode.h because they need knowledge of DSNode operation. Putting -/// them in a CPP file wouldn't help making them inlined and keeping DSNode and -/// DSNodeHandle (and friends) in one file complicates things. -/// -class DSNodeHandle { - mutable DSNode *N; - mutable unsigned Offset; - void operator==(const DSNode *N); // DISALLOW, use to promote N to nodehandle -public: - // Allow construction, destruction, and assignment... - DSNodeHandle(DSNode *n = 0, unsigned offs = 0) : N(0), Offset(0) { - setTo(n, offs); - } - DSNodeHandle(const DSNodeHandle &H) : N(0), Offset(0) { - DSNode *NN = H.getNode(); - setTo(NN, H.Offset); // Must read offset AFTER the getNode() - } - ~DSNodeHandle() { setTo(0, 0); } - DSNodeHandle &operator=(const DSNodeHandle &H) { - if (&H == this) return *this; // Don't set offset to 0 if self assigning. - DSNode *NN = H.getNode(); // Call getNode() before .Offset - setTo(NN, H.Offset); - return *this; - } - - bool operator<(const DSNodeHandle &H) const { // Allow sorting - return getNode() < H.getNode() || (N == H.N && Offset < H.Offset); - } - bool operator>(const DSNodeHandle &H) const { return H < *this; } - bool operator==(const DSNodeHandle &H) const { // Allow comparison - // getNode can change the offset, so we must call getNode() first. - return getNode() == H.getNode() && Offset == H.Offset; - } - bool operator!=(const DSNodeHandle &H) const { return !operator==(H); } - - inline void swap(DSNodeHandle &NH) { - std::swap(Offset, NH.Offset); - std::swap(N, NH.N); - } - - /// isNull - Check to see if getNode() == 0, without going through the trouble - /// of checking to see if we are forwarding... - /// - bool isNull() const { return N == 0; } - - // Allow explicit conversion to DSNode... - inline DSNode *getNode() const; // Defined inline in DSNode.h - unsigned getOffset() const { - assert(!isForwarding() && "This is a forwarding NH, call getNode() first!"); - return Offset; - } - - void setOffset(unsigned O) { - assert(!isForwarding() && "This is a forwarding NH, call getNode() first!"); - //assert((!N || Offset < N->Size || (N->Size == 0 && Offset == 0) || - // !N->ForwardNH.isNull()) && "Node handle offset out of range!"); - //assert((!N || O < N->Size || (N->Size == 0 && O == 0) || - // !N->ForwardNH.isNull()) && "Node handle offset out of range!"); - Offset = O; - } - - inline void setTo(DSNode *N, unsigned O) const; // Defined inline in DSNode.h - - void addEdgeTo(unsigned LinkNo, const DSNodeHandle &N); - void addEdgeTo(const DSNodeHandle &N) { addEdgeTo(0, N); } - - /// mergeWith - Merge the logical node pointed to by 'this' with the node - /// pointed to by 'N'. - /// - void mergeWith(const DSNodeHandle &N) const; - - /// hasLink - Return true if there is a link at the specified offset... - /// - inline bool hasLink(unsigned Num) const; - - /// getLink - Treat this current node pointer as a pointer to a structure of - /// some sort. This method will return the pointer a mem[this+Num] - /// - inline const DSNodeHandle &getLink(unsigned Num) const; - inline DSNodeHandle &getLink(unsigned Num); - - inline void setLink(unsigned Num, const DSNodeHandle &NH); -private: - DSNode *HandleForwarding() const; - - /// isForwarding - Return true if this NodeHandle is forwarding to another - /// one. - bool isForwarding() const; -}; - -} // End llvm namespace - -namespace std { - template<> - inline void swap<llvm::DSNodeHandle>(llvm::DSNodeHandle &NH1, llvm::DSNodeHandle &NH2) { NH1.swap(NH2); } -} - -namespace HASH_NAMESPACE { - // Provide a hash function for arbitrary pointers... - template <> struct hash<llvm::DSNodeHandle> { - inline size_t operator()(const llvm::DSNodeHandle &Val) const { - return hash<void*>()(Val.getNode()) ^ Val.getOffset(); - } - }; -} - -namespace llvm { - -//===----------------------------------------------------------------------===// -/// DSCallSite - Representation of a call site via its call instruction, -/// the DSNode handle for the callee function (or function pointer), and -/// the DSNode handles for the function arguments. -/// -class DSCallSite { - CallSite Site; // Actual call site - Function *CalleeF; // The function called (direct call) - DSNodeHandle CalleeN; // The function node called (indirect call) - DSNodeHandle RetVal; // Returned value - std::vector<DSNodeHandle> CallArgs;// The pointer arguments - - static void InitNH(DSNodeHandle &NH, const DSNodeHandle &Src, - const hash_map<const DSNode*, DSNode*> &NodeMap) { - if (DSNode *N = Src.getNode()) { - hash_map<const DSNode*, DSNode*>::const_iterator I = NodeMap.find(N); - assert(I != NodeMap.end() && "Node not in mapping!"); - NH.setTo(I->second, Src.getOffset()); - } - } - - static void InitNH(DSNodeHandle &NH, const DSNodeHandle &Src, - const hash_map<const DSNode*, DSNodeHandle> &NodeMap) { - if (DSNode *N = Src.getNode()) { - hash_map<const DSNode*, DSNodeHandle>::const_iterator I = NodeMap.find(N); - assert(I != NodeMap.end() && "Node not in mapping!"); - - DSNode *NN = I->second.getNode(); // Call getNode before getOffset() - NH.setTo(NN, Src.getOffset()+I->second.getOffset()); - } - } - - static void InitNH(DSNodeHandle &NH, const DSNodeHandle &Src, - ReachabilityCloner &RC); - - - DSCallSite(); // DO NOT IMPLEMENT -public: - /// Constructor. Note - This ctor destroys the argument vector passed in. On - /// exit, the argument vector is empty. - /// - DSCallSite(CallSite CS, const DSNodeHandle &rv, DSNode *Callee, - std::vector<DSNodeHandle> &Args) - : Site(CS), CalleeF(0), CalleeN(Callee), RetVal(rv) { - assert(Callee && "Null callee node specified for call site!"); - Args.swap(CallArgs); - } - DSCallSite(CallSite CS, const DSNodeHandle &rv, Function *Callee, - std::vector<DSNodeHandle> &Args) - : Site(CS), CalleeF(Callee), RetVal(rv) { - assert(Callee && "Null callee function specified for call site!"); - Args.swap(CallArgs); - } - - DSCallSite(const DSCallSite &DSCS) // Simple copy ctor - : Site(DSCS.Site), CalleeF(DSCS.CalleeF), CalleeN(DSCS.CalleeN), - RetVal(DSCS.RetVal), CallArgs(DSCS.CallArgs) {} - - /// Mapping copy constructor - This constructor takes a preexisting call site - /// to copy plus a map that specifies how the links should be transformed. - /// This is useful when moving a call site from one graph to another. - /// - template<typename MapTy> - DSCallSite(const DSCallSite &FromCall, MapTy &NodeMap) { - Site = FromCall.Site; - InitNH(RetVal, FromCall.RetVal, NodeMap); - InitNH(CalleeN, FromCall.CalleeN, NodeMap); - CalleeF = FromCall.CalleeF; - - CallArgs.resize(FromCall.CallArgs.size()); - for (unsigned i = 0, e = FromCall.CallArgs.size(); i != e; ++i) - InitNH(CallArgs[i], FromCall.CallArgs[i], NodeMap); - } - - const DSCallSite &operator=(const DSCallSite &RHS) { - Site = RHS.Site; - CalleeF = RHS.CalleeF; - CalleeN = RHS.CalleeN; - RetVal = RHS.RetVal; - CallArgs = RHS.CallArgs; - return *this; - } - - /// isDirectCall - Return true if this call site is a direct call of the - /// function specified by getCalleeFunc. If not, it is an indirect call to - /// the node specified by getCalleeNode. - /// - bool isDirectCall() const { return CalleeF != 0; } - bool isIndirectCall() const { return !isDirectCall(); } - - - // Accessor functions... - Function &getCaller() const; - CallSite getCallSite() const { return Site; } - DSNodeHandle &getRetVal() { return RetVal; } - const DSNodeHandle &getRetVal() const { return RetVal; } - - DSNode *getCalleeNode() const { - assert(!CalleeF && CalleeN.getNode()); return CalleeN.getNode(); - } - Function *getCalleeFunc() const { - assert(!CalleeN.getNode() && CalleeF); return CalleeF; - } - - unsigned getNumPtrArgs() const { return CallArgs.size(); } - - DSNodeHandle &getPtrArg(unsigned i) { - assert(i < CallArgs.size() && "Argument to getPtrArgNode is out of range!"); - return CallArgs[i]; - } - const DSNodeHandle &getPtrArg(unsigned i) const { - assert(i < CallArgs.size() && "Argument to getPtrArgNode is out of range!"); - return CallArgs[i]; - } - - void addPtrArg(const DSNodeHandle &NH) { - CallArgs.push_back(NH); - } - - void swap(DSCallSite &CS) { - if (this != &CS) { - std::swap(Site, CS.Site); - std::swap(RetVal, CS.RetVal); - std::swap(CalleeN, CS.CalleeN); - std::swap(CalleeF, CS.CalleeF); - std::swap(CallArgs, CS.CallArgs); - } - } - - /// mergeWith - Merge the return value and parameters of the these two call - /// sites. - /// - void mergeWith(DSCallSite &CS) { - getRetVal().mergeWith(CS.getRetVal()); - unsigned MinArgs = getNumPtrArgs(); - if (CS.getNumPtrArgs() < MinArgs) MinArgs = CS.getNumPtrArgs(); - - for (unsigned a = 0; a != MinArgs; ++a) - getPtrArg(a).mergeWith(CS.getPtrArg(a)); - - for (unsigned a = MinArgs, e = CS.getNumPtrArgs(); a != e; ++a) - CallArgs.push_back(CS.getPtrArg(a)); - } - - /// markReachableNodes - This method recursively traverses the specified - /// DSNodes, marking any nodes which are reachable. All reachable nodes it - /// adds to the set, which allows it to only traverse visited nodes once. - /// - void markReachableNodes(hash_set<const DSNode*> &Nodes) const; - - bool operator<(const DSCallSite &CS) const { - if (isDirectCall()) { // This must sort by callee first! - if (CS.isIndirectCall()) return true; - if (CalleeF < CS.CalleeF) return true; - if (CalleeF > CS.CalleeF) return false; - } else { - if (CS.isDirectCall()) return false; - if (CalleeN < CS.CalleeN) return true; - if (CalleeN > CS.CalleeN) return false; - } - if (RetVal < CS.RetVal) return true; - if (RetVal > CS.RetVal) return false; - return CallArgs < CS.CallArgs; - } - - bool operator==(const DSCallSite &CS) const { - return CalleeF == CS.CalleeF && CalleeN == CS.CalleeN && - RetVal == CS.RetVal && CallArgs == CS.CallArgs; - } -}; - -} // End llvm namespace - -namespace std { - template<> - inline void swap<llvm::DSCallSite>(llvm::DSCallSite &CS1, - llvm::DSCallSite &CS2) { CS1.swap(CS2); } -} -#endif
diff --git a/poolalloc/include/dsa/DataStructure.h b/poolalloc/include/dsa/DataStructure.h deleted file mode 100644 index b576dd6..0000000 --- a/poolalloc/include/dsa/DataStructure.h +++ /dev/null
@@ -1,441 +0,0 @@ -//===- DataStructure.h - Build data structure graphs ------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Implement the LLVM data structure analysis library. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ANALYSIS_DATA_STRUCTURE_H -#define LLVM_ANALYSIS_DATA_STRUCTURE_H - -#include "llvm/Pass.h" -#include "llvm/Target/TargetData.h" -#include "llvm/Support/CallSite.h" -#include "llvm/ADT/hash_map" -#include "llvm/ADT/hash_set" -#include "llvm/ADT/EquivalenceClasses.h" - -namespace llvm { - -class Type; -class Instruction; -class GlobalValue; -class DSGraph; -class DSCallSite; -class DSNode; -class DSNodeHandle; - -FunctionPass *createDataStructureStatsPass(); -FunctionPass *createDataStructureGraphCheckerPass(); - - -// FIXME: move this stuff to a private header -namespace DataStructureAnalysis { - /// isPointerType - Return true if this first class type is big enough to hold - /// a pointer. - /// - bool isPointerType(const Type *Ty); -} - - -// LocalDataStructures - The analysis that computes the local data structure -// graphs for all of the functions in the program. -// -// FIXME: This should be a Function pass that can be USED by a Pass, and would -// be automatically preserved. Until we can do that, this is a Pass. -// -class LocalDataStructures : public ModulePass { - // DSInfo, one graph for each function - hash_map<Function*, DSGraph*> DSInfo; - DSGraph *GlobalsGraph; - - /// GlobalECs - The equivalence classes for each global value that is merged - /// with other global values in the DSGraphs. - EquivalenceClasses<GlobalValue*> GlobalECs; -public: - ~LocalDataStructures() { releaseMemory(); } - - virtual bool runOnModule(Module &M); - - bool hasGraph(const Function &F) const { - return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end(); - } - - /// getDSGraph - Return the data structure graph for the specified function. - /// - DSGraph &getDSGraph(const Function &F) const { - hash_map<Function*, DSGraph*>::const_iterator I = - DSInfo.find(const_cast<Function*>(&F)); - assert(I != DSInfo.end() && "Function not in module!"); - return *I->second; - } - - DSGraph &getGlobalsGraph() const { return *GlobalsGraph; } - - EquivalenceClasses<GlobalValue*> &getGlobalECs() { return GlobalECs; } - - /// print - Print out the analysis results... - /// - void print(std::ostream &O, const Module *M) const; - - /// releaseMemory - if the pass pipeline is done with this pass, we can - /// release our memory... - /// - virtual void releaseMemory(); - - /// getAnalysisUsage - This obviously provides a data structure graph. - /// - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesAll(); - AU.addRequired<TargetData>(); - } -}; - - -/// BUDataStructures - The analysis that computes the interprocedurally closed -/// data structure graphs for all of the functions in the program. This pass -/// only performs a "Bottom Up" propagation (hence the name). -/// -class BUDataStructures : public ModulePass { -protected: - // DSInfo, one graph for each function - hash_map<Function*, DSGraph*> DSInfo; - DSGraph *GlobalsGraph; - std::set<std::pair<Instruction*, Function*> > ActualCallees; - - // This map is only maintained during construction of BU Graphs - std::map<std::vector<Function*>, - std::pair<DSGraph*, std::vector<DSNodeHandle> > > *IndCallGraphMap; - - /// GlobalECs - The equivalence classes for each global value that is merged - /// with other global values in the DSGraphs. - EquivalenceClasses<GlobalValue*> GlobalECs; - - std::map<CallSite, std::vector<Function*> > AlreadyInlined; - -public: - ~BUDataStructures() { releaseMyMemory(); } - - virtual bool runOnModule(Module &M); - - bool hasGraph(const Function &F) const { - return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end(); - } - - /// getDSGraph - Return the data structure graph for the specified function. - /// - DSGraph &getDSGraph(const Function &F) const { - hash_map<Function*, DSGraph*>::const_iterator I = - DSInfo.find(const_cast<Function*>(&F)); - if (I != DSInfo.end()) - return *I->second; - return const_cast<BUDataStructures*>(this)-> - CreateGraphForExternalFunction(F); - } - - /// DSGraphExists - Is the DSGraph computed for this function? - /// - bool doneDSGraph(const Function *F) const { - return (DSInfo.find(const_cast<Function*>(F)) != DSInfo.end()); - } - - DSGraph &getGlobalsGraph() const { return *GlobalsGraph; } - - EquivalenceClasses<GlobalValue*> &getGlobalECs() { return GlobalECs; } - - DSGraph &CreateGraphForExternalFunction(const Function &F); - - /// deleteValue/copyValue - Interfaces to update the DSGraphs in the program. - /// These correspond to the interfaces defined in the AliasAnalysis class. - void deleteValue(Value *V); - void copyValue(Value *From, Value *To); - - /// print - Print out the analysis results... - /// - void print(std::ostream &O, const Module *M) const; - - // FIXME: Once the pass manager is straightened out, rename this to - // releaseMemory. - void releaseMyMemory(); - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesAll(); - AU.addRequired<LocalDataStructures>(); - } - - typedef std::set<std::pair<Instruction*, Function*> > ActualCalleesTy; - const ActualCalleesTy &getActualCallees() const { - return ActualCallees; - } - - typedef ActualCalleesTy::const_iterator callee_iterator; - callee_iterator callee_begin(Instruction *I) const { - return ActualCallees.lower_bound(std::pair<Instruction*,Function*>(I, 0)); - } - - callee_iterator callee_end(Instruction *I) const { - I = (Instruction*)((char*)I + 1); - return ActualCallees.lower_bound(std::pair<Instruction*,Function*>(I, 0)); - } - -private: - bool calculateGraph(DSGraph &G); - - DSGraph &getOrCreateGraph(Function *F); - - unsigned calculateGraphs(Function *F, std::vector<Function*> &Stack, - unsigned &NextID, - hash_map<Function*, unsigned> &ValMap); -}; - - -/// TDDataStructures - Analysis that computes new data structure graphs -/// for each function using the closed graphs for the callers computed -/// by the bottom-up pass. -/// -class TDDataStructures : public ModulePass { - // DSInfo, one graph for each function - hash_map<Function*, DSGraph*> DSInfo; - hash_set<Function*> ArgsRemainIncomplete; - DSGraph *GlobalsGraph; - BUDataStructures *BUInfo; - - /// GlobalECs - The equivalence classes for each global value that is merged - /// with other global values in the DSGraphs. - EquivalenceClasses<GlobalValue*> GlobalECs; - - /// CallerCallEdges - For a particular graph, we keep a list of these records - /// which indicates which graphs call this function and from where. - struct CallerCallEdge { - DSGraph *CallerGraph; // The graph of the caller function. - const DSCallSite *CS; // The actual call site. - Function *CalledFunction; // The actual function being called. - - CallerCallEdge(DSGraph *G, const DSCallSite *cs, Function *CF) - : CallerGraph(G), CS(cs), CalledFunction(CF) {} - - bool operator<(const CallerCallEdge &RHS) const { - return CallerGraph < RHS.CallerGraph || - (CallerGraph == RHS.CallerGraph && CS < RHS.CS); - } - }; - - std::map<DSGraph*, std::vector<CallerCallEdge> > CallerEdges; - - - // IndCallMap - We memoize the results of indirect call inlining operations - // that have multiple targets here to avoid N*M inlining. The key to the map - // is a sorted set of callee functions, the value is the DSGraph that holds - // all of the caller graphs merged together, and the DSCallSite to merge with - // the arguments for each function. - std::map<std::vector<Function*>, DSGraph*> IndCallMap; - -public: - ~TDDataStructures() { releaseMyMemory(); } - - virtual bool runOnModule(Module &M); - - bool hasGraph(const Function &F) const { - return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end(); - } - - /// getDSGraph - Return the data structure graph for the specified function. - /// - DSGraph &getDSGraph(const Function &F) const { - hash_map<Function*, DSGraph*>::const_iterator I = - DSInfo.find(const_cast<Function*>(&F)); - if (I != DSInfo.end()) return *I->second; - return const_cast<TDDataStructures*>(this)-> - getOrCreateDSGraph(const_cast<Function&>(F)); - } - - DSGraph &getGlobalsGraph() const { return *GlobalsGraph; } - EquivalenceClasses<GlobalValue*> &getGlobalECs() { return GlobalECs; } - - - /// deleteValue/copyValue - Interfaces to update the DSGraphs in the program. - /// These correspond to the interfaces defined in the AliasAnalysis class. - void deleteValue(Value *V); - void copyValue(Value *From, Value *To); - - /// print - Print out the analysis results... - /// - void print(std::ostream &O, const Module *M) const; - - /// If the pass pipeline is done with this pass, we can release our memory... - /// - virtual void releaseMyMemory(); - - /// getAnalysisUsage - This obviously provides a data structure graph. - /// - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesAll(); - AU.addRequired<BUDataStructures>(); - } - -private: - void markReachableFunctionsExternallyAccessible(DSNode *N, - hash_set<DSNode*> &Visited); - - void InlineCallersIntoGraph(DSGraph &G); - DSGraph &getOrCreateDSGraph(Function &F); - void ComputePostOrder(Function &F, hash_set<DSGraph*> &Visited, - std::vector<DSGraph*> &PostOrder); -}; - - -/// CompleteBUDataStructures - This is the exact same as the bottom-up graphs, -/// but we use take a completed call graph and inline all indirect callees into -/// their callers graphs, making the result more useful for things like pool -/// allocation. -/// -struct CompleteBUDataStructures : public BUDataStructures { - virtual bool runOnModule(Module &M); - - bool hasGraph(const Function &F) const { - return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end(); - } - - /// getDSGraph - Return the data structure graph for the specified function. - /// - DSGraph &getDSGraph(const Function &F) const { - hash_map<Function*, DSGraph*>::const_iterator I = - DSInfo.find(const_cast<Function*>(&F)); - assert(I != DSInfo.end() && "Function not in module!"); - return *I->second; - } - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesAll(); - AU.addRequired<BUDataStructures>(); - - // FIXME: TEMPORARY (remove once finalization of indirect call sites in the - // globals graph has been implemented in the BU pass) - AU.addRequired<TDDataStructures>(); - } - - /// print - Print out the analysis results... - /// - void print(std::ostream &O, const Module *M) const; - -private: - unsigned calculateSCCGraphs(DSGraph &FG, std::vector<DSGraph*> &Stack, - unsigned &NextID, - hash_map<DSGraph*, unsigned> &ValMap); - DSGraph &getOrCreateGraph(Function &F); - void processGraph(DSGraph &G); -}; - - -/// EquivClassGraphs - This is the same as the complete bottom-up graphs, but -/// with functions partitioned into equivalence classes and a single merged -/// DS graph for all functions in an equivalence class. After this merging, -/// graphs are inlined bottom-up on the SCCs of the final (CBU) call graph. -/// -struct EquivClassGraphs : public ModulePass { - CompleteBUDataStructures *CBU; - - DSGraph *GlobalsGraph; - - // DSInfo - one graph for each function. - hash_map<const Function*, DSGraph*> DSInfo; - - /// ActualCallees - The actual functions callable from indirect call sites. - /// - std::set<std::pair<Instruction*, Function*> > ActualCallees; - - // Equivalence class where functions that can potentially be called via the - // same function pointer are in the same class. - EquivalenceClasses<Function*> FuncECs; - - /// OneCalledFunction - For each indirect call, we keep track of one - /// target of the call. This is used to find equivalence class called by - /// a call site. - std::map<DSNode*, Function *> OneCalledFunction; - - /// GlobalECs - The equivalence classes for each global value that is merged - /// with other global values in the DSGraphs. - EquivalenceClasses<GlobalValue*> GlobalECs; - -public: - /// EquivClassGraphs - Computes the equivalence classes and then the - /// folded DS graphs for each class. - /// - virtual bool runOnModule(Module &M); - - /// print - Print out the analysis results... - /// - void print(std::ostream &O, const Module *M) const; - - EquivalenceClasses<GlobalValue*> &getGlobalECs() { return GlobalECs; } - - /// getDSGraph - Return the data structure graph for the specified function. - /// This returns the folded graph. The folded graph is the same as the CBU - /// graph iff the function is in a singleton equivalence class AND all its - /// callees also have the same folded graph as the CBU graph. - /// - DSGraph &getDSGraph(const Function &F) const { - hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(&F); - assert(I != DSInfo.end() && "No graph computed for that function!"); - return *I->second; - } - - bool hasGraph(const Function &F) const { - return DSInfo.find(&F) != DSInfo.end(); - } - - /// ContainsDSGraphFor - Return true if we have a graph for the specified - /// function. - bool ContainsDSGraphFor(const Function &F) const { - return DSInfo.find(&F) != DSInfo.end(); - } - - /// getSomeCalleeForCallSite - Return any one callee function at - /// a call site. - /// - Function *getSomeCalleeForCallSite(const CallSite &CS) const; - - DSGraph &getGlobalsGraph() const { - return *GlobalsGraph; - } - - typedef std::set<std::pair<Instruction*, Function*> > ActualCalleesTy; - const ActualCalleesTy &getActualCallees() const { - return ActualCallees; - } - - typedef ActualCalleesTy::const_iterator callee_iterator; - callee_iterator callee_begin(Instruction *I) const { - return ActualCallees.lower_bound(std::pair<Instruction*,Function*>(I, 0)); - } - - callee_iterator callee_end(Instruction *I) const { - I = (Instruction*)((char*)I + 1); - return ActualCallees.lower_bound(std::pair<Instruction*,Function*>(I, 0)); - } - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesAll(); - AU.addRequired<CompleteBUDataStructures>(); - } - -private: - void buildIndirectFunctionSets(Module &M); - - unsigned processSCC(DSGraph &FG, std::vector<DSGraph*> &Stack, - unsigned &NextID, - std::map<DSGraph*, unsigned> &ValMap); - void processGraph(DSGraph &FG); - - DSGraph &getOrCreateGraph(Function &F); -}; - -} // End llvm namespace - -#endif
diff --git a/poolalloc/include/poolalloc/Config/config.h.in b/poolalloc/include/poolalloc/Config/config.h.in deleted file mode 100644 index 123cb75..0000000 --- a/poolalloc/include/poolalloc/Config/config.h.in +++ /dev/null
@@ -1,465 +0,0 @@ -/* include/poolalloc/Config/config.h.in. Generated from autoconf/configure.ac by autoheader. */ - -/* Define if dlopen(0) will open the symbols of the program */ -#undef CAN_DLOPEN_SELF - -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -#undef CRAY_STACKSEG_END - -/* Define to 1 if using `alloca.c'. */ -#undef C_ALLOCA - -/* Define to 1 if you have `alloca', as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). - */ -#undef HAVE_ALLOCA_H - -/* Define to 1 if you have the `argz_append' function. */ -#undef HAVE_ARGZ_APPEND - -/* Define to 1 if you have the `argz_create_sep' function. */ -#undef HAVE_ARGZ_CREATE_SEP - -/* Define to 1 if you have the <argz.h> header file. */ -#undef HAVE_ARGZ_H - -/* Define to 1 if you have the `argz_insert' function. */ -#undef HAVE_ARGZ_INSERT - -/* Define to 1 if you have the `argz_next' function. */ -#undef HAVE_ARGZ_NEXT - -/* Define to 1 if you have the `argz_stringify' function. */ -#undef HAVE_ARGZ_STRINGIFY - -/* Define to 1 if you have the <assert.h> header file. */ -#undef HAVE_ASSERT_H - -/* Define to 1 if you have the `backtrace' function. */ -#undef HAVE_BACKTRACE - -/* Define to 1 if you have the `bcopy' function. */ -#undef HAVE_BCOPY - -/* Does not have bi-directional iterator */ -#undef HAVE_BI_ITERATOR - -/* Define to 1 if you have the `closedir' function. */ -#undef HAVE_CLOSEDIR - -/* Define to 1 if you have the <ctype.h> header file. */ -#undef HAVE_CTYPE_H - -/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. - */ -#undef HAVE_DIRENT_H - -/* Define if you have the GNU dld library. */ -#undef HAVE_DLD - -/* Define to 1 if you have the <dld.h> header file. */ -#undef HAVE_DLD_H - -/* Define to 1 if you have the `dlerror' function. */ -#undef HAVE_DLERROR - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#undef HAVE_DLFCN_H - -/* Define if dlopen() is available on this platform. */ -#undef HAVE_DLOPEN - -/* Define to 1 if you have the <dl.h> header file. */ -#undef HAVE_DL_H - -/* Define if you have the _dyld_func_lookup function. */ -#undef HAVE_DYLD - -/* Define to 1 if you have the <errno.h> header file. */ -#undef HAVE_ERRNO_H - -/* Define to 1 if the system has the type `error_t'. */ -#undef HAVE_ERROR_T - -/* Define to 1 if you have the <execinfo.h> header file. */ -#undef HAVE_EXECINFO_H - -/* Define to 1 if you have the <fcntl.h> header file. */ -#undef HAVE_FCNTL_H - -/* Set to 1 if the finite function is found in <ieeefp.h> */ -#undef HAVE_FINITE_IN_IEEEFP_H - -/* Does not have forward iterator */ -#undef HAVE_FWD_ITERATOR - -/* Define to 1 if you have the `getcwd' function. */ -#undef HAVE_GETCWD - -/* Define to 1 if you have the `getpagesize' function. */ -#undef HAVE_GETPAGESIZE - -/* Define to 1 if you have the `getrusage' function. */ -#undef HAVE_GETRUSAGE - -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Does not have <hash_map> */ -#undef HAVE_GLOBAL_HASH_MAP - -/* Does not have hash_set in global namespace */ -#undef HAVE_GLOBAL_HASH_SET - -/* Does not have ext/hash_map */ -#undef HAVE_GNU_EXT_HASH_MAP - -/* Does not have hash_set in gnu namespace */ -#undef HAVE_GNU_EXT_HASH_SET - -/* Define to 1 if you have the `index' function. */ -#undef HAVE_INDEX - -/* Define to 1 if the system has the type `int64_t'. */ -#undef HAVE_INT64_T - -/* Define to 1 if you have the <inttypes.h> header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `isatty' function. */ -#undef HAVE_ISATTY - -/* Set to 1 if the isinf function is found in <cmath> */ -#undef HAVE_ISINF_IN_CMATH - -/* Set to 1 if the isinf function is found in <math.h> */ -#undef HAVE_ISINF_IN_MATH_H - -/* Set to 1 if the isnan function is found in <cmath> */ -#undef HAVE_ISNAN_IN_CMATH - -/* Set to 1 if the isnan function is found in <math.h> */ -#undef HAVE_ISNAN_IN_MATH_H - -/* Define if you have the libdl library or equivalent. */ -#undef HAVE_LIBDL - -/* Define to 1 if you have the `elf' library (-lelf). */ -#undef HAVE_LIBELF - -/* Define to 1 if you have the <limits.h> header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have the <link.h> header file. */ -#undef HAVE_LINK_H - -/* Define if you can use -Wl,-R. to pass -R. to the linker, in order to add - the current directory to the dynamic linker search path. */ -#undef HAVE_LINK_R - -/* Define if lt_dlopen() is available on this platform */ -#undef HAVE_LT_DLOPEN - -/* Define to 1 if you have the <mach-o/dyld.h> header file. */ -#undef HAVE_MACH_O_DYLD_H - -/* Define if mallinfo() is available on this platform. */ -#undef HAVE_MALLINFO - -/* Define to 1 if you have the <malloc.h> header file. */ -#undef HAVE_MALLOC_H - -/* Define to 1 if you have the `memcpy' function. */ -#undef HAVE_MEMCPY - -/* Define to 1 if you have the `memmove' function. */ -#undef HAVE_MEMMOVE - -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `mkdtemp' function. */ -#undef HAVE_MKDTEMP - -/* Define to 1 if you have the `mkstemp' function. */ -#undef HAVE_MKSTEMP - -/* Define to 1 if you have the `mktemp' function. */ -#undef HAVE_MKTEMP - -/* Define to 1 if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define if mmap() uses MAP_ANONYMOUS to map anonymous pages, or undefine if - it uses MAP_ANON */ -#undef HAVE_MMAP_ANONYMOUS - -/* Define if mmap() can map files into memory */ -#undef HAVE_MMAP_FILE - -/* define if the compiler implements namespaces */ -#undef HAVE_NAMESPACES - -/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ -#undef HAVE_NDIR_H - -/* Define to 1 if you have the `opendir' function. */ -#undef HAVE_OPENDIR - -/* Define if libtool can extract symbol lists from object files. */ -#undef HAVE_PRELOADED_SYMBOLS - -/* Define to have the %a format string */ -#undef HAVE_PRINTF_A - -/* Have pthread_mutex_lock */ -#undef HAVE_PTHREAD_MUTEX_LOCK - -/* Define to 1 if srand48/lrand48/drand48 exist in <stdlib.h> */ -#undef HAVE_RAND48 - -/* Define to 1 if you have the `readdir' function. */ -#undef HAVE_READDIR - -/* Define to 1 if you have the `realpath' function. */ -#undef HAVE_REALPATH - -/* Define to 1 if you have the `rindex' function. */ -#undef HAVE_RINDEX - -/* Define to 1 if you have the <rw/stdex/hash_map.h> header file. */ -#undef HAVE_RW_STDEX_HASH_MAP_H - -/* Define to 1 if you have the <rw/stdex/hash_set.h> header file. */ -#undef HAVE_RW_STDEX_HASH_SET_H - -/* Define to 1 if you have the `sbrk' function. */ -#undef HAVE_SBRK - -/* Define to 1 if you have the `setrlimit' function. */ -#undef HAVE_SETRLIMIT - -/* Define if you have the shl_load function. */ -#undef HAVE_SHL_LOAD - -/* Define to 1 if you have the <signal.h> header file. */ -#undef HAVE_SIGNAL_H - -/* Define to 1 if you have the <stdint.h> header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the <stdio.h> header file. */ -#undef HAVE_STDIO_H - -/* Define to 1 if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H - -/* Does not have ext/hash_map> */ -#undef HAVE_STD_EXT_HASH_MAP - -/* Does not have hash_set in std namespace */ -#undef HAVE_STD_EXT_HASH_SET - -/* Set to 1 if the std::isinf function is found in <cmath> */ -#undef HAVE_STD_ISINF_IN_CMATH - -/* Set to 1 if the std::isnan function is found in <cmath> */ -#undef HAVE_STD_ISNAN_IN_CMATH - -/* Does not have std namespace iterator */ -#undef HAVE_STD_ITERATOR - -/* Define to 1 if you have the `strchr' function. */ -#undef HAVE_STRCHR - -/* Define to 1 if you have the `strcmp' function. */ -#undef HAVE_STRCMP - -/* Define to 1 if you have the `strdup' function. */ -#undef HAVE_STRDUP - -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* Define to 1 if you have the `strerror_r' function. */ -#undef HAVE_STRERROR_R - -/* Define to 1 if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the <string.h> header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strrchr' function. */ -#undef HAVE_STRRCHR - -/* Define to 1 if you have the `strtoll' function. */ -#undef HAVE_STRTOLL - -/* Define to 1 if you have the `strtoq' function. */ -#undef HAVE_STRTOQ - -/* Define to 1 if you have the `sysconf' function. */ -#undef HAVE_SYSCONF - -/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. - */ -#undef HAVE_SYS_DIR_H - -/* Define to 1 if you have the <sys/dl.h> header file. */ -#undef HAVE_SYS_DL_H - -/* Define to 1 if you have the <sys/mman.h> header file. */ -#undef HAVE_SYS_MMAN_H - -/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. - */ -#undef HAVE_SYS_NDIR_H - -/* Define to 1 if you have the <sys/param.h> header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the <sys/resource.h> header file. */ -#undef HAVE_SYS_RESOURCE_H - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the <sys/time.h> header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ -#undef HAVE_SYS_WAIT_H - -/* Define to 1 if the system has the type `uint64_t'. */ -#undef HAVE_UINT64_T - -/* Define to 1 if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the <utime.h> header file. */ -#undef HAVE_UTIME_H - -/* Define to 1 if the system has the type `u_int64_t'. */ -#undef HAVE_U_INT64_T - -/* Define to 1 if you have the <windows.h> header file. */ -#undef HAVE_WINDOWS_H - -/* Installation directory for binary executables */ -#undef LLVM_BINDIR - -/* Time at which LLVM was configured */ -#undef LLVM_CONFIGTIME - -/* Installation directory for documentation */ -#undef LLVM_DATADIR - -/* Installation directory for config files */ -#undef LLVM_ETCDIR - -/* Installation directory for include files */ -#undef LLVM_INCLUDEDIR - -/* Installation directory for .info files */ -#undef LLVM_INFODIR - -/* Installation directory for libraries */ -#undef LLVM_LIBDIR - -/* Installation directory for man pages */ -#undef LLVM_MANDIR - -/* Define if this is Unixish platform */ -#undef LLVM_ON_UNIX - -/* Define if this is Win32ish platform */ -#undef LLVM_ON_WIN32 - -/* Installation prefix directory */ -#undef LLVM_PREFIX - -/* Define if the OS needs help to load dependent libraries for dlopen(). */ -#undef LTDL_DLOPEN_DEPLIBS - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LTDL_OBJDIR - -/* Define to the name of the environment variable that determines the dynamic - library search path. */ -#undef LTDL_SHLIBPATH_VAR - -/* Define to the extension used for shared libraries, say, ".so". */ -#undef LTDL_SHLIB_EXT - -/* Define to the system default library search path. */ -#undef LTDL_SYSSEARCHPATH - -/* Define if /dev/zero should be used when mapping RWX memory, or undefine if - its not necessary */ -#undef NEED_DEV_ZERO_FOR_MMAP - -/* Define if dlsym() requires a leading underscore in symbol names. */ -#undef NEED_USCORE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define as the return type of signal handlers (`int' or `void'). */ -#undef RETSIGTYPE - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -#undef STACK_DIRECTION - -/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */ -#undef STAT_MACROS_BROKEN - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ -#undef TIME_WITH_SYS_TIME - -/* Define to 1 if your <sys/time.h> declares `struct tm'. */ -#undef TM_IN_SYS_TIME - -/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a - `char[]'. */ -#undef YYTEXT_POINTER - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to a type to use for `error_t' if it is not otherwise available. */ -#undef error_t - -/* Define to `int' if <sys/types.h> does not define. */ -#undef pid_t - -/* Define to `unsigned' if <sys/types.h> does not define. */ -#undef size_t
diff --git a/poolalloc/include/poolalloc/MMAPSupport.h b/poolalloc/include/poolalloc/MMAPSupport.h deleted file mode 100644 index f2bb41c..0000000 --- a/poolalloc/include/poolalloc/MMAPSupport.h +++ /dev/null
@@ -1,56 +0,0 @@ -//===- MMAPSupport.h - mmap portability wrappers ----------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file allows clients to use some functionality of mmap efficiently and -// portably. This is used for the pool allocator runtime implementations. -// -//===----------------------------------------------------------------------===// - -#include "poolalloc/Config/config.h" -#include <cstdlib> -#include <cassert> - -#ifdef HAVE_FCNTL_H -#include <fcntl.h> -#endif - -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif - -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif - -#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS) -#define MAP_ANONYMOUS MAP_ANON -#endif /* defined(MAP_ANON) && !defined(MAP_ANONYMOUS) */ - -static void *AllocateSpaceWithMMAP(size_t Size, bool UseNoReserve = false) { - // NOTE: this assumes Size is a multiple of the page size. - int FD = -1; -#ifdef NEED_DEV_ZERO_FOR_MMAP - static int DevZeroFD = open("/dev/zero", O_RDWR); - if (DevZeroFD == -1) { - perror("Can't open /dev/zero device"); - abort(); - } - FD = zero_fd; -#endif - - int Flags = MAP_PRIVATE | MAP_ANONYMOUS; -#ifdef MAP_NORESERVE - if (UseNoReserve) - Flags |= MAP_NORESERVE; -#endif - - void *Mem = ::mmap(0, Size, PROT_READ|PROT_WRITE, Flags, FD, 0); - assert(Mem != MAP_FAILED && "couldn't get space!"); - return Mem; -}
diff --git a/poolalloc/include/poolalloc/PoolAllocate.h b/poolalloc/include/poolalloc/PoolAllocate.h deleted file mode 100644 index c33ab54..0000000 --- a/poolalloc/include/poolalloc/PoolAllocate.h +++ /dev/null
@@ -1,295 +0,0 @@ -//===-- PoolAllocate.h - Pool allocation pass -------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This transform changes programs so that disjoint data structures are -// allocated out of different pools of memory, increasing locality. This header -// file exposes information about the pool allocation itself so that follow-on -// passes may extend or use the pool allocation for analysis. -// -//===----------------------------------------------------------------------===// - -#ifndef POOLALLOCATE_H -#define POOLALLOCATE_H -//#define SAFECODE 1 -//#define BOUNDS_CHECK 1 -//comment the above two for normal poolallocation -#include "llvm/Pass.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Support/CallSite.h" -#include "llvm/ADT/EquivalenceClasses.h" -#include "llvm/ADT/VectorExtras.h" -#include "llvm/ADT/hash_set" - -#ifdef SAFECODE -//FIXME : make this use some configuration options -#include "/home/vadve/dhurjati/llvm/projects/safecode.typesafe/include/ConvertUnsafeAllocas.h" -#endif - - -#include <set> - -namespace llvm { -#ifdef SAFECODE - using namespace CUA; -#endif -class DSNode; -class DSGraph; -class Type; -class AllocaInst; -class EquivClassGraphs; -class CallTargetFinder; - -namespace PA { - - class Heuristic; - - /// FuncInfo - Represent the pool allocation information for one function in - /// the program. Note that many functions must actually be cloned in order - /// for pool allocation to add arguments to the function signature. In this - /// case, the Clone and NewToOldValueMap information identify how the clone - /// maps to the original function... - /// - struct FuncInfo { - FuncInfo(Function &f) : F(f), Clone(0) {} - - /// MarkedNodes - The set of nodes which are not locally pool allocatable in - /// the current function. - /// - hash_set<const DSNode*> MarkedNodes; - - /// F - The function this FuncInfo corresponds to. - /// - Function &F; - - /// Clone - The cloned version of the function, if applicable. - /// - Function *Clone; - - /// ArgNodes - The list of DSNodes which have pools passed in as arguments. - /// - std::vector<const DSNode*> ArgNodes; - - /// NodesToPA - The list of nodes which are to be pool allocated locally in - /// this function. This only includes heap nodes. - std::vector<const DSNode*> NodesToPA; - - /// PoolDescriptors - The Value* which defines the pool descriptor for this - /// DSNode. Note: This does not necessarily include pool arguments that are - /// passed in because of indirect function calls that are not used in the - /// function. - std::map<const DSNode*, Value*> PoolDescriptors; - -#ifdef SAFECODE - //This is a map from Old to New Value Map reverse of the one above - //Useful in SAFECode for check insertion - std::map<const Value*, Value*> ValueMap; -#endif - - /// NewToOldValueMap - When and if a function needs to be cloned, this map - /// contains a mapping from all of the values in the new function back to - /// the values they correspond to in the old function. - /// - typedef std::map<Value*, const Value*> NewToOldValueMapTy; - NewToOldValueMapTy NewToOldValueMap; - - /// MapValueToOriginal - Given a value in the cloned version of this - /// function, map it back to the original. If the specified value did not - /// exist in the original function (e.g. because it's a pool descriptor), - /// return null. - Value *MapValueToOriginal(Value *V) const { - NewToOldValueMapTy::const_iterator I = NewToOldValueMap.find(V); - return I != NewToOldValueMap.end() ? const_cast<Value*>(I->second) : 0; - } - }; - -} // end PA namespace - - - -/// PoolAllocate - The main pool allocation pass -/// -class PoolAllocate : public ModulePass { - /// PassAllArguments - If set to true, we should pass pool descriptor - /// arguments into any function that loads or stores to a pool, in addition to - /// those functions that allocate or deallocate. See also the - /// PoolAllocatePassAllPools pass below. - bool PassAllArguments; - - Module *CurModule; - EquivClassGraphs *ECGraphs; - CallTargetFinder* CTF; - - std::map<Function*, PA::FuncInfo> FunctionInfo; - std::map<Function*, Function*> CloneToOrigMap; -public: - -#ifdef SAFECODE - ConvertUnsafeAllocas *CUAPass; -#endif - Function *PoolInit, *PoolDestroy, *PoolAlloc, *PoolRealloc, *PoolMemAlign; - Function *PoolFree; -#ifdef SAFECODE - Function *PoolRegister; -#endif -#ifdef BOUNDS_CHECK - Function *PoolRegister; -#endif - - static const Type *PoolDescPtrTy; - - PA::Heuristic *CurHeuristic; - - /// GlobalNodes - For each node (with an H marker) in the globals graph, this - /// map contains the global variable that holds the pool descriptor for the - /// node. - std::map<const DSNode*, Value*> GlobalNodes; - - public: -#ifdef SAFECODE - PoolAllocate(bool passAllArguments = true) - : PassAllArguments(passAllArguments) {} -#else - PoolAllocate(bool passAllArguments = false) - : PassAllArguments(passAllArguments) {} -#endif - bool runOnModule(Module &M); - - virtual void getAnalysisUsage(AnalysisUsage &AU) const; - - EquivClassGraphs &getECGraphs() const { return *ECGraphs; } - - /// getOrigFunctionFromClone - Given a pointer to a function that was cloned - /// from another function, return the original function. If the argument - /// function is not a clone, return null. - Function *getOrigFunctionFromClone(Function *F) const { - std::map<Function*, Function*>::const_iterator I = CloneToOrigMap.find(F); - return I != CloneToOrigMap.end() ? I->second : 0; - } - - /// getFuncInfo - Return the FuncInfo object for the specified function. - /// - PA::FuncInfo *getFuncInfo(Function &F) { - std::map<Function*, PA::FuncInfo>::iterator I = FunctionInfo.find(&F); - return I != FunctionInfo.end() ? &I->second : 0; - } - - /// getFuncInfoOrClone - Return the function info object for for the specified - /// function. If this function is a clone of another function, return the - /// function info object for the original function. - PA::FuncInfo *getFuncInfoOrClone(Function &F) { - // If it is cloned or not check it out. - if (PA::FuncInfo *FI = getFuncInfo(F)) - return FI; - // Maybe this is a function clone? - if (Function *FC = getOrigFunctionFromClone(&F)) - return getFuncInfo(*FC); - return 0; - } - - - /// releaseMemory - When the pool allocator is no longer used, release - /// resources used by it. - virtual void releaseMemory() { - FunctionInfo.clear(); - GlobalNodes.clear(); - CloneToOrigMap.clear(); - } - - - Module *getCurModule() { return CurModule; } - - /// CreateGlobalPool - Create a global pool descriptor, initialize it in main, - /// and return a pointer to the global for it. - GlobalVariable *CreateGlobalPool(unsigned RecSize, unsigned Alignment, - Instruction *IPHint = 0); - - private: - - /// AddPoolPrototypes - Add prototypes for the pool functions to the - /// specified module and update the Pool* instance variables to point to - /// them. - /// - void AddPoolPrototypes(); - - /// MicroOptimizePoolCalls - Apply any microoptimizations to calls to pool - /// allocation function calls that we can. - void MicroOptimizePoolCalls(); - - /// BuildIndirectFunctionSets - Iterate over the module looking for indirect - /// calls to functions - void BuildIndirectFunctionSets(Module &M); - - /// SetupGlobalPools - Create global pools for all DSNodes in the globals - /// graph which contain heap objects. If a global variable points to a piece - /// of memory allocated from the heap, this pool gets a global lifetime. - /// - /// This method returns true if correct pool allocation of the module cannot - /// be performed because there is no main function for the module and there - /// are global pools. - bool SetupGlobalPools(Module &M); - - /// FindFunctionPoolArgs - In the first pass over the program, we decide which - /// arguments will have to be added for each function, build the FunctionInfo - /// map and recording this info in the ArgNodes set. - void FindFunctionPoolArgs(Function &F); - - /// MakeFunctionClone - If the specified function needs to be modified for - /// pool allocation support, make a clone of it, adding additional arguments - /// as neccesary, and return it. If not, just return null. - /// - Function *MakeFunctionClone(Function &F); - - /// ProcessFunctionBody - Rewrite the body of a transformed function to use - /// pool allocation where appropriate. - /// - void ProcessFunctionBody(Function &Old, Function &New); - - /// CreatePools - This inserts alloca instruction in the function for all - /// pools specified in the NodesToPA list. This adds an entry to the - /// PoolDescriptors map for each DSNode. - /// - void CreatePools(Function &F, DSGraph &G, - const std::vector<const DSNode*> &NodesToPA, - std::map<const DSNode*, Value*> &PoolDescriptors); - - void TransformBody(DSGraph &g, PA::FuncInfo &fi, - std::multimap<AllocaInst*, Instruction*> &poolUses, - std::multimap<AllocaInst*, CallInst*> &poolFrees, - Function &F); - - /// InitializeAndDestroyPools - This inserts calls to poolinit and pooldestroy - /// into the function to initialize and destroy the pools in the NodesToPA - /// list. - void InitializeAndDestroyPools(Function &F, - const std::vector<const DSNode*> &NodesToPA, - std::map<const DSNode*, Value*> &PoolDescriptors, - std::multimap<AllocaInst*, Instruction*> &PoolUses, - std::multimap<AllocaInst*, CallInst*> &PoolFrees); - - void InitializeAndDestroyPool(Function &F, const DSNode *Pool, - std::map<const DSNode*, Value*> &PoolDescriptors, - std::multimap<AllocaInst*, Instruction*> &PoolUses, - std::multimap<AllocaInst*, CallInst*> &PoolFrees); - - void CalculateLivePoolFreeBlocks(std::set<BasicBlock*> &LiveBlocks,Value *PD); -}; - - -/// PoolAllocatePassAllPools - This class is the same as the pool allocator, -/// except that it passes pool descriptors into functions that do not do -/// allocations or deallocations. This is needed by the pointer compression -/// pass, which requires a pool descriptor to be available for a pool if any -/// load or store to that pool is performed. -struct PoolAllocatePassAllPools : public PoolAllocate { - PoolAllocatePassAllPools() : PoolAllocate(true) {} -}; - -} - -#endif
diff --git a/poolalloc/include/poolalloc/Support/MallocAllocator.h b/poolalloc/include/poolalloc/Support/MallocAllocator.h deleted file mode 100644 index ae3dbac..0000000 --- a/poolalloc/include/poolalloc/Support/MallocAllocator.h +++ /dev/null
@@ -1,93 +0,0 @@ -//===-- llvm/Support/MallocAllocator.h --------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines MallocAllocator class, an STL compatible allocator which -// just uses malloc/free to get and release memory. The default allocator uses -// the STL pool allocator runtime library, this explicitly avoids it. -// -// This file is used for variety of purposes, including the pool allocator -// project and testing, regardless of whether or not it's used directly in the -// LLVM code, so don't delete this from CVS if you think it's unused! -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_SUPPORT_MALLOCALLOCATOR_H -#define LLVM_SUPPORT_MALLOCALLOCATOR_H - -#include <cstdlib> -#include <memory> - -namespace llvm { - -template<typename T> -struct MallocAllocator { - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef T* pointer; - typedef const T* const_pointer; - typedef T& reference; - typedef const T& const_reference; - typedef T value_type; - template <class U> struct rebind { - typedef MallocAllocator<U> other; - }; - - template<typename R> - MallocAllocator(const MallocAllocator<R> &) {} - MallocAllocator() {} - - pointer address(reference x) const { return &x; } - const_pointer address(const_reference x) const { return &x; } - size_type max_size() const { return ~0 / sizeof(T); } - - static pointer allocate(size_t n, void* hint = 0) { - return static_cast<pointer>(malloc(n*sizeof(T))); - } - - static void deallocate(pointer p, size_t n) { - free(static_cast<void*>(p)); - } - - void construct(pointer p, const T &val) { - new(static_cast<void*>(p)) T(val); - } - void destroy(pointer p) { - p->~T(); - } -}; - -template<typename T> -inline bool operator==(const MallocAllocator<T> &, const MallocAllocator<T> &) { - return true; -} -template<typename T> -inline bool operator!=(const MallocAllocator<T>&, const MallocAllocator<T>&) { - return false; -} -} // End llvm namespace - -/* - * This specialization was used for optimization earlier, but doesn't appear - * to work with newer versions of GCC, Linux or otherwise. - * - * This can be re-enabled if desired, but by default, it won't be included. - */ -#if 0 -namespace std { - template<typename Type, typename Type2> - struct _Alloc_traits<Type, ::llvm::MallocAllocator<Type2> > { - static const bool _S_instanceless = true; - typedef ::llvm::MallocAllocator<Type> base_alloc_type; - typedef ::llvm::MallocAllocator<Type> _Alloc_type; - typedef ::llvm::MallocAllocator<Type> allocator_type; - }; -} -#endif - -#endif
diff --git a/poolalloc/lib/DSA/BottomUpClosure.cpp b/poolalloc/lib/DSA/BottomUpClosure.cpp deleted file mode 100644 index dc7c761..0000000 --- a/poolalloc/lib/DSA/BottomUpClosure.cpp +++ /dev/null
@@ -1,790 +0,0 @@ -//===- BottomUpClosure.cpp - Compute bottom-up interprocedural closure ----===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the BUDataStructures class, which represents the -// Bottom-Up Interprocedural closure of the data structure graph over the -// program. This is useful for applications like pool allocation, but **not** -// applications like alias analysis. -// -//===----------------------------------------------------------------------===// -#define DEBUG_TYPE "bu_dsa" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Module.h" -#include "llvm/DerivedTypes.h" -#include "llvm/ADT/Statistic.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/Debug.h" -#include "llvm/Support/Timer.h" -#include <iostream> -using namespace llvm; - -namespace { - Statistic<> MaxSCC("budatastructure", "Maximum SCC Size in Call Graph"); - Statistic<> NumBUInlines("budatastructures", "Number of graphs inlined"); - Statistic<> NumCallEdges("budatastructures", "Number of 'actual' call edges"); - - cl::opt<bool> - AddGlobals("budatastructures-annotate-calls", - cl::desc("Annotate call sites with functions as they are resolved")); - cl::opt<bool> - UpdateGlobals("budatastructures-update-from-globals", - cl::desc("Update local graph from global graph when processing function")); - - RegisterAnalysis<BUDataStructures> - X("budatastructure", "Bottom-up Data Structure Analysis"); -} - -static bool GetAllCallees(const DSCallSite &CS, - std::vector<Function*> &Callees); - -/// BuildGlobalECs - Look at all of the nodes in the globals graph. If any node -/// contains multiple globals, DSA will never, ever, be able to tell the globals -/// apart. Instead of maintaining this information in all of the graphs -/// throughout the entire program, store only a single global (the "leader") in -/// the graphs, and build equivalence classes for the rest of the globals. -static void BuildGlobalECs(DSGraph &GG, std::set<GlobalValue*> &ECGlobals) { - DSScalarMap &SM = GG.getScalarMap(); - EquivalenceClasses<GlobalValue*> &GlobalECs = SM.getGlobalECs(); - for (DSGraph::node_iterator I = GG.node_begin(), E = GG.node_end(); - I != E; ++I) { - if (I->getGlobalsList().size() <= 1) continue; - - // First, build up the equivalence set for this block of globals. - const std::vector<GlobalValue*> &GVs = I->getGlobalsList(); - GlobalValue *First = GVs[0]; - for (unsigned i = 1, e = GVs.size(); i != e; ++i) - GlobalECs.unionSets(First, GVs[i]); - - // Next, get the leader element. - assert(First == GlobalECs.getLeaderValue(First) && - "First did not end up being the leader?"); - - // Next, remove all globals from the scalar map that are not the leader. - assert(GVs[0] == First && "First had to be at the front!"); - for (unsigned i = 1, e = GVs.size(); i != e; ++i) { - ECGlobals.insert(GVs[i]); - SM.erase(SM.find(GVs[i])); - } - - // Finally, change the global node to only contain the leader. - I->clearGlobals(); - I->addGlobal(First); - } - - DEBUG(GG.AssertGraphOK()); -} - -/// EliminateUsesOfECGlobals - Once we have determined that some globals are in -/// really just equivalent to some other globals, remove the globals from the -/// specified DSGraph (if present), and merge any nodes with their leader nodes. -static void EliminateUsesOfECGlobals(DSGraph &G, - const std::set<GlobalValue*> &ECGlobals) { - DSScalarMap &SM = G.getScalarMap(); - EquivalenceClasses<GlobalValue*> &GlobalECs = SM.getGlobalECs(); - - bool MadeChange = false; - for (DSScalarMap::global_iterator GI = SM.global_begin(), E = SM.global_end(); - GI != E; ) { - GlobalValue *GV = *GI++; - if (!ECGlobals.count(GV)) continue; - - const DSNodeHandle &GVNH = SM[GV]; - assert(!GVNH.isNull() && "Global has null NH!?"); - - // Okay, this global is in some equivalence class. Start by finding the - // leader of the class. - GlobalValue *Leader = GlobalECs.getLeaderValue(GV); - - // If the leader isn't already in the graph, insert it into the node - // corresponding to GV. - if (!SM.global_count(Leader)) { - GVNH.getNode()->addGlobal(Leader); - SM[Leader] = GVNH; - } else { - // Otherwise, the leader is in the graph, make sure the nodes are the - // merged in the specified graph. - const DSNodeHandle &LNH = SM[Leader]; - if (LNH.getNode() != GVNH.getNode()) - LNH.mergeWith(GVNH); - } - - // Next step, remove the global from the DSNode. - GVNH.getNode()->removeGlobal(GV); - - // Finally, remove the global from the ScalarMap. - SM.erase(GV); - MadeChange = true; - } - - DEBUG(if(MadeChange) G.AssertGraphOK()); -} - -static void AddGlobalToNode(BUDataStructures* B, DSCallSite D, Function* F) { - if(!AddGlobals) - return; - if(D.isIndirectCall()) { - DSGraph* GI = &B->getDSGraph(D.getCaller()); - DSNodeHandle& NHF = GI->getNodeForValue(F); - DSCallSite DL = GI->getDSCallSiteForCallSite(D.getCallSite()); - if (DL.getCalleeNode() != NHF.getNode() || NHF.isNull()) { - if (NHF.isNull()) { - DSNode *N = new DSNode(F->getType()->getElementType(), GI); // Create the node - N->addGlobal(F); - NHF.setTo(N,0); - DEBUG(std::cerr << "Adding " << F->getName() << " to a call node in " - << D.getCaller().getName() << "\n"); - } - DL.getCalleeNode()->mergeWith(NHF, 0); - } - } -} - -// run - Calculate the bottom up data structure graphs for each function in the -// program. -// -bool BUDataStructures::runOnModule(Module &M) { - LocalDataStructures &LocalDSA = getAnalysis<LocalDataStructures>(); - GlobalECs = LocalDSA.getGlobalECs(); - - GlobalsGraph = new DSGraph(LocalDSA.getGlobalsGraph(), GlobalECs); - GlobalsGraph->setPrintAuxCalls(); - - IndCallGraphMap = new std::map<std::vector<Function*>, - std::pair<DSGraph*, std::vector<DSNodeHandle> > >(); - - std::vector<Function*> Stack; - hash_map<Function*, unsigned> ValMap; - unsigned NextID = 1; - - Function *MainFunc = M.getMainFunction(); - - if (MainFunc) - calculateGraphs(MainFunc, Stack, NextID, ValMap); - - // Calculate the graphs for any functions that are unreachable from main... - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal() && !DSInfo.count(I)) { -#ifndef NDEBUG - if (MainFunc) - std::cerr << "*** BU: Function unreachable from main: " - << I->getName() << "\n"; -#endif - calculateGraphs(I, Stack, NextID, ValMap); // Calculate all graphs. - } - - // If we computed any temporary indcallgraphs, free them now. - for (std::map<std::vector<Function*>, - std::pair<DSGraph*, std::vector<DSNodeHandle> > >::iterator I = - IndCallGraphMap->begin(), E = IndCallGraphMap->end(); I != E; ++I) { - I->second.second.clear(); // Drop arg refs into the graph. - delete I->second.first; - } - delete IndCallGraphMap; - - // At the end of the bottom-up pass, the globals graph becomes complete. - // FIXME: This is not the right way to do this, but it is sorta better than - // nothing! In particular, externally visible globals and unresolvable call - // nodes at the end of the BU phase should make things that they point to - // incomplete in the globals graph. - // - GlobalsGraph->removeTriviallyDeadNodes(); - GlobalsGraph->maskIncompleteMarkers(); - - // Mark external globals incomplete. - GlobalsGraph->markIncompleteNodes(DSGraph::IgnoreGlobals); - - // Grow the equivalence classes for the globals to include anything that we - // now know to be aliased. - std::set<GlobalValue*> ECGlobals; - BuildGlobalECs(*GlobalsGraph, ECGlobals); - if (!ECGlobals.empty()) { - NamedRegionTimer X("Bottom-UP EC Cleanup"); - std::cerr << "Eliminating " << ECGlobals.size() << " EC Globals!\n"; - for (hash_map<Function*, DSGraph*>::iterator I = DSInfo.begin(), - E = DSInfo.end(); I != E; ++I) - EliminateUsesOfECGlobals(*I->second, ECGlobals); - } - - // Merge the globals variables (not the calls) from the globals graph back - // into the main function's graph so that the main function contains all of - // the information about global pools and GV usage in the program. - if (MainFunc && !MainFunc->isExternal()) { - DSGraph &MainGraph = getOrCreateGraph(MainFunc); - const DSGraph &GG = *MainGraph.getGlobalsGraph(); - ReachabilityCloner RC(MainGraph, GG, DSGraph::DontCloneCallNodes | - DSGraph::DontCloneAuxCallNodes); - - // Clone the global nodes into this graph. - for (DSScalarMap::global_iterator I = GG.getScalarMap().global_begin(), - E = GG.getScalarMap().global_end(); I != E; ++I) - if (isa<GlobalVariable>(*I)) - RC.getClonedNH(GG.getNodeForValue(*I)); - - MainGraph.maskIncompleteMarkers(); - MainGraph.markIncompleteNodes(DSGraph::MarkFormalArgs | - DSGraph::IgnoreGlobals); - - //Debug messages if along the way we didn't resolve a call site - //also update the call graph and callsites we did find. - for(DSGraph::afc_iterator ii = MainGraph.afc_begin(), - ee = MainGraph.afc_end(); ii != ee; ++ii) { - std::vector<Function*> Funcs; - GetAllCallees(*ii, Funcs); - std::cerr << "Lost site\n"; - for (std::vector<Function*>::iterator iif = Funcs.begin(), eef = Funcs.end(); - iif != eef; ++iif) { - AddGlobalToNode(this, *ii, *iif); - std::cerr << "Adding\n"; - ActualCallees.insert(std::make_pair(ii->getCallSite().getInstruction(), *iif)); - } - } - - } - - NumCallEdges += ActualCallees.size(); - - return false; -} - -DSGraph &BUDataStructures::getOrCreateGraph(Function *F) { - // Has the graph already been created? - DSGraph *&Graph = DSInfo[F]; - if (Graph) return *Graph; - - DSGraph &LocGraph = getAnalysis<LocalDataStructures>().getDSGraph(*F); - - // Steal the local graph. - Graph = new DSGraph(GlobalECs, LocGraph.getTargetData()); - Graph->spliceFrom(LocGraph); - - Graph->setGlobalsGraph(GlobalsGraph); - Graph->setPrintAuxCalls(); - - // Start with a copy of the original call sites... - Graph->getAuxFunctionCalls() = Graph->getFunctionCalls(); - return *Graph; -} - -static bool isVAHackFn(const Function *F) { - return F->getName() == "printf" || F->getName() == "sscanf" || - F->getName() == "fprintf" || F->getName() == "open" || - F->getName() == "sprintf" || F->getName() == "fputs" || - F->getName() == "fscanf" || F->getName() == "malloc" || - F->getName() == "free"; -} - -static bool isResolvableFunc(const Function* callee) { - return !callee->isExternal() || isVAHackFn(callee); -} - -//returns true if all callees were resolved -static bool GetAllCallees(const DSCallSite &CS, - std::vector<Function*> &Callees) { - if (CS.isDirectCall()) { - if (isResolvableFunc(CS.getCalleeFunc())) { - Callees.push_back(CS.getCalleeFunc()); - return true; - } else - return false; - } else { - // Get all callees. - bool retval = CS.getCalleeNode()->isComplete(); - unsigned OldSize = Callees.size(); - CS.getCalleeNode()->addFullFunctionList(Callees); - - // If any of the callees are unresolvable, remove that one - for (unsigned i = OldSize; i != Callees.size(); ++i) - if (!isResolvableFunc(Callees[i])) { - Callees.erase(Callees.begin()+i); - --i; - retval = false; - } - return retval; - //return false; - } -} - -/// GetAllAuxCallees - Return a list containing all of the resolvable callees in -/// the aux list for the specified graph in the Callees vector. -static void GetAllAuxCallees(DSGraph &G, std::vector<Function*> &Callees) { - Callees.clear(); - for (DSGraph::afc_iterator I = G.afc_begin(), E = G.afc_end(); I != E; ++I) - GetAllCallees(*I, Callees); -} - -unsigned BUDataStructures::calculateGraphs(Function *F, - std::vector<Function*> &Stack, - unsigned &NextID, - hash_map<Function*, unsigned> &ValMap) { - assert(!ValMap.count(F) && "Shouldn't revisit functions!"); - unsigned Min = NextID++, MyID = Min; - ValMap[F] = Min; - Stack.push_back(F); - - // FIXME! This test should be generalized to be any function that we have - // already processed, in the case when there isn't a main or there are - // unreachable functions! - if (F->isExternal()) { // sprintf, fprintf, sscanf, etc... - // No callees! - Stack.pop_back(); - ValMap[F] = ~0; - return Min; - } - - DSGraph &Graph = getOrCreateGraph(F); - if (UpdateGlobals) - Graph.updateFromGlobalGraph(); - - // Find all callee functions. - std::vector<Function*> CalleeFunctions; - GetAllAuxCallees(Graph, CalleeFunctions); - - // The edges out of the current node are the call site targets... - for (unsigned i = 0, e = CalleeFunctions.size(); i != e; ++i) { - Function *Callee = CalleeFunctions[i]; - unsigned M; - // Have we visited the destination function yet? - hash_map<Function*, unsigned>::iterator It = ValMap.find(Callee); - if (It == ValMap.end()) // No, visit it now. - M = calculateGraphs(Callee, Stack, NextID, ValMap); - else // Yes, get it's number. - M = It->second; - if (M < Min) Min = M; - } - - assert(ValMap[F] == MyID && "SCC construction assumption wrong!"); - if (Min != MyID) - return Min; // This is part of a larger SCC! - - // If this is a new SCC, process it now. - if (Stack.back() == F) { // Special case the single "SCC" case here. - DEBUG(std::cerr << "Visiting single node SCC #: " << MyID << " fn: " - << F->getName() << "\n"); - Stack.pop_back(); - DSGraph &G = getDSGraph(*F); - DEBUG(std::cerr << " [BU] Calculating graph for: " << F->getName()<< "\n"); - bool redo = calculateGraph(G); - DEBUG(std::cerr << " [BU] Done inlining: " << F->getName() << " [" - << G.getGraphSize() << "+" << G.getAuxFunctionCalls().size() - << "]\n"); - - if (MaxSCC < 1) MaxSCC = 1; - - // Should we revisit the graph? Only do it if there are now new resolvable - // callees. - if (redo) { - DEBUG(std::cerr << "Recalculating " << F->getName() << " due to new knowledge\n"); - ValMap.erase(F); - return calculateGraphs(F, Stack, NextID, ValMap); - } else { - ValMap[F] = ~0U; - } - return MyID; - - } else { - // SCCFunctions - Keep track of the functions in the current SCC - // - std::vector<DSGraph*> SCCGraphs; - - unsigned SCCSize = 1; - Function *NF = Stack.back(); - ValMap[NF] = ~0U; - DSGraph &SCCGraph = getDSGraph(*NF); - - // First thing first, collapse all of the DSGraphs into a single graph for - // the entire SCC. Splice all of the graphs into one and discard all of the - // old graphs. - // - while (NF != F) { - Stack.pop_back(); - NF = Stack.back(); - ValMap[NF] = ~0U; - - DSGraph &NFG = getDSGraph(*NF); - - // Update the Function -> DSG map. - for (DSGraph::retnodes_iterator I = NFG.retnodes_begin(), - E = NFG.retnodes_end(); I != E; ++I) - DSInfo[I->first] = &SCCGraph; - - SCCGraph.spliceFrom(NFG); - delete &NFG; - - ++SCCSize; - } - Stack.pop_back(); - - std::cerr << "Calculating graph for SCC #: " << MyID << " of size: " - << SCCSize << "\n"; - - // Compute the Max SCC Size. - if (MaxSCC < SCCSize) - MaxSCC = SCCSize; - - // Clean up the graph before we start inlining a bunch again... - SCCGraph.removeDeadNodes(DSGraph::KeepUnreachableGlobals); - - // Now that we have one big happy family, resolve all of the call sites in - // the graph... - bool redo = calculateGraph(SCCGraph); - DEBUG(std::cerr << " [BU] Done inlining SCC [" << SCCGraph.getGraphSize() - << "+" << SCCGraph.getAuxFunctionCalls().size() << "]\n"); - - if (redo) { - DEBUG(std::cerr << "MISSING REDO\n"); - } - - std::cerr << "DONE with SCC #: " << MyID << "\n"; - - // We never have to revisit "SCC" processed functions... - return MyID; - } - - return MyID; // == Min -} - - -// releaseMemory - If the pass pipeline is done with this pass, we can release -// our memory... here... -// -void BUDataStructures::releaseMyMemory() { - for (hash_map<Function*, DSGraph*>::iterator I = DSInfo.begin(), - E = DSInfo.end(); I != E; ++I) { - I->second->getReturnNodes().erase(I->first); - if (I->second->getReturnNodes().empty()) - delete I->second; - } - - // Empty map so next time memory is released, data structures are not - // re-deleted. - DSInfo.clear(); - delete GlobalsGraph; - GlobalsGraph = 0; -} - -DSGraph &BUDataStructures::CreateGraphForExternalFunction(const Function &Fn) { - Function *F = const_cast<Function*>(&Fn); - DSGraph *DSG = new DSGraph(GlobalECs, GlobalsGraph->getTargetData()); - DSInfo[F] = DSG; - DSG->setGlobalsGraph(GlobalsGraph); - DSG->setPrintAuxCalls(); - - // Add function to the graph. - DSG->getReturnNodes().insert(std::make_pair(F, DSNodeHandle())); - - if (F->getName() == "free") { // Taking the address of free. - - // Free should take a single pointer argument, mark it as heap memory. - DSNode *N = new DSNode(0, DSG); - N->setHeapNodeMarker(); - DSG->getNodeForValue(F->arg_begin()).mergeWith(N); - - } else { - std::cerr << "Unrecognized external function: " << F->getName() << "\n"; - abort(); - } - - return *DSG; -} - - -bool BUDataStructures::calculateGraph(DSGraph &Graph) { - // If this graph contains the main function, clone the globals graph into this - // graph before we inline callees and other fun stuff. - bool ContainsMain = false; - DSGraph::ReturnNodesTy &ReturnNodes = Graph.getReturnNodes(); - - for (DSGraph::ReturnNodesTy::iterator I = ReturnNodes.begin(), - E = ReturnNodes.end(); I != E; ++I) - if (I->first->hasExternalLinkage() && I->first->getName() == "main") { - ContainsMain = true; - break; - } - - // If this graph contains main, copy the contents of the globals graph over. - // Note that this is *required* for correctness. If a callee contains a use - // of a global, we have to make sure to link up nodes due to global-argument - // bindings. - if (ContainsMain) { - const DSGraph &GG = *Graph.getGlobalsGraph(); - ReachabilityCloner RC(Graph, GG, - DSGraph::DontCloneCallNodes | - DSGraph::DontCloneAuxCallNodes); - - // Clone the global nodes into this graph. - for (DSScalarMap::global_iterator I = GG.getScalarMap().global_begin(), - E = GG.getScalarMap().global_end(); I != E; ++I) - if (isa<GlobalVariable>(*I)) - RC.getClonedNH(GG.getNodeForValue(*I)); - } - - - // Move our call site list into TempFCs so that inline call sites go into the - // new call site list and doesn't invalidate our iterators! - std::list<DSCallSite> TempFCs; - std::list<DSCallSite> &AuxCallsList = Graph.getAuxFunctionCalls(); - TempFCs.swap(AuxCallsList); - //remember what we've seen (or will see) - unsigned oldSize = TempFCs.size(); - - bool Printed = false; - bool missingNode = false; - - while (!TempFCs.empty()) { - DSCallSite &CS = *TempFCs.begin(); - Instruction *TheCall = CS.getCallSite().getInstruction(); - DSGraph *GI; - - // Fast path for noop calls. Note that we don't care about merging globals - // in the callee with nodes in the caller here. - if (CS.isDirectCall()) { - if (!isVAHackFn(CS.getCalleeFunc()) && isResolvableFunc(CS.getCalleeFunc())) { - Function* Callee = CS.getCalleeFunc(); - ActualCallees.insert(std::make_pair(TheCall, Callee)); - - assert(doneDSGraph(Callee) && "Direct calls should always be precomputed"); - GI = &getDSGraph(*Callee); // Graph to inline - DEBUG(std::cerr << " Inlining graph for " << Callee->getName()); - DEBUG(std::cerr << "[" << GI->getGraphSize() << "+" - << GI->getAuxFunctionCalls().size() << "] into '" - << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" - << Graph.getAuxFunctionCalls().size() << "]\n"); - Graph.mergeInGraph(CS, *Callee, *GI, - DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes); - ++NumBUInlines; - } else { - DEBUG(std::cerr << "Graph " << Graph.getFunctionNames() << " Call Site " << - CS.getCallSite().getInstruction() << " never resolvable\n"); - } - --oldSize; - TempFCs.pop_front(); - continue; - } else { - std::vector<Function*> CalledFuncs; - bool resolved = GetAllCallees(CS, CalledFuncs); - - if (CalledFuncs.empty()) { - DEBUG(std::cerr << "Graph " << Graph.getFunctionNames() << " Call Site " << - CS.getCallSite().getInstruction() << " delayed\n"); - } else { - DEBUG( - if (!Printed) - std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n"; - std::cerr << " calls " << CalledFuncs.size() - << " fns from site: " << CS.getCallSite().getInstruction() - << " " << *CS.getCallSite().getInstruction(); - std::cerr << " Fns ="; - ); - unsigned NumPrinted = 0; - - for (std::vector<Function*>::iterator I = CalledFuncs.begin(), - E = CalledFuncs.end(); I != E; ++I) { - DEBUG(if (NumPrinted++ < 8) std::cerr << " " << (*I)->getName();); - - // Add the call edges to the call graph. - ActualCallees.insert(std::make_pair(TheCall, *I)); - } - DEBUG(std::cerr << "\n"); - - // See if we already computed a graph for this set of callees. - std::sort(CalledFuncs.begin(), CalledFuncs.end()); - std::pair<DSGraph*, std::vector<DSNodeHandle> > &IndCallGraph = - (*IndCallGraphMap)[CalledFuncs]; - - if (IndCallGraph.first == 0) { - std::vector<Function*>::iterator I = CalledFuncs.begin(), - E = CalledFuncs.end(); - - // Start with a copy of the first graph. - if (!doneDSGraph(*I)) { - AuxCallsList.splice(AuxCallsList.end(), TempFCs, TempFCs.begin()); - missingNode = true; - continue; - } - - AddGlobalToNode(this, CS, *I); - - GI = IndCallGraph.first = new DSGraph(getDSGraph(**I), GlobalECs); - GI->setGlobalsGraph(Graph.getGlobalsGraph()); - std::vector<DSNodeHandle> &Args = IndCallGraph.second; - - // Get the argument nodes for the first callee. The return value is - // the 0th index in the vector. - GI->getFunctionArgumentsForCall(*I, Args); - - // Merge all of the other callees into this graph. - bool locMissing = false; - for (++I; I != E && !locMissing; ++I) { - AddGlobalToNode(this, CS, *I); - // If the graph already contains the nodes for the function, don't - // bother merging it in again. - if (!GI->containsFunction(*I)) { - if (!doneDSGraph(*I)) { - locMissing = true; - break; - } - - GI->cloneInto(getDSGraph(**I)); - ++NumBUInlines; - } - - std::vector<DSNodeHandle> NextArgs; - GI->getFunctionArgumentsForCall(*I, NextArgs); - unsigned i = 0, e = Args.size(); - for (; i != e; ++i) { - if (i == NextArgs.size()) break; - Args[i].mergeWith(NextArgs[i]); - } - for (e = NextArgs.size(); i != e; ++i) - Args.push_back(NextArgs[i]); - } - if (locMissing) { - AuxCallsList.splice(AuxCallsList.end(), TempFCs, TempFCs.begin()); - missingNode = true; - continue; - } - - // Clean up the final graph! - GI->removeDeadNodes(DSGraph::KeepUnreachableGlobals); - } else { - DEBUG(std::cerr << "***\n*** RECYCLED GRAPH ***\n***\n"); - for (std::vector<Function*>::iterator I = CalledFuncs.begin(), E = CalledFuncs.end(); I != E; ++I) { - AddGlobalToNode(this, CS, *I); - } - } - - GI = IndCallGraph.first; - - if (AlreadyInlined[CS.getCallSite()] != CalledFuncs) { - AlreadyInlined[CS.getCallSite()].swap(CalledFuncs); - - // Merge the unified graph into this graph now. - DEBUG(std::cerr << " Inlining multi callee graph " - << "[" << GI->getGraphSize() << "+" - << GI->getAuxFunctionCalls().size() << "] into '" - << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" - << Graph.getAuxFunctionCalls().size() << "]\n"); - - Graph.mergeInGraph(CS, IndCallGraph.second, *GI, - DSGraph::StripAllocaBit | - DSGraph::DontCloneCallNodes); - - ++NumBUInlines; - } else { - DEBUG(std::cerr << " Skipping already inlined graph\n"); - } - } - AuxCallsList.splice(AuxCallsList.end(), TempFCs, TempFCs.begin()); - } - } - - // Recompute the Incomplete markers - Graph.maskIncompleteMarkers(); - Graph.markIncompleteNodes(DSGraph::MarkFormalArgs); - - // Delete dead nodes. Treat globals that are unreachable but that can - // reach live nodes as live. - Graph.removeDeadNodes(DSGraph::KeepUnreachableGlobals); - - // When this graph is finalized, clone the globals in the graph into the - // globals graph to make sure it has everything, from all graphs. - DSScalarMap &MainSM = Graph.getScalarMap(); - ReachabilityCloner RC(*GlobalsGraph, Graph, DSGraph::StripAllocaBit); - - // Clone everything reachable from globals in the function graph into the - // globals graph. - for (DSScalarMap::global_iterator I = MainSM.global_begin(), - E = MainSM.global_end(); I != E; ++I) - RC.getClonedNH(MainSM[*I]); - - //Graph.writeGraphToFile(std::cerr, "bu_" + F.getName()); - AuxCallsList.sort(); - AuxCallsList.unique(); - //conditionally prune the call list keeping only one copy of each actual - //CallSite - if (AuxCallsList.size() > 100) { - DEBUG(std::cerr << "Reducing Aux from " << AuxCallsList.size()); - std::map<CallSite, std::list<DSCallSite>::iterator> keepers; - TempFCs.swap(AuxCallsList); - for( std::list<DSCallSite>::iterator ii = TempFCs.begin(), ee = TempFCs.end(); - ii != ee; ++ii) - keepers[ii->getCallSite()] = ii; - for (std::map<CallSite, std::list<DSCallSite>::iterator>::iterator - ii = keepers.begin(), ee = keepers.end(); - ii != ee; ++ii) - AuxCallsList.splice(AuxCallsList.end(), TempFCs, ii->second); - DEBUG(std::cerr << " to " << AuxCallsList.size() << "\n"); - } - return missingNode || oldSize != AuxCallsList.size(); -} - -static const Function *getFnForValue(const Value *V) { - if (const Instruction *I = dyn_cast<Instruction>(V)) - return I->getParent()->getParent(); - else if (const Argument *A = dyn_cast<Argument>(V)) - return A->getParent(); - else if (const BasicBlock *BB = dyn_cast<BasicBlock>(V)) - return BB->getParent(); - return 0; -} - -/// deleteValue/copyValue - Interfaces to update the DSGraphs in the program. -/// These correspond to the interfaces defined in the AliasAnalysis class. -void BUDataStructures::deleteValue(Value *V) { - if (const Function *F = getFnForValue(V)) { // Function local value? - // If this is a function local value, just delete it from the scalar map! - getDSGraph(*F).getScalarMap().eraseIfExists(V); - return; - } - - if (Function *F = dyn_cast<Function>(V)) { - assert(getDSGraph(*F).getReturnNodes().size() == 1 && - "cannot handle scc's"); - delete DSInfo[F]; - DSInfo.erase(F); - return; - } - - assert(!isa<GlobalVariable>(V) && "Do not know how to delete GV's yet!"); -} - -void BUDataStructures::copyValue(Value *From, Value *To) { - if (From == To) return; - if (const Function *F = getFnForValue(From)) { // Function local value? - // If this is a function local value, just delete it from the scalar map! - getDSGraph(*F).getScalarMap().copyScalarIfExists(From, To); - return; - } - - if (Function *FromF = dyn_cast<Function>(From)) { - Function *ToF = cast<Function>(To); - assert(!DSInfo.count(ToF) && "New Function already exists!"); - DSGraph *NG = new DSGraph(getDSGraph(*FromF), GlobalECs); - DSInfo[ToF] = NG; - assert(NG->getReturnNodes().size() == 1 && "Cannot copy SCC's yet!"); - - // Change the Function* is the returnnodes map to the ToF. - DSNodeHandle Ret = NG->retnodes_begin()->second; - NG->getReturnNodes().clear(); - NG->getReturnNodes()[ToF] = Ret; - return; - } - - if (const Function *F = getFnForValue(To)) { - DSGraph &G = getDSGraph(*F); - G.getScalarMap().copyScalarIfExists(From, To); - return; - } - - std::cerr << *From; - std::cerr << *To; - assert(0 && "Do not know how to copy this yet!"); - abort(); -}
diff --git a/poolalloc/lib/DSA/CallTargets.cpp b/poolalloc/lib/DSA/CallTargets.cpp deleted file mode 100644 index 30d7d48..0000000 --- a/poolalloc/lib/DSA/CallTargets.cpp +++ /dev/null
@@ -1,125 +0,0 @@ -//=- lib/Analysis/IPA/CallTargets.cpp - Resolve Call Targets --*- C++ -*-=====// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This pass uses DSA to map targets of all calls, and reports on if it -// thinks it knows all targets of a given call. -// -// Loop over all callsites, and lookup the DSNode for that site. Pull the -// Functions from the node as callees. -// This is essentially a utility pass to simplify later passes that only depend -// on call sites and callees to operate (such as a devirtualizer). -// -//===----------------------------------------------------------------------===// - -#include "llvm/Module.h" -#include "llvm/Instructions.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Analysis/DataStructure/CallTargets.h" -#include "llvm/ADT/Statistic.h" -#include <iostream> -#include "llvm/Constants.h" - -using namespace llvm; - -namespace { - Statistic<> DirCall("calltarget", "Number of direct calls"); - Statistic<> IndCall("calltarget", "Number of indirect calls"); - Statistic<> CompleteInd("calltarget", "Number of complete indirect calls"); - Statistic<> CompleteEmpty("calltarget", "Number of complete empty calls"); - - RegisterAnalysis<CallTargetFinder> X("calltarget", "Find Call Targets (uses DSA)"); -} - -void CallTargetFinder::findIndTargets(Module &M) -{ - TDDataStructures* T = &getAnalysis<TDDataStructures>(); - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal()) - for (Function::iterator F = I->begin(), FE = I->end(); F != FE; ++F) - for (BasicBlock::iterator B = F->begin(), BE = F->end(); B != BE; ++B) - if (isa<CallInst>(B) || isa<InvokeInst>(B)) { - CallSite cs = CallSite::get(B); - AllSites.push_back(cs); - if (!cs.getCalledFunction()) { - IndCall++; - DSNode* N = T->getDSGraph(*cs.getCaller()) - .getNodeForValue(cs.getCalledValue()).getNode(); - N->addFullFunctionList(IndMap[cs]); - if (N->isComplete() && IndMap[cs].size()) { - CompleteSites.insert(cs); - ++CompleteInd; - } - if (N->isComplete() && !IndMap[cs].size()) { - ++CompleteEmpty; - std::cerr << "Call site empty: '" << cs.getInstruction()->getName() - << "' In '" << cs.getInstruction()->getParent()->getParent()->getName() - << "'\n"; - } - } else { - ++DirCall; - IndMap[cs].push_back(cs.getCalledFunction()); - CompleteSites.insert(cs); - } - } -} - -void CallTargetFinder::print(std::ostream &O, const Module *M) const -{ - return; - O << "[* = incomplete] CS: func list\n"; - for (std::map<CallSite, std::vector<Function*> >::const_iterator ii = IndMap.begin(), - ee = IndMap.end(); ii != ee; ++ii) { - if (!ii->first.getCalledFunction()) { //only print indirect - if (!isComplete(ii->first)) { - O << "* "; - CallSite cs = ii->first; - cs.getInstruction()->dump(); - O << cs.getInstruction()->getParent()->getParent()->getName() << " " - << cs.getInstruction()->getName() << " "; - } - O << ii->first.getInstruction() << ":"; - for (std::vector<Function*>::const_iterator i = ii->second.begin(), - e = ii->second.end(); i != e; ++i) { - O << " " << (*i)->getName(); - } - O << "\n"; - } - } -} - -bool CallTargetFinder::runOnModule(Module &M) { - findIndTargets(M); - return false; -} - -void CallTargetFinder::getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesAll(); - AU.addRequired<TDDataStructures>(); -} - -std::vector<Function*>::iterator CallTargetFinder::begin(CallSite cs) { - return IndMap[cs].begin(); -} - -std::vector<Function*>::iterator CallTargetFinder::end(CallSite cs) { - return IndMap[cs].end(); -} - -bool CallTargetFinder::isComplete(CallSite cs) const { - return CompleteSites.find(cs) != CompleteSites.end(); -} - -std::list<CallSite>::iterator CallTargetFinder::cs_begin() { - return AllSites.begin(); -} - -std::list<CallSite>::iterator CallTargetFinder::cs_end() { - return AllSites.end(); -}
diff --git a/poolalloc/lib/DSA/CompleteBottomUp.cpp b/poolalloc/lib/DSA/CompleteBottomUp.cpp deleted file mode 100644 index 452f033..0000000 --- a/poolalloc/lib/DSA/CompleteBottomUp.cpp +++ /dev/null
@@ -1,241 +0,0 @@ -//===- CompleteBottomUp.cpp - Complete Bottom-Up Data Structure Graphs ----===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This is the exact same as the bottom-up graphs, but we use take a completed -// call graph and inline all indirect callees into their callers graphs, making -// the result more useful for things like pool allocation. -// -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "cbudatastructure" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Module.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Support/Debug.h" -#include "llvm/ADT/SCCIterator.h" -#include "llvm/ADT/Statistic.h" -#include "llvm/ADT/STLExtras.h" -#include <iostream> -using namespace llvm; - -namespace { - RegisterAnalysis<CompleteBUDataStructures> - X("cbudatastructure", "'Complete' Bottom-up Data Structure Analysis"); - Statistic<> NumCBUInlines("cbudatastructures", "Number of graphs inlined"); -} - - -// run - Calculate the bottom up data structure graphs for each function in the -// program. -// -bool CompleteBUDataStructures::runOnModule(Module &M) { - BUDataStructures &BU = getAnalysis<BUDataStructures>(); - GlobalECs = BU.getGlobalECs(); - GlobalsGraph = new DSGraph(BU.getGlobalsGraph(), GlobalECs); - GlobalsGraph->setPrintAuxCalls(); - - // Our call graph is the same as the BU data structures call graph - ActualCallees = BU.getActualCallees(); - - std::vector<DSGraph*> Stack; - hash_map<DSGraph*, unsigned> ValMap; - unsigned NextID = 1; - - Function *MainFunc = M.getMainFunction(); - if (MainFunc) { - if (!MainFunc->isExternal()) - calculateSCCGraphs(getOrCreateGraph(*MainFunc), Stack, NextID, ValMap); - } else { - std::cerr << "CBU-DSA: No 'main' function found!\n"; - } - - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal() && !DSInfo.count(I)) { -#ifndef NDEBUG - if (MainFunc) - std::cerr << "*** CBU: Function unreachable from main: " - << I->getName() << "\n"; -#endif - calculateSCCGraphs(getOrCreateGraph(*I), Stack, NextID, ValMap); - } - - GlobalsGraph->removeTriviallyDeadNodes(); - - - // Merge the globals variables (not the calls) from the globals graph back - // into the main function's graph so that the main function contains all of - // the information about global pools and GV usage in the program. - if (MainFunc && !MainFunc->isExternal()) { - DSGraph &MainGraph = getOrCreateGraph(*MainFunc); - const DSGraph &GG = *MainGraph.getGlobalsGraph(); - ReachabilityCloner RC(MainGraph, GG, - DSGraph::DontCloneCallNodes | - DSGraph::DontCloneAuxCallNodes); - - // Clone the global nodes into this graph. - for (DSScalarMap::global_iterator I = GG.getScalarMap().global_begin(), - E = GG.getScalarMap().global_end(); I != E; ++I) - if (isa<GlobalVariable>(*I)) - RC.getClonedNH(GG.getNodeForValue(*I)); - - MainGraph.maskIncompleteMarkers(); - MainGraph.markIncompleteNodes(DSGraph::MarkFormalArgs | - DSGraph::IgnoreGlobals); - } - - return false; -} - -DSGraph &CompleteBUDataStructures::getOrCreateGraph(Function &F) { - // Has the graph already been created? - DSGraph *&Graph = DSInfo[&F]; - if (Graph) return *Graph; - - // Copy the BU graph... - Graph = new DSGraph(getAnalysis<BUDataStructures>().getDSGraph(F), GlobalECs); - Graph->setGlobalsGraph(GlobalsGraph); - Graph->setPrintAuxCalls(); - - // Make sure to update the DSInfo map for all of the functions currently in - // this graph! - for (DSGraph::retnodes_iterator I = Graph->retnodes_begin(); - I != Graph->retnodes_end(); ++I) - DSInfo[I->first] = Graph; - - return *Graph; -} - - - -unsigned CompleteBUDataStructures::calculateSCCGraphs(DSGraph &FG, - std::vector<DSGraph*> &Stack, - unsigned &NextID, - hash_map<DSGraph*, unsigned> &ValMap) { - assert(!ValMap.count(&FG) && "Shouldn't revisit functions!"); - unsigned Min = NextID++, MyID = Min; - ValMap[&FG] = Min; - Stack.push_back(&FG); - - // The edges out of the current node are the call site targets... - for (DSGraph::fc_iterator CI = FG.fc_begin(), CE = FG.fc_end(); - CI != CE; ++CI) { - Instruction *Call = CI->getCallSite().getInstruction(); - - // Loop over all of the actually called functions... - callee_iterator I = callee_begin(Call), E = callee_end(Call); - for (; I != E && I->first == Call; ++I) { - assert(I->first == Call && "Bad callee construction!"); - if (!I->second->isExternal()) { - DSGraph &Callee = getOrCreateGraph(*I->second); - unsigned M; - // Have we visited the destination function yet? - hash_map<DSGraph*, unsigned>::iterator It = ValMap.find(&Callee); - if (It == ValMap.end()) // No, visit it now. - M = calculateSCCGraphs(Callee, Stack, NextID, ValMap); - else // Yes, get it's number. - M = It->second; - if (M < Min) Min = M; - } - } - } - - assert(ValMap[&FG] == MyID && "SCC construction assumption wrong!"); - if (Min != MyID) - return Min; // This is part of a larger SCC! - - // If this is a new SCC, process it now. - bool IsMultiNodeSCC = false; - while (Stack.back() != &FG) { - DSGraph *NG = Stack.back(); - ValMap[NG] = ~0U; - - FG.cloneInto(*NG); - - // Update the DSInfo map and delete the old graph... - for (DSGraph::retnodes_iterator I = NG->retnodes_begin(); - I != NG->retnodes_end(); ++I) - DSInfo[I->first] = &FG; - - // Remove NG from the ValMap since the pointer may get recycled. - ValMap.erase(NG); - delete NG; - - Stack.pop_back(); - IsMultiNodeSCC = true; - } - - // Clean up the graph before we start inlining a bunch again... - if (IsMultiNodeSCC) - FG.removeTriviallyDeadNodes(); - - Stack.pop_back(); - processGraph(FG); - ValMap[&FG] = ~0U; - return MyID; -} - - -/// processGraph - Process the BU graphs for the program in bottom-up order on -/// the SCC of the __ACTUAL__ call graph. This builds "complete" BU graphs. -void CompleteBUDataStructures::processGraph(DSGraph &G) { - hash_set<Instruction*> calls; - - // The edges out of the current node are the call site targets... - unsigned i = 0; - for (DSGraph::fc_iterator CI = G.fc_begin(), CE = G.fc_end(); CI != CE; - ++CI, ++i) { - const DSCallSite &CS = *CI; - Instruction *TheCall = CS.getCallSite().getInstruction(); - - assert(calls.insert(TheCall).second && - "Call instruction occurs multiple times in graph??"); - - // Fast path for noop calls. Note that we don't care about merging globals - // in the callee with nodes in the caller here. - if (CS.getRetVal().isNull() && CS.getNumPtrArgs() == 0) - continue; - - // Loop over all of the potentially called functions... - // Inline direct calls as well as indirect calls because the direct - // callee may have indirect callees and so may have changed. - // - callee_iterator I = callee_begin(TheCall),E = callee_end(TheCall); - unsigned TNum = 0, Num = 0; - DEBUG(Num = std::distance(I, E)); - for (; I != E; ++I, ++TNum) { - assert(I->first == TheCall && "Bad callee construction!"); - Function *CalleeFunc = I->second; - if (!CalleeFunc->isExternal()) { - // Merge the callee's graph into this graph. This works for normal - // calls or for self recursion within an SCC. - DSGraph &GI = getOrCreateGraph(*CalleeFunc); - ++NumCBUInlines; - G.mergeInGraph(CS, *CalleeFunc, GI, - DSGraph::StripAllocaBit | DSGraph::DontCloneCallNodes | - DSGraph::DontCloneAuxCallNodes); - DEBUG(std::cerr << " Inlining graph [" << i << "/" - << G.getFunctionCalls().size()-1 - << ":" << TNum << "/" << Num-1 << "] for " - << CalleeFunc->getName() << "[" - << GI.getGraphSize() << "+" << GI.getAuxFunctionCalls().size() - << "] into '" /*<< G.getFunctionNames()*/ << "' [" - << G.getGraphSize() << "+" << G.getAuxFunctionCalls().size() - << "]\n"); - } - } - } - - // Recompute the Incomplete markers - G.maskIncompleteMarkers(); - G.markIncompleteNodes(DSGraph::MarkFormalArgs); - - // Delete dead nodes. Treat globals that are unreachable but that can - // reach live nodes as live. - G.removeDeadNodes(DSGraph::KeepUnreachableGlobals); -}
diff --git a/poolalloc/lib/DSA/DataStructure.cpp b/poolalloc/lib/DSA/DataStructure.cpp deleted file mode 100644 index 8acbe8e..0000000 --- a/poolalloc/lib/DSA/DataStructure.cpp +++ /dev/null
@@ -1,2425 +0,0 @@ -//===- DataStructure.cpp - Implement the core data structure analysis -----===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the core data structure functionality. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Analysis/DataStructure/DSGraphTraits.h" -#include "llvm/Constants.h" -#include "llvm/Function.h" -#include "llvm/GlobalVariable.h" -#include "llvm/Instructions.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Target/TargetData.h" -#include "llvm/Assembly/Writer.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/Debug.h" -#include "llvm/ADT/DepthFirstIterator.h" -#include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/SCCIterator.h" -#include "llvm/ADT/Statistic.h" -#include "llvm/Support/Timer.h" -#include <iostream> -#include <algorithm> -using namespace llvm; - -#define COLLAPSE_ARRAYS_AGGRESSIVELY 0 - -namespace { - Statistic<> NumFolds ("dsa", "Number of nodes completely folded"); - Statistic<> NumCallNodesMerged("dsa", "Number of call nodes merged"); - Statistic<> NumNodeAllocated ("dsa", "Number of nodes allocated"); - Statistic<> NumDNE ("dsa", "Number of nodes removed by reachability"); - Statistic<> NumTrivialDNE ("dsa", "Number of nodes trivially removed"); - Statistic<> NumTrivialGlobalDNE("dsa", "Number of globals trivially removed"); - static cl::opt<unsigned> - DSAFieldLimit("dsa-field-limit", cl::Hidden, - cl::desc("Number of fields to track before collapsing a node"), - cl::init(256)); -} - -#if 0 -#define TIME_REGION(VARNAME, DESC) \ - NamedRegionTimer VARNAME(DESC) -#else -#define TIME_REGION(VARNAME, DESC) -#endif - -using namespace DS; - -/// isForwarding - Return true if this NodeHandle is forwarding to another -/// one. -bool DSNodeHandle::isForwarding() const { - return N && N->isForwarding(); -} - -DSNode *DSNodeHandle::HandleForwarding() const { - assert(N->isForwarding() && "Can only be invoked if forwarding!"); - - // Handle node forwarding here! - DSNode *Next = N->ForwardNH.getNode(); // Cause recursive shrinkage - Offset += N->ForwardNH.getOffset(); - - if (--N->NumReferrers == 0) { - // Removing the last referrer to the node, sever the forwarding link - N->stopForwarding(); - } - - N = Next; - N->NumReferrers++; - if (N->Size <= Offset) { - assert(N->Size <= 1 && "Forwarded to shrunk but not collapsed node?"); - Offset = 0; - } - return N; -} - -//===----------------------------------------------------------------------===// -// DSScalarMap Implementation -//===----------------------------------------------------------------------===// - -DSNodeHandle &DSScalarMap::AddGlobal(GlobalValue *GV) { - assert(ValueMap.count(GV) == 0 && "GV already exists!"); - - // If the node doesn't exist, check to see if it's a global that is - // equated to another global in the program. - EquivalenceClasses<GlobalValue*>::iterator ECI = GlobalECs.findValue(GV); - if (ECI != GlobalECs.end()) { - GlobalValue *Leader = *GlobalECs.findLeader(ECI); - if (Leader != GV) { - GV = Leader; - iterator I = ValueMap.find(GV); - if (I != ValueMap.end()) - return I->second; - } - } - - // Okay, this is either not an equivalenced global or it is the leader, it - // will be inserted into the scalar map now. - GlobalSet.insert(GV); - - return ValueMap.insert(std::make_pair(GV, DSNodeHandle())).first->second; -} - - -//===----------------------------------------------------------------------===// -// DSNode Implementation -//===----------------------------------------------------------------------===// - -DSNode::DSNode(const Type *T, DSGraph *G) - : NumReferrers(0), Size(0), ParentGraph(G), Ty(Type::VoidTy), NodeType(0) { - // Add the type entry if it is specified... - if (T) mergeTypeInfo(T, 0); - if (G) G->addNode(this); - ++NumNodeAllocated; -} - -// DSNode copy constructor... do not copy over the referrers list! -DSNode::DSNode(const DSNode &N, DSGraph *G, bool NullLinks) - : NumReferrers(0), Size(N.Size), ParentGraph(G), - Ty(N.Ty), Globals(N.Globals), NodeType(N.NodeType) { - if (!NullLinks) { - Links = N.Links; - } else - Links.resize(N.Links.size()); // Create the appropriate number of null links - G->addNode(this); - ++NumNodeAllocated; -} - -/// getTargetData - Get the target data object used to construct this node. -/// -const TargetData &DSNode::getTargetData() const { - return ParentGraph->getTargetData(); -} - -void DSNode::assertOK() const { - assert((Ty != Type::VoidTy || - Ty == Type::VoidTy && (Size == 0 || - (NodeType & DSNode::Array))) && - "Node not OK!"); - - assert(ParentGraph && "Node has no parent?"); - const DSScalarMap &SM = ParentGraph->getScalarMap(); - for (unsigned i = 0, e = Globals.size(); i != e; ++i) { - assert(SM.global_count(Globals[i])); - assert(SM.find(Globals[i])->second.getNode() == this); - } -} - -/// forwardNode - Mark this node as being obsolete, and all references to it -/// should be forwarded to the specified node and offset. -/// -void DSNode::forwardNode(DSNode *To, unsigned Offset) { - assert(this != To && "Cannot forward a node to itself!"); - assert(ForwardNH.isNull() && "Already forwarding from this node!"); - if (To->Size <= 1) Offset = 0; - assert((Offset < To->Size || (Offset == To->Size && Offset == 0)) && - "Forwarded offset is wrong!"); - ForwardNH.setTo(To, Offset); - NodeType = DEAD; - Size = 0; - Ty = Type::VoidTy; - - // Remove this node from the parent graph's Nodes list. - ParentGraph->unlinkNode(this); - ParentGraph = 0; -} - -// addGlobal - Add an entry for a global value to the Globals list. This also -// marks the node with the 'G' flag if it does not already have it. -// -void DSNode::addGlobal(GlobalValue *GV) { - // First, check to make sure this is the leader if the global is in an - // equivalence class. - GV = getParentGraph()->getScalarMap().getLeaderForGlobal(GV); - - // Keep the list sorted. - std::vector<GlobalValue*>::iterator I = - std::lower_bound(Globals.begin(), Globals.end(), GV); - - if (I == Globals.end() || *I != GV) { - Globals.insert(I, GV); - NodeType |= GlobalNode; - } -} - -// removeGlobal - Remove the specified global that is explicitly in the globals -// list. -void DSNode::removeGlobal(GlobalValue *GV) { - std::vector<GlobalValue*>::iterator I = - std::lower_bound(Globals.begin(), Globals.end(), GV); - assert(I != Globals.end() && *I == GV && "Global not in node!"); - Globals.erase(I); -} - -/// foldNodeCompletely - If we determine that this node has some funny -/// behavior happening to it that we cannot represent, we fold it down to a -/// single, completely pessimistic, node. This node is represented as a -/// single byte with a single TypeEntry of "void". -/// -void DSNode::foldNodeCompletely() { - if (isNodeCompletelyFolded()) return; // If this node is already folded... - - ++NumFolds; - - // If this node has a size that is <= 1, we don't need to create a forwarding - // node. - if (getSize() <= 1) { - NodeType |= DSNode::Array; - Ty = Type::VoidTy; - Size = 1; - assert(Links.size() <= 1 && "Size is 1, but has more links?"); - Links.resize(1); - } else { - // Create the node we are going to forward to. This is required because - // some referrers may have an offset that is > 0. By forcing them to - // forward, the forwarder has the opportunity to correct the offset. - DSNode *DestNode = new DSNode(0, ParentGraph); - DestNode->NodeType = NodeType|DSNode::Array; - DestNode->Ty = Type::VoidTy; - DestNode->Size = 1; - DestNode->Globals.swap(Globals); - - // Start forwarding to the destination node... - forwardNode(DestNode, 0); - - if (!Links.empty()) { - DestNode->Links.reserve(1); - - DSNodeHandle NH(DestNode); - DestNode->Links.push_back(Links[0]); - - // If we have links, merge all of our outgoing links together... - for (unsigned i = Links.size()-1; i != 0; --i) - NH.getNode()->Links[0].mergeWith(Links[i]); - Links.clear(); - } else { - DestNode->Links.resize(1); - } - } -} - -/// isNodeCompletelyFolded - Return true if this node has been completely -/// folded down to something that can never be expanded, effectively losing -/// all of the field sensitivity that may be present in the node. -/// -bool DSNode::isNodeCompletelyFolded() const { - return getSize() == 1 && Ty == Type::VoidTy && isArray(); -} - -/// addFullGlobalsList - Compute the full set of global values that are -/// represented by this node. Unlike getGlobalsList(), this requires fair -/// amount of work to compute, so don't treat this method call as free. -void DSNode::addFullGlobalsList(std::vector<GlobalValue*> &List) const { - if (globals_begin() == globals_end()) return; - - EquivalenceClasses<GlobalValue*> &EC = getParentGraph()->getGlobalECs(); - - for (globals_iterator I = globals_begin(), E = globals_end(); I != E; ++I) { - EquivalenceClasses<GlobalValue*>::iterator ECI = EC.findValue(*I); - if (ECI == EC.end()) - List.push_back(*I); - else - List.insert(List.end(), EC.member_begin(ECI), EC.member_end()); - } -} - -/// addFullFunctionList - Identical to addFullGlobalsList, but only return the -/// functions in the full list. -void DSNode::addFullFunctionList(std::vector<Function*> &List) const { - if (globals_begin() == globals_end()) return; - - EquivalenceClasses<GlobalValue*> &EC = getParentGraph()->getGlobalECs(); - - for (globals_iterator I = globals_begin(), E = globals_end(); I != E; ++I) { - EquivalenceClasses<GlobalValue*>::iterator ECI = EC.findValue(*I); - if (ECI == EC.end()) { - if (Function *F = dyn_cast<Function>(*I)) - List.push_back(F); - } else { - for (EquivalenceClasses<GlobalValue*>::member_iterator MI = - EC.member_begin(ECI), E = EC.member_end(); MI != E; ++MI) - if (Function *F = dyn_cast<Function>(*MI)) - List.push_back(F); - } - } -} - -namespace { - /// TypeElementWalker Class - Used for implementation of physical subtyping... - /// - class TypeElementWalker { - struct StackState { - const Type *Ty; - unsigned Offset; - unsigned Idx; - StackState(const Type *T, unsigned Off = 0) - : Ty(T), Offset(Off), Idx(0) {} - }; - - std::vector<StackState> Stack; - const TargetData &TD; - public: - TypeElementWalker(const Type *T, const TargetData &td) : TD(td) { - Stack.push_back(T); - StepToLeaf(); - } - - bool isDone() const { return Stack.empty(); } - const Type *getCurrentType() const { return Stack.back().Ty; } - unsigned getCurrentOffset() const { return Stack.back().Offset; } - - void StepToNextType() { - PopStackAndAdvance(); - StepToLeaf(); - } - - private: - /// PopStackAndAdvance - Pop the current element off of the stack and - /// advance the underlying element to the next contained member. - void PopStackAndAdvance() { - assert(!Stack.empty() && "Cannot pop an empty stack!"); - Stack.pop_back(); - while (!Stack.empty()) { - StackState &SS = Stack.back(); - if (const StructType *ST = dyn_cast<StructType>(SS.Ty)) { - ++SS.Idx; - if (SS.Idx != ST->getNumElements()) { - const StructLayout *SL = TD.getStructLayout(ST); - SS.Offset += - unsigned(SL->MemberOffsets[SS.Idx]-SL->MemberOffsets[SS.Idx-1]); - return; - } - Stack.pop_back(); // At the end of the structure - } else { - const ArrayType *AT = cast<ArrayType>(SS.Ty); - ++SS.Idx; - if (SS.Idx != AT->getNumElements()) { - SS.Offset += unsigned(TD.getTypeSize(AT->getElementType())); - return; - } - Stack.pop_back(); // At the end of the array - } - } - } - - /// StepToLeaf - Used by physical subtyping to move to the first leaf node - /// on the type stack. - void StepToLeaf() { - if (Stack.empty()) return; - while (!Stack.empty() && !Stack.back().Ty->isFirstClassType()) { - StackState &SS = Stack.back(); - if (const StructType *ST = dyn_cast<StructType>(SS.Ty)) { - if (ST->getNumElements() == 0) { - assert(SS.Idx == 0); - PopStackAndAdvance(); - } else { - // Step into the structure... - assert(SS.Idx < ST->getNumElements()); - const StructLayout *SL = TD.getStructLayout(ST); - Stack.push_back(StackState(ST->getElementType(SS.Idx), - SS.Offset+unsigned(SL->MemberOffsets[SS.Idx]))); - } - } else { - const ArrayType *AT = cast<ArrayType>(SS.Ty); - if (AT->getNumElements() == 0) { - assert(SS.Idx == 0); - PopStackAndAdvance(); - } else { - // Step into the array... - assert(SS.Idx < AT->getNumElements()); - Stack.push_back(StackState(AT->getElementType(), - SS.Offset+SS.Idx* - unsigned(TD.getTypeSize(AT->getElementType())))); - } - } - } - } - }; -} // end anonymous namespace - -/// ElementTypesAreCompatible - Check to see if the specified types are -/// "physically" compatible. If so, return true, else return false. We only -/// have to check the fields in T1: T2 may be larger than T1. If AllowLargerT1 -/// is true, then we also allow a larger T1. -/// -static bool ElementTypesAreCompatible(const Type *T1, const Type *T2, - bool AllowLargerT1, const TargetData &TD){ - TypeElementWalker T1W(T1, TD), T2W(T2, TD); - - while (!T1W.isDone() && !T2W.isDone()) { - if (T1W.getCurrentOffset() != T2W.getCurrentOffset()) - return false; - - const Type *T1 = T1W.getCurrentType(); - const Type *T2 = T2W.getCurrentType(); - if (T1 != T2 && !T1->isLosslesslyConvertibleTo(T2)) - return false; - - T1W.StepToNextType(); - T2W.StepToNextType(); - } - - return AllowLargerT1 || T1W.isDone(); -} - - -/// mergeTypeInfo - This method merges the specified type into the current node -/// at the specified offset. This may update the current node's type record if -/// this gives more information to the node, it may do nothing to the node if -/// this information is already known, or it may merge the node completely (and -/// return true) if the information is incompatible with what is already known. -/// -/// This method returns true if the node is completely folded, otherwise false. -/// -bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset, - bool FoldIfIncompatible) { - const TargetData &TD = getTargetData(); - // Check to make sure the Size member is up-to-date. Size can be one of the - // following: - // Size = 0, Ty = Void: Nothing is known about this node. - // Size = 0, Ty = FnTy: FunctionPtr doesn't have a size, so we use zero - // Size = 1, Ty = Void, Array = 1: The node is collapsed - // Otherwise, sizeof(Ty) = Size - // - assert(((Size == 0 && Ty == Type::VoidTy && !isArray()) || - (Size == 0 && !Ty->isSized() && !isArray()) || - (Size == 1 && Ty == Type::VoidTy && isArray()) || - (Size == 0 && !Ty->isSized() && !isArray()) || - (TD.getTypeSize(Ty) == Size)) && - "Size member of DSNode doesn't match the type structure!"); - assert(NewTy != Type::VoidTy && "Cannot merge void type into DSNode!"); - - if (Offset == 0 && NewTy == Ty) - return false; // This should be a common case, handle it efficiently - - // Return true immediately if the node is completely folded. - if (isNodeCompletelyFolded()) return true; - - // If this is an array type, eliminate the outside arrays because they won't - // be used anyway. This greatly reduces the size of large static arrays used - // as global variables, for example. - // - bool WillBeArray = false; - while (const ArrayType *AT = dyn_cast<ArrayType>(NewTy)) { - // FIXME: we might want to keep small arrays, but must be careful about - // things like: [2 x [10000 x int*]] - NewTy = AT->getElementType(); - WillBeArray = true; - } - - // Figure out how big the new type we're merging in is... - unsigned NewTySize = NewTy->isSized() ? (unsigned)TD.getTypeSize(NewTy) : 0; - - // Otherwise check to see if we can fold this type into the current node. If - // we can't, we fold the node completely, if we can, we potentially update our - // internal state. - // - if (Ty == Type::VoidTy) { - // If this is the first type that this node has seen, just accept it without - // question.... - assert(Offset == 0 && !isArray() && - "Cannot have an offset into a void node!"); - - // If this node would have to have an unreasonable number of fields, just - // collapse it. This can occur for fortran common blocks, which have stupid - // things like { [100000000 x double], [1000000 x double] }. - unsigned NumFields = (NewTySize+DS::PointerSize-1) >> DS::PointerShift; - if (NumFields > DSAFieldLimit) { - foldNodeCompletely(); - return true; - } - - Ty = NewTy; - NodeType &= ~Array; - if (WillBeArray) NodeType |= Array; - Size = NewTySize; - - // Calculate the number of outgoing links from this node. - Links.resize(NumFields); - return false; - } - - // Handle node expansion case here... - if (Offset+NewTySize > Size) { - // It is illegal to grow this node if we have treated it as an array of - // objects... - if (isArray()) { - if (FoldIfIncompatible) foldNodeCompletely(); - return true; - } - - // If this node would have to have an unreasonable number of fields, just - // collapse it. This can occur for fortran common blocks, which have stupid - // things like { [100000000 x double], [1000000 x double] }. - unsigned NumFields = (NewTySize+Offset+DS::PointerSize-1) >> DS::PointerShift; - if (NumFields > DSAFieldLimit) { - foldNodeCompletely(); - return true; - } - - if (Offset) { - //handle some common cases: - // Ty: struct { t1, t2, t3, t4, ..., tn} - // NewTy: struct { offset, stuff...} - // try merge with NewTy: struct {t1, t2, stuff...} if offset lands exactly on a field in Ty - if (isa<StructType>(NewTy) && isa<StructType>(Ty)) { - DEBUG(std::cerr << "Ty: " << *Ty << "\nNewTy: " << *NewTy << "@" << Offset << "\n"); - unsigned O = 0; - const StructType *STy = cast<StructType>(Ty); - const StructLayout &SL = *TD.getStructLayout(STy); - unsigned i = SL.getElementContainingOffset(Offset); - //Either we hit it exactly or give up - if (SL.MemberOffsets[i] != Offset) { - if (FoldIfIncompatible) foldNodeCompletely(); - return true; - } - std::vector<const Type*> nt; - for (unsigned x = 0; x < i; ++x) - nt.push_back(STy->getElementType(x)); - STy = cast<StructType>(NewTy); - nt.insert(nt.end(), STy->element_begin(), STy->element_end()); - //and merge - STy = StructType::get(nt); - DEBUG(std::cerr << "Trying with: " << *STy << "\n"); - return mergeTypeInfo(STy, 0); - } - - //Ty: struct { t1, t2, t3 ... tn} - //NewTy T offset x - //try merge with NewTy: struct : {t1, t2, T} if offset lands on a field in Ty - if (isa<StructType>(Ty)) { - DEBUG(std::cerr << "Ty: " << *Ty << "\nNewTy: " << *NewTy << "@" << Offset << "\n"); - unsigned O = 0; - const StructType *STy = cast<StructType>(Ty); - const StructLayout &SL = *TD.getStructLayout(STy); - unsigned i = SL.getElementContainingOffset(Offset); - //Either we hit it exactly or give up - if (SL.MemberOffsets[i] != Offset) { - if (FoldIfIncompatible) foldNodeCompletely(); - return true; - } - std::vector<const Type*> nt; - for (unsigned x = 0; x < i; ++x) - nt.push_back(STy->getElementType(x)); - nt.push_back(NewTy); - //and merge - STy = StructType::get(nt); - DEBUG(std::cerr << "Trying with: " << *STy << "\n"); - return mergeTypeInfo(STy, 0); - } - - std::cerr << "UNIMP: Trying to merge a growth type into " - << "offset != 0: Collapsing!\n"; - abort(); - if (FoldIfIncompatible) foldNodeCompletely(); - return true; - - } - - - // Okay, the situation is nice and simple, we are trying to merge a type in - // at offset 0 that is bigger than our current type. Implement this by - // switching to the new type and then merge in the smaller one, which should - // hit the other code path here. If the other code path decides it's not - // ok, it will collapse the node as appropriate. - // - - const Type *OldTy = Ty; - Ty = NewTy; - NodeType &= ~Array; - if (WillBeArray) NodeType |= Array; - Size = NewTySize; - - // Must grow links to be the appropriate size... - Links.resize(NumFields); - - // Merge in the old type now... which is guaranteed to be smaller than the - // "current" type. - return mergeTypeInfo(OldTy, 0); - } - - assert(Offset <= Size && - "Cannot merge something into a part of our type that doesn't exist!"); - - // Find the section of Ty that NewTy overlaps with... first we find the - // type that starts at offset Offset. - // - unsigned O = 0; - const Type *SubType = Ty; - while (O < Offset) { - assert(Offset-O < TD.getTypeSize(SubType) && "Offset out of range!"); - - switch (SubType->getTypeID()) { - case Type::StructTyID: { - const StructType *STy = cast<StructType>(SubType); - const StructLayout &SL = *TD.getStructLayout(STy); - unsigned i = SL.getElementContainingOffset(Offset-O); - - // The offset we are looking for must be in the i'th element... - SubType = STy->getElementType(i); - O += (unsigned)SL.MemberOffsets[i]; - break; - } - case Type::ArrayTyID: { - SubType = cast<ArrayType>(SubType)->getElementType(); - unsigned ElSize = (unsigned)TD.getTypeSize(SubType); - unsigned Remainder = (Offset-O) % ElSize; - O = Offset-Remainder; - break; - } - default: - if (FoldIfIncompatible) foldNodeCompletely(); - return true; - } - } - - assert(O == Offset && "Could not achieve the correct offset!"); - - // If we found our type exactly, early exit - if (SubType == NewTy) return false; - - // Differing function types don't require us to merge. They are not values - // anyway. - if (isa<FunctionType>(SubType) && - isa<FunctionType>(NewTy)) return false; - - unsigned SubTypeSize = SubType->isSized() ? - (unsigned)TD.getTypeSize(SubType) : 0; - - // Ok, we are getting desperate now. Check for physical subtyping, where we - // just require each element in the node to be compatible. - if (NewTySize <= SubTypeSize && NewTySize && NewTySize < 256 && - SubTypeSize && SubTypeSize < 256 && - ElementTypesAreCompatible(NewTy, SubType, !isArray(), TD)) - return false; - - // Okay, so we found the leader type at the offset requested. Search the list - // of types that starts at this offset. If SubType is currently an array or - // structure, the type desired may actually be the first element of the - // composite type... - // - unsigned PadSize = SubTypeSize; // Size, including pad memory which is ignored - while (SubType != NewTy) { - const Type *NextSubType = 0; - unsigned NextSubTypeSize = 0; - unsigned NextPadSize = 0; - switch (SubType->getTypeID()) { - case Type::StructTyID: { - const StructType *STy = cast<StructType>(SubType); - const StructLayout &SL = *TD.getStructLayout(STy); - if (SL.MemberOffsets.size() > 1) - NextPadSize = (unsigned)SL.MemberOffsets[1]; - else - NextPadSize = SubTypeSize; - NextSubType = STy->getElementType(0); - NextSubTypeSize = (unsigned)TD.getTypeSize(NextSubType); - break; - } - case Type::ArrayTyID: - NextSubType = cast<ArrayType>(SubType)->getElementType(); - NextSubTypeSize = (unsigned)TD.getTypeSize(NextSubType); - NextPadSize = NextSubTypeSize; - break; - default: ; - // fall out - } - - if (NextSubType == 0) - break; // In the default case, break out of the loop - - if (NextPadSize < NewTySize) - break; // Don't allow shrinking to a smaller type than NewTySize - SubType = NextSubType; - SubTypeSize = NextSubTypeSize; - PadSize = NextPadSize; - } - - // If we found the type exactly, return it... - if (SubType == NewTy) - return false; - - // Check to see if we have a compatible, but different type... - if (NewTySize == SubTypeSize) { - // Check to see if this type is obviously convertible... int -> uint f.e. - if (NewTy->isLosslesslyConvertibleTo(SubType)) - return false; - - // Check to see if we have a pointer & integer mismatch going on here, - // loading a pointer as a long, for example. - // - if (SubType->isInteger() && isa<PointerType>(NewTy) || - NewTy->isInteger() && isa<PointerType>(SubType)) - return false; - } else if (NewTySize > SubTypeSize && NewTySize <= PadSize) { - // We are accessing the field, plus some structure padding. Ignore the - // structure padding. - return false; - } - - Module *M = 0; - if (getParentGraph()->retnodes_begin() != getParentGraph()->retnodes_end()) - M = getParentGraph()->retnodes_begin()->first->getParent(); - DEBUG(std::cerr << "MergeTypeInfo Folding OrigTy: "; - WriteTypeSymbolic(std::cerr, Ty, M) << "\n due to:"; - WriteTypeSymbolic(std::cerr, NewTy, M) << " @ " << Offset << "!\n" - << "SubType: "; - WriteTypeSymbolic(std::cerr, SubType, M) << "\n\n"); - - if (FoldIfIncompatible) foldNodeCompletely(); - return true; -} - - - -/// addEdgeTo - Add an edge from the current node to the specified node. This -/// can cause merging of nodes in the graph. -/// -void DSNode::addEdgeTo(unsigned Offset, const DSNodeHandle &NH) { - if (NH.isNull()) return; // Nothing to do - - if (isNodeCompletelyFolded()) - Offset = 0; - - DSNodeHandle &ExistingEdge = getLink(Offset); - if (!ExistingEdge.isNull()) { - // Merge the two nodes... - ExistingEdge.mergeWith(NH); - } else { // No merging to perform... - setLink(Offset, NH); // Just force a link in there... - } -} - - -/// MergeSortedVectors - Efficiently merge a vector into another vector where -/// duplicates are not allowed and both are sorted. This assumes that 'T's are -/// efficiently copyable and have sane comparison semantics. -/// -static void MergeSortedVectors(std::vector<GlobalValue*> &Dest, - const std::vector<GlobalValue*> &Src) { - // By far, the most common cases will be the simple ones. In these cases, - // avoid having to allocate a temporary vector... - // - if (Src.empty()) { // Nothing to merge in... - return; - } else if (Dest.empty()) { // Just copy the result in... - Dest = Src; - } else if (Src.size() == 1) { // Insert a single element... - const GlobalValue *V = Src[0]; - std::vector<GlobalValue*>::iterator I = - std::lower_bound(Dest.begin(), Dest.end(), V); - if (I == Dest.end() || *I != Src[0]) // If not already contained... - Dest.insert(I, Src[0]); - } else if (Dest.size() == 1) { - GlobalValue *Tmp = Dest[0]; // Save value in temporary... - Dest = Src; // Copy over list... - std::vector<GlobalValue*>::iterator I = - std::lower_bound(Dest.begin(), Dest.end(), Tmp); - if (I == Dest.end() || *I != Tmp) // If not already contained... - Dest.insert(I, Tmp); - - } else { - // Make a copy to the side of Dest... - std::vector<GlobalValue*> Old(Dest); - - // Make space for all of the type entries now... - Dest.resize(Dest.size()+Src.size()); - - // Merge the two sorted ranges together... into Dest. - std::merge(Old.begin(), Old.end(), Src.begin(), Src.end(), Dest.begin()); - - // Now erase any duplicate entries that may have accumulated into the - // vectors (because they were in both of the input sets) - Dest.erase(std::unique(Dest.begin(), Dest.end()), Dest.end()); - } -} - -void DSNode::mergeGlobals(const std::vector<GlobalValue*> &RHS) { - MergeSortedVectors(Globals, RHS); -} - -// MergeNodes - Helper function for DSNode::mergeWith(). -// This function does the hard work of merging two nodes, CurNodeH -// and NH after filtering out trivial cases and making sure that -// CurNodeH.offset >= NH.offset. -// -// ***WARNING*** -// Since merging may cause either node to go away, we must always -// use the node-handles to refer to the nodes. These node handles are -// automatically updated during merging, so will always provide access -// to the correct node after a merge. -// -void DSNode::MergeNodes(DSNodeHandle& CurNodeH, DSNodeHandle& NH) { - assert(CurNodeH.getOffset() >= NH.getOffset() && - "This should have been enforced in the caller."); - assert(CurNodeH.getNode()->getParentGraph()==NH.getNode()->getParentGraph() && - "Cannot merge two nodes that are not in the same graph!"); - - // Now we know that Offset >= NH.Offset, so convert it so our "Offset" (with - // respect to NH.Offset) is now zero. NOffset is the distance from the base - // of our object that N starts from. - // - unsigned NOffset = CurNodeH.getOffset()-NH.getOffset(); - unsigned NSize = NH.getNode()->getSize(); - - // If the two nodes are of different size, and the smaller node has the array - // bit set, collapse! - if (NSize != CurNodeH.getNode()->getSize()) { -#if COLLAPSE_ARRAYS_AGGRESSIVELY - if (NSize < CurNodeH.getNode()->getSize()) { - if (NH.getNode()->isArray()) - NH.getNode()->foldNodeCompletely(); - } else if (CurNodeH.getNode()->isArray()) { - NH.getNode()->foldNodeCompletely(); - } -#endif - } - - // Merge the type entries of the two nodes together... - if (NH.getNode()->Ty != Type::VoidTy) - CurNodeH.getNode()->mergeTypeInfo(NH.getNode()->Ty, NOffset); - assert(!CurNodeH.getNode()->isDeadNode()); - - // If we are merging a node with a completely folded node, then both nodes are - // now completely folded. - // - if (CurNodeH.getNode()->isNodeCompletelyFolded()) { - if (!NH.getNode()->isNodeCompletelyFolded()) { - NH.getNode()->foldNodeCompletely(); - assert(NH.getNode() && NH.getOffset() == 0 && - "folding did not make offset 0?"); - NOffset = NH.getOffset(); - NSize = NH.getNode()->getSize(); - assert(NOffset == 0 && NSize == 1); - } - } else if (NH.getNode()->isNodeCompletelyFolded()) { - CurNodeH.getNode()->foldNodeCompletely(); - assert(CurNodeH.getNode() && CurNodeH.getOffset() == 0 && - "folding did not make offset 0?"); - NSize = NH.getNode()->getSize(); - NOffset = NH.getOffset(); - assert(NOffset == 0 && NSize == 1); - } - - DSNode *N = NH.getNode(); - if (CurNodeH.getNode() == N || N == 0) return; - assert(!CurNodeH.getNode()->isDeadNode()); - - // Merge the NodeType information. - CurNodeH.getNode()->NodeType |= N->NodeType; - - // Start forwarding to the new node! - N->forwardNode(CurNodeH.getNode(), NOffset); - assert(!CurNodeH.getNode()->isDeadNode()); - - // Make all of the outgoing links of N now be outgoing links of CurNodeH. - // - for (unsigned i = 0; i < N->getNumLinks(); ++i) { - DSNodeHandle &Link = N->getLink(i << DS::PointerShift); - if (Link.getNode()) { - // Compute the offset into the current node at which to - // merge this link. In the common case, this is a linear - // relation to the offset in the original node (with - // wrapping), but if the current node gets collapsed due to - // recursive merging, we must make sure to merge in all remaining - // links at offset zero. - unsigned MergeOffset = 0; - DSNode *CN = CurNodeH.getNode(); - if (CN->Size != 1) - MergeOffset = ((i << DS::PointerShift)+NOffset) % CN->getSize(); - CN->addEdgeTo(MergeOffset, Link); - } - } - - // Now that there are no outgoing edges, all of the Links are dead. - N->Links.clear(); - - // Merge the globals list... - if (!N->Globals.empty()) { - CurNodeH.getNode()->mergeGlobals(N->Globals); - - // Delete the globals from the old node... - std::vector<GlobalValue*>().swap(N->Globals); - } -} - - -/// mergeWith - Merge this node and the specified node, moving all links to and -/// from the argument node into the current node, deleting the node argument. -/// Offset indicates what offset the specified node is to be merged into the -/// current node. -/// -/// The specified node may be a null pointer (in which case, we update it to -/// point to this node). -/// -void DSNode::mergeWith(const DSNodeHandle &NH, unsigned Offset) { - DSNode *N = NH.getNode(); - if (N == this && NH.getOffset() == Offset) - return; // Noop - - // If the RHS is a null node, make it point to this node! - if (N == 0) { - NH.mergeWith(DSNodeHandle(this, Offset)); - return; - } - - assert(!N->isDeadNode() && !isDeadNode()); - assert(!hasNoReferrers() && "Should not try to fold a useless node!"); - - if (N == this) { - // We cannot merge two pieces of the same node together, collapse the node - // completely. - DEBUG(std::cerr << "Attempting to merge two chunks of" - << " the same node together!\n"); - foldNodeCompletely(); - return; - } - - // If both nodes are not at offset 0, make sure that we are merging the node - // at an later offset into the node with the zero offset. - // - if (Offset < NH.getOffset()) { - N->mergeWith(DSNodeHandle(this, Offset), NH.getOffset()); - return; - } else if (Offset == NH.getOffset() && getSize() < N->getSize()) { - // If the offsets are the same, merge the smaller node into the bigger node - N->mergeWith(DSNodeHandle(this, Offset), NH.getOffset()); - return; - } - - // Ok, now we can merge the two nodes. Use a static helper that works with - // two node handles, since "this" may get merged away at intermediate steps. - DSNodeHandle CurNodeH(this, Offset); - DSNodeHandle NHCopy(NH); - if (CurNodeH.getOffset() >= NHCopy.getOffset()) - DSNode::MergeNodes(CurNodeH, NHCopy); - else - DSNode::MergeNodes(NHCopy, CurNodeH); -} - - -//===----------------------------------------------------------------------===// -// ReachabilityCloner Implementation -//===----------------------------------------------------------------------===// - -DSNodeHandle ReachabilityCloner::getClonedNH(const DSNodeHandle &SrcNH) { - if (SrcNH.isNull()) return DSNodeHandle(); - const DSNode *SN = SrcNH.getNode(); - - DSNodeHandle &NH = NodeMap[SN]; - if (!NH.isNull()) { // Node already mapped? - DSNode *NHN = NH.getNode(); - return DSNodeHandle(NHN, NH.getOffset()+SrcNH.getOffset()); - } - - // If SrcNH has globals and the destination graph has one of the same globals, - // merge this node with the destination node, which is much more efficient. - if (SN->globals_begin() != SN->globals_end()) { - DSScalarMap &DestSM = Dest.getScalarMap(); - for (DSNode::globals_iterator I = SN->globals_begin(),E = SN->globals_end(); - I != E; ++I) { - GlobalValue *GV = *I; - DSScalarMap::iterator GI = DestSM.find(GV); - if (GI != DestSM.end() && !GI->second.isNull()) { - // We found one, use merge instead! - merge(GI->second, Src.getNodeForValue(GV)); - assert(!NH.isNull() && "Didn't merge node!"); - DSNode *NHN = NH.getNode(); - return DSNodeHandle(NHN, NH.getOffset()+SrcNH.getOffset()); - } - } - } - - DSNode *DN = new DSNode(*SN, &Dest, true /* Null out all links */); - DN->maskNodeTypes(BitsToKeep); - NH = DN; - - // Next, recursively clone all outgoing links as necessary. Note that - // adding these links can cause the node to collapse itself at any time, and - // the current node may be merged with arbitrary other nodes. For this - // reason, we must always go through NH. - DN = 0; - for (unsigned i = 0, e = SN->getNumLinks(); i != e; ++i) { - const DSNodeHandle &SrcEdge = SN->getLink(i << DS::PointerShift); - if (!SrcEdge.isNull()) { - const DSNodeHandle &DestEdge = getClonedNH(SrcEdge); - // Compute the offset into the current node at which to - // merge this link. In the common case, this is a linear - // relation to the offset in the original node (with - // wrapping), but if the current node gets collapsed due to - // recursive merging, we must make sure to merge in all remaining - // links at offset zero. - unsigned MergeOffset = 0; - DSNode *CN = NH.getNode(); - if (CN->getSize() != 1) - MergeOffset = ((i << DS::PointerShift)+NH.getOffset()) % CN->getSize(); - CN->addEdgeTo(MergeOffset, DestEdge); - } - } - - // If this node contains any globals, make sure they end up in the scalar - // map with the correct offset. - for (DSNode::globals_iterator I = SN->globals_begin(), E = SN->globals_end(); - I != E; ++I) { - GlobalValue *GV = *I; - const DSNodeHandle &SrcGNH = Src.getNodeForValue(GV); - DSNodeHandle &DestGNH = NodeMap[SrcGNH.getNode()]; - assert(DestGNH.getNode() == NH.getNode() &&"Global mapping inconsistent"); - Dest.getNodeForValue(GV).mergeWith(DSNodeHandle(DestGNH.getNode(), - DestGNH.getOffset()+SrcGNH.getOffset())); - } - NH.getNode()->mergeGlobals(SN->getGlobalsList()); - - return DSNodeHandle(NH.getNode(), NH.getOffset()+SrcNH.getOffset()); -} - -void ReachabilityCloner::merge(const DSNodeHandle &NH, - const DSNodeHandle &SrcNH) { - if (SrcNH.isNull()) return; // Noop - if (NH.isNull()) { - // If there is no destination node, just clone the source and assign the - // destination node to be it. - NH.mergeWith(getClonedNH(SrcNH)); - return; - } - - // Okay, at this point, we know that we have both a destination and a source - // node that need to be merged. Check to see if the source node has already - // been cloned. - const DSNode *SN = SrcNH.getNode(); - DSNodeHandle &SCNH = NodeMap[SN]; // SourceClonedNodeHandle - if (!SCNH.isNull()) { // Node already cloned? - DSNode *SCNHN = SCNH.getNode(); - NH.mergeWith(DSNodeHandle(SCNHN, - SCNH.getOffset()+SrcNH.getOffset())); - return; // Nothing to do! - } - - // Okay, so the source node has not already been cloned. Instead of creating - // a new DSNode, only to merge it into the one we already have, try to perform - // the merge in-place. The only case we cannot handle here is when the offset - // into the existing node is less than the offset into the virtual node we are - // merging in. In this case, we have to extend the existing node, which - // requires an allocation anyway. - DSNode *DN = NH.getNode(); // Make sure the Offset is up-to-date - if (NH.getOffset() >= SrcNH.getOffset()) { - if (!DN->isNodeCompletelyFolded()) { - // Make sure the destination node is folded if the source node is folded. - if (SN->isNodeCompletelyFolded()) { - DN->foldNodeCompletely(); - DN = NH.getNode(); - } else if (SN->getSize() != DN->getSize()) { - // If the two nodes are of different size, and the smaller node has the - // array bit set, collapse! -#if COLLAPSE_ARRAYS_AGGRESSIVELY - if (SN->getSize() < DN->getSize()) { - if (SN->isArray()) { - DN->foldNodeCompletely(); - DN = NH.getNode(); - } - } else if (DN->isArray()) { - DN->foldNodeCompletely(); - DN = NH.getNode(); - } -#endif - } - - // Merge the type entries of the two nodes together... - if (SN->getType() != Type::VoidTy && !DN->isNodeCompletelyFolded()) { - DN->mergeTypeInfo(SN->getType(), NH.getOffset()-SrcNH.getOffset()); - DN = NH.getNode(); - } - } - - assert(!DN->isDeadNode()); - - // Merge the NodeType information. - DN->mergeNodeFlags(SN->getNodeFlags() & BitsToKeep); - - // Before we start merging outgoing links and updating the scalar map, make - // sure it is known that this is the representative node for the src node. - SCNH = DSNodeHandle(DN, NH.getOffset()-SrcNH.getOffset()); - - // If the source node contains any globals, make sure they end up in the - // scalar map with the correct offset. - if (SN->globals_begin() != SN->globals_end()) { - // Update the globals in the destination node itself. - DN->mergeGlobals(SN->getGlobalsList()); - - // Update the scalar map for the graph we are merging the source node - // into. - for (DSNode::globals_iterator I = SN->globals_begin(), - E = SN->globals_end(); I != E; ++I) { - GlobalValue *GV = *I; - const DSNodeHandle &SrcGNH = Src.getNodeForValue(GV); - DSNodeHandle &DestGNH = NodeMap[SrcGNH.getNode()]; - assert(DestGNH.getNode()==NH.getNode() &&"Global mapping inconsistent"); - Dest.getNodeForValue(GV).mergeWith(DSNodeHandle(DestGNH.getNode(), - DestGNH.getOffset()+SrcGNH.getOffset())); - } - NH.getNode()->mergeGlobals(SN->getGlobalsList()); - } - } else { - // We cannot handle this case without allocating a temporary node. Fall - // back on being simple. - DSNode *NewDN = new DSNode(*SN, &Dest, true /* Null out all links */); - NewDN->maskNodeTypes(BitsToKeep); - - unsigned NHOffset = NH.getOffset(); - NH.mergeWith(DSNodeHandle(NewDN, SrcNH.getOffset())); - - assert(NH.getNode() && - (NH.getOffset() > NHOffset || - (NH.getOffset() == 0 && NH.getNode()->isNodeCompletelyFolded())) && - "Merging did not adjust the offset!"); - - // Before we start merging outgoing links and updating the scalar map, make - // sure it is known that this is the representative node for the src node. - SCNH = DSNodeHandle(NH.getNode(), NH.getOffset()-SrcNH.getOffset()); - - // If the source node contained any globals, make sure to create entries - // in the scalar map for them! - for (DSNode::globals_iterator I = SN->globals_begin(), - E = SN->globals_end(); I != E; ++I) { - GlobalValue *GV = *I; - const DSNodeHandle &SrcGNH = Src.getNodeForValue(GV); - DSNodeHandle &DestGNH = NodeMap[SrcGNH.getNode()]; - assert(DestGNH.getNode()==NH.getNode() &&"Global mapping inconsistent"); - assert(SrcGNH.getNode() == SN && "Global mapping inconsistent"); - Dest.getNodeForValue(GV).mergeWith(DSNodeHandle(DestGNH.getNode(), - DestGNH.getOffset()+SrcGNH.getOffset())); - } - } - - - // Next, recursively merge all outgoing links as necessary. Note that - // adding these links can cause the destination node to collapse itself at - // any time, and the current node may be merged with arbitrary other nodes. - // For this reason, we must always go through NH. - DN = 0; - for (unsigned i = 0, e = SN->getNumLinks(); i != e; ++i) { - const DSNodeHandle &SrcEdge = SN->getLink(i << DS::PointerShift); - if (!SrcEdge.isNull()) { - // Compute the offset into the current node at which to - // merge this link. In the common case, this is a linear - // relation to the offset in the original node (with - // wrapping), but if the current node gets collapsed due to - // recursive merging, we must make sure to merge in all remaining - // links at offset zero. - DSNode *CN = SCNH.getNode(); - unsigned MergeOffset = - ((i << DS::PointerShift)+SCNH.getOffset()) % CN->getSize(); - - DSNodeHandle Tmp = CN->getLink(MergeOffset); - if (!Tmp.isNull()) { - // Perform the recursive merging. Make sure to create a temporary NH, - // because the Link can disappear in the process of recursive merging. - merge(Tmp, SrcEdge); - } else { - Tmp.mergeWith(getClonedNH(SrcEdge)); - // Merging this could cause all kinds of recursive things to happen, - // culminating in the current node being eliminated. Since this is - // possible, make sure to reaquire the link from 'CN'. - - unsigned MergeOffset = 0; - CN = SCNH.getNode(); - MergeOffset = ((i << DS::PointerShift)+SCNH.getOffset()) %CN->getSize(); - CN->getLink(MergeOffset).mergeWith(Tmp); - } - } - } -} - -/// mergeCallSite - Merge the nodes reachable from the specified src call -/// site into the nodes reachable from DestCS. -void ReachabilityCloner::mergeCallSite(DSCallSite &DestCS, - const DSCallSite &SrcCS) { - merge(DestCS.getRetVal(), SrcCS.getRetVal()); - unsigned MinArgs = DestCS.getNumPtrArgs(); - if (SrcCS.getNumPtrArgs() < MinArgs) MinArgs = SrcCS.getNumPtrArgs(); - - for (unsigned a = 0; a != MinArgs; ++a) - merge(DestCS.getPtrArg(a), SrcCS.getPtrArg(a)); - - for (unsigned a = MinArgs, e = SrcCS.getNumPtrArgs(); a != e; ++a) - DestCS.addPtrArg(getClonedNH(SrcCS.getPtrArg(a))); -} - - -//===----------------------------------------------------------------------===// -// DSCallSite Implementation -//===----------------------------------------------------------------------===// - -// Define here to avoid including iOther.h and BasicBlock.h in DSGraph.h -Function &DSCallSite::getCaller() const { - return *Site.getInstruction()->getParent()->getParent(); -} - -void DSCallSite::InitNH(DSNodeHandle &NH, const DSNodeHandle &Src, - ReachabilityCloner &RC) { - NH = RC.getClonedNH(Src); -} - -//===----------------------------------------------------------------------===// -// DSGraph Implementation -//===----------------------------------------------------------------------===// - -/// getFunctionNames - Return a space separated list of the name of the -/// functions in this graph (if any) -std::string DSGraph::getFunctionNames() const { - switch (getReturnNodes().size()) { - case 0: return "Globals graph"; - case 1: return retnodes_begin()->first->getName(); - default: - std::string Return; - for (DSGraph::retnodes_iterator I = retnodes_begin(); - I != retnodes_end(); ++I) - Return += I->first->getName() + " "; - Return.erase(Return.end()-1, Return.end()); // Remove last space character - return Return; - } -} - - -DSGraph::DSGraph(const DSGraph &G, EquivalenceClasses<GlobalValue*> &ECs, - unsigned CloneFlags) - : GlobalsGraph(0), ScalarMap(ECs), TD(G.TD) { - PrintAuxCalls = false; - cloneInto(G, CloneFlags); -} - -DSGraph::~DSGraph() { - FunctionCalls.clear(); - AuxFunctionCalls.clear(); - ScalarMap.clear(); - ReturnNodes.clear(); - - // Drop all intra-node references, so that assertions don't fail... - for (node_iterator NI = node_begin(), E = node_end(); NI != E; ++NI) - NI->dropAllReferences(); - - // Free all of the nodes. - Nodes.clear(); -} - -// dump - Allow inspection of graph in a debugger. -void DSGraph::dump() const { print(std::cerr); } - - -/// remapLinks - Change all of the Links in the current node according to the -/// specified mapping. -/// -void DSNode::remapLinks(DSGraph::NodeMapTy &OldNodeMap) { - for (unsigned i = 0, e = Links.size(); i != e; ++i) - if (DSNode *N = Links[i].getNode()) { - DSGraph::NodeMapTy::const_iterator ONMI = OldNodeMap.find(N); - if (ONMI != OldNodeMap.end()) { - DSNode *ONMIN = ONMI->second.getNode(); - Links[i].setTo(ONMIN, Links[i].getOffset()+ONMI->second.getOffset()); - } - } -} - -/// addObjectToGraph - This method can be used to add global, stack, and heap -/// objects to the graph. This can be used when updating DSGraphs due to the -/// introduction of new temporary objects. The new object is not pointed to -/// and does not point to any other objects in the graph. -DSNode *DSGraph::addObjectToGraph(Value *Ptr, bool UseDeclaredType) { - assert(isa<PointerType>(Ptr->getType()) && "Ptr is not a pointer!"); - const Type *Ty = cast<PointerType>(Ptr->getType())->getElementType(); - DSNode *N = new DSNode(UseDeclaredType ? Ty : 0, this); - assert(ScalarMap[Ptr].isNull() && "Object already in this graph!"); - ScalarMap[Ptr] = N; - - if (GlobalValue *GV = dyn_cast<GlobalValue>(Ptr)) { - N->addGlobal(GV); - } else if (MallocInst *MI = dyn_cast<MallocInst>(Ptr)) { - N->setHeapNodeMarker(); - } else if (AllocaInst *AI = dyn_cast<AllocaInst>(Ptr)) { - N->setAllocaNodeMarker(); - } else { - assert(0 && "Illegal memory object input!"); - } - return N; -} - - -/// cloneInto - Clone the specified DSGraph into the current graph. The -/// translated ScalarMap for the old function is filled into the ScalarMap -/// for the graph, and the translated ReturnNodes map is returned into -/// ReturnNodes. -/// -/// The CloneFlags member controls various aspects of the cloning process. -/// -void DSGraph::cloneInto(const DSGraph &G, unsigned CloneFlags) { - TIME_REGION(X, "cloneInto"); - assert(&G != this && "Cannot clone graph into itself!"); - - NodeMapTy OldNodeMap; - - // Remove alloca or mod/ref bits as specified... - unsigned BitsToClear = ((CloneFlags & StripAllocaBit)? DSNode::AllocaNode : 0) - | ((CloneFlags & StripModRefBits)? (DSNode::Modified | DSNode::Read) : 0) - | ((CloneFlags & StripIncompleteBit)? DSNode::Incomplete : 0); - BitsToClear |= DSNode::DEAD; // Clear dead flag... - - for (node_const_iterator I = G.node_begin(), E = G.node_end(); I != E; ++I) { - assert(!I->isForwarding() && - "Forward nodes shouldn't be in node list!"); - DSNode *New = new DSNode(*I, this); - New->maskNodeTypes(~BitsToClear); - OldNodeMap[I] = New; - } - -#ifndef NDEBUG - Timer::addPeakMemoryMeasurement(); -#endif - - // Rewrite the links in the new nodes to point into the current graph now. - // Note that we don't loop over the node's list to do this. The problem is - // that remaping links can cause recursive merging to happen, which means - // that node_iterator's can get easily invalidated! Because of this, we - // loop over the OldNodeMap, which contains all of the new nodes as the - // .second element of the map elements. Also note that if we remap a node - // more than once, we won't break anything. - for (NodeMapTy::iterator I = OldNodeMap.begin(), E = OldNodeMap.end(); - I != E; ++I) - I->second.getNode()->remapLinks(OldNodeMap); - - // Copy the scalar map... merging all of the global nodes... - for (DSScalarMap::const_iterator I = G.ScalarMap.begin(), - E = G.ScalarMap.end(); I != E; ++I) { - DSNodeHandle &MappedNode = OldNodeMap[I->second.getNode()]; - DSNodeHandle &H = ScalarMap.getRawEntryRef(I->first); - DSNode *MappedNodeN = MappedNode.getNode(); - H.mergeWith(DSNodeHandle(MappedNodeN, - I->second.getOffset()+MappedNode.getOffset())); - } - - if (!(CloneFlags & DontCloneCallNodes)) { - // Copy the function calls list. - for (fc_iterator I = G.fc_begin(), E = G.fc_end(); I != E; ++I) - FunctionCalls.push_back(DSCallSite(*I, OldNodeMap)); - } - - if (!(CloneFlags & DontCloneAuxCallNodes)) { - // Copy the auxiliary function calls list. - for (afc_iterator I = G.afc_begin(), E = G.afc_end(); I != E; ++I) - AuxFunctionCalls.push_back(DSCallSite(*I, OldNodeMap)); - } - - // Map the return node pointers over... - for (retnodes_iterator I = G.retnodes_begin(), - E = G.retnodes_end(); I != E; ++I) { - const DSNodeHandle &Ret = I->second; - DSNodeHandle &MappedRet = OldNodeMap[Ret.getNode()]; - DSNode *MappedRetN = MappedRet.getNode(); - ReturnNodes.insert(std::make_pair(I->first, - DSNodeHandle(MappedRetN, - MappedRet.getOffset()+Ret.getOffset()))); - } -} - -/// spliceFrom - Logically perform the operation of cloning the RHS graph into -/// this graph, then clearing the RHS graph. Instead of performing this as -/// two seperate operations, do it as a single, much faster, one. -/// -void DSGraph::spliceFrom(DSGraph &RHS) { - // Change all of the nodes in RHS to think we are their parent. - for (NodeListTy::iterator I = RHS.Nodes.begin(), E = RHS.Nodes.end(); - I != E; ++I) - I->setParentGraph(this); - // Take all of the nodes. - Nodes.splice(Nodes.end(), RHS.Nodes); - - // Take all of the calls. - FunctionCalls.splice(FunctionCalls.end(), RHS.FunctionCalls); - AuxFunctionCalls.splice(AuxFunctionCalls.end(), RHS.AuxFunctionCalls); - - // Take all of the return nodes. - if (ReturnNodes.empty()) { - ReturnNodes.swap(RHS.ReturnNodes); - } else { - ReturnNodes.insert(RHS.ReturnNodes.begin(), RHS.ReturnNodes.end()); - RHS.ReturnNodes.clear(); - } - - // Merge the scalar map in. - ScalarMap.spliceFrom(RHS.ScalarMap); -} - -/// spliceFrom - Copy all entries from RHS, then clear RHS. -/// -void DSScalarMap::spliceFrom(DSScalarMap &RHS) { - // Special case if this is empty. - if (ValueMap.empty()) { - ValueMap.swap(RHS.ValueMap); - GlobalSet.swap(RHS.GlobalSet); - } else { - GlobalSet.insert(RHS.GlobalSet.begin(), RHS.GlobalSet.end()); - for (ValueMapTy::iterator I = RHS.ValueMap.begin(), E = RHS.ValueMap.end(); - I != E; ++I) - ValueMap[I->first].mergeWith(I->second); - RHS.ValueMap.clear(); - } -} - - -/// getFunctionArgumentsForCall - Given a function that is currently in this -/// graph, return the DSNodeHandles that correspond to the pointer-compatible -/// function arguments. The vector is filled in with the return value (or -/// null if it is not pointer compatible), followed by all of the -/// pointer-compatible arguments. -void DSGraph::getFunctionArgumentsForCall(Function *F, - std::vector<DSNodeHandle> &Args) const { - Args.push_back(getReturnNodeFor(*F)); - for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); - AI != E; ++AI) - if (isPointerType(AI->getType())) { - Args.push_back(getNodeForValue(AI)); - assert(!Args.back().isNull() && "Pointer argument w/o scalarmap entry!?"); - } -} - -namespace { - // HackedGraphSCCFinder - This is used to find nodes that have a path from the - // node to a node cloned by the ReachabilityCloner object contained. To be - // extra obnoxious it ignores edges from nodes that are globals, and truncates - // search at RC marked nodes. This is designed as an object so that - // intermediate results can be memoized across invocations of - // PathExistsToClonedNode. - struct HackedGraphSCCFinder { - ReachabilityCloner &RC; - unsigned CurNodeId; - std::vector<const DSNode*> SCCStack; - std::map<const DSNode*, std::pair<unsigned, bool> > NodeInfo; - - HackedGraphSCCFinder(ReachabilityCloner &rc) : RC(rc), CurNodeId(1) { - // Remove null pointer as a special case. - NodeInfo[0] = std::make_pair(0, false); - } - - std::pair<unsigned, bool> &VisitForSCCs(const DSNode *N); - - bool PathExistsToClonedNode(const DSNode *N) { - return VisitForSCCs(N).second; - } - - bool PathExistsToClonedNode(const DSCallSite &CS) { - if (PathExistsToClonedNode(CS.getRetVal().getNode())) - return true; - for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i) - if (PathExistsToClonedNode(CS.getPtrArg(i).getNode())) - return true; - return false; - } - }; -} - -std::pair<unsigned, bool> &HackedGraphSCCFinder:: -VisitForSCCs(const DSNode *N) { - std::map<const DSNode*, std::pair<unsigned, bool> >::iterator - NodeInfoIt = NodeInfo.lower_bound(N); - if (NodeInfoIt != NodeInfo.end() && NodeInfoIt->first == N) - return NodeInfoIt->second; - - unsigned Min = CurNodeId++; - unsigned MyId = Min; - std::pair<unsigned, bool> &ThisNodeInfo = - NodeInfo.insert(NodeInfoIt, - std::make_pair(N, std::make_pair(MyId, false)))->second; - - // Base case: if we find a global, this doesn't reach the cloned graph - // portion. - if (N->isGlobalNode()) { - ThisNodeInfo.second = false; - return ThisNodeInfo; - } - - // Base case: if this does reach the cloned graph portion... it does. :) - if (RC.hasClonedNode(N)) { - ThisNodeInfo.second = true; - return ThisNodeInfo; - } - - SCCStack.push_back(N); - - // Otherwise, check all successors. - bool AnyDirectSuccessorsReachClonedNodes = false; - for (DSNode::const_edge_iterator EI = N->edge_begin(), EE = N->edge_end(); - EI != EE; ++EI) - if (DSNode *Succ = EI->getNode()) { - std::pair<unsigned, bool> &SuccInfo = VisitForSCCs(Succ); - if (SuccInfo.first < Min) Min = SuccInfo.first; - AnyDirectSuccessorsReachClonedNodes |= SuccInfo.second; - } - - if (Min != MyId) - return ThisNodeInfo; // Part of a large SCC. Leave self on stack. - - if (SCCStack.back() == N) { // Special case single node SCC. - SCCStack.pop_back(); - ThisNodeInfo.second = AnyDirectSuccessorsReachClonedNodes; - return ThisNodeInfo; - } - - // Find out if any direct successors of any node reach cloned nodes. - if (!AnyDirectSuccessorsReachClonedNodes) - for (unsigned i = SCCStack.size()-1; SCCStack[i] != N; --i) - for (DSNode::const_edge_iterator EI = N->edge_begin(), EE = N->edge_end(); - EI != EE; ++EI) - if (DSNode *N = EI->getNode()) - if (NodeInfo[N].second) { - AnyDirectSuccessorsReachClonedNodes = true; - goto OutOfLoop; - } -OutOfLoop: - // If any successor reaches a cloned node, mark all nodes in this SCC as - // reaching the cloned node. - if (AnyDirectSuccessorsReachClonedNodes) - while (SCCStack.back() != N) { - NodeInfo[SCCStack.back()].second = true; - SCCStack.pop_back(); - } - SCCStack.pop_back(); - ThisNodeInfo.second = true; - return ThisNodeInfo; -} - -/// mergeInCallFromOtherGraph - This graph merges in the minimal number of -/// nodes from G2 into 'this' graph, merging the bindings specified by the -/// call site (in this graph) with the bindings specified by the vector in G2. -/// The two DSGraphs must be different. -/// -void DSGraph::mergeInGraph(const DSCallSite &CS, - std::vector<DSNodeHandle> &Args, - const DSGraph &Graph, unsigned CloneFlags) { - TIME_REGION(X, "mergeInGraph"); - - assert((CloneFlags & DontCloneCallNodes) && - "Doesn't support copying of call nodes!"); - - // If this is not a recursive call, clone the graph into this graph... - if (&Graph == this) { - // Merge the return value with the return value of the context. - Args[0].mergeWith(CS.getRetVal()); - - // Resolve all of the function arguments. - for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i) { - if (i == Args.size()-1) - break; - - // Add the link from the argument scalar to the provided value. - Args[i+1].mergeWith(CS.getPtrArg(i)); - } - return; - } - - // Clone the callee's graph into the current graph, keeping track of where - // scalars in the old graph _used_ to point, and of the new nodes matching - // nodes of the old graph. - ReachabilityCloner RC(*this, Graph, CloneFlags); - - // Map the return node pointer over. - if (!CS.getRetVal().isNull()) - RC.merge(CS.getRetVal(), Args[0]); - - // Map over all of the arguments. - for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i) { - if (i == Args.size()-1) - break; - - // Add the link from the argument scalar to the provided value. - RC.merge(CS.getPtrArg(i), Args[i+1]); - } - - // We generally don't want to copy global nodes or aux calls from the callee - // graph to the caller graph. However, we have to copy them if there is a - // path from the node to a node we have already copied which does not go - // through another global. Compute the set of node that can reach globals and - // aux call nodes to copy over, then do it. - std::vector<const DSCallSite*> AuxCallToCopy; - std::vector<GlobalValue*> GlobalsToCopy; - - // NodesReachCopiedNodes - Memoize results for efficiency. Contains a - // true/false value for every visited node that reaches a copied node without - // going through a global. - HackedGraphSCCFinder SCCFinder(RC); - - if (!(CloneFlags & DontCloneAuxCallNodes)) - for (afc_iterator I = Graph.afc_begin(), E = Graph.afc_end(); I!=E; ++I) - if (SCCFinder.PathExistsToClonedNode(*I)) - AuxCallToCopy.push_back(&*I); - else if (I->isIndirectCall()){ - //If the call node doesn't have any callees, clone it - std::vector< Function *> List; - I->getCalleeNode()->addFullFunctionList(List); - if (!List.size()) - AuxCallToCopy.push_back(&*I); - } - - const DSScalarMap &GSM = Graph.getScalarMap(); - for (DSScalarMap::global_iterator GI = GSM.global_begin(), - E = GSM.global_end(); GI != E; ++GI) { - DSNode *GlobalNode = Graph.getNodeForValue(*GI).getNode(); - for (DSNode::edge_iterator EI = GlobalNode->edge_begin(), - EE = GlobalNode->edge_end(); EI != EE; ++EI) - if (SCCFinder.PathExistsToClonedNode(EI->getNode())) { - GlobalsToCopy.push_back(*GI); - break; - } - } - - // Copy aux calls that are needed. - for (unsigned i = 0, e = AuxCallToCopy.size(); i != e; ++i) - AuxFunctionCalls.push_back(DSCallSite(*AuxCallToCopy[i], RC)); - - // Copy globals that are needed. - for (unsigned i = 0, e = GlobalsToCopy.size(); i != e; ++i) - RC.getClonedNH(Graph.getNodeForValue(GlobalsToCopy[i])); -} - - - -/// mergeInGraph - The method is used for merging graphs together. If the -/// argument graph is not *this, it makes a clone of the specified graph, then -/// merges the nodes specified in the call site with the formal arguments in the -/// graph. -/// -void DSGraph::mergeInGraph(const DSCallSite &CS, Function &F, - const DSGraph &Graph, unsigned CloneFlags) { - // Set up argument bindings. - std::vector<DSNodeHandle> Args; - Graph.getFunctionArgumentsForCall(&F, Args); - - mergeInGraph(CS, Args, Graph, CloneFlags); -} - -/// getCallSiteForArguments - Get the arguments and return value bindings for -/// the specified function in the current graph. -/// -DSCallSite DSGraph::getCallSiteForArguments(Function &F) const { - std::vector<DSNodeHandle> Args; - - for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I) - if (isPointerType(I->getType())) - Args.push_back(getNodeForValue(I)); - - return DSCallSite(CallSite(), getReturnNodeFor(F), &F, Args); -} - -/// getDSCallSiteForCallSite - Given an LLVM CallSite object that is live in -/// the context of this graph, return the DSCallSite for it. -DSCallSite DSGraph::getDSCallSiteForCallSite(CallSite CS) const { - DSNodeHandle RetVal; - Instruction *I = CS.getInstruction(); - if (isPointerType(I->getType())) - RetVal = getNodeForValue(I); - - std::vector<DSNodeHandle> Args; - Args.reserve(CS.arg_end()-CS.arg_begin()); - - // Calculate the arguments vector... - for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end(); I != E; ++I) - if (isPointerType((*I)->getType())) - if (isa<ConstantPointerNull>(*I)) - Args.push_back(DSNodeHandle()); - else - Args.push_back(getNodeForValue(*I)); - - // Add a new function call entry... - if (Function *F = CS.getCalledFunction()) - return DSCallSite(CS, RetVal, F, Args); - else - return DSCallSite(CS, RetVal, - getNodeForValue(CS.getCalledValue()).getNode(), Args); -} - - - -// markIncompleteNodes - Mark the specified node as having contents that are not -// known with the current analysis we have performed. Because a node makes all -// of the nodes it can reach incomplete if the node itself is incomplete, we -// must recursively traverse the data structure graph, marking all reachable -// nodes as incomplete. -// -static void markIncompleteNode(DSNode *N) { - // Stop recursion if no node, or if node already marked... - if (N == 0 || N->isIncomplete()) return; - - // Actually mark the node - N->setIncompleteMarker(); - - // Recursively process children... - for (DSNode::edge_iterator I = N->edge_begin(),E = N->edge_end(); I != E; ++I) - if (DSNode *DSN = I->getNode()) - markIncompleteNode(DSN); -} - -static void markIncomplete(DSCallSite &Call) { - // Then the return value is certainly incomplete! - markIncompleteNode(Call.getRetVal().getNode()); - - // All objects pointed to by function arguments are incomplete! - for (unsigned i = 0, e = Call.getNumPtrArgs(); i != e; ++i) - markIncompleteNode(Call.getPtrArg(i).getNode()); -} - -// markIncompleteNodes - Traverse the graph, identifying nodes that may be -// modified by other functions that have not been resolved yet. This marks -// nodes that are reachable through three sources of "unknownness": -// -// Global Variables, Function Calls, and Incoming Arguments -// -// For any node that may have unknown components (because something outside the -// scope of current analysis may have modified it), the 'Incomplete' flag is -// added to the NodeType. -// -void DSGraph::markIncompleteNodes(unsigned Flags) { - // Mark any incoming arguments as incomplete. - if (Flags & DSGraph::MarkFormalArgs) - for (ReturnNodesTy::iterator FI = ReturnNodes.begin(), E =ReturnNodes.end(); - FI != E; ++FI) { - Function &F = *FI->first; - for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); - I != E; ++I) - if (isPointerType(I->getType())) - markIncompleteNode(getNodeForValue(I).getNode()); - markIncompleteNode(FI->second.getNode()); - } - - // Mark stuff passed into functions calls as being incomplete. - if (!shouldPrintAuxCalls()) - for (std::list<DSCallSite>::iterator I = FunctionCalls.begin(), - E = FunctionCalls.end(); I != E; ++I) - markIncomplete(*I); - else - for (std::list<DSCallSite>::iterator I = AuxFunctionCalls.begin(), - E = AuxFunctionCalls.end(); I != E; ++I) - markIncomplete(*I); - - // Mark all global nodes as incomplete. - for (DSScalarMap::global_iterator I = ScalarMap.global_begin(), - E = ScalarMap.global_end(); I != E; ++I) - if (GlobalVariable *GV = dyn_cast<GlobalVariable>(*I)) - if (!GV->hasInitializer() || // Always mark external globals incomp. - (!GV->isConstant() && (Flags & DSGraph::IgnoreGlobals) == 0)) - markIncompleteNode(ScalarMap[GV].getNode()); -} - -static inline void killIfUselessEdge(DSNodeHandle &Edge) { - if (DSNode *N = Edge.getNode()) // Is there an edge? - if (N->getNumReferrers() == 1) // Does it point to a lonely node? - // No interesting info? - if ((N->getNodeFlags() & ~DSNode::Incomplete) == 0 && - N->getType() == Type::VoidTy && !N->isNodeCompletelyFolded()) - Edge.setTo(0, 0); // Kill the edge! -} - -static inline bool nodeContainsExternalFunction(const DSNode *N) { - std::vector<Function*> Funcs; - N->addFullFunctionList(Funcs); - for (unsigned i = 0, e = Funcs.size(); i != e; ++i) - if (Funcs[i]->isExternal()) return true; - return false; -} - -static void removeIdenticalCalls(std::list<DSCallSite> &Calls) { - // Remove trivially identical function calls - Calls.sort(); // Sort by callee as primary key! - - // Scan the call list cleaning it up as necessary... - DSNodeHandle LastCalleeNode; - Function *LastCalleeFunc = 0; - unsigned NumDuplicateCalls = 0; - bool LastCalleeContainsExternalFunction = false; - - unsigned NumDeleted = 0; - for (std::list<DSCallSite>::iterator I = Calls.begin(), E = Calls.end(); - I != E;) { - DSCallSite &CS = *I; - std::list<DSCallSite>::iterator OldIt = I++; - - if (!CS.isIndirectCall()) { - LastCalleeNode = 0; - } else { - DSNode *Callee = CS.getCalleeNode(); - - // If the Callee is a useless edge, this must be an unreachable call site, - // eliminate it. - if (Callee->getNumReferrers() == 1 && Callee->isComplete() && - Callee->getGlobalsList().empty()) { // No useful info? -#ifndef NDEBUG - std::cerr << "WARNING: Useless call site found.\n"; -#endif - Calls.erase(OldIt); - ++NumDeleted; - continue; - } - - // If the last call site in the list has the same callee as this one, and - // if the callee contains an external function, it will never be - // resolvable, just merge the call sites. - if (!LastCalleeNode.isNull() && LastCalleeNode.getNode() == Callee) { - LastCalleeContainsExternalFunction = - nodeContainsExternalFunction(Callee); - - std::list<DSCallSite>::iterator PrevIt = OldIt; - --PrevIt; - PrevIt->mergeWith(CS); - - // No need to keep this call anymore. - Calls.erase(OldIt); - ++NumDeleted; - continue; - } else { - LastCalleeNode = Callee; - } - } - - // If the return value or any arguments point to a void node with no - // information at all in it, and the call node is the only node to point - // to it, remove the edge to the node (killing the node). - // - killIfUselessEdge(CS.getRetVal()); - for (unsigned a = 0, e = CS.getNumPtrArgs(); a != e; ++a) - killIfUselessEdge(CS.getPtrArg(a)); - -#if 0 - // If this call site calls the same function as the last call site, and if - // the function pointer contains an external function, this node will - // never be resolved. Merge the arguments of the call node because no - // information will be lost. - // - if ((CS.isDirectCall() && CS.getCalleeFunc() == LastCalleeFunc) || - (CS.isIndirectCall() && CS.getCalleeNode() == LastCalleeNode)) { - ++NumDuplicateCalls; - if (NumDuplicateCalls == 1) { - if (LastCalleeNode) - LastCalleeContainsExternalFunction = - nodeContainsExternalFunction(LastCalleeNode); - else - LastCalleeContainsExternalFunction = LastCalleeFunc->isExternal(); - } - - // It is not clear why, but enabling this code makes DSA really - // sensitive to node forwarding. Basically, with this enabled, DSA - // performs different number of inlinings based on which nodes are - // forwarding or not. This is clearly a problem, so this code is - // disabled until this can be resolved. -#if 1 - if (LastCalleeContainsExternalFunction -#if 0 - || - // This should be more than enough context sensitivity! - // FIXME: Evaluate how many times this is tripped! - NumDuplicateCalls > 20 -#endif - ) { - - std::list<DSCallSite>::iterator PrevIt = OldIt; - --PrevIt; - PrevIt->mergeWith(CS); - - // No need to keep this call anymore. - Calls.erase(OldIt); - ++NumDeleted; - continue; - } -#endif - } else { - if (CS.isDirectCall()) { - LastCalleeFunc = CS.getCalleeFunc(); - LastCalleeNode = 0; - } else { - LastCalleeNode = CS.getCalleeNode(); - LastCalleeFunc = 0; - } - NumDuplicateCalls = 0; - } -#endif - - if (I != Calls.end() && CS == *I) { - LastCalleeNode = 0; - Calls.erase(OldIt); - ++NumDeleted; - continue; - } - } - - // Resort now that we simplified things. - Calls.sort(); - - // Now that we are in sorted order, eliminate duplicates. - std::list<DSCallSite>::iterator CI = Calls.begin(), CE = Calls.end(); - if (CI != CE) - while (1) { - std::list<DSCallSite>::iterator OldIt = CI++; - if (CI == CE) break; - - // If this call site is now the same as the previous one, we can delete it - // as a duplicate. - if (*OldIt == *CI) { - Calls.erase(CI); - CI = OldIt; - ++NumDeleted; - } - } - - //Calls.erase(std::unique(Calls.begin(), Calls.end()), Calls.end()); - - // Track the number of call nodes merged away... - NumCallNodesMerged += NumDeleted; - - DEBUG(if (NumDeleted) - std::cerr << "Merged " << NumDeleted << " call nodes.\n";); -} - - -// removeTriviallyDeadNodes - After the graph has been constructed, this method -// removes all unreachable nodes that are created because they got merged with -// other nodes in the graph. These nodes will all be trivially unreachable, so -// we don't have to perform any non-trivial analysis here. -// -void DSGraph::removeTriviallyDeadNodes() { - TIME_REGION(X, "removeTriviallyDeadNodes"); - -#if 0 - /// NOTE: This code is disabled. This slows down DSA on 177.mesa - /// substantially! - - // Loop over all of the nodes in the graph, calling getNode on each field. - // This will cause all nodes to update their forwarding edges, causing - // forwarded nodes to be delete-able. - { TIME_REGION(X, "removeTriviallyDeadNodes:node_iterate"); - for (node_iterator NI = node_begin(), E = node_end(); NI != E; ++NI) { - DSNode &N = *NI; - for (unsigned l = 0, e = N.getNumLinks(); l != e; ++l) - N.getLink(l*N.getPointerSize()).getNode(); - } - } - - // NOTE: This code is disabled. Though it should, in theory, allow us to - // remove more nodes down below, the scan of the scalar map is incredibly - // expensive for certain programs (with large SCCs). In the future, if we can - // make the scalar map scan more efficient, then we can reenable this. - { TIME_REGION(X, "removeTriviallyDeadNodes:scalarmap"); - - // Likewise, forward any edges from the scalar nodes. While we are at it, - // clean house a bit. - for (DSScalarMap::iterator I = ScalarMap.begin(),E = ScalarMap.end();I != E;){ - I->second.getNode(); - ++I; - } - } -#endif - bool isGlobalsGraph = !GlobalsGraph; - - for (NodeListTy::iterator NI = Nodes.begin(), E = Nodes.end(); NI != E; ) { - DSNode &Node = *NI; - - // Do not remove *any* global nodes in the globals graph. - // This is a special case because such nodes may not have I, M, R flags set. - if (Node.isGlobalNode() && isGlobalsGraph) { - ++NI; - continue; - } - - if (Node.isComplete() && !Node.isModified() && !Node.isRead()) { - // This is a useless node if it has no mod/ref info (checked above), - // outgoing edges (which it cannot, as it is not modified in this - // context), and it has no incoming edges. If it is a global node it may - // have all of these properties and still have incoming edges, due to the - // scalar map, so we check those now. - // - if (Node.getNumReferrers() == Node.getGlobalsList().size()) { - const std::vector<GlobalValue*> &Globals = Node.getGlobalsList(); - - // Loop through and make sure all of the globals are referring directly - // to the node... - for (unsigned j = 0, e = Globals.size(); j != e; ++j) { - DSNode *N = getNodeForValue(Globals[j]).getNode(); - assert(N == &Node && "ScalarMap doesn't match globals list!"); - } - - // Make sure NumReferrers still agrees, if so, the node is truly dead. - if (Node.getNumReferrers() == Globals.size()) { - for (unsigned j = 0, e = Globals.size(); j != e; ++j) - ScalarMap.erase(Globals[j]); - Node.makeNodeDead(); - ++NumTrivialGlobalDNE; - } - } - } - - if (Node.getNodeFlags() == 0 && Node.hasNoReferrers()) { - // This node is dead! - NI = Nodes.erase(NI); // Erase & remove from node list. - ++NumTrivialDNE; - } else { - ++NI; - } - } - - removeIdenticalCalls(FunctionCalls); - removeIdenticalCalls(AuxFunctionCalls); -} - - -/// markReachableNodes - This method recursively traverses the specified -/// DSNodes, marking any nodes which are reachable. All reachable nodes it adds -/// to the set, which allows it to only traverse visited nodes once. -/// -void DSNode::markReachableNodes(hash_set<const DSNode*> &ReachableNodes) const { - if (this == 0) return; - assert(getForwardNode() == 0 && "Cannot mark a forwarded node!"); - if (ReachableNodes.insert(this).second) // Is newly reachable? - for (DSNode::const_edge_iterator I = edge_begin(), E = edge_end(); - I != E; ++I) - I->getNode()->markReachableNodes(ReachableNodes); -} - -void DSCallSite::markReachableNodes(hash_set<const DSNode*> &Nodes) const { - getRetVal().getNode()->markReachableNodes(Nodes); - if (isIndirectCall()) getCalleeNode()->markReachableNodes(Nodes); - - for (unsigned i = 0, e = getNumPtrArgs(); i != e; ++i) - getPtrArg(i).getNode()->markReachableNodes(Nodes); -} - -// CanReachAliveNodes - Simple graph walker that recursively traverses the graph -// looking for a node that is marked alive. If an alive node is found, return -// true, otherwise return false. If an alive node is reachable, this node is -// marked as alive... -// -static bool CanReachAliveNodes(DSNode *N, hash_set<const DSNode*> &Alive, - hash_set<const DSNode*> &Visited, - bool IgnoreGlobals) { - if (N == 0) return false; - assert(N->getForwardNode() == 0 && "Cannot mark a forwarded node!"); - - // If this is a global node, it will end up in the globals graph anyway, so we - // don't need to worry about it. - if (IgnoreGlobals && N->isGlobalNode()) return false; - - // If we know that this node is alive, return so! - if (Alive.count(N)) return true; - - // Otherwise, we don't think the node is alive yet, check for infinite - // recursion. - if (Visited.count(N)) return false; // Found a cycle - Visited.insert(N); // No recursion, insert into Visited... - - for (DSNode::edge_iterator I = N->edge_begin(),E = N->edge_end(); I != E; ++I) - if (CanReachAliveNodes(I->getNode(), Alive, Visited, IgnoreGlobals)) { - N->markReachableNodes(Alive); - return true; - } - return false; -} - -// CallSiteUsesAliveArgs - Return true if the specified call site can reach any -// alive nodes. -// -static bool CallSiteUsesAliveArgs(const DSCallSite &CS, - hash_set<const DSNode*> &Alive, - hash_set<const DSNode*> &Visited, - bool IgnoreGlobals) { - if (CanReachAliveNodes(CS.getRetVal().getNode(), Alive, Visited, - IgnoreGlobals)) - return true; - if (CS.isIndirectCall() && - CanReachAliveNodes(CS.getCalleeNode(), Alive, Visited, IgnoreGlobals)) - return true; - for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i) - if (CanReachAliveNodes(CS.getPtrArg(i).getNode(), Alive, Visited, - IgnoreGlobals)) - return true; - return false; -} - -// removeDeadNodes - Use a more powerful reachability analysis to eliminate -// subgraphs that are unreachable. This often occurs because the data -// structure doesn't "escape" into it's caller, and thus should be eliminated -// from the caller's graph entirely. This is only appropriate to use when -// inlining graphs. -// -void DSGraph::removeDeadNodes(unsigned Flags) { - DEBUG(AssertGraphOK(); if (GlobalsGraph) GlobalsGraph->AssertGraphOK()); - - // Reduce the amount of work we have to do... remove dummy nodes left over by - // merging... - removeTriviallyDeadNodes(); - - TIME_REGION(X, "removeDeadNodes"); - - // FIXME: Merge non-trivially identical call nodes... - - // Alive - a set that holds all nodes found to be reachable/alive. - hash_set<const DSNode*> Alive; - std::vector<std::pair<Value*, DSNode*> > GlobalNodes; - - // Copy and merge all information about globals to the GlobalsGraph if this is - // not a final pass (where unreachable globals are removed). - // - // Strip all alloca bits since the current function is only for the BU pass. - // Strip all incomplete bits since they are short-lived properties and they - // will be correctly computed when rematerializing nodes into the functions. - // - ReachabilityCloner GGCloner(*GlobalsGraph, *this, DSGraph::StripAllocaBit | - DSGraph::StripIncompleteBit); - - // Mark all nodes reachable by (non-global) scalar nodes as alive... -{ TIME_REGION(Y, "removeDeadNodes:scalarscan"); - for (DSScalarMap::iterator I = ScalarMap.begin(), E = ScalarMap.end(); - I != E; ++I) - if (isa<GlobalValue>(I->first)) { // Keep track of global nodes - assert(!I->second.isNull() && "Null global node?"); - assert(I->second.getNode()->isGlobalNode() && "Should be a global node!"); - GlobalNodes.push_back(std::make_pair(I->first, I->second.getNode())); - - // Make sure that all globals are cloned over as roots. - if (!(Flags & DSGraph::RemoveUnreachableGlobals) && GlobalsGraph) { - DSGraph::ScalarMapTy::iterator SMI = - GlobalsGraph->getScalarMap().find(I->first); - if (SMI != GlobalsGraph->getScalarMap().end()) - GGCloner.merge(SMI->second, I->second); - else - GGCloner.getClonedNH(I->second); - } - } else { - I->second.getNode()->markReachableNodes(Alive); - } -} - - // The return values are alive as well. - for (ReturnNodesTy::iterator I = ReturnNodes.begin(), E = ReturnNodes.end(); - I != E; ++I) - I->second.getNode()->markReachableNodes(Alive); - - // Mark any nodes reachable by primary calls as alive... - for (fc_iterator I = fc_begin(), E = fc_end(); I != E; ++I) - I->markReachableNodes(Alive); - - - // Now find globals and aux call nodes that are already live or reach a live - // value (which makes them live in turn), and continue till no more are found. - // - bool Iterate; - hash_set<const DSNode*> Visited; - hash_set<const DSCallSite*> AuxFCallsAlive; - do { - Visited.clear(); - // If any global node points to a non-global that is "alive", the global is - // "alive" as well... Remove it from the GlobalNodes list so we only have - // unreachable globals in the list. - // - Iterate = false; - if (!(Flags & DSGraph::RemoveUnreachableGlobals)) - for (unsigned i = 0; i != GlobalNodes.size(); ++i) - if (CanReachAliveNodes(GlobalNodes[i].second, Alive, Visited, - Flags & DSGraph::RemoveUnreachableGlobals)) { - std::swap(GlobalNodes[i--], GlobalNodes.back()); // Move to end to... - GlobalNodes.pop_back(); // erase efficiently - Iterate = true; - } - - // Mark only unresolvable call nodes for moving to the GlobalsGraph since - // call nodes that get resolved will be difficult to remove from that graph. - // The final unresolved call nodes must be handled specially at the end of - // the BU pass (i.e., in main or other roots of the call graph). - for (afc_iterator CI = afc_begin(), E = afc_end(); CI != E; ++CI) - if (!AuxFCallsAlive.count(&*CI) && - (CI->isIndirectCall() - || CallSiteUsesAliveArgs(*CI, Alive, Visited, - Flags & DSGraph::RemoveUnreachableGlobals))) { - CI->markReachableNodes(Alive); - AuxFCallsAlive.insert(&*CI); - Iterate = true; - } - } while (Iterate); - - // Move dead aux function calls to the end of the list - unsigned CurIdx = 0; - for (std::list<DSCallSite>::iterator CI = AuxFunctionCalls.begin(), - E = AuxFunctionCalls.end(); CI != E; ) - if (AuxFCallsAlive.count(&*CI)) - ++CI; - else { - // Copy and merge global nodes and dead aux call nodes into the - // GlobalsGraph, and all nodes reachable from those nodes. Update their - // target pointers using the GGCloner. - // - if (!(Flags & DSGraph::RemoveUnreachableGlobals)) - GlobalsGraph->AuxFunctionCalls.push_back(DSCallSite(*CI, GGCloner)); - - AuxFunctionCalls.erase(CI++); - } - - // We are finally done with the GGCloner so we can destroy it. - GGCloner.destroy(); - - // At this point, any nodes which are visited, but not alive, are nodes - // which can be removed. Loop over all nodes, eliminating completely - // unreachable nodes. - // - std::vector<DSNode*> DeadNodes; - DeadNodes.reserve(Nodes.size()); - for (NodeListTy::iterator NI = Nodes.begin(), E = Nodes.end(); NI != E;) { - DSNode *N = NI++; - assert(!N->isForwarding() && "Forwarded node in nodes list?"); - - if (!Alive.count(N)) { - Nodes.remove(N); - assert(!N->isForwarding() && "Cannot remove a forwarding node!"); - DeadNodes.push_back(N); - N->dropAllReferences(); - ++NumDNE; - } - } - - // Remove all unreachable globals from the ScalarMap. - // If flag RemoveUnreachableGlobals is set, GlobalNodes has only dead nodes. - // In either case, the dead nodes will not be in the set Alive. - for (unsigned i = 0, e = GlobalNodes.size(); i != e; ++i) - if (!Alive.count(GlobalNodes[i].second)) - ScalarMap.erase(GlobalNodes[i].first); - else - assert((Flags & DSGraph::RemoveUnreachableGlobals) && "non-dead global"); - - // Delete all dead nodes now since their referrer counts are zero. - for (unsigned i = 0, e = DeadNodes.size(); i != e; ++i) - delete DeadNodes[i]; - - DEBUG(AssertGraphOK(); GlobalsGraph->AssertGraphOK()); -} - -void DSGraph::AssertNodeContainsGlobal(const DSNode *N, GlobalValue *GV) const { - assert(std::find(N->globals_begin(),N->globals_end(), GV) != - N->globals_end() && "Global value not in node!"); -} - -void DSGraph::AssertCallSiteInGraph(const DSCallSite &CS) const { - if (CS.isIndirectCall()) { - AssertNodeInGraph(CS.getCalleeNode()); -#if 0 - if (CS.getNumPtrArgs() && CS.getCalleeNode() == CS.getPtrArg(0).getNode() && - CS.getCalleeNode() && CS.getCalleeNode()->getGlobals().empty()) - std::cerr << "WARNING: WEIRD CALL SITE FOUND!\n"; -#endif - } - AssertNodeInGraph(CS.getRetVal().getNode()); - for (unsigned j = 0, e = CS.getNumPtrArgs(); j != e; ++j) - AssertNodeInGraph(CS.getPtrArg(j).getNode()); -} - -void DSGraph::AssertCallNodesInGraph() const { - for (fc_iterator I = fc_begin(), E = fc_end(); I != E; ++I) - AssertCallSiteInGraph(*I); -} -void DSGraph::AssertAuxCallNodesInGraph() const { - for (afc_iterator I = afc_begin(), E = afc_end(); I != E; ++I) - AssertCallSiteInGraph(*I); -} - -void DSGraph::AssertGraphOK() const { - for (node_const_iterator NI = node_begin(), E = node_end(); NI != E; ++NI) - NI->assertOK(); - - for (ScalarMapTy::const_iterator I = ScalarMap.begin(), - E = ScalarMap.end(); I != E; ++I) { - assert(!I->second.isNull() && "Null node in scalarmap!"); - AssertNodeInGraph(I->second.getNode()); - if (GlobalValue *GV = dyn_cast<GlobalValue>(I->first)) { - assert(I->second.getNode()->isGlobalNode() && - "Global points to node, but node isn't global?"); - AssertNodeContainsGlobal(I->second.getNode(), GV); - } - } - AssertCallNodesInGraph(); - AssertAuxCallNodesInGraph(); - - // Check that all pointer arguments to any functions in this graph have - // destinations. - for (ReturnNodesTy::const_iterator RI = ReturnNodes.begin(), - E = ReturnNodes.end(); - RI != E; ++RI) { - Function &F = *RI->first; - for (Function::arg_iterator AI = F.arg_begin(); AI != F.arg_end(); ++AI) - if (isPointerType(AI->getType())) - assert(!getNodeForValue(AI).isNull() && - "Pointer argument must be in the scalar map!"); - } -} - -/// computeNodeMapping - Given roots in two different DSGraphs, traverse the -/// nodes reachable from the two graphs, computing the mapping of nodes from the -/// first to the second graph. This mapping may be many-to-one (i.e. the first -/// graph may have multiple nodes representing one node in the second graph), -/// but it will not work if there is a one-to-many or many-to-many mapping. -/// -void DSGraph::computeNodeMapping(const DSNodeHandle &NH1, - const DSNodeHandle &NH2, NodeMapTy &NodeMap, - bool StrictChecking) { - DSNode *N1 = NH1.getNode(), *N2 = NH2.getNode(); - if (N1 == 0 || N2 == 0) return; - - DSNodeHandle &Entry = NodeMap[N1]; - if (!Entry.isNull()) { - // Termination of recursion! - if (StrictChecking) { - assert(Entry.getNode() == N2 && "Inconsistent mapping detected!"); - assert((Entry.getOffset() == (NH2.getOffset()-NH1.getOffset()) || - Entry.getNode()->isNodeCompletelyFolded()) && - "Inconsistent mapping detected!"); - } - return; - } - - Entry.setTo(N2, NH2.getOffset()-NH1.getOffset()); - - // Loop over all of the fields that N1 and N2 have in common, recursively - // mapping the edges together now. - int N2Idx = NH2.getOffset()-NH1.getOffset(); - unsigned N2Size = N2->getSize(); - if (N2Size == 0) return; // No edges to map to. - - for (unsigned i = 0, e = N1->getSize(); i < e; i += DS::PointerSize) { - const DSNodeHandle &N1NH = N1->getLink(i); - // Don't call N2->getLink if not needed (avoiding crash if N2Idx is not - // aligned right). - if (!N1NH.isNull()) { - if (unsigned(N2Idx)+i < N2Size) - computeNodeMapping(N1NH, N2->getLink(N2Idx+i), NodeMap); - else - computeNodeMapping(N1NH, - N2->getLink(unsigned(N2Idx+i) % N2Size), NodeMap); - } - } -} - - -/// computeGToGGMapping - Compute the mapping of nodes in the global graph to -/// nodes in this graph. -void DSGraph::computeGToGGMapping(NodeMapTy &NodeMap) { - DSGraph &GG = *getGlobalsGraph(); - - DSScalarMap &SM = getScalarMap(); - for (DSScalarMap::global_iterator I = SM.global_begin(), - E = SM.global_end(); I != E; ++I) - DSGraph::computeNodeMapping(SM[*I], GG.getNodeForValue(*I), NodeMap); -} - -/// computeGGToGMapping - Compute the mapping of nodes in the global graph to -/// nodes in this graph. Note that any uses of this method are probably bugs, -/// unless it is known that the globals graph has been merged into this graph! -void DSGraph::computeGGToGMapping(InvNodeMapTy &InvNodeMap) { - NodeMapTy NodeMap; - computeGToGGMapping(NodeMap); - - while (!NodeMap.empty()) { - InvNodeMap.insert(std::make_pair(NodeMap.begin()->second, - NodeMap.begin()->first)); - NodeMap.erase(NodeMap.begin()); - } -} - - -/// computeCalleeCallerMapping - Given a call from a function in the current -/// graph to the 'Callee' function (which lives in 'CalleeGraph'), compute the -/// mapping of nodes from the callee to nodes in the caller. -void DSGraph::computeCalleeCallerMapping(DSCallSite CS, const Function &Callee, - DSGraph &CalleeGraph, - NodeMapTy &NodeMap) { - - DSCallSite CalleeArgs = - CalleeGraph.getCallSiteForArguments(const_cast<Function&>(Callee)); - - computeNodeMapping(CalleeArgs.getRetVal(), CS.getRetVal(), NodeMap); - - unsigned NumArgs = CS.getNumPtrArgs(); - if (NumArgs > CalleeArgs.getNumPtrArgs()) - NumArgs = CalleeArgs.getNumPtrArgs(); - - for (unsigned i = 0; i != NumArgs; ++i) - computeNodeMapping(CalleeArgs.getPtrArg(i), CS.getPtrArg(i), NodeMap); - - // Map the nodes that are pointed to by globals. - DSScalarMap &CalleeSM = CalleeGraph.getScalarMap(); - DSScalarMap &CallerSM = getScalarMap(); - - if (CalleeSM.global_size() >= CallerSM.global_size()) { - for (DSScalarMap::global_iterator GI = CallerSM.global_begin(), - E = CallerSM.global_end(); GI != E; ++GI) - if (CalleeSM.global_count(*GI)) - computeNodeMapping(CalleeSM[*GI], CallerSM[*GI], NodeMap); - } else { - for (DSScalarMap::global_iterator GI = CalleeSM.global_begin(), - E = CalleeSM.global_end(); GI != E; ++GI) - if (CallerSM.global_count(*GI)) - computeNodeMapping(CalleeSM[*GI], CallerSM[*GI], NodeMap); - } -} - -/// updateFromGlobalGraph - This function rematerializes global nodes and -/// nodes reachable from them from the globals graph into the current graph. -/// -void DSGraph::updateFromGlobalGraph() { - TIME_REGION(X, "updateFromGlobalGraph"); - ReachabilityCloner RC(*this, *GlobalsGraph, 0); - - // Clone the non-up-to-date global nodes into this graph. - for (DSScalarMap::global_iterator I = getScalarMap().global_begin(), - E = getScalarMap().global_end(); I != E; ++I) { - DSScalarMap::iterator It = GlobalsGraph->ScalarMap.find(*I); - if (It != GlobalsGraph->ScalarMap.end()) - RC.merge(getNodeForValue(*I), It->second); - } -}
diff --git a/poolalloc/lib/DSA/DataStructureAA.cpp b/poolalloc/lib/DSA/DataStructureAA.cpp deleted file mode 100644 index 1ea1d88..0000000 --- a/poolalloc/lib/DSA/DataStructureAA.cpp +++ /dev/null
@@ -1,300 +0,0 @@ -//===- DataStructureAA.cpp - Data Structure Based Alias Analysis ----------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This pass uses the top-down data structure graphs to implement a simple -// context sensitive alias analysis. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Constants.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Module.h" -#include "llvm/Analysis/AliasAnalysis.h" -#include "llvm/Analysis/Passes.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -using namespace llvm; - -namespace { - class DSAA : public ModulePass, public AliasAnalysis { - TDDataStructures *TD; - BUDataStructures *BU; - - // These members are used to cache mod/ref information to make us return - // results faster, particularly for aa-eval. On the first request of - // mod/ref information for a particular call site, we compute and store the - // calculated nodemap for the call site. Any time DSA info is updated we - // free this information, and when we move onto a new call site, this - // information is also freed. - CallSite MapCS; - std::multimap<DSNode*, const DSNode*> CallerCalleeMap; - public: - DSAA() : TD(0) {} - ~DSAA() { - InvalidateCache(); - } - - void InvalidateCache() { - MapCS = CallSite(); - CallerCalleeMap.clear(); - } - - //------------------------------------------------ - // Implement the Pass API - // - - // run - Build up the result graph, representing the pointer graph for the - // program. - // - bool runOnModule(Module &M) { - InitializeAliasAnalysis(this); - TD = &getAnalysis<TDDataStructures>(); - BU = &getAnalysis<BUDataStructures>(); - return false; - } - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AliasAnalysis::getAnalysisUsage(AU); - AU.setPreservesAll(); // Does not transform code - AU.addRequiredTransitive<TDDataStructures>(); // Uses TD Datastructures - AU.addRequiredTransitive<BUDataStructures>(); // Uses BU Datastructures - } - - //------------------------------------------------ - // Implement the AliasAnalysis API - // - - AliasResult alias(const Value *V1, unsigned V1Size, - const Value *V2, unsigned V2Size); - - ModRefResult getModRefInfo(CallSite CS, Value *P, unsigned Size); - ModRefResult getModRefInfo(CallSite CS1, CallSite CS2) { - return AliasAnalysis::getModRefInfo(CS1,CS2); - } - - virtual void deleteValue(Value *V) { - InvalidateCache(); - BU->deleteValue(V); - TD->deleteValue(V); - } - - virtual void copyValue(Value *From, Value *To) { - if (From == To) return; - InvalidateCache(); - BU->copyValue(From, To); - TD->copyValue(From, To); - } - - private: - DSGraph *getGraphForValue(const Value *V); - }; - - // Register the pass... - RegisterOpt<DSAA> X("ds-aa", "Data Structure Graph Based Alias Analysis"); - - // Register as an implementation of AliasAnalysis - RegisterAnalysisGroup<AliasAnalysis, DSAA> Y; -} - -ModulePass *llvm::createDSAAPass() { return new DSAA(); } - -// getGraphForValue - Return the DSGraph to use for queries about the specified -// value... -// -DSGraph *DSAA::getGraphForValue(const Value *V) { - if (const Instruction *I = dyn_cast<Instruction>(V)) - return &TD->getDSGraph(*I->getParent()->getParent()); - else if (const Argument *A = dyn_cast<Argument>(V)) - return &TD->getDSGraph(*A->getParent()); - else if (const BasicBlock *BB = dyn_cast<BasicBlock>(V)) - return &TD->getDSGraph(*BB->getParent()); - return 0; -} - -AliasAnalysis::AliasResult DSAA::alias(const Value *V1, unsigned V1Size, - const Value *V2, unsigned V2Size) { - if (V1 == V2) return MustAlias; - - DSGraph *G1 = getGraphForValue(V1); - DSGraph *G2 = getGraphForValue(V2); - assert((!G1 || !G2 || G1 == G2) && "Alias query for 2 different functions?"); - - // Get the graph to use... - DSGraph &G = *(G1 ? G1 : (G2 ? G2 : &TD->getGlobalsGraph())); - - const DSGraph::ScalarMapTy &GSM = G.getScalarMap(); - DSGraph::ScalarMapTy::const_iterator I = GSM.find((Value*)V1); - if (I == GSM.end()) return NoAlias; - - DSGraph::ScalarMapTy::const_iterator J = GSM.find((Value*)V2); - if (J == GSM.end()) return NoAlias; - - DSNode *N1 = I->second.getNode(), *N2 = J->second.getNode(); - unsigned O1 = I->second.getOffset(), O2 = J->second.getOffset(); - if (N1 == 0 || N2 == 0) - // Can't tell whether anything aliases null. - return AliasAnalysis::alias(V1, V1Size, V2, V2Size); - - // We can only make a judgment if one of the nodes is complete. - if (N1->isComplete() || N2->isComplete()) { - if (N1 != N2) - return NoAlias; // Completely different nodes. - - // See if they point to different offsets... if so, we may be able to - // determine that they do not alias... - if (O1 != O2) { - if (O2 < O1) { // Ensure that O1 <= O2 - std::swap(V1, V2); - std::swap(O1, O2); - std::swap(V1Size, V2Size); - } - - if (O1+V1Size <= O2) - return NoAlias; - } - } - - // FIXME: we could improve on this by checking the globals graph for aliased - // global queries... - return AliasAnalysis::alias(V1, V1Size, V2, V2Size); -} - -/// getModRefInfo - does a callsite modify or reference a value? -/// -AliasAnalysis::ModRefResult -DSAA::getModRefInfo(CallSite CS, Value *P, unsigned Size) { - DSNode *N = 0; - // First step, check our cache. - if (CS.getInstruction() == MapCS.getInstruction()) { - { - const Function *Caller = CS.getInstruction()->getParent()->getParent(); - DSGraph &CallerTDGraph = TD->getDSGraph(*Caller); - - // Figure out which node in the TD graph this pointer corresponds to. - DSScalarMap &CallerSM = CallerTDGraph.getScalarMap(); - DSScalarMap::iterator NI = CallerSM.find(P); - if (NI == CallerSM.end()) { - InvalidateCache(); - return DSAA::getModRefInfo(CS, P, Size); - } - N = NI->second.getNode(); - } - - HaveMappingInfo: - assert(N && "Null pointer in scalar map??"); - - typedef std::multimap<DSNode*, const DSNode*>::iterator NodeMapIt; - std::pair<NodeMapIt, NodeMapIt> Range = CallerCalleeMap.equal_range(N); - - // Loop over all of the nodes in the callee that correspond to "N", keeping - // track of aggregate mod/ref info. - bool NeverReads = true, NeverWrites = true; - for (; Range.first != Range.second; ++Range.first) { - if (Range.first->second->isModified()) - NeverWrites = false; - if (Range.first->second->isRead()) - NeverReads = false; - if (NeverReads == false && NeverWrites == false) - return AliasAnalysis::getModRefInfo(CS, P, Size); - } - - ModRefResult Result = ModRef; - if (NeverWrites) // We proved it was not modified. - Result = ModRefResult(Result & ~Mod); - if (NeverReads) // We proved it was not read. - Result = ModRefResult(Result & ~Ref); - - return ModRefResult(Result & AliasAnalysis::getModRefInfo(CS, P, Size)); - } - - // Any cached info we have is for the wrong function. - InvalidateCache(); - - Function *F = CS.getCalledFunction(); - - if (!F) return AliasAnalysis::getModRefInfo(CS, P, Size); - - if (F->isExternal()) { - // If we are calling an external function, and if this global doesn't escape - // the portion of the program we have analyzed, we can draw conclusions - // based on whether the global escapes the program. - Function *Caller = CS.getInstruction()->getParent()->getParent(); - DSGraph *G = &TD->getDSGraph(*Caller); - DSScalarMap::iterator NI = G->getScalarMap().find(P); - if (NI == G->getScalarMap().end()) { - // If it wasn't in the local function graph, check the global graph. This - // can occur for globals who are locally reference but hoisted out to the - // globals graph despite that. - G = G->getGlobalsGraph(); - NI = G->getScalarMap().find(P); - if (NI == G->getScalarMap().end()) - return AliasAnalysis::getModRefInfo(CS, P, Size); - } - - // If we found a node and it's complete, it cannot be passed out to the - // called function. - if (NI->second.getNode()->isComplete()) - return NoModRef; - return AliasAnalysis::getModRefInfo(CS, P, Size); - } - - // Get the graphs for the callee and caller. Note that we want the BU graph - // for the callee because we don't want all caller's effects incorporated! - const Function *Caller = CS.getInstruction()->getParent()->getParent(); - DSGraph &CallerTDGraph = TD->getDSGraph(*Caller); - DSGraph &CalleeBUGraph = BU->getDSGraph(*F); - - // Figure out which node in the TD graph this pointer corresponds to. - DSScalarMap &CallerSM = CallerTDGraph.getScalarMap(); - DSScalarMap::iterator NI = CallerSM.find(P); - if (NI == CallerSM.end()) { - ModRefResult Result = ModRef; - if (isa<ConstantPointerNull>(P) || isa<UndefValue>(P)) - return NoModRef; // null is never modified :) - else { - assert(isa<GlobalVariable>(P) && - cast<GlobalVariable>(P)->getType()->getElementType()->isFirstClassType() && - "This isn't a global that DSA inconsiderately dropped " - "from the graph?"); - - DSGraph &GG = *CallerTDGraph.getGlobalsGraph(); - DSScalarMap::iterator NI = GG.getScalarMap().find(P); - if (NI != GG.getScalarMap().end() && !NI->second.isNull()) { - // Otherwise, if the node is only M or R, return this. This can be - // useful for globals that should be marked const but are not. - DSNode *N = NI->second.getNode(); - if (!N->isModified()) - Result = (ModRefResult)(Result & ~Mod); - if (!N->isRead()) - Result = (ModRefResult)(Result & ~Ref); - } - } - - if (Result == NoModRef) return Result; - return ModRefResult(Result & AliasAnalysis::getModRefInfo(CS, P, Size)); - } - - // Compute the mapping from nodes in the callee graph to the nodes in the - // caller graph for this call site. - DSGraph::NodeMapTy CalleeCallerMap; - DSCallSite DSCS = CallerTDGraph.getDSCallSiteForCallSite(CS); - CallerTDGraph.computeCalleeCallerMapping(DSCS, *F, CalleeBUGraph, - CalleeCallerMap); - - // Remember the mapping and the call site for future queries. - MapCS = CS; - - // Invert the mapping into CalleeCallerInvMap. - for (DSGraph::NodeMapTy::iterator I = CalleeCallerMap.begin(), - E = CalleeCallerMap.end(); I != E; ++I) - CallerCalleeMap.insert(std::make_pair(I->second.getNode(), I->first)); - - N = NI->second.getNode(); - goto HaveMappingInfo; -}
diff --git a/poolalloc/lib/DSA/DataStructureOpt.cpp b/poolalloc/lib/DSA/DataStructureOpt.cpp deleted file mode 100644 index c464aee..0000000 --- a/poolalloc/lib/DSA/DataStructureOpt.cpp +++ /dev/null
@@ -1,102 +0,0 @@ -//===- DataStructureOpt.cpp - Data Structure Analysis Based Optimizations -===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This pass uses DSA to a series of simple optimizations, like marking -// unwritten global variables 'constant'. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Analysis/Passes.h" -#include "llvm/Module.h" -#include "llvm/Constant.h" -#include "llvm/Type.h" -#include "llvm/ADT/Statistic.h" -using namespace llvm; - -namespace { - Statistic<> - NumGlobalsConstanted("ds-opt", "Number of globals marked constant"); - Statistic<> - NumGlobalsIsolated("ds-opt", "Number of globals with references dropped"); - - class DSOpt : public ModulePass { - TDDataStructures *TD; - public: - bool runOnModule(Module &M) { - TD = &getAnalysis<TDDataStructures>(); - bool Changed = OptimizeGlobals(M); - return Changed; - } - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequired<TDDataStructures>(); // Uses TD Datastructures - AU.addPreserved<LocalDataStructures>(); // Preserves local... - AU.addPreserved<TDDataStructures>(); // Preserves bu... - AU.addPreserved<BUDataStructures>(); // Preserves td... - } - - private: - bool OptimizeGlobals(Module &M); - }; - - RegisterOpt<DSOpt> X("ds-opt", "DSA-based simple optimizations"); -} - -ModulePass *llvm::createDSOptPass() { return new DSOpt(); } - -/// OptimizeGlobals - This method uses information taken from DSA to optimize -/// global variables. -/// -bool DSOpt::OptimizeGlobals(Module &M) { - DSGraph &GG = TD->getGlobalsGraph(); - const DSGraph::ScalarMapTy &SM = GG.getScalarMap(); - bool Changed = false; - - for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) - if (!I->isExternal()) { // Loop over all of the non-external globals... - // Look up the node corresponding to this global, if it exists. - DSNode *GNode = 0; - DSGraph::ScalarMapTy::const_iterator SMI = SM.find(I); - if (SMI != SM.end()) GNode = SMI->second.getNode(); - - if (GNode == 0 && I->hasInternalLinkage()) { - // If there is no entry in the scalar map for this global, it was never - // referenced in the program. If it has internal linkage, that means we - // can delete it. We don't ACTUALLY want to delete the global, just - // remove anything that references the global: later passes will take - // care of nuking it. - if (!I->use_empty()) { - I->replaceAllUsesWith(Constant::getNullValue((Type*)I->getType())); - ++NumGlobalsIsolated; - } - } else if (GNode && GNode->isComplete()) { - - // If the node has not been read or written, and it is not externally - // visible, kill any references to it so it can be DCE'd. - if (!GNode->isModified() && !GNode->isRead() &&I->hasInternalLinkage()){ - if (!I->use_empty()) { - I->replaceAllUsesWith(Constant::getNullValue((Type*)I->getType())); - ++NumGlobalsIsolated; - } - } - - // We expect that there will almost always be a node for this global. - // If there is, and the node doesn't have the M bit set, we can set the - // 'constant' bit on the global. - if (!GNode->isModified() && !I->isConstant()) { - I->setConstant(true); - ++NumGlobalsConstanted; - Changed = true; - } - } - } - return Changed; -}
diff --git a/poolalloc/lib/DSA/DataStructureStats.cpp b/poolalloc/lib/DSA/DataStructureStats.cpp deleted file mode 100644 index f4aff30..0000000 --- a/poolalloc/lib/DSA/DataStructureStats.cpp +++ /dev/null
@@ -1,149 +0,0 @@ -//===- DataStructureStats.cpp - Various statistics for DS Graphs ----------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines a little pass that prints out statistics for DS Graphs. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Function.h" -#include "llvm/Instructions.h" -#include "llvm/Pass.h" -#include "llvm/Support/InstVisitor.h" -#include "llvm/ADT/Statistic.h" -#include <iostream> -using namespace llvm; - -namespace { - Statistic<> TotalNumCallees("totalcallees", - "Total number of callee functions at all indirect call sites"); - Statistic<> NumIndirectCalls("numindirect", - "Total number of indirect call sites in the program"); - Statistic<> NumPoolNodes("numpools", - "Number of allocation nodes that could be pool allocated"); - - // Typed/Untyped memory accesses: If DSA can infer that the types the loads - // and stores are accessing are correct (ie, the node has not been collapsed), - // increment the appropriate counter. - Statistic<> NumTypedMemAccesses("numtypedmemaccesses", - "Number of loads/stores which are fully typed"); - Statistic<> NumUntypedMemAccesses("numuntypedmemaccesses", - "Number of loads/stores which are untyped"); - - class DSGraphStats : public FunctionPass, public InstVisitor<DSGraphStats> { - void countCallees(const Function &F); - const DSGraph *TDGraph; - - DSNode *getNodeForValue(Value *V); - bool isNodeForValueCollapsed(Value *V); - public: - /// Driver functions to compute the Load/Store Dep. Graph per function. - bool runOnFunction(Function& F); - - /// getAnalysisUsage - This modify nothing, and uses the Top-Down Graph. - void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesAll(); - AU.addRequired<TDDataStructures>(); - } - - void visitLoad(LoadInst &LI); - void visitStore(StoreInst &SI); - - /// Debugging support methods - void print(std::ostream &O, const Module* = 0) const { } - }; - - static RegisterAnalysis<DSGraphStats> Z("dsstats", "DS Graph Statistics"); -} - -FunctionPass *llvm::createDataStructureStatsPass() { - return new DSGraphStats(); -} - - -static bool isIndirectCallee(Value *V) { - if (isa<Function>(V)) return false; - - if (CastInst *CI = dyn_cast<CastInst>(V)) - return isIndirectCallee(CI->getOperand(0)); - return true; -} - - -void DSGraphStats::countCallees(const Function& F) { - unsigned numIndirectCalls = 0, totalNumCallees = 0; - - for (DSGraph::fc_iterator I = TDGraph->fc_begin(), E = TDGraph->fc_end(); - I != E; ++I) - if (isIndirectCallee(I->getCallSite().getCalledValue())) { - // This is an indirect function call - std::vector<Function*> Callees; - I->getCalleeNode()->addFullFunctionList(Callees); - - if (Callees.size() > 0) { - totalNumCallees += Callees.size(); - ++numIndirectCalls; - } else - std::cerr << "WARNING: No callee in Function '" << F.getName() - << "' at call: \n" - << *I->getCallSite().getInstruction(); - } - - TotalNumCallees += totalNumCallees; - NumIndirectCalls += numIndirectCalls; - - if (numIndirectCalls) - std::cout << " In function " << F.getName() << ": " - << (totalNumCallees / (double) numIndirectCalls) - << " average callees per indirect call\n"; -} - -DSNode *DSGraphStats::getNodeForValue(Value *V) { - const DSGraph *G = TDGraph; - if (isa<Constant>(V)) - G = TDGraph->getGlobalsGraph(); - - const DSGraph::ScalarMapTy &ScalarMap = G->getScalarMap(); - DSGraph::ScalarMapTy::const_iterator I = ScalarMap.find(V); - if (I != ScalarMap.end()) - return I->second.getNode(); - return 0; -} - -bool DSGraphStats::isNodeForValueCollapsed(Value *V) { - if (DSNode *N = getNodeForValue(V)) - return N->isNodeCompletelyFolded() || N->isIncomplete(); - return false; -} - -void DSGraphStats::visitLoad(LoadInst &LI) { - if (isNodeForValueCollapsed(LI.getOperand(0))) { - NumUntypedMemAccesses++; - } else { - NumTypedMemAccesses++; - } -} - -void DSGraphStats::visitStore(StoreInst &SI) { - if (isNodeForValueCollapsed(SI.getOperand(1))) { - NumUntypedMemAccesses++; - } else { - NumTypedMemAccesses++; - } -} - - - -bool DSGraphStats::runOnFunction(Function& F) { - TDGraph = &getAnalysis<TDDataStructures>().getDSGraph(F); - countCallees(F); - visit(F); - return true; -}
diff --git a/poolalloc/lib/DSA/EquivClassGraphs.cpp b/poolalloc/lib/DSA/EquivClassGraphs.cpp deleted file mode 100644 index cc536a7..0000000 --- a/poolalloc/lib/DSA/EquivClassGraphs.cpp +++ /dev/null
@@ -1,483 +0,0 @@ -//===- EquivClassGraphs.cpp - Merge equiv-class graphs & inline bottom-up -===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This pass is the same as the complete bottom-up graphs, but -// with functions partitioned into equivalence classes and a single merged -// DS graph for all functions in an equivalence class. After this merging, -// graphs are inlined bottom-up on the SCCs of the final (CBU) call graph. -// -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "ECGraphs" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Module.h" -#include "llvm/Pass.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Support/CallSite.h" -#include "llvm/Support/Debug.h" -#include "llvm/ADT/SCCIterator.h" -#include "llvm/ADT/Statistic.h" -#include "llvm/ADT/EquivalenceClasses.h" -#include "llvm/ADT/STLExtras.h" -#include <iostream> -using namespace llvm; - -namespace { - RegisterAnalysis<EquivClassGraphs> X("eqdatastructure", - "Equivalence-class Bottom-up Data Structure Analysis"); - Statistic<> NumEquivBUInlines("equivdatastructures", - "Number of graphs inlined"); - Statistic<> NumFoldGraphInlines("Inline equiv-class graphs bottom up", - "Number of graphs inlined"); -} - -#ifndef NDEBUG -template<typename GT> -static void CheckAllGraphs(Module *M, GT &ECGraphs) { - for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) - if (!I->isExternal()) { - DSGraph &G = ECGraphs.getDSGraph(*I); - if (G.retnodes_begin()->first != I) - continue; // Only check a graph once. - - DSGraph::NodeMapTy GlobalsGraphNodeMapping; - G.computeGToGGMapping(GlobalsGraphNodeMapping); - } -} -#endif - -// getSomeCalleeForCallSite - Return any one callee function at a call site. -// -Function *EquivClassGraphs::getSomeCalleeForCallSite(const CallSite &CS) const{ - Function *thisFunc = CS.getCaller(); - assert(thisFunc && "getSomeCalleeForCallSite(): Not a valid call site?"); - DSGraph &DSG = getDSGraph(*thisFunc); - DSNode *calleeNode = DSG.getNodeForValue(CS.getCalledValue()).getNode(); - std::map<DSNode*, Function *>::const_iterator I = - OneCalledFunction.find(calleeNode); - return (I == OneCalledFunction.end())? NULL : I->second; -} - -// runOnModule - Calculate the bottom up data structure graphs for each function -// in the program. -// -bool EquivClassGraphs::runOnModule(Module &M) { - CBU = &getAnalysis<CompleteBUDataStructures>(); - GlobalECs = CBU->getGlobalECs(); - DEBUG(CheckAllGraphs(&M, *CBU)); - - GlobalsGraph = new DSGraph(CBU->getGlobalsGraph(), GlobalECs); - GlobalsGraph->setPrintAuxCalls(); - - ActualCallees = CBU->getActualCallees(); - - // Find equivalence classes of functions called from common call sites. - // Fold the CBU graphs for all functions in an equivalence class. - buildIndirectFunctionSets(M); - - // Stack of functions used for Tarjan's SCC-finding algorithm. - std::vector<DSGraph*> Stack; - std::map<DSGraph*, unsigned> ValMap; - unsigned NextID = 1; - - Function *MainFunc = M.getMainFunction(); - if (MainFunc && !MainFunc->isExternal()) { - processSCC(getOrCreateGraph(*MainFunc), Stack, NextID, ValMap); - } else { - std::cerr << "Fold Graphs: No 'main' function found!\n"; - } - - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal()) - processSCC(getOrCreateGraph(*I), Stack, NextID, ValMap); - - DEBUG(CheckAllGraphs(&M, *this)); - - getGlobalsGraph().removeTriviallyDeadNodes(); - getGlobalsGraph().markIncompleteNodes(DSGraph::IgnoreGlobals); - - // Merge the globals variables (not the calls) from the globals graph back - // into the main function's graph so that the main function contains all of - // the information about global pools and GV usage in the program. - if (MainFunc && !MainFunc->isExternal()) { - DSGraph &MainGraph = getOrCreateGraph(*MainFunc); - const DSGraph &GG = *MainGraph.getGlobalsGraph(); - ReachabilityCloner RC(MainGraph, GG, - DSGraph::DontCloneCallNodes | - DSGraph::DontCloneAuxCallNodes); - - // Clone the global nodes into this graph. - for (DSScalarMap::global_iterator I = GG.getScalarMap().global_begin(), - E = GG.getScalarMap().global_end(); I != E; ++I) - if (isa<GlobalVariable>(*I)) - RC.getClonedNH(GG.getNodeForValue(*I)); - - MainGraph.maskIncompleteMarkers(); - MainGraph.markIncompleteNodes(DSGraph::MarkFormalArgs | - DSGraph::IgnoreGlobals); - } - - // Final processing. Note that dead node elimination may actually remove - // globals from a function graph that are immediately used. If there are no - // scalars pointing to the node (e.g. because the only use is a direct store - // to a scalar global) we have to make sure to rematerialize the globals back - // into the graphs here, or clients will break! - for (Module::global_iterator GI = M.global_begin(), E = M.global_end(); - GI != E; ++GI) - // This only happens to first class typed globals. - if (GI->getType()->getElementType()->isFirstClassType()) - for (Value::use_iterator UI = GI->use_begin(), E = GI->use_end(); - UI != E; ++UI) - // This only happens to direct uses by instructions. - if (Instruction *User = dyn_cast<Instruction>(*UI)) { - DSGraph &DSG = getOrCreateGraph(*User->getParent()->getParent()); - if (!DSG.getScalarMap().count(GI)) { - // If this global does not exist in the graph, but it is immediately - // used by an instruction in the graph, clone it over from the - // globals graph. - ReachabilityCloner RC(DSG, *GlobalsGraph, 0); - RC.getClonedNH(GlobalsGraph->getNodeForValue(GI)); - } - } - - return false; -} - - -// buildIndirectFunctionSets - Iterate over the module looking for indirect -// calls to functions. If a call site can invoke any functions [F1, F2... FN], -// unify the N functions together in the FuncECs set. -// -void EquivClassGraphs::buildIndirectFunctionSets(Module &M) { - const ActualCalleesTy& AC = CBU->getActualCallees(); - - // Loop over all of the indirect calls in the program. If a call site can - // call multiple different functions, we need to unify all of the callees into - // the same equivalence class. - Instruction *LastInst = 0; - Function *FirstFunc = 0; - for (ActualCalleesTy::const_iterator I=AC.begin(), E=AC.end(); I != E; ++I) { - if (I->second->isExternal()) - continue; // Ignore functions we cannot modify - - CallSite CS = CallSite::get(I->first); - - if (CS.getCalledFunction()) { // Direct call: - FuncECs.insert(I->second); // -- Make sure function has equiv class - FirstFunc = I->second; // -- First callee at this site - } else { // Else indirect call - // DEBUG(std::cerr << "CALLEE: " << I->second->getName() - // << " from : " << I->first); - if (I->first != LastInst) { - // This is the first callee from this call site. - LastInst = I->first; - FirstFunc = I->second; - // Instead of storing the lastInst For Indirection call Sites we store - // the DSNode for the function ptr arguemnt - Function *thisFunc = LastInst->getParent()->getParent(); - DSGraph &TFG = CBU->getDSGraph(*thisFunc); - DSNode *calleeNode = TFG.getNodeForValue(CS.getCalledValue()).getNode(); - OneCalledFunction[calleeNode] = FirstFunc; - FuncECs.insert(I->second); - } else { - // This is not the first possible callee from a particular call site. - // Union the callee in with the other functions. - FuncECs.unionSets(FirstFunc, I->second); -#ifndef NDEBUG - Function *thisFunc = LastInst->getParent()->getParent(); - DSGraph &TFG = CBU->getDSGraph(*thisFunc); - DSNode *calleeNode = TFG.getNodeForValue(CS.getCalledValue()).getNode(); - assert(OneCalledFunction.count(calleeNode) > 0 && "Missed a call?"); -#endif - } - } - - // Now include all functions that share a graph with any function in the - // equivalence class. More precisely, if F is in the class, and G(F) is - // its graph, then we include all other functions that are also in G(F). - // Currently, that is just the functions in the same call-graph-SCC as F. - // - DSGraph& funcDSGraph = CBU->getDSGraph(*I->second); - for (DSGraph::retnodes_iterator RI = funcDSGraph.retnodes_begin(), - RE = funcDSGraph.retnodes_end(); RI != RE; ++RI) - FuncECs.unionSets(FirstFunc, RI->first); - } - - // Now that all of the equivalences have been built, merge the graphs for - // each equivalence class. - // - DEBUG(std::cerr << "\nIndirect Function Equivalence Sets:\n"); - for (EquivalenceClasses<Function*>::iterator EQSI = FuncECs.begin(), E = - FuncECs.end(); EQSI != E; ++EQSI) { - if (!EQSI->isLeader()) continue; - - EquivalenceClasses<Function*>::member_iterator SI = - FuncECs.member_begin(EQSI); - assert(SI != FuncECs.member_end() && "Empty equiv set??"); - EquivalenceClasses<Function*>::member_iterator SN = SI; - ++SN; - if (SN == FuncECs.member_end()) - continue; // Single function equivalence set, no merging to do. - - Function* LF = *SI; - -#ifndef NDEBUG - DEBUG(std::cerr <<" Equivalence set for leader " << LF->getName() <<" = "); - for (SN = SI; SN != FuncECs.member_end(); ++SN) - DEBUG(std::cerr << " " << (*SN)->getName() << "," ); - DEBUG(std::cerr << "\n"); -#endif - - // This equiv class has multiple functions: merge their graphs. First, - // clone the CBU graph for the leader and make it the common graph for the - // equivalence graph. - DSGraph &MergedG = getOrCreateGraph(*LF); - - // Record the argument nodes for use in merging later below. - std::vector<DSNodeHandle> ArgNodes; - - for (Function::arg_iterator AI = LF->arg_begin(), E = LF->arg_end(); - AI != E; ++AI) - if (DS::isPointerType(AI->getType())) - ArgNodes.push_back(MergedG.getNodeForValue(AI)); - - // Merge in the graphs of all other functions in this equiv. class. Note - // that two or more functions may have the same graph, and it only needs - // to be merged in once. - std::set<DSGraph*> GraphsMerged; - GraphsMerged.insert(&CBU->getDSGraph(*LF)); - - for (++SI; SI != FuncECs.member_end(); ++SI) { - Function *F = *SI; - DSGraph *&FG = DSInfo[F]; - - DSGraph &CBUGraph = CBU->getDSGraph(*F); - if (GraphsMerged.insert(&CBUGraph).second) { - // Record the "folded" graph for the function. - for (DSGraph::retnodes_iterator I = CBUGraph.retnodes_begin(), - E = CBUGraph.retnodes_end(); I != E; ++I) { - assert(DSInfo[I->first] == 0 && "Graph already exists for Fn!"); - DSInfo[I->first] = &MergedG; - } - - // Clone this member of the equivalence class into MergedG. - MergedG.cloneInto(CBUGraph); - } - - // Merge the return nodes of all functions together. - MergedG.getReturnNodes()[LF].mergeWith(MergedG.getReturnNodes()[F]); - - // Merge the function arguments with all argument nodes found so far. - // If there are extra function args, add them to the vector of argNodes - Function::arg_iterator AI2 = F->arg_begin(), AI2end = F->arg_end(); - for (unsigned arg = 0, numArgs = ArgNodes.size(); - arg != numArgs && AI2 != AI2end; ++AI2, ++arg) - if (DS::isPointerType(AI2->getType())) - ArgNodes[arg].mergeWith(MergedG.getNodeForValue(AI2)); - - for ( ; AI2 != AI2end; ++AI2) - if (DS::isPointerType(AI2->getType())) - ArgNodes.push_back(MergedG.getNodeForValue(AI2)); - DEBUG(MergedG.AssertGraphOK()); - } - } - DEBUG(std::cerr << "\n"); -} - - -DSGraph &EquivClassGraphs::getOrCreateGraph(Function &F) { - // Has the graph already been created? - DSGraph *&Graph = DSInfo[&F]; - if (Graph) return *Graph; - - DSGraph &CBUGraph = CBU->getDSGraph(F); - - // Copy the CBU graph... - Graph = new DSGraph(CBUGraph, GlobalECs); // updates the map via reference - Graph->setGlobalsGraph(&getGlobalsGraph()); - Graph->setPrintAuxCalls(); - - // Make sure to update the DSInfo map for all functions in the graph! - for (DSGraph::retnodes_iterator I = Graph->retnodes_begin(); - I != Graph->retnodes_end(); ++I) - if (I->first != &F) { - DSGraph *&FG = DSInfo[I->first]; - assert(FG == 0 && "Merging function in SCC twice?"); - FG = Graph; - } - - return *Graph; -} - - -unsigned EquivClassGraphs:: -processSCC(DSGraph &FG, std::vector<DSGraph*> &Stack, unsigned &NextID, - std::map<DSGraph*, unsigned> &ValMap) { - std::map<DSGraph*, unsigned>::iterator It = ValMap.lower_bound(&FG); - if (It != ValMap.end() && It->first == &FG) - return It->second; - - DEBUG(std::cerr << " ProcessSCC for function " << FG.getFunctionNames() - << "\n"); - - unsigned Min = NextID++, MyID = Min; - ValMap[&FG] = Min; - Stack.push_back(&FG); - - // The edges out of the current node are the call site targets... - for (DSGraph::fc_iterator CI = FG.fc_begin(), CE = FG.fc_end(); - CI != CE; ++CI) { - Instruction *Call = CI->getCallSite().getInstruction(); - - // Loop over all of the actually called functions... - for (callee_iterator I = callee_begin(Call), E = callee_end(Call); - I != E; ++I) - if (!I->second->isExternal()) { - // Process the callee as necessary. - unsigned M = processSCC(getOrCreateGraph(*I->second), - Stack, NextID, ValMap); - if (M < Min) Min = M; - } - } - - assert(ValMap[&FG] == MyID && "SCC construction assumption wrong!"); - if (Min != MyID) - return Min; // This is part of a larger SCC! - - // If this is a new SCC, process it now. - bool MergedGraphs = false; - while (Stack.back() != &FG) { - DSGraph *NG = Stack.back(); - ValMap[NG] = ~0U; - - // If the SCC found is not the same as those found in CBU, make sure to - // merge the graphs as appropriate. - FG.cloneInto(*NG); - - // Update the DSInfo map and delete the old graph... - for (DSGraph::retnodes_iterator I = NG->retnodes_begin(); - I != NG->retnodes_end(); ++I) - DSInfo[I->first] = &FG; - - // Remove NG from the ValMap since the pointer may get recycled. - ValMap.erase(NG); - delete NG; - MergedGraphs = true; - Stack.pop_back(); - } - - // Clean up the graph before we start inlining a bunch again. - if (MergedGraphs) - FG.removeTriviallyDeadNodes(); - - Stack.pop_back(); - - processGraph(FG); - ValMap[&FG] = ~0U; - return MyID; -} - - -/// processGraph - Process the CBU graphs for the program in bottom-up order on -/// the SCC of the __ACTUAL__ call graph. This builds final folded CBU graphs. -void EquivClassGraphs::processGraph(DSGraph &G) { - DEBUG(std::cerr << " ProcessGraph for function " - << G.getFunctionNames() << "\n"); - - hash_set<Instruction*> calls; - - // Else we need to inline some callee graph. Visit all call sites. - // The edges out of the current node are the call site targets... - unsigned i = 0; - for (DSGraph::fc_iterator CI = G.fc_begin(), CE = G.fc_end(); CI != CE; - ++CI, ++i) { - const DSCallSite &CS = *CI; - Instruction *TheCall = CS.getCallSite().getInstruction(); - - assert(calls.insert(TheCall).second && - "Call instruction occurs multiple times in graph??"); - - if (CS.getRetVal().isNull() && CS.getNumPtrArgs() == 0) - continue; - - // Inline the common callee graph into the current graph, if the callee - // graph has not changed. Note that all callees should have the same - // graph so we only need to do this once. - // - DSGraph* CalleeGraph = NULL; - callee_iterator I = callee_begin(TheCall), E = callee_end(TheCall); - unsigned TNum, Num; - - // Loop over all potential callees to find the first non-external callee. - for (TNum = 0, Num = std::distance(I, E); I != E; ++I, ++TNum) - if (!I->second->isExternal()) - break; - - // Now check if the graph has changed and if so, clone and inline it. - if (I != E) { - Function *CalleeFunc = I->second; - - // Merge the callee's graph into this graph, if not already the same. - // Callees in the same equivalence class (which subsumes those - // in the same SCCs) have the same graph. Note that all recursion - // including self-recursion have been folded in the equiv classes. - // - CalleeGraph = &getOrCreateGraph(*CalleeFunc); - if (CalleeGraph != &G) { - ++NumFoldGraphInlines; - G.mergeInGraph(CS, *CalleeFunc, *CalleeGraph, - DSGraph::StripAllocaBit | - DSGraph::DontCloneCallNodes | - DSGraph::DontCloneAuxCallNodes); - DEBUG(std::cerr << " Inlining graph [" << i << "/" - << G.getFunctionCalls().size()-1 - << ":" << TNum << "/" << Num-1 << "] for " - << CalleeFunc->getName() << "[" - << CalleeGraph->getGraphSize() << "+" - << CalleeGraph->getAuxFunctionCalls().size() - << "] into '" /*<< G.getFunctionNames()*/ << "' [" - << G.getGraphSize() << "+" << G.getAuxFunctionCalls().size() - << "]\n"); - } - } - -#ifndef NDEBUG - // Now loop over the rest of the callees and make sure they have the - // same graph as the one inlined above. - if (CalleeGraph) - for (++I, ++TNum; I != E; ++I, ++TNum) - if (!I->second->isExternal()) - assert(CalleeGraph == &getOrCreateGraph(*I->second) && - "Callees at a call site have different graphs?"); -#endif - } - - // Recompute the Incomplete markers. - G.maskIncompleteMarkers(); - G.markIncompleteNodes(DSGraph::MarkFormalArgs); - - // Delete dead nodes. Treat globals that are unreachable but that can - // reach live nodes as live. - G.removeDeadNodes(DSGraph::KeepUnreachableGlobals); - - // When this graph is finalized, clone the globals in the graph into the - // globals graph to make sure it has everything, from all graphs. - ReachabilityCloner RC(*G.getGlobalsGraph(), G, DSGraph::StripAllocaBit); - - // Clone everything reachable from globals in the function graph into the - // globals graph. - DSScalarMap &MainSM = G.getScalarMap(); - for (DSScalarMap::global_iterator I = MainSM.global_begin(), - E = MainSM.global_end(); I != E; ++I) - RC.getClonedNH(MainSM[*I]); - - DEBUG(std::cerr << " -- DONE ProcessGraph for function " - << G.getFunctionNames() << "\n"); -}
diff --git a/poolalloc/lib/DSA/GraphChecker.cpp b/poolalloc/lib/DSA/GraphChecker.cpp deleted file mode 100644 index f42ea7e..0000000 --- a/poolalloc/lib/DSA/GraphChecker.cpp +++ /dev/null
@@ -1,205 +0,0 @@ -//===- GraphChecker.cpp - Assert that various graph properties hold -------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This pass is used to test DSA with regression tests. It can be used to check -// that certain graph properties hold, such as two nodes being disjoint, whether -// or not a node is collapsed, etc. These are the command line arguments that -// it supports: -// -// --dsgc-dspass={local,bu,td} - Specify what flavor of graph to check -// --dsgc-abort-if-any-collapsed - Abort if any collapsed nodes are found -// --dsgc-abort-if-collapsed=<list> - Abort if a node pointed to by an SSA -// value with name in <list> is collapsed -// --dsgc-check-flags=<list> - Abort if the specified nodes have flags -// that are not specified. -// --dsgc-abort-if-merged=<list> - Abort if any of the named SSA values -// point to the same node. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Value.h" -#include <iostream> -#include <set> - -using namespace llvm; - -namespace { - enum DSPass { local, bu, td }; - cl::opt<DSPass> - DSPass("dsgc-dspass", cl::Hidden, - cl::desc("Specify which DSA pass the -datastructure-gc pass should use"), - cl::values(clEnumVal(local, "Local pass"), - clEnumVal(bu, "Bottom-up pass"), - clEnumVal(td, "Top-down pass"), - clEnumValEnd), cl::init(local)); - - cl::opt<bool> - AbortIfAnyCollapsed("dsgc-abort-if-any-collapsed", cl::Hidden, - cl::desc("Abort if any collapsed nodes are found")); - cl::list<std::string> - AbortIfCollapsed("dsgc-abort-if-collapsed", cl::Hidden, cl::CommaSeparated, - cl::desc("Abort if any of the named symbols is collapsed")); - cl::list<std::string> - CheckFlags("dsgc-check-flags", cl::Hidden, cl::CommaSeparated, - cl::desc("Check that flags are specified for nodes")); - cl::list<std::string> - AbortIfMerged("dsgc-abort-if-merged", cl::Hidden, cl::CommaSeparated, - cl::desc("Abort if any of the named symbols are merged together")); - - struct DSGC : public FunctionPass { - DSGC(); - bool doFinalization(Module &M); - bool runOnFunction(Function &F); - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - switch (DSPass) { - case local: AU.addRequired<LocalDataStructures>(); break; - case bu: AU.addRequired<BUDataStructures>(); break; - case td: AU.addRequired<TDDataStructures>(); break; - } - AU.setPreservesAll(); - } - void print(std::ostream &O, const Module *M) const {} - - private: - void verify(const DSGraph &G); - }; - - RegisterAnalysis<DSGC> X("datastructure-gc", "DSA Graph Checking Pass"); -} - -FunctionPass *llvm::createDataStructureGraphCheckerPass() { - return new DSGC(); -} - - -DSGC::DSGC() { - if (!AbortIfAnyCollapsed && AbortIfCollapsed.empty() && - CheckFlags.empty() && AbortIfMerged.empty()) { - std::cerr << "The -datastructure-gc is useless if you don't specify any" - " -dsgc-* options. See the -help-hidden output for a list.\n"; - abort(); - } -} - - -/// doFinalization - Verify that the globals graph is in good shape... -/// -bool DSGC::doFinalization(Module &M) { - switch (DSPass) { - case local:verify(getAnalysis<LocalDataStructures>().getGlobalsGraph());break; - case bu: verify(getAnalysis<BUDataStructures>().getGlobalsGraph()); break; - case td: verify(getAnalysis<TDDataStructures>().getGlobalsGraph()); break; - } - return false; -} - -/// runOnFunction - Get the DSGraph for this function and verify that it is ok. -/// -bool DSGC::runOnFunction(Function &F) { - switch (DSPass) { - case local: verify(getAnalysis<LocalDataStructures>().getDSGraph(F)); break; - case bu: verify(getAnalysis<BUDataStructures>().getDSGraph(F)); break; - case td: verify(getAnalysis<TDDataStructures>().getDSGraph(F)); break; - } - - return false; -} - -/// verify - This is the function which checks to make sure that all of the -/// invariants established on the command line are true. -/// -void DSGC::verify(const DSGraph &G) { - // Loop over all of the nodes, checking to see if any are collapsed... - if (AbortIfAnyCollapsed) { - for (DSGraph::node_const_iterator I = G.node_begin(), E = G.node_end(); - I != E; ++I) - if (I->isNodeCompletelyFolded()) { - std::cerr << "Node is collapsed: "; - I->print(std::cerr, &G); - abort(); - } - } - - if (!AbortIfCollapsed.empty() || !CheckFlags.empty() || - !AbortIfMerged.empty()) { - // Convert from a list to a set, because we don't have cl::set's yet. FIXME - std::set<std::string> AbortIfCollapsedS(AbortIfCollapsed.begin(), - AbortIfCollapsed.end()); - std::set<std::string> AbortIfMergedS(AbortIfMerged.begin(), - AbortIfMerged.end()); - std::map<std::string, unsigned> CheckFlagsM; - - for (cl::list<std::string>::iterator I = CheckFlags.begin(), - E = CheckFlags.end(); I != E; ++I) { - std::string::size_type ColonPos = I->rfind(':'); - if (ColonPos == std::string::npos) { - std::cerr << "Error: '" << *I - << "' is an invalid value for the --dsgc-check-flags option!\n"; - abort(); - } - - unsigned Flags = 0; - for (unsigned C = ColonPos+1; C != I->size(); ++C) - switch ((*I)[C]) { - case 'S': Flags |= DSNode::AllocaNode; break; - case 'H': Flags |= DSNode::HeapNode; break; - case 'G': Flags |= DSNode::GlobalNode; break; - case 'U': Flags |= DSNode::UnknownNode; break; - case 'I': Flags |= DSNode::Incomplete; break; - case 'M': Flags |= DSNode::Modified; break; - case 'R': Flags |= DSNode::Read; break; - case 'A': Flags |= DSNode::Array; break; - default: std::cerr << "Invalid DSNode flag!\n"; abort(); - } - CheckFlagsM[std::string(I->begin(), I->begin()+ColonPos)] = Flags; - } - - // Now we loop over all of the scalars, checking to see if any are collapsed - // that are not supposed to be, or if any are merged together. - const DSGraph::ScalarMapTy &SM = G.getScalarMap(); - std::map<DSNode*, std::string> AbortIfMergedNodes; - - for (DSGraph::ScalarMapTy::const_iterator I = SM.begin(), E = SM.end(); - I != E; ++I) - if (I->first->hasName() && I->second.getNode()) { - const std::string &Name = I->first->getName(); - DSNode *N = I->second.getNode(); - - // Verify it is not collapsed if it is not supposed to be... - if (N->isNodeCompletelyFolded() && AbortIfCollapsedS.count(Name)) { - std::cerr << "Node for value '%" << Name << "' is collapsed: "; - N->print(std::cerr, &G); - abort(); - } - - if (CheckFlagsM.count(Name) && CheckFlagsM[Name] != N->getNodeFlags()) { - std::cerr << "Node flags are not as expected for node: " << Name - << " (" << CheckFlagsM[Name] << ":" <<N->getNodeFlags() - << ")\n"; - N->print(std::cerr, &G); - abort(); - } - - // Verify that it is not merged if it is not supposed to be... - if (AbortIfMergedS.count(Name)) { - if (AbortIfMergedNodes.count(N)) { - std::cerr << "Nodes for values '%" << Name << "' and '%" - << AbortIfMergedNodes[N] << "' is merged: "; - N->print(std::cerr, &G); - abort(); - } - AbortIfMergedNodes[N] = Name; - } - } - } -}
diff --git a/poolalloc/lib/DSA/Local.cpp b/poolalloc/lib/DSA/Local.cpp deleted file mode 100644 index ecf9532..0000000 --- a/poolalloc/lib/DSA/Local.cpp +++ /dev/null
@@ -1,1310 +0,0 @@ -//===- Local.cpp - Compute a local data structure graph for a function ----===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Compute the local version of the data structure graph for a function. The -// external interface to this file is the DSGraph constructor. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Constants.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Instructions.h" -#include "llvm/Intrinsics.h" -#include "llvm/Support/GetElementPtrTypeIterator.h" -#include "llvm/Support/InstVisitor.h" -#include "llvm/Target/TargetData.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/Debug.h" -#include "llvm/Support/Timer.h" -#include <iostream> - -// FIXME: This should eventually be a FunctionPass that is automatically -// aggregated into a Pass. -// -#include "llvm/Module.h" - -using namespace llvm; - -static RegisterAnalysis<LocalDataStructures> -X("datastructure", "Local Data Structure Analysis"); - -static cl::opt<bool> -TrackIntegersAsPointers("dsa-track-integers", cl::Hidden, - cl::desc("If this is set, track integers as potential pointers")); - -static cl::list<std::string> -AllocList("dsa-alloc-list", - cl::value_desc("list"), - cl::desc("List of functions that allocate memory from the heap"), - cl::CommaSeparated, cl::Hidden); - -static cl::list<std::string> -FreeList("dsa-free-list", - cl::value_desc("list"), - cl::desc("List of functions that free memory from the heap"), - cl::CommaSeparated, cl::Hidden); - -namespace llvm { -namespace DS { - // isPointerType - Return true if this type is big enough to hold a pointer. - bool isPointerType(const Type *Ty) { - if (isa<PointerType>(Ty)) - return true; - else if (TrackIntegersAsPointers && Ty->isPrimitiveType() &&Ty->isInteger()) - return Ty->getPrimitiveSize() >= PointerSize; - return false; - } -}} - -using namespace DS; - -namespace { - cl::opt<bool> - DisableDirectCallOpt("disable-direct-call-dsopt", cl::Hidden, - cl::desc("Disable direct call optimization in " - "DSGraph construction")); - cl::opt<bool> - DisableFieldSensitivity("disable-ds-field-sensitivity", cl::Hidden, - cl::desc("Disable field sensitivity in DSGraphs")); - - //===--------------------------------------------------------------------===// - // GraphBuilder Class - //===--------------------------------------------------------------------===// - // - /// This class is the builder class that constructs the local data structure - /// graph by performing a single pass over the function in question. - /// - class GraphBuilder : InstVisitor<GraphBuilder> { - DSGraph &G; - DSNodeHandle *RetNode; // Node that gets returned... - DSScalarMap &ScalarMap; - std::list<DSCallSite> *FunctionCalls; - - public: - GraphBuilder(Function &f, DSGraph &g, DSNodeHandle &retNode, - std::list<DSCallSite> &fc) - : G(g), RetNode(&retNode), ScalarMap(G.getScalarMap()), - FunctionCalls(&fc) { - - // Create scalar nodes for all pointer arguments... - for (Function::arg_iterator I = f.arg_begin(), E = f.arg_end(); - I != E; ++I) - if (isPointerType(I->getType())) - getValueDest(*I); - - visit(f); // Single pass over the function - } - - // GraphBuilder ctor for working on the globals graph - GraphBuilder(DSGraph &g) - : G(g), RetNode(0), ScalarMap(G.getScalarMap()), FunctionCalls(0) { - } - - void mergeInGlobalInitializer(GlobalVariable *GV); - - private: - // Visitor functions, used to handle each instruction type we encounter... - friend class InstVisitor<GraphBuilder>; - void visitMallocInst(MallocInst &MI) { handleAlloc(MI, true); } - void visitAllocaInst(AllocaInst &AI) { handleAlloc(AI, false); } - void handleAlloc(AllocationInst &AI, bool isHeap); - - void visitPHINode(PHINode &PN); - void visitSelectInst(SelectInst &SI); - - void visitGetElementPtrInst(User &GEP); - void visitReturnInst(ReturnInst &RI); - void visitLoadInst(LoadInst &LI); - void visitStoreInst(StoreInst &SI); - void visitCallInst(CallInst &CI); - void visitInvokeInst(InvokeInst &II); - void visitSetCondInst(SetCondInst &SCI); - void visitFreeInst(FreeInst &FI); - void visitCastInst(CastInst &CI); - void visitInstruction(Instruction &I); - - void visitCallSite(CallSite CS); - void visitVAArgInst(VAArgInst &I); - - void MergeConstantInitIntoNode(DSNodeHandle &NH, Constant *C); - private: - // Helper functions used to implement the visitation functions... - - /// createNode - Create a new DSNode, ensuring that it is properly added to - /// the graph. - /// - DSNode *createNode(const Type *Ty = 0) { - DSNode *N = new DSNode(Ty, &G); // Create the node - if (DisableFieldSensitivity) { - // Create node handle referring to the old node so that it is - // immediately removed from the graph when the node handle is destroyed. - DSNodeHandle OldNNH = N; - N->foldNodeCompletely(); - if (DSNode *FN = N->getForwardNode()) - N = FN; - } - return N; - } - - /// setDestTo - Set the ScalarMap entry for the specified value to point to - /// the specified destination. If the Value already points to a node, make - /// sure to merge the two destinations together. - /// - void setDestTo(Value &V, const DSNodeHandle &NH); - - /// getValueDest - Return the DSNode that the actual value points to. - /// - DSNodeHandle getValueDest(Value &V); - - /// getLink - This method is used to return the specified link in the - /// specified node if one exists. If a link does not already exist (it's - /// null), then we create a new node, link it, then return it. - /// - DSNodeHandle &getLink(const DSNodeHandle &Node, unsigned Link = 0); - }; -} - -using namespace DS; - -//===----------------------------------------------------------------------===// -// DSGraph constructor - Simply use the GraphBuilder to construct the local -// graph. -DSGraph::DSGraph(EquivalenceClasses<GlobalValue*> &ECs, const TargetData &td, - Function &F, DSGraph *GG) - : GlobalsGraph(GG), ScalarMap(ECs), TD(td) { - PrintAuxCalls = false; - - DEBUG(std::cerr << " [Loc] Calculating graph for: " << F.getName() << "\n"); - - // Use the graph builder to construct the local version of the graph - GraphBuilder B(F, *this, ReturnNodes[&F], FunctionCalls); -#ifndef NDEBUG - Timer::addPeakMemoryMeasurement(); -#endif - - // If there are any constant globals referenced in this function, merge their - // initializers into the local graph from the globals graph. - if (ScalarMap.global_begin() != ScalarMap.global_end()) { - ReachabilityCloner RC(*this, *GG, 0); - - for (DSScalarMap::global_iterator I = ScalarMap.global_begin(); - I != ScalarMap.global_end(); ++I) - if (GlobalVariable *GV = dyn_cast<GlobalVariable>(*I)) - if (!GV->isExternal() && GV->isConstant()) - RC.merge(ScalarMap[GV], GG->ScalarMap[GV]); - } - - markIncompleteNodes(DSGraph::MarkFormalArgs); - - // Remove any nodes made dead due to merging... - removeDeadNodes(DSGraph::KeepUnreachableGlobals); -} - - -//===----------------------------------------------------------------------===// -// Helper method implementations... -// - -/// getValueDest - Return the DSNode that the actual value points to. -/// -DSNodeHandle GraphBuilder::getValueDest(Value &Val) { - Value *V = &Val; - if (isa<Constant>(V) && cast<Constant>(V)->isNullValue()) - return 0; // Null doesn't point to anything, don't add to ScalarMap! - - DSNodeHandle &NH = ScalarMap[V]; - if (!NH.isNull()) - return NH; // Already have a node? Just return it... - - // Otherwise we need to create a new node to point to. - // Check first for constant expressions that must be traversed to - // extract the actual value. - DSNode* N; - if (GlobalValue* GV = dyn_cast<GlobalValue>(V)) { - // Create a new global node for this global variable. - N = createNode(GV->getType()->getElementType()); - N->addGlobal(GV); - } else if (Constant *C = dyn_cast<Constant>(V)) { - if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) { - if (CE->getOpcode() == Instruction::Cast) { - if (isa<PointerType>(CE->getOperand(0)->getType())) - NH = getValueDest(*CE->getOperand(0)); - else - NH = createNode()->setUnknownNodeMarker(); - } else if (CE->getOpcode() == Instruction::GetElementPtr) { - visitGetElementPtrInst(*CE); - DSScalarMap::iterator I = ScalarMap.find(CE); - assert(I != ScalarMap.end() && "GEP didn't get processed right?"); - NH = I->second; - } else { - // This returns a conservative unknown node for any unhandled ConstExpr - return NH = createNode()->setUnknownNodeMarker(); - } - if (NH.isNull()) { // (getelementptr null, X) returns null - ScalarMap.erase(V); - return 0; - } - return NH; - } else if (isa<UndefValue>(C)) { - ScalarMap.erase(V); - return 0; - } else { - assert(0 && "Unknown constant type!"); - } - N = createNode(); // just create a shadow node - } else { - // Otherwise just create a shadow node - N = createNode(); - } - - NH.setTo(N, 0); // Remember that we are pointing to it... - return NH; -} - - -/// getLink - This method is used to return the specified link in the -/// specified node if one exists. If a link does not already exist (it's -/// null), then we create a new node, link it, then return it. We must -/// specify the type of the Node field we are accessing so that we know what -/// type should be linked to if we need to create a new node. -/// -DSNodeHandle &GraphBuilder::getLink(const DSNodeHandle &node, unsigned LinkNo) { - DSNodeHandle &Node = const_cast<DSNodeHandle&>(node); - DSNodeHandle &Link = Node.getLink(LinkNo); - if (Link.isNull()) { - // If the link hasn't been created yet, make and return a new shadow node - Link = createNode(); - } - return Link; -} - - -/// setDestTo - Set the ScalarMap entry for the specified value to point to the -/// specified destination. If the Value already points to a node, make sure to -/// merge the two destinations together. -/// -void GraphBuilder::setDestTo(Value &V, const DSNodeHandle &NH) { - ScalarMap[&V].mergeWith(NH); -} - - -//===----------------------------------------------------------------------===// -// Specific instruction type handler implementations... -// - -/// Alloca & Malloc instruction implementation - Simply create a new memory -/// object, pointing the scalar to it. -/// -void GraphBuilder::handleAlloc(AllocationInst &AI, bool isHeap) { - DSNode *N = createNode(); - if (isHeap) - N->setHeapNodeMarker(); - else - N->setAllocaNodeMarker(); - setDestTo(AI, N); -} - -// PHINode - Make the scalar for the PHI node point to all of the things the -// incoming values point to... which effectively causes them to be merged. -// -void GraphBuilder::visitPHINode(PHINode &PN) { - if (!isPointerType(PN.getType())) return; // Only pointer PHIs - - DSNodeHandle &PNDest = ScalarMap[&PN]; - for (unsigned i = 0, e = PN.getNumIncomingValues(); i != e; ++i) - PNDest.mergeWith(getValueDest(*PN.getIncomingValue(i))); -} - -void GraphBuilder::visitSelectInst(SelectInst &SI) { - if (!isPointerType(SI.getType())) return; // Only pointer Selects - - DSNodeHandle &Dest = ScalarMap[&SI]; - Dest.mergeWith(getValueDest(*SI.getOperand(1))); - Dest.mergeWith(getValueDest(*SI.getOperand(2))); -} - -void GraphBuilder::visitSetCondInst(SetCondInst &SCI) { - if (!isPointerType(SCI.getOperand(0)->getType()) || - isa<ConstantPointerNull>(SCI.getOperand(1))) return; // Only pointers - ScalarMap[SCI.getOperand(0)].mergeWith(getValueDest(*SCI.getOperand(1))); -} - - -void GraphBuilder::visitGetElementPtrInst(User &GEP) { - DSNodeHandle Value = getValueDest(*GEP.getOperand(0)); - if (Value.isNull()) - Value = createNode(); - - // As a special case, if all of the index operands of GEP are constant zeros, - // handle this just like we handle casts (ie, don't do much). - bool AllZeros = true; - for (unsigned i = 1, e = GEP.getNumOperands(); i != e; ++i) - if (GEP.getOperand(i) != - Constant::getNullValue(GEP.getOperand(i)->getType())) { - AllZeros = false; - break; - } - - // If all of the indices are zero, the result points to the operand without - // applying the type. - if (AllZeros || (!Value.isNull() && - Value.getNode()->isNodeCompletelyFolded())) { - setDestTo(GEP, Value); - return; - } - - - const PointerType *PTy = cast<PointerType>(GEP.getOperand(0)->getType()); - const Type *CurTy = PTy->getElementType(); - - if (Value.getNode()->mergeTypeInfo(CurTy, Value.getOffset())) { - // If the node had to be folded... exit quickly - setDestTo(GEP, Value); // GEP result points to folded node - return; - } - - const TargetData &TD = Value.getNode()->getTargetData(); - -#if 0 - // Handle the pointer index specially... - if (GEP.getNumOperands() > 1 && - (!isa<Constant>(GEP.getOperand(1)) || - !cast<Constant>(GEP.getOperand(1))->isNullValue())) { - - // If we already know this is an array being accessed, don't do anything... - if (!TopTypeRec.isArray) { - TopTypeRec.isArray = true; - - // If we are treating some inner field pointer as an array, fold the node - // up because we cannot handle it right. This can come because of - // something like this: &((&Pt->X)[1]) == &Pt->Y - // - if (Value.getOffset()) { - // Value is now the pointer we want to GEP to be... - Value.getNode()->foldNodeCompletely(); - setDestTo(GEP, Value); // GEP result points to folded node - return; - } else { - // This is a pointer to the first byte of the node. Make sure that we - // are pointing to the outter most type in the node. - // FIXME: We need to check one more case here... - } - } - } -#endif - - // All of these subscripts are indexing INTO the elements we have... - unsigned Offset = 0; - for (gep_type_iterator I = gep_type_begin(GEP), E = gep_type_end(GEP); - I != E; ++I) - if (const StructType *STy = dyn_cast<StructType>(*I)) { - unsigned FieldNo = - (unsigned)cast<ConstantUInt>(I.getOperand())->getValue(); - Offset += (unsigned)TD.getStructLayout(STy)->MemberOffsets[FieldNo]; - } else if (const PointerType *PTy = dyn_cast<PointerType>(*I)) { - if (!isa<Constant>(I.getOperand()) || - !cast<Constant>(I.getOperand())->isNullValue()) - Value.getNode()->setArrayMarker(); - } - - -#if 0 - if (const SequentialType *STy = cast<SequentialType>(*I)) { - CurTy = STy->getElementType(); - if (ConstantSInt *CS = dyn_cast<ConstantSInt>(GEP.getOperand(i))) { - Offset += CS->getValue()*TD.getTypeSize(CurTy); - } else { - // Variable index into a node. We must merge all of the elements of the - // sequential type here. - if (isa<PointerType>(STy)) - std::cerr << "Pointer indexing not handled yet!\n"; - else { - const ArrayType *ATy = cast<ArrayType>(STy); - unsigned ElSize = TD.getTypeSize(CurTy); - DSNode *N = Value.getNode(); - assert(N && "Value must have a node!"); - unsigned RawOffset = Offset+Value.getOffset(); - - // Loop over all of the elements of the array, merging them into the - // zeroth element. - for (unsigned i = 1, e = ATy->getNumElements(); i != e; ++i) - // Merge all of the byte components of this array element - for (unsigned j = 0; j != ElSize; ++j) - N->mergeIndexes(RawOffset+j, RawOffset+i*ElSize+j); - } - } - } -#endif - - // Add in the offset calculated... - Value.setOffset(Value.getOffset()+Offset); - - // Check the offset - DSNode *N = Value.getNode(); - if (N && - !N->isNodeCompletelyFolded() && - (N->getSize() != 0 || Offset != 0) && - !N->isForwarding()) { - if ((Offset >= N->getSize()) || int(Offset) < 0) { - // Accessing offsets out of node size range - // This is seen in the "magic" struct in named (from bind), where the - // fourth field is an array of length 0, presumably used to create struct - // instances of different sizes - - // Collapse the node since its size is now variable - N->foldNodeCompletely(); - } - } - - // Value is now the pointer we want to GEP to be... - setDestTo(GEP, Value); -} - -void GraphBuilder::visitLoadInst(LoadInst &LI) { - DSNodeHandle Ptr = getValueDest(*LI.getOperand(0)); - if (Ptr.isNull()) - Ptr = createNode(); - - // Make that the node is read from... - Ptr.getNode()->setReadMarker(); - - // Ensure a typerecord exists... - Ptr.getNode()->mergeTypeInfo(LI.getType(), Ptr.getOffset(), false); - - if (isPointerType(LI.getType())) - setDestTo(LI, getLink(Ptr)); -} - -void GraphBuilder::visitStoreInst(StoreInst &SI) { - const Type *StoredTy = SI.getOperand(0)->getType(); - DSNodeHandle Dest = getValueDest(*SI.getOperand(1)); - if (Dest.isNull()) return; - - // Mark that the node is written to... - Dest.getNode()->setModifiedMarker(); - - // Ensure a type-record exists... - Dest.getNode()->mergeTypeInfo(StoredTy, Dest.getOffset()); - - // Avoid adding edges from null, or processing non-"pointer" stores - if (isPointerType(StoredTy)) - Dest.addEdgeTo(getValueDest(*SI.getOperand(0))); -} - -void GraphBuilder::visitReturnInst(ReturnInst &RI) { - if (RI.getNumOperands() && isPointerType(RI.getOperand(0)->getType())) - RetNode->mergeWith(getValueDest(*RI.getOperand(0))); -} - -void GraphBuilder::visitVAArgInst(VAArgInst &I) { - //FIXME: also updates the argument - DSNodeHandle Ptr = getValueDest(*I.getOperand(0)); - if (Ptr.isNull()) return; - - // Make that the node is read from. - Ptr.getNode()->setReadMarker(); - - // Ensure a type record exists. - DSNode *PtrN = Ptr.getNode(); - PtrN->mergeTypeInfo(I.getType(), Ptr.getOffset(), false); - - if (isPointerType(I.getType())) - setDestTo(I, getLink(Ptr)); -} - - -void GraphBuilder::visitCallInst(CallInst &CI) { - visitCallSite(&CI); -} - -void GraphBuilder::visitInvokeInst(InvokeInst &II) { - visitCallSite(&II); -} - -void GraphBuilder::visitCallSite(CallSite CS) { - Value *Callee = CS.getCalledValue(); - - // Special case handling of certain libc allocation functions here. - if (Function *F = dyn_cast<Function>(Callee)) - if (F->isExternal()) - switch (F->getIntrinsicID()) { - case Intrinsic::vastart: - getValueDest(*CS.getInstruction()).getNode()->setAllocaNodeMarker(); - return; - case Intrinsic::vacopy: - getValueDest(*CS.getInstruction()). - mergeWith(getValueDest(**(CS.arg_begin()))); - return; - case Intrinsic::vaend: - return; // noop - case Intrinsic::memcpy_i32: - case Intrinsic::memcpy_i64: - case Intrinsic::memmove_i32: - case Intrinsic::memmove_i64: { - // Merge the first & second arguments, and mark the memory read and - // modified. - DSNodeHandle RetNH = getValueDest(**CS.arg_begin()); - RetNH.mergeWith(getValueDest(**(CS.arg_begin()+1))); - if (DSNode *N = RetNH.getNode()) - N->setModifiedMarker()->setReadMarker(); - return; - } - case Intrinsic::memset_i32: - case Intrinsic::memset_i64: - // Mark the memory modified. - if (DSNode *N = getValueDest(**CS.arg_begin()).getNode()) - N->setModifiedMarker(); - return; - default: - // Determine if the called function is one of the specified heap - // allocation functions - for (cl::list<std::string>::iterator AllocFunc = AllocList.begin(), - LastAllocFunc = AllocList.end(); - AllocFunc != LastAllocFunc; - ++AllocFunc) { - if (F->getName() == *(AllocFunc)) { - setDestTo(*CS.getInstruction(), - createNode()->setHeapNodeMarker()->setModifiedMarker()); - return; - } - } - - // Determine if the called function is one of the specified heap - // free functions - for (cl::list<std::string>::iterator FreeFunc = FreeList.begin(), - LastFreeFunc = FreeList.end(); - FreeFunc != LastFreeFunc; - ++FreeFunc) { - if (F->getName() == *(FreeFunc)) { - // Mark that the node is written to... - if (DSNode *N = getValueDest(*(CS.getArgument(0))).getNode()) - N->setModifiedMarker()->setHeapNodeMarker(); - return; - } - } - - //gets select localtime ioctl - - if ((F->isExternal() && F->getName() == "calloc") - || F->getName() == "posix_memalign" - || F->getName() == "memalign" || F->getName() == "valloc") { - setDestTo(*CS.getInstruction(), - createNode()->setHeapNodeMarker()->setModifiedMarker()); - return; - } else if (F->getName() == "realloc") { - DSNodeHandle RetNH = getValueDest(*CS.getInstruction()); - if (CS.arg_begin() != CS.arg_end()) - RetNH.mergeWith(getValueDest(**CS.arg_begin())); - if (DSNode *N = RetNH.getNode()) - N->setHeapNodeMarker()->setModifiedMarker()->setReadMarker(); - return; - } else if (F->getName() == "memmove") { - // Merge the first & second arguments, and mark the memory read and - // modified. - DSNodeHandle RetNH = getValueDest(**CS.arg_begin()); - RetNH.mergeWith(getValueDest(**(CS.arg_begin()+1))); - if (DSNode *N = RetNH.getNode()) - N->setModifiedMarker()->setReadMarker(); - return; - } else if (F->getName() == "free") { - // Mark that the node is written to... - if (DSNode *N = getValueDest(**CS.arg_begin()).getNode()) - N->setModifiedMarker()->setHeapNodeMarker(); - } else if (F->getName() == "atoi" || F->getName() == "atof" || - F->getName() == "atol" || F->getName() == "atoll" || - F->getName() == "remove" || F->getName() == "unlink" || - F->getName() == "rename" || F->getName() == "memcmp" || - F->getName() == "strcmp" || F->getName() == "strncmp" || - F->getName() == "execl" || F->getName() == "execlp" || - F->getName() == "execle" || F->getName() == "execv" || - F->getName() == "execvp" || F->getName() == "chmod" || - F->getName() == "puts" || F->getName() == "write" || - F->getName() == "open" || F->getName() == "create" || - F->getName() == "truncate" || F->getName() == "chdir" || - F->getName() == "mkdir" || F->getName() == "rmdir" || - F->getName() == "strlen") { - // These functions read all of their pointer operands. - for (CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); - AI != E; ++AI) { - if (isPointerType((*AI)->getType())) - if (DSNode *N = getValueDest(**AI).getNode()) - N->setReadMarker(); - } - return; - } else if (F->getName() == "memchr") { - DSNodeHandle RetNH = getValueDest(**CS.arg_begin()); - DSNodeHandle Result = getValueDest(*CS.getInstruction()); - RetNH.mergeWith(Result); - if (DSNode *N = RetNH.getNode()) - N->setReadMarker(); - return; - } else if (F->getName() == "read" || F->getName() == "pipe" || - F->getName() == "wait" || F->getName() == "time" || - F->getName() == "getrusage") { - // These functions write all of their pointer operands. - for (CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); - AI != E; ++AI) { - if (isPointerType((*AI)->getType())) - if (DSNode *N = getValueDest(**AI).getNode()) - N->setModifiedMarker(); - } - return; - } else if (F->getName() == "stat" || F->getName() == "fstat" || - F->getName() == "lstat") { - // These functions read their first operand if its a pointer. - CallSite::arg_iterator AI = CS.arg_begin(); - if (isPointerType((*AI)->getType())) { - DSNodeHandle Path = getValueDest(**AI); - if (DSNode *N = Path.getNode()) N->setReadMarker(); - } - - // Then they write into the stat buffer. - DSNodeHandle StatBuf = getValueDest(**++AI); - if (DSNode *N = StatBuf.getNode()) { - N->setModifiedMarker(); - const Type *StatTy = F->getFunctionType()->getParamType(1); - if (const PointerType *PTy = dyn_cast<PointerType>(StatTy)) - N->mergeTypeInfo(PTy->getElementType(), StatBuf.getOffset()); - } - return; - } else if (F->getName() == "strtod" || F->getName() == "strtof" || - F->getName() == "strtold") { - // These functions read the first pointer - if (DSNode *Str = getValueDest(**CS.arg_begin()).getNode()) { - Str->setReadMarker(); - // If the second parameter is passed, it will point to the first - // argument node. - const DSNodeHandle &EndPtrNH = getValueDest(**(CS.arg_begin()+1)); - if (DSNode *End = EndPtrNH.getNode()) { - End->mergeTypeInfo(PointerType::get(Type::SByteTy), - EndPtrNH.getOffset(), false); - End->setModifiedMarker(); - DSNodeHandle &Link = getLink(EndPtrNH); - Link.mergeWith(getValueDest(**CS.arg_begin())); - } - } - return; - } else if (F->getName() == "fopen" || F->getName() == "fdopen" || - F->getName() == "freopen") { - // These functions read all of their pointer operands. - for (CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); - AI != E; ++AI) - if (isPointerType((*AI)->getType())) - if (DSNode *N = getValueDest(**AI).getNode()) - N->setReadMarker(); - - // fopen allocates in an unknown way and writes to the file - // descriptor. Also, merge the allocated type into the node. - DSNodeHandle Result = getValueDest(*CS.getInstruction()); - if (DSNode *N = Result.getNode()) { - N->setModifiedMarker()->setUnknownNodeMarker(); - const Type *RetTy = F->getFunctionType()->getReturnType(); - if (const PointerType *PTy = dyn_cast<PointerType>(RetTy)) - N->mergeTypeInfo(PTy->getElementType(), Result.getOffset()); - } - - // If this is freopen, merge the file descriptor passed in with the - // result. - if (F->getName() == "freopen") { - // ICC doesn't handle getting the iterator, decrementing and - // dereferencing it in one operation without error. Do it in 2 steps - CallSite::arg_iterator compit = CS.arg_end(); - Result.mergeWith(getValueDest(**--compit)); - } - return; - } else if (F->getName() == "fclose" && CS.arg_end()-CS.arg_begin() ==1){ - // fclose reads and deallocates the memory in an unknown way for the - // file descriptor. It merges the FILE type into the descriptor. - DSNodeHandle H = getValueDest(**CS.arg_begin()); - if (DSNode *N = H.getNode()) { - N->setReadMarker()->setUnknownNodeMarker(); - const Type *ArgTy = F->getFunctionType()->getParamType(0); - if (const PointerType *PTy = dyn_cast<PointerType>(ArgTy)) - N->mergeTypeInfo(PTy->getElementType(), H.getOffset()); - } - return; - } else if (CS.arg_end()-CS.arg_begin() == 1 && - (F->getName() == "fflush" || F->getName() == "feof" || - F->getName() == "fileno" || F->getName() == "clearerr" || - F->getName() == "rewind" || F->getName() == "ftell" || - F->getName() == "ferror" || F->getName() == "fgetc" || - F->getName() == "fgetc" || F->getName() == "_IO_getc")) { - // fflush reads and writes the memory for the file descriptor. It - // merges the FILE type into the descriptor. - DSNodeHandle H = getValueDest(**CS.arg_begin()); - if (DSNode *N = H.getNode()) { - N->setReadMarker()->setModifiedMarker(); - - const Type *ArgTy = F->getFunctionType()->getParamType(0); - if (const PointerType *PTy = dyn_cast<PointerType>(ArgTy)) - N->mergeTypeInfo(PTy->getElementType(), H.getOffset()); - } - return; - } else if (CS.arg_end()-CS.arg_begin() == 4 && - (F->getName() == "fwrite" || F->getName() == "fread")) { - // fread writes the first operand, fwrite reads it. They both - // read/write the FILE descriptor, and merges the FILE type. - CallSite::arg_iterator compit = CS.arg_end(); - DSNodeHandle H = getValueDest(**--compit); - if (DSNode *N = H.getNode()) { - N->setReadMarker()->setModifiedMarker(); - const Type *ArgTy = F->getFunctionType()->getParamType(3); - if (const PointerType *PTy = dyn_cast<PointerType>(ArgTy)) - N->mergeTypeInfo(PTy->getElementType(), H.getOffset()); - } - - H = getValueDest(**CS.arg_begin()); - if (DSNode *N = H.getNode()) - if (F->getName() == "fwrite") - N->setReadMarker(); - else - N->setModifiedMarker(); - return; - } else if (F->getName() == "fgets" && CS.arg_end()-CS.arg_begin() == 3){ - // fgets reads and writes the memory for the file descriptor. It - // merges the FILE type into the descriptor, and writes to the - // argument. It returns the argument as well. - CallSite::arg_iterator AI = CS.arg_begin(); - DSNodeHandle H = getValueDest(**AI); - if (DSNode *N = H.getNode()) - N->setModifiedMarker(); // Writes buffer - H.mergeWith(getValueDest(*CS.getInstruction())); // Returns buffer - ++AI; ++AI; - - // Reads and writes file descriptor, merge in FILE type. - H = getValueDest(**AI); - if (DSNode *N = H.getNode()) { - N->setReadMarker()->setModifiedMarker(); - const Type *ArgTy = F->getFunctionType()->getParamType(2); - if (const PointerType *PTy = dyn_cast<PointerType>(ArgTy)) - N->mergeTypeInfo(PTy->getElementType(), H.getOffset()); - } - return; - } else if (F->getName() == "ungetc" || F->getName() == "fputc" || - F->getName() == "fputs" || F->getName() == "putc" || - F->getName() == "ftell" || F->getName() == "rewind" || - F->getName() == "_IO_putc") { - // These functions read and write the memory for the file descriptor, - // which is passes as the last argument. - CallSite::arg_iterator compit = CS.arg_end(); - DSNodeHandle H = getValueDest(**--compit); - if (DSNode *N = H.getNode()) { - N->setReadMarker()->setModifiedMarker(); - FunctionType::param_iterator compit2 = F->getFunctionType()->param_end(); - const Type *ArgTy = *--compit2; - if (const PointerType *PTy = dyn_cast<PointerType>(ArgTy)) - N->mergeTypeInfo(PTy->getElementType(), H.getOffset()); - } - - // Any pointer arguments are read. - for (CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); - AI != E; ++AI) - if (isPointerType((*AI)->getType())) - if (DSNode *N = getValueDest(**AI).getNode()) - N->setReadMarker(); - return; - } else if (F->getName() == "fseek" || F->getName() == "fgetpos" || - F->getName() == "fsetpos") { - // These functions read and write the memory for the file descriptor, - // and read/write all other arguments. - DSNodeHandle H = getValueDest(**CS.arg_begin()); - if (DSNode *N = H.getNode()) { - FunctionType::param_iterator compit2 = F->getFunctionType()->param_end(); - const Type *ArgTy = *--compit2; - if (const PointerType *PTy = dyn_cast<PointerType>(ArgTy)) - N->mergeTypeInfo(PTy->getElementType(), H.getOffset()); - } - - // Any pointer arguments are read. - for (CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); - AI != E; ++AI) - if (isPointerType((*AI)->getType())) - if (DSNode *N = getValueDest(**AI).getNode()) - N->setReadMarker()->setModifiedMarker(); - return; - } else if (F->getName() == "printf" || F->getName() == "fprintf" || - F->getName() == "sprintf") { - CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); - - if (F->getName() == "fprintf") { - // fprintf reads and writes the FILE argument, and applies the type - // to it. - DSNodeHandle H = getValueDest(**AI); - if (DSNode *N = H.getNode()) { - N->setModifiedMarker(); - const Type *ArgTy = (*AI)->getType(); - if (const PointerType *PTy = dyn_cast<PointerType>(ArgTy)) - N->mergeTypeInfo(PTy->getElementType(), H.getOffset()); - } - } else if (F->getName() == "sprintf") { - // sprintf writes the first string argument. - DSNodeHandle H = getValueDest(**AI++); - if (DSNode *N = H.getNode()) { - N->setModifiedMarker(); - const Type *ArgTy = (*AI)->getType(); - if (const PointerType *PTy = dyn_cast<PointerType>(ArgTy)) - N->mergeTypeInfo(PTy->getElementType(), H.getOffset()); - } - } - - for (; AI != E; ++AI) { - // printf reads all pointer arguments. - if (isPointerType((*AI)->getType())) - if (DSNode *N = getValueDest(**AI).getNode()) - N->setReadMarker(); - } - return; - } else if (F->getName() == "vprintf" || F->getName() == "vfprintf" || - F->getName() == "vsprintf") { - CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); - - if (F->getName() == "vfprintf") { - // ffprintf reads and writes the FILE argument, and applies the type - // to it. - DSNodeHandle H = getValueDest(**AI); - if (DSNode *N = H.getNode()) { - N->setModifiedMarker()->setReadMarker(); - const Type *ArgTy = (*AI)->getType(); - if (const PointerType *PTy = dyn_cast<PointerType>(ArgTy)) - N->mergeTypeInfo(PTy->getElementType(), H.getOffset()); - } - ++AI; - } else if (F->getName() == "vsprintf") { - // vsprintf writes the first string argument. - DSNodeHandle H = getValueDest(**AI++); - if (DSNode *N = H.getNode()) { - N->setModifiedMarker(); - const Type *ArgTy = (*AI)->getType(); - if (const PointerType *PTy = dyn_cast<PointerType>(ArgTy)) - N->mergeTypeInfo(PTy->getElementType(), H.getOffset()); - } - } - - // Read the format - if (AI != E) { - if (isPointerType((*AI)->getType())) - if (DSNode *N = getValueDest(**AI).getNode()) - N->setReadMarker(); - ++AI; - } - - // Read the valist, and the pointed-to objects. - if (AI != E && isPointerType((*AI)->getType())) { - const DSNodeHandle &VAList = getValueDest(**AI); - if (DSNode *N = VAList.getNode()) { - N->setReadMarker(); - N->mergeTypeInfo(PointerType::get(Type::SByteTy), - VAList.getOffset(), false); - - DSNodeHandle &VAListObjs = getLink(VAList); - VAListObjs.getNode()->setReadMarker(); - } - } - - return; - } else if (F->getName() == "scanf" || F->getName() == "fscanf" || - F->getName() == "sscanf") { - CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); - - if (F->getName() == "fscanf") { - // fscanf reads and writes the FILE argument, and applies the type - // to it. - DSNodeHandle H = getValueDest(**AI); - if (DSNode *N = H.getNode()) { - N->setReadMarker(); - const Type *ArgTy = (*AI)->getType(); - if (const PointerType *PTy = dyn_cast<PointerType>(ArgTy)) - N->mergeTypeInfo(PTy->getElementType(), H.getOffset()); - } - } else if (F->getName() == "sscanf") { - // sscanf reads the first string argument. - DSNodeHandle H = getValueDest(**AI++); - if (DSNode *N = H.getNode()) { - N->setReadMarker(); - const Type *ArgTy = (*AI)->getType(); - if (const PointerType *PTy = dyn_cast<PointerType>(ArgTy)) - N->mergeTypeInfo(PTy->getElementType(), H.getOffset()); - } - } - - for (; AI != E; ++AI) { - // scanf writes all pointer arguments. - if (isPointerType((*AI)->getType())) - if (DSNode *N = getValueDest(**AI).getNode()) - N->setModifiedMarker(); - } - return; - } else if (F->getName() == "strtok") { - // strtok reads and writes the first argument, returning it. It reads - // its second arg. FIXME: strtok also modifies some hidden static - // data. Someday this might matter. - CallSite::arg_iterator AI = CS.arg_begin(); - DSNodeHandle H = getValueDest(**AI++); - if (DSNode *N = H.getNode()) { - N->setReadMarker()->setModifiedMarker(); // Reads/Writes buffer - const Type *ArgTy = F->getFunctionType()->getParamType(0); - if (const PointerType *PTy = dyn_cast<PointerType>(ArgTy)) - N->mergeTypeInfo(PTy->getElementType(), H.getOffset()); - } - H.mergeWith(getValueDest(*CS.getInstruction())); // Returns buffer - - H = getValueDest(**AI); // Reads delimiter - if (DSNode *N = H.getNode()) { - N->setReadMarker(); - const Type *ArgTy = F->getFunctionType()->getParamType(1); - if (const PointerType *PTy = dyn_cast<PointerType>(ArgTy)) - N->mergeTypeInfo(PTy->getElementType(), H.getOffset()); - } - return; - } else if (F->getName() == "strchr" || F->getName() == "strrchr" || - F->getName() == "strstr") { - // These read their arguments, and return the first one - DSNodeHandle H = getValueDest(**CS.arg_begin()); - H.mergeWith(getValueDest(*CS.getInstruction())); // Returns buffer - - for (CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); - AI != E; ++AI) - if (isPointerType((*AI)->getType())) - if (DSNode *N = getValueDest(**AI).getNode()) - N->setReadMarker(); - - if (DSNode *N = H.getNode()) - N->setReadMarker(); - return; - } else if (F->getName() == "__assert_fail") { - for (CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); - AI != E; ++AI) - if (isPointerType((*AI)->getType())) - if (DSNode *N = getValueDest(**AI).getNode()) - N->setReadMarker(); - return; - } else if (F->getName() == "modf" && CS.arg_end()-CS.arg_begin() == 2) { - // This writes its second argument, and forces it to double. - CallSite::arg_iterator compit = CS.arg_end(); - DSNodeHandle H = getValueDest(**--compit); - if (DSNode *N = H.getNode()) { - N->setModifiedMarker(); - N->mergeTypeInfo(Type::DoubleTy, H.getOffset()); - } - return; - } else if (F->getName() == "strcat" || F->getName() == "strncat") { - //This might be making unsafe assumptions about usage - //Merge return and first arg - DSNodeHandle RetNH = getValueDest(*CS.getInstruction()); - RetNH.mergeWith(getValueDest(**CS.arg_begin())); - if (DSNode *N = RetNH.getNode()) - N->setHeapNodeMarker()->setModifiedMarker()->setReadMarker(); - //and read second pointer - if (DSNode *N = getValueDest(**(CS.arg_begin() + 1)).getNode()) - N->setReadMarker(); - return; - } else if (F->getName() == "strcpy" || F->getName() == "strncpy") { - //This might be making unsafe assumptions about usage - //Merge return and first arg - DSNodeHandle RetNH = getValueDest(*CS.getInstruction()); - RetNH.mergeWith(getValueDest(**CS.arg_begin())); - if (DSNode *N = RetNH.getNode()) - N->setHeapNodeMarker()->setModifiedMarker(); - //and read second pointer - if (DSNode *N = getValueDest(**(CS.arg_begin() + 1)).getNode()) - N->setReadMarker(); - return; - } else { - // Unknown function, warn if it returns a pointer type or takes a - // pointer argument. - bool Warn = isPointerType(CS.getInstruction()->getType()); - if (!Warn) - for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end(); - I != E; ++I) - if (isPointerType((*I)->getType())) { - Warn = true; - break; - } - if (Warn) - std::cerr << "WARNING: Call to unknown external function '" - << F->getName() << "' will cause pessimistic results!\n"; - } - } - - - // Set up the return value... - DSNodeHandle RetVal; - Instruction *I = CS.getInstruction(); - if (isPointerType(I->getType())) - RetVal = getValueDest(*I); - - DSNode *CalleeNode = 0; - if (DisableDirectCallOpt || !isa<Function>(Callee)) { - CalleeNode = getValueDest(*Callee).getNode(); - if (CalleeNode == 0) { - std::cerr << "WARNING: Program is calling through a null pointer?\n"<< *I; - return; // Calling a null pointer? - } - } - - std::vector<DSNodeHandle> Args; - Args.reserve(CS.arg_end()-CS.arg_begin()); - - // Calculate the arguments vector... - for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end(); I != E; ++I) - if (isPointerType((*I)->getType())) - Args.push_back(getValueDest(**I)); - - // Add a new function call entry... - if (CalleeNode) - FunctionCalls->push_back(DSCallSite(CS, RetVal, CalleeNode, Args)); - else - FunctionCalls->push_back(DSCallSite(CS, RetVal, cast<Function>(Callee), - Args)); -} - -void GraphBuilder::visitFreeInst(FreeInst &FI) { - // Mark that the node is written to... - if (DSNode *N = getValueDest(*FI.getOperand(0)).getNode()) - N->setModifiedMarker()->setHeapNodeMarker(); -} - -/// Handle casts... -void GraphBuilder::visitCastInst(CastInst &CI) { - if (isPointerType(CI.getType())) - if (isPointerType(CI.getOperand(0)->getType())) { - DSNodeHandle Ptr = getValueDest(*CI.getOperand(0)); - if (Ptr.getNode() == 0) return; - - // Cast one pointer to the other, just act like a copy instruction - setDestTo(CI, Ptr); - } else { - // Cast something (floating point, small integer) to a pointer. We need - // to track the fact that the node points to SOMETHING, just something we - // don't know about. Make an "Unknown" node. - // - setDestTo(CI, createNode()->setUnknownNodeMarker()); - } -} - - -// visitInstruction - For all other instruction types, if we have any arguments -// that are of pointer type, make them have unknown composition bits, and merge -// the nodes together. -void GraphBuilder::visitInstruction(Instruction &Inst) { - DSNodeHandle CurNode; - if (isPointerType(Inst.getType())) - CurNode = getValueDest(Inst); - for (User::op_iterator I = Inst.op_begin(), E = Inst.op_end(); I != E; ++I) - if (isPointerType((*I)->getType())) - CurNode.mergeWith(getValueDest(**I)); - - if (DSNode *N = CurNode.getNode()) - N->setUnknownNodeMarker(); -} - - - -//===----------------------------------------------------------------------===// -// LocalDataStructures Implementation -//===----------------------------------------------------------------------===// - -// MergeConstantInitIntoNode - Merge the specified constant into the node -// pointed to by NH. -void GraphBuilder::MergeConstantInitIntoNode(DSNodeHandle &NH, Constant *C) { - // Ensure a type-record exists... - DSNode *NHN = NH.getNode(); - NHN->mergeTypeInfo(C->getType(), NH.getOffset()); - - if (C->getType()->isFirstClassType()) { - if (isPointerType(C->getType())) - // Avoid adding edges from null, or processing non-"pointer" stores - NH.addEdgeTo(getValueDest(*C)); - return; - } - - const TargetData &TD = NH.getNode()->getTargetData(); - - if (ConstantArray *CA = dyn_cast<ConstantArray>(C)) { - for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) - // We don't currently do any indexing for arrays... - MergeConstantInitIntoNode(NH, cast<Constant>(CA->getOperand(i))); - } else if (ConstantStruct *CS = dyn_cast<ConstantStruct>(C)) { - const StructLayout *SL = TD.getStructLayout(CS->getType()); - for (unsigned i = 0, e = CS->getNumOperands(); i != e; ++i) { - DSNode *NHN = NH.getNode(); - //Some programmers think ending a structure with a [0 x sbyte] is cute - if (SL->MemberOffsets[i] < SL->StructSize) { - DSNodeHandle NewNH(NHN, NH.getOffset()+(unsigned)SL->MemberOffsets[i]); - MergeConstantInitIntoNode(NewNH, cast<Constant>(CS->getOperand(i))); - } else if (SL->MemberOffsets[i] == SL->StructSize) { - DEBUG(std::cerr << "Zero size element at end of struct\n"); - NHN->foldNodeCompletely(); - } else { - assert(0 && "type was smaller than offsets of of struct layout indicate"); - } - } - } else if (isa<ConstantAggregateZero>(C) || isa<UndefValue>(C)) { - // Noop - } else { - assert(0 && "Unknown constant type!"); - } -} - -void GraphBuilder::mergeInGlobalInitializer(GlobalVariable *GV) { - assert(!GV->isExternal() && "Cannot merge in external global!"); - // Get a node handle to the global node and merge the initializer into it. - DSNodeHandle NH = getValueDest(*GV); - MergeConstantInitIntoNode(NH, GV->getInitializer()); -} - - -/// BuildGlobalECs - Look at all of the nodes in the globals graph. If any node -/// contains multiple globals, DSA will never, ever, be able to tell the globals -/// apart. Instead of maintaining this information in all of the graphs -/// throughout the entire program, store only a single global (the "leader") in -/// the graphs, and build equivalence classes for the rest of the globals. -static void BuildGlobalECs(DSGraph &GG, std::set<GlobalValue*> &ECGlobals) { - DSScalarMap &SM = GG.getScalarMap(); - EquivalenceClasses<GlobalValue*> &GlobalECs = SM.getGlobalECs(); - for (DSGraph::node_iterator I = GG.node_begin(), E = GG.node_end(); - I != E; ++I) { - if (I->getGlobalsList().size() <= 1) continue; - - // First, build up the equivalence set for this block of globals. - const std::vector<GlobalValue*> &GVs = I->getGlobalsList(); - GlobalValue *First = GVs[0]; - for (unsigned i = 1, e = GVs.size(); i != e; ++i) - GlobalECs.unionSets(First, GVs[i]); - - // Next, get the leader element. - assert(First == GlobalECs.getLeaderValue(First) && - "First did not end up being the leader?"); - - // Next, remove all globals from the scalar map that are not the leader. - assert(GVs[0] == First && "First had to be at the front!"); - for (unsigned i = 1, e = GVs.size(); i != e; ++i) { - ECGlobals.insert(GVs[i]); - SM.erase(SM.find(GVs[i])); - } - - // Finally, change the global node to only contain the leader. - I->clearGlobals(); - I->addGlobal(First); - } - - DEBUG(GG.AssertGraphOK()); -} - -/// EliminateUsesOfECGlobals - Once we have determined that some globals are in -/// really just equivalent to some other globals, remove the globals from the -/// specified DSGraph (if present), and merge any nodes with their leader nodes. -static void EliminateUsesOfECGlobals(DSGraph &G, - const std::set<GlobalValue*> &ECGlobals) { - DSScalarMap &SM = G.getScalarMap(); - EquivalenceClasses<GlobalValue*> &GlobalECs = SM.getGlobalECs(); - - bool MadeChange = false; - for (DSScalarMap::global_iterator GI = SM.global_begin(), E = SM.global_end(); - GI != E; ) { - GlobalValue *GV = *GI++; - if (!ECGlobals.count(GV)) continue; - - const DSNodeHandle &GVNH = SM[GV]; - assert(!GVNH.isNull() && "Global has null NH!?"); - - // Okay, this global is in some equivalence class. Start by finding the - // leader of the class. - GlobalValue *Leader = GlobalECs.getLeaderValue(GV); - - // If the leader isn't already in the graph, insert it into the node - // corresponding to GV. - if (!SM.global_count(Leader)) { - GVNH.getNode()->addGlobal(Leader); - SM[Leader] = GVNH; - } else { - // Otherwise, the leader is in the graph, make sure the nodes are the - // merged in the specified graph. - const DSNodeHandle &LNH = SM[Leader]; - if (LNH.getNode() != GVNH.getNode()) - LNH.mergeWith(GVNH); - } - - // Next step, remove the global from the DSNode. - GVNH.getNode()->removeGlobal(GV); - - // Finally, remove the global from the ScalarMap. - SM.erase(GV); - MadeChange = true; - } - - DEBUG(if(MadeChange) G.AssertGraphOK()); -} - -bool LocalDataStructures::runOnModule(Module &M) { - const TargetData &TD = getAnalysis<TargetData>(); - - // First step, build the globals graph. - GlobalsGraph = new DSGraph(GlobalECs, TD); - { - GraphBuilder GGB(*GlobalsGraph); - - // Add initializers for all of the globals to the globals graph. - for (Module::global_iterator I = M.global_begin(), E = M.global_end(); - I != E; ++I) - if (!I->isExternal()) - GGB.mergeInGlobalInitializer(I); - } - - // Next step, iterate through the nodes in the globals graph, unioning - // together the globals into equivalence classes. - std::set<GlobalValue*> ECGlobals; - BuildGlobalECs(*GlobalsGraph, ECGlobals); - DEBUG(std::cerr << "Eliminating " << ECGlobals.size() << " EC Globals!\n"); - ECGlobals.clear(); - - // Calculate all of the graphs... - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal()) - DSInfo.insert(std::make_pair(I, new DSGraph(GlobalECs, TD, *I, - GlobalsGraph))); - - GlobalsGraph->removeTriviallyDeadNodes(); - GlobalsGraph->markIncompleteNodes(DSGraph::MarkFormalArgs); - - // Now that we've computed all of the graphs, and merged all of the info into - // the globals graph, see if we have further constrained the globals in the - // program if so, update GlobalECs and remove the extraneous globals from the - // program. - BuildGlobalECs(*GlobalsGraph, ECGlobals); - if (!ECGlobals.empty()) { - DEBUG(std::cerr << "Eliminating " << ECGlobals.size() << " EC Globals!\n"); - for (hash_map<Function*, DSGraph*>::iterator I = DSInfo.begin(), - E = DSInfo.end(); I != E; ++I) - EliminateUsesOfECGlobals(*I->second, ECGlobals); - } - - return false; -} - -// releaseMemory - If the pass pipeline is done with this pass, we can release -// our memory... here... -// -void LocalDataStructures::releaseMemory() { - for (hash_map<Function*, DSGraph*>::iterator I = DSInfo.begin(), - E = DSInfo.end(); I != E; ++I) { - I->second->getReturnNodes().erase(I->first); - if (I->second->getReturnNodes().empty()) - delete I->second; - } - - // Empty map so next time memory is released, data structures are not - // re-deleted. - DSInfo.clear(); - delete GlobalsGraph; - GlobalsGraph = 0; -} -
diff --git a/poolalloc/lib/DSA/Makefile b/poolalloc/lib/DSA/Makefile deleted file mode 100644 index 0f1986f..0000000 --- a/poolalloc/lib/DSA/Makefile +++ /dev/null
@@ -1,14 +0,0 @@ -##===- lib/Analysis/DataStructure/Makefile -----------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -LEVEL = ../../.. -LIBRARYNAME = LLVMDataStructure - -include $(LEVEL)/Makefile.common -
diff --git a/poolalloc/lib/DSA/Printer.cpp b/poolalloc/lib/DSA/Printer.cpp deleted file mode 100644 index 7cb7924..0000000 --- a/poolalloc/lib/DSA/Printer.cpp +++ /dev/null
@@ -1,354 +0,0 @@ -//===- Printer.cpp - Code for printing data structure graphs nicely -------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the 'dot' graph printer. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Analysis/DataStructure/DSGraphTraits.h" -#include "llvm/Module.h" -#include "llvm/Constants.h" -#include "llvm/Assembly/Writer.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/GraphWriter.h" -#include "llvm/ADT/Statistic.h" -#include "llvm/Config/config.h" -#include <fstream> -#include <sstream> -using namespace llvm; - -// OnlyPrintMain - The DataStructure printer exposes this option to allow -// printing of only the graph for "main". -// -namespace { - cl::opt<bool> OnlyPrintMain("only-print-main-ds", cl::ReallyHidden); - cl::opt<bool> DontPrintAnything("dont-print-ds", cl::ReallyHidden); - Statistic<> MaxGraphSize ("dsa", "Maximum graph size"); - Statistic<> NumFoldedNodes ("dsa", "Number of folded nodes (in final graph)"); -} - -void DSNode::dump() const { print(std::cerr, 0); } - -static std::string getCaption(const DSNode *N, const DSGraph *G) { - std::stringstream OS; - Module *M = 0; - - if (!G) G = N->getParentGraph(); - - // Get the module from ONE of the functions in the graph it is available. - if (G && G->retnodes_begin() != G->retnodes_end()) - M = G->retnodes_begin()->first->getParent(); - if (M == 0 && G) { - // If there is a global in the graph, we can use it to find the module. - const DSScalarMap &SM = G->getScalarMap(); - if (SM.global_begin() != SM.global_end()) - M = (*SM.global_begin())->getParent(); - } - - if (N->isNodeCompletelyFolded()) - OS << "COLLAPSED"; - else { - WriteTypeSymbolic(OS, N->getType(), M); - if (N->isArray()) - OS << " array"; - } - if (unsigned NodeType = N->getNodeFlags()) { - OS << ": "; - if (NodeType & DSNode::AllocaNode ) OS << "S"; - if (NodeType & DSNode::HeapNode ) OS << "H"; - if (NodeType & DSNode::GlobalNode ) OS << "G"; - if (NodeType & DSNode::UnknownNode) OS << "U"; - if (NodeType & DSNode::Incomplete ) OS << "I"; - if (NodeType & DSNode::Modified ) OS << "M"; - if (NodeType & DSNode::Read ) OS << "R"; -#ifndef NDEBUG - if (NodeType & DSNode::DEAD ) OS << "<dead>"; -#endif - OS << "\n"; - } - - EquivalenceClasses<GlobalValue*> *GlobalECs = 0; - if (G) GlobalECs = &G->getGlobalECs(); - - for (unsigned i = 0, e = N->getGlobalsList().size(); i != e; ++i) { - WriteAsOperand(OS, N->getGlobalsList()[i], false, true, M); - - // Figure out how many globals are equivalent to this one. - if (GlobalECs) { - EquivalenceClasses<GlobalValue*>::iterator I = - GlobalECs->findValue(N->getGlobalsList()[i]); - if (I != GlobalECs->end()) { - unsigned NumMembers = - std::distance(GlobalECs->member_begin(I), GlobalECs->member_end()); - if (NumMembers != 1) OS << " + " << (NumMembers-1) << " EC"; - } - } - OS << "\n"; - } - - return OS.str(); -} - -namespace llvm { -template<> -struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits { - static std::string getGraphName(const DSGraph *G) { - switch (G->getReturnNodes().size()) { - case 0: return G->getFunctionNames(); - case 1: return "Function " + G->getFunctionNames(); - default: return "Functions: " + G->getFunctionNames(); - } - } - - static std::string getNodeLabel(const DSNode *Node, const DSGraph *Graph) { - return getCaption(Node, Graph); - } - - static std::string getNodeAttributes(const DSNode *N) { - return "shape=Mrecord"; - } - - static bool edgeTargetsEdgeSource(const void *Node, - DSNode::const_iterator I) { - unsigned O = I.getNode()->getLink(I.getOffset()).getOffset(); - return (O >> DS::PointerShift) != 0; - } - - static DSNode::const_iterator getEdgeTarget(const DSNode *Node, - DSNode::const_iterator I) { - unsigned O = I.getNode()->getLink(I.getOffset()).getOffset(); - unsigned LinkNo = O >> DS::PointerShift; - const DSNode *N = *I; - DSNode::const_iterator R = N->begin(); - for (; LinkNo; --LinkNo) - ++R; - return R; - } - - - /// addCustomGraphFeatures - Use this graph writing hook to emit call nodes - /// and the return node. - /// - static void addCustomGraphFeatures(const DSGraph *G, - GraphWriter<const DSGraph*> &GW) { - Module *CurMod = 0; - if (G->retnodes_begin() != G->retnodes_end()) - CurMod = G->retnodes_begin()->first->getParent(); - else { - // If there is a global in the graph, we can use it to find the module. - const DSScalarMap &SM = G->getScalarMap(); - if (SM.global_begin() != SM.global_end()) - CurMod = (*SM.global_begin())->getParent(); - } - - - // Add scalar nodes to the graph... - const DSGraph::ScalarMapTy &VM = G->getScalarMap(); - for (DSGraph::ScalarMapTy::const_iterator I = VM.begin(); I != VM.end();++I) - if (!isa<GlobalValue>(I->first)) { - std::stringstream OS; - WriteAsOperand(OS, I->first, false, true, CurMod); - GW.emitSimpleNode(I->first, "", OS.str()); - - // Add edge from return node to real destination - DSNode *DestNode = I->second.getNode(); - int EdgeDest = I->second.getOffset() >> DS::PointerShift; - if (EdgeDest == 0) EdgeDest = -1; - GW.emitEdge(I->first, -1, DestNode, - EdgeDest, "arrowtail=tee,color=gray63"); - } - - - // Output the returned value pointer... - for (DSGraph::retnodes_iterator I = G->retnodes_begin(), - E = G->retnodes_end(); I != E; ++I) - if (I->second.getNode()) { - std::string Label; - if (G->getReturnNodes().size() == 1) - Label = "returning"; - else - Label = I->first->getName() + " ret node"; - // Output the return node... - GW.emitSimpleNode((void*)I->first, "plaintext=circle", Label); - - // Add edge from return node to real destination - DSNode *RetNode = I->second.getNode(); - int RetEdgeDest = I->second.getOffset() >> DS::PointerShift;; - if (RetEdgeDest == 0) RetEdgeDest = -1; - GW.emitEdge((void*)I->first, -1, RetNode, - RetEdgeDest, "arrowtail=tee,color=gray63"); - } - - // Output all of the call nodes... - const std::list<DSCallSite> &FCs = - G->shouldPrintAuxCalls() ? G->getAuxFunctionCalls() - : G->getFunctionCalls(); - for (std::list<DSCallSite>::const_iterator I = FCs.begin(), E = FCs.end(); - I != E; ++I) { - const DSCallSite &Call = *I; - std::vector<std::string> EdgeSourceCaptions(Call.getNumPtrArgs()+2); - EdgeSourceCaptions[0] = "r"; - if (Call.isDirectCall()) - EdgeSourceCaptions[1] = Call.getCalleeFunc()->getName(); - else - EdgeSourceCaptions[1] = "f"; - - GW.emitSimpleNode(&Call, "shape=record", "call", Call.getNumPtrArgs()+2, - &EdgeSourceCaptions); - - if (DSNode *N = Call.getRetVal().getNode()) { - int EdgeDest = Call.getRetVal().getOffset() >> DS::PointerShift; - if (EdgeDest == 0) EdgeDest = -1; - GW.emitEdge(&Call, 0, N, EdgeDest, "color=gray63,tailclip=false"); - } - - // Print out the callee... - if (Call.isIndirectCall()) { - DSNode *N = Call.getCalleeNode(); - assert(N && "Null call site callee node!"); - GW.emitEdge(&Call, 1, N, -1, "color=gray63,tailclip=false"); - } - - for (unsigned j = 0, e = Call.getNumPtrArgs(); j != e; ++j) - if (DSNode *N = Call.getPtrArg(j).getNode()) { - int EdgeDest = Call.getPtrArg(j).getOffset() >> DS::PointerShift; - if (EdgeDest == 0) EdgeDest = -1; - GW.emitEdge(&Call, j+2, N, EdgeDest, "color=gray63,tailclip=false"); - } - } - } -}; -} // end namespace llvm - -void DSNode::print(std::ostream &O, const DSGraph *G) const { - GraphWriter<const DSGraph *> W(O, G); - W.writeNode(this); -} - -void DSGraph::print(std::ostream &O) const { - WriteGraph(O, this, "DataStructures"); -} - -void DSGraph::writeGraphToFile(std::ostream &O, - const std::string &GraphName) const { - std::string Filename = GraphName + ".dot"; - O << "Writing '" << Filename << "'..."; - std::ofstream F(Filename.c_str()); - - if (F.good()) { - print(F); - unsigned NumCalls = shouldPrintAuxCalls() ? - getAuxFunctionCalls().size() : getFunctionCalls().size(); - O << " [" << getGraphSize() << "+" << NumCalls << "]\n"; - } else { - O << " error opening file for writing!\n"; - } -} - -/// viewGraph - Emit a dot graph, run 'dot', run gv on the postscript file, -/// then cleanup. For use from the debugger. -/// -void DSGraph::viewGraph() const { - ViewGraph(this, "ds.tempgraph", "DataStructures"); -} - - -template <typename Collection> -static void printCollection(const Collection &C, std::ostream &O, - const Module *M, const std::string &Prefix) { - if (M == 0) { - O << "Null Module pointer, cannot continue!\n"; - return; - } - - unsigned TotalNumNodes = 0, TotalCallNodes = 0; - for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) - if (C.hasGraph(*I)) { - DSGraph &Gr = C.getDSGraph((Function&)*I); - unsigned NumCalls = Gr.shouldPrintAuxCalls() ? - Gr.getAuxFunctionCalls().size() : Gr.getFunctionCalls().size(); - bool IsDuplicateGraph = false; - - if (I->getName() == "main" || !OnlyPrintMain) { - Function *SCCFn = Gr.retnodes_begin()->first; - if (&*I == SCCFn) { - Gr.writeGraphToFile(O, Prefix+I->getName()); - } else { - IsDuplicateGraph = true; // Don't double count node/call nodes. - O << "Didn't write '" << Prefix+I->getName() - << ".dot' - Graph already emitted to '" << Prefix+SCCFn->getName() - << "\n"; - } - } else { - Function *SCCFn = Gr.retnodes_begin()->first; - if (&*I == SCCFn) { - O << "Skipped Writing '" << Prefix+I->getName() << ".dot'... [" - << Gr.getGraphSize() << "+" << NumCalls << "]\n"; - } else { - IsDuplicateGraph = true; // Don't double count node/call nodes. - } - } - - if (!IsDuplicateGraph) { - unsigned GraphSize = Gr.getGraphSize(); - if (MaxGraphSize < GraphSize) MaxGraphSize = GraphSize; - - TotalNumNodes += Gr.getGraphSize(); - TotalCallNodes += NumCalls; - for (DSGraph::node_iterator NI = Gr.node_begin(), E = Gr.node_end(); - NI != E; ++NI) - if (NI->isNodeCompletelyFolded()) - ++NumFoldedNodes; - } - } - - DSGraph &GG = C.getGlobalsGraph(); - TotalNumNodes += GG.getGraphSize(); - TotalCallNodes += GG.getFunctionCalls().size(); - if (!OnlyPrintMain) { - GG.writeGraphToFile(O, Prefix+"GlobalsGraph"); - } else { - O << "Skipped Writing '" << Prefix << "GlobalsGraph.dot'... [" - << GG.getGraphSize() << "+" << GG.getFunctionCalls().size() << "]\n"; - } - - O << "\nGraphs contain [" << TotalNumNodes << "+" << TotalCallNodes - << "] nodes total" << std::endl; -} - - -// print - Print out the analysis results... -void LocalDataStructures::print(std::ostream &O, const Module *M) const { - if (DontPrintAnything) return; - printCollection(*this, O, M, "ds."); -} - -void BUDataStructures::print(std::ostream &O, const Module *M) const { - if (DontPrintAnything) return; - printCollection(*this, O, M, "bu."); -} - -void TDDataStructures::print(std::ostream &O, const Module *M) const { - if (DontPrintAnything) return; - printCollection(*this, O, M, "td."); -} - -void CompleteBUDataStructures::print(std::ostream &O, const Module *M) const { - if (DontPrintAnything) return; - printCollection(*this, O, M, "cbu."); -} - - -void EquivClassGraphs::print(std::ostream &O, const Module *M) const { - if (DontPrintAnything) return; - printCollection(*this, O, M, "eq."); -} -
diff --git a/poolalloc/lib/DSA/Steensgaard.cpp b/poolalloc/lib/DSA/Steensgaard.cpp deleted file mode 100644 index 8a8391f..0000000 --- a/poolalloc/lib/DSA/Steensgaard.cpp +++ /dev/null
@@ -1,268 +0,0 @@ -//===- Steensgaard.cpp - Context Insensitive Alias Analysis ---------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This pass uses the data structure graphs to implement a simple context -// insensitive alias analysis. It does this by computing the local analysis -// graphs for all of the functions, then merging them together into a single big -// graph without cloning. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Analysis/AliasAnalysis.h" -#include "llvm/Analysis/Passes.h" -#include "llvm/Module.h" -#include "llvm/Support/Debug.h" -#include <iostream> -using namespace llvm; - -namespace { - class Steens : public ModulePass, public AliasAnalysis { - DSGraph *ResultGraph; - - EquivalenceClasses<GlobalValue*> GlobalECs; // Always empty - public: - Steens() : ResultGraph(0) {} - ~Steens() { - releaseMyMemory(); - assert(ResultGraph == 0 && "releaseMemory not called?"); - } - - //------------------------------------------------ - // Implement the Pass API - // - - // run - Build up the result graph, representing the pointer graph for the - // program. - // - bool runOnModule(Module &M); - - virtual void releaseMyMemory() { delete ResultGraph; ResultGraph = 0; } - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AliasAnalysis::getAnalysisUsage(AU); - AU.setPreservesAll(); // Does not transform code... - AU.addRequired<LocalDataStructures>(); // Uses local dsgraph - } - - // print - Implement the Pass::print method... - void print(std::ostream &O, const Module *M) const { - assert(ResultGraph && "Result graph has not yet been computed!"); - ResultGraph->writeGraphToFile(O, "steensgaards"); - } - - //------------------------------------------------ - // Implement the AliasAnalysis API - // - - AliasResult alias(const Value *V1, unsigned V1Size, - const Value *V2, unsigned V2Size); - - ModRefResult getModRefInfo(CallSite CS, Value *P, unsigned Size); - - private: - void ResolveFunctionCall(Function *F, const DSCallSite &Call, - DSNodeHandle &RetVal); - }; - - // Register the pass... - RegisterOpt<Steens> X("steens-aa", - "Steensgaard's alias analysis (DSGraph based)"); - - // Register as an implementation of AliasAnalysis - RegisterAnalysisGroup<AliasAnalysis, Steens> Y; -} - -ModulePass *llvm::createSteensgaardPass() { return new Steens(); } - -/// ResolveFunctionCall - Resolve the actual arguments of a call to function F -/// with the specified call site descriptor. This function links the arguments -/// and the return value for the call site context-insensitively. -/// -void Steens::ResolveFunctionCall(Function *F, const DSCallSite &Call, - DSNodeHandle &RetVal) { - assert(ResultGraph != 0 && "Result graph not allocated!"); - DSGraph::ScalarMapTy &ValMap = ResultGraph->getScalarMap(); - - // Handle the return value of the function... - if (Call.getRetVal().getNode() && RetVal.getNode()) - RetVal.mergeWith(Call.getRetVal()); - - // Loop over all pointer arguments, resolving them to their provided pointers - unsigned PtrArgIdx = 0; - for (Function::arg_iterator AI = F->arg_begin(), AE = F->arg_end(); - AI != AE && PtrArgIdx < Call.getNumPtrArgs(); ++AI) { - DSGraph::ScalarMapTy::iterator I = ValMap.find(AI); - if (I != ValMap.end()) // If its a pointer argument... - I->second.mergeWith(Call.getPtrArg(PtrArgIdx++)); - } -} - - -/// run - Build up the result graph, representing the pointer graph for the -/// program. -/// -bool Steens::runOnModule(Module &M) { - InitializeAliasAnalysis(this); - assert(ResultGraph == 0 && "Result graph already allocated!"); - LocalDataStructures &LDS = getAnalysis<LocalDataStructures>(); - - // Create a new, empty, graph... - ResultGraph = new DSGraph(GlobalECs, getTargetData()); - ResultGraph->spliceFrom(LDS.getGlobalsGraph()); - - // Loop over the rest of the module, merging graphs for non-external functions - // into this graph. - // - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal()) - ResultGraph->spliceFrom(LDS.getDSGraph(*I)); - - ResultGraph->removeTriviallyDeadNodes(); - - // FIXME: Must recalculate and use the Incomplete markers!! - - // Now that we have all of the graphs inlined, we can go about eliminating - // call nodes... - // - std::list<DSCallSite> &Calls = ResultGraph->getAuxFunctionCalls(); - assert(Calls.empty() && "Aux call list is already in use??"); - - // Start with a copy of the original call sites. - Calls = ResultGraph->getFunctionCalls(); - - for (std::list<DSCallSite>::iterator CI = Calls.begin(), E = Calls.end(); - CI != E;) { - DSCallSite &CurCall = *CI++; - - // Loop over the called functions, eliminating as many as possible... - std::vector<Function*> CallTargets; - if (CurCall.isDirectCall()) - CallTargets.push_back(CurCall.getCalleeFunc()); - else - CurCall.getCalleeNode()->addFullFunctionList(CallTargets); - - for (unsigned c = 0; c != CallTargets.size(); ) { - // If we can eliminate this function call, do so! - Function *F = CallTargets[c]; - if (!F->isExternal()) { - ResolveFunctionCall(F, CurCall, ResultGraph->getReturnNodes()[F]); - CallTargets[c] = CallTargets.back(); - CallTargets.pop_back(); - } else - ++c; // Cannot eliminate this call, skip over it... - } - - if (CallTargets.empty()) { // Eliminated all calls? - std::list<DSCallSite>::iterator I = CI; - Calls.erase(--I); // Remove entry - } - } - - // Remove our knowledge of what the return values of the functions are, except - // for functions that are externally visible from this module (e.g. main). We - // keep these functions so that their arguments are marked incomplete. - for (DSGraph::ReturnNodesTy::iterator I = - ResultGraph->getReturnNodes().begin(), - E = ResultGraph->getReturnNodes().end(); I != E; ) - if (I->first->hasInternalLinkage()) - ResultGraph->getReturnNodes().erase(I++); - else - ++I; - - // Update the "incomplete" markers on the nodes, ignoring unknownness due to - // incoming arguments... - ResultGraph->maskIncompleteMarkers(); - ResultGraph->markIncompleteNodes(DSGraph::IgnoreGlobals | - DSGraph::MarkFormalArgs); - - // Remove any nodes that are dead after all of the merging we have done... - // FIXME: We should be able to disable the globals graph for steens! - //ResultGraph->removeDeadNodes(DSGraph::KeepUnreachableGlobals); - - DEBUG(print(std::cerr, &M)); - return false; -} - -AliasAnalysis::AliasResult Steens::alias(const Value *V1, unsigned V1Size, - const Value *V2, unsigned V2Size) { - assert(ResultGraph && "Result graph has not been computed yet!"); - - DSGraph::ScalarMapTy &GSM = ResultGraph->getScalarMap(); - - DSGraph::ScalarMapTy::iterator I = GSM.find(const_cast<Value*>(V1)); - DSGraph::ScalarMapTy::iterator J = GSM.find(const_cast<Value*>(V2)); - if (I != GSM.end() && !I->second.isNull() && - J != GSM.end() && !J->second.isNull()) { - DSNodeHandle &V1H = I->second; - DSNodeHandle &V2H = J->second; - - // If at least one of the nodes is complete, we can say something about - // this. If one is complete and the other isn't, then they are obviously - // different nodes. If they are both complete, we can't say anything - // useful. - if (I->second.getNode()->isComplete() || - J->second.getNode()->isComplete()) { - // If the two pointers point to different data structure graph nodes, they - // cannot alias! - if (V1H.getNode() != V2H.getNode()) - return NoAlias; - - // See if they point to different offsets... if so, we may be able to - // determine that they do not alias... - unsigned O1 = I->second.getOffset(), O2 = J->second.getOffset(); - if (O1 != O2) { - if (O2 < O1) { // Ensure that O1 <= O2 - std::swap(V1, V2); - std::swap(O1, O2); - std::swap(V1Size, V2Size); - } - - if (O1+V1Size <= O2) - return NoAlias; - } - } - } - - // If we cannot determine alias properties based on our graph, fall back on - // some other AA implementation. - // - return AliasAnalysis::alias(V1, V1Size, V2, V2Size); -} - -AliasAnalysis::ModRefResult -Steens::getModRefInfo(CallSite CS, Value *P, unsigned Size) { - AliasAnalysis::ModRefResult Result = ModRef; - - // Find the node in question. - DSGraph::ScalarMapTy &GSM = ResultGraph->getScalarMap(); - DSGraph::ScalarMapTy::iterator I = GSM.find(P); - - if (I != GSM.end() && !I->second.isNull()) { - DSNode *N = I->second.getNode(); - if (N->isComplete()) { - // If this is a direct call to an external function, and if the pointer - // points to a complete node, the external function cannot modify or read - // the value (we know it's not passed out of the program!). - if (Function *F = CS.getCalledFunction()) - if (F->isExternal()) - return NoModRef; - - // Otherwise, if the node is complete, but it is only M or R, return this. - // This can be useful for globals that should be marked const but are not. - if (!N->isModified()) - Result = (ModRefResult)(Result & ~Mod); - if (!N->isRead()) - Result = (ModRefResult)(Result & ~Ref); - } - } - - return (ModRefResult)(Result & AliasAnalysis::getModRefInfo(CS, P, Size)); -}
diff --git a/poolalloc/lib/DSA/TopDownClosure.cpp b/poolalloc/lib/DSA/TopDownClosure.cpp deleted file mode 100644 index 2271fa4..0000000 --- a/poolalloc/lib/DSA/TopDownClosure.cpp +++ /dev/null
@@ -1,471 +0,0 @@ -//===- TopDownClosure.cpp - Compute the top-down interprocedure closure ---===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the TDDataStructures class, which represents the -// Top-down Interprocedural closure of the data structure graph over the -// program. This is useful (but not strictly necessary?) for applications -// like pointer analysis. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Module.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Support/Debug.h" -#include "llvm/Support/Timer.h" -#include "llvm/ADT/Statistic.h" -#include <iostream> -using namespace llvm; - -#if 0 -#define TIME_REGION(VARNAME, DESC) \ - NamedRegionTimer VARNAME(DESC) -#else -#define TIME_REGION(VARNAME, DESC) -#endif - -namespace { - RegisterAnalysis<TDDataStructures> // Register the pass - Y("tddatastructure", "Top-down Data Structure Analysis"); - - Statistic<> NumTDInlines("tddatastructures", "Number of graphs inlined"); -} - -void TDDataStructures::markReachableFunctionsExternallyAccessible(DSNode *N, - hash_set<DSNode*> &Visited) { - if (!N || Visited.count(N)) return; - Visited.insert(N); - - for (unsigned i = 0, e = N->getNumLinks(); i != e; ++i) { - DSNodeHandle &NH = N->getLink(i*N->getPointerSize()); - if (DSNode *NN = NH.getNode()) { - std::vector<Function*> Functions; - NN->addFullFunctionList(Functions); - ArgsRemainIncomplete.insert(Functions.begin(), Functions.end()); - markReachableFunctionsExternallyAccessible(NN, Visited); - } - } -} - - -// run - Calculate the top down data structure graphs for each function in the -// program. -// -bool TDDataStructures::runOnModule(Module &M) { - BUInfo = &getAnalysis<BUDataStructures>(); - GlobalECs = BUInfo->getGlobalECs(); - GlobalsGraph = new DSGraph(BUInfo->getGlobalsGraph(), GlobalECs); - GlobalsGraph->setPrintAuxCalls(); - - // Figure out which functions must not mark their arguments complete because - // they are accessible outside this compilation unit. Currently, these - // arguments are functions which are reachable by global variables in the - // globals graph. - const DSScalarMap &GGSM = GlobalsGraph->getScalarMap(); - hash_set<DSNode*> Visited; - for (DSScalarMap::global_iterator I=GGSM.global_begin(), E=GGSM.global_end(); - I != E; ++I) { - DSNode *N = GGSM.find(*I)->second.getNode(); - if (N->isIncomplete()) - markReachableFunctionsExternallyAccessible(N, Visited); - } - - // Loop over unresolved call nodes. Any functions passed into (but not - // returned!) from unresolvable call nodes may be invoked outside of the - // current module. - for (DSGraph::afc_iterator I = GlobalsGraph->afc_begin(), - E = GlobalsGraph->afc_end(); I != E; ++I) - for (unsigned arg = 0, e = I->getNumPtrArgs(); arg != e; ++arg) - markReachableFunctionsExternallyAccessible(I->getPtrArg(arg).getNode(), - Visited); - Visited.clear(); - - // Functions without internal linkage also have unknown incoming arguments! - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal() && !I->hasInternalLinkage()) - ArgsRemainIncomplete.insert(I); - - // We want to traverse the call graph in reverse post-order. To do this, we - // calculate a post-order traversal, then reverse it. - hash_set<DSGraph*> VisitedGraph; - std::vector<DSGraph*> PostOrder; - -#if 0 -{TIME_REGION(XXX, "td:Copy graphs"); - - // Visit each of the graphs in reverse post-order now! - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal()) - getOrCreateDSGraph(*I); - return false; -} -#endif - - -{TIME_REGION(XXX, "td:Compute postorder"); - - // Calculate top-down from main... - if (Function *F = M.getMainFunction()) - ComputePostOrder(*F, VisitedGraph, PostOrder); - - // Next calculate the graphs for each unreachable function... - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - ComputePostOrder(*I, VisitedGraph, PostOrder); - - VisitedGraph.clear(); // Release memory! -} - -{TIME_REGION(XXX, "td:Inline stuff"); - - // Visit each of the graphs in reverse post-order now! - while (!PostOrder.empty()) { - InlineCallersIntoGraph(*PostOrder.back()); - PostOrder.pop_back(); - } -} - - // Free the IndCallMap. - while (!IndCallMap.empty()) { - delete IndCallMap.begin()->second; - IndCallMap.erase(IndCallMap.begin()); - } - - - ArgsRemainIncomplete.clear(); - GlobalsGraph->removeTriviallyDeadNodes(); - - return false; -} - - -DSGraph &TDDataStructures::getOrCreateDSGraph(Function &F) { - DSGraph *&G = DSInfo[&F]; - if (G == 0) { // Not created yet? Clone BU graph... - G = new DSGraph(getAnalysis<BUDataStructures>().getDSGraph(F), GlobalECs, - DSGraph::DontCloneAuxCallNodes); - assert(G->getAuxFunctionCalls().empty() && "Cloned aux calls?"); - G->setPrintAuxCalls(); - G->setGlobalsGraph(GlobalsGraph); - - // Note that this graph is the graph for ALL of the function in the SCC, not - // just F. - for (DSGraph::retnodes_iterator RI = G->retnodes_begin(), - E = G->retnodes_end(); RI != E; ++RI) - if (RI->first != &F) - DSInfo[RI->first] = G; - } - return *G; -} - - -void TDDataStructures::ComputePostOrder(Function &F,hash_set<DSGraph*> &Visited, - std::vector<DSGraph*> &PostOrder) { - if (F.isExternal()) return; - DSGraph &G = getOrCreateDSGraph(F); - if (Visited.count(&G)) return; - Visited.insert(&G); - - // Recursively traverse all of the callee graphs. - for (DSGraph::fc_iterator CI = G.fc_begin(), CE = G.fc_end(); CI != CE; ++CI){ - Instruction *CallI = CI->getCallSite().getInstruction(); - for (BUDataStructures::callee_iterator I = BUInfo->callee_begin(CallI), - E = BUInfo->callee_end(CallI); I != E; ++I) - ComputePostOrder(*I->second, Visited, PostOrder); - } - - PostOrder.push_back(&G); -} - - - - - -// releaseMemory - If the pass pipeline is done with this pass, we can release -// our memory... here... -// -// FIXME: This should be releaseMemory and will work fine, except that LoadVN -// has no way to extend the lifetime of the pass, which screws up ds-aa. -// -void TDDataStructures::releaseMyMemory() { - for (hash_map<Function*, DSGraph*>::iterator I = DSInfo.begin(), - E = DSInfo.end(); I != E; ++I) { - I->second->getReturnNodes().erase(I->first); - if (I->second->getReturnNodes().empty()) - delete I->second; - } - - // Empty map so next time memory is released, data structures are not - // re-deleted. - DSInfo.clear(); - delete GlobalsGraph; - GlobalsGraph = 0; -} - -/// InlineCallersIntoGraph - Inline all of the callers of the specified DS graph -/// into it, then recompute completeness of nodes in the resultant graph. -void TDDataStructures::InlineCallersIntoGraph(DSGraph &DSG) { - // Inline caller graphs into this graph. First step, get the list of call - // sites that call into this graph. - std::vector<CallerCallEdge> EdgesFromCaller; - std::map<DSGraph*, std::vector<CallerCallEdge> >::iterator - CEI = CallerEdges.find(&DSG); - if (CEI != CallerEdges.end()) { - std::swap(CEI->second, EdgesFromCaller); - CallerEdges.erase(CEI); - } - - // Sort the caller sites to provide a by-caller-graph ordering. - std::sort(EdgesFromCaller.begin(), EdgesFromCaller.end()); - - - // Merge information from the globals graph into this graph. FIXME: This is - // stupid. Instead of us cloning information from the GG into this graph, - // then having RemoveDeadNodes clone it back, we should do all of this as a - // post-pass over all of the graphs. We need to take cloning out of - // removeDeadNodes and gut removeDeadNodes at the same time first though. :( - { - DSGraph &GG = *DSG.getGlobalsGraph(); - ReachabilityCloner RC(DSG, GG, - DSGraph::DontCloneCallNodes | - DSGraph::DontCloneAuxCallNodes); - for (DSScalarMap::global_iterator - GI = DSG.getScalarMap().global_begin(), - E = DSG.getScalarMap().global_end(); GI != E; ++GI) - RC.getClonedNH(GG.getNodeForValue(*GI)); - } - - DEBUG(std::cerr << "[TD] Inlining callers into '" << DSG.getFunctionNames() - << "'\n"); - - // Iteratively inline caller graphs into this graph. - while (!EdgesFromCaller.empty()) { - DSGraph &CallerGraph = *EdgesFromCaller.back().CallerGraph; - - // Iterate through all of the call sites of this graph, cloning and merging - // any nodes required by the call. - ReachabilityCloner RC(DSG, CallerGraph, - DSGraph::DontCloneCallNodes | - DSGraph::DontCloneAuxCallNodes); - - // Inline all call sites from this caller graph. - do { - const DSCallSite &CS = *EdgesFromCaller.back().CS; - Function &CF = *EdgesFromCaller.back().CalledFunction; - DEBUG(std::cerr << " [TD] Inlining graph into Fn '" - << CF.getName() << "' from "); - if (CallerGraph.getReturnNodes().empty()) - DEBUG(std::cerr << "SYNTHESIZED INDIRECT GRAPH"); - else - DEBUG (std::cerr << "Fn '" - << CS.getCallSite().getInstruction()-> - getParent()->getParent()->getName() << "'"); - DEBUG(std::cerr << ": " << CF.getFunctionType()->getNumParams() - << " args\n"); - - // Get the formal argument and return nodes for the called function and - // merge them with the cloned subgraph. - DSCallSite T1 = DSG.getCallSiteForArguments(CF); - RC.mergeCallSite(T1, CS); - ++NumTDInlines; - - EdgesFromCaller.pop_back(); - } while (!EdgesFromCaller.empty() && - EdgesFromCaller.back().CallerGraph == &CallerGraph); - } - - - // Next, now that this graph is finalized, we need to recompute the - // incompleteness markers for this graph and remove unreachable nodes. - DSG.maskIncompleteMarkers(); - - // If any of the functions has incomplete incoming arguments, don't mark any - // of them as complete. - bool HasIncompleteArgs = false; - for (DSGraph::retnodes_iterator I = DSG.retnodes_begin(), - E = DSG.retnodes_end(); I != E; ++I) - if (ArgsRemainIncomplete.count(I->first)) { - HasIncompleteArgs = true; - break; - } - - // Recompute the Incomplete markers. Depends on whether args are complete - unsigned Flags - = HasIncompleteArgs ? DSGraph::MarkFormalArgs : DSGraph::IgnoreFormalArgs; - DSG.markIncompleteNodes(Flags | DSGraph::IgnoreGlobals); - - // Delete dead nodes. Treat globals that are unreachable as dead also. - DSG.removeDeadNodes(DSGraph::RemoveUnreachableGlobals); - - // We are done with computing the current TD Graph! Finally, before we can - // finish processing this function, we figure out which functions it calls and - // records these call graph edges, so that we have them when we process the - // callee graphs. - if (DSG.fc_begin() == DSG.fc_end()) return; - - // Loop over all the call sites and all the callees at each call site, and add - // edges to the CallerEdges structure for each callee. - for (DSGraph::fc_iterator CI = DSG.fc_begin(), E = DSG.fc_end(); - CI != E; ++CI) { - - // Handle direct calls efficiently. - if (CI->isDirectCall()) { - if (!CI->getCalleeFunc()->isExternal() && - !DSG.getReturnNodes().count(CI->getCalleeFunc())) - CallerEdges[&getDSGraph(*CI->getCalleeFunc())] - .push_back(CallerCallEdge(&DSG, &*CI, CI->getCalleeFunc())); - continue; - } - - Instruction *CallI = CI->getCallSite().getInstruction(); - // For each function in the invoked function list at this call site... - BUDataStructures::callee_iterator IPI = - BUInfo->callee_begin(CallI), IPE = BUInfo->callee_end(CallI); - - // Skip over all calls to this graph (SCC calls). - while (IPI != IPE && &getDSGraph(*IPI->second) == &DSG) - ++IPI; - - // All SCC calls? - if (IPI == IPE) continue; - - Function *FirstCallee = IPI->second; - ++IPI; - - // Skip over more SCC calls. - while (IPI != IPE && &getDSGraph(*IPI->second) == &DSG) - ++IPI; - - // If there is exactly one callee from this call site, remember the edge in - // CallerEdges. - if (IPI == IPE) { - if (!FirstCallee->isExternal()) - CallerEdges[&getDSGraph(*FirstCallee)] - .push_back(CallerCallEdge(&DSG, &*CI, FirstCallee)); - continue; - } - - // Otherwise, there are multiple callees from this call site, so it must be - // an indirect call. Chances are that there will be other call sites with - // this set of targets. If so, we don't want to do M*N inlining operations, - // so we build up a new, private, graph that represents the calls of all - // calls to this set of functions. - std::vector<Function*> Callees; - for (BUDataStructures::ActualCalleesTy::const_iterator I = - BUInfo->callee_begin(CallI), E = BUInfo->callee_end(CallI); - I != E; ++I) - if (!I->second->isExternal()) - Callees.push_back(I->second); - std::sort(Callees.begin(), Callees.end()); - - std::map<std::vector<Function*>, DSGraph*>::iterator IndCallRecI = - IndCallMap.lower_bound(Callees); - - DSGraph *IndCallGraph; - - // If we already have this graph, recycle it. - if (IndCallRecI != IndCallMap.end() && IndCallRecI->first == Callees) { - std::cerr << " [TD] *** Reuse of indcall graph for " << Callees.size() - << " callees!\n"; - IndCallGraph = IndCallRecI->second; - } else { - // Otherwise, create a new DSGraph to represent this. - IndCallGraph = new DSGraph(DSG.getGlobalECs(), DSG.getTargetData()); - - // Make a nullary dummy call site, which will eventually get some content - // merged into it. The actual callee function doesn't matter here, so we - // just pass it something to keep the ctor happy. - std::vector<DSNodeHandle> ArgDummyVec; - DSCallSite DummyCS(CI->getCallSite(), DSNodeHandle(), Callees[0]/*dummy*/, - ArgDummyVec); - IndCallGraph->getFunctionCalls().push_back(DummyCS); - - IndCallRecI = IndCallMap.insert(IndCallRecI, - std::make_pair(Callees, IndCallGraph)); - - // Additionally, make sure that each of the callees inlines this graph - // exactly once. - DSCallSite *NCS = &IndCallGraph->getFunctionCalls().front(); - for (unsigned i = 0, e = Callees.size(); i != e; ++i) { - DSGraph& CalleeGraph = getDSGraph(*Callees[i]); - if (&CalleeGraph != &DSG) - CallerEdges[&CalleeGraph].push_back(CallerCallEdge(IndCallGraph, NCS, - Callees[i])); - } - } - - // Now that we know which graph to use for this, merge the caller - // information into the graph, based on information from the call site. - ReachabilityCloner RC(*IndCallGraph, DSG, 0); - RC.mergeCallSite(IndCallGraph->getFunctionCalls().front(), *CI); - } -} - - -static const Function *getFnForValue(const Value *V) { - if (const Instruction *I = dyn_cast<Instruction>(V)) - return I->getParent()->getParent(); - else if (const Argument *A = dyn_cast<Argument>(V)) - return A->getParent(); - else if (const BasicBlock *BB = dyn_cast<BasicBlock>(V)) - return BB->getParent(); - return 0; -} - -void TDDataStructures::deleteValue(Value *V) { - if (const Function *F = getFnForValue(V)) { // Function local value? - // If this is a function local value, just delete it from the scalar map! - getDSGraph(*F).getScalarMap().eraseIfExists(V); - return; - } - - if (Function *F = dyn_cast<Function>(V)) { - assert(getDSGraph(*F).getReturnNodes().size() == 1 && - "cannot handle scc's"); - delete DSInfo[F]; - DSInfo.erase(F); - return; - } - - assert(!isa<GlobalVariable>(V) && "Do not know how to delete GV's yet!"); -} - -void TDDataStructures::copyValue(Value *From, Value *To) { - if (From == To) return; - if (const Function *F = getFnForValue(From)) { // Function local value? - // If this is a function local value, just delete it from the scalar map! - getDSGraph(*F).getScalarMap().copyScalarIfExists(From, To); - return; - } - - if (Function *FromF = dyn_cast<Function>(From)) { - Function *ToF = cast<Function>(To); - assert(!DSInfo.count(ToF) && "New Function already exists!"); - DSGraph *NG = new DSGraph(getDSGraph(*FromF), GlobalECs); - DSInfo[ToF] = NG; - assert(NG->getReturnNodes().size() == 1 && "Cannot copy SCC's yet!"); - - // Change the Function* is the returnnodes map to the ToF. - DSNodeHandle Ret = NG->retnodes_begin()->second; - NG->getReturnNodes().clear(); - NG->getReturnNodes()[ToF] = Ret; - return; - } - - if (const Function *F = getFnForValue(To)) { - DSGraph &G = getDSGraph(*F); - G.getScalarMap().copyScalarIfExists(From, To); - return; - } - - std::cerr << *From; - std::cerr << *To; - assert(0 && "Do not know how to copy this yet!"); - abort(); -}
diff --git a/poolalloc/lib/Macroscopic/DeadFieldElimination.cpp b/poolalloc/lib/Macroscopic/DeadFieldElimination.cpp deleted file mode 100644 index 1701783..0000000 --- a/poolalloc/lib/Macroscopic/DeadFieldElimination.cpp +++ /dev/null
@@ -1,248 +0,0 @@ -//===-- DeadFieldElimination.cpp - Dead Field Elimination Pass ------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the -rds-deadfieldelim pass, which implements -// Macroscopic Dead Field Elimination. -// -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "rds-deadfieldelim" -#include "StructureFieldVisitor.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Support/Debug.h" -#include "llvm/Support/Timer.h" -using namespace llvm; -using namespace llvm::Macroscopic; - -namespace { - /// DeadFieldElim - This class implements the dead field elimination - /// optimization. This transformation is a very simple macroscopic - /// optimization whose high-level algorithm works like this: - /// - /// 1. Identify all type-homogenous data structures that only contain HGS - /// composition bits. - /// 2. For each data structure, visit every load of fields in the node. - /// Keep track of whether a field is ever loaded. - /// 3. If we found fields that are never loaded from, rewrite the affected - /// data structures, deleting the dead fields! - /// - class DeadFieldElim : public ModulePass { - - bool runOnModule(Module &M); - - void getAnalysisUsage(AnalysisUsage &AU) const { - // Need information from DSA. - AU.addRequired<EquivClassGraphs>(); - AU.addPreserved<EquivClassGraphs>(); - } - }; - RegisterOpt<DeadFieldElim> - X("rds-deadfieldelim", "Macroscopic Dead Field Elimination"); -} // end anonymous namespace - - -namespace { - /// DeadFieldElimLattice - This is the most trivial lattice possible: it - /// consists of two states, dead (the default) and alive (overdefined, - /// bottom). Because it has only two states, it does not need to maintain any - /// actual state. - struct DeadFieldElimLattice : public LatticeValue { - DeadFieldElimLattice(DSNode *Node, const std::vector<unsigned> &Idxs, - const Type *FieldTy) - : LatticeValue(Node, Idxs, FieldTy) {} - - // getInterestingEvents - We only care about reads from memory? - static unsigned getInterestingEvents() { return Macroscopic::Visit::Loads; } - - virtual void dump() const { - LatticeValue::dump(); - std::cerr << " DEAD FIELD!\n"; - } - - // create - Return a dataflow fact for this field, initialized to top. - static DeadFieldElimLattice *create(DSNode *Node, - const std::vector<unsigned> &Idxs, - const Type *FieldTy) { - return new DeadFieldElimLattice(Node, Idxs, FieldTy); - } - - virtual bool mergeInValue(const LatticeValue *RHS) { - return false; // Neither LHS nor RHS are overdefined. - } - - // VisitLoad - Load events always move us to bottom. - virtual bool visitLoad(LoadInst &LI) { - return true; // Bottom! - } - }; -} - - -#include "llvm/Constants.h" -#include "llvm/Instructions.h" -namespace { - /// ConstPropLattice - This is the standard 3-level constant propagation - /// lattice. When CstVal is null it is undefined, when it is non-null it is - /// defined to that constant, and it hits bottom of set to something - /// unanalyzable or multiple values. - struct ConstPropLattice : public LatticeValue { - Constant *CstVal; - - ConstPropLattice(DSNode *Node, const std::vector<unsigned> &Idxs, - const Type *FieldTy) - : LatticeValue(Node, Idxs, FieldTy), CstVal(0) {} - - // getInterestingEvents - We only care about reads from memory? - static unsigned getInterestingEvents() { return Macroscopic::Visit::Stores;} - - // create - Return a dataflow fact for this field, initialized to top. - static ConstPropLattice *create(DSNode *Node, - const std::vector<unsigned> &Idxs, - const Type *FieldTy) { - return new ConstPropLattice(Node, Idxs, FieldTy); - } - - bool mergeInValue(Constant *V) { - if (V == 0 || isa<UndefValue>(V)) return false; - if (CstVal == 0) - CstVal = V; - else if (CstVal != V) - return true; - return false; - } - - virtual void dump() const { - LatticeValue::dump(); - if (CstVal) - std::cerr << " CONSTANT VALUE = " << *CstVal << "\n"; - else - std::cerr << " FIELD NEVER DEFINED!\n"; - } - - virtual bool mergeInValue(const LatticeValue *RHSLV) { - const ConstPropLattice *RHS = static_cast<const ConstPropLattice*>(RHSLV); - return mergeInValue(RHS->CstVal); - } - - virtual bool visitStore(StoreInst &SI) { - if (Constant *CV = dyn_cast<Constant>(SI.getOperand(0))) - return mergeInValue(CV); - return true; // Bottom! - } - - bool visitGlobalInit(Constant *InitVal) { - return mergeInValue(InitVal); - } - - virtual bool visitMemSet(CallInst &I) { - if (Constant *C = dyn_cast<Constant>(I.getOperand(2))) - if (C->isNullValue()) { - std::cerr << "HANDLED MEMSET: " << I; - return mergeInValue(Constant::getNullValue(getFieldType())); - } - return true; - } - }; -} - - - -bool DeadFieldElim::runOnModule(Module &M) { - EquivClassGraphs &ECG = getAnalysis<EquivClassGraphs>(); - - // Step #1: Identify all type-homogenous HGS (non-U) data structure nodes. - std::set<DSNode*> Nodes; - - { NamedRegionTimer XX("Dead Fields"); - - FindAllDataStructures(Nodes, 0 /*nothing required*/, - DSNode::UnknownNode, true /*typesafe*/, ECG); - - DEBUG(std::cerr << "DeadFieldElim: Found " << Nodes.size() - << " eligible data structure nodes.\n"); - - // Step #2: For each data structure, visit every load of fields in the node. - // Keep track of whether a field is ever loaded. The visitor returns a set of - // lattice values that have not reached bottom (in this case, that means it - // returns a set of dead fields). - std::set<DeadFieldElimLattice*> DeadFields = - StructureFieldVisitor<DeadFieldElimLattice>(ECG).visit(Nodes); - - DEBUG(std::cerr << "DeadFieldElim: Found " << DeadFields.size() - << " dead fields!\n"); - for (std::set<DeadFieldElimLattice*>::iterator I = DeadFields.begin(), - E = DeadFields.end(); I != E; ++I) { - DEBUG((*I)->dump()); - delete *I; - } - DEBUG(std::cerr << "\n"); - } - //return true; - - { NamedRegionTimer XX("Constants"); - - Nodes.clear(); - FindAllDataStructures(Nodes, 0 /*nothing required*/, - DSNode::UnknownNode, true /*typesafe*/, ECG); - - // Step #2: For each data structure, visit every stores to fields in the node. - // Keep track of whether a field is always constant. The visitor returns a - // set of lattice values that have not reached bottom (in this case, that - // means they are either undefined or overdefined. - std::set<ConstPropLattice*> ConstantFields = - StructureFieldVisitor<ConstPropLattice>(ECG).visit(Nodes); - - DEBUG(std::cerr << "ConstProp: Found " << ConstantFields.size() - << " constant or uninitialized fields!\n"); - for (std::set<ConstPropLattice*>::iterator I = ConstantFields.begin(), - E = ConstantFields.end(); I != E; ++I) { - DEBUG((*I)->dump()); - delete *I; - } - DEBUG(std::cerr << "\n"); - - } - - return true; - - // NOTE: We could do a simple thing that checks for fields whose loads are - // immediately casted to something smaller, and stores that are casted from - // something smaller to shrink them. - - - { NamedRegionTimer XX("Combined"); - - Nodes.clear(); - FindAllDataStructures(Nodes, 0 /*nothing required*/, - DSNode::UnknownNode, true /*typesafe*/, ECG); - - typedef CombinedLatticeValue<DeadFieldElimLattice,ConstPropLattice> - CombinedLattice; - - // Step #2: For each data structure, visit every stores to fields in the node. - // Keep track of whether a field is always constant. The visitor returns a - // set of lattice values that have not reached bottom (in this case, that - // means they are either undefined or overdefined. - std::set<CombinedLattice*> CombinedFields = - StructureFieldVisitor<CombinedLattice>(ECG).visit(Nodes); - - DEBUG(std::cerr << "Combined: Found " << CombinedFields.size() - << " interesting fields!\n"); - for (std::set<CombinedLattice*>::iterator I = CombinedFields.begin(), - E = CombinedFields.end(); I != E; ++I) { - DEBUG((*I)->dump()); - delete *I; - } - DEBUG(std::cerr << "\n"); - - } - - return true; -}
diff --git a/poolalloc/lib/Macroscopic/Makefile b/poolalloc/lib/Macroscopic/Makefile deleted file mode 100755 index 1c76cf8..0000000 --- a/poolalloc/lib/Macroscopic/Makefile +++ /dev/null
@@ -1,12 +0,0 @@ -# Indicate where we are relative to the top of the source tree. -LEVEL=../.. - -# Give the name of a library. This will build a dynamic version. -SHARED_LIBRARY=1 -LOADABLE_MODULE = 1 -DONT_BUILD_RELINKED=1 -LIBRARYNAME=macroscopic - -# Include Makefile.common so we know what to do. -include $(LEVEL)/Makefile.common -
diff --git a/poolalloc/lib/Macroscopic/README.txt b/poolalloc/lib/Macroscopic/README.txt deleted file mode 100644 index 323ccf6..0000000 --- a/poolalloc/lib/Macroscopic/README.txt +++ /dev/null
@@ -1,5 +0,0 @@ -//===- llvm-poolalloc/lib/Macroscopic -------------------------------------===// - -This directory contains an experimental implementation of several ideas for -Macroscopic analyses and transformations, which may eventually include -reimplementation of the pool allocator and other passes.
diff --git a/poolalloc/lib/Macroscopic/StructureFieldVisitor.cpp b/poolalloc/lib/Macroscopic/StructureFieldVisitor.cpp deleted file mode 100644 index b5f06b6..0000000 --- a/poolalloc/lib/Macroscopic/StructureFieldVisitor.cpp +++ /dev/null
@@ -1,939 +0,0 @@ -//===-- StructureFieldVisitor.cpp - Implement StructureFieldVisitor -------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the StructureFieldVisitor and related classes. -// -//===----------------------------------------------------------------------===// - -#include "StructureFieldVisitor.h" -#include "llvm/Constants.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Intrinsics.h" -#include "llvm/Support/InstVisitor.h" -#include <algorithm> -#include <iostream> - -using namespace llvm::Macroscopic; -using namespace llvm; - -/// FindAllDataStructures - Inspect the program specified by ECG, adding to -/// 'Nodes' all of the data structures node in the program that contain the -/// "IncludeFlags" and do not contain "ExcludeFlags" node flags. If -/// OnlyHomogenous is true, only type-homogenous nodes are considered. -void FindAllDataStructures(std::set<DSNode*> &Nodes, unsigned IncludeFlags, - unsigned ExcludeFlags, bool OnlyHomogenous, - EquivClassGraphs &ECG) { - // Loop over all of the graphs in ECG, finding nodes that are not incomplete - // and do not have any of the flags specified by Flags. - ExcludeFlags |= DSNode::Incomplete; - - /// FIXME: nodes in the global graph should not be marked incomplete in main!! - for (hash_map<const Function*, DSGraph*>::iterator GI = ECG.DSInfo.begin(), - E = ECG.DSInfo.end(); GI != E; ++GI) { - assert(GI->second && "Null graph pointer?"); - DSGraph &G = *GI->second; - for (DSGraph::node_iterator I = G.node_begin(), E = G.node_end(); - I != E; ++I) - // If this node matches our constraints, include it. - if ((I->getNodeFlags() & IncludeFlags) == IncludeFlags && - (I->getNodeFlags() & ExcludeFlags) == 0) - if (!OnlyHomogenous || !I->isNodeCompletelyFolded()) - Nodes.insert(I); - } -} - -//===----------------------------------------------------------------------===// -// LatticeValue class implementation -// - -DSGraph &LatticeValue::getParentGraph() const { - DSGraph *PG = getNode()->getParentGraph(); - assert(PG && "Node doesn't have a parent, is it a GlobalGraph node?"); - return *PG; -} - -/// getFieldOffset - Return the offset of this field from the start of the node. -/// -unsigned LatticeValue::getFieldOffset() const { - const TargetData &TD = getNode()->getParentGraph()->getTargetData(); - - unsigned Offset = 0; - const Type *Ty = Node->getType(); - for (unsigned i = 0, e = Idxs.size(); i != e; ++i) - if (const StructType *STy = dyn_cast<StructType>(Ty)) { - const StructLayout *SL = TD.getStructLayout(STy); - Offset += SL->MemberOffsets[Idxs[i]]; - Ty = STy->getElementType(Idxs[i]); - } else { - const SequentialType *STy = cast<SequentialType>(Ty); - Ty = STy->getElementType(); - --i; // This doesn't index a struct. - } - return Offset; -} - - - -void LatticeValue::dump() const { - std::cerr << "\nFunction: " << Node->getParentGraph()->getFunctionNames() - << "\n"; - Node->dump(); - if (!Idxs.empty()) { - std::cerr << "Field: "; - for (unsigned i = 0, e = Idxs.size(); i != e; ++i) - std::cerr << Idxs[i] << "."; - } - std::cerr << "\n"; -} - -bool LatticeValue::visitLoad(LoadInst &) { - std::cerr << "ERROR: Client requested load visitation, but did not " - << "overload visitLoad!\n"; - dump(); - return true; -} -bool LatticeValue::visitStore(StoreInst &) { - std::cerr << "ERROR: Client requested store visitation, but did not " - << "overload visitStore!\n"; - dump(); - return true; -} - -bool LatticeValue::visitGlobalInit(Constant *) { - std::cerr << "ERROR: Client requested store visitation, but did not " - << "overload visitGlobalInit!\n"; - dump(); - return true; -} - -//===----------------------------------------------------------------------===// -// SFVInstVisitor class implementation -// - -namespace { - /// SFVInstVisitor - This visitor is used to do the actual visitation of - /// memory instructions in the program. - /// - struct SFVInstVisitor : public InstVisitor<SFVInstVisitor, bool> { - DSGraph &DSG; - const unsigned Callbacks; - std::multimap<DSNode*, LatticeValue*> &NodeLVs; - - // DirectCallSites - When we see call sites, we don't process them, but we - // do remember them if they are direct calls. - std::set<Instruction*> DirectCallSites; - - SFVInstVisitor(DSGraph &dsg, unsigned CBs, - std::multimap<DSNode*, LatticeValue*> &LVs) - : DSG(dsg), Callbacks(CBs), NodeLVs(LVs) {} - - // Methods used by visitation methods. - LatticeValue *getLatticeValueForField(Value *Ptr); - bool RemoveLatticeValueAtBottom(LatticeValue *LV); - - /// Visitation methods - These methods should return true when a lattice - /// value is driven to 'bottom' and removed from NodeLVs. - bool visitLoadInst(LoadInst &LI); - bool visitStoreInst(StoreInst &SI); - - /// These are not implemented yet. - bool visitGetElementPtrInst(GetElementPtrInst &GEPI) { return false; } - bool visitMallocInst(MallocInst &MI) { return false; } - bool visitAllocaInst(AllocaInst &AI) { return false; } - bool visitFreeInst(FreeInst &FI) { return false; } - bool visitPHINode(PHINode &PN) { return false; } - bool visitSelectInst(SelectInst &SI) { return false; } - bool visitSetCondInst(SetCondInst &SCI) { return false; } - bool visitCastInst(CastInst &CI) { return false; } - bool visitReturnInst(ReturnInst &RI) { return false; } - - // visitCallInst/visitInvokeInst - Call and invoke are handled specially, so - // they are just noops here. - bool visitCallInst(CallInst &CI) { return visitCallSite(CI); } - bool visitInvokeInst(InvokeInst &II) { return visitCallSite(II); } - bool visitCallSite(Instruction &I) { - // Remember direct function calls. - if (isa<Function>(I.getOperand(0))) DirectCallSites.insert(&I); - return false; - } - - bool visitInstruction(Instruction &I) { -#ifndef NDEBUG - // Check to make sure this instruction really isn't using anything we the - // client needs to know about. - assert(getLatticeValueForField(&I) == 0 && "Inst should be handled!"); - for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) - assert(getLatticeValueForField(I.getOperand(i)) == 0 && - "Inst should be handled by visitor!"); -#endif - return false; - } - }; -} - -static void ComputeStructureFieldIndices(const Type *Ty, unsigned Offset, - std::vector<unsigned> &Idxs, - const TargetData &TD) { - if (Ty->isFirstClassType()) { - assert(Offset == 0 && "Illegal structure index!"); - return; - } - - if (const SequentialType *STy = dyn_cast<SequentialType>(Ty)) { - ComputeStructureFieldIndices(STy->getElementType(), Offset, Idxs, TD); - } else if (const StructType *STy = dyn_cast<StructType>(Ty)) { - const StructLayout *SL = TD.getStructLayout(STy); - - std::vector<uint64_t>::const_iterator SI = - std::upper_bound(SL->MemberOffsets.begin(), SL->MemberOffsets.end(), - Offset); - assert(SI != SL->MemberOffsets.begin() && "Offset not in structure type!"); - --SI; - assert(*SI <= Offset && "upper_bound didn't work"); - assert((SI == SL->MemberOffsets.begin() || *(SI-1) < Offset) && - (SI+1 == SL->MemberOffsets.end() || *(SI+1) > Offset) && - "Upper bound didn't work!"); - Offset -= *SI; // Skip over the offset to this structure field. - unsigned Idx = SI - SL->MemberOffsets.begin(); - assert(Idx < STy->getNumElements() && "Illegal structure index"); - Idxs.push_back(Idx); - ComputeStructureFieldIndices(STy->getElementType(Idx), Offset, Idxs, TD); - } else { - assert(0 && "Unknown type to index into!"); - } -} - -LatticeValue *SFVInstVisitor::getLatticeValueForField(Value *Ptr) { - if (!isa<PointerType>(Ptr->getType()) || - isa<ConstantPointerNull>(Ptr)) return 0; - - const DSNodeHandle *NH = &DSG.getNodeForValue(Ptr); - DSNode *Node = NH->getNode(); - assert(Node && "Pointer doesn't have node??"); - - std::multimap<DSNode*, LatticeValue*>::iterator I = NodeLVs.find(Node); - if (I == NodeLVs.end()) return 0; // Not a node we are still tracking. - - // Okay, next convert the node offset to a field index expression. - std::vector<unsigned> Idxs; - ComputeStructureFieldIndices(Node->getType(), NH->getOffset(), Idxs, - Node->getParentGraph()->getTargetData()); - - for (; I != NodeLVs.end() && I->first == Node; ++I) - if (I->second->getIndices() == Idxs) - return I->second; - return 0; -} - -/// RemoveLatticeValueAtBottom - When analysis determines that LV hit bottom, -/// this method is used to remove it from the NodeLVs map. This method always -/// returns true to simplify caller code. -/// -bool SFVInstVisitor::RemoveLatticeValueAtBottom(LatticeValue *LV) { - for (std::multimap<DSNode*, LatticeValue*>::iterator I - = NodeLVs.find(LV->getNode());; ++I) { - assert(I != NodeLVs.end() && "Lattice value not in map??"); - if (I->second == LV) { - NodeLVs.erase(I); - return true; - } - } -} - - -bool SFVInstVisitor::visitLoadInst(LoadInst &LI) { - if ((Callbacks & Visit::Loads) == 0) return false; - - if (LatticeValue *LV = getLatticeValueForField(LI.getOperand(0))) - if (LV->visitLoad(LI)) - return RemoveLatticeValueAtBottom(LV); - - return false; -} - -bool SFVInstVisitor::visitStoreInst(StoreInst &SI) { - if ((Callbacks & Visit::Stores) == 0) return false; - - if (LatticeValue *LV = getLatticeValueForField(SI.getOperand(1))) - if (LV->visitStore(SI)) - return RemoveLatticeValueAtBottom(LV); - - return false; -} - - -//===----------------------------------------------------------------------===// -// StructureFieldVisitorBase class implementation -// - -void StructureFieldVisitorBase:: -AddLatticeValuesForFields(DSNode *Node, const Type *Ty, - const std::vector<unsigned> &Idxs, - std::set<LatticeValue*> &Values) { - if (Ty->isFirstClassType()) { - if (LatticeValue *LV = createLatticeValue(Node, Idxs, Ty)) - Values.insert(LV); - return; - } - - const StructType *STy = dyn_cast<StructType>(Ty); - if (STy == 0) return; // Not handling arrays yet! - - std::vector<unsigned> NextIdxs(Idxs); - NextIdxs.push_back(0); - for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { - NextIdxs.back() = i; - AddLatticeValuesForFields(Node, STy->getElementType(i), NextIdxs, Values); - } -} - -void StructureFieldVisitorBase:: -AddLatticeValuesForNode(DSNode *N, std::set<LatticeValue*> &Values) { - if (N->isNodeCompletelyFolded() || - N->getType() == Type::VoidTy) return; // Can't analyze node. - std::vector<unsigned> Idxs; - AddLatticeValuesForFields(N, N->getType(), Idxs, Values); -} - - -/// visitNodes - This is a simple wrapper around visitFields that creates a -/// lattice value for every field in the specified collection of nodes. -/// -std::set<LatticeValue*> StructureFieldVisitorBase:: -visitNodes(const std::set<DSNode*> &Nodes) { - std::set<LatticeValue*> Result; - - // Create lattice values for all of the fields in these nodes. - for (std::set<DSNode*>::const_iterator I = Nodes.begin(), E = Nodes.end(); - I != E; ++I) - AddLatticeValuesForNode(*I, Result); - - // Now that we have the lattice values, just use visitFields to do the grunt - // work. - visitFields(Result); - return Result; -} - - -/// VisitGlobalInit - The specified lattice value corresponds to a field (or -/// several) in the specified global. Merge all of the overlapping initializer -/// values into LV (up-to and until it becomes overdefined). -/// -static bool VisitGlobalInit(LatticeValue *LV, Constant *Init, - unsigned FieldOffset) { - const TargetData &TD = LV->getParentGraph().getTargetData(); - - if (Init->isNullValue()) - return LV->visitGlobalInit(Constant::getNullValue(LV->getFieldType())); - if (isa<UndefValue>(Init)) - return LV->visitGlobalInit(UndefValue::get(LV->getFieldType())); - - if (LV->getNode()->isArray() && - TD.getTypeSize(Init->getType()) > LV->getNode()->getSize()) { - ConstantArray *CA = cast<ConstantArray>(Init); - for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) - if (VisitGlobalInit(LV, CA->getOperand(i), FieldOffset)) - return true; - return false; - } - -NextStep: // Manual tail recursion - - if (Init->isNullValue()) - return LV->visitGlobalInit(Constant::getNullValue(LV->getFieldType())); - if (isa<UndefValue>(Init)) - return LV->visitGlobalInit(UndefValue::get(LV->getFieldType())); - if (Init->getType()->isFirstClassType()) { - assert(FieldOffset == 0 && "GV Init mismatch!"); - return LV->visitGlobalInit(Init); - } - - if (const StructType *STy = dyn_cast<StructType>(Init->getType())) { - const StructLayout *SL = TD.getStructLayout(STy); - unsigned Field = SL->getElementContainingOffset(FieldOffset); - FieldOffset -= SL->MemberOffsets[Field]; - Init = cast<ConstantStruct>(Init)->getOperand(Field); - goto NextStep; - } else if (const ArrayType *ATy = dyn_cast<ArrayType>(Init->getType())) { - unsigned ElSz = TD.getTypeSize(ATy->getElementType()); - unsigned Idx = FieldOffset / ElSz; - FieldOffset -= Idx*ElSz; - Init = cast<ConstantArray>(Init)->getOperand(Idx); - goto NextStep; - } else { - assert(0 && "Unexpected initializer type!"); - return true; - } -} - - -/// visitFields - Visit all uses of the specified fields, updating the lattice -/// values as appropriate. -/// -void StructureFieldVisitorBase::visitFields(std::set<LatticeValue*> &Fields) { - // Now that we added all of the initial nodes, find out what graphs these - // nodes are rooted in. For efficiency, handle batches of nodes in the same - // function together at the same time. To do this, pull everything out of - // Fields and put it into FieldsByGraph. - std::multimap<DSGraph*, LatticeValue*> FieldsByGraph; - while (!Fields.empty()) { - LatticeValue *LV = *Fields.begin(); - Fields.erase(Fields.begin()); - FieldsByGraph.insert(std::make_pair(&LV->getParentGraph(), LV)); - } - - // Now that everything is grouped by graph, process a graph worth of nodes at - // a time, moving the results back to Fields if they are not overdefined. - while (!FieldsByGraph.empty()) { - // NodeLVs - Inspect all of the lattice values that are active in this - // graph. - std::multimap<DSNode*, LatticeValue*> NodeLVs; - DSGraph &DSG = *FieldsByGraph.begin()->first; - - // Pull out all nodes in this graph, putting them into NodeLVs. - while (FieldsByGraph.begin()->first == &DSG) { - LatticeValue *LV = FieldsByGraph.begin()->second; - FieldsByGraph.erase(FieldsByGraph.begin()); - NodeLVs.insert(std::make_pair(LV->getNode(), LV)); - } - - // Visit all operations in this graph, looking at how these lattice values - // are used! - visitGraph(DSG, NodeLVs); - - if (NodeLVs.empty()) continue; - - // If any of the nodes have globals, and if we are inspecting stores, make - // sure to notice the global variable initializers. - if (Callbacks & Visit::Stores) { - for (std::multimap<DSNode*, LatticeValue*>::iterator I = NodeLVs.begin(); - I != NodeLVs.end(); ) { - // If this node has globals, incorporate them. - bool LVisOverdefined = false; - std::vector<GlobalValue*> GVs; - I->first->addFullGlobalsList(GVs); - for (unsigned i = 0, e = GVs.size(); i != e; ++i) - if (GlobalVariable *GV = dyn_cast<GlobalVariable>(GVs[i])) { - assert(GV->hasInitializer() && "Should not be analyzing this GV!"); - if (VisitGlobalInit(I->second, GV->getInitializer(), - I->second->getFieldOffset())) { - LVisOverdefined = true; - break; - } - } - - if (LVisOverdefined) - NodeLVs.erase(I++); - else - ++I; - } - if (NodeLVs.empty()) continue; - } - - // Okay, final check. If we have any dataflow facts about nodes that are - // reachable from global variable nodes, we must make sure to check every - // function in the program that uses the global for uses of the node. - // Because of the globals graph, we might not have all of the information we - // need with our (potentially) truncated call graph traversal. - ProcessNodesReachableFromGlobals(DSG, NodeLVs); - - // Everything that survived goes into Fields now that we processed it. - while (!NodeLVs.empty()) { - Fields.insert(NodeLVs.begin()->second); - NodeLVs.erase(NodeLVs.begin()); - } - } -} - -/// ComputeInverseGraphFrom - Perform a simple depth-first search of the -/// DSGraph, recording the inverse of all of the edges in the graph. -/// -static void ComputeInverseGraphFrom(DSNode *N, - std::set<std::pair<DSNode*,DSNode*> > &InverseGraph) { - for (DSNode::edge_iterator I = N->edge_begin(), E = N->edge_end(); I != E;++I) - if (DSNode *Target = I->getNode()) - if (InverseGraph.insert(std::make_pair(Target, N)).second) - ComputeInverseGraphFrom(Target, InverseGraph); -} - - -/// ComputeNodesReacahbleFrom - Compute the set of nodes in the specified -/// inverse graph that are reachable from N. This is a simple depth first -/// search. -/// -static void ComputeNodesReachableFrom(DSNode *N, - std::set<std::pair<DSNode*,DSNode*> > &InverseGraph, - hash_set<const DSNode*> &Reachable) { - if (!Reachable.insert(N).second) return; // Already visited! - - std::set<std::pair<DSNode*,DSNode*> >::iterator I = - InverseGraph.lower_bound(std::make_pair(N, (DSNode*)0)); - for (; I != InverseGraph.end() && I->first == N; ++I) - ComputeNodesReachableFrom(I->second, InverseGraph, Reachable); -} - -/// ProcessNodesReachableFromGlobals - If we inferred anything about nodes -/// reachable from globals, we have to make sure that we incorporate data for -/// all graphs that include those globals due to the nature of the globals -/// graph. -/// -void StructureFieldVisitorBase:: -ProcessNodesReachableFromGlobals(DSGraph &DSG, - std::multimap<DSNode*,LatticeValue*> &NodeLVs){ - // Start by marking all nodes reachable from globals. - DSScalarMap &SM = DSG.getScalarMap(); - if (SM.global_begin() == SM.global_end()) return; - - hash_set<const DSNode*> Reachable; - for (DSScalarMap::global_iterator GI = SM.global_begin(), - E = SM.global_end(); GI != E; ++GI) - SM[*GI].getNode()->markReachableNodes(Reachable); - if (Reachable.empty()) return; - - // If any of the nodes with dataflow facts are reachable from the globals - // graph, we have to do the GG processing step. - bool MustProcessThroughGlobalsGraph = false; - for (std::multimap<DSNode*, LatticeValue*>::iterator I = NodeLVs.begin(), - E = NodeLVs.end(); I != E; ++I) - if (Reachable.count(I->first)) { - MustProcessThroughGlobalsGraph = true; - break; - } - - if (!MustProcessThroughGlobalsGraph) return; - Reachable.clear(); - - // Compute the mapping from DSG to the globals graph. - DSGraph::NodeMapTy DSGToGGMap; - DSG.computeGToGGMapping(DSGToGGMap); - - // Most of the times when we find facts about things reachable from globals we - // we are in the main graph. This means that we have *all* of the globals - // graph in this DSG. To be efficient, we compute the minimum set of globals - // that can reach any of the NodeLVs facts. - // - // I'm not aware of any wonderful way of computing the set of globals that - // points to the set of nodes in NodeLVs that is not N^2 in either NodeLVs or - // the number of globals, except to compute the inverse of DSG. As such, we - // compute the inverse graph of DSG, which basically has the edges going from - // pointed to nodes to pointing nodes. Because we only care about one - // connectedness properties, we ignore field info. In addition, we only - // compute inverse of the portion of the graph reachable from the globals. - std::set<std::pair<DSNode*,DSNode*> > InverseGraph; - - for (DSScalarMap::global_iterator GI = SM.global_begin(), - E = SM.global_end(); GI != E; ++GI) - ComputeInverseGraphFrom(SM[*GI].getNode(), InverseGraph); - - // Okay, now that we have our bastardized inverse graph, compute the set of - // globals nodes reachable from our lattice nodes. - for (std::multimap<DSNode*, LatticeValue*>::iterator I = NodeLVs.begin(), - E = NodeLVs.end(); I != E; ++I) - ComputeNodesReachableFrom(I->first, InverseGraph, Reachable); - - // Now that we know which nodes point to the data flow facts, figure out which - // globals point to the data flow facts. - std::set<GlobalValue*> Globals; - for (hash_set<const DSNode*>::iterator I = Reachable.begin(), - E = Reachable.end(); I != E; ++I) - Globals.insert((*I)->globals_begin(), (*I)->globals_end()); - - // Finally, loop over all of the DSGraphs for the program, computing - // information for the graph if not done already, mapping the result into our - // context. - for (hash_map<const Function*, DSGraph*>::iterator GI = ECG.DSInfo.begin(), - E = ECG.DSInfo.end(); GI != E; ++GI) { - DSGraph &FG = *GI->second; - // Graphs can contain multiple functions, only process the graph once. - if (GI->first != FG.retnodes_begin()->first || - // Also, do not bother reprocessing DSG. - &FG == &DSG) - continue; - - bool GraphUsesGlobal = false; - for (std::set<GlobalValue*>::iterator I = Globals.begin(), - E = Globals.end(); I != E; ++I) - if (FG.getScalarMap().count(*I)) { - GraphUsesGlobal = true; - break; - } - - // If this graph does not contain the global at all, there is no reason to - // even think about it. - if (!GraphUsesGlobal) continue; - - // Otherwise, compute the full set of dataflow effects of the function. - std::multimap<DSNode*, LatticeValue*> &FGF = getCalleeFacts(FG); - //std::cerr << "Computed: " << FG.getFunctionNames() << "\n"; - -#if 0 - for (std::multimap<DSNode*, LatticeValue*>::iterator I = FGF.begin(), - E = FGF.end(); I != E; ++I) - I->second->dump(); -#endif - // Compute the mapping of nodes in the globals graph to the function's - // graph. Note that this function graph may not have nodes (or may have - // fragments of full nodes) in the globals graph, and we don't want this to - // pessimize the analysis. - std::multimap<const DSNode*, std::pair<DSNode*,int> > GraphMap; - DSGraph::NodeMapTy GraphToGGMap; - FG.computeGToGGMapping(GraphToGGMap); - - // "Invert" the mapping. We compute the mapping from the start of a global - // graph node to a place in the graph's node. Note that not all of the GG - // node may be present in the graphs node, so there may be a negative offset - // involved. - while (!GraphToGGMap.empty()) { - DSNode *GN = const_cast<DSNode*>(GraphToGGMap.begin()->first); - DSNodeHandle &GGNH = GraphToGGMap.begin()->second; - GraphMap.insert(std::make_pair(GGNH.getNode(), - std::make_pair(GN, -GGNH.getOffset()))); - GraphToGGMap.erase(GraphToGGMap.begin()); - } - - // Loop over all of the dataflow facts that we have computed, mapping them - // to the globals graph. - for (std::multimap<DSNode*, LatticeValue*>::iterator I = NodeLVs.begin(), - E = NodeLVs.end(); I != E; ) { - bool FactHitBottom = false; - - //I->second->dump(); - - assert(I->first->getParentGraph() == &DSG); - assert(I->second->getNode()->getParentGraph() == &DSG); - - // Node is in the GG? - DSGraph::NodeMapTy::iterator DSGToGGMapI = DSGToGGMap.find(I->first); - if (DSGToGGMapI != DSGToGGMap.end()) { - DSNodeHandle &GGNH = DSGToGGMapI->second; - const DSNode *GGNode = GGNH.getNode(); - unsigned DSGToGGOffset = GGNH.getOffset(); - - // See if there is a node in FG that corresponds to this one. If not, - // no information will be computed in this scope, as the memory is not - // accessed. - std::multimap<const DSNode*, std::pair<DSNode*,int> >::iterator GMI = - GraphMap.find(GGNode); - - // LatticeValOffset - The offset from the start of the GG Node to the - // start of the field we are interested in. - unsigned LatticeValOffset = I->second->getFieldOffset()+DSGToGGOffset; - - // Loop over all of the nodes in FG that correspond to this single node - // in the GG. - for (; GMI != GraphMap.end() && GMI->first == GGNode; ++GMI) { - // Compute the offset to the field in the user graph. - unsigned FieldOffset = LatticeValOffset - GMI->second.second; - - // If the field is within the amount of memory accessed by this scope, - // then there must be a corresponding lattice value. - DSNode *FGNode = GMI->second.first; - if (FieldOffset < FGNode->getSize()) { - LatticeValue *CorrespondingLV = 0; - - std::multimap<DSNode*, LatticeValue*>::iterator FGFI = - FGF.find(FGNode); - for (; FGFI != FGF.end() && FGFI->first == FGNode; ++FGFI) - if (FGFI->second->getFieldOffset() == FieldOffset) { - CorrespondingLV = FGFI->second; - break; - } - - // Finally, if either there was no corresponding fact (because it - // hit bottom in this scope), or if merging the two pieces of - // information makes it hit bottom, remember this. - if (CorrespondingLV == 0 || - I->second->mergeInValue(CorrespondingLV)) - FactHitBottom = true; - } - } - } - - if (FactHitBottom) { - delete I->second; - NodeLVs.erase(I++); - if (NodeLVs.empty()) return; - } else { - ++I; - } - } - } -} - - -/// getCalleeFacts - Compute the data flow effect that calling one of the -/// functions in this graph has on the caller. This information is cached after -/// it is computed for a function the first time. -/// -std::multimap<DSNode*, LatticeValue*> & -StructureFieldVisitorBase::getCalleeFacts(DSGraph &DSG) { - // Already computed? - std::map<DSGraph*, std::multimap<DSNode*,LatticeValue*> >::iterator - I = CalleeFnFacts.find(&DSG); - if (I != CalleeFnFacts.end()) - return I->second; // We already computed stuff for this fn! - - std::multimap<DSNode*, LatticeValue*> &Result = CalleeFnFacts[&DSG]; - - std::set<LatticeValue*> LVs; - for (DSGraph::node_iterator NI = DSG.node_begin(), E = DSG.node_end(); - NI != E; ++NI) - AddLatticeValuesForNode(NI, LVs); - - while (!LVs.empty()) { - Result.insert(std::make_pair((*LVs.begin())->getNode(), *LVs.begin())); - LVs.erase(LVs.begin()); - } - - if (!Result.empty()) - visitGraph(DSG, Result); - return Result; -} - - -/// NodeCanPossiblyBeInteresting - Return true if the specified node can -/// potentially be interesting to a client that is only interested in -/// VisitFlags events. This is used to reduce the cost of interprocedural -/// analysis by not traversing the call graph through portions that the DSGraph -/// can answer immediately. -/// -static bool NodeCanPossiblyBeInteresting(const DSNode *N, unsigned VisitFlags) { - // No fields are accessed in this context. - if (N->getType() == Type::VoidTy) return false; - - // This node is possibly interesting if we are looking for reads and it is - // read, we're looking for writes and it is modified, etc. - if ((VisitFlags & Visit::Loads) && N->isRead()) return true; - if ((VisitFlags & Visit::Stores) && N->isModified()) return true; - - assert((VisitFlags & ~(Visit::Loads|Visit::Stores)) == 0 && - "Unknown visitation type!"); - - // Otherwise, this node is not interesting to the current client. - return false; -} - -/// visitGraph - Visit the functions in the specified graph, updating the -/// specified lattice values for all of their uses. -/// -void StructureFieldVisitorBase:: -visitGraph(DSGraph &DSG, std::multimap<DSNode*, LatticeValue*> &NodeLVs) { - assert(!NodeLVs.empty() && "No lattice values to compute!"); - - // To visit a graph, first step, we visit the instruction making up each - // function in the graph, but ignore calls when processing them. We handle - // call nodes explicitly by looking at call nodes in the graph if needed. We - // handle instructions before calls to avoid interprocedural analysis if we - // can drive lattice values to bottom early. - // - SFVInstVisitor IV(DSG, Callbacks, NodeLVs); - - for (DSGraph::retnodes_iterator FI = DSG.retnodes_begin(), - E = DSG.retnodes_end(); FI != E; ++FI) - for (Function::iterator BB = FI->first->begin(), E = FI->first->end(); - BB != E; ++BB) - for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) - if (IV.visit(*I) && NodeLVs.empty()) - return; // Nothing left to analyze. - - // Keep track of which actual direct callees are handled. - std::set<Function*> CalleesHandled; - - // Once we have visited all of the instructions in the function bodies, if - // there are lattice values that have not been driven to bottom, see if any of - // the nodes involved are passed into function calls. If so, we potentially - // have to recursively traverse the call graph. - for (DSGraph::fc_iterator CS = DSG.fc_begin(), E = DSG.fc_end(); - CS != E; ++CS) { - // Figure out the mapping from a node in the caller (potentially several) - // nodes in the callee. - DSGraph::NodeMapTy CallNodeMap; - - Instruction *TheCall = CS->getCallSite().getInstruction(); - - // If this is an indirect function call, assume nothing gets passed through - // it. FIXME: THIS IS BROKEN! Just get the ECG for the fn ptr if it's not - // direct. - if (CS->isIndirectCall()) - continue; - - // If this is an external function call, it cannot be involved with this - // node, because otherwise the node would be marked incomplete! - if (CS->getCalleeFunc()->isExternal()) - continue; - - // If we can handle this function call, remove it from the set of direct - // calls found by the visitor. - CalleesHandled.insert(CS->getCalleeFunc()); - - std::vector<DSNodeHandle> Args; - - DSGraph *CG = &ECG.getDSGraph(*CS->getCalleeFunc()); - CG->getFunctionArgumentsForCall(CS->getCalleeFunc(), Args); - - if (!CS->getRetVal().isNull()) - DSGraph::computeNodeMapping(Args[0], CS->getRetVal(), CallNodeMap); - for (unsigned i = 0, e = CS->getNumPtrArgs(); i != e; ++i) { - if (i == Args.size()-1) break; - DSGraph::computeNodeMapping(Args[i+1], CS->getPtrArg(i), CallNodeMap); - } - Args.clear(); - - // The mapping we just computed maps from nodes in the callee to nodes in - // the caller, so we can't query it efficiently. Instead of going through - // the trouble of inverting the map to do this (linear time with the size of - // the mapping), we just do a linear search to see if any affected nodes are - // passed into this call. - bool CallCanModifyDataFlow = false; - for (DSGraph::NodeMapTy::iterator MI = CallNodeMap.begin(), - E = CallNodeMap.end(); MI != E; ++MI) - if (NodeLVs.count(MI->second.getNode())) - // Okay, the node is passed in, check to see if the call might do - // something interesting to it (i.e. if analyzing the call can produce - // anything other than "top"). - if ((CallCanModifyDataFlow = NodeCanPossiblyBeInteresting(MI->first, - Callbacks))) - break; - - // If this function call cannot impact the analysis (either because the - // nodes we are tracking are not passed into the call, or the DSGraph for - // the callee tells us that analysis of the callee can't provide interesting - // information), ignore it. - if (!CallCanModifyDataFlow) - continue; - - // Okay, either compute analysis results for the callee function, or reuse - // results previously computed. - std::multimap<DSNode*, LatticeValue*> &CalleeFacts = getCalleeFacts(*CG); - - // Merge all of the facts for the callee into the facts for the caller. If - // this reduces anything in the caller to 'bottom', remove them. - for (DSGraph::NodeMapTy::iterator MI = CallNodeMap.begin(), - E = CallNodeMap.end(); MI != E; ++MI) { - // If we have Lattice facts in the caller for this node in the callee, - // merge any information from the callee into the caller. - - // If the node is not accessed in the callee at all, don't update. - if (MI->first->getType() == Type::VoidTy) - continue; - - // If there are no data-flow facts live in the caller for this node, don't - // both processing it. - std::multimap<DSNode*, LatticeValue*>::iterator NLVI = - NodeLVs.find(MI->second.getNode()); - if (NLVI == NodeLVs.end()) continue; - - - // Iterate over all of the lattice values that have corresponding fields - // in the callee, merging in information as we go. Be careful about the - // fact that the callee may get passed the address of a substructure and - // other funny games. - //if (CalleeFacts.count(const_cast<DSNode*>(MI->first)) == 0) { - - DSNode *CalleeNode = const_cast<DSNode*>(MI->first); - - unsigned CalleeNodeOffset = MI->second.getOffset(); - while (NLVI->first == MI->second.getNode()) { - // Figure out what offset in the callee this field would land. - unsigned FieldOff = NLVI->second->getFieldOffset()+CalleeNodeOffset; - - // If the field is not within the callee node, ignore it. - if (FieldOff >= CalleeNode->getSize()) { - ++NLVI; - continue; - } - - // Okay, check to see if we have a lattice value for the field at offset - // FieldOff in the callee node. - const LatticeValue *CalleeLV = 0; - - std::multimap<DSNode*, LatticeValue*>::iterator CFI = - CalleeFacts.lower_bound(CalleeNode); - for (; CFI != CalleeFacts.end() && CFI->first == CalleeNode; ++CFI) - if (CFI->second->getFieldOffset() == FieldOff) { - CalleeLV = CFI->second; // Found it! - break; - } - - // If we don't, the lattice value hit bottom and we should remove the - // lattice value in the caller. - if (!CalleeLV) { - delete NLVI->second; // The lattice value hit bottom. - NodeLVs.erase(NLVI++); - continue; - } - - // Finally, if we did find a corresponding entry, merge the information - // into the caller's lattice value and keep going. - if (NLVI->second->mergeInValue(CalleeLV)) { - // Okay, merging these two caused the caller value to hit bottom. - // Remove it. - delete NLVI->second; // The lattice value hit bottom. - NodeLVs.erase(NLVI++); - } - - ++NLVI; // We successfully merged in some information! - } - - // If we ran out of facts to prove, just exit. - if (NodeLVs.empty()) return; - } - } - - // The local analysis pass inconveniently discards many local function calls - // from the graph if they are to known functions. Loop over direct function - // calls not handled above and visit them as appropriate. - while (!IV.DirectCallSites.empty()) { - Instruction *Call = *IV.DirectCallSites.begin(); - IV.DirectCallSites.erase(IV.DirectCallSites.begin()); - - // Is this one actually handled by DSA? - if (CalleesHandled.count(cast<Function>(Call->getOperand(0)))) - continue; - - // Collect the pointers involved in this call. - std::vector<Value*> Pointers; - if (isa<PointerType>(Call->getType())) - Pointers.push_back(Call); - for (unsigned i = 1, e = Call->getNumOperands(); i != e; ++i) - if (isa<PointerType>(Call->getOperand(i)->getType())) - Pointers.push_back(Call->getOperand(i)); - - // If this is an intrinsic function call, figure out which one. - unsigned IID = cast<Function>(Call->getOperand(0))->getIntrinsicID(); - - for (unsigned i = 0, e = Pointers.size(); i != e; ++i) { - // If any of our lattice values are passed into this call, which is - // specially handled by the local analyzer, inform the lattice function. - DSNode *N = DSG.getNodeForValue(Pointers[i]).getNode(); - for (std::multimap<DSNode*, LatticeValue*>::iterator LVI = - NodeLVs.lower_bound(N); LVI != NodeLVs.end() && LVI->first == N;) { - bool AtBottom = false; - switch (IID) { - default: - AtBottom = LVI->second->visitRecognizedCall(*Call); - break; - case Intrinsic::memset: - if (Callbacks & Visit::Stores) - AtBottom = LVI->second->visitMemSet(*cast<CallInst>(Call)); - break; - } - - if (AtBottom) { - delete LVI->second; - NodeLVs.erase(LVI++); - } else { - ++LVI; - } - } - } - } -}
diff --git a/poolalloc/lib/Macroscopic/StructureFieldVisitor.h b/poolalloc/lib/Macroscopic/StructureFieldVisitor.h deleted file mode 100644 index 767ac70..0000000 --- a/poolalloc/lib/Macroscopic/StructureFieldVisitor.h +++ /dev/null
@@ -1,277 +0,0 @@ -//===-- StructureFieldVisitor.h - Macroscopic DS inspector ------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the public interface to the LatticeValue and -// StructureFieldVisitor classes. -// -//===----------------------------------------------------------------------===// - -#ifndef MACROSCOPIC_STRUCTUREFIELDVISITOR_H -#define MACROSCOPIC_STRUCTUREFIELDVISITOR_H - -#include <set> -#include <map> -#include <vector> - -namespace llvm { - class Type; - class Constant; - class Instruction; - class LoadInst; - class CallInst; - class StoreInst; - class EquivClassGraphs; - class DSNode; - class DSGraph; - -namespace Macroscopic { - -/// FindAllDataStructures - Inspect the program specified by ECG, adding to -/// 'Nodes' all of the data structures node in the program that contain the -/// "IncludeFlags" and do not contain "ExcludeFlags" node flags. If -/// OnlyHomogenous is true, only type-homogenous nodes are considered. -void FindAllDataStructures(std::set<DSNode*> &Nodes, unsigned IncludeFlags, - unsigned ExcludeFlags, bool OnlyHomogenous, - EquivClassGraphs &ECG); - -//===----------------------------------------------------------------------===// -/// Visit types - This describes an enum specifying which methods are -/// overloaded in the concrete implementation of the LatticeValue class. -namespace Visit { - enum { - Loads = 1, - Stores = 2, - Allocs = 4, - Deallocs = 8, - // ... - }; -} - -//===----------------------------------------------------------------------===// -/// LatticeValue - Describe. -/// -class LatticeValue { - DSNode *Node; - std::vector<unsigned> Idxs; // The index path to get to this field. - const Type *FieldTy; // The type of this field. -public: - LatticeValue(DSNode *N, const std::vector<unsigned> &I, - const Type *Ty) : Node(N), Idxs(I), FieldTy(Ty) {} - virtual ~LatticeValue() {} - - DSNode *getNode() const { return Node; } - DSGraph &getParentGraph() const; - - const std::vector<unsigned> &getIndices() const { return Idxs; } - const Type *getFieldType() const { return FieldTy; } - - /// getFieldOffset - Get the byte offset of this field from the start of the - /// node. - /// - unsigned getFieldOffset() const; - - /// dump - Print debugging information about this class. - /// - virtual void dump() const; - - /// mergeInValue - Merge the information from the RHS lattice value (which is - /// guaranteed to be the same dynamic type as 'this') into this lattice value. - /// If the resultant value hits bottom, return true. This is used for - /// interprocedural analysis. - /// - virtual bool mergeInValue(const LatticeValue *RHS) { - return true; - } - - //===--------------------------------------------------------------------===// - // Visitation methods - These methods update the current lattice state - // based on the information in the operation. If the lattice value reaches - // bottom, the method implementation should return true so that analysis - // can be stopped as early as possible. Visitation methods are grouped by - // their Visitation class. - - // All lattice values must implement these. - - /// visitRecognizedCall - The node for this lattice value is passed into some - /// external function that is "known" by the Local analysis pass (e.g. atoi). - /// By default, this stops any analysis of the node. - /// - virtual bool visitRecognizedCall(Instruction &I) { - return true; - } - - // Load Vistation methods. - virtual bool visitLoad(LoadInst &); - - // Store Visitation methods. - virtual bool visitStore(StoreInst &); - virtual bool visitGlobalInit(Constant *InitVal); - virtual bool visitMemSet(CallInst &I) { - return visitRecognizedCall((Instruction&)I); - } -}; - -//===----------------------------------------------------------------------===// -/// CombinedLatticeValue - Describe. -/// -template<typename L1, typename L2> -class CombinedLatticeValue : public LatticeValue { - L1 LV1; L2 LV2; - bool LV1Bottom, LV2Bottom; -public: - CombinedLatticeValue(DSNode *Node, const std::vector<unsigned> &Idxs, - const Type *FieldTy) - : LatticeValue(Node, Idxs, FieldTy), LV1(Node, Idxs, FieldTy), - LV2(Node, Idxs, FieldTy), LV1Bottom(false), LV2Bottom(false) {} - - static unsigned getInterestingEvents() { - return L1::getInterestingEvents() | L2::getInterestingEvents(); - } - - static CombinedLatticeValue *create(DSNode *Node, - const std::vector<unsigned> &Idxs, - const Type *FieldTy) { - return new CombinedLatticeValue(Node, Idxs, FieldTy); - } - - void dump() const { - if (!LV1Bottom) LV1.dump(); - if (!LV2Bottom) LV2.dump(); - } - - virtual bool mergeInValue(const LatticeValue *RHSLV) { - const CombinedLatticeValue *RHS = - static_cast<const CombinedLatticeValue *>(RHSLV); - LV1Bottom |= RHS->LV1Bottom; - LV2Bottom |= RHS->LV2Bottom; - if (!LV1Bottom) LV1Bottom = LV1.mergeInValue(&RHS->LV1); - if (!LV2Bottom) LV2Bottom = LV2.mergeInValue(&RHS->LV2); - return LV1Bottom & LV2Bottom; - } - - virtual bool visitRecognizedCall(Instruction &I) { - if (!LV1Bottom) LV1Bottom = LV1.visitRecognizedCall(I); - if (!LV2Bottom) LV2Bottom = LV2.visitRecognizedCall(I); - return LV1Bottom & LV2Bottom; - } - - // Load Vistation methods. - virtual bool visitLoad(LoadInst &LI) { - if (!LV1Bottom && (L1::getInterestingEvents() & Visit::Loads)) - LV1Bottom = LV1.visitLoad(LI); - if (!LV2Bottom && (L2::getInterestingEvents() & Visit::Loads)) - LV2Bottom = LV2.visitLoad(LI); - return LV1Bottom & LV2Bottom; - } - - // Store Visitation methods. - virtual bool visitStore(StoreInst &SI) { - if (!LV1Bottom && (L1::getInterestingEvents() & Visit::Stores)) - LV1Bottom = LV1.visitStore(SI); - if (!LV2Bottom && (L2::getInterestingEvents() & Visit::Stores)) - LV2Bottom = LV2.visitStore(SI); - return LV1Bottom & LV2Bottom; - } - - virtual bool visitGlobalInit(Constant *InitVal) { - if (!LV1Bottom && (L1::getInterestingEvents() & Visit::Stores)) - LV1Bottom = LV1.visitGlobalInit(InitVal); - if (!LV2Bottom && (L2::getInterestingEvents() & Visit::Stores)) - LV2Bottom = LV2.visitGlobalInit(InitVal); - return LV1Bottom & LV2Bottom; - } - - virtual bool visitMemSet(CallInst &I) { - if (!LV1Bottom && (L1::getInterestingEvents() & Visit::Stores)) - LV1Bottom = LV1.visitMemSet(I); - if (!LV2Bottom && (L2::getInterestingEvents() & Visit::Stores)) - LV2Bottom = LV2.visitMemSet(I); - return LV1Bottom & LV2Bottom; - } -}; - - -//===----------------------------------------------------------------------===// -/// StructureFieldVisitorBase - This implements all of the heavy lifting -/// for the StructureFieldVisitor class. This class should not be used -/// directly, see it (below) for usage. -/// -class StructureFieldVisitorBase { - unsigned Callbacks; // Bitfield containing bits from Macroscopic::Visit - EquivClassGraphs &ECG; - - std::map<DSGraph*, std::multimap<DSNode*,LatticeValue*> > CalleeFnFacts; - - // createLatticeValue - Provide a virtual ctor for the concrete lattice value. - virtual LatticeValue* createLatticeValue(DSNode *Node, - const std::vector<unsigned> &Idxs, - const Type *FieldTy) = 0; -protected: - // Only allow this to be subclassed. - StructureFieldVisitorBase(unsigned CB, EquivClassGraphs &ecg) - : Callbacks(CB), ECG(ecg) {} - virtual ~StructureFieldVisitorBase() {} - - - std::set<LatticeValue*> visitNodes(const std::set<DSNode*> &Nodes); - void visitFields(std::set<LatticeValue*> &Fields); - -private: - void visitGraph(DSGraph &DSG, std::multimap<DSNode*, LatticeValue*> &NodeLVs); - std::multimap<DSNode*, LatticeValue*> &getCalleeFacts(DSGraph &DSG); - - void AddLatticeValuesForFields(DSNode *N, const Type *Ty, - const std::vector<unsigned> &Idxs, - std::set<LatticeValue*> &Values); - void AddLatticeValuesForNode(DSNode *N, std::set<LatticeValue*> &Values); - void ProcessNodesReachableFromGlobals(DSGraph &DSG, - std::multimap<DSNode*,LatticeValue*> &NodeLVs); - -}; - - - -//===----------------------------------------------------------------------===// -/// FIXME: Describe -template<typename ConcLatticeVal> -class StructureFieldVisitor : public StructureFieldVisitorBase { -public: - // FIXME: We really want to be able to infer which methods LatticeVal - // overloads from the base class using template metaprogramming techniques. - StructureFieldVisitor(EquivClassGraphs &ECG) - : StructureFieldVisitorBase(ConcLatticeVal::getInterestingEvents(), ECG) {} - - /// visit - Visit the specified set of data structure nodes, recursively - /// visiting all accesses to structure fields defined in those nodes. This - /// method returns a set of lattice values that have not reached bottom. - std::set<ConcLatticeVal*> visit(const std::set<DSNode*> &Nodes) { - std::set<LatticeValue*> ResultVals = visitNodes(Nodes); - - // Convert the result set to the appropriate lattice type. - std::set<ConcLatticeVal*> Result; - while (!ResultVals.empty()) { - Result.insert(static_cast<ConcLatticeVal*>(*ResultVals.begin())); - ResultVals.erase(ResultVals.begin()); - } - return Result; - } - - -private: // Virtual method implementations for the base class. - virtual LatticeValue* createLatticeValue(DSNode *N, - const std::vector<unsigned> &Idxs, - const Type *FieldTy) { - return ConcLatticeVal::create(N, Idxs, FieldTy); - } -}; - -} // End Macroscopic namespace -} // End llvm namespace - -#endif
diff --git a/poolalloc/lib/Makefile b/poolalloc/lib/Makefile deleted file mode 100644 index c8d2b81..0000000 --- a/poolalloc/lib/Makefile +++ /dev/null
@@ -1,11 +0,0 @@ -# -# Relative path to the top of the source tree. -# -LEVEL=.. - -# -# List all of the subdirectories that we will compile. -# -DIRS=PoolAllocate - -include $(LEVEL)/Makefile.common
diff --git a/poolalloc/lib/PoolAllocate/AccessTrace.cpp b/poolalloc/lib/PoolAllocate/AccessTrace.cpp deleted file mode 100644 index 1fece6e..0000000 --- a/poolalloc/lib/PoolAllocate/AccessTrace.cpp +++ /dev/null
@@ -1,129 +0,0 @@ -//===-- PoolAccessTrace.cpp - Build trace of loads ------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the -poolaccesstrace pass. -// -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "pointercompress" -#include "PoolAllocate.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Instructions.h" -#include "llvm/Module.h" -using namespace llvm; - -namespace { - - /// PoolAccessTrace - This transformation adds instrumentation to the program - /// to print a trace of pairs containing the address of each load and the pool - /// descriptor loaded from. - class PoolAccessTrace : public ModulePass { - PoolAllocate *PoolAlloc; - EquivClassGraphs *ECG; - Function *AccessTraceInitFn, *PoolAccessTraceFn; - const Type *VoidPtrTy; - public: - - bool runOnModule(Module &M); - - void getAnalysisUsage(AnalysisUsage &AU) const; - - const DSGraph &getGraphForFunc(PA::FuncInfo *FI) const { - return ECG->getDSGraph(FI->F); - } - - private: - void InitializeLibraryFunctions(Module &M); - void InstrumentAccess(Instruction *I, Value *Ptr, - PA::FuncInfo *FI, DSGraph &DSG); - }; - - RegisterOpt<PoolAccessTrace> - X("poolaccesstrace", "Instrument program to print trace of accesses"); -} - -void PoolAccessTrace::getAnalysisUsage(AnalysisUsage &AU) const { - // Need information about how pool allocation happened. - AU.addRequired<PoolAllocatePassAllPools>(); - - // Need information from DSA. - AU.addRequired<EquivClassGraphs>(); -} - -void PoolAccessTrace::InitializeLibraryFunctions(Module &M) { - VoidPtrTy = PointerType::get(Type::SByteTy); - - AccessTraceInitFn = M.getOrInsertFunction("poolaccesstraceinit", - Type::VoidTy,NULL); - PoolAccessTraceFn = M.getOrInsertFunction("poolaccesstrace", Type::VoidTy, - VoidPtrTy, VoidPtrTy, NULL); -} - -void PoolAccessTrace::InstrumentAccess(Instruction *I, Value *Ptr, - PA::FuncInfo *FI, DSGraph &DSG) { - // Don't trace loads of globals or the stack. - if (isa<Constant>(Ptr) || isa<AllocaInst>(Ptr)) return; - - Value *MappedPtr = Ptr; - if (!FI->NewToOldValueMap.empty()) - if ((MappedPtr = FI->MapValueToOriginal(MappedPtr)) == 0) { - // Value didn't exist in the orig program (pool desc?). - return; - } - DSNode *Node = DSG.getNodeForValue(MappedPtr).getNode(); - if (Node == 0) return; - - Value *PD = FI->PoolDescriptors[Node]; - Ptr = new CastInst(Ptr, VoidPtrTy, Ptr->getName(), I); - - if (PD) - PD = new CastInst(PD, VoidPtrTy, PD->getName(), I); - else - PD = Constant::getNullValue(VoidPtrTy); - - // Insert the trace call. - new CallInst(PoolAccessTraceFn, Ptr, PD, "", I); -} - -bool PoolAccessTrace::runOnModule(Module &M) { - PoolAlloc = &getAnalysis<PoolAllocatePassAllPools>(); - ECG = &getAnalysis<EquivClassGraphs>(); - - // Create the function prototypes for runtime library. - InitializeLibraryFunctions(M); - - Function *MainFunc = M.getMainFunction(); - if (MainFunc && !MainFunc->isExternal()) - // Insert a call to the library init function into the beginning of main. - new CallInst(AccessTraceInitFn, "", MainFunc->begin()->begin()); - - // Look at all of the loads in the program. - for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { - if (F->isExternal()) continue; - - PA::FuncInfo *FI = PoolAlloc->getFuncInfoOrClone(*F); - assert(FI && "DIDN'T FIND POOL INFO!"); - - // If this function was cloned, and this is the original function, ignore it - // (it's dead). We'll deal with the cloned version later when we run into - // it again. - if (FI->Clone && &FI->F == F) - continue; - - // Get the DSGraph for this function. - DSGraph &DSG = ECG->getDSGraph(FI->F); - - for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) - for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) - if (LoadInst *LI = dyn_cast<LoadInst>(I)) - InstrumentAccess(LI, LI->getOperand(0), FI, DSG); - } - return true; -}
diff --git a/poolalloc/lib/PoolAllocate/Heuristic.cpp b/poolalloc/lib/PoolAllocate/Heuristic.cpp deleted file mode 100644 index 2d6e3eb..0000000 --- a/poolalloc/lib/PoolAllocate/Heuristic.cpp +++ /dev/null
@@ -1,509 +0,0 @@ -//===-- Heuristic.cpp - Interface to PA heuristics ------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This implements the various pool allocation heuristics. -// -//===----------------------------------------------------------------------===// - -#include "Heuristic.h" -#include "PoolAllocate.h" -#include "llvm/Instructions.h" -#include "llvm/Module.h" -#include "llvm/Analysis/DataStructure/DSGraphTraits.h" -#include "llvm/ADT/DepthFirstIterator.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Target/TargetData.h" -#include <iostream> -using namespace llvm; -using namespace PA; - -namespace { - enum PoolAllocHeuristic { - NoNodes, - OnlyOverhead, - AllInOneGlobalPool, - SmartCoallesceNodes, - CyclicNodes, - AllButUnreachableFromMemory, - AllNodes - }; - cl::opt<PoolAllocHeuristic> - TheHeuristic("poolalloc-heuristic", - cl::desc("Heuristic to choose which nodes to pool allocate"), - cl::values(clEnumVal(AllNodes, " Pool allocate all nodes"), - clEnumVal(AllButUnreachableFromMemory, " Pool allocate all reachable from memory objects"), - clEnumVal(CyclicNodes, " Pool allocate nodes with cycles"), - clEnumVal(SmartCoallesceNodes, " Use the smart node merging heuristic"), - clEnumVal(AllInOneGlobalPool, " Use pool library as replacement for malloc/free"), - clEnumVal(OnlyOverhead, " Do not pool allocate anything, but induce all overhead from it"), - clEnumVal(NoNodes, " Do not pool allocate anything"), - clEnumValEnd), - cl::init(AllButUnreachableFromMemory)); - - cl::opt<bool> - DisableAlignOpt("poolalloc-disable-alignopt", - cl::desc("Force all pool alignment to 8 bytes")); -} - -Heuristic::~Heuristic() {} - -unsigned Heuristic::getRecommendedSize(const DSNode *N) { - unsigned PoolSize = 0; - if (!N->isArray() && N->getType()->isSized()) { - PoolSize = N->getParentGraph()->getTargetData().getTypeSize(N->getType()); - } - if (PoolSize == 1) PoolSize = 0; - return PoolSize; -} - -/// Wants8ByteAlignment - FIXME: this is a complete hack for X86 right now. -static bool Wants8ByteAlignment(const Type *Ty, unsigned Offs, - const TargetData &TD) { - if (DisableAlignOpt) return true; - - if ((Offs & 7) == 0) { - // Doubles always want to be 8-byte aligned. - if (Ty == Type::DoubleTy) return true; - - // If we are on a 64-bit system, we want to align 8-byte integers and - // pointers. - if (TD.getTypeAlignment(Ty) == 8) - return true; - } - - if (Ty->isPrimitiveType() || isa<PointerType>(Ty)) - return false; - - if (const StructType *STy = dyn_cast<StructType>(Ty)) { - const StructLayout *SL = TD.getStructLayout(STy); - for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { - if (Wants8ByteAlignment(STy->getElementType(i), - Offs+SL->MemberOffsets[i], TD)) - return true; - } - } else if (const SequentialType *STy = dyn_cast<SequentialType>(Ty)) { - return Wants8ByteAlignment(STy->getElementType(), Offs, TD); - } else { - std::cerr << *Ty << "\n"; - assert(0 && "Unknown type!"); - } - return false; -} - -unsigned Heuristic::getRecommendedAlignment(const Type *Ty, - const TargetData &TD) { - if (Ty == Type::VoidTy) // Is this void or collapsed? - return 0; // No known alignment, let runtime decide. - - return Wants8ByteAlignment(Ty, 0, TD) ? 8 : 4; -} - -/// getRecommendedAlignment - Return the recommended object alignment for this -/// DSNode. -/// -unsigned Heuristic::getRecommendedAlignment(const DSNode *N) { - if (N->getType() == Type::VoidTy) // Is this void or collapsed? - return 0; // No known alignment, let runtime decide. - - const TargetData &TD = N->getParentGraph()->getTargetData(); - - // If there are no doubles on an 8-byte boundary in this structure, there is - // no reason to 8-byte align objects in the pool. - return Wants8ByteAlignment(N->getType(), 0, TD) ? 8 : 4; -} - - -//===-- AllNodes Heuristic ------------------------------------------------===// -// -// This heuristic pool allocates everything possible into separate pools. -// -struct AllNodesHeuristic : public Heuristic { - - void AssignToPools(const std::vector<const DSNode*> &NodesToPA, - Function *F, DSGraph &G, - std::vector<OnePool> &ResultPools) { - for (unsigned i = 0, e = NodesToPA.size(); i != e; ++i) - ResultPools.push_back(OnePool(NodesToPA[i])); - } -}; - - -//===-- AllButUnreachableFromMemoryHeuristic Heuristic --------------------===// -// -// This heuristic pool allocates everything possible into separate pools, unless -// the pool is not reachable by other memory objects. This filters out objects -// that are not cyclic and are only pointed to by scalars: these tend to be -// singular memory allocations that are not worth creating a whole pool for. -// -struct AllButUnreachableFromMemoryHeuristic : public Heuristic { - - void AssignToPools(const std::vector<const DSNode*> &NodesToPA, - Function *F, DSGraph &G, - std::vector<OnePool> &ResultPools) { - // Build a set of all nodes that are reachable from another node in the - // graph. Here we ignore scalar nodes that are only globals as they are - // often global pointers to big arrays. - std::set<const DSNode*> ReachableFromMemory; - for (DSGraph::node_iterator I = G.node_begin(), E = G.node_end(); - I != E; ++I) { - DSNode *N = I; - // Ignore nodes that are just globals and not arrays. - /* - if (N->isArray() || N->isHeapNode() || N->isAllocaNode() || - N->isUnknownNode()) - */ - // If a node is marked, all children are too. - if (!ReachableFromMemory.count(N)) - for (DSNode::iterator NI = N->begin(), E = N->end(); NI != E; ++NI) - for (df_ext_iterator<const DSNode*> - DI = df_ext_begin(*NI, ReachableFromMemory), - E = df_ext_end(*NI, ReachableFromMemory); DI != E; ++DI) - /*empty*/; - } - - // Only pool allocate a node if it is reachable from a memory object (itself - // included). - for (unsigned i = 0, e = NodesToPA.size(); i != e; ++i) - if (ReachableFromMemory.count(NodesToPA[i])) - ResultPools.push_back(OnePool(NodesToPA[i])); - } -}; - -//===-- CyclicNodes Heuristic ---------------------------------------------===// -// -// This heuristic only pool allocates nodes in an SCC in the DSGraph. -// -struct CyclicNodesHeuristic : public Heuristic { - - void AssignToPools(const std::vector<const DSNode*> &NodesToPA, - Function *F, DSGraph &G, - std::vector<OnePool> &ResultPools); -}; - -static bool NodeExistsInCycle(const DSNode *N) { - for (DSNode::const_iterator I = N->begin(), E = N->end(); I != E; ++I) - if (*I && std::find(df_begin(*I), df_end(*I), N) != df_end(*I)) - return true; - return false; -} - -void CyclicNodesHeuristic::AssignToPools(const std::vector<const - DSNode*> &NodesToPA, - Function *F, DSGraph &G, - std::vector<OnePool> &ResultPools) { - for (unsigned i = 0, e = NodesToPA.size(); i != e; ++i) - if (NodeExistsInCycle(NodesToPA[i])) - ResultPools.push_back(OnePool(NodesToPA[i])); -} - - -//===-- SmartCoallesceNodes Heuristic -------------------------------------===// -// -// This heuristic attempts to be smart and coallesce nodes at times. In -// practice, it doesn't work very well. -// -struct SmartCoallesceNodesHeuristic : public Heuristic { - - void AssignToPools(const std::vector<const DSNode*> &NodesToPA, - Function *F, DSGraph &G, - std::vector<OnePool> &ResultPools) { - // For globals, do not pool allocate unless the node is cyclic and not an - // array (unless it's collapsed). - if (F == 0) { - for (unsigned i = 0, e = NodesToPA.size(); i != e; ++i) { - const DSNode *Node = NodesToPA[i]; - if ((Node->isNodeCompletelyFolded() || !Node->isArray()) && - NodeExistsInCycle(Node)) - ResultPools.push_back(OnePool(Node)); - } - } else { - // TODO - } - } -}; - -#if 0 -/// NodeIsSelfRecursive - Return true if this node contains a pointer to itself. -static bool NodeIsSelfRecursive(DSNode *N) { - for (DSNode::iterator I = N->begin(), E = N->end(); I != E; ++I) - if (*I == N) return true; - return false; -} - -/// POVisit - This implements functionality found in Support/PostOrderIterator.h -/// but in a way that allows multiple roots to be used. If PostOrderIterator -/// supported an external set like DepthFirstIterator did I could eliminate this -/// cruft. -/// -static void POVisit(DSNode *N, std::set<DSNode*> &Visited, - std::vector<DSNode*> &Order) { - if (!Visited.insert(N).second) return; // already visited - - // Visit all children before visiting this node. - for (DSNode::iterator I = N->begin(), E = N->end(); I != E; ++I) - if (DSNode *C = const_cast<DSNode*>(*I)) - POVisit(C, Visited, Order); - // Now that we visited all of our children, add ourself to the order. - Order.push_back(N); -} - - - - // Heuristic for building per-function pools - - switch (Heuristic) { - case SmartCoallesceNodes: { - std::set<DSNode*> NodesToPASet(NodesToPA.begin(), NodesToPA.end()); - - // DSGraphs only have unidirectional edges, to traverse or inspect the - // predecessors of nodes, we must build a mapping of the inverse graph. - std::map<DSNode*, std::vector<DSNode*> > InverseGraph; - - for (unsigned i = 0, e = NodesToPA.size(); i != e; ++i) { - DSNode *Node = NodesToPA[i]; - for (DSNode::iterator CI = Node->begin(), E = Node->end(); CI != E; ++CI) - if (DSNode *Child = const_cast<DSNode*>(*CI)) - if (NodesToPASet.count(Child)) - InverseGraph[Child].push_back(Node); - } - - // Traverse the heap nodes in reverse-post-order so that we are guaranteed - // to visit all nodes pointing to another node before we visit that node - // itself (except with cycles). - - // FIXME: This really should be using the PostOrderIterator.h file stuff, - // but the routines there do not support external storage! - std::set<DSNode*> Visited; - std::vector<DSNode*> Order; - for (unsigned i = 0, e = NodesToPA.size(); i != e; ++i) - POVisit(NodesToPA[i], Visited, Order); - - // We want RPO, not PO, so reverse the order. - std::reverse(Order.begin(), Order.end()); - - // Okay, we have an ordering of the nodes in reverse post order. Traverse - // each node in this ordering, noting that there may be nodes in the order - // that are not in our NodesToPA list. - for (unsigned i = 0, e = Order.size(); i != e; ++i) - if (NodesToPASet.count(Order[i])) { // Only process pa nodes. - DSNode *N = Order[i]; - - // If this node has a backedge to itself, pool allocate it in a new - // pool. - if (NodeIsSelfRecursive(N)) { - // Create a new alloca instruction for the pool... - Value *AI = new AllocaInst(PoolDescType, 0, "PD", InsertPoint); - - // Void types in DS graph are never used - if (N->isNodeCompletelyFolded()) - std::cerr << "Node collapsing in '" << F.getName() << "'\n"; - - // Update the PoolDescriptors map - PoolDescriptors.insert(std::make_pair(N, AI)); -#if 1 - } else if (N->isArray() && !N->isNodeCompletelyFolded()) { - // We never pool allocate array nodes. - PoolDescriptors[N] = - Constant::getNullValue(PointerType::get(PoolDescType)); - ++NumNonprofit; -#endif - } else { - // Otherwise the node is not self recursive. If the node is not an - // array, we can co-locate it with the pool of a predecessor node if - // any has been pool allocated, and start a new pool if a predecessor - // is an array. If there is a predecessor of this node that has not - // been visited yet in this RPO traversal, that means there is a - // cycle, so we choose to pool allocate this node right away. - // - // If there multiple predecessors in multiple different pools, we - // don't pool allocate this at all. - - // Check out each of the predecessors of this node. - std::vector<DSNode*> &Preds = InverseGraph[N]; - Value *PredPool = 0; - bool HasUnvisitedPred = false; - bool HasArrayPred = false; - bool HasMultiplePredPools = false; - for (unsigned p = 0, e = Preds.size(); p != e; ++p) { - DSNode *Pred = Preds[p]; - if (!PoolDescriptors.count(Pred)) - HasUnvisitedPred = true; // no pool assigned to predecessor? - else if (Pred->isArray() && !Pred->isNodeCompletelyFolded()) - HasArrayPred = true; - else if (PredPool && PoolDescriptors[Pred] != PredPool) - HasMultiplePredPools = true; - else if (!PredPool && - !isa<ConstantPointerNull>(PoolDescriptors[Pred])) - PredPool = PoolDescriptors[Pred]; - // Otherwise, this predecessor has the same pool as a previous one. - } - - if (HasMultiplePredPools) { - // If this node has predecessors that are in different pools, don't - // pool allocate this node. - PoolDescriptors[N] = - Constant::getNullValue(PointerType::get(PoolDescType)); - ++NumNonprofit; - } else if (PredPool) { - // If all of the predecessors of this node are already in a pool, - // colocate. - PoolDescriptors[N] = PredPool; - ++NumColocated; - } else if (HasArrayPred || HasUnvisitedPred) { - // If this node has an array predecessor, or if there is a - // predecessor that has not been visited yet, allocate a new pool - // for it. - Value *AI = new AllocaInst(PoolDescType, 0, "PD", InsertPoint); - if (N->isNodeCompletelyFolded()) - std::cerr << "Node collapsing in '" << F.getName() << "'\n"; - - PoolDescriptors[N] = AI; - } else { - // If this node has no pool allocated predecessors, and there is no - // reason to pool allocate it, don't. - assert(PredPool == 0); - PoolDescriptors[N] = - Constant::getNullValue(PointerType::get(PoolDescType)); - ++NumNonprofit; - } - } - } - } // End switch case - } // end switch -#endif - - -//===-- AllInOneGlobalPool Heuristic --------------------------------------===// -// -// This heuristic puts all memory in the whole program into a single global -// pool. This is not safe, and is not good for performance, but can be used to -// evaluate how good the pool allocator runtime works as a "malloc replacement". -// -struct AllInOneGlobalPoolHeuristic : public Heuristic { - // TheGlobalPD - This global pool is the one and only one used when running - // with Heuristic=AllInOneGlobalPool. - GlobalVariable *TheGlobalPD; - - AllInOneGlobalPoolHeuristic() : TheGlobalPD(0) {} - - - virtual bool IsRealHeuristic() { return false; } - - void AssignToPools(const std::vector<const DSNode*> &NodesToPA, - Function *F, DSGraph &G, - std::vector<OnePool> &ResultPools) { - if (TheGlobalPD == 0) - TheGlobalPD = PA->CreateGlobalPool(0, 0); - - // All nodes allocate from the same global pool. - OnePool Pool; - Pool.NodesInPool = NodesToPA; - Pool.PoolDesc = TheGlobalPD; - ResultPools.push_back(Pool); - } -}; - -//===-- OnlyOverhead Heuristic --------------------------------------------===// -// -// This heuristic is a hack to evaluate how much overhead pool allocation adds -// to a program. It adds all of the arguments, poolinits and pool destroys to -// the program, but dynamically only passes null into the pool alloc/free -// functions, causing them to allocate from the heap. -// -struct OnlyOverheadHeuristic : public Heuristic { - virtual bool IsRealHeuristic() { return false; } - - void AssignToPools(const std::vector<const DSNode*> &NodesToPA, - Function *F, DSGraph &G, - std::vector<OnePool> &ResultPools) { - // For this heuristic, we assign everything possible to its own pool. - for (unsigned i = 0, e = NodesToPA.size(); i != e; ++i) - ResultPools.push_back(OnePool(NodesToPA[i])); - } - - void HackFunctionBody(Function &F, std::map<const DSNode*, Value*> &PDs); -}; - -/// getDynamicallyNullPool - Return a PoolDescriptor* that is always dynamically -/// null. Insert the code necessary to produce it before the specified -/// instruction. -static Value *getDynamicallyNullPool(BasicBlock::iterator I) { - // Arrange to dynamically pass null into all of the pool functions if we are - // only checking for overhead. - static Value *NullGlobal = 0; - if (!NullGlobal) { - Module *M = I->getParent()->getParent()->getParent(); - NullGlobal = new GlobalVariable(PoolAllocate::PoolDescPtrTy, false, - GlobalValue::ExternalLinkage, - Constant::getNullValue(PoolAllocate::PoolDescPtrTy), - "llvm-poolalloc-null-init", M); - } - while (isa<AllocaInst>(I)) ++I; - - return new LoadInst(NullGlobal, "nullpd", I); -} - -// HackFunctionBody - This method is called on every transformed function body. -// Basically it replaces all uses of real pool descriptors with dynamically null -// values. However, it leaves pool init/destroy alone. -void OnlyOverheadHeuristic::HackFunctionBody(Function &F, - std::map<const DSNode*, - Value*> &PDs) { - Function *PoolInit = PA->PoolInit; - Function *PoolDestroy = PA->PoolDestroy; - - Value *NullPD = getDynamicallyNullPool(F.front().begin()); - for (std::map<const DSNode*, Value*>::iterator PDI = PDs.begin(), - E = PDs.end(); PDI != E; ++PDI) { - Value *OldPD = PDI->second; - std::vector<User*> OldPDUsers(OldPD->use_begin(), OldPD->use_end()); - for (unsigned i = 0, e = OldPDUsers.size(); i != e; ++i) { - CallSite PDUser = CallSite::get(cast<Instruction>(OldPDUsers[i])); - if (PDUser.getCalledValue() != PoolInit && - PDUser.getCalledValue() != PoolDestroy) { - assert(PDUser.getInstruction()->getParent()->getParent() == &F && - "Not in cur fn??"); - PDUser.getInstruction()->replaceUsesOfWith(OldPD, NullPD); - } - } - } -} - - -//===-- NoNodes Heuristic -------------------------------------------------===// -// -// This dummy heuristic chooses to not pool allocate anything. -// -struct NoNodesHeuristic : public Heuristic { - virtual bool IsRealHeuristic() { return false; } - - void AssignToPools(const std::vector<const DSNode*> &NodesToPA, - Function *F, DSGraph &G, - std::vector<OnePool> &ResultPools) { - // Nothing to pool allocate here. - } -}; - -//===----------------------------------------------------------------------===// -// Heuristic dispatch support -// - -PA::Heuristic *Heuristic::create() { - switch (TheHeuristic) { - default: assert(0 && "Unknown heuristic!"); - case AllNodes: return new AllNodesHeuristic(); - case AllButUnreachableFromMemory: - return new AllButUnreachableFromMemoryHeuristic(); - case CyclicNodes: return new CyclicNodesHeuristic(); - case SmartCoallesceNodes: return new SmartCoallesceNodesHeuristic(); - case AllInOneGlobalPool: return new AllInOneGlobalPoolHeuristic(); - case OnlyOverhead: return new OnlyOverheadHeuristic(); - case NoNodes: return new NoNodesHeuristic(); - } -}
diff --git a/poolalloc/lib/PoolAllocate/Heuristic.h b/poolalloc/lib/PoolAllocate/Heuristic.h deleted file mode 100644 index 9f8734e..0000000 --- a/poolalloc/lib/PoolAllocate/Heuristic.h +++ /dev/null
@@ -1,107 +0,0 @@ -//===-- Heuristic.h - Interface to PA heuristics ----------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This header is the abstract interface used by the pool allocator to access -// the various heuristics supported. -// -//===----------------------------------------------------------------------===// - -#ifndef POOLALLOCATION_HEURISTIC_H -#define POOLALLOCATION_HEURISTIC_H - -#include <vector> -#include <map> - -namespace llvm { - class Value; - class Function; - class Module; - class DSGraph; - class DSNode; - class PoolAllocate; - class TargetData; - class Type; - -namespace PA { - class Heuristic { - protected: - Module *M; - DSGraph *GG; - PoolAllocate *PA; - - Heuristic() {} - public: - void Initialize(Module &m, DSGraph &gg, PoolAllocate &pa) { - M = &m; GG = ≫ PA = &pa; - } - virtual ~Heuristic(); - - /// IsRealHeuristic - Return true if this is not a real pool allocation - /// heuristic. - virtual bool IsRealHeuristic() { return true; } - - /// OnePool - This represents some number of nodes which are coallesced into - /// a pool. - struct OnePool { - // NodesInPool - The DS nodes to be allocated to this pool. There may be - // multiple here if they are being coallesced into the same pool. - std::vector<const DSNode*> NodesInPool; - - // PoolDesc - If the heuristic wants the nodes allocated to a specific - // pool descriptor, it can specify it here, otherwise a new pool is - // created. - Value *PoolDesc; - - // PoolSize - If the pool is to be created, indicate the "recommended - // size" for the pool here. This gets passed into poolinit. - unsigned PoolSize; - unsigned PoolAlignment; - - OnePool() : PoolDesc(0), PoolSize(0), PoolAlignment(0) {} - - OnePool(const DSNode *N) : PoolDesc(0), PoolSize(getRecommendedSize(N)), - PoolAlignment(getRecommendedAlignment(N)) { - NodesInPool.push_back(N); - } - OnePool(const DSNode *N, Value *PD) : PoolDesc(PD), PoolSize(0), - PoolAlignment(0) { - NodesInPool.push_back(N); - } - }; - - /// AssignToPools - Partition NodesToPA into a set of disjoint pools, - /// returning the result in ResultPools. If this is a function being pool - /// allocated, F will not be null. - virtual void AssignToPools(const std::vector<const DSNode*> &NodesToPA, - Function *F, DSGraph &G, - std::vector<OnePool> &ResultPools) = 0; - - // Hacks for the OnlyOverhead heuristic. - virtual void HackFunctionBody(Function &F, - std::map<const DSNode*, Value*> &PDs) {} - - /// getRecommendedSize - Return the recommended pool size for this DSNode. - /// - static unsigned getRecommendedSize(const DSNode *N); - - /// getRecommendedAlignment - Return the recommended object alignment for - /// this DSNode. - /// - static unsigned getRecommendedAlignment(const DSNode *N); - static unsigned getRecommendedAlignment(const Type *Ty, - const TargetData &TD); - - /// create - This static ctor creates the heuristic, based on the command - /// line argument to choose the heuristic. - static Heuristic *create(); - }; -} -} - -#endif
diff --git a/poolalloc/lib/PoolAllocate/Makefile b/poolalloc/lib/PoolAllocate/Makefile deleted file mode 100644 index 08ef625..0000000 --- a/poolalloc/lib/PoolAllocate/Makefile +++ /dev/null
@@ -1,18 +0,0 @@ -# -# Indicate where we are relative to the top of the source tree. -# -LEVEL=../.. - -# -# Give the name of a library. This will build a dynamic version. -# -SHARED_LIBRARY=1 -LOADABLE_MODULE = 1 -DONT_BUILD_RELINKED=1 -LIBRARYNAME=poolalloc - -# -# Include Makefile.common so we know what to do. -# -include $(LEVEL)/Makefile.common -
diff --git a/poolalloc/lib/PoolAllocate/PointerCompress.cpp b/poolalloc/lib/PoolAllocate/PointerCompress.cpp deleted file mode 100644 index 468dcea..0000000 --- a/poolalloc/lib/PoolAllocate/PointerCompress.cpp +++ /dev/null
@@ -1,1543 +0,0 @@ -//===-- PointerCompress.cpp - Pointer Compression Pass --------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the -pointercompress pass. -// -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "pointercompress" -#include "PoolAllocate.h" -#include "Heuristic.h" -#include "llvm/Constants.h" -#include "llvm/Instructions.h" -#include "llvm/Module.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/ADT/Statistic.h" -#include "llvm/ADT/STLExtras.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/Debug.h" -#include "llvm/Support/GetElementPtrTypeIterator.h" -#include "llvm/Support/InstVisitor.h" - -#include "llvm/Transforms/Utils/Cloning.h" - -#include <iostream> - -using namespace llvm; - -/// MEMUINTTYPE - This is the actual type we are compressing to. This is really -/// only capable of being UIntTy, except when we are doing tests for 16-bit -/// integers, when it's UShortTy. -static const Type *MEMUINTTYPE; - -/// SCALARUINTTYPE - We keep scalars the same size as the machine word on the -/// system (e.g. 64-bits), only keeping memory objects in MEMUINTTYPE. -static const Type *SCALARUINTTYPE; - -namespace { - cl::opt<bool> - SmallIntCompress("compress-to-16-bits", - cl::desc("Pointer compress data structures to 16 bit " - "integers instead of 32-bit integers")); - cl::opt<bool> - DisablePoolBaseASR("disable-ptrcomp-poolbase-aggregation", - cl::desc("Don't optimize pool base loads")); - cl::opt<bool> - ADLFix("adl-pc", - cl::desc("Enable Andrew's fixes/hacks")); - - - Statistic<> NumCompressed("pointercompress", - "Number of pools pointer compressed"); - Statistic<> NumNotCompressed("pointercompress", - "Number of pools not compressible"); - Statistic<> NumCloned ("pointercompress", "Number of functions cloned"); - - class CompressedPoolInfo; - - /// FunctionCloneRecord - One of these is kept for each function that is - /// cloned. - struct FunctionCloneRecord { - /// PAFn - The pool allocated input function that we compressed. - /// - Function *PAFn; - FunctionCloneRecord(Function *pafn) : PAFn(pafn) {} - - /// PoolDescriptors - The Value* which defines the pool descriptor for this - /// DSNode. Note: Does not necessarily include pool arguments that are - /// passed in because of indirect function calls that are not used in the - /// function. - std::map<const DSNode*, Value*> PoolDescriptors; - - /// NewToOldValueMap - This is a mapping from the values in the cloned body - /// to the values in PAFn. - std::map<Value*, const Value*> NewToOldValueMap; - - const Value *getValueInOriginalFunction(Value *V) const { - std::map<Value*, const Value*>::const_iterator I = - NewToOldValueMap.find(V); - if (I == NewToOldValueMap.end()) { - for (I = NewToOldValueMap.begin(); I != NewToOldValueMap.end(); ++I) - std::cerr << "MAP: " << *I->first << " TO: " << *I->second << "\n"; - } - assert (I != NewToOldValueMap.end() && "Value did not come from clone!"); - return I->second; - } - }; - - /// PointerCompress - This transformation hacks on type-safe pool allocated - /// data structures to reduce the size of pointers in the program. - class PointerCompress : public ModulePass { - PoolAllocate *PoolAlloc; - EquivClassGraphs *ECG; - - /// ClonedFunctionMap - Every time we clone a function to compress its - /// arguments, keep track of the clone and which arguments are compressed. - typedef std::pair<Function*, std::set<const DSNode*> > CloneID; - std::map<CloneID, Function *> ClonedFunctionMap; - - std::map<std::pair<Function*, std::vector<unsigned> >, - Function*> ExtCloneFunctionMap; - - /// ClonedFunctionInfoMap - This identifies the pool allocated function that - /// a clone came from. - std::map<Function*, FunctionCloneRecord> ClonedFunctionInfoMap; - - /// CompressedGlobalPools - Keep track of which DSNodes in the globals graph - /// are both pool allocated and should be compressed, and which GlobalValue - /// their pool descriptor is. - std::map<const DSNode*, GlobalValue*> CompressedGlobalPools; - - public: - Function *PoolInitPC, *PoolDestroyPC, *PoolAllocPC; - typedef std::map<const DSNode*, CompressedPoolInfo> PoolInfoMap; - - /// NoArgFunctionsCalled - When we are walking the call graph, keep track of - /// which functions are called that don't need their prototype to be - /// changed. - std::vector<Function*> NoArgFunctionsCalled; - - bool runOnModule(Module &M); - - void HandleGlobalPools(Module &M); - - - void getAnalysisUsage(AnalysisUsage &AU) const; - - PoolAllocate *getPoolAlloc() const { return PoolAlloc; } - - const DSGraph &getGraphForFunc(PA::FuncInfo *FI) const { - return ECG->getDSGraph(FI->F); - } - - /// getCloneInfo - If the specified function is a clone, return the - /// information about the cloning process for it. Otherwise, return a null - /// pointer. - FunctionCloneRecord *getCloneInfo(Function &F) { - std::map<Function*, FunctionCloneRecord>::iterator I = - ClonedFunctionInfoMap.find(&F); - return I == ClonedFunctionInfoMap.end() ? 0 : &I->second; - } - - Function *GetFunctionClone(Function *F, - std::set<const DSNode*> &PoolsToCompress, - PA::FuncInfo &FI, const DSGraph &CG); - Function *GetExtFunctionClone(Function *F, - const std::vector<unsigned> &Args); - - private: - void InitializePoolLibraryFunctions(Module &M); - bool CompressPoolsInFunction(Function &F, - std::vector<std::pair<Value*, Value*> > *PremappedVals = 0, - std::set<const DSNode*> *ExternalPoolsToCompress = 0); - - void FindPoolsToCompress(std::set<const DSNode*> &Pools, - std::map<const DSNode*, Value*> &PreassignedPools, - Function &F, DSGraph &DSG, PA::FuncInfo *FI); - }; - - RegisterOpt<PointerCompress> - X("pointercompress", "Compress type-safe data structures"); -} - -//===----------------------------------------------------------------------===// -// CompressedPoolInfo Class and Implementation -//===----------------------------------------------------------------------===// - -namespace { - /// CompressedPoolInfo - An instance of this structure is created for each - /// pool that is compressed. - class CompressedPoolInfo { - const DSNode *Pool; - Value *PoolDesc; - const Type *NewTy; - unsigned NewSize; - mutable Value *PoolBase; - public: - CompressedPoolInfo(const DSNode *N, Value *PD) - : Pool(N), PoolDesc(PD), NewTy(0), PoolBase(0) {} - - /// Initialize - When we know all of the pools in a function that are going - /// to be compressed, initialize our state based on that data. - void Initialize(std::map<const DSNode*, CompressedPoolInfo> &Nodes, - const TargetData &TD); - - const DSNode *getNode() const { return Pool; } - const Type *getNewType() const { return NewTy; } - - /// getNewSize - Return the size of each node after compression. - /// - unsigned getNewSize() const { return NewSize; } - - /// getPoolDesc - Return the Value* for the pool descriptor for this pool. - /// - Value *getPoolDesc() const { return PoolDesc; } - - /// EmitPoolBaseLoad - Emit code to load the pool base value for this pool - /// before the specified instruction. - Value *EmitPoolBaseLoad(Instruction &I) const; - void setPoolBase(Value *PB) const { PoolBase = PB; } - - // dump - Emit a debugging dump of this pool info. - void dump() const; - - private: - const Type *ComputeCompressedType(const Type *OrigTy, unsigned NodeOffset, - std::map<const DSNode*, CompressedPoolInfo> &Nodes); - }; -} - -/// Initialize - When we know all of the pools in a function that are going -/// to be compressed, initialize our state based on that data. -void CompressedPoolInfo::Initialize(std::map<const DSNode*, - CompressedPoolInfo> &Nodes, - const TargetData &TD) { - // First step, compute the type of the compressed node. This basically - // replaces all pointers to compressed pools with uints. - NewTy = ComputeCompressedType(Pool->getType(), 0, Nodes); - - // Get the compressed type size. - NewSize = NewTy->isSized() ? TD.getTypeSize(NewTy) : 0; -} - - -/// ComputeCompressedType - Recursively compute the new type for this node after -/// pointer compression. This involves compressing any pointers that point into -/// compressed pools. -const Type *CompressedPoolInfo:: -ComputeCompressedType(const Type *OrigTy, unsigned NodeOffset, - std::map<const DSNode*, CompressedPoolInfo> &Nodes) { - if (const PointerType *PTY = dyn_cast<PointerType>(OrigTy)) { - if (ADLFix) { - DSNode *PointeeNode = getNode()->getLink(NodeOffset).getNode(); - if (PointeeNode == getNode()) - return MEMUINTTYPE; - return OrigTy; - } - - // Okay, we have a pointer. Check to see if the node pointed to is actually - // compressed! - //DSNode *PointeeNode = getNode()->getLink(NodeOffset).getNode(); - //if (PointeeNode && Nodes.count(PointeeNode)) - return MEMUINTTYPE; - // Otherwise, it points to a non-compressed node. - return OrigTy; - } else if (OrigTy->isFirstClassType() || OrigTy == Type::VoidTy) - return OrigTy; - - - const TargetData &TD = getNode()->getParentGraph()->getTargetData(); - - // Okay, we have an aggregate type. - if (const StructType *STy = dyn_cast<StructType>(OrigTy)) { - std::vector<const Type*> Elements; - Elements.reserve(STy->getNumElements()); - - const StructLayout *SL = TD.getStructLayout(STy); - - for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) - Elements.push_back(ComputeCompressedType(STy->getElementType(i), - NodeOffset+SL->MemberOffsets[i], - Nodes)); - return StructType::get(Elements); - } else if (const ArrayType *ATy = dyn_cast<ArrayType>(OrigTy)) { - return ArrayType::get(ComputeCompressedType(ATy->getElementType(), - NodeOffset, Nodes), - ATy->getNumElements()); - } else { - std::cerr << "TYPE: " << *OrigTy << "\n"; - assert(0 && "FIXME: Unhandled aggregate type!"); - abort(); - } -} - -/// EmitPoolBaseLoad - Emit code to load the pool base value for this pool -/// before the specified instruction. -Value *CompressedPoolInfo::EmitPoolBaseLoad(Instruction &I) const { - if (DisablePoolBaseASR) { - assert(PoolBase == 0 && "Mixing and matching optimized vs not!"); - - // Get the pool base pointer. - Constant *Zero = Constant::getNullValue(Type::UIntTy); - Value *BasePtrPtr = new GetElementPtrInst(getPoolDesc(), Zero, Zero, - "poolbaseptrptr", &I); - return new LoadInst(BasePtrPtr, "poolbaseptr", &I); - } else { - // If this is a pool descriptor passed into the function, and this is the - // first use, emit a load of the pool base into the entry of the function. - if (PoolBase == 0 && (isa<Argument>(PoolDesc) || - isa<GlobalVariable>(PoolDesc))) { - BasicBlock::iterator IP = I.getParent()->getParent()->begin()->begin(); - while (isa<AllocaInst>(IP)) ++IP; - Constant *Zero = Constant::getNullValue(Type::UIntTy); - Value *BasePtrPtr = new GetElementPtrInst(getPoolDesc(), Zero, Zero, - "poolbaseptrptr", IP); - PoolBase = new LoadInst(BasePtrPtr, "poolbaseptr", IP); - } - - assert(PoolBase && "Mixing and matching optimized vs not!"); - return PoolBase; - } -} - - -/// dump - Emit a debugging dump for this pool info. -/// -void CompressedPoolInfo::dump() const { - const TargetData &TD = getNode()->getParentGraph()->getTargetData(); - std::cerr << " From size: " - << (getNode()->getType()->isSized() ? - TD.getTypeSize(getNode()->getType()) : 0) - << " To size: " - << (NewTy->isSized() ? TD.getTypeSize(NewTy) : 0) << "\n"; - std::cerr << "Node: "; getNode()->dump(); - std::cerr << "New Type: " << *NewTy << "\n"; -} - - -//===----------------------------------------------------------------------===// -// InstructionRewriter Implementation -//===----------------------------------------------------------------------===// - -namespace { - /// InstructionRewriter - This class implements the rewriting neccesary to - /// transform a function body from normal pool allocation to pointer - /// compression. It is constructed, then the 'visit' method is called on a - /// function. If is responsible for rewriting all instructions that refer to - /// pointers into compressed pools. - class InstructionRewriter : public llvm::InstVisitor<InstructionRewriter> { - /// OldToNewValueMap - This keeps track of what new instructions we create - /// for instructions that used to produce pointers into our pool. - std::map<Value*, Value*> OldToNewValueMap; - - const PointerCompress::PoolInfoMap &PoolInfo; - - /// TD - The TargetData object for the current target. - /// - const TargetData &TD; - - - DSGraph &DSG; - - /// PAFuncInfo - Information about the transformation the pool allocator did - /// to the original function. - PA::FuncInfo &PAFuncInfo; - - /// FCR - If we are compressing a clone of a pool allocated function (as - /// opposed to the pool allocated function itself), this contains - /// information about the clone. - FunctionCloneRecord *FCR; - - PointerCompress &PtrComp; - public: - InstructionRewriter(const PointerCompress::PoolInfoMap &poolInfo, - DSGraph &dsg, PA::FuncInfo &pafi, - FunctionCloneRecord *fcr, PointerCompress &ptrcomp) - : PoolInfo(poolInfo), TD(dsg.getTargetData()), DSG(dsg), - PAFuncInfo(pafi), FCR(fcr), PtrComp(ptrcomp) { - } - - ~InstructionRewriter(); - - /// PremapValues - Seed the transformed value map with the specified values. - /// This indicates that the first value (a pointer) will map to the second - /// value (an integer). When the InstructionRewriter is complete, all of - /// the pointers in this vector are deleted. - void PremapValues(std::vector<std::pair<Value*, Value*> > &Vals) { - for (unsigned i = 0, e = Vals.size(); i != e; ++i) - OldToNewValueMap.insert(Vals[i]); - } - - /// getTransformedValue - Return the transformed version of the specified - /// value, creating a new forward ref value as needed. - Value *getTransformedValue(Value *V) { - if (isa<ConstantPointerNull>(V)) // null -> uint 0 - return Constant::getNullValue(SCALARUINTTYPE); - if (isa<UndefValue>(V)) // undef -> uint undef - return UndefValue::get(SCALARUINTTYPE); - - if (!getNodeIfCompressed(V)) - assert(getNodeIfCompressed(V) && "Value is not compressed!"); - Value *&RV = OldToNewValueMap[V]; - if (RV) return RV; - - RV = new Argument(SCALARUINTTYPE); - return RV; - } - - /// setTransformedValue - When we create a new value, this method sets it as - /// the current value. - void setTransformedValue(Instruction &Old, Value *New) { - Value *&EV = OldToNewValueMap[&Old]; - if (EV) { - assert(isa<Argument>(EV) && "Not a forward reference!"); - EV->replaceAllUsesWith(New); - delete EV; - } - EV = New; - } - - /// getMappedNodeHandle - Given a pointer value that may be cloned multiple - /// times (once for PA, once for PC) return the node handle in DSG, or a - /// null descriptor if the value didn't exist. - DSNodeHandle getMappedNodeHandle(Value *V) { - assert(isa<PointerType>(V->getType()) && "Not a pointer value!"); - - // If this is a function clone, map the value to the original function. - if (FCR) - V = const_cast<Value*>(FCR->getValueInOriginalFunction(V)); - - // If this is a pool allocator clone, map the value to the REAL original - // function. - if (!PAFuncInfo.NewToOldValueMap.empty()) - if ((V = PAFuncInfo.MapValueToOriginal(V)) == 0) - // Value didn't exist in the orig program (pool desc?). - return DSNodeHandle(); - - return DSG.getNodeForValue(V); - } - - /// getNodeIfCompressed - If the specified value is a pointer that will be - /// compressed, return the DSNode corresponding to the pool it belongs to. - const DSNode *getNodeIfCompressed(Value *V) { - if (!isa<PointerType>(V->getType()) || isa<ConstantPointerNull>(V) || - isa<Function>(V)) - return 0; - - DSNode *N = getMappedNodeHandle(V).getNode(); - return PoolInfo.count(N) ? N : 0; - } - - /// getPoolInfo - Return the pool info for the specified compressed pool. - /// - const CompressedPoolInfo &getPoolInfo(const DSNode *N) { - assert(N && "Pool not compressed!"); - PointerCompress::PoolInfoMap::const_iterator I = PoolInfo.find(N); - assert(I != PoolInfo.end() && "Pool is not compressed!"); - return I->second; - } - - /// getPoolInfo - Return the pool info object for the specified value if the - /// pointer points into a compressed pool, otherwise return null. - const CompressedPoolInfo *getPoolInfo(Value *V) { - if (const DSNode *N = getNodeIfCompressed(V)) - return &getPoolInfo(N); - return 0; - } - - /// getPoolInfoForPoolDesc - Given a pool descriptor as a Value*, return the - /// pool info for the pool if it is compressed. - const CompressedPoolInfo *getPoolInfoForPoolDesc(Value *PD) const { - for (PointerCompress::PoolInfoMap::const_iterator I = PoolInfo.begin(), - E = PoolInfo.end(); I != E; ++I) - if (I->second.getPoolDesc() == PD) - return &I->second; - return 0; - } - - /// ValueRemoved - Whenever we remove a value from the current function, - /// update any maps that contain that pointer so we don't have stale - /// pointers hanging around. - void ValueRemoved(Value *V) { - if (FCR) { - // If this is in a pointer-compressed clone, update our map. - FCR->NewToOldValueMap.erase(V); - } else if (!PAFuncInfo.NewToOldValueMap.empty()) { - // Otherwise if this exists in a pool allocator clone, update it now. - PAFuncInfo.NewToOldValueMap.erase(V); - } else { - // Otherwise if this was in the original function, remove it from the - // DSG scalar map if it is there. - DSG.getScalarMap().eraseIfExists(V); - } - } - - /// ValueReplaced - Whenever we replace a value from the current function, - /// update any maps that contain that value so we don't have stale pointers - /// hanging around. - void ValueReplaced(Value &Old, Value *New) { - // If this value exists in a pointer compress clone, update it now. - if (FCR) { - std::map<Value*, const Value*>::iterator I = - FCR->NewToOldValueMap.find(&Old); - assert(I != FCR->NewToOldValueMap.end() && "Didn't find element!?"); - FCR->NewToOldValueMap.insert(std::make_pair(New, I->second)); - FCR->NewToOldValueMap.erase(I); - } else if (!PAFuncInfo.NewToOldValueMap.empty()) { - // Otherwise if this exists in a pool allocator clone, update it now. - PA::FuncInfo::NewToOldValueMapTy::iterator I = - PAFuncInfo.NewToOldValueMap.find(&Old); - if (I != PAFuncInfo.NewToOldValueMap.end()) { - PAFuncInfo.NewToOldValueMap[New] = I->second; - PAFuncInfo.NewToOldValueMap.erase(I); - } - - } else { - // Finally, if this occurred in a function that neither the pool - // allocator nor the ptr compression implementation had to change, - // update the DSGraph. - if (DSG.getScalarMap().count(&Old)) - DSG.getScalarMap().replaceScalar(&Old, New); - } - } - - //===------------------------------------------------------------------===// - // Visitation methods. These do all of the heavy lifting for the various - // cases we have to handle. - - void visitReturnInst(ReturnInst &RI); - void visitCastInst(CastInst &CI); - void visitPHINode(PHINode &PN); - void visitSelectInst(SelectInst &SI); - void visitSetCondInst(SetCondInst &SCI); - void visitGetElementPtrInst(GetElementPtrInst &GEPI); - void visitLoadInst(LoadInst &LI); - void visitStoreInst(StoreInst &SI); - - void visitCallInst(CallInst &CI); - void visitPoolInit(CallInst &CI); - void visitPoolAlloc(CallInst &CI); - void visitPoolDestroy(CallInst &CI); - - void visitInstruction(Instruction &I) { -#ifndef NDEBUG - bool Unhandled = !!getNodeIfCompressed(&I); - for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) - Unhandled |= !!getNodeIfCompressed(I.getOperand(i)); - - if (Unhandled) { - std::cerr << "ERROR: UNHANDLED INSTRUCTION: " << I; - //assert(0); - //abort(); - } -#endif - } - }; -} // end anonymous namespace. - - -InstructionRewriter::~InstructionRewriter() { - // Nuke all of the old values from the program. - for (std::map<Value*, Value*>::iterator I = OldToNewValueMap.begin(), - E = OldToNewValueMap.end(); I != E; ++I) { - assert((!isa<Argument>(I->second) || cast<Argument>(I->second)->getParent()) - && "ERROR: Unresolved value still left in the program!"); - // If there is anything still using this, provide a temporary value. - if (!I->first->use_empty()) - I->first->replaceAllUsesWith(UndefValue::get(I->first->getType())); - - // Finally, remove it from the program. - if (Instruction *Inst = dyn_cast<Instruction>(I->first)) { - ValueRemoved(Inst); - Inst->eraseFromParent(); - } else if (Argument *Arg = dyn_cast<Argument>(I->first)) { - assert(Arg->getParent() == 0 && "Unexpected argument type here!"); - delete Arg; // Marker node used when cloning. - } else { - assert(0 && "Unknown entry in this map!"); - } - } -} - -void InstructionRewriter::visitReturnInst(ReturnInst &RI) { - if (RI.getNumOperands() && isa<PointerType>(RI.getOperand(0)->getType())) - if (!isa<PointerType>(RI.getParent()->getParent()->getReturnType())) { - // Compressing the return value. - new ReturnInst(getTransformedValue(RI.getOperand(0)), &RI); - RI.eraseFromParent(); - } -} - - -void InstructionRewriter::visitCastInst(CastInst &CI) { - if (!isa<PointerType>(CI.getType())) { - // If this is a pointer -> integer cast, turn this into an idx -> integer - // cast. - if (isa<PointerType>(CI.getOperand(0)->getType()) && - getPoolInfo(CI.getOperand(0))) - CI.setOperand(0, getTransformedValue(CI.getOperand(0))); - return; - } - - const CompressedPoolInfo *PI = getPoolInfo(&CI); - if (!PI) return; - assert(getPoolInfo(CI.getOperand(0)) == PI && "Not cast from ptr -> ptr?"); - - // A cast from one pointer to another turns into a cast from uint -> uint, - // which is a noop. - setTransformedValue(CI, getTransformedValue(CI.getOperand(0))); -} - -void InstructionRewriter::visitPHINode(PHINode &PN) { - const CompressedPoolInfo *DestPI = getPoolInfo(&PN); - if (DestPI == 0) return; - - PHINode *New = new PHINode(SCALARUINTTYPE, PN.getName(), &PN); - New->reserveOperandSpace(PN.getNumIncomingValues()); - - for (unsigned i = 0, e = PN.getNumIncomingValues(); i != e; ++i) - New->addIncoming(getTransformedValue(PN.getIncomingValue(i)), - PN.getIncomingBlock(i)); - setTransformedValue(PN, New); -} - -void InstructionRewriter::visitSelectInst(SelectInst &SI) { - const CompressedPoolInfo *DestPI = getPoolInfo(&SI); - if (DestPI == 0) return; - - setTransformedValue(SI, new SelectInst(SI.getOperand(0), - getTransformedValue(SI.getOperand(1)), - getTransformedValue(SI.getOperand(2)), - SI.getName(), &SI)); -} - -void InstructionRewriter::visitSetCondInst(SetCondInst &SCI) { - if (!isa<PointerType>(SCI.getOperand(0)->getType())) return; - Value *NonNullPtr = SCI.getOperand(0); - if (isa<ConstantPointerNull>(NonNullPtr)) { - NonNullPtr = SCI.getOperand(1); - if (isa<ConstantPointerNull>(NonNullPtr)) - return; // setcc null, null - } - - const CompressedPoolInfo *SrcPI = getPoolInfo(NonNullPtr); - if (SrcPI == 0) return; // comparing non-compressed pointers. - - std::string Name = SCI.getName(); SCI.setName(""); - Value *New = new SetCondInst(SCI.getOpcode(), - getTransformedValue(SCI.getOperand(0)), - getTransformedValue(SCI.getOperand(1)), - Name, &SCI); - SCI.replaceAllUsesWith(New); - ValueReplaced(SCI, New); - SCI.eraseFromParent(); -} - -void InstructionRewriter::visitGetElementPtrInst(GetElementPtrInst &GEPI) { - const CompressedPoolInfo *PI = getPoolInfo(&GEPI); - if (PI == 0) return; - - // Get the base index. - Value *Val = getTransformedValue(GEPI.getOperand(0)); - - bool AllZeros = true; - for (unsigned i = 1, e = GEPI.getNumOperands(); i != e; ++i) - if (!isa<Constant>(GEPI.getOperand(i)) || - !cast<Constant>(GEPI.getOperand(i))->isNullValue()) { - AllZeros = false; - break; - } - if (AllZeros) { - // We occasionally get non-type-matching GEP instructions with zeros. These - // are effectively pointer casts, so treat them as such. - setTransformedValue(GEPI, Val); - return; - } - - // The compressed type for the pool. FIXME: NOTE: This only works if 'Val' - // pointed to the start of a node! - const Type *NTy = PointerType::get(PI->getNewType()); - - //Check if we have a pointer to an array of Original Types this happens if - //you do a malloc of [n x OrigTy] for a pool of Type OrigTy - if(isa<PointerType>(GEPI.getOperand(0)->getType())) { - const Type* PT = - cast<PointerType>(GEPI.getOperand(0)->getType())->getElementType(); - if(isa<ArrayType>(PT)) { - if (cast<ArrayType>(PT)->getElementType() == PI->getNode()->getType()) - NTy = PointerType::get(ArrayType::get(PI->getNewType(), - cast<ArrayType>(PT)->getNumElements())); - } - } - - - gep_type_iterator GTI = gep_type_begin(GEPI), E = gep_type_end(GEPI); - for (unsigned i = 1, e = GEPI.getNumOperands(); i != e; ++i, ++GTI) { - Value *Idx = GEPI.getOperand(i); - if (const StructType *STy = dyn_cast<StructType>(*GTI)) { - unsigned Field = (unsigned)cast<ConstantUInt>(Idx)->getValue(); - if (Field) { - uint64_t FieldOffs = TD.getStructLayout(cast<StructType>(NTy)) - ->MemberOffsets[Field]; - Constant *FieldOffsCst = ConstantUInt::get(SCALARUINTTYPE, FieldOffs); - Val = BinaryOperator::createAdd(Val, FieldOffsCst, - GEPI.getName(), &GEPI); - } - - // If this is a one element struct, NTy may not have the structure type. - if (STy->getNumElements() > 1 || - (isa<StructType>(NTy) && - cast<StructType>(NTy)->getNumElements() == 1)) - NTy = cast<StructType>(NTy)->getElementType(Field); - } else { - assert(isa<SequentialType>(*GTI) && "Not struct or sequential?"); - const SequentialType *STy = cast<SequentialType>(*GTI); - if (!isa<Constant>(Idx) || !cast<Constant>(Idx)->isNullValue()) { - // Add Idx*sizeof(NewElementType) to the index. - const Type *ElTy = cast<SequentialType>(NTy)->getElementType(); - if (Idx->getType() != SCALARUINTTYPE) - Idx = new CastInst(Idx, SCALARUINTTYPE, Idx->getName(), &GEPI); - - Constant *Scale = ConstantUInt::get(SCALARUINTTYPE, - TD.getTypeSize(ElTy)); - Idx = BinaryOperator::createMul(Idx, Scale, "fieldidx", &GEPI); - Val = BinaryOperator::createAdd(Val, Idx, GEPI.getName(), &GEPI); - } - - // If this is a one element array type, NTy may not reflect the array. - if (!isa<ArrayType>(STy) || cast<ArrayType>(STy)->getNumElements() != 1 || - (isa<ArrayType>(NTy) && cast<ArrayType>(NTy)->getNumElements() == 1)) - NTy = cast<SequentialType>(NTy)->getElementType(); - } - } - - setTransformedValue(GEPI, Val); -} - -void InstructionRewriter::visitLoadInst(LoadInst &LI) { - const CompressedPoolInfo *SrcPI = getPoolInfo(LI.getOperand(0)); - if (SrcPI == 0) { - // If we are loading a compressed pointer from a non-compressessed memory - // object, retain the load, but cast from the pointer type to our scalar - // type. - if (getPoolInfo(&LI)) { - Value *NLI = new LoadInst(LI.getOperand(0), LI.getName()+".cp", &LI); - Value *NC = new CastInst(NLI, SCALARUINTTYPE, NLI->getName(), &LI); - setTransformedValue(LI, NC); - } - return; - } - - // We care about two cases, here: - // 1. Loading a normal value from a ptr compressed data structure. - // 2. Loading a compressed ptr from a ptr compressed data structure. - bool LoadingCompressedPtr = getNodeIfCompressed(&LI) != 0; - - Value *BasePtr = SrcPI->EmitPoolBaseLoad(LI); - - // Get the pointer to load from. - std::vector<Value*> Ops; - Ops.push_back(getTransformedValue(LI.getOperand(0))); - if (Ops[0]->getType() == Type::UShortTy) - Ops[0] = new CastInst(Ops[0], Type::UIntTy, "extend_idx", &LI); - Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, - LI.getOperand(0)->getName()+".pp", &LI); - const Type *DestTy = LoadingCompressedPtr ? MEMUINTTYPE : LI.getType(); - SrcPtr = new CastInst(SrcPtr, PointerType::get(DestTy), - SrcPtr->getName(), &LI); - std::string OldName = LI.getName(); LI.setName(""); - Value *NewLoad = new LoadInst(SrcPtr, OldName, &LI); - - if (LoadingCompressedPtr) { - // Convert from MEMUINTTYPE to SCALARUINTTYPE if different. - if (MEMUINTTYPE != SCALARUINTTYPE) - NewLoad = new CastInst(NewLoad, SCALARUINTTYPE, NewLoad->getName(), &LI); - - setTransformedValue(LI, NewLoad); - } else { - LI.replaceAllUsesWith(NewLoad); - ValueReplaced(LI, NewLoad); - LI.eraseFromParent(); - } -} - - - -void InstructionRewriter::visitStoreInst(StoreInst &SI) { - const CompressedPoolInfo *DestPI = getPoolInfo(SI.getOperand(1)); - if (DestPI == 0) { - // If we are storing a compressed pointer into uncompressed memory, just - // cast the index to a pointer type and store that. - if (getPoolInfo(SI.getOperand(0))) { - Value *SrcVal = getTransformedValue(SI.getOperand(0)); - SrcVal = new CastInst(SrcVal, SI.getOperand(0)->getType(), - SrcVal->getName(), &SI); - SI.setOperand(0, SrcVal); - } - return; - } - - // We care about two cases, here: - // 1. Storing a normal value into a ptr compressed data structure. - // 2. Storing a compressed ptr into a ptr compressed data structure. Note - // that we cannot use the src value to decide if this is a compressed - // pointer if it's a null pointer. We have to try harder. - // - Value *SrcVal = SI.getOperand(0); - if (!isa<ConstantPointerNull>(SrcVal)) { - if (const CompressedPoolInfo *SrcPI = getPoolInfo(SrcVal)) { - // If the stored value is compressed, get the xformed version - SrcVal = getTransformedValue(SrcVal); - - // If SCALAR type is not the MEM type, reduce it now. - if (SrcVal->getType() != MEMUINTTYPE) - SrcVal = new CastInst(SrcVal, MEMUINTTYPE, SrcVal->getName(), &SI); - } - } else { - // FIXME: This assumes that all null pointers are compressed! - SrcVal = Constant::getNullValue(MEMUINTTYPE); - } - - // Get the pool base pointer. - Value *BasePtr = DestPI->EmitPoolBaseLoad(SI); - - // Get the pointer to store to. - std::vector<Value*> Ops; - Ops.push_back(getTransformedValue(SI.getOperand(1))); - if (Ops[0]->getType() == Type::UShortTy) - Ops[0] = new CastInst(Ops[0], Type::UIntTy, "extend_idx", &SI); - - Value *DestPtr = new GetElementPtrInst(BasePtr, Ops, - SI.getOperand(1)->getName()+".pp", - &SI); - DestPtr = new CastInst(DestPtr, PointerType::get(SrcVal->getType()), - DestPtr->getName(), &SI); - new StoreInst(SrcVal, DestPtr, &SI); - - // Finally, explicitly remove the store from the program, as it does not - // produce a pointer result. - SI.eraseFromParent(); -} - - -void InstructionRewriter::visitPoolInit(CallInst &CI) { - // Transform to poolinit_pc if this is initializing a pool that we are - // compressing. - const CompressedPoolInfo *PI = getPoolInfoForPoolDesc(CI.getOperand(1)); - if (PI == 0) return; // Pool isn't compressed. - - std::vector<Value*> Ops; - Ops.push_back(CI.getOperand(1)); - // Transform to pass in the compressed size. - Ops.push_back(ConstantUInt::get(Type::UIntTy, PI->getNewSize())); - - // Pointer compression can reduce the alignment restriction to 4 bytes from 8. - // Reevaluate the desired alignment. - Ops.push_back(ConstantUInt::get(Type::UIntTy, - PA::Heuristic::getRecommendedAlignment(PI->getNewType(), TD))); - // TODO: Compression could reduce the alignment restriction for the pool! - Value *PB = new CallInst(PtrComp.PoolInitPC, Ops, "", &CI); - - if (!DisablePoolBaseASR) { // Load the pool base immediately. - PB->setName(CI.getOperand(1)->getName()+".poolbase"); - // Remember the pool base for this pool. - PI->setPoolBase(PB); - } - - CI.eraseFromParent(); -} - -void InstructionRewriter::visitPoolDestroy(CallInst &CI) { - // Transform to pooldestroy_pc if this is destroying a pool that we are - // compressing. - const CompressedPoolInfo *PI = getPoolInfoForPoolDesc(CI.getOperand(1)); - if (PI == 0) return; // Pool isn't compressed. - - std::vector<Value*> Ops; - Ops.push_back(CI.getOperand(1)); - new CallInst(PtrComp.PoolDestroyPC, Ops, "", &CI); - CI.eraseFromParent(); -} - -void InstructionRewriter::visitPoolAlloc(CallInst &CI) { - const CompressedPoolInfo *PI = getPoolInfo(&CI); - if (PI == 0) return; // Pool isn't compressed. - - std::vector<Value*> Ops; - Ops.push_back(CI.getOperand(1)); // PD - - Value *Size = CI.getOperand(2); - - // If there was a recommended size, shrink it down now. - if (unsigned OldSizeV = PA::Heuristic::getRecommendedSize(PI->getNode())) - if (OldSizeV != PI->getNewSize()) { - // Emit code to scale the allocated size down by the old size then up by - // the new size. We actually compute (N+OS-1)/OS * NS. - Value *OldSize = ConstantUInt::get(Type::UIntTy, OldSizeV); - Value *NewSize = ConstantUInt::get(Type::UIntTy, PI->getNewSize()); - - Size = BinaryOperator::createAdd(Size, - ConstantUInt::get(Type::UIntTy, OldSizeV-1), - "roundup", &CI); - Size = BinaryOperator::createDiv(Size, OldSize, "numnodes", &CI); - Size = BinaryOperator::createMul(Size, NewSize, "newbytes", &CI); - } - - Ops.push_back(Size); - Value *NC = new CallInst(PtrComp.PoolAllocPC, Ops, CI.getName(), &CI); - setTransformedValue(CI, NC); -} - - -void InstructionRewriter::visitCallInst(CallInst &CI) { - if (Function *F = CI.getCalledFunction()) - // These functions are handled specially. - if (F->getName() == "poolinit") { - visitPoolInit(CI); - return; - } else if (F->getName() == "pooldestroy") { - visitPoolDestroy(CI); - return; - } else if (F->getName() == "poolalloc") { - visitPoolAlloc(CI); - return; - } - - // Normal function call: check to see if this call produces or uses a pointer - // into a compressed pool. If so, we will need to transform the callee or use - // a previously transformed version. - - // PoolsToCompress - Keep track of which pools we are supposed to compress, - // with the nodes from the callee's graph. - std::set<const DSNode*> PoolsToCompress; - - // If this is a direct call, get the information about the callee. - PA::FuncInfo *FI = 0; - const DSGraph *CG = 0; - Function *Callee = CI.getCalledFunction(); - if (Callee) - if ((FI = PtrComp.getPoolAlloc()->getFuncInfoOrClone(*Callee))) - CG = &PtrComp.getGraphForFunc(FI); - - if (!Callee) { - // Indirect call: you CAN'T passed compress pointers in. Don't even think - // about it. - return; - } else if (Callee->isExternal()) { - // We don't have a DSG for the callee in this case. Assume that things will - // work out if we pass compressed pointers. - std::vector<Value*> Operands; - Operands.reserve(CI.getNumOperands()-1); - - // If this is one of the functions we know about, just materialize the - // compressed pointer as a real pointer, and pass it. - if (Callee->getName() == "printf" || Callee->getName() == "sprintf") { - for (unsigned i = 1, e = CI.getNumOperands(); i != e; ++i) - if (isa<PointerType>(CI.getOperand(i)->getType()) && - getPoolInfo(CI.getOperand(i))) - CI.setOperand(i, getTransformedValue(CI.getOperand(i))); - return; - } else if (Callee->getName() == "read") { - if (const CompressedPoolInfo *DestPI = getPoolInfo(CI.getOperand(2))) { - std::vector<Value*> Ops; - Ops.push_back(getTransformedValue(CI.getOperand(2))); - Value *BasePtr = DestPI->EmitPoolBaseLoad(CI); - Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, - CI.getOperand(2)->getName()+".pp", &CI); - SrcPtr = new CastInst(SrcPtr, CI.getOperand(2)->getType(), "", &CI); - CI.setOperand(2, SrcPtr); - return; - } - } else if (Callee->getName() == "fwrite") { - if (const CompressedPoolInfo *DestPI = getPoolInfo(CI.getOperand(1))) { - std::vector<Value*> Ops; - Ops.push_back(getTransformedValue(CI.getOperand(1))); - Value *BasePtr = DestPI->EmitPoolBaseLoad(CI); - Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, - CI.getOperand(1)->getName()+".pp", &CI); - SrcPtr = new CastInst(SrcPtr, CI.getOperand(1)->getType(), "", &CI); - CI.setOperand(1, SrcPtr); - return; - } - } else if (Callee->getName() == "llvm.memset" || - Callee->getName() == "llvm.memset.i32" || - Callee->getName() == "llvm.memset.i64") { - if (const CompressedPoolInfo *DestPI = getPoolInfo(CI.getOperand(1))) { - std::vector<Value*> Ops; - Ops.push_back(getTransformedValue(CI.getOperand(1))); - Value *BasePtr = DestPI->EmitPoolBaseLoad(CI); - Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, - CI.getOperand(1)->getName()+".pp", &CI); - SrcPtr = new CastInst(SrcPtr, CI.getOperand(1)->getType(), "", &CI); - CI.setOperand(1, SrcPtr); - return; - } - } else if (Callee->getName() == "llvm.memcpy" || - Callee->getName() == "llvm.memcpy.i32" || - Callee->getName() == "llvm.memcpy.i64") { - bool doret = false; - if (const CompressedPoolInfo *DestPI = getPoolInfo(CI.getOperand(1))) { - std::vector<Value*> Ops; - Ops.push_back(getTransformedValue(CI.getOperand(1))); - Value *BasePtr = DestPI->EmitPoolBaseLoad(CI); - Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, - CI.getOperand(1)->getName()+".pp", &CI); - SrcPtr = new CastInst(SrcPtr, CI.getOperand(1)->getType(), "", &CI); - CI.setOperand(1, SrcPtr); - doret = true; - } - if (const CompressedPoolInfo *DestPI = getPoolInfo(CI.getOperand(2))) { - std::vector<Value*> Ops; - Ops.push_back(getTransformedValue(CI.getOperand(2))); - Value *BasePtr = DestPI->EmitPoolBaseLoad(CI); - Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, - CI.getOperand(2)->getName()+".pp", &CI); - SrcPtr = new CastInst(SrcPtr, CI.getOperand(2)->getType(), "", &CI); - CI.setOperand(2, SrcPtr); - doret = true; - } - if (doret) return; - } - - - std::vector<unsigned> CompressedArgs; - if (isa<PointerType>(CI.getType()) && getPoolInfo(&CI)) - CompressedArgs.push_back(0); // Compress retval. - - for (unsigned i = 1, e = CI.getNumOperands(); i != e; ++i) - if (isa<PointerType>(CI.getOperand(i)->getType()) && - getPoolInfo(CI.getOperand(i))) { - CompressedArgs.push_back(i); - Operands.push_back(getTransformedValue(CI.getOperand(i))); - } else { - Operands.push_back(CI.getOperand(i)); - } - - if (CompressedArgs.empty()) { - PtrComp.NoArgFunctionsCalled.push_back(Callee); - return; // Nothing to compress! - } - - Function *Clone = PtrComp.GetExtFunctionClone(Callee, CompressedArgs); - Value *NC = new CallInst(Clone, Operands, CI.getName(), &CI); - if (NC->getType() != CI.getType()) // Compressing return value? - setTransformedValue(CI, NC); - else { - if (CI.getType() != Type::VoidTy) - CI.replaceAllUsesWith(NC); - ValueReplaced(CI, NC); - CI.eraseFromParent(); - } - return; - } - - // CalleeCallerMap: Mapping from nodes in the callee to nodes in the caller. - DSGraph::NodeMapTy CalleeCallerMap; - - // Do we need to compress the return value? - if (isa<PointerType>(CI.getType())) - DSGraph::computeNodeMapping(CG->getReturnNodeFor(FI->F), - getMappedNodeHandle(&CI), CalleeCallerMap); - - // Find the arguments we need to compress. - unsigned NumPoolArgs = FI ? FI->ArgNodes.size() : 0; - //only search non-vararg arguments - //FIXME: suspect hack to prevent crashing on user-defined vaarg functions - unsigned NumSearch = FI ? FI->F.arg_size() + 1: CI.getNumOperands(); - for (unsigned i = 1, e = NumSearch; i != e; ++i) - if (isa<PointerType>(CI.getOperand(i)->getType()) && i > NumPoolArgs) { - Argument *FormalArg = next(FI->F.arg_begin(), i-1-NumPoolArgs); - - DSGraph::computeNodeMapping(CG->getNodeForValue(FormalArg), - getMappedNodeHandle(CI.getOperand(i)), - CalleeCallerMap); - } - - // Now that we know the basic pools passed/returned through the - // argument/retval of the call, add the compressed pools that are reachable - // from them. The CalleeCallerMap contains a mapping from callee nodes to the - // caller nodes they correspond to (a many-to-one mapping). - for (DSGraph::NodeMapTy::iterator I = CalleeCallerMap.begin(), - E = CalleeCallerMap.end(); I != E; ++I) { - // If the destination is compressed, so should the source be. - if (PoolInfo.count(I->second.getNode())) - PoolsToCompress.insert(I->first); - } - - // If this function doesn't require compression, there is nothing to do! - // However, this function still needs to be transformed; it may just be - // using a global pool descriptor. - if (PoolsToCompress.empty()) { - PtrComp.NoArgFunctionsCalled.push_back(Callee); - return; - } - - - // Get the clone of this function that uses compressed pointers instead of - // normal pointers. - Function *Clone = PtrComp.GetFunctionClone(Callee, PoolsToCompress, - *FI, *CG); - - - // Okay, we now have our clone: rewrite the call instruction. - std::vector<Value*> Operands; - Operands.reserve(CI.getNumOperands()-1); - - Function::arg_iterator AI = FI->F.arg_begin(); - - // Pass pool descriptors. - for (unsigned i = 1; i != NumPoolArgs+1; ++i) - Operands.push_back(CI.getOperand(i)); - - for (unsigned i = NumPoolArgs+1, e = CI.getNumOperands(); i != e; ++i, ++AI) - if (isa<PointerType>(CI.getOperand(i)->getType()) && - PoolsToCompress.count(CG->getNodeForValue(AI).getNode())) - Operands.push_back(getTransformedValue(CI.getOperand(i))); - else - Operands.push_back(CI.getOperand(i)); - - Value *NC = new CallInst(Clone, Operands, CI.getName(), &CI); - if (NC->getType() != CI.getType()) // Compressing return value? - setTransformedValue(CI, NC); - else { - if (CI.getType() != Type::VoidTy) - CI.replaceAllUsesWith(NC); - ValueReplaced(CI, NC); - CI.eraseFromParent(); - } -} - - - -//===----------------------------------------------------------------------===// -// PointerCompress Implementation -//===----------------------------------------------------------------------===// - -void PointerCompress::getAnalysisUsage(AnalysisUsage &AU) const { - // Need information about how pool allocation happened. - AU.addRequired<PoolAllocatePassAllPools>(); - - // Need information from DSA. - AU.addRequired<EquivClassGraphs>(); -} - -/// PoolIsCompressible - Return true if we can pointer compress this node. -/// If not, we should DEBUG print out why. -static bool PoolIsCompressible(const DSNode *N) { - assert(!N->isForwarding() && "Should not be dealing with merged nodes!"); - if (N->isNodeCompletelyFolded()) { - DEBUG(std::cerr << "Node is not type-safe:\n"); - return false; - } - - // FIXME: If any non-type-safe nodes point to this one, we cannot compress it. -#if 0 - bool HasFields = false; - for (DSNode::const_edge_iterator I = N->edge_begin(), E = N->edge_end(); - I != E; ++I) - if (!I->isNull()) { - HasFields = true; - if (I->getNode() != N) { - // We currently only handle trivially self cyclic DS's right now. - DEBUG(std::cerr << "Node points to nodes other than itself:\n"); - return false; - } - } - - if (!HasFields) { - DEBUG(std::cerr << "Node does not contain any pointers to compress:\n"); - return false; - } -#endif - - if ((N->getNodeFlags() & DSNode::Composition) != DSNode::HeapNode) { - DEBUG(std::cerr << "Node contains non-heap values:\n"); - return false; - } - - return true; -} - -/// FindPoolsToCompress - Inspect the specified function and find pools that are -/// compressible that are homed in that function. Return those pools in the -/// Pools set. -void PointerCompress::FindPoolsToCompress(std::set<const DSNode*> &Pools, - std::map<const DSNode*, - Value*> &PreassignedPools, - Function &F, DSGraph &DSG, - PA::FuncInfo *FI) { - DEBUG(std::cerr << "In function '" << F.getName() << "':\n"); - for (unsigned i = 0, e = FI->NodesToPA.size(); i != e; ++i) { - const DSNode *N = FI->NodesToPA[i]; - - // Ignore potential pools that the pool allocation heuristic decided not to - // pool allocated. - if (!isa<ConstantPointerNull>(FI->PoolDescriptors[N])) - if (PoolIsCompressible(N)) { - Pools.insert(N); - ++NumCompressed; - } else { - DEBUG(std::cerr << "PCF: "; N->dump()); - ++NumNotCompressed; - } - } - - // If there are no compressed global pools, don't bother to look for them. - if (CompressedGlobalPools.empty()) return; - - // Calculate which DSNodes are reachable from globals. If a node is reachable - // from a global, we check to see if the global pool is compressed. - DSGraph &GG = ECG->getGlobalsGraph(); - - // Map all node reachable from this global to the corresponding nodes in the - // globals graph. - DSGraph::NodeMapTy GlobalsGraphNodeMapping; - DSG.computeGToGGMapping(GlobalsGraphNodeMapping); - - // See if there are nodes in this graph that correspond to nodes in the - // globals graph, and if so, if it is compressed. - for (DSGraph::node_iterator I = DSG.node_begin(), E = DSG.node_end(); - I != E;++I) - if (GlobalsGraphNodeMapping.count(I)) { - // If it is a global pool, set up the pool descriptor appropriately. - DSNode *GGN = GlobalsGraphNodeMapping[I].getNode(); - if (CompressedGlobalPools.count(GGN)) { - Pools.insert(I); - PreassignedPools[I] = CompressedGlobalPools[GGN]; - } - } -} - - -/// CompressPoolsInFunction - Find all pools that are compressible in this -/// function and compress them. -bool PointerCompress:: -CompressPoolsInFunction(Function &F, - std::vector<std::pair<Value*, Value*> > *PremappedVals, - std::set<const DSNode*> *ExternalPoolsToCompress){ - if (F.isExternal()) return false; - - // If this is a pointer compressed clone of a pool allocated function, get the - // the pool allocated function. Rewriting a clone means that there are - // incoming arguments that point into compressed pools. - FunctionCloneRecord *FCR = getCloneInfo(F); - Function *CloneSource = FCR ? FCR->PAFn : 0; - - PA::FuncInfo *FI; - if (CloneSource) - FI = PoolAlloc->getFuncInfoOrClone(*CloneSource); - else - FI = PoolAlloc->getFuncInfoOrClone(F); - - if (FI == 0) { - std::cerr << "DIDN'T FIND POOL INFO FOR: " - << *F.getType() << F.getName() << "!\n"; - return false; - } - - // If this function was cloned, and this is the original function, ignore it - // (it's dead). We'll deal with the cloned version later when we run into it - // again. - if (FI->Clone && &FI->F == &F) - return false; - - // Get the DSGraph for this function. - DSGraph &DSG = ECG->getDSGraph(FI->F); - - std::set<const DSNode*> PoolsToCompressSet; - - // Compute the set of compressible pools in this function that are hosted - // here. - std::map<const DSNode*, Value*> PreassignedPools; - FindPoolsToCompress(PoolsToCompressSet, PreassignedPools, F, DSG, FI); - - // Handle pools that are passed into the function through arguments or - // returned by the function. If this occurs, we must be dealing with a ptr - // compressed clone of the pool allocated clone of the original function. - if (ExternalPoolsToCompress) - PoolsToCompressSet.insert(ExternalPoolsToCompress->begin(), - ExternalPoolsToCompress->end()); - - // If there is nothing that we can compress, exit now. - if (PoolsToCompressSet.empty()) return false; - - // Compute the initial collection of compressed pointer infos. - std::map<const DSNode*, CompressedPoolInfo> PoolsToCompress; - - for (std::set<const DSNode*>::iterator I = PoolsToCompressSet.begin(), - E = PoolsToCompressSet.end(); I != E; ++I) { - Value *PD; - if (Value *PAPD = PreassignedPools[*I]) - PD = PAPD; // Must be a global pool. - else if (FCR) - PD = FCR->PoolDescriptors.find(*I)->second; - else - PD = FI->PoolDescriptors[*I]; - assert(PD && "No pool descriptor available for this pool???"); - - PoolsToCompress.insert(std::make_pair(*I, CompressedPoolInfo(*I, PD))); - } - - // Use these to compute the closure of compression information. In - // particular, if one pool points to another, we need to know if the outgoing - // pointer is compressed. - const TargetData &TD = DSG.getTargetData(); - std::cerr << "In function '" << F.getName() << "':\n"; - for (std::map<const DSNode*, CompressedPoolInfo>::iterator - I = PoolsToCompress.begin(), E = PoolsToCompress.end(); I != E; ++I) { - - I->second.Initialize(PoolsToCompress, TD); - - // Only dump info about a compressed pool if this is the home for it. - if (isa<AllocaInst>(I->second.getPoolDesc()) || - (isa<GlobalValue>(I->second.getPoolDesc()) && - F.hasExternalLinkage() && F.getName() == "main")) { - std::cerr << " COMPRESSING POOL:\nPCS:"; - I->second.dump(); - } - } - - // Finally, rewrite the function body to use compressed pointers! - InstructionRewriter IR(PoolsToCompress, DSG, *FI, FCR, *this); - if (PremappedVals) - IR.PremapValues(*PremappedVals); - IR.visit(F); - return true; -} - - -/// GetExtFunctionClone - Return a clone of the specified external function with -/// the specified arguments compressed. -Function *PointerCompress:: -GetExtFunctionClone(Function *F, const std::vector<unsigned> &ArgsToComp) { - assert(!ArgsToComp.empty() && "No reason to make a clone!"); - Function *&Clone = ExtCloneFunctionMap[std::make_pair(F, ArgsToComp)]; - if (Clone) return Clone; - - const FunctionType *FTy = F->getFunctionType(); - const Type *RetTy = FTy->getReturnType(); - unsigned ArgIdx = 0; - if (isa<PointerType>(RetTy) && ArgsToComp[0] == 0) { - RetTy = SCALARUINTTYPE; - ++ArgIdx; - } - - std::vector<const Type*> ParamTypes; - - for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i) - if (ArgIdx < ArgsToComp.size() && ArgsToComp[ArgIdx]-1 == i) { - // Compressed pool, pass an index. - ParamTypes.push_back(SCALARUINTTYPE); - ++ArgIdx; - } else { - ParamTypes.push_back(FTy->getParamType(i)); - } - FunctionType *CFTy = FunctionType::get(RetTy, ParamTypes, FTy->isVarArg()); - - // Next, create the clone prototype and insert it into the module. - Clone = new Function(CFTy, GlobalValue::ExternalLinkage, - F->getName()+"_pc"); - F->getParent()->getFunctionList().insert(F, Clone); - return Clone; -} - -/// GetFunctionClone - Lazily create clones of pool allocated functions that we -/// need in compressed form. This memoizes the functions that have been cloned -/// to allow only one clone of each function in a desired permutation. -Function *PointerCompress:: -GetFunctionClone(Function *F, std::set<const DSNode*> &PoolsToCompress, - PA::FuncInfo &FI, const DSGraph &CG) { - assert(!PoolsToCompress.empty() && "No clone needed!"); - - // Check to see if we have already compressed this function, if so, there is - // no need to make another clone. This is also important to avoid infinite - // recursion. - Function *&Clone = ClonedFunctionMap[std::make_pair(F, PoolsToCompress)]; - if (Clone) return Clone; - - // First step, construct the new function prototype. - const FunctionType *FTy = F->getFunctionType(); - const Type *RetTy = FTy->getReturnType(); - if (isa<PointerType>(RetTy) && - PoolsToCompress.count(CG.getReturnNodeFor(FI.F).getNode())) { - RetTy = SCALARUINTTYPE; - } - std::vector<const Type*> ParamTypes; - unsigned NumPoolArgs = FI.ArgNodes.size(); - - // Pass all pool args unmodified. - for (unsigned i = 0; i != NumPoolArgs; ++i) - ParamTypes.push_back(FTy->getParamType(i)); - - Function::arg_iterator AI = FI.F.arg_begin(); - for (unsigned i = NumPoolArgs, e = FTy->getNumParams(); i != e; ++i, ++AI) - if (isa<PointerType>(FTy->getParamType(i)) && - PoolsToCompress.count(CG.getNodeForValue(AI).getNode())) { - // Compressed pool, pass an index. - ParamTypes.push_back(SCALARUINTTYPE); - } else { - ParamTypes.push_back(FTy->getParamType(i)); - } - FunctionType *CFTy = FunctionType::get(RetTy, ParamTypes, FTy->isVarArg()); - - // Next, create the clone prototype and insert it into the module. - Clone = new Function(CFTy, GlobalValue::InternalLinkage, - F->getName()+".pc"); - F->getParent()->getFunctionList().insert(F, Clone); - - // Remember where this clone came from. - FunctionCloneRecord &CFI = - ClonedFunctionInfoMap.insert(std::make_pair(Clone, F)).first->second; - - ++NumCloned; - std::cerr << " CLONING FUNCTION: " << F->getName() << " -> " - << Clone->getName() << "\n"; - - if (F->isExternal()) { - Clone->setLinkage(GlobalValue::ExternalLinkage); - return Clone; - } - - std::map<const Value*, Value*> ValueMap; - - // Create dummy Value*'s of pointer type for any arguments that are - // compressed. These are needed to satisfy typing constraints before the - // function body has been rewritten. - std::vector<std::pair<Value*,Value*> > RemappedArgs; - - // Process arguments, setting up the ValueMap for them. - Function::arg_iterator CI = Clone->arg_begin();// Iterate over cloned fn args. - for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); - I != E; ++I, ++CI) { - // Transfer the argument names over. - CI->setName(I->getName()); - - // If we are compressing this argument, set up RemappedArgs. - if (CI->getType() != I->getType()) { - // Create a useless value* that is only needed to hold the uselist for the - // argument. - Value *V = new Argument(I->getType()); // dummy argument - RemappedArgs.push_back(std::make_pair(V, CI)); - ValueMap[I] = V; - } else { - // Otherwise, just remember the mapping. - ValueMap[I] = CI; - } - } - - // Clone the actual function body over. - std::vector<ReturnInst*> Returns; - CloneFunctionInto(Clone, F, ValueMap, Returns); - Returns.clear(); // Don't need this. - - // Invert the ValueMap into the NewToOldValueMap - std::map<Value*, const Value*> &NewToOldValueMap = CFI.NewToOldValueMap; - for (std::map<const Value*, Value*>::iterator I = ValueMap.begin(), - E = ValueMap.end(); I != E; ++I) - NewToOldValueMap.insert(std::make_pair(I->second, I->first)); - - // Compute the PoolDescriptors map for the cloned function. - for (std::map<const DSNode*, Value*>::iterator I = - FI.PoolDescriptors.begin(), E = FI.PoolDescriptors.end(); - I != E; ++I) - CFI.PoolDescriptors[I->first] = ValueMap[I->second]; - - ValueMap.clear(); - - // Recursively transform the function. - CompressPoolsInFunction(*Clone, &RemappedArgs, &PoolsToCompress); - return Clone; -} - - -// Handle all pools pointed to by global variables. -void PointerCompress::HandleGlobalPools(Module &M) { - if (PoolAlloc->GlobalNodes.empty()) return; - - DEBUG(std::cerr << "Inspecting global nodes:\n"); - - // Loop over all of the global nodes identified by the pool allocator. - for (std::map<const DSNode*, Value*>::iterator I = - PoolAlloc->GlobalNodes.begin(), E = PoolAlloc->GlobalNodes.end(); - I != E; ++I) { - const DSNode *N = I->first; - - // Ignore potential pools that the pool allocation heuristic decided not to - // pool allocated. - if (!isa<ConstantPointerNull>(I->second)) - if (PoolIsCompressible(N)) { - CompressedGlobalPools.insert(std::make_pair(N, - cast<GlobalValue>(I->second))); - ++NumCompressed; - } else { - DEBUG(std::cerr << "PCF: "; N->dump()); - ++NumNotCompressed; - } - } -} - - -/// InitializePoolLibraryFunctions - Create the function prototypes for pointer -/// compress runtime library functions. -void PointerCompress::InitializePoolLibraryFunctions(Module &M) { - const Type *VoidPtrTy = PointerType::get(Type::SByteTy); - const Type *PoolDescPtrTy = PointerType::get(ArrayType::get(VoidPtrTy, 16)); - - PoolInitPC = M.getOrInsertFunction("poolinit_pc", VoidPtrTy, PoolDescPtrTy, - Type::UIntTy, Type::UIntTy, NULL); - PoolDestroyPC = M.getOrInsertFunction("pooldestroy_pc", Type::VoidTy, - PoolDescPtrTy, NULL); - PoolAllocPC = M.getOrInsertFunction("poolalloc_pc", SCALARUINTTYPE, - PoolDescPtrTy, Type::UIntTy, NULL); - // FIXME: Need bumppointer versions as well as realloc??/memalign?? -} - -bool PointerCompress::runOnModule(Module &M) { - PoolAlloc = &getAnalysis<PoolAllocatePassAllPools>(); - ECG = &getAnalysis<EquivClassGraphs>(); - - if (SmallIntCompress) - MEMUINTTYPE = Type::UShortTy; - else - MEMUINTTYPE = Type::UIntTy; - - // FIXME: make this IntPtrTy. - SCALARUINTTYPE = Type::ULongTy; - - // Create the function prototypes for pointer compress runtime library - // functions. - InitializePoolLibraryFunctions(M); - - // Handle all pools pointed to by global variables. - HandleGlobalPools(M); - - std::set<Function*> TransformedFns; - - // Iterate over all functions in the module, looking for compressible data - // structures. - bool Changed = false; - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - // If this function is not a pointer-compressed or pool allocated clone, - // compress any pools in it now. - if (I->hasExternalLinkage()) { - Changed |= CompressPoolsInFunction(*I); - TransformedFns.insert(I); - } - - // If compressing external functions (e.g. main), required other function - // bodies to be compressed that do not take pool arguments, handle them now. - for (unsigned i = 0; i != NoArgFunctionsCalled.size(); ++i) - if (TransformedFns.insert(NoArgFunctionsCalled[i]).second) - Changed |= CompressPoolsInFunction(*NoArgFunctionsCalled[i]); - - NoArgFunctionsCalled.clear(); - ClonedFunctionMap.clear(); - return Changed; -}
diff --git a/poolalloc/lib/PoolAllocate/PoolAllocate.cpp b/poolalloc/lib/PoolAllocate/PoolAllocate.cpp deleted file mode 100644 index 44e2df1..0000000 --- a/poolalloc/lib/PoolAllocate/PoolAllocate.cpp +++ /dev/null
@@ -1,937 +0,0 @@ -//===-- PoolAllocate.cpp - Pool Allocation Pass ---------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This transform changes programs so that disjoint data structures are -// allocated out of different pools of memory, increasing locality. -// -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "poolalloc" -#include "PoolAllocate.h" -#include "Heuristic.h" -#include "llvm/Constants.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Instructions.h" -#include "llvm/Module.h" -#include "llvm/Constants.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Support/CFG.h" -#include "llvm/Target/TargetData.h" -#include "llvm/Transforms/Utils/BasicBlockUtils.h" -#include "llvm/Transforms/Utils/Cloning.h" -#include "llvm/Analysis/DataStructure/CallTargets.h" -#include "llvm/ADT/DepthFirstIterator.h" -#include "llvm/ADT/Statistic.h" -#include "llvm/ADT/STLExtras.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/Debug.h" -#include "llvm/Support/Timer.h" - -#include <iostream> - -using namespace llvm; -using namespace PA; -#ifdef SAFECODE -using namespace CUA; -#endif - -const Type *PoolAllocate::PoolDescPtrTy = 0; - -#if 0 -#define TIME_REGION(VARNAME, DESC) \ - NamedRegionTimer VARNAME(DESC) -#else -#define TIME_REGION(VARNAME, DESC) -#endif - -namespace { - RegisterOpt<PoolAllocate> - X("poolalloc", "Pool allocate disjoint data structures"); - RegisterOpt<PoolAllocatePassAllPools> - Y("poolalloc-passing-all-pools", "Pool allocate disjoint data structures"); - - Statistic<> NumArgsAdded("poolalloc", "Number of function arguments added"); - Statistic<> MaxArgsAdded("poolalloc", "Maximum function arguments added to one function"); - Statistic<> NumCloned ("poolalloc", "Number of functions cloned"); - Statistic<> NumPools ("poolalloc", "Number of pools allocated"); - Statistic<> NumTSPools ("poolalloc", "Number of typesafe pools"); - Statistic<> NumPoolFree ("poolalloc", "Number of poolfree's elided"); - Statistic<> NumNonprofit("poolalloc", "Number of DSNodes not profitable"); - Statistic<> NumColocated("poolalloc", "Number of DSNodes colocated"); - - const Type *VoidPtrTy; - - // The type to allocate for a pool descriptor. - const Type *PoolDescType; - - cl::opt<bool> - DisableInitDestroyOpt("poolalloc-force-simple-pool-init", - cl::desc("Always insert poolinit/pooldestroy calls at start and exit of functions"));//, cl::init(true)); - cl::opt<bool> - DisablePoolFreeOpt("poolalloc-force-all-poolfrees", - cl::desc("Do not try to elide poolfree's where possible")); - - cl::opt<bool> - UseTDResolve("poolalloc-usetd-resolve", - cl::desc("Use Top-Down Graph as a resolve source")); -} - -void PoolAllocate::getAnalysisUsage(AnalysisUsage &AU) const { -#ifdef SAFECODE - AU.addRequired<ConvertUnsafeAllocas>(); -#endif - AU.addRequired<EquivClassGraphs>(); - AU.addPreserved<EquivClassGraphs>(); -#ifdef SAFECODE - //Dinakar for preserving the pool information across passes - AU.setPreservesAll(); -#endif -#ifdef BOUNDS_CHECK - //Dinakar hack for preserving the pool information across passes - AU.setPreservesAll(); -#endif - AU.addRequired<TargetData>(); - if (UseTDResolve) - AU.addRequired<CallTargetFinder>(); -} - -bool PoolAllocate::runOnModule(Module &M) { - if (M.begin() == M.end()) return false; -#ifdef SAFECODE - CUAPass = &getAnalysis<ConvertUnsafeAllocas>(); -#endif - CurModule = &M; - ECGraphs = &getAnalysis<EquivClassGraphs>(); // folded inlined CBU graphs - if (UseTDResolve) - CTF = &getAnalysis<CallTargetFinder>(); - else - CTF = 0; - - CurHeuristic = Heuristic::create(); - CurHeuristic->Initialize(M, ECGraphs->getGlobalsGraph(), *this); - - // Add the pool* prototypes to the module - AddPoolPrototypes(); - - // Create the pools for memory objects reachable by global variables. - if (SetupGlobalPools(M)) - return true; - - // Loop over the functions in the original program finding the pool desc. - // arguments necessary for each function that is indirectly callable. - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal() && ECGraphs->ContainsDSGraphFor(*I)) - FindFunctionPoolArgs(*I); - - std::map<Function*, Function*> FuncMap; - - // Now clone a function using the pool arg list obtained in the previous pass - // over the modules. Loop over only the function initially in the program, - // don't traverse newly added ones. If the function needs new arguments, make - // its clone. - std::set<Function*> ClonedFunctions; -{TIME_REGION(X, "MakeFunctionClone"); - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal() && !ClonedFunctions.count(I) && - ECGraphs->ContainsDSGraphFor(*I)) - if (Function *Clone = MakeFunctionClone(*I)) { - FuncMap[I] = Clone; - ClonedFunctions.insert(Clone); - } -} - - // Now that all call targets are available, rewrite the function bodies of the - // clones. -{TIME_REGION(X, "ProcessFunctionBody"); - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal() && !ClonedFunctions.count(I) && - ECGraphs->ContainsDSGraphFor(*I)) { - std::map<Function*, Function*>::iterator FI = FuncMap.find(I); - ProcessFunctionBody(*I, FI != FuncMap.end() ? *FI->second : *I); - } -} - // Replace all uses of original functions with the transformed function. - for (std::map<Function *, Function *>::iterator I = FuncMap.begin(), - E = FuncMap.end(); I != E; ++I) { - Function *F = I->first; - F->replaceAllUsesWith(ConstantExpr::getCast(I->second, F->getType())); - } - - if (CurHeuristic->IsRealHeuristic()) - MicroOptimizePoolCalls(); - - delete CurHeuristic; - return true; -} - -// AddPoolPrototypes - Add prototypes for the pool functions to the specified -// module and update the Pool* instance variables to point to them. -// -// NOTE: If these are changed, make sure to update PoolOptimize.cpp as well! -// -void PoolAllocate::AddPoolPrototypes() { - if (VoidPtrTy == 0) { - // NOTE: If these are changed, make sure to update PoolOptimize.cpp as well! - VoidPtrTy = PointerType::get(Type::SByteTy); -#ifdef SAFECODE - PoolDescType = ArrayType::get(VoidPtrTy, 50); -#else - PoolDescType = ArrayType::get(VoidPtrTy, 16); -#endif - PoolDescPtrTy = PointerType::get(PoolDescType); - } - - CurModule->addTypeName("PoolDescriptor", PoolDescType); - - // Get poolinit function. - PoolInit = CurModule->getOrInsertFunction("poolinit", Type::VoidTy, - PoolDescPtrTy, Type::UIntTy, - Type::UIntTy, NULL); - - // Get pooldestroy function. - PoolDestroy = CurModule->getOrInsertFunction("pooldestroy", Type::VoidTy, - PoolDescPtrTy, NULL); - - // The poolalloc function. - PoolAlloc = CurModule->getOrInsertFunction("poolalloc", - VoidPtrTy, PoolDescPtrTy, - Type::UIntTy, NULL); - - // The poolrealloc function. - PoolRealloc = CurModule->getOrInsertFunction("poolrealloc", - VoidPtrTy, PoolDescPtrTy, - VoidPtrTy, Type::UIntTy, NULL); - // The poolmemalign function. - PoolMemAlign = CurModule->getOrInsertFunction("poolmemalign", - VoidPtrTy, PoolDescPtrTy, - Type::UIntTy, Type::UIntTy, - NULL); - - // Get the poolfree function. - PoolFree = CurModule->getOrInsertFunction("poolfree", Type::VoidTy, - PoolDescPtrTy, VoidPtrTy, NULL); -#ifdef SAFECODE - //Get the poolregister function - PoolRegister = CurModule->getOrInsertFunction("poolregister", Type::VoidTy, - PoolDescPtrTy, Type::UIntTy, VoidPtrTy, NULL); -#endif -#ifdef BOUNDS_CHECK - PoolRegister = CurModule->getOrInsertFunction("poolregister", Type::VoidTy, - PoolDescPtrTy, VoidPtrTy, Type::UIntTy, NULL); -#endif -} - -static void getCallsOf(Function *F, std::vector<CallInst*> &Calls) { - Calls.clear(); - for (Value::use_iterator UI = F->use_begin(), E = F->use_end(); UI != E; ++UI) - Calls.push_back(cast<CallInst>(*UI)); -} - -static void OptimizePointerNotNull(Value *V) { - for (Value::use_iterator I = V->use_begin(), E = V->use_end(); I != E; ++I) { - Instruction *User = cast<Instruction>(*I); - if (User->getOpcode() == Instruction::SetEQ || - User->getOpcode() == Instruction::SetNE) { - if (isa<Constant>(User->getOperand(1)) && - cast<Constant>(User->getOperand(1))->isNullValue()) { - bool CondIsTrue = User->getOpcode() == Instruction::SetNE; - User->replaceAllUsesWith(ConstantBool::get(CondIsTrue)); - } - } else if (User->getOpcode() == Instruction::Cast) { - // Casted pointers are also not null. - if (isa<PointerType>(User->getType())) - OptimizePointerNotNull(User); - } else if (User->getOpcode() == Instruction::GetElementPtr) { - // GEP'd pointers are also not null. - OptimizePointerNotNull(User); - } - } -} - -/// MicroOptimizePoolCalls - Apply any microoptimizations to calls to pool -/// allocation function calls that we can. This runs after the whole program -/// has been transformed. -void PoolAllocate::MicroOptimizePoolCalls() { - // Optimize poolalloc - std::vector<CallInst*> Calls; - getCallsOf(PoolAlloc, Calls); - for (unsigned i = 0, e = Calls.size(); i != e; ++i) { - CallInst *CI = Calls[i]; - // poolalloc never returns null. Loop over all uses of the call looking for - // set(eq|ne) X, null. - OptimizePointerNotNull(CI); - } - - // TODO: poolfree accepts a null pointer, so remove any check above it, like - // 'if (P) poolfree(P)' -} - - - - -static void GetNodesReachableFromGlobals(DSGraph &G, - hash_set<const DSNode*> &NodesFromGlobals) { - for (DSScalarMap::global_iterator I = G.getScalarMap().global_begin(), - E = G.getScalarMap().global_end(); I != E; ++I) - G.getNodeForValue(*I).getNode()->markReachableNodes(NodesFromGlobals); -} - -static void MarkNodesWhichMustBePassedIn(hash_set<const DSNode*> &MarkedNodes, - Function &F, DSGraph &G, - bool PassAllArguments) { - // Mark globals and incomplete nodes as live... (this handles arguments) - if (F.getName() != "main") { - // All DSNodes reachable from arguments must be passed in. - for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); - I != E; ++I) { - DSGraph::ScalarMapTy::iterator AI = G.getScalarMap().find(I); - if (AI != G.getScalarMap().end()) - if (DSNode *N = AI->second.getNode()) - N->markReachableNodes(MarkedNodes); - } - } - - // Marked the returned node as needing to be passed in. - if (DSNode *RetNode = G.getReturnNodeFor(F).getNode()) - RetNode->markReachableNodes(MarkedNodes); - - // Calculate which DSNodes are reachable from globals. If a node is reachable - // from a global, we will create a global pool for it, so no argument passage - // is required. - hash_set<const DSNode*> NodesFromGlobals; - GetNodesReachableFromGlobals(G, NodesFromGlobals); - - // Remove any nodes reachable from a global. These nodes will be put into - // global pools, which do not require arguments to be passed in. Also, erase - // any marked node that is not a heap node. Since no allocations or frees - // will be done with it, it needs no argument. - for (hash_set<const DSNode*>::iterator I = MarkedNodes.begin(), - E = MarkedNodes.end(); I != E; ) { - const DSNode *N = *I++; - if ((!(1 || N->isHeapNode()) && !PassAllArguments) || NodesFromGlobals.count(N)) - MarkedNodes.erase(N); - } -} - - -/// FindFunctionPoolArgs - In the first pass over the program, we decide which -/// arguments will have to be added for each function, build the FunctionInfo -/// map and recording this info in the ArgNodes set. -void PoolAllocate::FindFunctionPoolArgs(Function &F) { - DSGraph &G = ECGraphs->getDSGraph(F); - - // Create a new entry for F. - FuncInfo &FI = - FunctionInfo.insert(std::make_pair(&F, FuncInfo(F))).first->second; - hash_set<const DSNode*> &MarkedNodes = FI.MarkedNodes; - - if (G.node_begin() == G.node_end()) - return; // No memory activity, nothing is required - - // Find DataStructure nodes which are allocated in pools non-local to the - // current function. This set will contain all of the DSNodes which require - // pools to be passed in from outside of the function. - MarkNodesWhichMustBePassedIn(MarkedNodes, F, G, PassAllArguments); - - FI.ArgNodes.insert(FI.ArgNodes.end(), MarkedNodes.begin(), MarkedNodes.end()); -} - -// MakeFunctionClone - If the specified function needs to be modified for pool -// allocation support, make a clone of it, adding additional arguments as -// necessary, and return it. If not, just return null. -// -Function *PoolAllocate::MakeFunctionClone(Function &F) { - DSGraph &G = ECGraphs->getDSGraph(F); - if (G.node_begin() == G.node_end()) return 0; - - FuncInfo &FI = *getFuncInfo(F); - if (FI.ArgNodes.empty()) - return 0; // No need to clone if no pools need to be passed in! - - // Update statistics.. - NumArgsAdded += FI.ArgNodes.size(); - if (MaxArgsAdded < FI.ArgNodes.size()) MaxArgsAdded = FI.ArgNodes.size(); - ++NumCloned; - - - // Figure out what the arguments are to be for the new version of the function - const FunctionType *OldFuncTy = F.getFunctionType(); - std::vector<const Type*> ArgTys(FI.ArgNodes.size(), PoolDescPtrTy); - ArgTys.reserve(OldFuncTy->getNumParams() + FI.ArgNodes.size()); - - ArgTys.insert(ArgTys.end(), OldFuncTy->param_begin(), OldFuncTy->param_end()); - - // Create the new function prototype - FunctionType *FuncTy = FunctionType::get(OldFuncTy->getReturnType(), ArgTys, - OldFuncTy->isVarArg()); - // Create the new function... - Function *New = new Function(FuncTy, Function::InternalLinkage, F.getName()); - F.getParent()->getFunctionList().insert(&F, New); - CloneToOrigMap[New] = &F; // Remember original function. - - // Set the rest of the new arguments names to be PDa<n> and add entries to the - // pool descriptors map - std::map<const DSNode*, Value*> &PoolDescriptors = FI.PoolDescriptors; - Function::arg_iterator NI = New->arg_begin(); - - for (unsigned i = 0, e = FI.ArgNodes.size(); i != e; ++i, ++NI) { - NI->setName("PDa"); - PoolDescriptors[FI.ArgNodes[i]] = NI; - } - - // Map the existing arguments of the old function to the corresponding - // arguments of the new function, and copy over the names. -#ifdef SAFECODE - std::map<const Value*, Value*> &ValueMap = FI.ValueMap; -#else - std::map<const Value*, Value*> ValueMap; -#endif - for (Function::arg_iterator I = F.arg_begin(); - NI != New->arg_end(); ++I, ++NI) { - ValueMap[I] = NI; - NI->setName(I->getName()); - } - - // Perform the cloning. - std::vector<ReturnInst*> Returns; -{TIME_REGION(X, "CloneFunctionInto"); - CloneFunctionInto(New, &F, ValueMap, Returns); -} - // Invert the ValueMap into the NewToOldValueMap - std::map<Value*, const Value*> &NewToOldValueMap = FI.NewToOldValueMap; - - for (std::map<const Value*, Value*>::iterator I = ValueMap.begin(), - E = ValueMap.end(); I != E; ++I) - NewToOldValueMap.insert(std::make_pair(I->second, I->first)); - return FI.Clone = New; -} - -// SetupGlobalPools - Create global pools for all DSNodes in the globals graph -// which contain heap objects. If a global variable points to a piece of memory -// allocated from the heap, this pool gets a global lifetime. This is -// implemented by making the pool descriptor be a global variable of it's own, -// and initializing the pool on entrance to main. Note that we never destroy -// the pool, because it has global lifetime. -// -// This method returns true if correct pool allocation of the module cannot be -// performed because there is no main function for the module and there are -// global pools. -// -bool PoolAllocate::SetupGlobalPools(Module &M) { - // Get the globals graph for the program. - DSGraph &GG = ECGraphs->getGlobalsGraph(); - - // Get all of the nodes reachable from globals. - hash_set<const DSNode*> GlobalHeapNodes; - GetNodesReachableFromGlobals(GG, GlobalHeapNodes); - - // Filter out all nodes which have no heap allocations merged into them. - for (hash_set<const DSNode*>::iterator I = GlobalHeapNodes.begin(), - E = GlobalHeapNodes.end(); I != E; ) { - hash_set<const DSNode*>::iterator Last = I++; -#ifndef SAFECODE -#ifndef BOUNDS_CHECK - // if (!(*Last)->isHeapNode()); - // GlobalHeapNodes.erase(Last); -#endif -#endif - const DSNode *tmp = *Last; - // std::cerr << "test \n"; - if (!(tmp->isHeapNode() || tmp->isArray())) - GlobalHeapNodes.erase(Last); - } - - // Otherwise get the main function to insert the poolinit calls. - Function *MainFunc = M.getMainFunction(); - if (MainFunc == 0 || MainFunc->isExternal()) { - std::cerr << "Cannot pool allocate this program: it has global " - << "pools but no 'main' function yet!\n"; - return true; - } - - std::cerr << "Pool allocating " << GlobalHeapNodes.size() - << " global nodes!\n"; - - - std::vector<const DSNode*> NodesToPA(GlobalHeapNodes.begin(), - GlobalHeapNodes.end()); - std::vector<Heuristic::OnePool> ResultPools; - CurHeuristic->AssignToPools(NodesToPA, 0, GG, ResultPools); - - BasicBlock::iterator InsertPt = MainFunc->getEntryBlock().begin(); -#ifndef SAFECODE -#ifndef BOUNDS_CHECK - while (isa<AllocaInst>(InsertPt)) ++InsertPt; -#endif -#endif - // Perform all global assignments as specified. - for (unsigned i = 0, e = ResultPools.size(); i != e; ++i) { - Heuristic::OnePool &Pool = ResultPools[i]; - Value *PoolDesc = Pool.PoolDesc; - if (PoolDesc == 0) { - PoolDesc = CreateGlobalPool(Pool.PoolSize, Pool.PoolAlignment, InsertPt); - - if (Pool.NodesInPool.size() == 1 && - !Pool.NodesInPool[0]->isNodeCompletelyFolded()) - ++NumTSPools; - } - for (unsigned N = 0, e = Pool.NodesInPool.size(); N != e; ++N) { - GlobalNodes[Pool.NodesInPool[N]] = PoolDesc; - GlobalHeapNodes.erase(Pool.NodesInPool[N]); // Handled! - } - } - - // Any unallocated DSNodes get null pool descriptor pointers. - for (hash_set<const DSNode*>::iterator I = GlobalHeapNodes.begin(), - E = GlobalHeapNodes.end(); I != E; ++I) { - GlobalNodes[*I] = Constant::getNullValue(PointerType::get(PoolDescType)); - ++NumNonprofit; - } - - return false; -} - -/// CreateGlobalPool - Create a global pool descriptor object, and insert a -/// poolinit for it into main. IPHint is an instruction that we should insert -/// the poolinit before if not null. -GlobalVariable *PoolAllocate::CreateGlobalPool(unsigned RecSize, unsigned Align, - Instruction *IPHint) { - GlobalVariable *GV = - new GlobalVariable(PoolDescType, false, GlobalValue::InternalLinkage, - Constant::getNullValue(PoolDescType), "GlobalPool", - CurModule); - - // Update the global DSGraph to include this. - DSNode *GNode = ECGraphs->getGlobalsGraph().addObjectToGraph(GV); - GNode->setModifiedMarker()->setReadMarker(); - - Function *MainFunc = CurModule->getMainFunction(); - assert(MainFunc && "No main in program??"); - - BasicBlock::iterator InsertPt; - if (IPHint) - InsertPt = IPHint; - else { - InsertPt = MainFunc->getEntryBlock().begin(); - while (isa<AllocaInst>(InsertPt)) ++InsertPt; - } - - Value *ElSize = ConstantUInt::get(Type::UIntTy, RecSize); - Value *AlignV = ConstantUInt::get(Type::UIntTy, Align); - new CallInst(PoolInit, make_vector((Value*)GV, ElSize, AlignV, 0), - "", InsertPt); - ++NumPools; - return GV; -} - - -// CreatePools - This creates the pool initialization and destruction code for -// the DSNodes specified by the NodesToPA list. This adds an entry to the -// PoolDescriptors map for each DSNode. -// -void PoolAllocate::CreatePools(Function &F, DSGraph &DSG, - const std::vector<const DSNode*> &NodesToPA, - std::map<const DSNode*, - Value*> &PoolDescriptors) { - if (NodesToPA.empty()) return; - TIME_REGION(X, "CreatePools"); - - std::vector<Heuristic::OnePool> ResultPools; - CurHeuristic->AssignToPools(NodesToPA, &F, *NodesToPA[0]->getParentGraph(), - ResultPools); - - std::set<const DSNode*> UnallocatedNodes(NodesToPA.begin(), NodesToPA.end()); - - BasicBlock::iterator InsertPoint = F.front().begin(); -#ifndef SAFECODE -#ifndef BOUNDS_CHECK - while (isa<AllocaInst>(InsertPoint)) ++InsertPoint; -#endif -#endif - // Is this main? If so, make the pool descriptors globals, not automatic - // vars. - bool IsMain = F.getName() == "main" && F.hasExternalLinkage(); - - // Perform all global assignments as specified. - for (unsigned i = 0, e = ResultPools.size(); i != e; ++i) { - Heuristic::OnePool &Pool = ResultPools[i]; - Value *PoolDesc = Pool.PoolDesc; - if (PoolDesc == 0) { - // Create a pool descriptor for the pool. The poolinit will be inserted - // later. - if (!IsMain) { - PoolDesc = new AllocaInst(PoolDescType, 0, "PD", InsertPoint); - - // Create a node in DSG to represent the new alloca. - DSNode *NewNode = DSG.addObjectToGraph(PoolDesc); - NewNode->setModifiedMarker()->setReadMarker(); // This is M/R - } else { - PoolDesc = CreateGlobalPool(Pool.PoolSize, Pool.PoolAlignment, - InsertPoint); - - // Add the global node to main's graph. - DSNode *NewNode = DSG.addObjectToGraph(PoolDesc); - NewNode->setModifiedMarker()->setReadMarker(); // This is M/R - - if (Pool.NodesInPool.size() == 1 && - !Pool.NodesInPool[0]->isNodeCompletelyFolded()) - ++NumTSPools; - } - } - for (unsigned N = 0, e = Pool.NodesInPool.size(); N != e; ++N) { - PoolDescriptors[Pool.NodesInPool[N]] = PoolDesc; - UnallocatedNodes.erase(Pool.NodesInPool[N]); // Handled! - } - } - - // Any unallocated DSNodes get null pool descriptor pointers. - for (std::set<const DSNode*>::iterator I = UnallocatedNodes.begin(), - E = UnallocatedNodes.end(); I != E; ++I) { - PoolDescriptors[*I] =Constant::getNullValue(PointerType::get(PoolDescType)); - ++NumNonprofit; - } -} - -// processFunction - Pool allocate any data structures which are contained in -// the specified function. -// -void PoolAllocate::ProcessFunctionBody(Function &F, Function &NewF) { - DSGraph &G = ECGraphs->getDSGraph(F); - - if (G.node_begin() == G.node_end()) return; // Quick exit if nothing to do. - - FuncInfo &FI = *getFuncInfo(F); - hash_set<const DSNode*> &MarkedNodes = FI.MarkedNodes; - - // Calculate which DSNodes are reachable from globals. If a node is reachable - // from a global, we will create a global pool for it, so no argument passage - // is required. - DSGraph &GG = ECGraphs->getGlobalsGraph(); - - // Map all node reachable from this global to the corresponding nodes in - // the globals graph. - DSGraph::NodeMapTy GlobalsGraphNodeMapping; - G.computeGToGGMapping(GlobalsGraphNodeMapping); - - // Loop over all of the nodes which are non-escaping, adding pool-allocatable - // ones to the NodesToPA vector. - for (DSGraph::node_iterator I = G.node_begin(), E = G.node_end(); I != E;++I){ - // We only need to make a pool if there is a heap object in it... - DSNode *N = I; - if ( -#ifdef BOUNDS_CHECK - (N->isArray() || -#endif - (N->isHeapNode())) - if (GlobalsGraphNodeMapping.count(N)) { - // If it is a global pool, set up the pool descriptor appropriately. - DSNode *GGN = GlobalsGraphNodeMapping[N].getNode(); - assert(GGN && GlobalNodes[GGN] && "No global node found??"); - FI.PoolDescriptors[N] = GlobalNodes[GGN]; - } else if (!MarkedNodes.count(N)) { - // Otherwise, if it was not passed in from outside the function, it must - // be a local pool! - assert(!N->isGlobalNode() && "Should be in global mapping!"); - FI.NodesToPA.push_back(N); - } - } - - if (!FI.NodesToPA.empty()) { - std::cerr << "[" << F.getName() << "] " << FI.NodesToPA.size() - << " nodes pool allocatable\n"; - CreatePools(NewF, G, FI.NodesToPA, FI.PoolDescriptors); - } else { - DEBUG(std::cerr << "[" << F.getName() << "] transforming body.\n"); - } - - // Transform the body of the function now... collecting information about uses - // of the pools. - std::multimap<AllocaInst*, Instruction*> PoolUses; - std::multimap<AllocaInst*, CallInst*> PoolFrees; - TransformBody(G, FI, PoolUses, PoolFrees, NewF); - - // Create pool construction/destruction code - if (!FI.NodesToPA.empty()) - InitializeAndDestroyPools(NewF, FI.NodesToPA, FI.PoolDescriptors, - PoolUses, PoolFrees); - CurHeuristic->HackFunctionBody(NewF, FI.PoolDescriptors); -} - -template<class IteratorTy> -static void AllOrNoneInSet(IteratorTy S, IteratorTy E, - std::set<BasicBlock*> &Blocks, bool &AllIn, - bool &NoneIn) { - AllIn = true; - NoneIn = true; - for (; S != E; ++S) - if (Blocks.count(*S)) - NoneIn = false; - else - AllIn = false; -} - -static void DeleteIfIsPoolFree(Instruction *I, AllocaInst *PD, - std::multimap<AllocaInst*, CallInst*> &PoolFrees) { - std::multimap<AllocaInst*, CallInst*>::iterator PFI, PFE; - if (CallInst *CI = dyn_cast<CallInst>(I)) - for (tie(PFI,PFE) = PoolFrees.equal_range(PD); PFI != PFE; ++PFI) - if (PFI->second == I) { - PoolFrees.erase(PFI); - I->eraseFromParent(); - ++NumPoolFree; - return; - } -} - -void PoolAllocate::CalculateLivePoolFreeBlocks(std::set<BasicBlock*>&LiveBlocks, - Value *PD) { - for (Value::use_iterator I = PD->use_begin(), E = PD->use_end(); I != E; ++I){ - // The only users of the pool should be call & invoke instructions. - CallSite U = CallSite::get(*I); - if (U.getCalledValue() != PoolFree && U.getCalledValue() != PoolDestroy) { - // This block and every block that can reach this block must keep pool - // frees. - for (idf_ext_iterator<BasicBlock*, std::set<BasicBlock*> > - DI = idf_ext_begin(U.getInstruction()->getParent(), LiveBlocks), - DE = idf_ext_end(U.getInstruction()->getParent(), LiveBlocks); - DI != DE; ++DI) - /* empty */; - } - } -} - -/// InitializeAndDestroyPools- This inserts calls to poolinit and pooldestroy -/// into the function to initialize and destroy one pool. -/// -void PoolAllocate::InitializeAndDestroyPool(Function &F, const DSNode *Node, - std::map<const DSNode*, Value*> &PoolDescriptors, - std::multimap<AllocaInst*, Instruction*> &PoolUses, - std::multimap<AllocaInst*, CallInst*> &PoolFrees) { - AllocaInst *PD = cast<AllocaInst>(PoolDescriptors[Node]); - - // Convert the PoolUses/PoolFrees sets into something specific to this pool: a - // set of which blocks are immediately using the pool. - std::set<BasicBlock*> UsingBlocks; - - std::multimap<AllocaInst*, Instruction*>::iterator PUI, PUE; - tie(PUI, PUE) = PoolUses.equal_range(PD); - for (; PUI != PUE; ++PUI) - UsingBlocks.insert(PUI->second->getParent()); - - // To calculate all of the basic blocks which require the pool to be - // initialized before, do a depth first search on the CFG from the using - // blocks. - std::set<BasicBlock*> InitializedBefore; - std::set<BasicBlock*> DestroyedAfter; - for (std::set<BasicBlock*>::iterator I = UsingBlocks.begin(), - E = UsingBlocks.end(); I != E; ++I) { - for (df_ext_iterator<BasicBlock*, std::set<BasicBlock*> > - DI = df_ext_begin(*I, InitializedBefore), - DE = df_ext_end(*I, InitializedBefore); DI != DE; ++DI) - /* empty */; - - for (idf_ext_iterator<BasicBlock*, std::set<BasicBlock*> > - DI = idf_ext_begin(*I, DestroyedAfter), - DE = idf_ext_end(*I, DestroyedAfter); DI != DE; ++DI) - /* empty */; - } - // Now that we have created the sets, intersect them. - std::set<BasicBlock*> LiveBlocks; - std::set_intersection(InitializedBefore.begin(),InitializedBefore.end(), - DestroyedAfter.begin(), DestroyedAfter.end(), - std::inserter(LiveBlocks, LiveBlocks.end())); - InitializedBefore.clear(); - DestroyedAfter.clear(); - - DEBUG(std::cerr << "POOL: " << PD->getName() << " information:\n"); - DEBUG(std::cerr << " Live in blocks: "); - DEBUG(for (std::set<BasicBlock*>::iterator I = LiveBlocks.begin(), - E = LiveBlocks.end(); I != E; ++I) - std::cerr << (*I)->getName() << " "); - DEBUG(std::cerr << "\n"); - - - std::vector<Instruction*> PoolInitPoints; - std::vector<Instruction*> PoolDestroyPoints; - - if (DisableInitDestroyOpt) { - // Insert poolinit calls after all of the allocas... - Instruction *InsertPoint; - for (BasicBlock::iterator I = F.front().begin(); - isa<AllocaInst>(InsertPoint = I); ++I) - /*empty*/; - PoolInitPoints.push_back(InsertPoint); - - if (F.getName() != "main") - for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) - if (isa<ReturnInst>(BB->getTerminator()) || - isa<UnwindInst>(BB->getTerminator())) - PoolDestroyPoints.push_back(BB->getTerminator()); - } else { - // Keep track of the blocks we have inserted poolinit/destroy into. - std::set<BasicBlock*> PoolInitInsertedBlocks, PoolDestroyInsertedBlocks; - - for (std::set<BasicBlock*>::iterator I = LiveBlocks.begin(), - E = LiveBlocks.end(); I != E; ++I) { - BasicBlock *BB = *I; - TerminatorInst *Term = BB->getTerminator(); - - // Check the predecessors of this block. If any preds are not in the - // set, or if there are no preds, insert a pool init. - bool AllIn, NoneIn; - AllOrNoneInSet(pred_begin(BB), pred_end(BB), LiveBlocks, AllIn, - NoneIn); - - if (NoneIn) { - if (!PoolInitInsertedBlocks.count(BB)) { - BasicBlock::iterator It = BB->begin(); - while (isa<AllocaInst>(It) || isa<PHINode>(It)) ++It; -#if 0 - // Move through all of the instructions not in the pool - while (!PoolUses.count(std::make_pair(PD, It))) - // Advance past non-users deleting any pool frees that we run - // across. - DeleteIfIsPoolFree(It++, PD, PoolFrees); -#endif - PoolInitPoints.push_back(It); - PoolInitInsertedBlocks.insert(BB); - } - } else if (!AllIn) { - TryAgainPred: - for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; - ++PI) - if (!LiveBlocks.count(*PI) && !PoolInitInsertedBlocks.count(*PI)){ - if (SplitCriticalEdge(BB, PI)) - // If the critical edge was split, *PI was invalidated - goto TryAgainPred; - - // Insert at the end of the predecessor, before the terminator. - PoolInitPoints.push_back((*PI)->getTerminator()); - PoolInitInsertedBlocks.insert(*PI); - } - } - // Check the successors of this block. If some succs are not in the - // set, insert destroys on those successor edges. If all succs are - // not in the set, insert a destroy in this block. - AllOrNoneInSet(succ_begin(BB), succ_end(BB), LiveBlocks, - AllIn, NoneIn); - - if (NoneIn) { - // Insert before the terminator. - if (!PoolDestroyInsertedBlocks.count(BB)) { - BasicBlock::iterator It = Term; - - // Rewind to the first using instruction. -#if 0 - while (!PoolUses.count(std::make_pair(PD, It))) - DeleteIfIsPoolFree(It--, PD, PoolFrees); - ++It; -#endif - - // Insert after the first using instruction - PoolDestroyPoints.push_back(It); - PoolDestroyInsertedBlocks.insert(BB); - } - } else if (!AllIn) { - for (succ_iterator SI = succ_begin(BB), E = succ_end(BB); - SI != E; ++SI) - if (!LiveBlocks.count(*SI) && - !PoolDestroyInsertedBlocks.count(*SI)) { - // If this edge is critical, split it. - SplitCriticalEdge(BB, SI); - - // Insert at entry to the successor, but after any PHI nodes. - BasicBlock::iterator It = (*SI)->begin(); - while (isa<PHINode>(It)) ++It; - PoolDestroyPoints.push_back(It); - PoolDestroyInsertedBlocks.insert(*SI); - } - } - } - } - - DEBUG(std::cerr << " Init in blocks: "); - - // Insert the calls to initialize the pool. - unsigned ElSizeV = Heuristic::getRecommendedSize(Node); - Value *ElSize = ConstantUInt::get(Type::UIntTy, ElSizeV); - unsigned AlignV = Heuristic::getRecommendedAlignment(Node); - Value *Align = ConstantUInt::get(Type::UIntTy, AlignV); - - for (unsigned i = 0, e = PoolInitPoints.size(); i != e; ++i) { - new CallInst(PoolInit, make_vector((Value*)PD, ElSize, Align, 0), - "", PoolInitPoints[i]); - DEBUG(std::cerr << PoolInitPoints[i]->getParent()->getName() << " "); - } - - DEBUG(std::cerr << "\n Destroy in blocks: "); - - // Loop over all of the places to insert pooldestroy's... - for (unsigned i = 0, e = PoolDestroyPoints.size(); i != e; ++i) { - // Insert the pooldestroy call for this pool. - new CallInst(PoolDestroy, make_vector((Value*)PD, 0), "", - PoolDestroyPoints[i]); - DEBUG(std::cerr << PoolDestroyPoints[i]->getParent()->getName()<<" "); - } - DEBUG(std::cerr << "\n\n"); - - // We are allowed to delete any poolfree's which occur between the last - // call to poolalloc, and the call to pooldestroy. Figure out which - // basic blocks have this property for this pool. - std::set<BasicBlock*> PoolFreeLiveBlocks; - if (!DisablePoolFreeOpt) - CalculateLivePoolFreeBlocks(PoolFreeLiveBlocks, PD); - else - PoolFreeLiveBlocks = LiveBlocks; - - // Delete any pool frees which are not in live blocks, for correctness. - std::multimap<AllocaInst*, CallInst*>::iterator PFI, PFE; - for (tie(PFI,PFE) = PoolFrees.equal_range(PD); PFI != PFE; ) { - CallInst *PoolFree = (PFI++)->second; - if (!LiveBlocks.count(PoolFree->getParent()) || - !PoolFreeLiveBlocks.count(PoolFree->getParent())) - DeleteIfIsPoolFree(PoolFree, PD, PoolFrees); - } -} - - -/// InitializeAndDestroyPools - This inserts calls to poolinit and pooldestroy -/// into the function to initialize and destroy the pools in the NodesToPA list. -/// -void PoolAllocate::InitializeAndDestroyPools(Function &F, - const std::vector<const DSNode*> &NodesToPA, - std::map<const DSNode*, Value*> &PoolDescriptors, - std::multimap<AllocaInst*, Instruction*> &PoolUses, - std::multimap<AllocaInst*, CallInst*> &PoolFrees) { - std::set<AllocaInst*> AllocasHandled; - - // Insert all of the poolinit/destroy calls into the function. - for (unsigned i = 0, e = NodesToPA.size(); i != e; ++i) { - const DSNode *Node = NodesToPA[i]; - - if (isa<GlobalVariable>(PoolDescriptors[Node]) || - isa<ConstantPointerNull>(PoolDescriptors[Node])) - continue; - - assert(isa<AllocaInst>(PoolDescriptors[Node]) && "Why pool allocate this?"); - AllocaInst *PD = cast<AllocaInst>(PoolDescriptors[Node]); - - // FIXME: Turn this into an assert and fix the problem!! - //assert(PoolUses.count(PD) && "Pool is not used, but is marked heap?!"); - if (!PoolUses.count(PD) && !PoolFrees.count(PD)) continue; - if (!AllocasHandled.insert(PD).second) continue; - - ++NumPools; - if (!Node->isNodeCompletelyFolded()) - ++NumTSPools; - - InitializeAndDestroyPool(F, Node, PoolDescriptors, PoolUses, PoolFrees); - } -}
diff --git a/poolalloc/lib/PoolAllocate/PoolAllocate.h b/poolalloc/lib/PoolAllocate/PoolAllocate.h deleted file mode 100644 index c33ab54..0000000 --- a/poolalloc/lib/PoolAllocate/PoolAllocate.h +++ /dev/null
@@ -1,295 +0,0 @@ -//===-- PoolAllocate.h - Pool allocation pass -------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This transform changes programs so that disjoint data structures are -// allocated out of different pools of memory, increasing locality. This header -// file exposes information about the pool allocation itself so that follow-on -// passes may extend or use the pool allocation for analysis. -// -//===----------------------------------------------------------------------===// - -#ifndef POOLALLOCATE_H -#define POOLALLOCATE_H -//#define SAFECODE 1 -//#define BOUNDS_CHECK 1 -//comment the above two for normal poolallocation -#include "llvm/Pass.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Support/CallSite.h" -#include "llvm/ADT/EquivalenceClasses.h" -#include "llvm/ADT/VectorExtras.h" -#include "llvm/ADT/hash_set" - -#ifdef SAFECODE -//FIXME : make this use some configuration options -#include "/home/vadve/dhurjati/llvm/projects/safecode.typesafe/include/ConvertUnsafeAllocas.h" -#endif - - -#include <set> - -namespace llvm { -#ifdef SAFECODE - using namespace CUA; -#endif -class DSNode; -class DSGraph; -class Type; -class AllocaInst; -class EquivClassGraphs; -class CallTargetFinder; - -namespace PA { - - class Heuristic; - - /// FuncInfo - Represent the pool allocation information for one function in - /// the program. Note that many functions must actually be cloned in order - /// for pool allocation to add arguments to the function signature. In this - /// case, the Clone and NewToOldValueMap information identify how the clone - /// maps to the original function... - /// - struct FuncInfo { - FuncInfo(Function &f) : F(f), Clone(0) {} - - /// MarkedNodes - The set of nodes which are not locally pool allocatable in - /// the current function. - /// - hash_set<const DSNode*> MarkedNodes; - - /// F - The function this FuncInfo corresponds to. - /// - Function &F; - - /// Clone - The cloned version of the function, if applicable. - /// - Function *Clone; - - /// ArgNodes - The list of DSNodes which have pools passed in as arguments. - /// - std::vector<const DSNode*> ArgNodes; - - /// NodesToPA - The list of nodes which are to be pool allocated locally in - /// this function. This only includes heap nodes. - std::vector<const DSNode*> NodesToPA; - - /// PoolDescriptors - The Value* which defines the pool descriptor for this - /// DSNode. Note: This does not necessarily include pool arguments that are - /// passed in because of indirect function calls that are not used in the - /// function. - std::map<const DSNode*, Value*> PoolDescriptors; - -#ifdef SAFECODE - //This is a map from Old to New Value Map reverse of the one above - //Useful in SAFECode for check insertion - std::map<const Value*, Value*> ValueMap; -#endif - - /// NewToOldValueMap - When and if a function needs to be cloned, this map - /// contains a mapping from all of the values in the new function back to - /// the values they correspond to in the old function. - /// - typedef std::map<Value*, const Value*> NewToOldValueMapTy; - NewToOldValueMapTy NewToOldValueMap; - - /// MapValueToOriginal - Given a value in the cloned version of this - /// function, map it back to the original. If the specified value did not - /// exist in the original function (e.g. because it's a pool descriptor), - /// return null. - Value *MapValueToOriginal(Value *V) const { - NewToOldValueMapTy::const_iterator I = NewToOldValueMap.find(V); - return I != NewToOldValueMap.end() ? const_cast<Value*>(I->second) : 0; - } - }; - -} // end PA namespace - - - -/// PoolAllocate - The main pool allocation pass -/// -class PoolAllocate : public ModulePass { - /// PassAllArguments - If set to true, we should pass pool descriptor - /// arguments into any function that loads or stores to a pool, in addition to - /// those functions that allocate or deallocate. See also the - /// PoolAllocatePassAllPools pass below. - bool PassAllArguments; - - Module *CurModule; - EquivClassGraphs *ECGraphs; - CallTargetFinder* CTF; - - std::map<Function*, PA::FuncInfo> FunctionInfo; - std::map<Function*, Function*> CloneToOrigMap; -public: - -#ifdef SAFECODE - ConvertUnsafeAllocas *CUAPass; -#endif - Function *PoolInit, *PoolDestroy, *PoolAlloc, *PoolRealloc, *PoolMemAlign; - Function *PoolFree; -#ifdef SAFECODE - Function *PoolRegister; -#endif -#ifdef BOUNDS_CHECK - Function *PoolRegister; -#endif - - static const Type *PoolDescPtrTy; - - PA::Heuristic *CurHeuristic; - - /// GlobalNodes - For each node (with an H marker) in the globals graph, this - /// map contains the global variable that holds the pool descriptor for the - /// node. - std::map<const DSNode*, Value*> GlobalNodes; - - public: -#ifdef SAFECODE - PoolAllocate(bool passAllArguments = true) - : PassAllArguments(passAllArguments) {} -#else - PoolAllocate(bool passAllArguments = false) - : PassAllArguments(passAllArguments) {} -#endif - bool runOnModule(Module &M); - - virtual void getAnalysisUsage(AnalysisUsage &AU) const; - - EquivClassGraphs &getECGraphs() const { return *ECGraphs; } - - /// getOrigFunctionFromClone - Given a pointer to a function that was cloned - /// from another function, return the original function. If the argument - /// function is not a clone, return null. - Function *getOrigFunctionFromClone(Function *F) const { - std::map<Function*, Function*>::const_iterator I = CloneToOrigMap.find(F); - return I != CloneToOrigMap.end() ? I->second : 0; - } - - /// getFuncInfo - Return the FuncInfo object for the specified function. - /// - PA::FuncInfo *getFuncInfo(Function &F) { - std::map<Function*, PA::FuncInfo>::iterator I = FunctionInfo.find(&F); - return I != FunctionInfo.end() ? &I->second : 0; - } - - /// getFuncInfoOrClone - Return the function info object for for the specified - /// function. If this function is a clone of another function, return the - /// function info object for the original function. - PA::FuncInfo *getFuncInfoOrClone(Function &F) { - // If it is cloned or not check it out. - if (PA::FuncInfo *FI = getFuncInfo(F)) - return FI; - // Maybe this is a function clone? - if (Function *FC = getOrigFunctionFromClone(&F)) - return getFuncInfo(*FC); - return 0; - } - - - /// releaseMemory - When the pool allocator is no longer used, release - /// resources used by it. - virtual void releaseMemory() { - FunctionInfo.clear(); - GlobalNodes.clear(); - CloneToOrigMap.clear(); - } - - - Module *getCurModule() { return CurModule; } - - /// CreateGlobalPool - Create a global pool descriptor, initialize it in main, - /// and return a pointer to the global for it. - GlobalVariable *CreateGlobalPool(unsigned RecSize, unsigned Alignment, - Instruction *IPHint = 0); - - private: - - /// AddPoolPrototypes - Add prototypes for the pool functions to the - /// specified module and update the Pool* instance variables to point to - /// them. - /// - void AddPoolPrototypes(); - - /// MicroOptimizePoolCalls - Apply any microoptimizations to calls to pool - /// allocation function calls that we can. - void MicroOptimizePoolCalls(); - - /// BuildIndirectFunctionSets - Iterate over the module looking for indirect - /// calls to functions - void BuildIndirectFunctionSets(Module &M); - - /// SetupGlobalPools - Create global pools for all DSNodes in the globals - /// graph which contain heap objects. If a global variable points to a piece - /// of memory allocated from the heap, this pool gets a global lifetime. - /// - /// This method returns true if correct pool allocation of the module cannot - /// be performed because there is no main function for the module and there - /// are global pools. - bool SetupGlobalPools(Module &M); - - /// FindFunctionPoolArgs - In the first pass over the program, we decide which - /// arguments will have to be added for each function, build the FunctionInfo - /// map and recording this info in the ArgNodes set. - void FindFunctionPoolArgs(Function &F); - - /// MakeFunctionClone - If the specified function needs to be modified for - /// pool allocation support, make a clone of it, adding additional arguments - /// as neccesary, and return it. If not, just return null. - /// - Function *MakeFunctionClone(Function &F); - - /// ProcessFunctionBody - Rewrite the body of a transformed function to use - /// pool allocation where appropriate. - /// - void ProcessFunctionBody(Function &Old, Function &New); - - /// CreatePools - This inserts alloca instruction in the function for all - /// pools specified in the NodesToPA list. This adds an entry to the - /// PoolDescriptors map for each DSNode. - /// - void CreatePools(Function &F, DSGraph &G, - const std::vector<const DSNode*> &NodesToPA, - std::map<const DSNode*, Value*> &PoolDescriptors); - - void TransformBody(DSGraph &g, PA::FuncInfo &fi, - std::multimap<AllocaInst*, Instruction*> &poolUses, - std::multimap<AllocaInst*, CallInst*> &poolFrees, - Function &F); - - /// InitializeAndDestroyPools - This inserts calls to poolinit and pooldestroy - /// into the function to initialize and destroy the pools in the NodesToPA - /// list. - void InitializeAndDestroyPools(Function &F, - const std::vector<const DSNode*> &NodesToPA, - std::map<const DSNode*, Value*> &PoolDescriptors, - std::multimap<AllocaInst*, Instruction*> &PoolUses, - std::multimap<AllocaInst*, CallInst*> &PoolFrees); - - void InitializeAndDestroyPool(Function &F, const DSNode *Pool, - std::map<const DSNode*, Value*> &PoolDescriptors, - std::multimap<AllocaInst*, Instruction*> &PoolUses, - std::multimap<AllocaInst*, CallInst*> &PoolFrees); - - void CalculateLivePoolFreeBlocks(std::set<BasicBlock*> &LiveBlocks,Value *PD); -}; - - -/// PoolAllocatePassAllPools - This class is the same as the pool allocator, -/// except that it passes pool descriptors into functions that do not do -/// allocations or deallocations. This is needed by the pointer compression -/// pass, which requires a pool descriptor to be available for a pool if any -/// load or store to that pool is performed. -struct PoolAllocatePassAllPools : public PoolAllocate { - PoolAllocatePassAllPools() : PoolAllocate(true) {} -}; - -} - -#endif
diff --git a/poolalloc/lib/PoolAllocate/PoolOptimize.cpp b/poolalloc/lib/PoolAllocate/PoolOptimize.cpp deleted file mode 100644 index 388e6a1..0000000 --- a/poolalloc/lib/PoolAllocate/PoolOptimize.cpp +++ /dev/null
@@ -1,242 +0,0 @@ -//===-- PoolOptimize.cpp - Optimize pool allocated program ----------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This simple pass optimizes a program that has been through pool allocation. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Constants.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Instructions.h" -#include "llvm/Pass.h" -#include "llvm/Module.h" -#include "llvm/ADT/Statistic.h" -using namespace llvm; - -namespace { - Statistic<> NumBumpPtr("poolalloc", "Number of bump pointer pools"); - - struct PoolOptimize : public ModulePass { - bool runOnModule(Module &M); - }; - - RegisterOpt<PoolOptimize> - X("pooloptimize", "Optimize a pool allocated program"); -} - -static void getCallsOf(Function *F, std::vector<CallInst*> &Calls) { - Calls.clear(); - for (Value::use_iterator UI = F->use_begin(), E = F->use_end(); UI != E; ++UI) - Calls.push_back(cast<CallInst>(*UI)); -} - -bool PoolOptimize::runOnModule(Module &M) { - const Type *VoidPtrTy = PointerType::get(Type::SByteTy); - const Type *PoolDescPtrTy = PointerType::get(ArrayType::get(VoidPtrTy, 16)); - - - // Get poolinit function. - Function *PoolInit = M.getOrInsertFunction("poolinit", Type::VoidTy, - PoolDescPtrTy, Type::UIntTy, - Type::UIntTy, NULL); - - // Get pooldestroy function. - Function *PoolDestroy = M.getOrInsertFunction("pooldestroy", Type::VoidTy, - PoolDescPtrTy, NULL); - - // The poolalloc function. - Function *PoolAlloc = M.getOrInsertFunction("poolalloc", - VoidPtrTy, PoolDescPtrTy, - Type::UIntTy, NULL); - - // The poolrealloc function. - Function *PoolRealloc = M.getOrInsertFunction("poolrealloc", - VoidPtrTy, PoolDescPtrTy, - VoidPtrTy, Type::UIntTy, NULL); - // The poolmemalign function. - Function *PoolMemAlign = M.getOrInsertFunction("poolmemalign", - VoidPtrTy, PoolDescPtrTy, - Type::UIntTy, Type::UIntTy, - NULL); - - // Get the poolfree function. - Function *PoolFree = M.getOrInsertFunction("poolfree", Type::VoidTy, - PoolDescPtrTy, VoidPtrTy, NULL); - - - // Get poolinit_bp function. - Function *PoolInitBP = M.getOrInsertFunction("poolinit_bp", Type::VoidTy, - PoolDescPtrTy, Type::UIntTy, - NULL); - - // Get pooldestroy_bp function. - Function *PoolDestroyBP = M.getOrInsertFunction("pooldestroy_bp",Type::VoidTy, - PoolDescPtrTy, NULL); - - // The poolalloc_bp function. - Function *PoolAllocBP = M.getOrInsertFunction("poolalloc_bp", - VoidPtrTy, PoolDescPtrTy, - Type::UIntTy, NULL); - - Function *Realloc = M.getOrInsertFunction("realloc", - VoidPtrTy, VoidPtrTy, Type::UIntTy, - NULL); - Function *MemAlign = M.getOrInsertFunction("memalign", - VoidPtrTy, Type::UIntTy, - Type::UIntTy, NULL); - - - // Optimize poolreallocs - std::vector<CallInst*> Calls; - getCallsOf(PoolRealloc, Calls); - for (unsigned i = 0, e = Calls.size(); i != e; ++i) { - CallInst *CI = Calls[i]; - // poolrealloc(PD, null, X) -> poolalloc(PD, X) - if (isa<ConstantPointerNull>(CI->getOperand(2))) { - std::vector<Value*> Ops; - Ops.push_back(CI->getOperand(1)); - Ops.push_back(CI->getOperand(3)); - Value *New = new CallInst(PoolAlloc, Ops, CI->getName(), CI); - CI->replaceAllUsesWith(New); - CI->eraseFromParent(); - } else if (isa<Constant>(CI->getOperand(3)) && - cast<Constant>(CI->getOperand(3))->isNullValue()) { - // poolrealloc(PD, X, 0) -> poolfree(PD, X) - std::vector<Value*> Ops; - Ops.push_back(CI->getOperand(1)); - Ops.push_back(CI->getOperand(2)); - new CallInst(PoolFree, Ops, "", CI); - CI->replaceAllUsesWith(Constant::getNullValue(CI->getType())); - CI->eraseFromParent(); - } else if (isa<ConstantPointerNull>(CI->getOperand(1))) { - // poolrealloc(null, X, Y) -> realloc(X, Y) - std::vector<Value*> Ops; - Ops.push_back(CI->getOperand(2)); - Ops.push_back(CI->getOperand(3)); - Value *New = new CallInst(Realloc, Ops, CI->getName(), CI); - CI->replaceAllUsesWith(New); - CI->eraseFromParent(); - } - } - - // Optimize poolallocs - getCallsOf(PoolAlloc, Calls); - for (unsigned i = 0, e = Calls.size(); i != e; ++i) { - CallInst *CI = Calls[i]; - // poolalloc(null, X) -> malloc(X) - if (isa<Constant>(CI->getOperand(1)) && - cast<Constant>(CI->getOperand(1))->isNullValue()) { - Value *New = new MallocInst(Type::SByteTy, CI->getOperand(2), - CI->getName(), CI); - CI->replaceAllUsesWith(New); - CI->eraseFromParent(); - } - } - - // Optimize poolmemaligns - getCallsOf(PoolMemAlign, Calls); - for (unsigned i = 0, e = Calls.size(); i != e; ++i) { - CallInst *CI = Calls[i]; - // poolmemalign(null, X, Y) -> memalign(X, Y) - if (isa<ConstantPointerNull>(CI->getOperand(1))) { - std::vector<Value*> Ops; - Ops.push_back(CI->getOperand(2)); - Ops.push_back(CI->getOperand(3)); - Value *New = new CallInst(MemAlign, Ops, CI->getName(), CI); - CI->replaceAllUsesWith(New); - CI->eraseFromParent(); - } - } - - // Optimize poolfrees - getCallsOf(PoolFree, Calls); - for (unsigned i = 0, e = Calls.size(); i != e; ++i) { - CallInst *CI = Calls[i]; - // poolfree(PD, null) -> noop - if (isa<ConstantPointerNull>(CI->getOperand(2))) - CI->eraseFromParent(); - else if (isa<ConstantPointerNull>(CI->getOperand(1))) { - // poolfree(null, Ptr) -> free(Ptr) - new FreeInst(CI->getOperand(2), CI); - CI->eraseFromParent(); - } - } - - // Transform pools that only have poolinit/destroy/allocate uses into - // bump-pointer pools. Also, delete pools that are unused. Find pools by - // looking for pool inits in the program. - getCallsOf(PoolInit, Calls); - std::set<Value*> Pools; - for (unsigned i = 0, e = Calls.size(); i != e; ++i) - Pools.insert(Calls[i]->getOperand(1)); - - // Loop over all of the pools processing each as we find it. - for (std::set<Value*>::iterator PI = Pools.begin(), E = Pools.end(); - PI != E; ++PI) { - bool HasPoolAlloc = false, HasOtherUse = false; - Value *PoolDesc = *PI; - for (Value::use_iterator UI = PoolDesc->use_begin(), - E = PoolDesc->use_end(); UI != E; ++UI) { - if (CallInst *CI = dyn_cast<CallInst>(*UI)) { - if (CI->getCalledFunction() == PoolInit || - CI->getCalledFunction() == PoolDestroy) { - // ignore - } else if (CI->getCalledFunction() == PoolAlloc) { - HasPoolAlloc = true; - } else { - HasOtherUse = true; - break; - } - } else { - HasOtherUse = true; - break; - } - } - - // Can we optimize it? - if (!HasOtherUse) { - // Yes, if there are uses at all, nuke the pool init, destroy, and the PD. - if (!HasPoolAlloc) { - while (!PoolDesc->use_empty()) - cast<Instruction>(PoolDesc->use_back())->eraseFromParent(); - if (AllocaInst *AI = dyn_cast<AllocaInst>(PoolDesc)) - AI->eraseFromParent(); - else - cast<GlobalVariable>(PoolDesc)->eraseFromParent(); - } else { - // Convert all of the pool descriptor users to the BumpPtr flavor. - std::vector<User*> PDUsers(PoolDesc->use_begin(), PoolDesc->use_end()); - - while (!PDUsers.empty()) { - CallInst *CI = cast<CallInst>(PDUsers.back()); - PDUsers.pop_back(); - std::vector<Value*> Args; - if (CI->getCalledFunction() == PoolAlloc) { - Args.assign(CI->op_begin()+1, CI->op_end()); - Value *New = new CallInst(PoolAllocBP, Args, CI->getName(), CI); - CI->replaceAllUsesWith(New); - CI->eraseFromParent(); - } else if (CI->getCalledFunction() == PoolInit) { - Args.assign(CI->op_begin()+1, CI->op_end()); - Args.erase(Args.begin()+1); // Drop the size argument. - Value *New = new CallInst(PoolInitBP, Args, "", CI); - CI->eraseFromParent(); - } else { - assert(CI->getCalledFunction() == PoolDestroy); - Args.assign(CI->op_begin()+1, CI->op_end()); - Value *New = new CallInst(PoolDestroyBP, Args, "", CI); - CI->eraseFromParent(); - } - } - ++NumBumpPtr; - } - } - } - return true; -}
diff --git a/poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp b/poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp deleted file mode 100644 index 53577e9..0000000 --- a/poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp +++ /dev/null
@@ -1,718 +0,0 @@ -//===-- TransformFunctionBody.cpp - Pool Function Transformer -------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the PoolAllocate::TransformBody method. -// -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "PoolAllocator" -#include "PoolAllocate.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Analysis/DataStructure/CallTargets.h" -#include "llvm/Module.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Constants.h" -#include "llvm/Instructions.h" -#include "llvm/Target/TargetData.h" -#include "llvm/Support/InstVisitor.h" -#include "llvm/Support/Debug.h" -#include "llvm/ADT/VectorExtras.h" -#include <iostream> -using namespace llvm; -using namespace PA; - -namespace { - /// FuncTransform - This class implements transformation required of pool - /// allocated functions. - struct FuncTransform : public InstVisitor<FuncTransform> { - PoolAllocate &PAInfo; - DSGraph &G; // The Bottom-up DS Graph - FuncInfo &FI; - CallTargetFinder* CTF; - - // PoolUses - For each pool (identified by the pool descriptor) keep track - // of which blocks require the memory in the pool to not be freed. This - // does not include poolfree's. Note that this is only tracked for pools - // which this is the home of, ie, they are Alloca instructions. - std::multimap<AllocaInst*, Instruction*> &PoolUses; - - // PoolDestroys - For each pool, keep track of the actual poolfree calls - // inserted into the code. This is seperated out from PoolUses. - std::multimap<AllocaInst*, CallInst*> &PoolFrees; - - FuncTransform(PoolAllocate &P, DSGraph &g, FuncInfo &fi, - std::multimap<AllocaInst*, Instruction*> &poolUses, - std::multimap<AllocaInst*, CallInst*> &poolFrees, - CallTargetFinder* ctf) - : PAInfo(P), G(g), FI(fi), CTF(ctf), - PoolUses(poolUses), PoolFrees(poolFrees) { - } - - template <typename InstType, typename SetType> - void AddPoolUse(InstType &I, Value *PoolHandle, SetType &Set) { - if (AllocaInst *AI = dyn_cast<AllocaInst>(PoolHandle)) - Set.insert(std::make_pair(AI, &I)); - } - - void visitInstruction(Instruction &I); - void visitMallocInst(MallocInst &MI); - void visitAllocaInst(AllocaInst &MI); - void visitCallocCall(CallSite CS); - void visitReallocCall(CallSite CS); - void visitMemAlignCall(CallSite CS); - void visitFreeInst(FreeInst &FI); - void visitCallSite(CallSite CS); - void visitCallInst(CallInst &CI) { visitCallSite(&CI); } - void visitInvokeInst(InvokeInst &II) { visitCallSite(&II); } - void visitLoadInst(LoadInst &I); - void visitStoreInst (StoreInst &I); - - private: - Instruction *TransformAllocationInstr(Instruction *I, Value *Size); - Instruction *InsertPoolFreeInstr(Value *V, Instruction *Where); - - void UpdateNewToOldValueMap(Value *OldVal, Value *NewV1, Value *NewV2 = 0) { - std::map<Value*, const Value*>::iterator I = - FI.NewToOldValueMap.find(OldVal); - assert(I != FI.NewToOldValueMap.end() && "OldVal not found in clone?"); - FI.NewToOldValueMap.insert(std::make_pair(NewV1, I->second)); - if (NewV2) - FI.NewToOldValueMap.insert(std::make_pair(NewV2, I->second)); - FI.NewToOldValueMap.erase(I); - } - - Value* getOldValueIfAvailable(Value* V) { - if (!FI.NewToOldValueMap.empty()) { - // If the NewToOldValueMap is in effect, use it. - std::map<Value*,const Value*>::iterator I = FI.NewToOldValueMap.find(V); - if (I != FI.NewToOldValueMap.end()) - V = (Value*)I->second; - } - return V; - } - - DSNodeHandle& getDSNodeHFor(Value *V) { - return G.getScalarMap()[getOldValueIfAvailable(V)]; - } - - Value *getPoolHandle(Value *V) { - DSNode *Node = getDSNodeHFor(V).getNode(); - // Get the pool handle for this DSNode... - std::map<const DSNode*, Value*>::iterator I = - FI.PoolDescriptors.find(Node); - return I != FI.PoolDescriptors.end() ? I->second : 0; - } - - Function* retCloneIfFunc(Value *V); - }; -} - -void PoolAllocate::TransformBody(DSGraph &g, PA::FuncInfo &fi, - std::multimap<AllocaInst*,Instruction*> &poolUses, - std::multimap<AllocaInst*, CallInst*> &poolFrees, - Function &F) { - FuncTransform(*this, g, fi, poolUses, poolFrees, CTF).visit(F); -} - - -// Returns the clone if V is a static function (not a pointer) and belongs -// to an equivalence class i.e. is pool allocated -Function* FuncTransform::retCloneIfFunc(Value *V) { - if (Function *F = dyn_cast<Function>(V)) - if (FuncInfo *FI = PAInfo.getFuncInfo(*F)) - return FI->Clone; - - return 0; -} - -void FuncTransform::visitLoadInst(LoadInst &LI) { - if (Value *PH = getPoolHandle(LI.getOperand(0))) - AddPoolUse(LI, PH, PoolUses); - visitInstruction(LI); -} - -void FuncTransform::visitStoreInst(StoreInst &SI) { - if (Value *PH = getPoolHandle(SI.getOperand(1))) - AddPoolUse(SI, PH, PoolUses); - visitInstruction(SI); -} - -Instruction *FuncTransform::TransformAllocationInstr(Instruction *I, - Value *Size) { - std::string Name = I->getName(); I->setName(""); - - if (Size->getType() != Type::UIntTy) - Size = new CastInst(Size, Type::UIntTy, Size->getName(), I); - - // Insert a call to poolalloc - Value *PH = getPoolHandle(I); - - Instruction *V = new CallInst(PAInfo.PoolAlloc, make_vector(PH, Size, 0), - Name, I); - - AddPoolUse(*V, PH, PoolUses); - - // Cast to the appropriate type if necessary - Instruction *Casted = V; - if (V->getType() != I->getType()) - Casted = new CastInst(V, I->getType(), V->getName(), I); - - // Update def-use info - I->replaceAllUsesWith(Casted); - - // If we are modifying the original function, update the DSGraph. - if (!FI.Clone) { - // V and Casted now point to whatever the original allocation did. - G.getScalarMap().replaceScalar(I, V); - if (V != Casted) - G.getScalarMap()[Casted] = G.getScalarMap()[V]; - } else { // Otherwise, update the NewToOldValueMap - UpdateNewToOldValueMap(I, V, V != Casted ? Casted : 0); - } - - // If this was an invoke, fix up the CFG. - if (InvokeInst *II = dyn_cast<InvokeInst>(I)) { - new BranchInst(II->getNormalDest(), I); - II->getUnwindDest()->removePredecessor(II->getParent(), true); - } - - // Remove old allocation instruction. - I->eraseFromParent(); - return Casted; -} - - -void FuncTransform::visitMallocInst(MallocInst &MI) { - // Get the pool handle for the node that this contributes to... - Value *PH = getPoolHandle(&MI); - - if (PH == 0 || isa<ConstantPointerNull>(PH)) return; - - TargetData &TD = PAInfo.getAnalysis<TargetData>(); - Value *AllocSize = - ConstantUInt::get(Type::UIntTy, TD.getTypeSize(MI.getAllocatedType())); - - if (MI.isArrayAllocation()) - AllocSize = BinaryOperator::create(Instruction::Mul, AllocSize, - MI.getOperand(0), "sizetmp", &MI); -#ifdef SAFECODE - const MallocInst *originalMalloc = &MI; - if (FI.NewToOldValueMap.count(&MI)) { - originalMalloc = cast<MallocInst>(FI.NewToOldValueMap[&MI]); - } - //Dinakar to test stack safety & array safety - if (PAInfo.CUAPass->ArrayMallocs.find(originalMalloc) == - PAInfo.CUAPass->ArrayMallocs.end()) { - TransformAllocationInstr(&MI, AllocSize); - } else { - AllocaInst *AI = new AllocaInst(MI.getType()->getElementType(), MI.getArraySize(), MI.getName(), MI.getNext()); - MI.replaceAllUsesWith(AI); - MI.getParent()->getInstList().erase(&MI); - Value *Casted = AI; - Instruction *aiNext = AI->getNext(); - if (AI->getType() != PointerType::get(Type::SByteTy)) - Casted = new CastInst(AI, PointerType::get(Type::SByteTy), - AI->getName()+".casted",aiNext); - - Instruction *V = new CallInst(PAInfo.PoolRegister, - make_vector(PH, AllocSize, Casted, 0), "", aiNext); - AddPoolUse(*V, PH, PoolUses); - } -#else - TransformAllocationInstr(&MI, AllocSize); -#endif -} - -void FuncTransform::visitAllocaInst(AllocaInst &MI) { -#ifdef BOUNDS_CHECK - // Get the pool handle for the node that this contributes to... - DSNode *Node = getDSNodeHFor(&MI).getNode(); - if (Node->isArray()) { - Value *PH = getPoolHandle(&MI); - if (PH == 0 || isa<ConstantPointerNull>(PH)) return; - TargetData &TD = PAInfo.getAnalysis<TargetData>(); - Value *AllocSize = - ConstantUInt::get(Type::UIntTy, TD.getTypeSize(MI.getAllocatedType())); - - if (MI.isArrayAllocation()) - AllocSize = BinaryOperator::create(Instruction::Mul, AllocSize, - MI.getOperand(0), "sizetmp", &MI); - - // TransformAllocationInstr(&MI, AllocSize); - Instruction *Casted = new CastInst(&MI, PointerType::get(Type::SByteTy), - MI.getName()+".casted", MI.getNext()); - Instruction *V = new CallInst(PAInfo.PoolRegister, - make_vector(PH, Casted, AllocSize, 0), "", Casted->getNext()); - AddPoolUse(*V, PH, PoolUses); - } -#endif -} - - -Instruction *FuncTransform::InsertPoolFreeInstr(Value *Arg, Instruction *Where){ - Value *PH = getPoolHandle(Arg); // Get the pool handle for this DSNode... - if (PH == 0 || isa<ConstantPointerNull>(PH)) return 0; - - // Insert a cast and a call to poolfree... - Value *Casted = Arg; - if (Arg->getType() != PointerType::get(Type::SByteTy)) { - Casted = new CastInst(Arg, PointerType::get(Type::SByteTy), - Arg->getName()+".casted", Where); - G.getScalarMap()[Casted] = G.getScalarMap()[Arg]; - } - - CallInst *FreeI = new CallInst(PAInfo.PoolFree, make_vector(PH, Casted, 0), - "", Where); - AddPoolUse(*FreeI, PH, PoolFrees); - return FreeI; -} - - -void FuncTransform::visitFreeInst(FreeInst &FrI) { - if (Instruction *I = InsertPoolFreeInstr(FrI.getOperand(0), &FrI)) { - // Delete the now obsolete free instruction... - FrI.getParent()->getInstList().erase(&FrI); - - // Update the NewToOldValueMap if this is a clone - if (!FI.NewToOldValueMap.empty()) { - std::map<Value*,const Value*>::iterator II = - FI.NewToOldValueMap.find(&FrI); - assert(II != FI.NewToOldValueMap.end() && - "FrI not found in clone?"); - FI.NewToOldValueMap.insert(std::make_pair(I, II->second)); - FI.NewToOldValueMap.erase(II); - } - } -} - - -void FuncTransform::visitCallocCall(CallSite CS) { - TargetData& TD = PAInfo.getAnalysis<TargetData>(); - bool useLong = TD.getTypeSize(PointerType::get(Type::SByteTy)) != 4; - - Module *M = CS.getInstruction()->getParent()->getParent()->getParent(); - assert(CS.arg_end()-CS.arg_begin() == 2 && "calloc takes two arguments!"); - Value *V1 = CS.getArgument(0); - Value *V2 = CS.getArgument(1); - if (V1->getType() != V2->getType()) { - V1 = new CastInst(V1, useLong ? Type::ULongTy : Type::UIntTy, V1->getName(), CS.getInstruction()); - V2 = new CastInst(V2, useLong ? Type::ULongTy : Type::UIntTy, V2->getName(), CS.getInstruction()); - } - - V2 = BinaryOperator::create(Instruction::Mul, V1, V2, "size", - CS.getInstruction()); - if (V2->getType() != (useLong ? Type::ULongTy : Type::UIntTy)) - V2 = new CastInst(V2, useLong ? Type::ULongTy : Type::UIntTy, V2->getName(), CS.getInstruction()); - - BasicBlock::iterator BBI = - TransformAllocationInstr(CS.getInstruction(), V2); - Value *Ptr = BBI++; - - // We just turned the call of 'calloc' into the equivalent of malloc. To - // finish calloc, we need to zero out the memory. - Function *MemSet = M->getOrInsertFunction((useLong ? "llvm.memset.i64" : "llvm.memset.i32"), - Type::VoidTy, - PointerType::get(Type::SByteTy), - Type::UByteTy, (useLong ? Type::ULongTy : Type::UIntTy), - Type::UIntTy, NULL); - - if (Ptr->getType() != PointerType::get(Type::SByteTy)) - Ptr = new CastInst(Ptr, PointerType::get(Type::SByteTy), Ptr->getName(), - BBI); - - // We know that the memory returned by poolalloc is at least 4 byte aligned. - new CallInst(MemSet, make_vector(Ptr, ConstantUInt::get(Type::UByteTy, 0), - V2, ConstantUInt::get(Type::UIntTy, 4), 0), - "", BBI); -} - - -void FuncTransform::visitReallocCall(CallSite CS) { - assert(CS.arg_end()-CS.arg_begin() == 2 && "realloc takes two arguments!"); - Instruction *I = CS.getInstruction(); - Value *PH = getPoolHandle(I); - Value *OldPtr = CS.getArgument(0); - Value *Size = CS.getArgument(1); - - if (Size->getType() != Type::UIntTy) - Size = new CastInst(Size, Type::UIntTy, Size->getName(), I); - - static Type *VoidPtrTy = PointerType::get(Type::SByteTy); - if (OldPtr->getType() != VoidPtrTy) - OldPtr = new CastInst(OldPtr, VoidPtrTy, OldPtr->getName(), I); - - std::string Name = I->getName(); I->setName(""); - Instruction *V = new CallInst(PAInfo.PoolRealloc, make_vector(PH, OldPtr, - Size, 0), - Name, I); - Instruction *Casted = V; - if (V->getType() != I->getType()) - Casted = new CastInst(V, I->getType(), V->getName(), I); - - // Update def-use info - I->replaceAllUsesWith(Casted); - - // If we are modifying the original function, update the DSGraph. - if (!FI.Clone) { - // V and Casted now point to whatever the original allocation did. - G.getScalarMap().replaceScalar(I, V); - if (V != Casted) - G.getScalarMap()[Casted] = G.getScalarMap()[V]; - } else { // Otherwise, update the NewToOldValueMap - UpdateNewToOldValueMap(I, V, V != Casted ? Casted : 0); - } - - // If this was an invoke, fix up the CFG. - if (InvokeInst *II = dyn_cast<InvokeInst>(I)) { - new BranchInst(II->getNormalDest(), I); - II->getUnwindDest()->removePredecessor(II->getParent(), true); - } - - // Remove old allocation instruction. - I->eraseFromParent(); -} - - -/// visitMemAlignCall - Handle memalign and posix_memalign. -/// -void FuncTransform::visitMemAlignCall(CallSite CS) { - Instruction *I = CS.getInstruction(); - Value *ResultDest = 0; - Value *Align = 0; - Value *Size = 0; - Value *PH; - - if (CS.getCalledFunction()->getName() == "memalign") { - Align = CS.getArgument(0); - Size = CS.getArgument(1); - PH = getPoolHandle(I); - } else { - assert(CS.getCalledFunction()->getName() == "posix_memalign"); - ResultDest = CS.getArgument(0); - Align = CS.getArgument(1); - Size = CS.getArgument(2); - - assert(0 && "posix_memalign not implemented fully!"); - // We need to get the pool descriptor corresponding to *ResultDest. - PH = getPoolHandle(I); - - // Return success always. - Value *RetVal = Constant::getNullValue(I->getType()); - I->replaceAllUsesWith(RetVal); - - static const Type *PtrPtr=PointerType::get(PointerType::get(Type::SByteTy)); - if (ResultDest->getType() != PtrPtr) - ResultDest = new CastInst(ResultDest, PtrPtr, ResultDest->getName(), I); - } - - if (Align->getType() != Type::UIntTy) - Align = new CastInst(Align, Type::UIntTy, Align->getName(), I); - if (Size->getType() != Type::UIntTy) - Size = new CastInst(Size, Type::UIntTy, Size->getName(), I); - - std::string Name = I->getName(); I->setName(""); - Instruction *V = new CallInst(PAInfo.PoolMemAlign, - make_vector(PH, Align, Size, 0), Name, I); - - Instruction *Casted = V; - if (V->getType() != I->getType()) - Casted = new CastInst(V, I->getType(), V->getName(), I); - - if (ResultDest) - new StoreInst(V, ResultDest, I); - else - I->replaceAllUsesWith(Casted); - - // If we are modifying the original function, update the DSGraph. - if (!FI.Clone) { - // V and Casted now point to whatever the original allocation did. - G.getScalarMap().replaceScalar(I, V); - if (V != Casted) - G.getScalarMap()[Casted] = G.getScalarMap()[V]; - } else { // Otherwise, update the NewToOldValueMap - UpdateNewToOldValueMap(I, V, V != Casted ? Casted : 0); - } - - // If this was an invoke, fix up the CFG. - if (InvokeInst *II = dyn_cast<InvokeInst>(I)) { - new BranchInst(II->getNormalDest(), I); - II->getUnwindDest()->removePredecessor(II->getParent(), true); - } - - // Remove old allocation instruction. - I->eraseFromParent(); -} - - - -void FuncTransform::visitCallSite(CallSite CS) { - Function *CF = CS.getCalledFunction(); - Instruction *TheCall = CS.getInstruction(); - - if (ConstantExpr *CE = dyn_cast<ConstantExpr>(CS.getCalledValue())) - if (CE->getOpcode() == Instruction::Cast && isa<Function>(CE->getOperand(0))) - CF = cast<Function>(CE->getOperand(0)); - - if (isa<InlineAsm>(TheCall->getOperand(0))) { - std::cerr << "INLINE ASM: ignoring. Hoping that's safe.\n"; - return; - } - - // If this function is one of the memory manipulating functions built into - // libc, emulate it with pool calls as appropriate. - if (CF && CF->isExternal()) - if (CF->getName() == "calloc") { - visitCallocCall(CS); - return; - } else if (CF->getName() == "realloc") { - visitReallocCall(CS); - return; - } else if (CF->getName() == "memalign" || - CF->getName() == "posix_memalign") { - visitMemAlignCall(CS); - return; - } else if (CF->getName() == "strdup") { - assert(0 && "strdup should have been linked into the program!"); - } else if (CF->getName() == "valloc") { - std::cerr << "VALLOC USED BUT NOT HANDLED!\n"; - abort(); - } - - // We need to figure out which local pool descriptors correspond to the pool - // descriptor arguments passed into the function call. Calculate a mapping - // from callee DSNodes to caller DSNodes. We construct a partial isomophism - // between the graphs to figure out which pool descriptors need to be passed - // in. The roots of this mapping is found from arguments and return values. - // - EquivClassGraphs& ECGraphs = PAInfo.getECGraphs(); - DSGraph::NodeMapTy NodeMapping; - Instruction *NewCall; - Value *NewCallee; - std::vector<const DSNode*> ArgNodes; - DSGraph *CalleeGraph; // The callee graph - - // For indirect callees find any callee since all DS graphs have been merged. - if (CF) { // Direct calls are nice and simple. - DEBUG(std::cerr << " Handling direct call: " << *TheCall); - FuncInfo *CFI = PAInfo.getFuncInfo(*CF); - if (CFI == 0 || CFI->Clone == 0) { // Nothing to transform... - visitInstruction(*TheCall); - return; - } - NewCallee = CFI->Clone; - ArgNodes = CFI->ArgNodes; - - CalleeGraph = &ECGraphs.getDSGraph(*CF); - } else { - DEBUG(std::cerr << " Handling indirect call: " << *TheCall); - - // Here we fill in CF with one of the possible called functions. Because we - // merged together all of the arguments to all of the functions in the - // equivalence set, it doesn't really matter which one we pick. - // (If the function was cloned, we have to map the cloned call instruction - // in CS back to the original call instruction.) - Instruction *OrigInst = - cast<Instruction>(getOldValueIfAvailable(CS.getInstruction())); - CF = isa<CallInst>(OrigInst)? - ECGraphs.getSomeCalleeForCallSite(cast<CallInst>(OrigInst)) : - ECGraphs.getSomeCalleeForCallSite(cast<InvokeInst>(OrigInst)); - - if (!CF) - for (EquivClassGraphs::callee_iterator I = ECGraphs.callee_begin(OrigInst), - E = ECGraphs.callee_end(OrigInst); I != E; ++I) - if (I->second) { - CF = I->second; - break; - } - - // If we didn't find the callee in the constructed call graph, try - // checking in the DSNode itself. - // This isn't ideal as it means that this call site didn't have inlining - // happen. - if (!CF) { - DSGraph* dg = &ECGraphs.getDSGraph(*OrigInst->getParent()->getParent()); - DSNode* d = dg->getNodeForValue(OrigInst->getOperand(0)).getNode(); - const std::vector<GlobalValue*> &g = d->getGlobalsList(); - for(std::vector<GlobalValue*>::const_iterator ii = g.begin(), ee = g.end(); - !CF && ii != ee; ++ii) { - EquivalenceClasses< GlobalValue *> & EC = ECGraphs.getGlobalECs(); - for (EquivalenceClasses<GlobalValue *>::member_iterator MI = EC.findLeader(*ii); - MI != EC.member_end(); ++MI) // Loop over members in this set. - if ((CF = dyn_cast<Function>(*MI))) { - std::cerr << "\n***\nPA: *** WARNING (FuncTransform::visitCallSite): " - << "Using DSNode for callees for call-site in function " - << CS.getCaller()->getName() << "\n***\n"; - break; - } - } - } - - if (!CF && CTF) { - std::cerr << "\nPA: Last Resort TD Indirect Resolve in " << CS.getCaller()->getName() << "\n"; - CF = *CTF->begin(isa<CallInst>(OrigInst)?CallSite(cast<CallInst>(OrigInst)) - :CallSite(cast<InvokeInst>(OrigInst))); - if (CF) std::cerr << "TD resolved to " << CF->getName() << "\n"; - } - - if (!CF) { - // FIXME: Unknown callees for a call-site. Warn and ignore. - std::cerr << "\n***\nPA: *** WARNING (FuncTransform::visitCallSite): " - << "Unknown callees for call-site in function " - << CS.getCaller()->getName() << "\n***\n"; - return; - } - - // Get the common graph for the set of functions this call may invoke. - CalleeGraph = &ECGraphs.getDSGraph(*CF); - -#ifndef NDEBUG - // Verify that all potential callees at call site have the same DS graph. - EquivClassGraphs::callee_iterator I = - ECGraphs.callee_begin(OrigInst), E = ECGraphs.callee_end(OrigInst); - for (; I != E; ++I) - if (!I->second->isExternal()) - assert(CalleeGraph == &ECGraphs.getDSGraph(*I->second) && - "Callees at call site do not have a common graph!"); -#endif - - // Find the DS nodes for the arguments that need to be added, if any. - FuncInfo *CFI = PAInfo.getFuncInfo(*CF); - assert(CFI && "No function info for callee at indirect call?"); - ArgNodes = CFI->ArgNodes; - - if (ArgNodes.empty()) - return; // No arguments to add? Transformation is a noop! - - // Cast the function pointer to an appropriate type! - std::vector<const Type*> ArgTys(ArgNodes.size(), - PoolAllocate::PoolDescPtrTy); - for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end(); - I != E; ++I) - ArgTys.push_back((*I)->getType()); - - FunctionType *FTy = FunctionType::get(TheCall->getType(), ArgTys, false); - PointerType *PFTy = PointerType::get(FTy); - - // If there are any pool arguments cast the func ptr to the right type. - NewCallee = new CastInst(CS.getCalledValue(), PFTy, "tmp", TheCall); - } - - Function::arg_iterator FAI = CF->arg_begin(), E = CF->arg_end(); - CallSite::arg_iterator AI = CS.arg_begin(), AE = CS.arg_end(); - for ( ; FAI != E && AI != AE; ++FAI, ++AI) - if (!isa<Constant>(*AI)) - DSGraph::computeNodeMapping(CalleeGraph->getNodeForValue(FAI), - getDSNodeHFor(*AI), NodeMapping, false); - - //assert(AI == AE && "Varargs calls not handled yet!"); - - // Map the return value as well... - if (DS::isPointerType(TheCall->getType())) - DSGraph::computeNodeMapping(CalleeGraph->getReturnNodeFor(*CF), - getDSNodeHFor(TheCall), NodeMapping, false); - - // This code seems redundant (and crashes occasionally) - // There is no reason to map globals here, since they are not passed as - // arguments - -// // Map the nodes that are pointed to by globals. -// DSScalarMap &CalleeSM = CalleeGraph->getScalarMap(); -// for (DSScalarMap::global_iterator GI = G.getScalarMap().global_begin(), -// E = G.getScalarMap().global_end(); GI != E; ++GI) -// if (CalleeSM.count(*GI)) -// DSGraph::computeNodeMapping(CalleeGraph->getNodeForValue(*GI), -// getDSNodeHFor(*GI), -// NodeMapping, false); - - // Okay, now that we have established our mapping, we can figure out which - // pool descriptors to pass in... - std::vector<Value*> Args; - for (unsigned i = 0, e = ArgNodes.size(); i != e; ++i) { - Value *ArgVal = Constant::getNullValue(PoolAllocate::PoolDescPtrTy); - if (NodeMapping.count(ArgNodes[i])) - if (DSNode *LocalNode = NodeMapping[ArgNodes[i]].getNode()) - if (FI.PoolDescriptors.count(LocalNode)) - ArgVal = FI.PoolDescriptors.find(LocalNode)->second; - if (isa<Constant>(ArgVal) && cast<Constant>(ArgVal)->isNullValue()) { -#ifdef BOUNDS_CHECK - if (ArgNodes[i]->isArray()) { -#endif - if (!isa<InvokeInst>(TheCall)) { - //Dinakar we need pooldescriptors for allocas in the callee if it escapes - BasicBlock::iterator InsertPt = TheCall->getParent()->getParent()->front().begin(); - Type *VoidPtrTy = PointerType::get(Type::SByteTy); - ArgVal = new AllocaInst(ArrayType::get(VoidPtrTy, 16), 0, "PD", InsertPt); - Value *ElSize = ConstantUInt::get(Type::UIntTy,0); - Value *Align = ConstantUInt::get(Type::UIntTy,0); - new CallInst(PAInfo.PoolInit, make_vector(ArgVal, ElSize, Align, 0),"", TheCall); - new CallInst(PAInfo.PoolDestroy, make_vector(ArgVal, 0), "", - TheCall->getNext()); - } - //probably need to update DSG - // std::cerr << "WARNING: NULL POOL ARGUMENTS ARE PASSED IN!\n"; -#ifdef BOUNDS_CHECK - } -#endif - } - Args.push_back(ArgVal); - } - - // Add the rest of the arguments... - Args.insert(Args.end(), CS.arg_begin(), CS.arg_end()); - - std::string Name = TheCall->getName(); TheCall->setName(""); - - if (InvokeInst *II = dyn_cast<InvokeInst>(TheCall)) { - NewCall = new InvokeInst(NewCallee, II->getNormalDest(), - II->getUnwindDest(), Args, Name, TheCall); - } else { - NewCall = new CallInst(NewCallee, Args, Name, TheCall); - } - - // Add all of the uses of the pool descriptor - for (unsigned i = 0, e = ArgNodes.size(); i != e; ++i) - AddPoolUse(*NewCall, Args[i], PoolUses); - - TheCall->replaceAllUsesWith(NewCall); - DEBUG(std::cerr << " Result Call: " << *NewCall); - - if (TheCall->getType() != Type::VoidTy) { - // If we are modifying the original function, update the DSGraph... - DSGraph::ScalarMapTy &SM = G.getScalarMap(); - DSGraph::ScalarMapTy::iterator CII = SM.find(TheCall); - if (CII != SM.end()) { - SM[NewCall] = CII->second; - SM.erase(CII); // Destroy the CallInst - } else if (!FI.NewToOldValueMap.empty()) { - // Otherwise, if this is a clone, update the NewToOldValueMap with the new - // CI return value. - UpdateNewToOldValueMap(TheCall, NewCall); - } - } else if (!FI.NewToOldValueMap.empty()) { - UpdateNewToOldValueMap(TheCall, NewCall); - } - - TheCall->eraseFromParent(); - visitInstruction(*NewCall); -} - - -// visitInstruction - For all instructions in the transformed function bodies, -// replace any references to the original calls with references to the -// transformed calls. Many instructions can "take the address of" a function, -// and we must make sure to catch each of these uses, and transform it into a -// reference to the new, transformed, function. -void FuncTransform::visitInstruction(Instruction &I) { - for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) - if (Function *clonedFunc = retCloneIfFunc(I.getOperand(i))) { - Constant *CF = clonedFunc; - I.setOperand(i, ConstantExpr::getCast(CF, I.getOperand(i)->getType())); - } -}
diff --git a/poolalloc/runtime/FL2Allocator/Makefile b/poolalloc/runtime/FL2Allocator/Makefile deleted file mode 100755 index a2df33c..0000000 --- a/poolalloc/runtime/FL2Allocator/Makefile +++ /dev/null
@@ -1,8 +0,0 @@ -LEVEL = ../.. -SHARED_LIBRARY=1 -LIBRARYNAME=poolalloc_rt - -CXXFLAGS += -fno-exceptions - -include $(LEVEL)/Makefile.common -
diff --git a/poolalloc/runtime/FL2Allocator/PoolAllocator.cpp b/poolalloc/runtime/FL2Allocator/PoolAllocator.cpp deleted file mode 100644 index 66151ba..0000000 --- a/poolalloc/runtime/FL2Allocator/PoolAllocator.cpp +++ /dev/null
@@ -1,1067 +0,0 @@ -//===- PoolAllocator.cpp - Simple free-list based pool allocator ----------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file is one possible implementation of the LLVM pool allocator runtime -// library. -// -// FIXME: -// The pointer compression functions are not thread safe. -//===----------------------------------------------------------------------===// - -#include "PoolAllocator.h" -#include "poolalloc/MMAPSupport.h" -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -typedef long intptr_t; -typedef unsigned long uintptr_t; - -// Performance tweaking macros. -#define INITIAL_SLAB_SIZE 4096 -#define LARGE_SLAB_SIZE 4096 - -#ifndef NDEBUG -// Configuration macros. Define up to one of these. -#define PRINT_NUM_POOLS // Print use dynamic # pools info -//#define PRINT_POOLDESTROY_STATS // When pools are destroyed, print stats -//#define PRINT_POOL_TRACE // Print a full trace -#define ENABLE_POOL_IDS // PID for access/pool traces - - -// ALWAYS_USE_MALLOC_FREE - Make poolalloc/free always call malloc/free. Note -// that if the poolfree optimization is in use that this will cause memory -// leaks! -//#define ALWAYS_USE_MALLOC_FREE -#endif - -//===----------------------------------------------------------------------===// -// Pool Debugging stuff. -//===----------------------------------------------------------------------===// - -#if defined(ALWAYS_USE_MALLOC_FREE) -#define DO_IF_FORCE_MALLOCFREE(x) x -#else -#define DO_IF_FORCE_MALLOCFREE(x) -#endif - - -#if !defined(PRINT_POOL_TRACE) -#define DO_IF_TRACE(X) -#else -#define ENABLE_POOL_IDS -#define DO_IF_TRACE(X) X -#define PRINT_POOLDESTROY_STATS -#endif - -#if defined(ENABLE_POOL_IDS) -struct PoolID { - void *PD; - unsigned ID; -}; - -struct PoolID *PoolIDs = 0; -static unsigned NumLivePools = 0; -static unsigned NumPoolIDsAllocated = 0; -static unsigned CurPoolID = 0; - -static unsigned addPoolNumber(void *PD) { - if (NumLivePools == NumPoolIDsAllocated) { - NumPoolIDsAllocated = (10+NumPoolIDsAllocated)*2; - PoolIDs = (PoolID*)realloc(PoolIDs, sizeof(PoolID)*NumPoolIDsAllocated); - } - - PoolIDs[NumLivePools].PD = PD; - PoolIDs[NumLivePools].ID = ++CurPoolID; - NumLivePools++; - return CurPoolID; -} - -static unsigned getPoolNumber(void *PD) { - if (PD == 0) return ~0; - for (unsigned i = 0; i != NumLivePools; ++i) - if (PoolIDs[i].PD == PD) - return PoolIDs[i].ID; - fprintf(stderr, "INVALID/UNKNOWN POOL DESCRIPTOR: 0x%lX\n",(unsigned long)PD); - return 0; -} - -static unsigned removePoolNumber(void *PD) { - for (unsigned i = 0; i != NumLivePools; ++i) - if (PoolIDs[i].PD == PD) { - unsigned PN = PoolIDs[i].ID; - memmove(&PoolIDs[i], &PoolIDs[i+1], sizeof(PoolID)*(NumLivePools-i-1)); - --NumLivePools; - return PN; - } - fprintf(stderr, "INVALID/UNKNOWN POOL DESCRIPTOR: 0x%lX\n",(unsigned long)PD); - return 0; -} - -static void PrintPoolStats(void *Pool); -template<typename PoolTraits> -static void PrintLivePoolInfo() { - for (unsigned i = 0; i != NumLivePools; ++i) { - fprintf(stderr, "[%d] pool at exit ", PoolIDs[i].ID); - PrintPoolStats((PoolTy<PoolTraits>*)PoolIDs[i].PD); - } -} -#endif - -#ifdef PRINT_POOLDESTROY_STATS -#define DO_IF_POOLDESTROY_STATS(X) X -#define PRINT_NUM_POOLS - -template<typename PoolTraits> -static void PrintPoolStats(PoolTy<PoolTraits> *Pool) { - fprintf(stderr, - "(0x%X) BytesAlloc=%d NumObjs=%d" - " AvgObjSize=%d NextAllocSize=%d DeclaredSize=%d\n", - Pool, Pool->BytesAllocated, Pool->NumObjects, - Pool->NumObjects ? Pool->BytesAllocated/Pool->NumObjects : 0, - Pool->AllocSize, Pool->DeclaredSize); -} - -#else -#define DO_IF_POOLDESTROY_STATS(X) -#endif - -#ifdef PRINT_NUM_POOLS -static unsigned PoolCounter = 0; -static unsigned PoolsInited = 0; - -// MaxHeapSize - The maximum size of the heap ever. -static unsigned MaxHeapSize = 0; - -// CurHeapSize - The current size of the heap. -static unsigned CurHeapSize = 0; - -template<typename PoolTraits> -static void PoolCountPrinter() { - DO_IF_TRACE(PrintLivePoolInfo<PoolTraits>()); - fprintf(stderr, "\n\n" - "*** %d DYNAMIC POOLS INITIALIZED ***\n\n" - "*** %d DYNAMIC POOLS ALLOCATED FROM ***\n\n", - PoolsInited, PoolCounter); - fprintf(stderr, "MaxHeapSize = %fKB HeapSizeAtExit = %fKB " - "NOTE: only valid if using Heuristic=AllPools and no " - "bumpptr/realloc!\n", MaxHeapSize/1024.0, CurHeapSize/1024.0); -} - -template<typename PoolTraits> -static void InitPrintNumPools() { - static bool Initialized = 0; - if (!Initialized) { - Initialized = 1; - atexit(PoolCountPrinter<PoolTraits>); - } -} - -#define DO_IF_PNP(X) X -#else -#define DO_IF_PNP(X) -#endif - -//===----------------------------------------------------------------------===// -// PoolSlab implementation -//===----------------------------------------------------------------------===// - - -template<typename PoolTraits> -static void AddNodeToFreeList(PoolTy<PoolTraits> *Pool, - FreedNodeHeader<PoolTraits> *FreeNode) { - typename PoolTraits::FreeNodeHeaderPtrTy *FreeList; - if (FreeNode->Header.Size == Pool->DeclaredSize) - FreeList = &Pool->ObjFreeList; - else - FreeList = &Pool->OtherFreeList; - - void *PoolBase = Pool->Slabs; - - typename PoolTraits::FreeNodeHeaderPtrTy FreeNodeIdx = - PoolTraits::FNHPtrToIndex(FreeNode, PoolBase); - - FreeNode->Prev = 0; // First on the list. - FreeNode->Next = *FreeList; - *FreeList = FreeNodeIdx; - if (FreeNode->Next) - PoolTraits::IndexToFNHPtr(FreeNode->Next, PoolBase)->Prev = FreeNodeIdx; -} - -template<typename PoolTraits> -static void UnlinkFreeNode(PoolTy<PoolTraits> *Pool, - FreedNodeHeader<PoolTraits> *FNH) { - void *PoolBase = Pool->Slabs; - - // Make the predecessor point to our next node. - if (FNH->Prev) - PoolTraits::IndexToFNHPtr(FNH->Prev, PoolBase)->Next = FNH->Next; - else { - typename PoolTraits::FreeNodeHeaderPtrTy NodeIdx = - PoolTraits::FNHPtrToIndex(FNH, PoolBase); - - if (Pool->ObjFreeList == NodeIdx) - Pool->ObjFreeList = FNH->Next; - else { - assert(Pool->OtherFreeList == NodeIdx && - "Prev Ptr is null but not at head of free list?"); - Pool->OtherFreeList = FNH->Next; - } - } - - if (FNH->Next) - PoolTraits::IndexToFNHPtr(FNH->Next, PoolBase)->Prev = FNH->Prev; -} - - -// PoolSlab Structure - Hold multiple objects of the current node type. -// Invariants: FirstUnused <= UsedEnd -// -template<typename PoolTraits> -struct PoolSlab { - // Next - This link is used when we need to traverse the list of slabs in a - // pool, for example, to destroy them all. - PoolSlab<PoolTraits> *Next; - -public: - static void create(PoolTy<PoolTraits> *Pool, unsigned SizeHint); - static void *create_for_bp(PoolTy<PoolTraits> *Pool); - static void create_for_ptrcomp(PoolTy<PoolTraits> *Pool, - void *Mem, unsigned Size); - void destroy(); - - PoolSlab<PoolTraits> *getNext() const { return Next; } -}; - -// create - Create a new (empty) slab and add it to the end of the Pools list. -template<typename PoolTraits> -void PoolSlab<PoolTraits>::create(PoolTy<PoolTraits> *Pool, unsigned SizeHint) { - if (Pool->DeclaredSize == 0) { - unsigned Align = Pool->Alignment; - if (SizeHint < sizeof(FreedNodeHeader<PoolTraits>) - - sizeof(NodeHeader<PoolTraits>)) - SizeHint = sizeof(FreedNodeHeader<PoolTraits>) - - sizeof(NodeHeader<PoolTraits>); - SizeHint = SizeHint+sizeof(FreedNodeHeader<PoolTraits>)+(Align-1); - SizeHint = (SizeHint & ~(Align-1))-sizeof(FreedNodeHeader<PoolTraits>); - Pool->DeclaredSize = SizeHint; - } - - unsigned Size = Pool->AllocSize; - Pool->AllocSize <<= 1; - Size = (Size+SizeHint-1) / SizeHint * SizeHint; - PoolSlab *PS = (PoolSlab*)malloc(Size+sizeof(PoolSlab<PoolTraits>) + - sizeof(NodeHeader<PoolTraits>) + - sizeof(FreedNodeHeader<PoolTraits>)); - char *PoolBody = (char*)(PS+1); - - // If the Alignment is greater than the size of the FreedNodeHeader, skip over - // some space so that the a "free pointer + sizeof(FreedNodeHeader)" is always - // aligned. - unsigned Alignment = Pool->Alignment; - if (Alignment > sizeof(FreedNodeHeader<PoolTraits>)) { - PoolBody += Alignment-sizeof(FreedNodeHeader<PoolTraits>); - Size -= Alignment-sizeof(FreedNodeHeader<PoolTraits>); - } - - // Add the body of the slab to the free list. - FreedNodeHeader<PoolTraits> *SlabBody =(FreedNodeHeader<PoolTraits>*)PoolBody; - SlabBody->Header.Size = Size; - AddNodeToFreeList(Pool, SlabBody); - - // Make sure to add a marker at the end of the slab to prevent the coallescer - // from trying to merge off the end of the page. - FreedNodeHeader<PoolTraits> *End = - (FreedNodeHeader<PoolTraits>*)(PoolBody + sizeof(NodeHeader<PoolTraits>)+ - Size); - End->Header.Size = ~0; // Looks like an allocated chunk - - // Add the slab to the list... - PS->Next = Pool->Slabs; - Pool->Slabs = PS; -} - -/// create_for_bp - This creates a slab for a bump-pointer pool. -template<typename PoolTraits> -void *PoolSlab<PoolTraits>::create_for_bp(PoolTy<PoolTraits> *Pool) { - unsigned Size = Pool->AllocSize; - Pool->AllocSize <<= 1; - PoolSlab *PS = (PoolSlab*)malloc(Size+sizeof(PoolSlab)); - char *PoolBody = (char*)(PS+1); - if (sizeof(PoolSlab) == 4) - PoolBody += 4; // No reason to start out unaligned. - - // Update the end pointer. - Pool->OtherFreeList = (FreedNodeHeader<PoolTraits>*)((char*)(PS+1)+Size); - - // Add the slab to the list... - PS->Next = Pool->Slabs; - Pool->Slabs = PS; - return PoolBody; -} - -/// create_for_ptrcomp - Initialize a chunk of memory 'Mem' of size 'Size' for -/// pointer compression. -template<typename PoolTraits> -void PoolSlab<PoolTraits>::create_for_ptrcomp(PoolTy<PoolTraits> *Pool, - void *SMem, unsigned Size) { - if (Pool->DeclaredSize == 0) { - unsigned Align = Pool->Alignment; - unsigned SizeHint = sizeof(FreedNodeHeader<PoolTraits>) - - sizeof(NodeHeader<PoolTraits>); - SizeHint = SizeHint+sizeof(FreedNodeHeader<PoolTraits>)+(Align-1); - SizeHint = (SizeHint & ~(Align-1))-sizeof(FreedNodeHeader<PoolTraits>); - Pool->DeclaredSize = SizeHint; - } - - Size -= sizeof(PoolSlab) + sizeof(NodeHeader<PoolTraits>) + - sizeof(FreedNodeHeader<PoolTraits>); - PoolSlab *PS = (PoolSlab*)SMem; - char *PoolBody = (char*)(PS+1); - - // If the Alignment is greater than the size of the NodeHeader, skip over some - // space so that the a "free pointer + sizeof(NodeHeader)" is always aligned - // for user data. - unsigned Alignment = Pool->Alignment; - if (Alignment > sizeof(NodeHeader<PoolTraits>)) { - PoolBody += Alignment-sizeof(NodeHeader<PoolTraits>); - Size -= Alignment-sizeof(NodeHeader<PoolTraits>); - } - - // Add the body of the slab to the free list. - FreedNodeHeader<PoolTraits> *SlabBody =(FreedNodeHeader<PoolTraits>*)PoolBody; - SlabBody->Header.Size = Size; - AddNodeToFreeList(Pool, SlabBody); - - // Make sure to add a marker at the end of the slab to prevent the coallescer - // from trying to merge off the end of the page. - FreedNodeHeader<PoolTraits> *End = - (FreedNodeHeader<PoolTraits>*)(PoolBody + sizeof(NodeHeader<PoolTraits>) + - Size); - End->Header.Size = ~0; // Looks like an allocated chunk - PS->Next = 0; -} - - -template<typename PoolTraits> -void PoolSlab<PoolTraits>::destroy() { - free(this); -} - -//===----------------------------------------------------------------------===// -// -// Bump-pointer pool allocator library implementation -// -//===----------------------------------------------------------------------===// - -void poolinit_bp(PoolTy<NormalPoolTraits> *Pool, unsigned ObjAlignment) { - DO_IF_PNP(memset(Pool, 0, sizeof(PoolTy<NormalPoolTraits>))); - Pool->Slabs = 0; - if (ObjAlignment < 4) ObjAlignment = __alignof(double); - Pool->AllocSize = INITIAL_SLAB_SIZE; - Pool->Alignment = ObjAlignment; - Pool->LargeArrays = 0; - Pool->ObjFreeList = 0; // This is our bump pointer. - Pool->OtherFreeList = 0; // This is our end pointer. - - unsigned PID; -#ifdef ENABLE_POOL_IDS - PID = addPoolNumber(Pool); -#endif - - DO_IF_TRACE(fprintf(stderr, "[%d] poolinit_bp(0x%X, %d)\n", - PID, Pool, ObjAlignment)); - DO_IF_PNP(++PoolsInited); // Track # pools initialized - DO_IF_PNP(InitPrintNumPools<NormalPoolTraits>()); -} - -void *poolalloc_bp(PoolTy<NormalPoolTraits> *Pool, unsigned NumBytes) { - DO_IF_FORCE_MALLOCFREE(return malloc(NumBytes)); - assert(Pool && "Bump pointer pool does not support null PD!"); - DO_IF_TRACE(fprintf(stderr, "[%d] poolalloc_bp(%d) -> ", - getPoolNumber(Pool), NumBytes)); - DO_IF_PNP(if (Pool->NumObjects == 0) ++PoolCounter); // Track # pools. - - if (NumBytes >= LARGE_SLAB_SIZE) - goto LargeObject; - - DO_IF_PNP(++Pool->NumObjects); - DO_IF_PNP(Pool->BytesAllocated += NumBytes); - - if (NumBytes < 1) NumBytes = 1; - - uintptr_t Alignment; - char *BumpPtr, *EndPtr; - Alignment = Pool->Alignment-1; - BumpPtr = (char*)Pool->ObjFreeList; // Get our bump pointer. - EndPtr = (char*)Pool->OtherFreeList; // Get our end pointer. - -TryAgain: - // Align the bump pointer to the required boundary. - BumpPtr = (char*)(intptr_t((BumpPtr+Alignment)) & ~Alignment); - - if (BumpPtr + NumBytes < EndPtr) { - void *Result = BumpPtr; - // Update bump ptr. - Pool->ObjFreeList = (FreedNodeHeader<NormalPoolTraits>*)(BumpPtr+NumBytes); - DO_IF_TRACE(fprintf(stderr, "%p\n", Result)); - return Result; - } - - BumpPtr = (char*)PoolSlab<NormalPoolTraits>::create_for_bp(Pool); - EndPtr = (char*)Pool->OtherFreeList; // Get our updated end pointer. - goto TryAgain; - -LargeObject: - // Otherwise, the allocation is a large array. Since we're not going to be - // able to help much for this allocation, simply pass it on to malloc. - LargeArrayHeader *LAH = (LargeArrayHeader*)malloc(sizeof(LargeArrayHeader) + - NumBytes); - LAH->Size = NumBytes; - LAH->Marker = ~0U; - LAH->LinkIntoList(&Pool->LargeArrays); - DO_IF_TRACE(fprintf(stderr, "%p [large]\n", LAH+1)); - return LAH+1; -} - -void pooldestroy_bp(PoolTy<NormalPoolTraits> *Pool) { - assert(Pool && "Null pool pointer passed in to pooldestroy!\n"); - - unsigned PID; -#ifdef ENABLE_POOL_IDS - PID = removePoolNumber(Pool); -#endif - DO_IF_TRACE(fprintf(stderr, "[%d] pooldestroy_bp", PID)); - DO_IF_POOLDESTROY_STATS(PrintPoolStats(Pool)); - - // Free all allocated slabs. - PoolSlab<NormalPoolTraits> *PS = Pool->Slabs; - while (PS) { - PoolSlab<NormalPoolTraits> *Next = PS->getNext(); - PS->destroy(); - PS = Next; - } - - // Free all of the large arrays. - LargeArrayHeader *LAH = Pool->LargeArrays; - while (LAH) { - LargeArrayHeader *Next = LAH->Next; - free(LAH); - LAH = Next; - } -} - - - -//===----------------------------------------------------------------------===// -// -// Pool allocator library implementation -// -//===----------------------------------------------------------------------===// - -// poolinit - Initialize a pool descriptor to empty -// -template<typename PoolTraits> -static void poolinit_internal(PoolTy<PoolTraits> *Pool, - unsigned DeclaredSize, unsigned ObjAlignment) { - assert(Pool && "Null pool pointer passed into poolinit!\n"); - memset(Pool, 0, sizeof(PoolTy<PoolTraits>)); - Pool->AllocSize = INITIAL_SLAB_SIZE; - - if (ObjAlignment < 4) ObjAlignment = __alignof(double); - Pool->Alignment = ObjAlignment; - - // Round the declared size up to an alignment boundary-header size, just like - // we have to do for objects. - if (DeclaredSize) { - if (DeclaredSize < sizeof(FreedNodeHeader<PoolTraits>) - - sizeof(NodeHeader<PoolTraits>)) - DeclaredSize = sizeof(FreedNodeHeader<PoolTraits>) - - sizeof(NodeHeader<PoolTraits>); - DeclaredSize = DeclaredSize+sizeof(FreedNodeHeader<PoolTraits>) + - (ObjAlignment-1); - DeclaredSize = (DeclaredSize & ~(ObjAlignment-1)) - - sizeof(FreedNodeHeader<PoolTraits>); - } - - Pool->DeclaredSize = DeclaredSize; - - unsigned PID; -#ifdef ENABLE_POOL_IDS - PID = addPoolNumber(Pool); -#endif - DO_IF_TRACE(fprintf(stderr, "[%d] poolinit%s(0x%X, %d, %d)\n", - PID, PoolTraits::getSuffix(), - Pool, DeclaredSize, ObjAlignment)); - DO_IF_PNP(++PoolsInited); // Track # pools initialized - DO_IF_PNP(InitPrintNumPools<PoolTraits>()); -} - -void poolinit(PoolTy<NormalPoolTraits> *Pool, - unsigned DeclaredSize, unsigned ObjAlignment) { - poolinit_internal(Pool, DeclaredSize, ObjAlignment); -} - -// pooldestroy - Release all memory allocated for a pool -// -void pooldestroy(PoolTy<NormalPoolTraits> *Pool) { - assert(Pool && "Null pool pointer passed in to pooldestroy!\n"); - - unsigned PID; -#ifdef ENABLE_POOL_IDS - PID = removePoolNumber(Pool); -#endif - DO_IF_TRACE(fprintf(stderr, "[%d] pooldestroy", PID)); - DO_IF_POOLDESTROY_STATS(PrintPoolStats(Pool)); - - // Free all allocated slabs. - PoolSlab<NormalPoolTraits> *PS = Pool->Slabs; - while (PS) { - PoolSlab<NormalPoolTraits> *Next = PS->getNext(); - PS->destroy(); - PS = Next; - } - - // Free all of the large arrays. - LargeArrayHeader *LAH = Pool->LargeArrays; - while (LAH) { - LargeArrayHeader *Next = LAH->Next; - free(LAH); - LAH = Next; - } -} - -template<typename PoolTraits> -static void *poolalloc_internal(PoolTy<PoolTraits> *Pool, unsigned NumBytesA) { - DO_IF_TRACE(fprintf(stderr, "[%d] poolalloc%s(%d) -> ", - getPoolNumber(Pool), PoolTraits::getSuffix(), NumBytesA)); - - unsigned NumBytes = NumBytesA; - - // If a null pool descriptor is passed in, this is not a pool allocated data - // structure. Hand off to the system malloc. - if (Pool == 0) { - void *Result = malloc(NumBytes); - DO_IF_TRACE(fprintf(stderr, "0x%X [malloc]\n", Result)); - return Result; - } - DO_IF_PNP(if (Pool->NumObjects == 0) ++PoolCounter); // Track # pools. - - // Objects must be at least 8 bytes to hold the FreedNodeHeader object when - // they are freed. This also handles allocations of 0 bytes. - if (NumBytes < (sizeof(FreedNodeHeader<PoolTraits>) - - sizeof(NodeHeader<PoolTraits>))) - NumBytes = sizeof(FreedNodeHeader<PoolTraits>) - - sizeof(NodeHeader<PoolTraits>); - - // Adjust the size so that memory allocated from the pool is always on the - // proper alignment boundary. - unsigned Alignment = Pool->Alignment; - NumBytes = NumBytes+sizeof(FreedNodeHeader<PoolTraits>) + - (Alignment-1); // Round up - NumBytes = (NumBytes & ~(Alignment-1)) - - sizeof(FreedNodeHeader<PoolTraits>); // Truncate - - DO_IF_PNP(CurHeapSize += (NumBytes + sizeof(NodeHeader<PoolTraits>))); - DO_IF_PNP(if (CurHeapSize > MaxHeapSize) MaxHeapSize = CurHeapSize); - - DO_IF_PNP(++Pool->NumObjects); - DO_IF_PNP(Pool->BytesAllocated += NumBytes); - - // Fast path - allocate objects off the object list. - if (NumBytes == Pool->DeclaredSize && Pool->ObjFreeList != 0) { - typename PoolTraits::FreeNodeHeaderPtrTy NodeIdx = Pool->ObjFreeList; - void *PoolBase = Pool->Slabs; - FreedNodeHeader<PoolTraits> *Node = - PoolTraits::IndexToFNHPtr(NodeIdx, PoolBase); - UnlinkFreeNode(Pool, Node); - assert(NumBytes == Node->Header.Size); - - Node->Header.Size = NumBytes|1; // Mark as allocated - DO_IF_TRACE(fprintf(stderr, "0x%X\n", &Node->Header+1)); - return &Node->Header+1; - } - - if (PoolTraits::UseLargeArrayObjects && - NumBytes >= LARGE_SLAB_SIZE-sizeof(PoolSlab<PoolTraits>) - - sizeof(NodeHeader<PoolTraits>)) - goto LargeObject; - - // Fast path. In the common case, we can allocate a portion of the node at - // the front of the free list. - do { - void *PoolBase = Pool->Slabs; - FreedNodeHeader<PoolTraits> *FirstNode = - PoolTraits::IndexToFNHPtr(Pool->OtherFreeList, PoolBase); - if (FirstNode) { - unsigned FirstNodeSize = FirstNode->Header.Size; - if (FirstNodeSize >= NumBytes) { - if (FirstNodeSize >= 2*NumBytes+sizeof(NodeHeader<PoolTraits>)) { - // Put the remainder back on the list... - FreedNodeHeader<PoolTraits> *NextNodes = - (FreedNodeHeader<PoolTraits>*)((char*)FirstNode + - sizeof(NodeHeader<PoolTraits>) +NumBytes); - - // Remove from list - UnlinkFreeNode(Pool, FirstNode); - - NextNodes->Header.Size = FirstNodeSize-NumBytes - - sizeof(NodeHeader<PoolTraits>); - AddNodeToFreeList(Pool, NextNodes); - - } else { - UnlinkFreeNode(Pool, FirstNode); - NumBytes = FirstNodeSize; - } - FirstNode->Header.Size = NumBytes|1; // Mark as allocated - DO_IF_TRACE(fprintf(stderr, "0x%X\n", &FirstNode->Header+1)); - return &FirstNode->Header+1; - } - - // Perform a search of the free list, taking the front of the first free - // chunk that is big enough. - typename PoolTraits::FreeNodeHeaderPtrTy *FN = &Pool->OtherFreeList; - FreedNodeHeader<PoolTraits> *FNN = FirstNode; - - // Search the list for the first-fit. - while (FNN && FNN->Header.Size < NumBytes) { - // Advance FN to point to the Next field of FNN. - FN = &FNN->Next; - - // Advance FNN to point to whatever the next node points to (null or the - // next node in the free list). - FNN = PoolTraits::IndexToFNHPtr(*FN, PoolBase); - } - - if (FNN) { - // We found a slab big enough. If it's a perfect fit, just unlink - // from the free list, otherwise, slice a little bit off and adjust - // the free list. - if (FNN->Header.Size > 2*NumBytes+sizeof(NodeHeader<PoolTraits>)) { - UnlinkFreeNode(Pool, FNN); - - // Put the remainder back on the list... - FreedNodeHeader<PoolTraits> *NextNodes = - (FreedNodeHeader<PoolTraits>*)((char*)FNN + - sizeof(NodeHeader<PoolTraits>) + - NumBytes); - NextNodes->Header.Size = FNN->Header.Size-NumBytes - - sizeof(NodeHeader<PoolTraits>); - AddNodeToFreeList(Pool, NextNodes); - } else { - UnlinkFreeNode(Pool, FNN); - NumBytes = FNN->Header.Size; - } - FNN->Header.Size = NumBytes|1; // Mark as allocated - DO_IF_TRACE(fprintf(stderr, "0x%X\n", &FNN->Header+1)); - return &FNN->Header+1; - } - } - - // If we are not allowed to grow this pool, don't. - if (!PoolTraits::CanGrowPool) { - abort(); - return 0; - } - - // Oops, we didn't find anything on the free list big enough! Allocate - // another slab and try again. - PoolSlab<PoolTraits>::create(Pool, NumBytes); - } while (1); - -LargeObject: - // Otherwise, the allocation is a large array. Since we're not going to be - // able to help much for this allocation, simply pass it on to malloc. - LargeArrayHeader *LAH = (LargeArrayHeader*)malloc(sizeof(LargeArrayHeader) + - NumBytes); - LAH->Size = NumBytes; - LAH->Marker = ~0U; - LAH->LinkIntoList(&Pool->LargeArrays); - DO_IF_TRACE(fprintf(stderr, "0x%X [large]\n", LAH+1)); - return LAH+1; -} - -template<typename PoolTraits> -static void poolfree_internal(PoolTy<PoolTraits> *Pool, void *Node) { - if (Node == 0) return; - DO_IF_TRACE(fprintf(stderr, "[%d] poolfree%s(%p) ", - getPoolNumber(Pool), PoolTraits::getSuffix(), Node)); - - // If a null pool descriptor is passed in, this is not a pool allocated data - // structure. Hand off to the system free. - if (Pool == 0) { - free(Node); - DO_IF_TRACE(fprintf(stderr, "[free]\n")); - return; - } - - // Check to see how many elements were allocated to this node... - FreedNodeHeader<PoolTraits> *FNH = - (FreedNodeHeader<PoolTraits>*)((char*)Node-sizeof(NodeHeader<PoolTraits>)); - assert((FNH->Header.Size & 1) && "Node not allocated!"); - unsigned Size = FNH->Header.Size & ~1; - - if (Size == ~1U) goto LargeArrayCase; - DO_IF_TRACE(fprintf(stderr, "%d bytes\n", Size)); - - DO_IF_PNP(CurHeapSize -= (Size + sizeof(NodeHeader<PoolTraits>))); - - // If the node immediately after this one is also free, merge it into node. - FreedNodeHeader<PoolTraits> *NextFNH; - NextFNH = (FreedNodeHeader<PoolTraits>*)((char*)Node+Size); - while ((NextFNH->Header.Size & 1) == 0) { - // Unlink NextFNH from the freelist that it is in. - UnlinkFreeNode(Pool, NextFNH); - Size += sizeof(NodeHeader<PoolTraits>)+NextFNH->Header.Size; - NextFNH = (FreedNodeHeader<PoolTraits>*)((char*)Node+Size); - } - - // If there are already nodes on the freelist, see if these blocks can be - // coallesced into one of the early blocks on the front of the list. This is - // a simple check that prevents many horrible forms of fragmentation, - // particularly when freeing objects in allocation order. - // - if (Pool->ObjFreeList) { - void *PoolBase = Pool->Slabs; - FreedNodeHeader<PoolTraits> *ObjFNH = - PoolTraits::IndexToFNHPtr(Pool->ObjFreeList, PoolBase); - - if ((char*)ObjFNH + sizeof(NodeHeader<PoolTraits>) + - ObjFNH->Header.Size == (char*)FNH) { - // Merge this with a node that is already on the object size free list. - // Because the object is growing, we will never be able to find it if we - // leave it on the object freelist. - UnlinkFreeNode(Pool, ObjFNH); - ObjFNH->Header.Size += Size+sizeof(NodeHeader<PoolTraits>); - AddNodeToFreeList(Pool, ObjFNH); - return; - } - } - - if (Pool->OtherFreeList) { - void *PoolBase = Pool->Slabs; - FreedNodeHeader<PoolTraits> *OFNH = - PoolTraits::IndexToFNHPtr(Pool->OtherFreeList, PoolBase); - - if ((char*)OFNH + sizeof(NodeHeader<PoolTraits>) + - OFNH->Header.Size == (char*)FNH) { - // Merge this with a node that is already on the object size free list. - OFNH->Header.Size += Size+sizeof(NodeHeader<PoolTraits>); - return; - } - } - - FNH->Header.Size = Size; - AddNodeToFreeList(Pool, FNH); - return; - -LargeArrayCase: - LargeArrayHeader *LAH = ((LargeArrayHeader*)Node)-1; - DO_IF_TRACE(fprintf(stderr, "%d bytes [large]\n", LAH->Size)); - DO_IF_PNP(CurHeapSize -= LAH->Size); - - // Unlink it from the list of large arrays and free it. - LAH->UnlinkFromList(); - free(LAH); -} - -template<typename PoolTraits> -static void *poolrealloc_internal(PoolTy<PoolTraits> *Pool, void *Node, - unsigned NumBytes) { - DO_IF_TRACE(fprintf(stderr, "[%d] poolrealloc%s(0x%X, %d) -> ", - getPoolNumber(Pool), PoolTraits::getSuffix(), - Node, NumBytes)); - - // If a null pool descriptor is passed in, this is not a pool allocated data - // structure. Hand off to the system realloc. - if (Pool == 0) { - void *Result = realloc(Node, NumBytes); - DO_IF_TRACE(fprintf(stderr, "0x%X (system realloc)\n", Result)); - return Result; - } - if (Node == 0) return poolalloc_internal(Pool, NumBytes); - if (NumBytes == 0) { - poolfree_internal(Pool, Node); - DO_IF_TRACE(fprintf(stderr, "freed\n")); - return 0; - } - - FreedNodeHeader<PoolTraits> *FNH = - (FreedNodeHeader<PoolTraits>*)((char*)Node-sizeof(NodeHeader<PoolTraits>)); - assert((FNH->Header.Size & 1) && "Node not allocated!"); - unsigned Size = FNH->Header.Size & ~1; - if (Size != ~1U) { - // FIXME: This is obviously much worse than it could be. In particular, we - // never try to expand something in a pool. This might hurt some programs! - void *New = poolalloc_internal(Pool, NumBytes); - assert(New != 0 && "Our poolalloc doesn't ever return null for failure!"); - - // Copy the min of the new and old sizes over. - memcpy(New, Node, Size < NumBytes ? Size : NumBytes); - poolfree_internal(Pool, Node); - DO_IF_TRACE(fprintf(stderr, "0x%X (moved)\n", New)); - return New; - } - - // Otherwise, we have a large array. Perform the realloc using the system - // realloc function. This case is actually quite common as many large blocks - // end up being realloc'd it seems. - LargeArrayHeader *LAH = ((LargeArrayHeader*)Node)-1; - LAH->UnlinkFromList(); - - LargeArrayHeader *NewLAH = - (LargeArrayHeader*)realloc(LAH, sizeof(LargeArrayHeader)+NumBytes); - - DO_IF_TRACE(if (LAH == NewLAH) - fprintf(stderr, "resized in place (system realloc)\n"); - else - fprintf(stderr, "0x%X (moved by system realloc)\n", NewLAH+1)); - NewLAH->LinkIntoList(&Pool->LargeArrays); - return NewLAH+1; -} - -unsigned poolobjsize(PoolTy<NormalPoolTraits> *Pool, void *Node) { - if (Node == 0) return 0; - - // If a null pool descriptor is passed in, this is not a pool allocated data - // structure. We don't really have any way to service this!! - if (Pool == 0) { - fprintf(stderr, "ERROR: Cannot call poolobjsize on a pool that is getting" - " memory from the heap. Sorry!\n"); - abort(); - } - - // Check to see how many bytes were allocated to this node. - FreedNodeHeader<NormalPoolTraits> *FNH = - (FreedNodeHeader<NormalPoolTraits>*)((char*)Node - - sizeof(NodeHeader<NormalPoolTraits>)); - assert((FNH->Header.Size & 1) && "Node not allocated!"); - unsigned Size = FNH->Header.Size & ~1; - if (Size != ~1U) return Size; - - // Otherwise, we have a large array. - LargeArrayHeader *LAH = ((LargeArrayHeader*)Node)-1; - return LAH->Size; -} - - -void *poolalloc(PoolTy<NormalPoolTraits> *Pool, unsigned NumBytes) { - DO_IF_FORCE_MALLOCFREE(return malloc(NumBytes)); - return poolalloc_internal(Pool, NumBytes); -} - -void *poolmemalign(PoolTy<NormalPoolTraits> *Pool, - unsigned Alignment, unsigned NumBytes) { - //punt and use pool alloc. - //I don't know if this is safe or breaks any assumptions in the runtime - intptr_t base = (intptr_t)poolalloc_internal(Pool, NumBytes + Alignment - 1); - return (void*)((base + (Alignment - 1)) & ~((intptr_t)Alignment -1)); -} - -void poolfree(PoolTy<NormalPoolTraits> *Pool, void *Node) { - DO_IF_FORCE_MALLOCFREE(free(Node); return); - poolfree_internal(Pool, Node); -} - -void *poolrealloc(PoolTy<NormalPoolTraits> *Pool, void *Node, - unsigned NumBytes) { - DO_IF_FORCE_MALLOCFREE(return realloc(Node, NumBytes)); - return poolrealloc_internal(Pool, Node, NumBytes); -} - - - -//===----------------------------------------------------------------------===// -// Pointer Compression runtime library. Most of these are just wrappers -// around the normal pool routines. -//===----------------------------------------------------------------------===// - -// For now, use address space reservation of 256MB. -#define POOLSIZE (256*1024*1024) - -// Pools - When we are done with a pool, don't munmap it, keep it around for -// next time. -static PoolSlab<CompressedPoolTraits> *Pools[4] = { 0, 0, 0, 0 }; - -void *poolinit_pc(PoolTy<CompressedPoolTraits> *Pool, - unsigned DeclaredSize, unsigned ObjAlignment) { - poolinit_internal(Pool, DeclaredSize, ObjAlignment); - - // The number of nodes to stagger in the mmap'ed pool - static unsigned stagger=0; - - // Create the pool. We have to do this eagerly (instead of on the first - // allocation), because code may want to eagerly copy the pool base into a - // register. - - // If we already have a pool mapped, reuse it. - for (unsigned i = 0; i != 4; ++i) - if (Pools[i]) { - Pool->Slabs = Pools[i]; - Pools[i] = 0; - break; - } - - // - // Wrap the stagger value back to zero if we're past the size of the pool. - // This way, we always reserve less than 2*POOLSIZE of the virtual address - // space. - // - if ((stagger * DeclaredSize) >= POOLSIZE) - stagger = 0; - - if (Pool->Slabs == 0) { - // - // Didn't find an existing pool, create one. - // - // To create a pool, we stagger the beginning of the pool so that pools - // do not end up starting on the same page boundary (creating extra cache - // conflicts). - // - Pool->Slabs = (PoolSlab<CompressedPoolTraits>*) - AllocateSpaceWithMMAP(POOLSIZE + (DeclaredSize * stagger), true); - Pool->Slabs += (DeclaredSize * stagger); - - // Increase the stagger amount by one node. - stagger++; - DO_IF_TRACE(fprintf(stderr, "RESERVED ADDR SPACE: %p -> %p\n", - Pool->Slabs, (char*)Pool->Slabs+POOLSIZE)); - } - PoolSlab<CompressedPoolTraits>::create_for_ptrcomp(Pool, Pool->Slabs, - POOLSIZE); - return Pool->Slabs; -} - -void pooldestroy_pc(PoolTy<CompressedPoolTraits> *Pool) { - assert(Pool && "Null pool pointer passed in to pooldestroy!\n"); - if (Pool->Slabs == 0) - return; // no memory allocated from this pool. - - unsigned PID; -#ifdef ENABLE_POOL_IDS - PID = removePoolNumber(Pool); -#endif - DO_IF_TRACE(fprintf(stderr, "[%d] pooldestroy_pc", PID)); - DO_IF_POOLDESTROY_STATS(PrintPoolStats(Pool)); - - // If there is space to remember this pool, do so. - for (unsigned i = 0; i != 4; ++i) - if (Pools[i] == 0) { - Pools[i] = Pool->Slabs; - return; - } - - // Otherwise, just munmap it. - DO_IF_TRACE(fprintf(stderr, "UNMAPPING ADDR SPACE: %p -> %p\n", - Pool->Slabs, (char*)Pool->Slabs+POOLSIZE)); - munmap(Pool->Slabs, POOLSIZE); -} - -unsigned long long poolalloc_pc(PoolTy<CompressedPoolTraits> *Pool, - unsigned NumBytes) { - void *Result = poolalloc_internal(Pool, NumBytes); - return (char*)Result-(char*)Pool->Slabs; -} - -void poolfree_pc(PoolTy<CompressedPoolTraits> *Pool, unsigned long long Node) { - poolfree_internal(Pool, (char*)Pool->Slabs+Node); -} - -unsigned long long poolrealloc_pc(PoolTy<CompressedPoolTraits> *Pool, - unsigned long long Node, unsigned NumBytes) { - void *Result = poolrealloc_internal(Pool, (char*)Pool->Slabs+Node, NumBytes); - return (char*)Result-(char*)Pool->Slabs; -} - -// Alternate Pointer Compression -void *poolinit_pca(PoolTy<CompressedPoolTraits> *Pool, unsigned NodeSize, - unsigned ObjAlignment) -{ - return poolinit_pc(Pool, NodeSize, ObjAlignment); -} - -void pooldestroy_pca(PoolTy<CompressedPoolTraits> *Pool) -{ - pooldestroy_pc(Pool); -} - -void* poolalloc_pca(PoolTy<CompressedPoolTraits> *Pool, unsigned NumBytes) -{ - return poolalloc_internal(Pool, NumBytes); -} - -void poolfree_pca(PoolTy<CompressedPoolTraits> *Pool, void* Node) -{ - poolfree_internal(Pool, Node); -} - -void* poolrealloc_pca(PoolTy<CompressedPoolTraits> *Pool, void* Node, - unsigned NumBytes) -{ - return poolrealloc_internal(Pool, Node, NumBytes); -} - -//===----------------------------------------------------------------------===// -// Access Tracing Runtime Library Support -//===----------------------------------------------------------------------===// - -static FILE *FD = 0; -void poolaccesstraceinit() { -#ifdef ALWAYS_USE_MALLOC_FREE - FD = fopen("trace.malloc.csv", "w"); -#else - FD = fopen("trace.pa.csv", "w"); -#endif -} - -#define NUMLRU 2 -static void *LRUWindow[NUMLRU]; - -void poolaccesstrace(void *Ptr, void *PD) { - static unsigned Time = ~0U; - static void *LastPtr = 0; - - // Not pool memory? - if (PD == 0) return; - - // Filter out stuff that is not to the heap. - ++Time; - if ((uintptr_t)Ptr > 1000000000UL) - return; - - Ptr = (void*)((intptr_t)Ptr & ~31L); - -#if 1 - // Drop duplicate points. - for (unsigned i = 0; i != NUMLRU; ++i) - if (Ptr == LRUWindow[i]) { - memmove(LRUWindow+1, LRUWindow, sizeof(void*)*i); - LRUWindow[0] = Ptr; - return; - } - - // Rotate LRU window. - memmove(LRUWindow+1, LRUWindow, sizeof(void*)*(NUMLRU-1)); - LRUWindow[0] = Ptr; -#endif - - // Delete many points to reduce data. - static unsigned int Ctr; - if ((++Ctr & 31)) return; - - - fprintf(FD, "%d", Time); -#if defined(ENABLE_POOL_IDS) - for (unsigned PID = getPoolNumber(PD)+1; PID; --PID) - fprintf(FD,"\t?"); -#else - fprintf(FD, "\t%p ", PD); -#endif - fprintf(FD, "\t%lu\n", (intptr_t)Ptr); -}
diff --git a/poolalloc/runtime/FL2Allocator/PoolAllocator.h b/poolalloc/runtime/FL2Allocator/PoolAllocator.h deleted file mode 100644 index 402b4f1..0000000 --- a/poolalloc/runtime/FL2Allocator/PoolAllocator.h +++ /dev/null
@@ -1,235 +0,0 @@ -//===- PoolAllocator.h - Pool allocator runtime interface file --*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the interface which is implemented by the LLVM pool -// allocator runtime library. -// -// Note: Most of this runtime library is templated based on a PoolTraits -// instance. This allows the normal pool allocator to use standard pointers and -// long's to represent things, but allows the pointer compression runtime -// library use pool indexes which are smaller. Using smaller indexes reduces -// the minimum object size on a 64-bit system from 16 to 8 bytes, and reduces -// the object header size to 4 bytes (from 8). -// -//===----------------------------------------------------------------------===// - -#ifndef POOLALLOCATOR_RUNTIME_H -#define POOLALLOCATOR_RUNTIME_H - -#include <assert.h> - -template<typename PoolTraits> -struct PoolSlab; -template<typename PoolTraits> -struct FreedNodeHeader; - -// NormalPoolTraits - This describes normal pool allocation pools, which can -// address the entire heap, and are made out of multiple chunks of memory. The -// object header is a full machine word, and pointers into the heap are native -// pointers. -struct NormalPoolTraits { - typedef unsigned long NodeHeaderType; - enum { - UseLargeArrayObjects = 1, - CanGrowPool = 1 - }; - - // Pointers are just pointers. - typedef FreedNodeHeader<NormalPoolTraits>* FreeNodeHeaderPtrTy; - - static const char *getSuffix() { return ""; } - - /// DerefFNHPtr - Given an index into the pool, return a pointer to the - /// FreeNodeHeader object. - static FreedNodeHeader<NormalPoolTraits>* - IndexToFNHPtr(FreeNodeHeaderPtrTy P, void *PoolBase) { - return P; - } - - static FreeNodeHeaderPtrTy - FNHPtrToIndex(FreedNodeHeader<NormalPoolTraits>* FNHP, void *PoolBase) { - return FNHP; - } -}; - - -// CompressedPoolTraits - This describes a statically pointer compressed pool, -// which is known to be <= 2^32 bytes in size (even on a 64-bit machine), and is -// made out of a single contiguous block. The meta-data to represent the pool -// uses 32-bit indexes from the start of the pool instead of full pointers to -// decrease the minimum object size. -struct CompressedPoolTraits { - typedef unsigned NodeHeaderType; - - enum { - UseLargeArrayObjects = 0, - CanGrowPool = 0 - }; - - // Represent pointers with indexes from the pool base. - typedef unsigned FreeNodeHeaderPtrTy; - - static const char *getSuffix() { return "_pc"; } - - /// DerefFNHPtr - Given an index into the pool, return a pointer to the - /// FreeNodeHeader object. - static FreedNodeHeader<CompressedPoolTraits>* - IndexToFNHPtr(FreeNodeHeaderPtrTy P, void *PoolBase) { - return (FreedNodeHeader<CompressedPoolTraits>*)((char*)PoolBase + P); - } - - static FreeNodeHeaderPtrTy - FNHPtrToIndex(FreedNodeHeader<CompressedPoolTraits>* FNHP, void *PoolBase) { - assert(FNHP && PoolBase && "Can't handle null FHNP!"); - return (char*)FNHP - (char*)PoolBase; - } -}; - - -// NodeHeader - Each block of memory is preceeded in the the pool by one of -// these headers. -template<typename PoolTraits> -struct NodeHeader { - typename PoolTraits::NodeHeaderType Size; -}; - - -// When objects are on the free list, we pretend they have this header. -template<typename PoolTraits> -struct FreedNodeHeader { - // NormalHeader - This is the normal node header that is on allocated or free - // blocks. - NodeHeader<PoolTraits> Header; - - // Next - The next object in the free list. - typename PoolTraits::FreeNodeHeaderPtrTy Next; - - // Prev - The node that points to this node on the free list. This is null - // if it is the first node in one of the two free lists. - typename PoolTraits::FreeNodeHeaderPtrTy Prev; -}; - - -// Large Arrays are passed on to directly malloc, and are not necessarily page -// aligned. These arrays are marked by setting the object size preheader to ~1. -// LargeArrays are on their own list to allow for efficient deletion. -struct LargeArrayHeader { - LargeArrayHeader **Prev, *Next; - - // Size - This contains the size of the object. - unsigned long Size; - - // Marker: this is the ObjectSize marker which MUST BE THE LAST ELEMENT of - // this header! - unsigned long Marker; - - void UnlinkFromList() { - *Prev = Next; - if (Next) - Next->Prev = Prev; - } - - void LinkIntoList(LargeArrayHeader **List) { - Next = *List; - if (Next) - Next->Prev = &Next; - *List = this; - Prev = List; - } -}; - - -template<typename PoolTraits> -struct PoolTy { - // Slabs - the list of slabs in this pool. NOTE: This must remain the first - // memory of this structure for the pointer compression pass. - PoolSlab<PoolTraits> *Slabs; - - // The free node lists for objects of various sizes. - typename PoolTraits::FreeNodeHeaderPtrTy ObjFreeList; - typename PoolTraits::FreeNodeHeaderPtrTy OtherFreeList; - - // Alignment - The required alignment of allocations the pool in bytes. - unsigned Alignment; - - // The declared size of the pool, just kept for the record. - unsigned DeclaredSize; - - // LargeArrays - A doubly linked list of large array chunks, dynamically - // allocated with malloc. - LargeArrayHeader *LargeArrays; - - // The size to allocate for the next slab. - unsigned AllocSize; - - // NumObjects - the number of poolallocs for this pool. - unsigned NumObjects; - - // BytesAllocated - The total number of bytes ever allocated from this pool. - // Together with NumObjects, allows us to calculate average object size. - unsigned BytesAllocated; -}; - -extern "C" { - void poolinit(PoolTy<NormalPoolTraits> *Pool, - unsigned DeclaredSize, unsigned ObjAlignment); - void poolmakeunfreeable(PoolTy<NormalPoolTraits> *Pool); - void pooldestroy(PoolTy<NormalPoolTraits> *Pool); - void *poolalloc(PoolTy<NormalPoolTraits> *Pool, unsigned NumBytes); - void *poolrealloc(PoolTy<NormalPoolTraits> *Pool, - void *Node, unsigned NumBytes); - void *poolmemalign(PoolTy<NormalPoolTraits> *Pool, - unsigned Alignment, unsigned NumBytes); - void poolfree(PoolTy<NormalPoolTraits> *Pool, void *Node); - - /// poolobjsize - Return the size of the object at the specified address, in - /// the specified pool. Note that this cannot be used in normal cases, as it - /// is completely broken if things land in the system heap. Perhaps in the - /// future. :( - /// - unsigned poolobjsize(PoolTy<NormalPoolTraits> *Pool, void *Node); - - // Bump pointer pool library. This is a pool implementation that does not - // support frees or reallocs to the pool. As such, it can be much more - // efficient and simpler than a general pool implementation. - void poolinit_bp(PoolTy<NormalPoolTraits> *Pool, unsigned ObjAlignment); - void *poolalloc_bp(PoolTy<NormalPoolTraits> *Pool, unsigned NumBytes); - void pooldestroy_bp(PoolTy<NormalPoolTraits> *Pool); - - - // Pointer Compression runtime library. Most of these are just wrappers - // around the normal pool routines. - void *poolinit_pc(PoolTy<CompressedPoolTraits> *Pool, unsigned NodeSize, - unsigned ObjAlignment); - void pooldestroy_pc(PoolTy<CompressedPoolTraits> *Pool); - unsigned long long poolalloc_pc(PoolTy<CompressedPoolTraits> *Pool, - unsigned NumBytes); - void poolfree_pc(PoolTy<CompressedPoolTraits> *Pool, unsigned long long Node); - //void *poolmemalign_pc(PoolTy *Pool, unsigned Alignment, unsigned NumBytes); - unsigned long long poolrealloc_pc(PoolTy<CompressedPoolTraits> *Pool, - unsigned long long Node, unsigned NumBytes); - - // Alternate Pointer Compression runtime library. Most of these are just - // wrappers around the normal pool routines. - void *poolinit_pca(PoolTy<CompressedPoolTraits> *Pool, unsigned NodeSize, - unsigned ObjAlignment); - void pooldestroy_pca(PoolTy<CompressedPoolTraits> *Pool); - void* poolalloc_pca(PoolTy<CompressedPoolTraits> *Pool, - unsigned NumBytes); - void poolfree_pca(PoolTy<CompressedPoolTraits> *Pool, void* Node); - void* poolrealloc_pca(PoolTy<CompressedPoolTraits> *Pool, - void* Node, unsigned NumBytes); - - // Access tracing runtime library support. - void poolaccesstraceinit(void); - void poolaccesstrace(void *Ptr, void *PD); -} - -#endif -
diff --git a/poolalloc/runtime/FreeListAllocator/Makefile b/poolalloc/runtime/FreeListAllocator/Makefile deleted file mode 100644 index c47e306..0000000 --- a/poolalloc/runtime/FreeListAllocator/Makefile +++ /dev/null
@@ -1,5 +0,0 @@ -LEVEL = ../.. -SHARED_LIBRARY=1 -LIBRARYNAME=poolalloc_fl_rt - -include $(LEVEL)/Makefile.common
diff --git a/poolalloc/runtime/FreeListAllocator/PageManager.cpp b/poolalloc/runtime/FreeListAllocator/PageManager.cpp deleted file mode 100644 index 67d91e2..0000000 --- a/poolalloc/runtime/FreeListAllocator/PageManager.cpp +++ /dev/null
@@ -1,97 +0,0 @@ -//===- PageManager.cpp - Implementation of the page allocator -------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the PageManager.h interface. -// -//===----------------------------------------------------------------------===// - -#include "PageManager.h" -#ifndef _POSIX_MAPPED_FILES -#define _POSIX_MAPPED_FILES -#endif -#include <unistd.h> -#include "poolalloc/MMAPSupport.h" -#include "poolalloc/Support/MallocAllocator.h" -#include <vector> -#include <iostream> - -// Define this if we want to use memalign instead of mmap to get pages. -// Empirically, this slows down the pool allocator a LOT. -#define USE_MEMALIGN 0 - -unsigned PageSize = 4096; - -// Explicitly use the malloc allocator here, to avoid depending on the C++ -// runtime library. -typedef std::vector<void*, llvm::MallocAllocator<void*> > FreePagesListType; -static FreePagesListType *FreePages = 0; - -// -// Function: InitializePageManager () -// -// Description: -// This function initializes the Page Manager code. It must be called before -// any other Page Manager functions are called. -// -unsigned int InitializePageManager() { - if (!PageSize) { - PageSize = sysconf(_SC_PAGESIZE); - FreePages = 0; - } - return PageSize; -} - -/// -/// Function: AllocatePage () -/// -/// Description: -/// This function returns a chunk of memory with size and alignment specified -/// by PageSize. -void *AllocatePage() { -#if USE_MEMALIGN - void *Addr; - posix_memalign(&Addr, PageSize, PageSize); - return Addr; -#else - // - // Try to allocate a page that has already been created. - // - if (FreePages && !FreePages->empty()) { - void *Result = FreePages->back(); - FreePages->pop_back(); - return Result; - } - - // Allocate several pages, and put the extras on the freelist... - unsigned NumToAllocate = 8; - char *Ptr = (char*)AllocateSpaceWithMMAP(PageSize*NumToAllocate); - - if (!FreePages) { - // Avoid using operator new! - FreePages = (FreePagesListType*)malloc(sizeof(FreePagesListType)); - // Use placement new now. - new (FreePages) std::vector<void*, llvm::MallocAllocator<void*> >(); - } - for (unsigned i = 1; i != NumToAllocate; ++i) - FreePages->push_back(Ptr+i*PageSize); - return Ptr; -#endif -} - - -/// FreePage - This function returns the specified page to the pagemanager for -/// future allocation. -void FreePage(void *Page) { -#if USE_MEMALIGN - free(Page); -#else - assert(FreePages && "No pages allocated!"); - FreePages->push_back(Page); -#endif -}
diff --git a/poolalloc/runtime/FreeListAllocator/PageManager.h b/poolalloc/runtime/FreeListAllocator/PageManager.h deleted file mode 100644 index a04b3da..0000000 --- a/poolalloc/runtime/FreeListAllocator/PageManager.h +++ /dev/null
@@ -1,41 +0,0 @@ -//===- PageManager.h - Allocates memory on page boundaries ------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the interface used by the pool allocator to allocate memory -// on large alignment boundaries. -// -//===----------------------------------------------------------------------===// - -#ifndef PAGEMANAGER_H -#define PAGEMANAGER_H - -/// InitializePageManager - This function must be called before any other page -/// manager accesses are performed. It may be called multiple times. -/// -unsigned int InitializePageManager(); - -/// PageSize - Contains the size of the unit of memory allocated by -/// AllocatePage. This is a value that is typically several kilobytes in size, -/// and is guaranteed to be a power of two. -/// -extern unsigned PageSize; - -/// AllocatePage - This function returns a chunk of memory with size and -/// alignment specified by getPageSize(). -void *AllocatePage(); - -/// FreePage - This function returns the specified page to the pagemanager for -/// future allocation. -void FreePage(void *Page); - -/// GetPages - Just allocate the specified pages on a page boundary. This is -/// a hack for large arrays. -void * GetPages (unsigned NumPages); - -#endif
diff --git a/poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp b/poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp deleted file mode 100644 index fa1dae6..0000000 --- a/poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp +++ /dev/null
@@ -1,463 +0,0 @@ -//===- PoolAllocatorChained.cpp - Implementation of poolallocator runtime -===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file is yet another implementation of the LLVM pool allocator runtime -// library. -// -//===----------------------------------------------------------------------===// - -#include "PoolAllocator.h" -#include "PageManager.h" -#include "PoolSlab.h" -#include <assert.h> -#include <stdlib.h> -#include <stdio.h> - -#include "llvm/Support/DataTypes.h" - -//===----------------------------------------------------------------------===// -// -// PoolSlab implementation -// -//===----------------------------------------------------------------------===// - -// -// Function: createSlab () -// -// Description: -// Allocate memory for a new slab and initialize the slab. -// -struct SlabHeader * -createSlab (PoolTy * Pool, unsigned int NodesPerSlab = 0) -{ - // Maximum number of nodes per page - unsigned int MaxNodesPerPage = Pool->MaxNodesPerPage; - - // Pointer to the new Slab - struct SlabHeader * NewSlab; - - // Save locally the node size - unsigned int NodeSize = Pool->NodeSize; - - // - // If we can't fit a node into a page, give up. - // - if (NodeSize > PageSize) - { - fprintf (stderr, "Node size %d is larger than page size %d.\n", NodeSize, PageSize); - fflush (stderr); - abort(); - } - - if (MaxNodesPerPage == 0) - { - fprintf (stderr, "Node size is too large\n"); - fflush (stderr); - abort(); - } - - // - // Allocate the memory for the slab and initialize its contents. - // - if (NodesPerSlab > MaxNodesPerPage) - { - unsigned NumBytes = sizeof(SlabHeader) + NodeSize * NodesPerSlab; - NumBytes += NodesPerSlab * sizeof (NodePointer); - NewSlab = (struct SlabHeader *)GetPages((NumBytes+PageSize-1)/PageSize); - if (NewSlab == NULL) - { - fprintf (stderr, "Failed large allocation\n"); - fflush (stderr); - abort(); - } - NewSlab->IsArray = 1; - NewSlab->IsManaged = 0; - } - else - { - NewSlab = (struct SlabHeader *) AllocatePage (); - if (NewSlab == NULL) - { - fprintf (stderr, "Failed regular allocation\n"); - fflush (stderr); - abort(); - } - NewSlab->IsArray = 0; - NewSlab->IsManaged = 1; - - // - // Bump the number of nodes in the slab up to the maximum. - // - if (NodesPerSlab == 0) - { - NodesPerSlab = MaxNodesPerPage; - } - } - NewSlab->NodesPerSlab = NodesPerSlab; - NewSlab->NextFreeData = NewSlab->LiveNodes = 0; - NewSlab->Next = NULL; - NewSlab->Data = (unsigned char *)NewSlab + sizeof (struct SlabHeader) + ((NodesPerSlab) * sizeof (NodePointer)); - return NewSlab; -} - -// -// Function: BlockOwner () -// -// Description: -// Find the slab that owns this block. -// -inline struct SlabHeader * -BlockOwner (unsigned int PageSize, NodePointer p) -{ - // - // Convert the node pointer into a slab pointer. - // - return reinterpret_cast<struct SlabHeader *>(reinterpret_cast<intptr_t>(p.Next) & ~(PageSize - 1)); -} - -// -// Function: DataOwner () -// -// Description: -// This function finds the slab that owns this data block. -// -inline struct SlabHeader * -DataOwner (unsigned int PageSize, void * p) -{ - return reinterpret_cast<struct SlabHeader *>(reinterpret_cast<intptr_t>(p) & ~(PageSize - 1)); -} - -//===----------------------------------------------------------------------===// -// -// Pool allocator library implementation -// -//===----------------------------------------------------------------------===// - -// -// Function: poolinit () -// -// Description: -// Initialize a pool descriptor for a new pool. -// -// Inputs: -// NodeSize - The typical size allocated for this pool. -// -// Outputs: -// Pool - An initialized pool. -// -void -poolinit (PoolTy *Pool, unsigned int NodeSize) -{ - assert(Pool && "Null pool pointer passed into poolinit!\n"); - - // We must alway return unique pointers, even if they asked for 0 bytes - Pool->NodeSize = NodeSize ? NodeSize : 1; - Pool->Slabs = Pool->ArraySlabs = Pool->FastArray = NULL; - Pool->FreeList.Next = NULL; -#if 0 - Pool->FreeablePool = 1; -#endif /* 0 */ - - // Calculate once for this pool the maximum number of nodes per page - Pool->MaxNodesPerPage = (PageSize - sizeof (struct SlabHeader)) / (sizeof (NodePointer) + NodeSize); - - // - // Initialize the page manager. - // - InitializePageManager (); - - return; -} - -void -poolmakeunfreeable(PoolTy *Pool) -{ - assert(Pool && "Null pool pointer passed in to poolmakeunfreeable!\n"); -#if 0 - Pool->FreeablePool = 0; -#endif -} - -// pooldestroy - Release all memory allocated for a pool -// -void -pooldestroy(PoolTy *Pool) -{ - // Pointer to scan Slab list - struct SlabHeader * Slabp; - struct SlabHeader * Nextp; - - assert(Pool && "Null pool pointer passed in to pooldestroy!\n"); - - // - // Deallocate all of the pages. - // - Slabp = Pool->Slabs; - while (Slabp != NULL) - { - // Record the next step - Nextp = Slabp->Next; - - // Deallocate the memory if it is managed. - if (Slabp->IsManaged) - { - FreePage (Slabp); - } - - // Move to the next node. - Slabp = Nextp; - } - - return; -} - -// -// Function: poolallocarray () -// -// Description: -// Allocate an array of contiguous nodes. -// -// Inputs: -// Pool - The pool from which to allocate memory. -// ArraySize - The size of the array in number of elements (not bytes). -// -static void * -poolallocarray(PoolTy* Pool, unsigned ArraySize) -{ - assert(Pool && "Null pool pointer passed into poolallocarray!\n"); - - // - // Scan the list of array slabs to see if there is one that fits. - // - struct SlabHeader * Slabp = Pool->FastArray; - struct SlabHeader ** Prevp = &(Pool->ArraySlabs); - - // - // Check to see if we have an array slab that has extra space that we - // can use. - // - if ((Slabp != NULL) && - ((Pool->MaxNodesPerPage - Slabp->NextFreeData) >= ArraySize)) - { - // - // Increase the reference count for this slab. - // - Slabp->LiveNodes++; - - // - // Find the data for the caller. - // - void * Data = (Slabp->Data + (Pool->NodeSize * Slabp->NextFreeData)); - - // - // Disconnect the array slab if it is full. - // - if (((Slabp->NextFreeData) += ArraySize) >= Pool->MaxNodesPerPage) - { - Pool->FastArray = NULL; - } - - return (Data); - } - - // - // Scan through all the free array slabs to see if they are large - // enough. - // - for (Slabp = Pool->ArraySlabs; Slabp != NULL; Slabp=Slabp->Next) - { - // - // Check to see if this slab has enough room. - // - if (Slabp->NodesPerSlab >= ArraySize) - { - // - // Make the previous node point to the next node. - // - (*Prevp)->Next = Slabp->Next; - - // - // Increase the reference count of the slab. - // - ++(Slabp->LiveNodes); - - // - // Adjust the slab's index of data blocks. - // - Slabp->NextFreeData = ArraySize; - - // - // Return the slab's data. - // - return (Slabp->Data); - } - - // - // Move on to the next node. - // - Prevp = &(Slabp->Next); - } - - // - // Create a new slab and mark it as an array. - // - Slabp = createSlab (Pool, ArraySize); - Slabp->IsArray = 1; - Slabp->LiveNodes = 1; - Slabp->NextFreeData = ArraySize; - - // - // If the array has some space, link it into the array "free" list. - // - if ((Slabp->IsManaged == 1) && (Slabp->NextFreeData != Pool->MaxNodesPerPage)) - { - Pool->FastArray = Slabp; - } - - // - // Return the list of blocks to the caller. - // - return (Slabp->Data); -} - - -// -// Function: poolalloc () -// -// Description: -// Allocates memory from the pool. Typically, we will allocate memory -// in the same size chunks as we usually do, but sometimes, we will have to -// allocate more. -// -void * -poolalloc(PoolTy *Pool, unsigned BytesWanted) -{ - // Pointer to the data block to return - void * Data; - - // Slab Pointer - struct SlabHeader * Slabp; - - assert(Pool && "Null pool pointer passed in to poolalloc!\n"); - - // Make sure we allocate something - BytesWanted = (BytesWanted ? BytesWanted : 1); - - // - // Determine if we can satisfy this request normally. If not, then - // we need to use the array allocation instead. - // - if (Pool->NodeSize < BytesWanted) - { - return (poolallocarray (Pool, (BytesWanted+Pool->NodeSize-1)/Pool->NodeSize)); - } - - // - // If we don't have a slab, this is our first initialization. Do some - // quick stuff. - // - Slabp = Pool->Slabs; - if (Slabp == NULL) - { - Pool->Slabs = Slabp = createSlab (Pool); - (Slabp->NextFreeData)++; - return (Slabp->Data); - } - - // - // Determine whether we can allocate from the current slab. - // - if (Slabp->NextFreeData < Slabp->NodesPerSlab) - { - // - // Return the block and increment the index of the next free data block. - // - Data = (Slabp->Data + (Pool->NodeSize * Slabp->NextFreeData)); - (Slabp->NextFreeData)++; - return (Data); - } - - // - // We have a slab, but it doesn't have any new blocks. - // Check the free list to see if we can use any recycled blocks. - // - if (Pool->FreeList.Next == NULL) - { - // - // Create a new slab and add it to the list. - // - Slabp = createSlab (Pool); - Slabp->Next = Pool->Slabs; - Pool->Slabs = Slabp; - - (Slabp->NextFreeData)++; - - // - // Return the block and increment the index of the next free data block. - // - return (Slabp->Data); - } - - // - // Determine which slab owns this block. - // - Slabp = BlockOwner (PageSize, Pool->FreeList); - - // - // Find the data block that corresponds with this pointer. - // - Data = (Slabp->Data + (Pool->NodeSize * (Pool->FreeList.Next - &(BlockList(Slabp)[0])))); - - // - // Unlink the first block. - // - Pool->FreeList.Next = Pool->FreeList.Next->Next; - - return Data; -} - -void -poolfree (PoolTy * Pool, void * Block) -{ - assert(Pool && "Null pool pointer passed in to poolfree!\n"); - assert(Block && "Null block pointer passed in to poolfree!\n"); - - // - // Find the header of the memory block. - // - struct SlabHeader * slabp = DataOwner (PageSize, Block); - - // - // If the owning slab is an array, add it back to the free array list. - // - if (slabp->IsArray) - { - if ((--slabp->LiveNodes) == 0) - { - slabp->Next = Pool->ArraySlabs; - Pool->ArraySlabs = slabp; - } - return; - } - - // - // Find the node pointer that corresponds to this data block. - // - NodePointer Node; - Node.Next = &(BlockList(slabp)[((unsigned char *)Block - slabp->Data)/Pool->NodeSize]); - - // - // Add the node back to the free list. - // - Node.Next->Next = Pool->FreeList.Next; - Pool->FreeList.Next = Node.Next; - - return; -} -
diff --git a/poolalloc/runtime/FreeListAllocator/PoolAllocator.h b/poolalloc/runtime/FreeListAllocator/PoolAllocator.h deleted file mode 100644 index 684889f..0000000 --- a/poolalloc/runtime/FreeListAllocator/PoolAllocator.h +++ /dev/null
@@ -1,60 +0,0 @@ -//===- PoolAllocator.h - Pool allocator runtime interface file --*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the interface which is implemented by the LLVM pool -// allocator runtime library. -// -//===----------------------------------------------------------------------===// - -#ifndef POOLALLOCATOR_RUNTIME_H -#define POOLALLOCATOR_RUNTIME_H - -#include "PoolSlab.h" - -typedef struct PoolTy { -#if 0 - // The size of a page on this system - unsigned int PageSize; -#endif - - // NodeSize - Keep track of the object size tracked by this pool - unsigned NodeSize; - - // Maximum number of nodes per page - unsigned int MaxNodesPerPage; - - // Pointer to the list of slabs allocated for this pool - struct SlabHeader * Slabs; - - // Linked list of slabs used to hold arrays - struct SlabHeader * ArraySlabs; - - // Pointer to the fast alloc array - struct SlabHeader * FastArray; - - // Pointer to the free list of nodes - struct NodePointer FreeList; - -#if 0 - // FreeablePool - Set to false if the memory from this pool cannot be freed - // before destroy. - // - unsigned FreeablePool; -#endif /* 0 */ -} PoolTy; - -extern "C" { - void poolinit(PoolTy *Pool, unsigned NodeSize); - void poolmakeunfreeable(PoolTy *Pool); - void pooldestroy(PoolTy *Pool); - void *poolalloc(PoolTy *Pool, unsigned NodeSize); - void poolfree(PoolTy *Pool, void *Node); -} - -#endif
diff --git a/poolalloc/runtime/FreeListAllocator/PoolSlab.h b/poolalloc/runtime/FreeListAllocator/PoolSlab.h deleted file mode 100644 index 38be39c..0000000 --- a/poolalloc/runtime/FreeListAllocator/PoolSlab.h +++ /dev/null
@@ -1,80 +0,0 @@ -//===- Slab.h - Implementation of poolallocator runtime -------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This header file defines structures used internally by the free list pool -// allocator library. -// -//===----------------------------------------------------------------------===// - -#ifndef _POOLSLAB_H -#define _POOLSLAB_H - -#include "PoolAllocator.h" -#include "PageManager.h" -#include <assert.h> -#include <stdlib.h> - -//===----------------------------------------------------------------------===// -// -// Defintion of Slab Data Structures -// -//===----------------------------------------------------------------------===// - -// -// Provide a pointer type that points to pointers of itself. -// -typedef struct NodePointer -{ - struct NodePointer * Next; -} NodePointer; - -// -// Structure: SlabHeader -// -// Description: -// This structure defines the beginning of a memory slab. A memory slab -// consists of book keeping information, a list of pointers, and a list of -// data blocks. -// -// There is a 1 to 1 correspondence between the pointers and the data blocks. -// Pointer[x] points to Pointer[y] if Data[y] is linked after Data[x] in a -// linked list. In other words, Pointer[x] is the "next" pointer for Data[x]. -// -// The slab is allocated on a page boundary, so it is easy to find match -// pointers to blocks if you know the offset of one of them. -// -struct SlabHeader -{ - // Flags whether this is an array - unsigned char IsArray : 1; - - // Flags whether this is managed by the Page Manager - unsigned char IsManaged : 1; - - // Number of nodes per slab - unsigned int NodesPerSlab; - - // Reference Count - unsigned int LiveNodes; - - // Next free data block - unsigned int NextFreeData; - - // Pointer to the next slab - struct SlabHeader * Next; - - // Pointer to the data area (will be in the same page) - unsigned char * Data; - - // Pointer to the list of nodes - //NodePointer* BlockList; -}; -#define BlockList(x) ((NodePointer*)((char*)x + sizeof(SlabHeader))) - -#endif /* _POOLSLAB_H */
diff --git a/poolalloc/runtime/FreeListAllocator/README.txt b/poolalloc/runtime/FreeListAllocator/README.txt deleted file mode 100644 index faa660a..0000000 --- a/poolalloc/runtime/FreeListAllocator/README.txt +++ /dev/null
@@ -1,3 +0,0 @@ -This implementation of the pool allocator runtime library is not used, -and is kept for historical reasons. Please use the FL2 allocator -instead.
diff --git a/poolalloc/runtime/HeapFrag/HeapFrag.c b/poolalloc/runtime/HeapFrag/HeapFrag.c deleted file mode 100644 index be55f3d..0000000 --- a/poolalloc/runtime/HeapFrag/HeapFrag.c +++ /dev/null
@@ -1,47 +0,0 @@ -/*===- HeapFrag.c - Routine to fragment the heap --------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines a function 'EnsureHeapFragmentation', which is used to -// artificially fragment the heap, to show the value of pool allocator even for -// silly benchmarks that never free memory and thus have no fragmentation at -// all. -// -//===----------------------------------------------------------------------===*/ - -#include <stdlib.h> - -static void **AllocateNodes(unsigned N, unsigned Size) { - void **Spine = (void**)malloc(N*sizeof(void*)); - unsigned i; - for (i = 0; i != N; ++i) - Spine[i] = malloc(Size); - return Spine; -} - -static void DeallocateNodes(void **Spine, unsigned N, unsigned Stride) { - unsigned i; - for (i = 0; i < N; i += Stride) { - free(Spine[i]); - Spine[i] = 0; - } -} - - -void EnsureHeapFragmentation() { - void **DS1 = AllocateNodes(10000, 16); - void **DS2; - void *A, *B, *C; - DeallocateNodes(DS1+9000, 1000, 1); /* Free last elements */ - DS2 = AllocateNodes(40000, 40); - DeallocateNodes(DS1, 9000, 2); - DeallocateNodes(DS2, 40000, 2); - DS1 = AllocateNodes(2000, 8); - DeallocateNodes(DS1, 2000, 2); - DeallocateNodes(DS1, 2000, 3); -}
diff --git a/poolalloc/runtime/HeapFrag/Makefile b/poolalloc/runtime/HeapFrag/Makefile deleted file mode 100755 index 8f7b510..0000000 --- a/poolalloc/runtime/HeapFrag/Makefile +++ /dev/null
@@ -1,9 +0,0 @@ -LEVEL = ../.. -#BYTECODE_LIBRARY=1 -#SHARED_LIBRARY=1 -LIBRARYNAME=heapfrag - -include $(LEVEL)/Makefile.common - -# Always build optimized and debug versions -all:: $(LIBNAME_OBJO) $(LIBNAME_OBJG)
diff --git a/poolalloc/runtime/Makefile b/poolalloc/runtime/Makefile deleted file mode 100644 index 299b463..0000000 --- a/poolalloc/runtime/Makefile +++ /dev/null
@@ -1,11 +0,0 @@ -# -# Relative path to the top of the source tree. -# -LEVEL=.. - -# -# List all of the subdirectories that we will compile. -# -DIRS=FreeListAllocator FL2Allocator - -include $(LEVEL)/Makefile.common
diff --git a/poolalloc/runtime/PoolAllocator/Makefile b/poolalloc/runtime/PoolAllocator/Makefile deleted file mode 100644 index 85cb8fe..0000000 --- a/poolalloc/runtime/PoolAllocator/Makefile +++ /dev/null
@@ -1,8 +0,0 @@ -LEVEL = ../.. -SHARED_LIBRARY=1 -LIBRARYNAME=poolalloc_rt_old - -include $(LEVEL)/Makefile.common - -# Always build optimized and debug versions -all:: $(LIBNAME_OBJO) $(LIBNAME_OBJG)
diff --git a/poolalloc/runtime/PoolAllocator/PageManager.cpp b/poolalloc/runtime/PoolAllocator/PageManager.cpp deleted file mode 100644 index 3eb96bc..0000000 --- a/poolalloc/runtime/PoolAllocator/PageManager.cpp +++ /dev/null
@@ -1,90 +0,0 @@ -//===- PageManager.cpp - Implementation of the page allocator -------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the PageManager.h interface. -// -//===----------------------------------------------------------------------===// - -#include "PageManager.h" -#ifndef _POSIX_MAPPED_FILES -#define _POSIX_MAPPED_FILES -#endif -#include <unistd.h> -#include "poolalloc/MMAPSupport.h" -#include "poolalloc/Support/MallocAllocator.h" -#include <vector> -#include <iostream> - -// Define this if we want to use memalign instead of mmap to get pages. -// Empirically, this slows down the pool allocator a LOT. -#define USE_MEMALIGN 0 - -unsigned PageSize = 0; - -void InitializePageManager() { - if (!PageSize) PageSize = sysconf(_SC_PAGESIZE); -} - -// Explicitly use the malloc allocator here, to avoid depending on the C++ -// runtime library. -typedef std::vector<void*, llvm::MallocAllocator<void*> > FreePagesListType; - -static FreePagesListType &getFreePageList() { - static FreePagesListType *FreePages = 0; - - if (!FreePages) { - // Avoid using operator new! - FreePages = (FreePagesListType*)malloc(sizeof(FreePagesListType)); - // Use placement new now. - new (FreePages) std::vector<void*, llvm::MallocAllocator<void*> >(); - } - return *FreePages; -} - -/// AllocatePage - This function returns a chunk of memory with size and -/// alignment specified by PageSize. -void *AllocatePage() { -#if USE_MEMALIGN - void *Addr; - posix_memalign(&Addr, PageSize, PageSize); - return Addr; -#else - - FreePagesListType &FPL = getFreePageList(); - - if (!FPL.empty()) { - void *Result = FPL.back(); - FPL.pop_back(); - return Result; - } - - // Allocate several pages, and put the extras on the freelist... - unsigned NumToAllocate = 8; - char *Ptr = (char*)AllocateSpaceWithMMAP(NumToAllocate*PageSize); - for (unsigned i = 1; i != NumToAllocate; ++i) - FPL.push_back(Ptr+i*PageSize); - return Ptr; -#endif -} - -void *AllocateNPages(unsigned Num) { - if (Num <= 1) return AllocatePage(); - return AllocateSpaceWithMMAP(Num*PageSize); -} - -/// FreePage - This function returns the specified page to the pagemanager for -/// future allocation. -void FreePage(void *Page) { -#if USE_MEMALIGN - free(Page); -#else - FreePagesListType &FPL = getFreePageList(); - FPL.push_back(Page); -#endif -}
diff --git a/poolalloc/runtime/PoolAllocator/PageManager.h b/poolalloc/runtime/PoolAllocator/PageManager.h deleted file mode 100644 index ec57652..0000000 --- a/poolalloc/runtime/PoolAllocator/PageManager.h +++ /dev/null
@@ -1,40 +0,0 @@ -//===- PageManager.h - Allocates memory on page boundaries ------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the interface used by the pool allocator to allocate memory -// on large alignment boundaries. -// -//===----------------------------------------------------------------------===// - -#ifndef PAGEMANAGER_H -#define PAGEMANAGER_H - -/// InitializePageManager - This function must be called before any other page -/// manager accesses are performed. It may be called multiple times. -/// -void InitializePageManager(); - -/// PageSize - Contains the size of the unit of memory allocated by -/// AllocatePage. This is a value that is typically several kilobytes in size, -/// and is guaranteed to be a power of two. -/// -extern unsigned PageSize; - -/// AllocatePage - This function returns a chunk of memory with size and -/// alignment specified by getPageSize(). -void *AllocatePage(); - -/// AllocateNPages - -void *AllocateNPages(unsigned Num); - -/// FreePage - This function returns the specified page to the pagemanager for -/// future allocation. -void FreePage(void *Page); - -#endif
diff --git a/poolalloc/runtime/PoolAllocator/PoolAllocator.h b/poolalloc/runtime/PoolAllocator/PoolAllocator.h deleted file mode 100644 index 2973908..0000000 --- a/poolalloc/runtime/PoolAllocator/PoolAllocator.h +++ /dev/null
@@ -1,40 +0,0 @@ -//===- PoolAllocator.h - Pool allocator runtime interface file --*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the interface which is implemented by the LLVM pool -// allocator runtime library. -// -//===----------------------------------------------------------------------===// - -#ifndef POOLALLOCATOR_RUNTIME_H -#define POOLALLOCATOR_RUNTIME_H - -typedef struct PoolTy { - // Ptr1, Ptr2 - Implementation specified data pointers. - void *Ptr1, *Ptr2; - - // NodeSize - Keep track of the object size tracked by this pool - unsigned NodeSize; - - // FreeablePool - Set to false if the memory from this pool cannot be freed - // before destroy. - // - unsigned FreeablePool; -} PoolTy; - -extern "C" { - void poolinit(PoolTy *Pool, unsigned NodeSize); - void poolmakeunfreeable(PoolTy *Pool); - void pooldestroy(PoolTy *Pool); - void *poolalloc(PoolTy *Pool, unsigned NumBytes); - void poolfree(PoolTy *Pool, void *Node); - void poolcheck(PoolTy *Pool, void *Node); -} - -#endif
diff --git a/poolalloc/runtime/PoolAllocator/PoolAllocatorBitMask.cpp b/poolalloc/runtime/PoolAllocator/PoolAllocatorBitMask.cpp deleted file mode 100644 index 0ec99b5..0000000 --- a/poolalloc/runtime/PoolAllocator/PoolAllocatorBitMask.cpp +++ /dev/null
@@ -1,725 +0,0 @@ -//===- PoolAllocatorBitMask.cpp - Implementation of poolallocator runtime -===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file is one possible implementation of the LLVM pool allocator runtime -// library. -// -// This uses the 'Ptr1' field to maintain a linked list of slabs that are either -// empty or are partially allocated from. The 'Ptr2' field of the PoolTy is -// used to track a linked list of slabs which are full, ie, all elements have -// been allocated from them. -// -//===----------------------------------------------------------------------===// - -#include "PoolAllocator.h" -#include "PageManager.h" -#include <assert.h> -#include <stdlib.h> -#include <stdio.h> - -//===----------------------------------------------------------------------===// -// -// PoolSlab implementation -// -//===----------------------------------------------------------------------===// - - -// PoolSlab Structure - Hold multiple objects of the current node type. -// Invariants: FirstUnused <= UsedEnd -// -struct PoolSlab { - PoolSlab **PrevPtr, *Next; - bool isSingleArray; // If this slab is used for exactly one array - -private: - // FirstUnused - First empty node in slab - unsigned short FirstUnused; - - // UsedBegin - The first node in the slab that is used. - unsigned short UsedBegin; - - // UsedEnd - 1 past the last allocated node in slab. 0 if slab is empty - unsigned short UsedEnd; - - // NumNodesInSlab - This contains the number of nodes in this slab, which - // effects the size of the NodeFlags vector, and indicates the number of nodes - // which are in the slab. - unsigned short NumNodesInSlab; - - // NodeFlagsVector - This array contains two bits for each node in this pool - // slab. The first (low address) bit indicates whether this node has been - // allocated, and the second (next higher) bit indicates whether this is the - // start of an allocation. - // - // This is a variable sized array, which has 2*NumNodesInSlab bits (rounded up - // to 4 bytes). - unsigned NodeFlagsVector[]; - - bool isNodeAllocated(unsigned NodeNum) { - return NodeFlagsVector[NodeNum/16] & (1 << (NodeNum & 15)); - } - - void markNodeAllocated(unsigned NodeNum) { - NodeFlagsVector[NodeNum/16] |= 1 << (NodeNum & 15); - } - - void markNodeFree(unsigned NodeNum) { - NodeFlagsVector[NodeNum/16] &= ~(1 << (NodeNum & 15)); - } - - void setStartBit(unsigned NodeNum) { - NodeFlagsVector[NodeNum/16] |= 1 << ((NodeNum & 15)+16); - } - - bool isStartOfAllocation(unsigned NodeNum) { - return NodeFlagsVector[NodeNum/16] & (1 << ((NodeNum & 15)+16)); - } - - void clearStartBit(unsigned NodeNum) { - NodeFlagsVector[NodeNum/16] &= ~(1 << ((NodeNum & 15)+16)); - } - -public: - // create - Create a new (empty) slab and add it to the end of the Pools list. - static PoolSlab *create(PoolTy *Pool); - - // createSingleArray - Create a slab for a large singlearray with NumNodes - // entries in it, returning the pointer into the pool directly. - static void *createSingleArray(PoolTy *Pool, unsigned NumNodes); - - // getSlabSize - Return the number of nodes that each slab should contain. - static unsigned getSlabSize(PoolTy *Pool) { - // We need space for the header... - unsigned NumNodes = PageSize-sizeof(PoolSlab); - - // We need space for the NodeFlags... - unsigned NodeFlagsBytes = NumNodes/Pool->NodeSize * 2 / 8; - NumNodes -= (NodeFlagsBytes+3) & ~3; // Round up to int boundaries. - - // Divide the remainder among the nodes! - return NumNodes / Pool->NodeSize; - } - - void addToList(PoolSlab **PrevPtrPtr) { - PoolSlab *InsertBefore = *PrevPtrPtr; - *PrevPtrPtr = this; - PrevPtr = PrevPtrPtr; - Next = InsertBefore; - if (InsertBefore) InsertBefore->PrevPtr = &Next; - } - - void unlinkFromList() { - *PrevPtr = Next; - if (Next) Next->PrevPtr = PrevPtr; - } - - unsigned getSlabSize() const { - return NumNodesInSlab; - } - - // destroy - Release the memory for the current object. - void destroy(); - - // isEmpty - This is a quick check to see if this slab is completely empty or - // not. - bool isEmpty() const { return UsedEnd == 0; } - - // isFull - This is a quick check to see if the slab is completely allocated. - // - bool isFull() const { return isSingleArray || FirstUnused == getSlabSize(); } - - // allocateSingle - Allocate a single element from this pool, returning -1 if - // there is no space. - int allocateSingle(); - - // allocateMultiple - Allocate multiple contiguous elements from this pool, - // returning -1 if there is no space. - int allocateMultiple(unsigned Num); - - // getElementAddress - Return the address of the specified element. - void *getElementAddress(unsigned ElementNum, unsigned ElementSize) { - char *Data = (char*)&NodeFlagsVector[((unsigned)NumNodesInSlab+15)/16]; - return &Data[ElementNum*ElementSize]; - } - const void *getElementAddress(unsigned ElementNum, unsigned ElementSize)const{ - const char *Data = - (const char *)&NodeFlagsVector[(unsigned)(NumNodesInSlab+15)/16]; - return &Data[ElementNum*ElementSize]; - } - - // containsElement - Return the element number of the specified address in - // this slab. If the address is not in slab, return -1. - int containsElement(void *Ptr, unsigned ElementSize) const; - - // freeElement - Free the single node, small array, or entire array indicated. - void freeElement(unsigned short ElementIdx); - - // lastNodeAllocated - Return one past the last node in the pool which is - // before ScanIdx, that is allocated. If there are no allocated nodes in this - // slab before ScanIdx, return 0. - unsigned lastNodeAllocated(unsigned ScanIdx); -}; - -// create - Create a new (empty) slab and add it to the end of the Pools list. -PoolSlab *PoolSlab::create(PoolTy *Pool) { - unsigned NodesPerSlab = getSlabSize(Pool); - - unsigned Size = sizeof(PoolSlab) + 4*((NodesPerSlab+15)/16) + - Pool->NodeSize*getSlabSize(Pool); - assert(Size <= PageSize && "Trying to allocate a slab larger than a page!"); - PoolSlab *PS = (PoolSlab*)AllocatePage(); - - PS->NumNodesInSlab = NodesPerSlab; - PS->isSingleArray = 0; // Not a single array! - PS->FirstUnused = 0; // Nothing allocated. - PS->UsedBegin = 0; // Nothing allocated. - PS->UsedEnd = 0; // Nothing allocated. - - // Add the slab to the list... - PS->addToList((PoolSlab**)&Pool->Ptr1); - return PS; -} - -void *PoolSlab::createSingleArray(PoolTy *Pool, unsigned NumNodes) { - // FIXME: This wastes memory by allocating space for the NodeFlagsVector - unsigned NodesPerSlab = getSlabSize(Pool); - assert(NumNodes > NodesPerSlab && "No need to create a single array!"); - - unsigned NumPages = (NumNodes+NodesPerSlab-1)/NodesPerSlab; - PoolSlab *PS = (PoolSlab*)AllocateNPages(NumPages); - assert(PS && "poolalloc: Could not allocate memory!"); - - PS->addToList((PoolSlab**)&Pool->Ptr2); - - PS->isSingleArray = 1; // Not a single array! - *(unsigned*)&PS->FirstUnused = NumPages; - return PS->getElementAddress(0, 0); -} - -void PoolSlab::destroy() { - if (isSingleArray) - for (unsigned NumPages = *(unsigned*)&FirstUnused; NumPages != 1;--NumPages) - FreePage((char*)this + (NumPages-1)*PageSize); - - FreePage(this); -} - -// allocateSingle - Allocate a single element from this pool, returning -1 if -// there is no space. -int PoolSlab::allocateSingle() { - // If the slab is a single array, go on to the next slab. Don't allocate - // single nodes in a SingleArray slab. - if (isSingleArray) return -1; - - unsigned SlabSize = getSlabSize(); - - // Check to see if there are empty entries at the end of the slab... - if (UsedEnd < SlabSize) { - // Mark the returned entry used - unsigned short UE = UsedEnd; - markNodeAllocated(UE); - setStartBit(UE); - - // If we are allocating out the first unused field, bump its index also - if (FirstUnused == UE) - FirstUnused++; - - // Return the entry, increment UsedEnd field. - return UsedEnd++; - } - - // If not, check to see if this node has a declared "FirstUnused" value that - // is less than the number of nodes allocated... - // - if (FirstUnused < SlabSize) { - // Successfully allocate out the first unused node - unsigned Idx = FirstUnused; - markNodeAllocated(Idx); - setStartBit(Idx); - - // Increment FirstUnused to point to the new first unused value... - // FIXME: this should be optimized - unsigned short FU = FirstUnused; - do { - ++FU; - } while (FU != SlabSize && isNodeAllocated(FU)); - FirstUnused = FU; - - return Idx; - } - - return -1; -} - -// allocateMultiple - Allocate multiple contiguous elements from this pool, -// returning -1 if there is no space. -int PoolSlab::allocateMultiple(unsigned Size) { - // Do not allocate small arrays in SingleArray slabs - if (isSingleArray) return -1; - - // For small array allocation, check to see if there are empty entries at the - // end of the slab... - if (UsedEnd+Size <= getSlabSize()) { - // Mark the returned entry used and set the start bit - unsigned UE = UsedEnd; - setStartBit(UE); - for (unsigned i = UE; i != UE+Size; ++i) - markNodeAllocated(i); - - // If we are allocating out the first unused field, bump its index also - if (FirstUnused == UE) - FirstUnused += Size; - - // Increment UsedEnd - UsedEnd += Size; - - // Return the entry - return UE; - } - - // If not, check to see if this node has a declared "FirstUnused" value - // starting which Size nodes can be allocated - // - unsigned Idx = FirstUnused; - while (Idx+Size <= getSlabSize()) { - assert(!isNodeAllocated(Idx) && "FirstUsed is not accurate!"); - - // Check if there is a continuous array of Size nodes starting FirstUnused - unsigned LastUnused = Idx+1; - for (; LastUnused != Idx+Size && !isNodeAllocated(LastUnused); ++LastUnused) - /*empty*/; - - // If we found an unused section of this pool which is large enough, USE IT! - if (LastUnused == Idx+Size) { - setStartBit(Idx); - // FIXME: this loop can be made more efficient! - for (unsigned i = Idx; i != Idx + Size; ++i) - markNodeAllocated(i); - - // This should not be allocating on the end of the pool, so we don't need - // to bump the UsedEnd pointer. - assert(Idx != UsedEnd && "Shouldn't allocate at end of pool!"); - - // If we are allocating out the first unused field, bump its index also. - if (Idx == FirstUnused) - FirstUnused += Size; - - // Return the entry - return Idx; - } - - // Otherwise, try later in the pool. Find the next unused entry. - Idx = LastUnused; - while (Idx+Size <= getSlabSize() && isNodeAllocated(Idx)) - ++Idx; - } - - return -1; -} - - -// containsElement - Return the element number of the specified address in -// this slab. If the address is not in slab, return -1. -int PoolSlab::containsElement(void *Ptr, unsigned ElementSize) const { - const void *FirstElement = getElementAddress(0, 0); - if (FirstElement <= Ptr) { - unsigned Delta = (char*)Ptr-(char*)FirstElement; - unsigned Index = Delta/ElementSize; - if (Index < getSlabSize()) { - assert(Delta % ElementSize == 0 && - "Freeing pointer into the middle of an element!"); - return Index; - } - } - return -1; -} - - -// freeElement - Free the single node, small array, or entire array indicated. -void PoolSlab::freeElement(unsigned short ElementIdx) { - assert(isNodeAllocated(ElementIdx) && - "poolfree: Attempt to free node that is already freed\n"); - assert(!isSingleArray && "Cannot free an element from a single array!"); - - // Mark this element as being free! - markNodeFree(ElementIdx); - - // If this slab is not a SingleArray - assert(isStartOfAllocation(ElementIdx) && - "poolfree: Attempt to free middle of allocated array\n"); - - // Free the first cell - clearStartBit(ElementIdx); - markNodeFree(ElementIdx); - - // Free all nodes if this was a small array allocation. - unsigned short ElementEndIdx = ElementIdx + 1; - - // FIXME: This should use manual strength reduction to produce decent code. - unsigned short UE = UsedEnd; - while (ElementEndIdx != UE && - !isStartOfAllocation(ElementEndIdx) && - isNodeAllocated(ElementEndIdx)) { - markNodeFree(ElementEndIdx); - ++ElementEndIdx; - } - - // Update the first free field if this node is below the free node line - if (ElementIdx < FirstUnused) FirstUnused = ElementIdx; - - // Update the first used field if this node was the first used. - if (ElementIdx == UsedBegin) UsedBegin = ElementEndIdx; - - // If we are freeing the last element in a slab, shrink the UsedEnd marker - // down to the last used node. - if (ElementEndIdx == UE) { -#if 0 - printf("FU: %d, UB: %d, UE: %d FREED: [%d-%d)", - FirstUnused, UsedBegin, UsedEnd, ElementIdx, ElementEndIdx); -#endif - - // If the user is freeing the slab entirely in-order, it's quite possible - // that all nodes are free in the slab. If this is the case, simply reset - // our pointers. - if (UsedBegin == UE) { - //printf(": SLAB EMPTY\n"); - FirstUnused = 0; - UsedBegin = 0; - UsedEnd = 0; - } else if (FirstUnused == ElementIdx) { - // Freed the last node(s) in this slab. - FirstUnused = ElementIdx; - UsedEnd = ElementIdx; - } else { - UsedEnd = lastNodeAllocated(ElementIdx); - assert(FirstUnused <= UsedEnd && - "FirstUnused field was out of date!"); - } - } -} - -unsigned PoolSlab::lastNodeAllocated(unsigned ScanIdx) { - // Check the last few nodes in the current word of flags... - unsigned CurWord = ScanIdx/16; - unsigned short Flags = NodeFlagsVector[CurWord] & 0xFFFF; - if (Flags) { - // Mask off nodes above this one - Flags &= (1 << ((ScanIdx & 15)+1))-1; - if (Flags) { - // If there is still something in the flags vector, then there is a node - // allocated in this part. The goto is a hack to get the uncommonly - // executed code away from the common code path. - //printf("A: "); - goto ContainsAllocatedNode; - } - } - - // Ok, the top word doesn't contain anything, scan the whole flag words now. - --CurWord; - while (CurWord != ~0U) { - Flags = NodeFlagsVector[CurWord] & 0xFFFF; - if (Flags) { - // There must be a node allocated in this word! - //printf("B: "); - goto ContainsAllocatedNode; - } - CurWord--; - } - return 0; - -ContainsAllocatedNode: - // Figure out exactly which node is allocated in this word now. The node - // allocated is the one with the highest bit set in 'Flags'. - // - // This should use __builtin_clz to get the value, but this builtin is only - // available with GCC 3.4 and above. :( - assert(Flags && "Should have allocated node!"); - - unsigned short MSB; -#if GCC3_4_EVENTUALLY - MSB = 16 - ::__builtin_clz(Flags); -#else - for (MSB = 15; (Flags & (1U << MSB)) == 0; --MSB) - /*empty*/; -#endif - - assert((1U << MSB) & Flags); // The bit should be set - assert((~(1U << MSB) & Flags) < Flags);// Removing it should make flag smaller - ScanIdx = CurWord*16 + MSB; - assert(isNodeAllocated(ScanIdx)); - return ScanIdx; -} - - -//===----------------------------------------------------------------------===// -// -// Pool allocator library implementation -// -//===----------------------------------------------------------------------===// - -// poolinit - Initialize a pool descriptor to empty -// -void poolinit(PoolTy *Pool, unsigned NodeSize) { - assert(Pool && "Null pool pointer passed into poolinit!\n"); - - // Ensure the page manager is initialized - InitializePageManager(); - - // We must alway return unique pointers, even if they asked for 0 bytes - Pool->NodeSize = NodeSize ? NodeSize : 1; - Pool->Ptr1 = Pool->Ptr2 = 0; - Pool->FreeablePool = 1; -} - -void poolmakeunfreeable(PoolTy *Pool) { - assert(Pool && "Null pool pointer passed in to poolmakeunfreeable!\n"); - Pool->FreeablePool = 0; -} - -// pooldestroy - Release all memory allocated for a pool -// -void pooldestroy(PoolTy *Pool) { - assert(Pool && "Null pool pointer passed in to pooldestroy!\n"); - - // Free any partially allocated slabs - PoolSlab *PS = (PoolSlab*)Pool->Ptr1; - while (PS) { - PoolSlab *Next = PS->Next; - PS->destroy(); - PS = Next; - } - - // Free the completely allocated slabs - PS = (PoolSlab*)Pool->Ptr2; - while (PS) { - PoolSlab *Next = PS->Next; - PS->destroy(); - PS = Next; - } -} - - -// poolallocarray - a helper function used to implement poolalloc, when the -// number of nodes to allocate is not 1. -static void *poolallocarray(PoolTy* Pool, unsigned Size) { - assert(Pool && "Null pool pointer passed into poolallocarray!\n"); - if (Size > PoolSlab::getSlabSize(Pool)) - return PoolSlab::createSingleArray(Pool, Size); - - PoolSlab *PS = (PoolSlab*)Pool->Ptr1; - - // Loop through all of the slabs looking for one with an opening - for (; PS; PS = PS->Next) { - int Element = PS->allocateMultiple(Size); - if (Element != -1) { - // We allocated an element. Check to see if this slab has been completely - // filled up. If so, move it to the Ptr2 list. - if (PS->isFull()) { - PS->unlinkFromList(); - PS->addToList((PoolSlab**)&Pool->Ptr2); - } - return PS->getElementAddress(Element, Pool->NodeSize); - } - } - - PoolSlab *New = PoolSlab::create(Pool); - int Idx = New->allocateMultiple(Size); - assert(Idx == 0 && "New allocation didn't return zero'th node?"); - return New->getElementAddress(0, 0); -} - -void *poolalloc(PoolTy *Pool, unsigned NumBytes) { - assert(Pool && "Null pool pointer passed in to poolalloc!\n"); - - unsigned NodeSize = Pool->NodeSize; - unsigned NodesToAllocate = (NumBytes+NodeSize-1)/NodeSize; - if (NodesToAllocate > 1) - return poolallocarray(Pool, NodesToAllocate); - - // Special case the most common situation, where a single node is being - // allocated. - PoolSlab *PS = (PoolSlab*)Pool->Ptr1; - - if (__builtin_expect(PS != 0, 1)) { - int Element = PS->allocateSingle(); - if (__builtin_expect(Element != -1, 1)) { - // We allocated an element. Check to see if this slab has been - // completely filled up. If so, move it to the Ptr2 list. - if (__builtin_expect(PS->isFull(), false)) { - PS->unlinkFromList(); - PS->addToList((PoolSlab**)&Pool->Ptr2); - } - - return PS->getElementAddress(Element, NodeSize); - } - - // Loop through all of the slabs looking for one with an opening - for (PS = PS->Next; PS; PS = PS->Next) { - int Element = PS->allocateSingle(); - if (Element != -1) { - // We allocated an element. Check to see if this slab has been - // completely filled up. If so, move it to the Ptr2 list. - if (PS->isFull()) { - PS->unlinkFromList(); - PS->addToList((PoolSlab**)&Pool->Ptr2); - } - - return PS->getElementAddress(Element, NodeSize); - } - } - } - - // Otherwise we must allocate a new slab and add it to the list - PoolSlab *New = PoolSlab::create(Pool); - int Idx = New->allocateSingle(); - assert(Idx == 0 && "New allocation didn't return zero'th node?"); - return New->getElementAddress(0, 0); -} - - - -// SearchForContainingSlab - Do a brute force search through the list of -// allocated slabs for the node in question. -// -static PoolSlab *SearchForContainingSlab(PoolTy *Pool, void *Node, - unsigned &TheIndex) { - PoolSlab *PS = (PoolSlab*)Pool->Ptr1; - unsigned NodeSize = Pool->NodeSize; - - // Search the partially allocated slab list for the slab that contains this - // node. - int Idx = -1; - if (PS) { // Pool->Ptr1 could be null if Ptr2 isn't - for (; PS; PS = PS->Next) { - Idx = PS->containsElement(Node, NodeSize); - if (Idx != -1) break; - } - } - - // If the partially allocated slab list doesn't contain it, maybe the - // completely allocated list does. - if (PS == 0) { - PS = (PoolSlab*)Pool->Ptr2; - assert(Idx == -1 && "Found node but don't have PS?"); - - while (1) { - assert(PS && "poolfree: node being free'd not found in allocation " - " pool specified!\n"); - Idx = PS->containsElement(Node, NodeSize); - if (Idx != -1) break; - PS = PS->Next; - } - } - TheIndex = Idx; - return PS; -} - -// same as above, but this is the actual run time check called from the -// code to check if the node belongs to the pool or not, so will be -// like crazy, (use a hash table ?) -// FIXME cannot call this for pointers in the middle of the node yet, -// asserts out if we do -void poolcheck(PoolTy *Pool, void *Node) { - PoolSlab *PS = (PoolSlab*)Pool->Ptr1; - unsigned NodeSize = Pool->NodeSize; - - // Search the partially allocated slab list for the slab that contains this - // node. - int Idx = -1; - if (PS) { // Pool->Ptr1 could be null if Ptr2 isn't - for (; PS; PS = PS->Next) { - Idx = PS->containsElement(Node, NodeSize); - if (Idx != -1) break; - } - } - - // If the partially allocated slab list doesn't contain it, maybe the - // completely allocated list does. - if (PS == 0) { - PS = (PoolSlab*)Pool->Ptr2; - while (1) { - assert(PS && "poolfree: node being free'd not found in allocation " - " pool specified!\n"); - Idx = PS->containsElement(Node, NodeSize); - if (Idx != -1) break; - PS = PS->Next; - } - } -} - -void poolfree(PoolTy *Pool, void *Node) { - assert(Pool && "Null pool pointer passed in to poolfree!\n"); - PoolSlab *PS; - unsigned Idx; - if (0) { // THIS SHOULD BE SET FOR SAFECODE! - unsigned TheIndex; - PS = SearchForContainingSlab(Pool, Node, TheIndex); - Idx = TheIndex; - } else { - // Since it is undefined behavior to free a node which has not been - // allocated, we know that the pointer coming in has to be a valid node - // pointer in the pool. Mask off some bits of the address to find the base - // of the pool. - assert((PageSize & PageSize-1) == 0 && "Page size is not a power of 2??"); - PS = (PoolSlab*)((long)Node & ~(PageSize-1)); - - if (PS->isSingleArray) { - PS->unlinkFromList(); - PS->destroy(); - return; - } - - Idx = PS->containsElement(Node, Pool->NodeSize); - assert((int)Idx != -1 && "Node not contained in slab??"); - } - - // If PS was full, it must have been in list #2. Unlink it and move it to - // list #1. - if (PS->isFull()) { - // Now that we found the node, we are about to free an element from it. - // This will make the slab no longer completely full, so we must move it to - // the other list! - PS->unlinkFromList(); // Remove it from the Ptr2 list. - - PoolSlab **InsertPosPtr = (PoolSlab**)&Pool->Ptr1; - - // If the partially full list has an empty node sitting at the front of the - // list, insert right after it. - if ((*InsertPosPtr)->isEmpty()) - InsertPosPtr = &(*InsertPosPtr)->Next; - - PS->addToList(InsertPosPtr); // Insert it now in the Ptr1 list. - } - - // Free the actual element now! - PS->freeElement(Idx); - - // Ok, if this slab is empty, we unlink it from the of slabs and either move - // it to the head of the list, or free it, depending on whether or not there - // is already an empty slab at the head of the list. - // - if (PS->isEmpty()) { - PS->unlinkFromList(); // Unlink from the list of slabs... - - // If we can free this pool, check to see if there are any empty slabs at - // the start of this list. If so, delete the FirstSlab! - PoolSlab *FirstSlab = (PoolSlab*)Pool->Ptr1; - if (Pool->FreeablePool && FirstSlab && FirstSlab->isEmpty()) { - // Here we choose to delete FirstSlab instead of the pool we just freed - // from because the pool we just freed from is more likely to be in the - // processor cache. - FirstSlab->unlinkFromList(); - FirstSlab->destroy(); - } - - // Link our slab onto the head of the list so that allocations will find it - // efficiently. - PS->addToList((PoolSlab**)&Pool->Ptr1); - } -}
diff --git a/poolalloc/runtime/README.txt b/poolalloc/runtime/README.txt deleted file mode 100644 index 1b1786c..0000000 --- a/poolalloc/runtime/README.txt +++ /dev/null
@@ -1,15 +0,0 @@ -//===---------------------------------------------------------------------===// -This directory contains the pool allocator runtime library implementations. - -The only fully maintained runtime library implementation is in the FL2Allocator -directory. This supports the pool allocator, the bump pointer optimization, -and the pointer compression runtime. - -The implementation in the FreeListAllocator directory is much slower than -the FL2Allocator and has not been updated. - -The implementation in the PoolAllocator directory is also probably out of date, -and is much slower than FL2, but is used by the SAFECode project, which cannot -allow pool metadata to be stored intermixed with program data. - -
diff --git a/poolalloc/test/Makefile b/poolalloc/test/Makefile deleted file mode 100644 index d0f9098..0000000 --- a/poolalloc/test/Makefile +++ /dev/null
@@ -1,264 +0,0 @@ -##===- poolalloc/test/Makefile -----------------------------*- Makefile -*-===## -# -# Define the default test rule, which allows people to just type 'make test' in -# this directory. -# -##===----------------------------------------------------------------------===## - -# The default target in this directory is the test:: target -test:: - -LEVEL = .. -include $(LEVEL)/Makefile.common - -ifndef NO_STABLE_NUMBERS -STABLERUN := GET_STABLE_NUMBERS=1 -else -STABLERUN := -endif - -ifndef NO_LARGE_SIZE -LARGESIZE := LARGE_PROBLEM_SIZE=1 -else -LARGESIZE := -endif - - -LARGE_PROBLEM_SIZE_DIRS := \ - MultiSource/Benchmarks/llubenchmark \ - MultiSource/Benchmarks/FreeBench \ - MultiSource/Benchmarks/Ptrdist \ - MultiSource/Benchmarks/MallocBench/cfrac \ - SingleSource/Benchmarks/McGill - -LARGE_PROBLEM_SIZE_DIRS := \ - $(addprefix $(LLVM_OBJ_ROOT)/projects/llvm-test/,$(LARGE_PROBLEM_SIZE_DIRS)) - -NORMAL_PROBLEM_SIZE_DIRS := \ - MultiSource/Benchmarks/SciMark2-C/scimark2 \ - External/Povray \ - External/FPGrowth \ - External/Namd \ - External/SPEC/CINT2000/164.gzip \ - External/SPEC/CINT2000/175.vpr \ - External/SPEC/CINT2000/176.gcc \ - External/SPEC/CINT2000/252.eon \ - External/SPEC/CINT2000/253.perlbmk \ - External/SPEC/CINT2000/254.gap \ - External/SPEC/CINT2000/300.twolf - -NORMAL_PROBLEM_SIZE_DIRS := \ - $(addprefix $(LLVM_OBJ_ROOT)/projects/llvm-test/,$(NORMAL_PROBLEM_SIZE_DIRS)) - -# -# Problems for Pointer Compression -# -PCLARGE_PROBLEM_SIZE_DIRS := \ - MultiSource/Benchmarks/Olden/bh \ - MultiSource/Benchmarks/Olden/bisort \ - MultiSource/Benchmarks/Olden/em3d \ - MultiSource/Benchmarks/Olden/power \ - MultiSource/Benchmarks/llubenchmark \ - MultiSource/Benchmarks/Ptrdist \ - MultiSource/Benchmarks/MallocBench/cfrac - -PCLARGE_PROBLEM_SIZE_DIRS := \ - $(addprefix $(LLVM_OBJ_ROOT)/projects/llvm-test/,$(PCLARGE_PROBLEM_SIZE_DIRS)) - -PCNORMAL_PROBLEM_SIZE_DIRS := \ - MultiSource/Benchmarks/Olden/perimeter \ - MultiSource/Benchmarks/Olden/treeadd \ - MultiSource/Benchmarks/Olden/tsp \ - MultiSource/Benchmarks/Olden/voronoi - -PCNORMAL_PROBLEM_SIZE_DIRS := \ - $(addprefix $(LLVM_OBJ_ROOT)/projects/llvm-test/,$(PCNORMAL_PROBLEM_SIZE_DIRS)) - -############################################################################## -# Targets for gathering statistics for programs for papers -############################################################################## - -# Program tests for Pool Allocation -progtest:: - for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=poolalloc \ - LARGE_PROBLEM_SIZE=1 report.html) \ - done - for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=poolalloc \ - report.html) \ - done - @for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=poolalloc \ - LARGE_PROBLEM_SIZE=1 report) \ - done - @for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=poolalloc \ - report) \ - done - @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" - -# Program tests for Pointer Compression -progpc:: - for dir in $(PCLARGE_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=ptrcomp \ - LARGE_PROBLEM_SIZE=1 report.html) \ - done - for dir in $(PCNORMAL_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=ptrcomp \ - report.html) \ - done - @for dir in $(PCLARGE_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=ptrcomp \ - LARGE_PROBLEM_SIZE=1 report) \ - done - @for dir in $(PCNORMAL_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=ptrcomp \ - report) \ - done - @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" - -progperf:: - for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=perf \ - LARGE_PROBLEM_SIZE=1 report.html report.csv) \ - done - for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=perf \ - report.html report.csv) \ - done - @for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=perf \ - LARGE_PROBLEM_SIZE=1 report report.csv) \ - done - @for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=perf \ - report report.csv) \ - done - @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" - -progp4perf:: - for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=p4perf \ - LARGE_PROBLEM_SIZE=1 report.html report.csv) \ - done - for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=p4perf \ - report.html report.csv) \ - done - @for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=p4perf \ - LARGE_PROBLEM_SIZE=1 report report.csv) \ - done - @for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=p4perf \ - report report.csv) \ - done - @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" - -progcputrack:: - for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=cputrack \ - LARGE_PROBLEM_SIZE=1 report.html report.csv) \ - done - for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=cputrack \ - report.html report.csv) \ - done - @for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=cputrack \ - LARGE_PROBLEM_SIZE=1 report report.csv) \ - done - @for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ - (cd $$dir; \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=cputrack \ - report report.csv) \ - done - @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" - - -############################################################################## -# Targets for running tests and gathering statistics for arbitrary tests -############################################################################## - -# test target - Descend into projects/llvm-test and run the TEST.poolalloc.Makefile -# tests... -test:: - (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=poolalloc \ - $(LARGESIZE) $(STABLERUN) report report.html) - @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" - -pacompiletime:: - (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=pacompiletime \ - report report.html) - @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" - -ptrcomp:: - (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=ptrcomp \ - $(LARGESIZE) $(STABLERUN) report report.html) - @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" - -ptrcomptest:: - (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=ptrcomp \ - $(LARGESIZE) report) - @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" - -vtl:: - (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=pavtl \ - test report report.csv) - @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" - -perf:: - (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=perf \ - test report report.csv) - @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" - -optzn:: - (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=optzn \ - $(LARGESIZE) $(STABLERUN) test report report.csv) - @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" - -p4perf:: - (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=p4perf \ - test report report.csv) - @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" - -strace:: - (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=strace \ - test) - @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" - -cputrack:: - (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ - PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=cputrack \ - report report.csv) - @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" -
diff --git a/poolalloc/test/TEST.cputrack.Makefile b/poolalloc/test/TEST.cputrack.Makefile deleted file mode 100755 index a40008c..0000000 --- a/poolalloc/test/TEST.cputrack.Makefile +++ /dev/null
@@ -1,216 +0,0 @@ -##===- poolalloc/TEST.cputrack.Makefile --------------------*- Makefile -*-===## -# -# Makefile for measuring cache miss rates with the Solaris cputrack utility -# -##===----------------------------------------------------------------------===## - -TESTNAME = $* -CURDIR := $(shell cd .; pwd) -PROGDIR := $(shell cd $(LLVM_SRC_ROOT)/projects/llvm-test; pwd)/ -RELDIR := $(subst $(PROGDIR),,$(CURDIR)) - -# -# The Solaris cputrack command samples the performance counters every x number -# of ticks (by default, I believe one tick == 1 second). -# -# Use the cputrack command and set the interval to the maximum amount of time -# that the program is allowed to run. -# -# Care must be taken to ensure that the counters do not wrap around. So -# far, I don't believe this has happened, as that would require over -# 4 billion events per execution. -# -CPUTRACK := cputrack -T $(RUNTIMELIMIT) - -# -# Events for the Ultrasparc IIIi processor. -# -# EVENTS_DC_RD: -# Read accesses and misses on the L1 Data Cache. -# -# EVENTS_DC_WR: -# Write accesses and misses on the L1 Data Cache. This probably isn't as -# valuable as it sounds because the cache is write through, non allocate. -# So, as I understand it, the L2 and Write Caches are where the write action -# is. -# -# EVENTS_EC_MISS: -# Read misses and overall misses for the L2 Cache (aka the Embedded Cache). -# -EVENTS_DC_RD := -c pic0=DC_rd,pic1=DC_rd_miss -EVENTS_DC_WR := -c pic0=DC_wr,pic1=DC_wr_miss -EVENTS_EC_MISS := -c pic0=EC_rd_miss,pic1=EC_misses -EVENTS_TLB := -c pic0=EC_rd_miss,pic1=DTLB_miss -EVENTS_WC := -c pic0=Cycle_cnt,pic1=WC_miss - -############################################################################ -# Rules for running the tests -############################################################################ - -ifndef PROGRAMS_HAVE_CUSTOM_RUN_RULES - -# -# Generate events for Pool Allocated CBE -# -$(PROGRAMS_TO_TEST:%=Output/$(TEST).pa.%.dcrd): \ -Output/$(TEST).pa.%.dcrd: Output/%.poolalloc.cbe - @echo "=========================================" - @echo "Running '$(TEST)' test on '$(TESTNAME)' program" - $(VERB) $(CPUTRACK) $(EVENTS_DC_RD) -o $@ $< $(RUN_OPTIONS) < $(STDIN_FILENAME) > /dev/null 2>&1 - - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).pa.%.ec): \ -Output/$(TEST).pa.%.ec: Output/%.poolalloc.cbe - @echo "=========================================" - @echo "Running '$(TEST)' test on '$(TESTNAME)' program" - $(VERB) $(CPUTRACK) $(EVENTS_EC_MISS) -o $@ $< $(RUN_OPTIONS) < $(STDIN_FILENAME) > /dev/null 2>&1 - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).pa.%.wc): \ -Output/$(TEST).pa.%.wc: Output/%.poolalloc.cbe - @echo "=========================================" - @echo "Running '$(TEST)' test on '$(TESTNAME)' program" - $(VERB) $(CPUTRACK) $(EVENTS_WC) -o $@ $< $(RUN_OPTIONS) < $(STDIN_FILENAME) > /dev/null 2>&1 - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).pa.%.tlb): \ -Output/$(TEST).pa.%.tlb: Output/%.poolalloc.cbe - @echo "=========================================" - @echo "Running '$(TEST)' test on '$(TESTNAME)' program" - $(VERB) $(CPUTRACK) $(EVENTS_TLB) -o $@ $< $(RUN_OPTIONS) < $(STDIN_FILENAME) > /dev/null 2>&1 - -# -# Generate events for CBE -# -$(PROGRAMS_TO_TEST:%=Output/$(TEST).%.dcrd): \ -Output/$(TEST).%.dcrd: Output/%.nonpa.cbe - @echo "=========================================" - @echo "Running '$(TEST)' test on '$(TESTNAME)' program" - $(VERB) $(CPUTRACK) $(EVENTS_DC_RD) -o $@ $< $(RUN_OPTIONS) < $(STDIN_FILENAME) > /dev/null 2>&1 - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).%.ec): \ -Output/$(TEST).%.ec: Output/%.nonpa.cbe - @echo "=========================================" - @echo "Running '$(TEST)' test on '$(TESTNAME)' program" - $(VERB) $(CPUTRACK) $(EVENTS_EC_MISS) -o $@ $< $(RUN_OPTIONS) < $(STDIN_FILENAME) > /dev/null 2>&1 - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).%.wc): \ -Output/$(TEST).%.wc: Output/%.nonpa.cbe - @echo "=========================================" - @echo "Running '$(TEST)' test on '$(TESTNAME)' program" - $(VERB) $(CPUTRACK) $(EVENTS_WC) -o $@ $< $(RUN_OPTIONS) < $(STDIN_FILENAME) > /dev/null 2>&1 - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).%.tlb): \ -Output/$(TEST).%.tlb: Output/%.nonpa.cbe - @echo "=========================================" - @echo "Running '$(TEST)' test on '$(TESTNAME)' program" - $(VERB) $(CPUTRACK) $(EVENTS_TLB) -o $@ $< $(RUN_OPTIONS) < $(STDIN_FILENAME) > /dev/null 2>&1 - -else - -# This rule runs the generated executable, generating timing information, for -# SPEC -$(PROGRAMS_TO_TEST:%=Output/$(TEST).pa.%.dcrd): \ -Output/$(TEST).pa.%.dcrd: Output/%.poolalloc.cbe - -$(SPEC_SANDBOX) poolalloccbe-$(RUN_TYPE) $@.out $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - $(CPUTRACK) $(EVENTS_DC_RD) -o $(BUILD_OBJ_DIR)/$@ $(BUILD_OBJ_DIR)/$< $(RUN_OPTIONS) - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).pa.%.ec): \ -Output/$(TEST).pa.%.ec: Output/%.poolalloc.cbe - -$(SPEC_SANDBOX) poolalloccbe-$(RUN_TYPE) $@.out $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - $(CPUTRACK) $(EVENTS_EC_MISS) -o $(BUILD_OBJ_DIR)/$@ $(BUILD_OBJ_DIR)/$< $(RUN_OPTIONS) - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).pa.%.wc): \ -Output/$(TEST).pa.%.wc: Output/%.poolalloc.cbe - -$(SPEC_SANDBOX) poolalloccbe-$(RUN_TYPE) $@.out $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - $(CPUTRACK) $(EVENTS_WC) -o $(BUILD_OBJ_DIR)/$@ $(BUILD_OBJ_DIR)/$< $(RUN_OPTIONS) - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).pa.%.tlb): \ -Output/$(TEST).pa.%.tlb: Output/%.poolalloc.cbe - -$(SPEC_SANDBOX) poolalloccbe-$(RUN_TYPE) $@.out $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - $(CPUTRACK) $(EVENTS_TLB) -o $(BUILD_OBJ_DIR)/$@ $(BUILD_OBJ_DIR)/$< $(RUN_OPTIONS) - -# This rule runs the generated executable, generating timing information, for -# SPEC -$(PROGRAMS_TO_TEST:%=Output/$(TEST).%.dcrd): \ -Output/$(TEST).%.dcrd: Output/%.nonpa.cbe - -$(SPEC_SANDBOX) nonpacbe-$(RUN_TYPE) $@.out $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - $(CPUTRACK) $(EVENTS_DC_RD) -o $(BUILD_OBJ_DIR)/$@ $(BUILD_OBJ_DIR)/$< $(RUN_OPTIONS) - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).%.ec): \ -Output/$(TEST).%.ec: Output/%.nonpa.cbe - -$(SPEC_SANDBOX) nonpacbe-$(RUN_TYPE) $@.out $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - $(CPUTRACK) $(EVENTS_EC_MISS) -o $(BUILD_OBJ_DIR)/$@ $(BUILD_OBJ_DIR)/$< $(RUN_OPTIONS) - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).%.wc): \ -Output/$(TEST).%.wc: Output/%.nonpa.cbe - -$(SPEC_SANDBOX) nonpacbe-$(RUN_TYPE) $@.out $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - $(CPUTRACK) $(EVENTS_WC) -o $(BUILD_OBJ_DIR)/$@ $(BUILD_OBJ_DIR)/$< $(RUN_OPTIONS) - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).%.tlb): \ -Output/$(TEST).%.tlb: Output/%.nonpa.cbe - -$(SPEC_SANDBOX) nonpacbe-$(RUN_TYPE) $@.out $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - $(CPUTRACK) $(EVENTS_TLB) -o $(BUILD_OBJ_DIR)/$@ $(BUILD_OBJ_DIR)/$< $(RUN_OPTIONS) -endif - -############################################################################ -# Report Targets -############################################################################ -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ -Output/%.$(TEST).report.txt: \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).%.dcrd) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).pa.%.dcrd) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).%.wc) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).pa.%.wc) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).%.ec) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).pa.%.ec) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).%.tlb) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).pa.%.tlb) \ - $(PROGRAMS_TO_TEST:%=Output/%.poolalloc.out-cbe.time) \ - $(PROGRAMS_TO_TEST:%=Output/%.nonpa.out-cbe.time) - @echo "Program:" $* > $@ - @echo "-------------------------------------------------------------" >> $@ - @printf "CBE-PA-L1-Data-Reads: " >> $@ - @cat Output/$(TEST).pa.$*.dcrd | tail -1 | awk '{print $$4}' >> $@ - @printf "CBE-PA-L1-Data-Misses: " >> $@ - @cat Output/$(TEST).pa.$*.dcrd | tail -1 | awk '{print $$5}' >> $@ - @printf "CBE-L1-Data-Reads: " >> $@ - @cat Output/$(TEST).$*.dcrd | tail -1 | awk '{print $$4}' >> $@ - @printf "CBE-L1-Data-Misses: " >> $@ - @cat Output/$(TEST).$*.dcrd | tail -1 | awk '{print $$5}' >> $@ - @printf "CBE-PA-WCache-Misses: " >> $@ - @cat Output/$(TEST).pa.$*.wc | tail -1 | awk '{print $$5}' >> $@ - @printf "CBE-WCache-Misses: " >> $@ - @cat Output/$(TEST).$*.wc | tail -1 | awk '{print $$5}' >> $@ - @printf "CBE-PA-L2-Data-Read-Misses: " >> $@ - @cat Output/$(TEST).pa.$*.ec | tail -1 | awk '{print $$4}' >> $@ - @printf "CBE-PA-L2-Data-Misses: " >> $@ - @cat Output/$(TEST).pa.$*.ec | tail -1 | awk '{print $$5}' >> $@ - @printf "CBE-L2-Data-Read-Misses: " >> $@ - @cat Output/$(TEST).$*.ec | tail -1 | awk '{print $$4}' >> $@ - @printf "CBE-L2-Data-Misses: " >> $@ - @cat Output/$(TEST).$*.ec | tail -1 | awk '{print $$5}' >> $@ - @printf "CBE-PA-DTLB-Misses: " >> $@ - @cat Output/$(TEST).pa.$*.tlb | tail -1 | awk '{print $$5}' >> $@ - @printf "CBE-DTLB-Misses: " >> $@ - @cat Output/$(TEST).$*.tlb | tail -1 | awk '{print $$5}' >> $@ - @printf "CBE-RUN-TIME: " >> $@ - @grep "^program" Output/$*.nonpa.out-cbe.time >> $@ - @printf "CBE-PA-RUN-TIME: " >> $@ - @grep "^program" Output/$*.poolalloc.out-cbe.time >> $@ - -$(PROGRAMS_TO_TEST:%=test.$(TEST).%): \ -test.$(TEST).%: Output/%.$(TEST).report.txt - @echo "---------------------------------------------------------------" - @echo ">>> ========= '$(RELDIR)/$*' Program" - @echo "---------------------------------------------------------------" - @cat $< - -REPORT_DEPENDENCIES := $(PROGRAMS_TO_TEST:%=Output/%.poolalloc.out-cbe.time) \ - $(PROGRAMS_TO_TEST:%=Output/%.nonpa.out-cbe.time)
diff --git a/poolalloc/test/TEST.cputrack.report b/poolalloc/test/TEST.cputrack.report deleted file mode 100644 index 07b0549..0000000 --- a/poolalloc/test/TEST.cputrack.report +++ /dev/null
@@ -1,96 +0,0 @@ -##=== TEST.poolalloc.report - Report description for poolalloc -*- perl -*-===## -# -# This file defines a report to be generated for the pool allocator tests. -# -##===----------------------------------------------------------------------===## - -# Sort by program name -$SortCol = 0; -$TrimRepeatedPrefix = 1; - -sub Ratio { - my ($Cols, $Col) = @_; - if ($Cols->[$Col-1] ne "*" and $Cols->[$Col-4] ne "*" and - $Cols->[$Col-1] != "0") { - return sprintf "%1.3f", $Cols->[$Col-4]/$Cols->[$Col-1]; - } else { - return "n/a"; - } -} - -sub Sum { - my ($Cols, $Col) = @_; - if ($Cols->[$Col-1] ne "*" and $Cols->[$Col-2] ne "*") { - return sprintf "%1.3f", $Cols->[$Col-2]+$Cols->[$Col-1]; - } else { - return "n/a"; - } -} - - -sub FormatTime { - my $Time = shift; - if ($Time =~ m/([0-9]+)[m:]([0-9.]+)/) { - $Time = sprintf("%7.3f", $1*60.0+$2); - } - return $Time; -} - -@LatexColumns = (2, 3, 4, 5, 6, 7); - -my $OLDEN = 'MultiSource/Benchmarks/Olden'; -my $FREEBENCH = 'MultiSource/Benchmarks/FreeBench'; -my $PTRDIST = 'MultiSource/Benchmarks/Ptrdist'; - -@LatexRowMapOrder = ( - "$OLDEN/bh/bh" => 'bh', - "$OLDEN/bisort/bisort" => 'bisort', - "$OLDEN/em3d/em3d" => 'em3d', - "$OLDEN/health/health" => 'health', - "$OLDEN/mst/mst" => 'mst', - "$OLDEN/perimeter/perimeter" => 'perimeter', - "$OLDEN/power/power" => 'power', - "$OLDEN/treeadd/treeadd" => 'treeadd', - "$OLDEN/tsp/tsp" => 'tsp', - "$OLDEN/voronoi/voronoi" => 'voronoi', - '-' => '-', - "$FREEBENCH/analyzer/analyzer" => 'analyzer', -# "$FREEBENCH/distray/distray" => 'distray', -# "$FREEBENCH/fourinarow/fourinarow" => 'fourinarow', -# "$FREEBENCH/mason/mason" => 'mason', - "$FREEBENCH/neural/neural" => 'neural', - "$FREEBENCH/pcompress2/pcompress2" => 'pcompress2', - "$FREEBENCH/pifft/pifft" => 'pifft', - '-' => '-', - "$PTRDIST/anagram/anagram" => 'anagram', - "$PTRDIST/bc/bc" => 'bc', - "$PTRDIST/ft/ft" => 'ft', - "$PTRDIST/ks/ks" => 'ks', - "$PTRDIST/yacr2/yacr2" => 'yacr2', - ); - - -# These are the columns for the report. The first entry is the header for the -# column, the second is the regex to use to match the value. Empty list create -# seperators, and closures may be put in for custom processing. -( -# Name - ["Name:" , '\'([^\']+)\' Program'], - [], -# Times - ["NormalL1DataRead", 'CBE-L1-Data-Reads: ([0-9]+)'], - ["NormalL1DataMiss", 'CBE-L1-Data-Misses: ([0-9]+)'], - ["NormalL2DataReadMiss", 'CBE-L2-Data-Read-Misses: ([0-9]+)'], - ["NormalL2DataMiss", 'CBE-L2-Data-Misses: ([0-9]+)'], - ["NormalWriteCacheMiss", 'CBE-WCache-Misses: ([0-9]+)'], - ["NormalDTLBMiss", 'CBE-DTLB-Misses: ([0-9]+)'], - - ["PoolAllocL1DataRead", 'CBE-PA-L1-Data-Reads: ([0-9]+)'], - ["PoolAllocL1DataMiss", 'CBE-PA-L1-Data-Misses: ([0-9]+)'], - ["PoolAllocL2DataReadMiss", 'CBE-PA-L2-Data-Read-Misses: ([0-9]+)'], - ["PoolAllocL2DataMiss", 'CBE-PA-L2-Data-Misses: ([0-9]+)'], - ["PoolAllocWriteCacheMiss", 'CBE-PA-WCache-Misses: ([0-9]+)'], - ["PoolAllocDTLBMiss", 'CBE-PA-DTLB-Misses: ([0-9]+)'], - [] -); -
diff --git a/poolalloc/test/TEST.optzn.Makefile b/poolalloc/test/TEST.optzn.Makefile deleted file mode 100755 index b9eb48b..0000000 --- a/poolalloc/test/TEST.optzn.Makefile +++ /dev/null
@@ -1,258 +0,0 @@ -##===- poolalloc/test/TEST.optzn.Makefile ------------------*- Makefile -*-===## -# -# This test runs the pool allocator on all of the Programs, producing some -# performance numbers and statistics. -# -##===----------------------------------------------------------------------===## - -CFLAGS = -O2 -fno-strict-aliasing - -EXTRA_PA_FLAGS := - -# HEURISTIC can be set to: -# AllNodes -ifdef HEURISTIC -EXTRA_PA_FLAGS += -poolalloc-heuristic=$(HEURISTIC) -endif - - -CURDIR := $(shell cd .; pwd) -PROGDIR := $(shell cd $(LLVM_SRC_ROOT)/projects/llvm-test; pwd)/ -RELDIR := $(subst $(PROGDIR),,$(CURDIR)) - -# Pool allocator pass shared object -PA_SO := $(PROJECT_DIR)/Debug/lib/poolalloc$(SHLIBEXT) - -# Pool allocator runtime library -#PA_RT := $(PROJECT_DIR)/lib/Bytecode/libpoolalloc_fl_rt.bc -#PA_RT_O := $(PROJECT_DIR)/lib/$(CONFIGURATION)/poolalloc_rt.o -PA_RT_O := $(PROJECT_DIR)/Release/lib/poolalloc_rt.o -#PA_RT_O := $(PROJECT_DIR)/lib/Release/poolalloc_fl_rt.o - -# Command to run opt with the pool allocator pass loaded -OPT_PA := $(LOPT) -load $(PA_SO) - -# OPT_PA_STATS - Run opt with the -stats and -time-passes options, capturing the -# output to a file. -OPT_PA_STATS = $(OPT_PA) -info-output-file=$(CURDIR)/$@.info -stats -time-passes - -OPTZN_PASSES := -globaldce -ipsccp -deadargelim -adce -instcombine -simplifycfg - - -# This rule runs the pool allocator on the .llvm.bc file to produce a new .bc -# file -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).basepa.bc): \ -Output/%.$(TEST).basepa.bc: Output/%.llvm.bc $(PA_SO) $(LOPT) - -@rm -f $(CURDIR)/$@.info - -$(OPT_PA_STATS) -poolalloc -poolalloc-disable-alignopt -poolalloc-heuristic=AllNodes $(EXTRA_PA_FLAGS) $(OPTZN_PASSES) $< -o $@ -f 2>&1 > $@.out - - -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).selectivepa.bc): \ -Output/%.$(TEST).selectivepa.bc: Output/%.llvm.bc $(PA_SO) $(LOPT) - -@rm -f $(CURDIR)/$@.info - -$(OPT_PA_STATS) -poolalloc -poolalloc-heuristic=AllNodes $(EXTRA_PA_FLAGS) $(OPTZN_PASSES) -pooloptimize $< -o $@ -f 2>&1 > $@.out - -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).bumpptr.bc): \ -Output/%.$(TEST).bumpptr.bc: Output/%.llvm.bc $(PA_SO) $(LOPT) - -@rm -f $(CURDIR)/$@.info - -$(OPT_PA_STATS) -poolalloc $(EXTRA_PA_FLAGS) $(OPTZN_PASSES) $< -o $@ -f 2>&1 > $@.out - - -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).align.bc): \ -Output/%.$(TEST).align.bc: Output/%.llvm.bc $(PA_SO) $(LOPT) - -@rm -f $(CURDIR)/$@.info - -$(OPT_PA_STATS) -poolalloc -poolalloc-disable-alignopt $(EXTRA_PA_FLAGS) $(OPTZN_PASSES) -pooloptimize $< -o $@ -f 2>&1 > $@.out - - -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).freeelim.bc): \ -Output/%.$(TEST).freeelim.bc: Output/%.llvm.bc $(PA_SO) $(LOPT) - -@rm -f $(CURDIR)/$@.info - -$(OPT_PA_STATS) -poolalloc -poolalloc-force-all-poolfrees $(EXTRA_PA_FLAGS) $(OPTZN_PASSES) -pooloptimize $< -o $@ -f 2>&1 > $@.out - - -# This rule compiles the new .bc file into a .c file using CBE -$(PROGRAMS_TO_TEST:%=Output/%.basepa.cbe.c): \ -Output/%.basepa.cbe.c: Output/%.$(TEST).basepa.bc $(LLC) - -$(LLC) -march=c -f $< -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.selectivepa.cbe.c): \ -Output/%.selectivepa.cbe.c: Output/%.$(TEST).selectivepa.bc $(LLC) - -$(LLC) -march=c -f $< -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.bumpptr.cbe.c): \ -Output/%.bumpptr.cbe.c: Output/%.$(TEST).bumpptr.bc $(LLC) - -$(LLC) -march=c -f $< -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.align.cbe.c): \ -Output/%.align.cbe.c: Output/%.$(TEST).align.bc $(LLC) - -$(LLC) -march=c -f $< -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.freeelim.cbe.c): \ -Output/%.freeelim.cbe.c: Output/%.$(TEST).freeelim.bc $(LLC) - -$(LLC) -march=c -f $< -o $@ - - - -$(PROGRAMS_TO_TEST:%=Output/%.basepa.cbe): \ -Output/%.basepa.cbe: Output/%.basepa.cbe.c $(PA_RT_O) - -$(CC) $(CFLAGS) $< $(PA_RT_O) $(LLCLIBS) $(LDFLAGS) -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.selectivepa.cbe): \ -Output/%.selectivepa.cbe: Output/%.selectivepa.cbe.c $(PA_RT_O) - -$(CC) $(CFLAGS) $< $(PA_RT_O) $(LLCLIBS) $(LDFLAGS) -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.bumpptr.cbe): \ -Output/%.bumpptr.cbe: Output/%.bumpptr.cbe.c $(PA_RT_O) - -$(CC) $(CFLAGS) $< $(PA_RT_O) $(LLCLIBS) $(LDFLAGS) -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.align.cbe): \ -Output/%.align.cbe: Output/%.align.cbe.c $(PA_RT_O) - -$(CC) $(CFLAGS) $< $(PA_RT_O) $(LLCLIBS) $(LDFLAGS) -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.freeelim.cbe): \ -Output/%.freeelim.cbe: Output/%.freeelim.cbe.c $(PA_RT_O) - -$(CC) $(CFLAGS) $< $(PA_RT_O) $(LLCLIBS) $(LDFLAGS) -o $@ - - - -ifndef PROGRAMS_HAVE_CUSTOM_RUN_RULES - -# This rule runs the generated executable, generating timing information, for -# normal test programs -$(PROGRAMS_TO_TEST:%=Output/%.basepa.out-cbe): \ -Output/%.basepa.out-cbe: Output/%.basepa.cbe - -$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS) - -$(PROGRAMS_TO_TEST:%=Output/%.selectivepa.out-cbe): \ -Output/%.selectivepa.out-cbe: Output/%.selectivepa.cbe - -$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS) - -$(PROGRAMS_TO_TEST:%=Output/%.bumpptr.out-cbe): \ -Output/%.bumpptr.out-cbe: Output/%.bumpptr.cbe - -$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS) - -$(PROGRAMS_TO_TEST:%=Output/%.align.out-cbe): \ -Output/%.align.out-cbe: Output/%.align.cbe - -$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS) - -$(PROGRAMS_TO_TEST:%=Output/%.freeelim.out-cbe): \ -Output/%.freeelim.out-cbe: Output/%.freeelim.cbe - -$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS) - -else - -# This rule runs the generated executable, generating timing information, for -# SPEC -$(PROGRAMS_TO_TEST:%=Output/%.basepa.out-cbe): \ -Output/%.basepa.out-cbe: Output/%.basepa.cbe - -$(SPEC_SANDBOX) basepacbe-$(RUN_TYPE) $@ $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - ../../$< $(RUN_OPTIONS) - -(cd Output/basepacbe-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ - -cp Output/basepacbe-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time - -$(PROGRAMS_TO_TEST:%=Output/%.selectivepa.out-cbe): \ -Output/%.selectivepa.out-cbe: Output/%.selectivepa.cbe - -$(SPEC_SANDBOX) selectivepacbe-$(RUN_TYPE) $@ $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - ../../$< $(RUN_OPTIONS) - -(cd Output/selectivepacbe-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ - -cp Output/selectivepacbe-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time - -$(PROGRAMS_TO_TEST:%=Output/%.bumpptr.out-cbe): \ -Output/%.bumpptr.out-cbe: Output/%.bumpptr.cbe - -$(SPEC_SANDBOX) bumpptrcbe-$(RUN_TYPE) $@ $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - ../../$< $(RUN_OPTIONS) - -(cd Output/bumpptrcbe-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ - -cp Output/bumpptrcbe-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time - -$(PROGRAMS_TO_TEST:%=Output/%.align.out-cbe): \ -Output/%.align.out-cbe: Output/%.align.cbe - -$(SPEC_SANDBOX) aligncbe-$(RUN_TYPE) $@ $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - ../../$< $(RUN_OPTIONS) - -(cd Output/aligncbe-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ - -cp Output/aligncbe-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time - -$(PROGRAMS_TO_TEST:%=Output/%.freeelim.out-cbe): \ -Output/%.freeelim.out-cbe: Output/%.freeelim.cbe - -$(SPEC_SANDBOX) freeelimcbe-$(RUN_TYPE) $@ $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - ../../$< $(RUN_OPTIONS) - -(cd Output/freeelimcbe-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ - -cp Output/freeelimcbe-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time - -endif - - -# This rule diffs the post-poolallocated version to make sure we didn't break -# the program! -$(PROGRAMS_TO_TEST:%=Output/%.basepa.diff-cbe): \ -Output/%.basepa.diff-cbe: Output/%.out-nat Output/%.basepa.out-cbe - @cp Output/$*.out-nat Output/$*.basepa.out-nat - -$(DIFFPROG) cbe $*.basepa $(HIDEDIFF) - -$(PROGRAMS_TO_TEST:%=Output/%.selectivepa.diff-cbe): \ -Output/%.selectivepa.diff-cbe: Output/%.out-nat Output/%.selectivepa.out-cbe - @cp Output/$*.out-nat Output/$*.selectivepa.out-nat - -$(DIFFPROG) cbe $*.selectivepa $(HIDEDIFF) - -$(PROGRAMS_TO_TEST:%=Output/%.bumpptr.diff-cbe): \ -Output/%.bumpptr.diff-cbe: Output/%.out-nat Output/%.bumpptr.out-cbe - @cp Output/$*.out-nat Output/$*.bumpptr.out-nat - -$(DIFFPROG) cbe $*.bumpptr $(HIDEDIFF) - -$(PROGRAMS_TO_TEST:%=Output/%.align.diff-cbe): \ -Output/%.align.diff-cbe: Output/%.out-nat Output/%.align.out-cbe - @cp Output/$*.out-nat Output/$*.align.out-nat - -$(DIFFPROG) cbe $*.align $(HIDEDIFF) - -$(PROGRAMS_TO_TEST:%=Output/%.freeelim.diff-cbe): \ -Output/%.freeelim.diff-cbe: Output/%.out-nat Output/%.freeelim.out-cbe - @cp Output/$*.out-nat Output/$*.freeelim.out-nat - -$(DIFFPROG) cbe $*.freeelim $(HIDEDIFF) - - - -# This rule wraps everything together to build the actual output the report is -# generated from. -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ -Output/%.$(TEST).report.txt: Output/%.out-nat \ - Output/%.basepa.diff-cbe \ - Output/%.selectivepa.diff-cbe \ - Output/%.bumpptr.diff-cbe \ - Output/%.align.diff-cbe \ - Output/%.freeelim.diff-cbe \ - Output/%.LOC.txt - @echo > $@ - @-if test -f Output/$*.basepa.diff-cbe; then \ - printf "CBE-RUN-TIME-BASEPA: " >> $@;\ - grep "^program" Output/$*.basepa.out-cbe.time >> $@;\ - fi - @-if test -f Output/$*.align.diff-cbe; then \ - printf "CBE-RUN-TIME-ALIGN: " >> $@;\ - grep "^program" Output/$*.align.out-cbe.time >> $@;\ - fi - @-if test -f Output/$*.freeelim.diff-cbe; then \ - printf "CBE-RUN-TIME-FREEELIM: " >> $@;\ - grep "^program" Output/$*.freeelim.out-cbe.time >> $@;\ - fi - @-if test -f Output/$*.bumpptr.diff-cbe; then \ - printf "CBE-RUN-TIME-BUMPPTR: " >> $@;\ - grep "^program" Output/$*.bumpptr.out-cbe.time >> $@;\ - fi - @-if test -f Output/$*.selectivepa.diff-cbe; then \ - printf "CBE-RUN-TIME-SELECTIVEPA: " >> $@;\ - grep "^program" Output/$*.selectivepa.out-cbe.time >> $@;\ - fi - - -$(PROGRAMS_TO_TEST:%=test.$(TEST).%): \ -test.$(TEST).%: Output/%.$(TEST).report.txt - @echo "---------------------------------------------------------------" - @echo ">>> ========= '$(RELDIR)/$*' Program" - @echo "---------------------------------------------------------------" - @cat $< - -REPORT_DEPENDENCIES := $(PA_RT_O) $(PA_SO) $(PROGRAMS_TO_TEST:%=Output/%.llvm.bc) $(LLC) $(LOPT)
diff --git a/poolalloc/test/TEST.optzn.report b/poolalloc/test/TEST.optzn.report deleted file mode 100644 index 85aa5e5..0000000 --- a/poolalloc/test/TEST.optzn.report +++ /dev/null
@@ -1,74 +0,0 @@ -##=== TEST.optzn.report - Report description for optzn ---------*- perl -*-===## -# -# This file defines a report to be generated for the pool allocator tests. -# -##===----------------------------------------------------------------------===## - -# Sort by program name -$SortCol = 0; -$TrimRepeatedPrefix = 1; - -# FormatTime - Convert a time from 1m23.45 into 83.45 -sub FormatTime { - my $Time = shift; - if ($Time =~ m/([0-9]+)[m:]([0-9.]+)/) { - return sprintf("%7.3f", $1*60.0+$2); - } - - return sprintf("%6.2f", $Time); -} - - -sub RuntimePercent { - my ($Cols, $Col) = @_; - if ($Cols->[$Col-1] ne "*" and $Cols->[4] ne "*" and - $Cols->[4] != "0") { - return sprintf "%7.2f", 100*$Cols->[$Col-1]/$Cols->[4]; - } else { - return "n/a"; - } -} - -@LatexColumns = (1, 5, 8, 12, 9, 13, 14, 15, 2, 16); - -my $FREEBENCH = 'MultiSource/Benchmarks/FreeBench'; -my $PTRDIST = 'MultiSource/Benchmarks/Ptrdist'; - -@LatexRowMapOrder = ( - "anagram/anagram" => 'anagram', - "bc/bc" => 'bc', - "ft/ft" => 'ft', - "ks/ks" => 'ks', - "yacr2/yacr2" => 'yacr2', - '-' => '-', - '164.gzip/164.gzip' => '164.gzip', - '175.vpr/175.vpr' => '175.vpr', - '181.mcf/181.mcf' => '181.mcf', - '186.crafty/186.crafty' => '186.crafty', - '197.parser/197.parser' => '197.parser', - '197.parser.hacked/197.parser.hacked' => '197.parser(b)', - '255.vortex/255.vortex' => '255.vortex', - '256.bzip2/256.bzip2' => '256.bzip2', - '300.twolf/300.twolf' => '300.twolf', - '-' => '-', - "analyzer" => 'analyzer', - "llu" => 'llu-bench', - ); - - -# These are the columns for the report. The first entry is the header for the -# column, the second is the regex to use to match the value. Empty list create -# seperators, and closures may be put in for custom processing. -( -# Name - ["Name:" , '\'([^\']+)\' Program'], - [], -# Times - ["BasePA", 'CBE-RUN-TIME-BASEPA: program\s*([.0-9m:]+)', \&FormatTime], - ["NoSelectivePA", 'CBE-RUN-TIME-SELECTIVEPA: program\s*([.0-9m:]+)', \&FormatTime], - ["NoFreeElim", 'CBE-RUN-TIME-FREEELIM: program\s*([.0-9m:]+)', \&FormatTime], - ["NoBumpPtr", 'CBE-RUN-TIME-BUMPPTR: program\s*([.0-9m:]+)', \&FormatTime], - ["NoAlign", 'CBE-RUN-TIME-ALIGN: program\s*([.0-9m:]+)', \&FormatTime], - [] -); -
diff --git a/poolalloc/test/TEST.p4perf.Makefile b/poolalloc/test/TEST.p4perf.Makefile deleted file mode 100644 index 5957db3..0000000 --- a/poolalloc/test/TEST.p4perf.Makefile +++ /dev/null
@@ -1,216 +0,0 @@ -##===- poolalloc/TEST.vtl.Makefile -------------------------*- Makefile -*-===## -# -# Makefile for getting performance metrics using Intel's VTune. -# -##===----------------------------------------------------------------------===## - -TESTNAME = $* -CURDIR := $(shell cd .; pwd) -PROGDIR := $(shell cd $(LLVM_SRC_ROOT)/projects/llvm-test; pwd)/ -RELDIR := $(subst $(PROGDIR),,$(CURDIR)) - -PERFEX := /home/vadve/criswell/local/Linux/bin/perfex - -PERFOUT := /home/vadve/criswell/perf.out -PERFSCRIPT := $(BUILD_SRC_DIR)/perf.awk - -# -# Events for the AMD K7 (Athlon) processors -# -K7_REFILL_SYSTEM := 0x00411F43 -K7_REFILL_L2 := 0x00411F42 -K7_CACHE_MISSES := 0x00410041 -K7_CACHE_ACCESSES := 0x00410040 - -K7_EVENTS := -e $(K7_REFILL_SYSTEM) -e $(K7_REFILL_L2) -e $(K7_CACHE_MISSES) -e $(K7_CACHE_ACCESSES) - -# -# Events for the Pentium 4/Xeon processors -# -P4_L1_READ_MISS := -e 0x0003B000/0x12000204@0x8000000C --p4pe=0x01000001 --p4pmv=0x1 -P4_L2_READ_MISS := -e 0x0003B000/0x12002204@0x8000000E --p4pe=0x01000002 --p4pmv=0x1 -#P4_L2_READ_MISS := -e 0x0003B000/0x12000204@0x8000000E --p4pe=0x01000002 --p4pmv=0x1 - -P4_EVENTS := $(P4_L1_READ_MISS) $(P4_L2_READ_MISS) - -EVENTS := $(P4_EVENTS) - -############################################################################ -# Once the results are generated, create files containing each individiual -# piece of performance information. -############################################################################ - -# Pentium 4/Xeon Events -ifeq ($(EVENTS),$(P4_EVENTS)) -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L1Misses.%): \ -Output/$(TEST).L1Misses.%: Output/test.$(TEST).% - $(VERB) grep 0x12000204 $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L1Misses.pa.%): \ -Output/$(TEST).L1Misses.pa.%: Output/test.$(TEST).pa.% - $(VERB) grep 0x12000204 $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L1Misses.allpa.%): \ -Output/$(TEST).L1Misses.allpa.%: Output/test.$(TEST).allpa.% - $(VERB) grep 0x12000204 $< | awk '{print $$(NF)}' > $@ - - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L2Misses.%): \ -Output/$(TEST).L2Misses.%: Output/test.$(TEST).% - $(VERB) grep 0x12002204 $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L2Misses.pa.%): \ -Output/$(TEST).L2Misses.pa.%: Output/test.$(TEST).pa.% - $(VERB) grep 0x12002204 $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L2Misses.allpa.%): \ -Output/$(TEST).L2Misses.allpa.%: Output/test.$(TEST).allpa.% - $(VERB) grep 0x12002204 $< | awk '{print $$(NF)}' > $@ -endif - -############################################################################ -# Rules for running the tests -############################################################################ - -ifndef PROGRAMS_HAVE_CUSTOM_RUN_RULES - -# -# Generate events for Pool Allocated CBE -# -$(PROGRAMS_TO_TEST:%=Output/test.$(TEST).pa.%): \ -Output/test.$(TEST).pa.%: Output/%.poolalloc.cbe Output/test.$(TEST).% - @echo "=========================================" - @echo "Running '$(TEST)' Default PA test on '$(TESTNAME)' program" -ifeq ($(RUN_OPTIONS),) - $(VERB) cat $(STDIN_FILENAME) | $(PERFEX) -o $@.1 $(P4_L1_READ_MISS) $< > /dev/null - $(VERB) cat $(STDIN_FILENAME) | $(PERFEX) -o $@.2 $(P4_L2_READ_MISS) $< > /dev/null -else - $(VERB) cat $(STDIN_FILENAME) | $(PERFEX) -o $@.1 $(P4_L1_READ_MISS) $< $(RUN_OPTIONS) > /dev/null - $(VERB) cat $(STDIN_FILENAME) | $(PERFEX) -o $@.2 $(P4_L2_READ_MISS) $< $(RUN_OPTIONS) > /dev/null -endif - @cat $@.1 $@.2 > $@ - - -$(PROGRAMS_TO_TEST:%=Output/test.$(TEST).allpa.%): \ -Output/test.$(TEST).allpa.%: Output/%.allnodes.cbe Output/test.$(TEST).% - @echo "=========================================" - @echo "Running '$(TEST)' AllNodes PA test on '$(TESTNAME)' program" -ifeq ($(RUN_OPTIONS),) - $(VERB) cat $(STDIN_FILENAME) | $(PERFEX) -o $@.1 $(P4_L1_READ_MISS) $< > /dev/null - $(VERB) cat $(STDIN_FILENAME) | $(PERFEX) -o $@.2 $(P4_L2_READ_MISS) $< > /dev/null -else - $(VERB) cat $(STDIN_FILENAME) | $(PERFEX) -o $@.1 $(P4_L1_READ_MISS) $< $(RUN_OPTIONS) > /dev/null - $(VERB) cat $(STDIN_FILENAME) | $(PERFEX) -o $@.2 $(P4_L2_READ_MISS) $< $(RUN_OPTIONS) > /dev/null -endif - @cat $@.1 $@.2 > $@ - - -# -# Generate events for CBE -# -$(PROGRAMS_TO_TEST:%=Output/test.$(TEST).%): \ -Output/test.$(TEST).%: Output/%.nonpa.cbe - @echo "=========================================" - @echo "Running '$(TEST)' No-PA test on '$(TESTNAME)' program" -ifeq ($(RUN_OPTIONS),) - $(VERB) cat $(STDIN_FILENAME) | $(PERFEX) -o $@.1 $(P4_L1_READ_MISS) $< > /dev/null - $(VERB) cat $(STDIN_FILENAME) | $(PERFEX) -o $@.2 $(P4_L2_READ_MISS) $< > /dev/null -else - $(VERB) cat $(STDIN_FILENAME) | $(PERFEX) -o $@.1 $(P4_L1_READ_MISS) $< $(RUN_OPTIONS) > /dev/null - $(VERB) cat $(STDIN_FILENAME) | $(PERFEX) -o $@.2 $(P4_L2_READ_MISS) $< $(RUN_OPTIONS) > /dev/null -endif - @cat $@.1 $@.2 > $@ - -else - -# This rule runs the generated executable, generating timing information, for -# SPEC -$(PROGRAMS_TO_TEST:%=Output/test.$(TEST).pa.%): \ -Output/test.$(TEST).pa.%: Output/%.poolalloc.cbe - -$(SPEC_SANDBOX) poolalloccbe-$(RUN_TYPE) /dev/null $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - $(PERFEX) -o ../../$@.2 $(P4_L2_READ_MISS) ../../$< $(RUN_OPTIONS) - -$(SPEC_SANDBOX) poolalloccbe-$(RUN_TYPE) /dev/null $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - $(PERFEX) -o ../../$@.1 $(P4_L1_READ_MISS) ../../$< $(RUN_OPTIONS) - @cat $@.1 $@.2 > $@ - -# This rule runs the generated executable, generating timing information, for -# SPEC -$(PROGRAMS_TO_TEST:%=Output/test.$(TEST).allpa.%): \ -Output/test.$(TEST).allpa.%: Output/%.allnodes.cbe - -$(SPEC_SANDBOX) allnodescbe-$(RUN_TYPE) /dev/null $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - $(PERFEX) -o ../../$@.2 $(P4_L2_READ_MISS) ../../$< $(RUN_OPTIONS) - -$(SPEC_SANDBOX) allnodescbe-$(RUN_TYPE) /dev/null $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - $(PERFEX) -o ../../$@.1 $(P4_L1_READ_MISS) ../../$< $(RUN_OPTIONS) - @cat $@.1 $@.2 > $@ - - -# This rule runs the generated executable, generating timing information, for -# SPEC -$(PROGRAMS_TO_TEST:%=Output/test.$(TEST).%): \ -Output/test.$(TEST).%: Output/%.nonpa.cbe - -$(SPEC_SANDBOX) nonpacbe-$(RUN_TYPE) /dev/null $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - $(PERFEX) -o ../../$@.2 $(P4_L2_READ_MISS) ../../$< $(RUN_OPTIONS) - -$(SPEC_SANDBOX) nonpacbe-$(RUN_TYPE) /dev/null $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - $(PERFEX) -o ../../$@.1 $(P4_L1_READ_MISS) ../../$< $(RUN_OPTIONS) - @cat $@.1 $@.2 > $@ -endif - -############################################################################ -# Report Targets -############################################################################ -ifeq ($(EVENTS),$(K7_EVENTS)) -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ -Output/%.$(TEST).report.txt: $(PROGRAMS_TO_TEST:%=Output/$(TEST).cacheaccesses.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).cacheaccesses.pa.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).cachemisses.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).cachemisses.pa.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L1Misses.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L1Misses.pa.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L2Misses.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L2Misses.pa.%) - @echo "Program:" $* > $@ - @echo "-------------------------------------------------------------" >> $@ - @printf "CBE-PA-Cache-Accesses: %lld\n" `cat Output/$(TEST).cacheaccesses.pa.$*` >> $@ - @printf "CBE-Cache-Accesses: %lld\n" `cat Output/$(TEST).cacheaccesses.$*` >> $@ - @printf "CBE-PA-Cache-Misses: %lld\n" `cat Output/$(TEST).cachemisses.pa.$*` >> $@ - @printf "CBE-Cache-Misses: %lld\n" `cat Output/$(TEST).cachemisses.$*` >> $@ - @printf "CBE-PA-L1-Cache-Misses: %lld\n" `cat Output/$(TEST).L1Misses.pa.$*` >> $@ - @printf "CBE-L1-Cache-Misses: %lld\n" `cat Output/$(TEST).L1Misses.$*` >> $@ - @printf "CBE-PA-L2-Cache-Misses: %lld\n" `cat Output/$(TEST).L2Misses.pa.$*` >> $@ - @printf "CBE-L2-Cache-Misses: %lld\n" `cat Output/$(TEST).L2Misses.$*` >> $@ -endif - -ifeq ($(EVENTS),$(P4_EVENTS)) -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ -Output/%.$(TEST).report.txt: \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L1Misses.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L1Misses.pa.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L1Misses.allpa.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L2Misses.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L2Misses.pa.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L2Misses.allpa.%) - @echo "Program:" $* > $@ - @echo "-------------------------------------------------------------" >> $@ - @printf "CBE-PA-L1-Cache-Misses: %lld\n" `cat Output/$(TEST).L1Misses.pa.$*` >> $@ - @printf "CBE-ALLPA-L1-Cache-Misses: %lld\n" `cat Output/$(TEST).L1Misses.allpa.$*` >> $@ - @printf "CBE-L1-Cache-Misses: %lld\n" `cat Output/$(TEST).L1Misses.$*` >> $@ - @printf "CBE-PA-L2-Cache-Misses: %lld\n" `cat Output/$(TEST).L2Misses.pa.$*` >> $@ - @printf "CBE-ALLPA-L2-Cache-Misses: %lld\n" `cat Output/$(TEST).L2Misses.allpa.$*` >> $@ - @printf "CBE-L2-Cache-Misses: %lld\n" `cat Output/$(TEST).L2Misses.$*` >> $@ - -endif - -$(PROGRAMS_TO_TEST:%=test.$(TEST).%): \ -test.$(TEST).%: Output/%.$(TEST).report.txt - @echo "---------------------------------------------------------------" - @echo ">>> ========= '$(RELDIR)/$*' Program" - @echo "---------------------------------------------------------------" - @cat $< - -REPORT_DEPENDENCIES := $(PROGRAMS_TO_TEST:%=Output/%.llvm.bc)
diff --git a/poolalloc/test/TEST.p4perf.report b/poolalloc/test/TEST.p4perf.report deleted file mode 100644 index a1f732b..0000000 --- a/poolalloc/test/TEST.p4perf.report +++ /dev/null
@@ -1,73 +0,0 @@ -##=== TEST.poolalloc.report - Report description for poolalloc -*- perl -*-===## -# -# This file defines a report to be generated for the pool allocator tests. -# -##===----------------------------------------------------------------------===## - -# Sort by program name -$SortCol = 0; -$TrimRepeatedPrefix = 1; - -@LatexColumns = (2, 3, 4, 5, 6, 7); - -my $OLDEN = 'MultiSource/Benchmarks/Olden'; -my $FREEBENCH = 'MultiSource/Benchmarks/FreeBench'; -my $PTRDIST = 'MultiSource/Benchmarks/Ptrdist'; - -@LatexRowMapOrder = ( - "$OLDEN/bh/bh" => 'bh', - "$OLDEN/bisort/bisort" => 'bisort', - "$OLDEN/em3d/em3d" => 'em3d', - "$OLDEN/health/health" => 'health', - "$OLDEN/mst/mst" => 'mst', - "$OLDEN/perimeter/perimeter" => 'perimeter', - "$OLDEN/power/power" => 'power', - "$OLDEN/treeadd/treeadd" => 'treeadd', - "$OLDEN/tsp/tsp" => 'tsp', - "$OLDEN/voronoi/voronoi" => 'voronoi', - '-' => '-', - "$FREEBENCH/analyzer/analyzer" => 'analyzer', -# "$FREEBENCH/distray/distray" => 'distray', -# "$FREEBENCH/fourinarow/fourinarow" => 'fourinarow', -# "$FREEBENCH/mason/mason" => 'mason', - "$FREEBENCH/neural/neural" => 'neural', - "$FREEBENCH/pcompress2/pcompress2" => 'pcompress2', - "$FREEBENCH/pifft/pifft" => 'pifft', - '-' => '-', - "$PTRDIST/anagram/anagram" => 'anagram', - "$PTRDIST/bc/bc" => 'bc', - "$PTRDIST/ft/ft" => 'ft', - "$PTRDIST/ks/ks" => 'ks', - "$PTRDIST/yacr2/yacr2" => 'yacr2', - ); - -sub Ratio { - my ($Cols, $Col) = @_; - if ($Cols->[$Col-2] ne "*" and $Cols->[$Col-1] ne "*" and - $Cols->[$Col-2] != "0") { - return sprintf "%1.3f", $Cols->[$Col-1]/$Cols->[$Col-2]; - } else { - return "n/a"; - } -} - -# These are the columns for the report. The first entry is the header for the -# column, the second is the regex to use to match the value. Empty list create -# seperators, and closures may be put in for custom processing. -( -# Name - ["Name:" , '\'([^\']+)\' Program'], - [], -# Times - ["L1Miss", 'CBE-L1-Cache-Misses: ([0-9]+)'], - ["PAL1Miss", 'CBE-PA-L1-Cache-Misses: ([0-9]+)'], - ["PAL1Ratio", \&Ratio], - ["ALLPAL1Miss", 'CBE-ALLPA-L1-Cache-Misses: ([0-9]+)'], - [], - ["L2Miss", 'CBE-L2-Cache-Misses: ([.0-9]+)'], - ["PAL2Miss", 'CBE-PA-L2-Cache-Misses: ([.0-9]+)'], - ["PAL2Ratio", \&Ratio], - ["ALLPAL2Miss", 'CBE-ALLPA-L2-Cache-Misses: ([0-9]+)'], - [] -); -
diff --git a/poolalloc/test/TEST.pacompiletime.Makefile b/poolalloc/test/TEST.pacompiletime.Makefile deleted file mode 100755 index 54a8858..0000000 --- a/poolalloc/test/TEST.pacompiletime.Makefile +++ /dev/null
@@ -1,65 +0,0 @@ -##===- poolalloc/test/TEST.pacompiletime.Makefile ----------*- Makefile -*-===## -# -# This test figures out how much time we spend in DSA and the pool allocator -# compiling a program. -# -##===----------------------------------------------------------------------===## - -CFLAGS = -O2 -fno-strict-aliasing - -EXTRA_PA_FLAGS := - -CURDIR := $(shell cd .; pwd) -PROGDIR := $(shell cd $(LLVM_SRC_ROOT)/projects/llvm-test; pwd)/ -RELDIR := $(subst $(PROGDIR),,$(CURDIR)) - -# Pool allocator pass shared object -PA_SO := $(PROJECT_DIR)/Release/lib/libpoolalloc$(SHLIBEXT) - -# Command to run opt with the pool allocator pass loaded -OPT_PA := $(LOPT) -load $(PA_SO) - -# OPT_PA_STATS - Run opt with the -stats and -time-passes options, capturing the -# output to a file. -OPT_PA_STATS = $(OPT_PA) -info-output-file=$(CURDIR)/$@.info -time-passes - - -# This rule runs the pool allocator on the .llvm.bc file to produce a new .bc -# file -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).poolalloc.bc): \ -Output/%.$(TEST).poolalloc.bc: Output/%.llvm.bc $(PA_SO) $(LOPT) - -@rm -f $(CURDIR)/$@.info - -$(OPT_PA_STATS) -poolalloc $(EXTRA_PA_FLAGS) $< -o $@ -f 2>&1 > $@.out - - -# This rule wraps everything together to build the actual output the report is -# generated from. -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ -Output/%.$(TEST).report.txt: Output/%.$(TEST).poolalloc.bc Output/%.LOC.txt - @echo > $@ - printf "LOC: " >> $@ - cat Output/$*.LOC.txt >> $@ - @echo >> $@ - @printf "LOCTIME: " >> $@ - @-grep "Local Data Structure" Output/$*.$(TEST).poolalloc.bc.info >>$@ - @printf "BUTIME: " >> $@ - @-grep " Bottom-up Data Struc" Output/$*.$(TEST).poolalloc.bc.info >>$@ - @printf "TDTIME: " >> $@ - @-grep "Top-down Data Structur" Output/$*.$(TEST).poolalloc.bc.info >>$@ - @printf "COMTIME: " >> $@ - @-grep "'Complete' Bottom-up D" Output/$*.$(TEST).poolalloc.bc.info >>$@ - @printf "EQTIME: " >> $@ - @-grep "Equivalence-class Bott" Output/$*.$(TEST).poolalloc.bc.info >>$@ - @printf "PATIME: " >> $@ - @-grep "Pool allocate disjoint" Output/$*.$(TEST).poolalloc.bc.info >>$@ - - - -$(PROGRAMS_TO_TEST:%=test.$(TEST).%): \ -test.$(TEST).%: Output/%.$(TEST).report.txt - @echo "---------------------------------------------------------------" - @echo ">>> ========= '$(RELDIR)/$*' Program" - @echo "---------------------------------------------------------------" - @cat $< - -REPORT_DEPENDENCIES := $(PA_RT_O) $(PA_SO) $(PROGRAMS_TO_TEST:%=Output/%.llvm.bc) $(LLC) $(LOPT)
diff --git a/poolalloc/test/TEST.pacompiletime.report b/poolalloc/test/TEST.pacompiletime.report deleted file mode 100644 index 8f19a85..0000000 --- a/poolalloc/test/TEST.pacompiletime.report +++ /dev/null
@@ -1,61 +0,0 @@ -##=== TEST.pacompiletime.report - Report for PA Compile Time ---*- perl -*-===## -# -# This file defines a report to be generated for the pool allocator compile-time -# tests. -# -##===----------------------------------------------------------------------===## - -# Sort by program name -$SortCol = 0; -$TrimRepeatedPrefix = 1; - -@LatexColumns = (1, 8, 10); - -my $FREEBENCH = 'MultiSource/Benchmarks/FreeBench'; -my $PTRDIST = 'MultiSource/Benchmarks/Ptrdist'; - -@LatexRowMapOrder = ( - "anagram/anagram" => 'anagram', - "bc/bc" => 'bc', - "ft/ft" => 'ft', - "ks/ks" => 'ks', - "yacr2/yacr2" => 'yacr2', - '-' => '-', - '164.gzip/164.gzip' => '164.gzip', - '175.vpr/175.vpr' => '175.vpr', - '181.mcf/181.mcf' => '181.mcf', - '186.crafty/186.crafty' => '186.crafty', - '197.parser/197.parser' => '197.parser', - '197.parser.hacked/197.parser.hacked' => '197.parser(b)', - '255.vortex/255.vortex' => '255.vortex', - '256.bzip2/256.bzip2' => '256.bzip2', - '300.twolf/300.twolf' => '300.twolf', - '-' => '-', - "analyzer" => 'analyzer', - "llu" => 'llu-bench', - ); - - -# These are the columns for the report. The first entry is the header for the -# column, the second is the regex to use to match the value. Empty list create -# seperators, and closures may be put in for custom processing. -my $USERSYSTTIME = '([0-9.]+)[ 0-9.]+\([^)]+\)[ 0-9.]+\([^)]+\) +'; -( -# Name - ["Name:" , '\'([^\']+)\' Program'], - ["LOC" , 'LOC:\s*([0-9]+)'], - [], -# DSA Times - ["LOC", "${USERSYSTTIME}Local"], - ["BU", "${USERSYSTTIME}Bottom-up"], - ["TD", "${USERSYSTTIME}Top-down"], - ["DSASUM", sub { return SumCols(@_, 3); }], - [], - ["COM", "${USERSYSTTIME}'Complete'"], - ["EQ", "${USERSYSTTIME}Equivalence"], - ["EBUSUM", sub { return SumCols(@_, 2); }], - [], - ["PA Time", "${USERSYSTTIME}Pool allocate"], - [] -); -
diff --git a/poolalloc/test/TEST.pavtl.Makefile b/poolalloc/test/TEST.pavtl.Makefile deleted file mode 100644 index 37b3cf1..0000000 --- a/poolalloc/test/TEST.pavtl.Makefile +++ /dev/null
@@ -1,116 +0,0 @@ -##===- poolalloc/TEST.vtl.Makefile -------------------------*- Makefile -*-===## -# -# Makefile for getting performance metrics using Intel's VTune. -# -##===----------------------------------------------------------------------===## - -TESTNAME = $* -CURDIR := $(shell cd .; pwd) -PROGDIR := $(shell cd $(LLVM_SRC_ROOT)/projects/llvm-test; pwd)/ -RELDIR := $(subst $(PROGDIR),,$(CURDIR)) - -VTL := /opt/intel/vtune/bin/vtl - -# -# Events: These will need to be modified for every different CPU that is used -# (i.e. the Pentium 3 on Cypher has a different set of available events than -# the Pentium 4 on Zion). -# -P4_EVENTS := -ec -P4_EVENTS += en='2nd Level Cache Read Misses':sa=5000 -P4_EVENTS += -ec -P4_EVENTS += en='2nd-Level Cache Read References' -#P4_EVENTS += -ec -#P4_EVENTS += en='3rd-Level Cache Read Misses':sa=5000 -#P4_EVENTS += en='1st Level Cache Load Misses Retired' -P3_EVENTS := -ec en='L2 Cache Request Misses (highly correlated)' - -EVENTS := $(P4_EVENTS) - -# -# Once the results are generated, create files containing each individiual -# piece of performance information. -# - -# Pentium 4 Events -ifeq ($(EVENTS),$(P4_EVENTS)) -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L2cachemisses.%): \ -Output/$(TEST).L2cachemisses.%: Output/test.$(TEST).% - grep "Output/$*.cbe" $< | grep "Cache Read Misses" | grep "2nd" | awk '{print $$(NF-1)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L2cachemisses.pa.%): \ -Output/$(TEST).L2cachemisses.pa.%: Output/test.$(TEST).pa.% - grep "Output/$*.poolalloc.cbe" $< | grep "Cache Read Misses" | grep "2nd" | awk '{print $$(NF-1)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L2cacherefs.%): \ -Output/$(TEST).L2cacherefs.%: Output/test.$(TEST).% - grep "Output/$*.cbe" $< | grep "Cache Read References" | grep "2nd" | awk '{print $$(NF-1)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L2cacherefs.pa.%): \ -Output/$(TEST).L2cacherefs.pa.%: Output/test.$(TEST).pa.% - grep "Output/$*.poolalloc.cbe" $< | grep "Cache Read References" | grep "2nd" | awk '{print $$(NF-1)}' > $@ -endif - -# Pentium 3 Events -ifeq ($(EVENTS),$(P3_EVENTS)) -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L2cachemisses.%): \ -Output/$(TEST).L2cachemisses.%: Output/test.$(TEST).% - grep "Output/$*.cbe" $< | grep " L2 Cache Request Misses" | awk '{print $$(NF-1)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L2cachemisses.pa.%): \ -Output/$(TEST).L2cachemisses.pa.%: Output/test.$(TEST).pa.% - grep "Output/$*.poolalloc.cbe" $< | grep " L2 Cache Request Misses" | awk '{print $$(NF-1)}' > $@ -endif - -# -# Generate events for Pool Allocated CBE -# -$(PROGRAMS_TO_TEST:%=Output/test.$(TEST).pa.%): \ -Output/test.$(TEST).pa.%: Output/%.poolalloc.cbe Output/test.$(TEST).% - @echo "=========================================" - @echo "Running '$(TEST)' test on '$(TESTNAME)' program" -ifeq ($(RUN_OPTIONS),) - $(VERB) cat $(STDIN_FILENAME) | $(VTL) activity $* -d 50 -c sampling -o "$(EVENTS)" -app $< -moi $< -else - $(VERB) cat $(STDIN_FILENAME) | $(VTL) activity $* -d 50 -c sampling -o "$(EVENTS)" -app $<,"$(RUN_OPTIONS)" -moi $< -endif - $(VERB) $(VTL) run $* - $(VERB) $(VTL) view > $@ - $(VERB) $(VTL) delete $* -f - -# -# Generate events for CBE -# -$(PROGRAMS_TO_TEST:%=Output/test.$(TEST).%): \ -Output/test.$(TEST).%: Output/%.cbe - @echo "=========================================" - @echo "Running '$(TEST)' test on '$(TESTNAME)' program" -ifeq ($(RUN_OPTIONS),) - $(VERB) cat $(STDIN_FILENAME) | $(VTL) activity $* -d 50 -c sampling -o "$(EVENTS)" -app $< -moi $< -else - $(VERB) cat $(STDIN_FILENAME) | $(VTL) activity $* -d 50 -c sampling -o "$(EVENTS)" -app $<,"$(RUN_OPTIONS)" -moi $< -endif - $(VERB) $(VTL) run $* - $(VERB) $(VTL) view > $@ - $(VERB) $(VTL) delete $* -f - - -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ -Output/%.$(TEST).report.txt: $(PROGRAMS_TO_TEST:%=Output/$(TEST).L2cachemisses.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L2cachemisses.pa.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L2cacherefs.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L2cacherefs.pa.%) - @echo > $@ - @echo "CBE-PA-L2-Misses:" `cat Output/$(TEST).L2cachemisses.pa.$*` >> $@ - @echo "CBE-PA-L2-Refs:" `cat Output/$(TEST).L2cacherefs.pa.$*` >> $@ - @echo "CBE-L2-Misses:" `cat Output/$(TEST).L2cachemisses.$*` >> $@ - @echo "CBE-L2-Refs:" `cat Output/$(TEST).L2cacherefs.$*` >> $@ - - -$(PROGRAMS_TO_TEST:%=test.$(TEST).%): \ -test.$(TEST).%: Output/%.$(TEST).report.txt - @echo "---------------------------------------------------------------" - @echo ">>> ========= '$(RELDIR)/$*' Program" - @echo "---------------------------------------------------------------" - @cat $< -
diff --git a/poolalloc/test/TEST.pavtl.report b/poolalloc/test/TEST.pavtl.report deleted file mode 100644 index efff3bc..0000000 --- a/poolalloc/test/TEST.pavtl.report +++ /dev/null
@@ -1,88 +0,0 @@ -##=== TEST.poolalloc.report - Report description for poolalloc -*- perl -*-===## -# -# This file defines a report to be generated for the pool allocator tests. -# -##===----------------------------------------------------------------------===## - -# Sort by program name -$SortCol = 0; -$TrimRepeatedPrefix = 1; - -sub Ratio { - my ($Cols, $Col) = @_; - if ($Cols->[$Col-1] ne "*" and $Cols->[$Col-4] ne "*" and - $Cols->[$Col-1] != "0") { - return sprintf "%1.3f", $Cols->[$Col-4]/$Cols->[$Col-1]; - } else { - return "n/a"; - } -} - -sub Sum { - my ($Cols, $Col) = @_; - if ($Cols->[$Col-1] ne "*" and $Cols->[$Col-2] ne "*") { - return sprintf "%1.3f", $Cols->[$Col-2]+$Cols->[$Col-1]; - } else { - return "n/a"; - } -} - - -sub FormatTime { - my $Time = shift; - if ($Time =~ m/([0-9]+)[m:]([0-9.]+)/) { - $Time = sprintf("%7.3f", $1*60.0+$2); - } - return $Time; -} - -@LatexColumns = (2, 3, 4, 5, 6, 7); - -my $OLDEN = 'MultiSource/Benchmarks/Olden'; -my $FREEBENCH = 'MultiSource/Benchmarks/FreeBench'; -my $PTRDIST = 'MultiSource/Benchmarks/Ptrdist'; - -@LatexRowMapOrder = ( - "$OLDEN/bh/bh" => 'bh', - "$OLDEN/bisort/bisort" => 'bisort', - "$OLDEN/em3d/em3d" => 'em3d', - "$OLDEN/health/health" => 'health', - "$OLDEN/mst/mst" => 'mst', - "$OLDEN/perimeter/perimeter" => 'perimeter', - "$OLDEN/power/power" => 'power', - "$OLDEN/treeadd/treeadd" => 'treeadd', - "$OLDEN/tsp/tsp" => 'tsp', - "$OLDEN/voronoi/voronoi" => 'voronoi', - '-' => '-', - "$FREEBENCH/analyzer/analyzer" => 'analyzer', -# "$FREEBENCH/distray/distray" => 'distray', -# "$FREEBENCH/fourinarow/fourinarow" => 'fourinarow', -# "$FREEBENCH/mason/mason" => 'mason', - "$FREEBENCH/neural/neural" => 'neural', - "$FREEBENCH/pcompress2/pcompress2" => 'pcompress2', - "$FREEBENCH/pifft/pifft" => 'pifft', - '-' => '-', - "$PTRDIST/anagram/anagram" => 'anagram', - "$PTRDIST/bc/bc" => 'bc', - "$PTRDIST/ft/ft" => 'ft', - "$PTRDIST/ks/ks" => 'ks', - "$PTRDIST/yacr2/yacr2" => 'yacr2', - ); - - -# These are the columns for the report. The first entry is the header for the -# column, the second is the regex to use to match the value. Empty list create -# seperators, and closures may be put in for custom processing. -( -# Name - ["Name:" , '\'([^\']+)\' Program'], - [], -# Times - ["NormalL2CacheReadReq", 'CBE-L2-Refs: ([0-9]+)'], - ["NormalL2CacheReadMiss", 'CBE-L2-Misses: ([.0-9]+)'], - ["PoolAllocL2CacheReadReq", 'CBE-PA-L2-Refs: ([0-9]+)'], - ["PoolAllocL2CacheReadMiss", 'CBE-PA-L2-Misses: ([.0-9]+)'], - - [] -); -
diff --git a/poolalloc/test/TEST.perf.Makefile b/poolalloc/test/TEST.perf.Makefile deleted file mode 100644 index f9c6fc1..0000000 --- a/poolalloc/test/TEST.perf.Makefile +++ /dev/null
@@ -1,213 +0,0 @@ -##===- poolalloc/TEST.vtl.Makefile -------------------------*- Makefile -*-===## -# -# Makefile for getting performance metrics using Intel's VTune. -# -##===----------------------------------------------------------------------===## - -TESTNAME = $* -CURDIR := $(shell cd .; pwd) -PROGDIR := $(shell cd $(LLVM_SRC_ROOT)/projects/llvm-test; pwd)/ -RELDIR := $(subst $(PROGDIR),,$(CURDIR)) - -PERFEX := /home/vadve/criswell/local/Linux/bin/perfex - -PERFOUT := /home/vadve/criswell/perf.out -PERFSCRIPT := $(BUILD_SRC_DIR)/perf.awk - -# -# Events for the AMD K7 (Athlon) processors -# -K7_REFILL_SYSTEM := 0x00411F43 -K7_REFILL_L2 := 0x00411F42 -#K7_CACHE_MISSES := 0x00410041 -#K7_CACHE_ACCESSES := 0x00410040 -K7_TLB_MISSES := 0x00410046 -K7_MISALIGNED_DATA := 0x00410047 - -K7_EVENTS := -e $(K7_REFILL_SYSTEM) -e $(K7_REFILL_L2) \ - -e $(K7_MISALIGNED_DATA) -e $(K7_TLB_MISSES) - -# -# Events for the Pentium 4/Xeon processors -# -P4_L1_READ_MISS := -e 0x0003B000/0x12000204@0x8000000C --p4pe=0x01000001 --p4pmv=0x1 -P4_L2_READ_MISS := -e 0x0003B000/0x12000204@0x8000000D --p4pe=0x01000002 --p4pmv=0x1 - -P4_EVENTS := $(P4_L1_READ_MISS) $(P4_L2_READ_MISS) - -EVENTS := $(K7_EVENTS) - -############################################################################ -# Once the results are generated, create files containing each individiual -# piece of performance information. -############################################################################ - -# AMD K7 (Athlon) Events -ifeq ($(EVENTS),$(K7_EVENTS)) -$(PROGRAMS_TO_TEST:%=Output/$(TEST).cacheaccesses.%): \ -Output/$(TEST).cacheaccesses.%: Output/test.$(TEST).% - $(VERB) grep $(K7_CACHE_ACCESSES) $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).cacheaccesses.pa.%): \ -Output/$(TEST).cacheaccesses.pa.%: Output/test.$(TEST).pa.% - $(VERB) grep $(K7_CACHE_ACCESSES) $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).tlbmisses.%): \ -Output/$(TEST).tlbmisses.%: Output/test.$(TEST).% - $(VERB) grep $(K7_TLB_MISSES) $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).tlbmisses.pa.%): \ -Output/$(TEST).tlbmisses.pa.%: Output/test.$(TEST).pa.% - $(VERB) grep $(K7_TLB_MISSES) $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).cachemisses.%): \ -Output/$(TEST).cachemisses.%: Output/test.$(TEST).% - $(VERB) grep $(K7_CACHE_MISSES) $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).cachemisses.pa.%): \ -Output/$(TEST).cachemisses.pa.%: Output/test.$(TEST).pa.% - $(VERB) grep $(K7_CACHE_MISSES) $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).misaligned.%): \ -Output/$(TEST).misaligned.%: Output/test.$(TEST).% - $(VERB) grep $(K7_MISALIGNED_DATA) $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).misaligned.pa.%): \ -Output/$(TEST).misaligned.pa.%: Output/test.$(TEST).pa.% - $(VERB) grep $(K7_MISALIGNED_DATA) $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L1Misses.%): \ -Output/$(TEST).L1Misses.%: Output/test.$(TEST).% - $(VERB) grep $(K7_REFILL_SYSTEM) $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L1Misses.pa.%): \ -Output/$(TEST).L1Misses.pa.%: Output/test.$(TEST).pa.% - $(VERB) grep $(K7_REFILL_SYSTEM) $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L2Misses.%): \ -Output/$(TEST).L2Misses.%: Output/test.$(TEST).% - $(VERB) grep $(K7_REFILL_L2) $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L2Misses.pa.%): \ -Output/$(TEST).L2Misses.pa.%: Output/test.$(TEST).pa.% - $(VERB) grep $(K7_REFILL_L2) $< | awk '{print $$(NF)}' > $@ -endif - -# Pentium 4/Xeon Events -ifeq ($(EVENTS),$(P4_EVENTS)) -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L1Misses.%): \ -Output/$(TEST).L1Misses.%: Output/test.$(TEST).% - $(VERB) grep "$(P4_L1_READ_MISSES)" $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L1Misses.pa.%): \ -Output/$(TEST).L1Misses.pa.%: Output/test.$(TEST).pa.% - $(VERB) grep "$(P4_L1_READ_MISSES)" $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L2Misses.%): \ -Output/$(TEST).L2Misses.%: Output/test.$(TEST).% - $(VERB) grep "$(P4_L2_READ_MISSES)" $< | awk '{print $$(NF)}' > $@ - -$(PROGRAMS_TO_TEST:%=Output/$(TEST).L2Misses.pa.%): \ -Output/$(TEST).L2Misses.pa.%: Output/test.$(TEST).pa.% - $(VERB) grep "$(P4_L2_READ_MISSES)" $< | awk '{print $$(NF)}' > $@ -endif - -############################################################################ -# Rules for running the tests -############################################################################ - -ifndef PROGRAMS_HAVE_CUSTOM_RUN_RULES - -# -# Generate events for Pool Allocated CBE -# -$(PROGRAMS_TO_TEST:%=Output/test.$(TEST).pa.%): \ -Output/test.$(TEST).pa.%: Output/%.poolalloc.cbe Output/test.$(TEST).% - @echo "=========================================" - @echo "Running '$(TEST)' test on '$(TESTNAME)' program" - -$(PERFEX) -o $@ $(EVENTS) $< $(RUN_OPTIONS) > /dev/null 2>&1 < $(STDIN_FILENAME) - -# -# Generate events for CBE -# -$(PROGRAMS_TO_TEST:%=Output/test.$(TEST).%): \ -Output/test.$(TEST).%: Output/%.nonpa.cbe - @echo "=========================================" - @echo "Running '$(TEST)' test on '$(TESTNAME)' program" - -$(PERFEX) -o $@ $(EVENTS) $< $(RUN_OPTIONS) > /dev/null 2>&1 < $(STDIN_FILENAME) - -else - -# This rule runs the generated executable, generating timing information, for -# SPEC -$(PROGRAMS_TO_TEST:%=Output/test.$(TEST).pa.%): \ -Output/test.$(TEST).pa.%: Output/%.poolalloc.cbe Output/test.$(TEST).% - -$(SPEC_SANDBOX) poolalloccbe-$(RUN_TYPE) $@.out $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - $(PERFEX) -o $(BUILD_OBJ_DIR)/$@ $(EVENTS) $(BUILD_OBJ_DIR)/$< $(RUN_OPTIONS) - -# This rule runs the generated executable, generating timing information, for -# SPEC -$(PROGRAMS_TO_TEST:%=Output/test.$(TEST).%): \ -Output/test.$(TEST).%: Output/%.nonpa.cbe - -$(SPEC_SANDBOX) nonpacbe-$(RUN_TYPE) $@.out $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - $(PERFEX) -o $(BUILD_OBJ_DIR)/$@ $(EVENTS) $(BUILD_OBJ_DIR)/$< $(RUN_OPTIONS) -endif - -############################################################################ -# Report Targets -############################################################################ -ifeq ($(EVENTS),$(K7_EVENTS)) -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ -Output/%.$(TEST).report.txt: $(PROGRAMS_TO_TEST:%=Output/$(TEST).tlbmisses.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).tlbmisses.pa.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).misaligned.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).misaligned.pa.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L1Misses.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L1Misses.pa.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L2Misses.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L2Misses.pa.%) \ - $(PROGRAMS_TO_TEST:%=Output/%.poolalloc.out-cbe.time) \ - $(PROGRAMS_TO_TEST:%=Output/%.nonpa.out-cbe.time) - @echo "Program:" $* > $@ - @echo "-------------------------------------------------------------" >> $@ - @printf "CBE-PA-TLB-Misses: %lld\n" `cat Output/$(TEST).tlbmisses.pa.$*` >> $@ - @printf "CBE-TLB-Misses: %lld\n" `cat Output/$(TEST).tlbmisses.$*` >> $@ - @printf "CBE-PA-Misaligned: %lld\n" `cat Output/$(TEST).misaligned.pa.$*` >> $@ - @printf "CBE-Misaligned: %lld\n" `cat Output/$(TEST).misaligned.$*` >> $@ - @printf "CBE-PA-L1-Cache-Misses: %lld\n" `cat Output/$(TEST).L1Misses.pa.$*` >> $@ - @printf "CBE-L1-Cache-Misses: %lld\n" `cat Output/$(TEST).L1Misses.$*` >> $@ - @printf "CBE-PA-L2-Cache-Misses: %lld\n" `cat Output/$(TEST).L2Misses.pa.$*` >> $@ - @printf "CBE-L2-Cache-Misses: %lld\n" `cat Output/$(TEST).L2Misses.$*` >> $@ - @printf "CBE-RUN-TIME: " >> $@ - @grep "^program" Output/$*.nonpa.out-cbe.time >> $@ - @printf "CBE-PA-RUN-TIME: " >> $@ - @grep "^program" Output/$*.poolalloc.out-cbe.time >> $@ -endif - -ifeq ($(EVENTS),$(P4_EVENTS)) -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ -Output/%.$(TEST).report.txt: \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L1Misses.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L1Misses.pa.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L2Misses.%) \ - $(PROGRAMS_TO_TEST:%=Output/$(TEST).L2Misses.pa.%) - @echo "Program:" $* > $@ - @echo "-------------------------------------------------------------" >> $@ - @printf "CBE-PA-L1-Cache-Misses: %lld\n" `cat Output/$(TEST).L1Misses.pa.$*` >> $@ - @printf "CBE-L1-Cache-Misses: %lld\n" `cat Output/$(TEST).L1Misses.$*` >> $@ - @printf "CBE-PA-L2-Cache-Misses: %lld\n" `cat Output/$(TEST).L2Misses.pa.$*` >> $@ - @printf "CBE-L2-Cache-Misses: %lld\n" `cat Output/$(TEST).L2Misses.$*` >> $@ - -endif - -$(PROGRAMS_TO_TEST:%=test.$(TEST).%): \ -test.$(TEST).%: Output/%.$(TEST).report.txt - @echo "---------------------------------------------------------------" - @echo ">>> ========= '$(RELDIR)/$*' Program" - @echo "---------------------------------------------------------------" - @cat $< - -REPORT_DEPENDENCIES := $(PROGRAMS_TO_TEST:%=Output/%.poolalloc.out-cbe.time) \ - $(PROGRAMS_TO_TEST:%=Output/%.nonpa.out-cbe.time)
diff --git a/poolalloc/test/TEST.perf.report b/poolalloc/test/TEST.perf.report deleted file mode 100644 index 45c90a7..0000000 --- a/poolalloc/test/TEST.perf.report +++ /dev/null
@@ -1,94 +0,0 @@ -##=== TEST.poolalloc.report - Report description for poolalloc -*- perl -*-===## -# -# This file defines a report to be generated for the pool allocator tests. -# -##===----------------------------------------------------------------------===## - -# Sort by program name -$SortCol = 0; -$TrimRepeatedPrefix = 1; - -sub Ratio { - my ($Cols, $Col) = @_; - if ($Cols->[$Col-1] ne "*" and $Cols->[$Col-4] ne "*" and - $Cols->[$Col-1] != "0") { - return sprintf "%1.3f", $Cols->[$Col-4]/$Cols->[$Col-1]; - } else { - return "n/a"; - } -} - -sub Sum { - my ($Cols, $Col) = @_; - if ($Cols->[$Col-1] ne "*" and $Cols->[$Col-2] ne "*") { - return sprintf "%1.3f", $Cols->[$Col-2]+$Cols->[$Col-1]; - } else { - return "n/a"; - } -} - - -sub FormatTime { - my $Time = shift; - if ($Time =~ m/([0-9]+)[m:]([0-9.]+)/) { - $Time = sprintf("%7.3f", $1*60.0+$2); - } - return $Time; -} - -@LatexColumns = (2, 3, 4, 5, 6, 7); - -my $OLDEN = 'MultiSource/Benchmarks/Olden'; -my $FREEBENCH = 'MultiSource/Benchmarks/FreeBench'; -my $PTRDIST = 'MultiSource/Benchmarks/Ptrdist'; - -@LatexRowMapOrder = ( - "$OLDEN/bh/bh" => 'bh', - "$OLDEN/bisort/bisort" => 'bisort', - "$OLDEN/em3d/em3d" => 'em3d', - "$OLDEN/health/health" => 'health', - "$OLDEN/mst/mst" => 'mst', - "$OLDEN/perimeter/perimeter" => 'perimeter', - "$OLDEN/power/power" => 'power', - "$OLDEN/treeadd/treeadd" => 'treeadd', - "$OLDEN/tsp/tsp" => 'tsp', - "$OLDEN/voronoi/voronoi" => 'voronoi', - '-' => '-', - "$FREEBENCH/analyzer/analyzer" => 'analyzer', -# "$FREEBENCH/distray/distray" => 'distray', -# "$FREEBENCH/fourinarow/fourinarow" => 'fourinarow', -# "$FREEBENCH/mason/mason" => 'mason', - "$FREEBENCH/neural/neural" => 'neural', - "$FREEBENCH/pcompress2/pcompress2" => 'pcompress2', - "$FREEBENCH/pifft/pifft" => 'pifft', - '-' => '-', - "$PTRDIST/anagram/anagram" => 'anagram', - "$PTRDIST/bc/bc" => 'bc', - "$PTRDIST/ft/ft" => 'ft', - "$PTRDIST/ks/ks" => 'ks', - "$PTRDIST/yacr2/yacr2" => 'yacr2', - ); - - -# These are the columns for the report. The first entry is the header for the -# column, the second is the regex to use to match the value. Empty list create -# seperators, and closures may be put in for custom processing. -( -# Name - ["Name:" , '\'([^\']+)\' Program'], - [], -# Times - ["Time", 'CBE-RUN-TIME: program\s*([0-9.m]+)'], - ["L1 Misses", 'CBE-L1-Cache-Misses: ([0-9]+)'], - ["L2 Misses", 'CBE-L2-Cache-Misses: ([.0-9]+)'], - ["TLBMisses", 'CBE-TLB-Misses: ([0-9]+)'], - ["Misaligned", 'CBE-Misaligned: ([0-9]+)'], - [], - ["PA Time", 'CBE-PA-RUN-TIME: program\s*([0-9.m]+)'], - ["PA L1 Misses", 'CBE-PA-L1-Cache-Misses: ([0-9]+)'], - ["PA L2 Misses", 'CBE-PA-L2-Cache-Misses: ([.0-9]+)'], - ["PA TLB Misses", 'CBE-PA-TLB-Misses: ([0-9]+)'], - ["PA Misaligned", 'CBE-PA-Misaligned: ([0-9]+)'], - [] -); -
diff --git a/poolalloc/test/TEST.poolalloc.Makefile b/poolalloc/test/TEST.poolalloc.Makefile deleted file mode 100644 index c6d6128..0000000 --- a/poolalloc/test/TEST.poolalloc.Makefile +++ /dev/null
@@ -1,261 +0,0 @@ -##===- poolalloc/test/TEST.poolalloc.Makefile --------------*- Makefile -*-===## -# -# This test runs the pool allocator on all of the Programs, producing some -# performance numbers and statistics. -# -##===----------------------------------------------------------------------===## - -CFLAGS = -O2 -fno-strict-aliasing - -EXTRA_PA_FLAGS := - -# HEURISTIC can be set to: -# AllNodes -ifdef HEURISTIC -EXTRA_PA_FLAGS += -poolalloc-heuristic=$(HEURISTIC) -endif - - -CURDIR := $(shell cd .; pwd) -PROGDIR := $(shell cd $(LLVM_SRC_ROOT)/projects/llvm-test; pwd)/ -RELDIR := $(subst $(PROGDIR),,$(CURDIR)) - -# Pool allocator pass shared object -PA_SO := $(PROJECT_DIR)/Debug/lib/poolalloc$(SHLIBEXT) - -# Pool allocator runtime library -#PA_RT := $(PROJECT_DIR)/lib/Bytecode/libpoolalloc_fl_rt.bc -#PA_RT_O := $(PROJECT_DIR)/lib/$(CONFIGURATION)/poolalloc_rt.o -PA_RT_O := $(PROJECT_DIR)/Release/lib/poolalloc_rt.o -#PA_RT_O := $(PROJECT_DIR)/lib/Release/poolalloc_fl_rt.o - -# Command to run opt with the pool allocator pass loaded -OPT_PA := $(LOPT) -load $(PA_SO) - -# OPT_PA_STATS - Run opt with the -stats and -time-passes options, capturing the -# output to a file. -OPT_PA_STATS = $(OPT_PA) -info-output-file=$(CURDIR)/$@.info -stats -time-passes - -OPTZN_PASSES := -globaldce -ipsccp -deadargelim -adce -instcombine -simplifycfg - - -# This rule runs the pool allocator on the .llvm.bc file to produce a new .bc -# file -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).poolalloc.bc): \ -Output/%.$(TEST).poolalloc.bc: Output/%.llvm.bc $(PA_SO) $(LOPT) - -@rm -f $(CURDIR)/$@.info - -$(OPT_PA_STATS) -poolalloc $(EXTRA_PA_FLAGS) $(OPTZN_PASSES) -pooloptimize $< -o $@ -f 2>&1 > $@.out - -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).basepa.bc): \ -Output/%.$(TEST).basepa.bc: Output/%.llvm.bc $(PA_SO) $(LOPT) - -@rm -f $(CURDIR)/$@.info - -$(OPT_PA_STATS) -poolalloc -poolalloc-disable-alignopt -poolalloc-force-all-poolfrees -poolalloc-heuristic=AllNodes $(OPTZN_PASSES) $< -o $@ -f 2>&1 > $@.out - - -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).mallocrepl.bc): \ -Output/%.$(TEST).mallocrepl.bc: Output/%.llvm.bc $(PA_SO) $(LOPT) - -@rm -f $(CURDIR)/$@.info - -$(OPT_PA_STATS) -poolalloc -poolalloc-heuristic=AllInOneGlobalPool $(OPTZN_PASSES) $< -o $@ -f 2>&1 > $@.out - -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).onlyoverhead.bc): \ -Output/%.$(TEST).onlyoverhead.bc: Output/%.llvm.bc $(PA_SO) $(LOPT) - -@rm -f $(CURDIR)/$@.info - -$(OPT_PA_STATS) -poolalloc -poolalloc-heuristic=OnlyOverhead $(OPTZN_PASSES) $< -o $@ -f 2>&1 > $@.out - -$(PROGRAMS_TO_TEST:%=Output/%.nonpa.bc): \ -Output/%.nonpa.bc: Output/%.llvm.bc $(LOPT) - -@rm -f $(CURDIR)/$@.info - -$(LOPT) $(OPTZN_PASSES) $< -o $@ -f 2>&1 > $@.out - -# This rule compiles the new .bc file into a .c file using CBE -$(PROGRAMS_TO_TEST:%=Output/%.poolalloc.cbe.c): \ -Output/%.poolalloc.cbe.c: Output/%.$(TEST).poolalloc.bc $(LLC) - -$(LLC) -march=c -f $< -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.basepa.cbe.c): \ -Output/%.basepa.cbe.c: Output/%.$(TEST).basepa.bc $(LLC) - -$(LLC) -march=c -f $< -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.mallocrepl.cbe.c): \ -Output/%.mallocrepl.cbe.c: Output/%.$(TEST).mallocrepl.bc $(LLC) - -$(LLC) -march=c -f $< -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.onlyoverhead.cbe.c): \ -Output/%.onlyoverhead.cbe.c: Output/%.$(TEST).onlyoverhead.bc $(LLC) - -$(LLC) -march=c -f $< -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.nonpa.cbe.c): \ -Output/%.nonpa.cbe.c: Output/%.nonpa.bc $(LLC) - -$(LLC) -march=c -f $< -o $@ - - - -$(PROGRAMS_TO_TEST:%=Output/%.poolalloc.cbe): \ -Output/%.poolalloc.cbe: Output/%.poolalloc.cbe.c $(PA_RT_O) - -$(CC) $(CFLAGS) $< $(PA_RT_O) $(LLCLIBS) $(LDFLAGS) -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.basepa.cbe): \ -Output/%.basepa.cbe: Output/%.basepa.cbe.c $(PA_RT_O) - -$(CC) $(CFLAGS) $< $(PA_RT_O) $(LLCLIBS) $(LDFLAGS) -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.mallocrepl.cbe): \ -Output/%.mallocrepl.cbe: Output/%.mallocrepl.cbe.c $(PA_RT_O) - -$(CC) $(CFLAGS) $< $(PA_RT_O) $(LLCLIBS) $(LDFLAGS) -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.onlyoverhead.cbe): \ -Output/%.onlyoverhead.cbe: Output/%.onlyoverhead.cbe.c $(PA_RT_O) - -$(CC) $(CFLAGS) $< $(PA_RT_O) $(LLCLIBS) $(LDFLAGS) -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.nonpa.cbe): \ -Output/%.nonpa.cbe: Output/%.nonpa.cbe.c $(PA_RT_O) - -$(CC) $(CFLAGS) $< $(PA_RT_O) $(LLCLIBS) $(LDFLAGS) -o $@ - - - -ifndef PROGRAMS_HAVE_CUSTOM_RUN_RULES - -# This rule runs the generated executable, generating timing information, for -# normal test programs -$(PROGRAMS_TO_TEST:%=Output/%.poolalloc.out-cbe): \ -Output/%.poolalloc.out-cbe: Output/%.poolalloc.cbe - -$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS) - -$(PROGRAMS_TO_TEST:%=Output/%.basepa.out-cbe): \ -Output/%.basepa.out-cbe: Output/%.basepa.cbe - -$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS) - -$(PROGRAMS_TO_TEST:%=Output/%.mallocrepl.out-cbe): \ -Output/%.mallocrepl.out-cbe: Output/%.mallocrepl.cbe - -$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS) - -$(PROGRAMS_TO_TEST:%=Output/%.onlyoverhead.out-cbe): \ -Output/%.onlyoverhead.out-cbe: Output/%.onlyoverhead.cbe - -$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS) - -$(PROGRAMS_TO_TEST:%=Output/%.nonpa.out-cbe): \ -Output/%.nonpa.out-cbe: Output/%.nonpa.cbe - -$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS) -else - -# This rule runs the generated executable, generating timing information, for -# SPEC -$(PROGRAMS_TO_TEST:%=Output/%.poolalloc.out-cbe): \ -Output/%.poolalloc.out-cbe: Output/%.poolalloc.cbe - -$(SPEC_SANDBOX) poolalloccbe-$(RUN_TYPE) $@ $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - ../../$< $(RUN_OPTIONS) - -(cd Output/poolalloccbe-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ - -cp Output/poolalloccbe-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time - -$(PROGRAMS_TO_TEST:%=Output/%.basepa.out-cbe): \ -Output/%.basepa.out-cbe: Output/%.basepa.cbe - -$(SPEC_SANDBOX) basepacbe-$(RUN_TYPE) $@ $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - ../../$< $(RUN_OPTIONS) - -(cd Output/basepacbe-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ - -cp Output/basepacbe-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time - -$(PROGRAMS_TO_TEST:%=Output/%.mallocrepl.out-cbe): \ -Output/%.mallocrepl.out-cbe: Output/%.mallocrepl.cbe - -$(SPEC_SANDBOX) mallocreplcbe-$(RUN_TYPE) $@ $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - ../../$< $(RUN_OPTIONS) - -(cd Output/mallocreplcbe-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ - -cp Output/mallocreplcbe-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time - -$(PROGRAMS_TO_TEST:%=Output/%.onlyoverhead.out-cbe): \ -Output/%.onlyoverhead.out-cbe: Output/%.onlyoverhead.cbe - -$(SPEC_SANDBOX) onlyoverheadcbe-$(RUN_TYPE) $@ $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - ../../$< $(RUN_OPTIONS) - -(cd Output/onlyoverheadcbe-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ - -cp Output/onlyoverheadcbe-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time - -$(PROGRAMS_TO_TEST:%=Output/%.nonpa.out-cbe): \ -Output/%.nonpa.out-cbe: Output/%.nonpa.cbe - -$(SPEC_SANDBOX) nonpacbe-$(RUN_TYPE) $@ $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - ../../$< $(RUN_OPTIONS) - -(cd Output/nonpacbe-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ - -cp Output/nonpacbe-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time - -endif - - -# This rule diffs the post-poolallocated version to make sure we didn't break -# the program! -$(PROGRAMS_TO_TEST:%=Output/%.poolalloc.diff-cbe): \ -Output/%.poolalloc.diff-cbe: Output/%.out-nat Output/%.poolalloc.out-cbe - @cp Output/$*.out-nat Output/$*.poolalloc.out-nat - -$(DIFFPROG) cbe $*.poolalloc $(HIDEDIFF) - -$(PROGRAMS_TO_TEST:%=Output/%.basepa.diff-cbe): \ -Output/%.basepa.diff-cbe: Output/%.out-nat Output/%.basepa.out-cbe - @cp Output/$*.out-nat Output/$*.basepa.out-nat - -$(DIFFPROG) cbe $*.basepa $(HIDEDIFF) - -$(PROGRAMS_TO_TEST:%=Output/%.mallocrepl.diff-cbe): \ -Output/%.mallocrepl.diff-cbe: Output/%.out-nat Output/%.mallocrepl.out-cbe - @cp Output/$*.out-nat Output/$*.mallocrepl.out-nat - -$(DIFFPROG) cbe $*.mallocrepl $(HIDEDIFF) - -$(PROGRAMS_TO_TEST:%=Output/%.onlyoverhead.diff-cbe): \ -Output/%.onlyoverhead.diff-cbe: Output/%.out-nat Output/%.onlyoverhead.out-cbe - @cp Output/$*.out-nat Output/$*.onlyoverhead.out-nat - -$(DIFFPROG) cbe $*.onlyoverhead $(HIDEDIFF) - -$(PROGRAMS_TO_TEST:%=Output/%.nonpa.diff-cbe): \ -Output/%.nonpa.diff-cbe: Output/%.out-nat Output/%.nonpa.out-cbe - @cp Output/$*.out-nat Output/$*.nonpa.out-nat - -$(DIFFPROG) cbe $*.nonpa $(HIDEDIFF) - - -# This rule wraps everything together to build the actual output the report is -# generated from. -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ -Output/%.$(TEST).report.txt: Output/%.out-nat \ - Output/%.nonpa.diff-cbe \ - Output/%.poolalloc.diff-cbe \ - Output/%.basepa.diff-cbe \ - Output/%.mallocrepl.diff-cbe \ - Output/%.onlyoverhead.diff-cbe \ - Output/%.LOC.txt - @echo > $@ - @-if test -f Output/$*.nonpa.diff-cbe; then \ - printf "GCC-RUN-TIME: " >> $@;\ - grep "^program" Output/$*.out-nat.time >> $@;\ - fi - @-if test -f Output/$*.nonpa.diff-cbe; then \ - printf "CBE-RUN-TIME-NORMAL: " >> $@;\ - grep "^program" Output/$*.nonpa.out-cbe.time >> $@;\ - fi - @-if test -f Output/$*.mallocrepl.diff-cbe; then \ - printf "CBE-RUN-TIME-MALLOCREPL: " >> $@;\ - grep "^program" Output/$*.mallocrepl.out-cbe.time >> $@;\ - fi - @-if test -f Output/$*.onlyoverhead.diff-cbe; then \ - printf "CBE-RUN-TIME-ONLYOVERHEAD: " >> $@;\ - grep "^program" Output/$*.onlyoverhead.out-cbe.time >> $@;\ - fi - @-if test -f Output/$*.basepa.diff-cbe; then \ - printf "CBE-RUN-TIME-BASEPA: " >> $@;\ - grep "^program" Output/$*.basepa.out-cbe.time >> $@;\ - fi - @-if test -f Output/$*.poolalloc.diff-cbe; then \ - printf "CBE-RUN-TIME-POOLALLOC: " >> $@;\ - grep "^program" Output/$*.poolalloc.out-cbe.time >> $@;\ - fi - printf "LOC: " >> $@ - cat Output/$*.LOC.txt >> $@ - @cat Output/$*.$(TEST).poolalloc.bc.info >> $@ - @#cat Output/$*.$(TEST).basepa.bc.out >> $@ - - -$(PROGRAMS_TO_TEST:%=test.$(TEST).%): \ -test.$(TEST).%: Output/%.$(TEST).report.txt - @echo "---------------------------------------------------------------" - @echo ">>> ========= '$(RELDIR)/$*' Program" - @echo "---------------------------------------------------------------" - @cat $< - -REPORT_DEPENDENCIES := $(PA_RT_O) $(PA_SO) $(PROGRAMS_TO_TEST:%=Output/%.llvm.bc) $(LLC) $(LOPT)
diff --git a/poolalloc/test/TEST.poolalloc.report b/poolalloc/test/TEST.poolalloc.report deleted file mode 100644 index aca9340..0000000 --- a/poolalloc/test/TEST.poolalloc.report +++ /dev/null
@@ -1,106 +0,0 @@ -##=== TEST.poolalloc.report - Report description for poolalloc -*- perl -*-===## -# -# This file defines a report to be generated for the pool allocator tests. -# -##===----------------------------------------------------------------------===## - -# Sort by program name -$SortCol = 0; -$TrimRepeatedPrefix = 1; - -# FormatTime - Convert a time from 1m23.45 into 83.45 -sub FormatTime { - my $Time = shift; - if ($Time =~ m/([0-9]+)[m:]([0-9.]+)/) { - return sprintf("%7.3f", $1*60.0+$2); - } - - return sprintf("%6.2f", $Time); -} - - -sub RuntimePercent { - my ($Cols, $Col) = @_; - if ($Cols->[$Col-1] ne "*" and $Cols->[4] ne "*" and - $Cols->[4] != "0") { - return sprintf "%7.2f", 100*$Cols->[$Col-1]/$Cols->[4]; - } else { - return "n/a"; - } -} - -@LatexColumns = (1, 5, 8, 12, 9, 13, 14, 15, 2, 16); - -my $FREEBENCH = 'MultiSource/Benchmarks/FreeBench'; -my $PTRDIST = 'MultiSource/Benchmarks/Ptrdist'; - -@LatexRowMapOrder = ( - '164.gzip/164.gzip' => '164.gzip', - '175.vpr/175.vpr' => '175.vpr', - '181.mcf/181.mcf' => '181.mcf', - '186.crafty/186.crafty' => '186.crafty', - '197.parser/197.parser' => '197.parser', - '197.parser.hacked/197.parser.hacked' => '197.parser(b)', - '255.vortex/255.vortex' => '255.vortex', - '256.bzip2/256.bzip2' => '256.bzip2', - '300.twolf/300.twolf' => '300.twolf', - '-' => '-', - "anagram/anagram" => 'anagram', - "bc/bc" => 'bc', - "ft/ft" => 'ft', - "ks/ks" => 'ks', - "yacr2/yacr2" => 'yacr2', - '-' => '-', - "analyzer" => 'analyzer', - "neural" => 'neural', - "pcompress2" => 'pcompress2', - "piff2" => 'piff2', - '-' => '-', - "bh/bh" => 'bh', - "bisort/bisort" => 'bisort', - "em3d/em3d" => 'em3d', - "health/health" => 'health', - "mst/mst" => 'mst', - "perimeter/perimeter" => 'perimeter', - "power/power" => 'power', - "treeadd/treeadd" => 'treeadd', - "tsp/tsp" => 'tsp', - '-' => '-', - "llu" => 'llu-bench', - ); - - -# These are the columns for the report. The first entry is the header for the -# column, the second is the regex to use to match the value. Empty list create -# seperators, and closures may be put in for custom processing. -( -# Name - ["Name:" , '\'([^\']+)\' Program'], - ["LOC" , 'LOC:\s*([0-9]+)'], - [], -# Times - ["GCC", 'GCC-RUN-TIME: program\s*([.0-9m:]+)', \&FormatTime], - ["NonPATime", 'CBE-RUN-TIME-NORMAL: program\s*([.0-9m:]+)', \&FormatTime], - [], - ["OnlyOHTime", 'CBE-RUN-TIME-ONLYOVERHEAD: program\s*([.0-9m:]+)', \&FormatTime], - ["OO run%", \&RuntimePercent], - [], - ["ReplTime", 'CBE-RUN-TIME-MALLOCREPL: program\s*([.0-9m:]+)', \&FormatTime], - ["MR run%", \&RuntimePercent], - [], - ["PA Time", 'CBE-RUN-TIME-POOLALLOC: program\s*([.0-9m:]+)', \&FormatTime], - ["PA run%", \&RuntimePercent], - [], - ["Basepa", 'CBE-RUN-TIME-BASEPA: program\s*([.0-9m:]+)', \&FormatTime], - ["Base run%", \&RuntimePercent], - [], - ["NumPools", '([0-9]+).*Number of pools allocated'], - ["Typesafe", '([0-9]+).*Number of typesafe pools'], - ["BumpPtr", '([0-9]+).*Number of bump pointer pools'], - ["PFE", '([0-9]+).*Number of poolfree.s elided'], - ["NumArgs", '([0-9]+).*Number of function arguments added'], - ["MaxArgs", '([0-9]+).*Maximum function arguments added'], -#["Nonprofit", '([0-9]+).*Number of DSNodes not profitable'], - [] -); -
diff --git a/poolalloc/test/TEST.ptrcomp.Makefile b/poolalloc/test/TEST.ptrcomp.Makefile deleted file mode 100755 index 409f426..0000000 --- a/poolalloc/test/TEST.ptrcomp.Makefile +++ /dev/null
@@ -1,144 +0,0 @@ -##===- poolalloc/test/TEST.ptrcomp.Makefile ----------------*- Makefile -*-===## -# -# This test runs the pool allocator and pointer compressor on all of the -# programs, producing some performance numbers and statistics. -# -##===----------------------------------------------------------------------===## - -CFLAGS = -O2 -fno-strict-aliasing - -EXTRA_PA_FLAGS := - -CURDIR := $(shell cd .; pwd) -PROGDIR := $(shell cd $(LLVM_SRC_ROOT)/projects/llvm-test; pwd)/ -RELDIR := $(subst $(PROGDIR),,$(CURDIR)) - -# Pool allocator pass shared object -PA_SO := $(PROJECT_DIR)/Debug/lib/poolalloc$(SHLIBEXT) - -# Pool allocator runtime library -#PA_RT := $(PROJECT_DIR)/lib/Bytecode/libpoolalloc_fl_rt.bc -#PA_RT_O := $(PROJECT_DIR)/lib/$(CONFIGURATION)/poolalloc_rt.o -PA_RT_O := $(PROJECT_DIR)/Release/lib/poolalloc_rt.o -#PA_RT_O := $(PROJECT_DIR)/lib/Release/poolalloc_fl_rt.o - -# Command to run opt with the pool allocator pass loaded -OPT_PA := $(LOPT) -load $(PA_SO) - -# OPT_PA_STATS - Run opt with the -stats and -time-passes options, capturing the -# output to a file. -OPT_PA_STATS = $(OPT_PA) -info-output-file=$(CURDIR)/$@.info -stats -time-passes - -OPTZN_PASSES := -globaldce -ipsccp -deadargelim -adce -instcombine -simplifycfg - - -# This rule runs the pool allocator on the .llvm.bc file to produce a new .bc -# file -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).poolalloc.bc): \ -Output/%.$(TEST).poolalloc.bc: Output/%.llvm.bc $(PA_SO) $(LOPT) - -@rm -f $(CURDIR)/$@.info - -$(OPT_PA_STATS) -poolalloc $(EXTRA_PA_FLAGS) $(OPTZN_PASSES) $< -o $@ -f 2>&1 > $@.out - -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).ptrcomp64.bc): \ -Output/%.$(TEST).ptrcomp64.bc: Output/%.llvm.bc $(PA_SO) $(LOPT) - -@rm -f $(CURDIR)/$@.info - -$(OPT_PA_STATS) -pointercompress $(OPTZN_PASSES) $< -o $@ -f 2>&1 > $@.out - -# This rule compiles the new .bc file into a .c file using CBE -$(PROGRAMS_TO_TEST:%=Output/%.poolalloc.cbe.c): \ -Output/%.poolalloc.cbe.c: Output/%.$(TEST).poolalloc.bc $(LLC) - -$(LLC) -march=c -f $< -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.ptrcomp64.cbe.c): \ -Output/%.ptrcomp64.cbe.c: Output/%.$(TEST).ptrcomp64.bc $(LLC) - -$(LLC) -march=c -f $< -o $@ - - - -$(PROGRAMS_TO_TEST:%=Output/%.poolalloc.cbe): \ -Output/%.poolalloc.cbe: Output/%.poolalloc.cbe.c $(PA_RT_O) - -$(CC) $(CFLAGS) $< $(PA_RT_O) $(LLCLIBS) $(LDFLAGS) -o $@ - -$(PROGRAMS_TO_TEST:%=Output/%.ptrcomp64.cbe): \ -Output/%.ptrcomp64.cbe: Output/%.ptrcomp64.cbe.c $(PA_RT_O) - -$(CC) $(CFLAGS) $< $(PA_RT_O) $(LLCLIBS) $(LDFLAGS) -o $@ - - -ifndef PROGRAMS_HAVE_CUSTOM_RUN_RULES - -# This rule runs the generated executable, generating timing information, for -# normal test programs -$(PROGRAMS_TO_TEST:%=Output/%.poolalloc.out-cbe): \ -Output/%.poolalloc.out-cbe: Output/%.poolalloc.cbe - -$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS) - -$(PROGRAMS_TO_TEST:%=Output/%.ptrcomp64.out-cbe): \ -Output/%.ptrcomp64.out-cbe: Output/%.ptrcomp64.cbe - -$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS) - -else - -# This rule runs the generated executable, generating timing information, for -# SPEC -$(PROGRAMS_TO_TEST:%=Output/%.poolalloc.out-cbe): \ -Output/%.poolalloc.out-cbe: Output/%.poolalloc.cbe - -$(SPEC_SANDBOX) poolalloccbe-$(RUN_TYPE) $@ $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - ../../$< $(RUN_OPTIONS) - -(cd Output/poolalloccbe-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ - -cp Output/poolalloccbe-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time - -$(PROGRAMS_TO_TEST:%=Output/%.ptrcomp64.out-cbe): \ -Output/%.ptrcomp64.out-cbe: Output/%.ptrcomp64.cbe - -$(SPEC_SANDBOX) ptrcomp64cbe-$(RUN_TYPE) $@ $(REF_IN_DIR) \ - $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - ../../$< $(RUN_OPTIONS) - -(cd Output/ptrcomp64cbe-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ - -cp Output/ptrcomp64cbe-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time - -endif - - -# This rule diffs the post-poolallocated version to make sure we didn't break -# the program! -$(PROGRAMS_TO_TEST:%=Output/%.poolalloc.diff-cbe): \ -Output/%.poolalloc.diff-cbe: Output/%.out-nat Output/%.poolalloc.out-cbe - @cp Output/$*.out-nat Output/$*.poolalloc.out-nat - -$(DIFFPROG) cbe $*.poolalloc $(HIDEDIFF) - -$(PROGRAMS_TO_TEST:%=Output/%.ptrcomp64.diff-cbe): \ -Output/%.ptrcomp64.diff-cbe: Output/%.out-nat Output/%.ptrcomp64.out-cbe - @cp Output/$*.out-nat Output/$*.ptrcomp64.out-nat - -$(DIFFPROG) cbe $*.ptrcomp64 $(HIDEDIFF) - - -# This rule wraps everything together to build the actual output the report is -# generated from. -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ -Output/%.$(TEST).report.txt: Output/%.out-nat \ - Output/%.poolalloc.diff-cbe \ - Output/%.ptrcomp64.diff-cbe \ - Output/%.LOC.txt - @echo > $@ - @-if test -f Output/$*.ptrcomp64.diff-cbe; then \ - printf "CBE-RUN-TIME-PTRCOMP64: " >> $@;\ - grep "^program" Output/$*.ptrcomp64.out-cbe.time >> $@;\ - fi - @-if test -f Output/$*.poolalloc.diff-cbe; then \ - printf "CBE-RUN-TIME-POOLALLOC: " >> $@;\ - grep "^program" Output/$*.poolalloc.out-cbe.time >> $@;\ - fi - printf "LOC: " >> $@ - cat Output/$*.LOC.txt >> $@ - @cat Output/$*.$(TEST).ptrcomp64.bc.info >> $@ - @#cat Output/$*.$(TEST).ptrcomp64.bc.out >> $@ - - -$(PROGRAMS_TO_TEST:%=test.$(TEST).%): \ -test.$(TEST).%: Output/%.$(TEST).report.txt - @echo "---------------------------------------------------------------" - @echo ">>> ========= '$(RELDIR)/$*' Program" - @echo "---------------------------------------------------------------" - @cat $< - -REPORT_DEPENDENCIES := $(PA_RT_O) $(PA_SO) $(PROGRAMS_TO_TEST:%=Output/%.llvm.bc) $(LLC) $(LOPT)
diff --git a/poolalloc/test/TEST.ptrcomp.report b/poolalloc/test/TEST.ptrcomp.report deleted file mode 100644 index 0d61989..0000000 --- a/poolalloc/test/TEST.ptrcomp.report +++ /dev/null
@@ -1,78 +0,0 @@ -##=== TEST.ptrcomp.report - Report description for ptrcomp -----*- perl -*-===## -# -# This file defines a report to be generated for the pointer compression tests. -# -##===----------------------------------------------------------------------===## - -# Sort by program name -$SortCol = 0; -$TrimRepeatedPrefix = 1; - -# FormatTime - Convert a time from 1m23.45 into 83.45 -sub FormatTime { - my $Time = shift; - if ($Time =~ m/([0-9]+)[m:]([0-9.]+)/) { - return sprintf("%7.3f", $1*60.0+$2); - } - - return sprintf("%6.2f", $Time); -} - - -sub RuntimePercent { - my ($Cols, $Col) = @_; - if ($Cols->[$Col-1] ne "*" and $Cols->[3] ne "*" and - $Cols->[3] != "0") { - return sprintf "%7.2f", 100*$Cols->[$Col-1]/$Cols->[3]; - } else { - return "n/a"; - } -} - -@LatexColumns = (1, 5, 8, 12, 9, 13, 14, 15, 2, 16); - -my $FREEBENCH = 'MultiSource/Benchmarks/FreeBench'; -my $PTRDIST = 'MultiSource/Benchmarks/Ptrdist'; - -@LatexRowMapOrder = ( - "anagram/anagram" => 'anagram', - "bc/bc" => 'bc', - "ft/ft" => 'ft', - "ks/ks" => 'ks', - "yacr2/yacr2" => 'yacr2', - '-' => '-', - '164.gzip/164.gzip' => '164.gzip', - '175.vpr/175.vpr' => '175.vpr', - '181.mcf/181.mcf' => '181.mcf', - '186.crafty/186.crafty' => '186.crafty', - '197.parser/197.parser' => '197.parser', - '197.parser.hacked/197.parser.hacked' => '197.parser(b)', - '255.vortex/255.vortex' => '255.vortex', - '256.bzip2/256.bzip2' => '256.bzip2', - '300.twolf/300.twolf' => '300.twolf', - '-' => '-', - "analyzer" => 'analyzer', - "llu" => 'llu-bench', - ); - - -# These are the columns for the report. The first entry is the header for the -# column, the second is the regex to use to match the value. Empty list create -# seperators, and closures may be put in for custom processing. -( -# Name - ["Name:" , '\'([^\']+)\' Program'], - ["LOC" , 'LOC:\s*([0-9]+)'], - [], -# Times - ["PA Time", 'CBE-RUN-TIME-POOLALLOC: program\s*([.0-9m:]+)', \&FormatTime], - ["PC Time", 'CBE-RUN-TIME-PTRCOMP64: program\s*([.0-9m:]+)', \&FormatTime], - ["PC run%", \&RuntimePercent], - [], - ["NumPools", '([0-9]+).*Number of pools allocated'], - ["Typesafe", '([0-9]+).*Number of typesafe pools'], - ["NumArgs", '([0-9]+).*Number of function arguments added'], -#["Nonprofit", '([0-9]+).*Number of DSNodes not profitable'], - [] -); -
diff --git a/poolalloc/test/TEST.strace.Makefile b/poolalloc/test/TEST.strace.Makefile deleted file mode 100644 index fe00af4..0000000 --- a/poolalloc/test/TEST.strace.Makefile +++ /dev/null
@@ -1,55 +0,0 @@ -##===- poolalloc/TEST.strace.Makefile ----------------------*- Makefile -*-===## -# -# Makefile for measuring system call activity with strace -# -##===----------------------------------------------------------------------===## - -TESTNAME = $* -CURDIR := $(shell cd .; pwd) -PROGDIR := $(shell cd $(LLVM_SRC_ROOT)/projects/llvm-test; pwd)/ -RELDIR := $(subst $(PROGDIR),,$(CURDIR)) - -STRACE := strace -c -f - -# -# Once the results are generated, create files containing each individiual -# piece of performance information. -# - -# -# Generate events for Pool Allocated CBE -# -$(PROGRAMS_TO_TEST:%=Output/test.$(TEST).pa.%): \ -Output/test.$(TEST).pa.%: Output/%.poolalloc.cbe Output/test.$(TEST).% - @echo "=========================================" - @echo "Running '$(TEST)' test on '$(TESTNAME)' program" -ifeq ($(RUN_OPTIONS),) - $(VERB) cat $(STDIN_FILENAME) | $(STRACE) -o $@ $< -else - $(VERB) cat $(STDIN_FILENAME) | $(STRACE) -o $@ $< $(RUN_OPTIONS) -endif - -# -# Generate events for CBE -# -$(PROGRAMS_TO_TEST:%=Output/test.$(TEST).%): \ -Output/test.$(TEST).%: Output/%.cbe - @echo "=========================================" - @echo "Running '$(TEST)' test on '$(TESTNAME)' program" -ifeq ($(RUN_OPTIONS),) - $(VERB) cat $(STDIN_FILENAME) | $(STRACE) -o $@ $< -else - $(VERB) cat $(STDIN_FILENAME) | $(STRACE) -o $@ $< $(RUN_OPTIONS) -endif - -$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ -Output/%.$(TEST).report.txt: Output/test.$(TEST).pa.% Output/test.$(TEST).% - touch $@ - -$(PROGRAMS_TO_TEST:%=test.$(TEST).%): \ -test.$(TEST).%: Output/%.$(TEST).report.txt - @echo "---------------------------------------------------------------" - @echo ">>> ========= '$(RELDIR)/$*' Program" - @echo "---------------------------------------------------------------" - @cat $< -
diff --git a/television/LICENSE.TXT b/television/LICENSE.TXT deleted file mode 100644 index 0e09035..0000000 --- a/television/LICENSE.TXT +++ /dev/null
@@ -1,41 +0,0 @@ -============================================================================== -LLVM-TV Release License -============================================================================== -University of Illinois/NCSA -Open Source License - -Copyright (c) 2003, 2004 University of Illinois at Urbana-Champaign. -All rights reserved. - -Developed by: - - Misha Brukman, Tanya Brethour, and Brian Gaeke - - University of Illinois at Urbana-Champaign - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE.
diff --git a/television/Makefile b/television/Makefile deleted file mode 100755 index 90c9d9d..0000000 --- a/television/Makefile +++ /dev/null
@@ -1,29 +0,0 @@ -# -# This is a sample Makefile for a project that uses LLVM. -# - -# -# Indicates our relative path to the top of the project's root directory. -# -LEVEL = . - -# -# Directories that needs to be built. -# -DIRS = lib tools - -# -# This is needed since the tags generation code expects a tools directory -# to exist. -# -#all:: -# mkdir -p tools - -# -# Include the Master Makefile that knows how to build all. -# -include $(LEVEL)/Makefile.common - -distclean:: clean - ${RM} -f Makefile.common Makefile.config config.log config.status -
diff --git a/television/Makefile.common b/television/Makefile.common deleted file mode 100644 index 1e1e89e..0000000 --- a/television/Makefile.common +++ /dev/null
@@ -1,19 +0,0 @@ -#===-- Makefile.common - Common make rules for LLVM-TV -----*- Makefile -*--===# -# -# The LLVM Compiler Infrastructure -# -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. -# -#===------------------------------------------------------------------------===# - -# -# Include the local config file -# -include $(LEVEL)/Makefile.config - -# -# Include LLVM's Master Makefile. -# -include $(LLVM_SRC_ROOT)/Makefile.rules -
diff --git a/television/Makefile.config.in b/television/Makefile.config.in deleted file mode 100644 index 132290d..0000000 --- a/television/Makefile.config.in +++ /dev/null
@@ -1,30 +0,0 @@ -PROJECT_NAME = @PACKAGE_NAME@ -PROJ_VERSION = @PACKAGE_VERSION@ - -# -# Set this variable to the top of the LLVM source tree. -# -LLVM_SRC_ROOT = @LLVM_SRC@ - -# -# Set this variable to the top level directory where LLVM was built -# (this is *not* the same as OBJ_ROOT as defined in LLVM's Makefile.config). -# -LLVM_OBJ_ROOT = @LLVM_OBJ@ - -# Set the directory root of this project's source files -PROJ_SRC_ROOT := $(subst //,/,@abs_top_srcdir@) - -# Set the root directory of this project's object files -PROJ_OBJ_ROOT := $(subst //,/,@abs_top_builddir@) - -# Set the root directory of this project's install prefix -PROJ_INSTALL_ROOT := @prefix@ - -# Include LLVM's Master Makefile. -include $(LLVM_OBJ_ROOT)/Makefile.config - -#Set SourceDir for backwards compatbility. -ifndef SourceDir -SourceDir=$(PROJ_SRC_DIR) -endif
diff --git a/television/README.txt b/television/README.txt deleted file mode 100644 index e983cde..0000000 --- a/television/README.txt +++ /dev/null
@@ -1,47 +0,0 @@ -LLVM-TV: LLVM Transformation Visualizer -Written by: Misha Brukman, Tanya Brethour, and Brian Gaeke - -LLVM-TV is a tool that can be used to visualize the effects of transformations -written in the LLVM framework. Compilation units in LLVM have a simple, -hierarchical structure: a Module contains Functions, which contain BasicBlocks, -which contain Instructions. At the lowest level of this hierarchy, Instructions -may reference other BasicBlocks (with branches) or Functions (with calls), -making the control-flow graphs and call graphs explicit. Our first task is to -develop an interactive browser for these graphs and hierarchies. - -Our target audience is compiler developers working within the LLVM framework, -who are trying to understand and debug transformations. - -Currently, the visualization tool will not reflect dynamic updates -to the code; rather, it reflects the state of a compilation unit at -a single instant in time, between transformations. Future work should -extend this tool to reflect a dynamically updating view of the program as -a transformation is modifying the code. - -How to compile: - -1. You must have wxWindows installed on your system, and wx-config has to be - in your path. - - Make absolutely sure that wxwindows's configure picks up the same - C++ compiler that you're using for llvm. Otherwise, you may get - weird link errors when trying to link the llvm-tv tool. - -2. Configure and compile llvm-tv (you need an LLVM source and build trees): - -% cd path/to/llvm-tv -% ./configure --with-llvmsrc=[path] --with-llvmobj=[path] - If you're building in llvm/projects/llvm-tv, then you don't need - to specify these --with options. -% gmake - -Example of usage: - -% llvm-tv.exe & - The .exe is not a typo; this command starts up the visualizer in - the background using its wrapper script. -% opt-snap -debug -licm -snapshot -gcse -snapshot < bytecode-file.bc > /dev/null - This runs the llvm optimizer driver with the snapshot pass loaded, using - another wrapper script, and makes two snapshots, which should appear - in your visualizer. -
diff --git a/television/autoconf/AutoRegen.sh b/television/autoconf/AutoRegen.sh deleted file mode 100755 index 6976591..0000000 --- a/television/autoconf/AutoRegen.sh +++ /dev/null
@@ -1,43 +0,0 @@ -#!/bin/sh -die () { - echo "$@" 1>&2 - exit 1 -} -outfile=configure -configfile=configure.ac -test -d autoconf && test -f autoconf/$configfile && cd autoconf -test -f $configfile || die "Can't find 'autoconf' dir; please cd into it first" -autoconf --version | egrep '2\.59' > /dev/null -if test $? -ne 0 ; then - die "Your autoconf was not detected as being 2.59" -fi -aclocal --version | egrep '1\.9\.2' > /dev/null -if test $? -ne 0 ; then - die "Your aclocal was not detected as being 1.9.2" -fi -autoheader --version | egrep '2\.59' > /dev/null -if test $? -ne 0 ; then - die "Your autoheader was not detected as being 2.59" -fi -libtool --version | grep '1\.5\.10' > /dev/null -if test $? -ne 0 ; then - die "Your libtool was not detected as being 1.5.10" -fi -echo "" -echo "### NOTE: ############################################################" -echo "### If you get *any* warnings from autoconf below you MUST fix the" -echo "### scripts in the m4 directory because there are future forward" -echo "### compatibility or platform support issues at risk. Please do NOT" -echo "### commit any configure script that was generated with warnings" -echo "### present. You should get just three 'Regenerating..' lines." -echo "######################################################################" -echo "" -#echo "Regenerating aclocal.m4 with aclocal 1.9.2" -#cwd=`pwd` -#aclocal --force -I $cwd/m4 || die "aclocal failed" -echo "Regenerating configure with autoconf 2.59" -autoconf --force --warnings=all -o ../$outfile $configfile || die "autoconf failed" -cd .. -echo "Regenerating config.h.in with autoheader 2.59" -#autoheader --warnings=all -I autoconf -I autoconf/m4 autoconf/$configfile || die "autoheader failed" -exit 0
diff --git a/television/autoconf/aclocal.m4 b/television/autoconf/aclocal.m4 deleted file mode 100644 index e9b9180..0000000 --- a/television/autoconf/aclocal.m4 +++ /dev/null
@@ -1,6168 +0,0 @@ -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -## Copyright 1996, 1997, 1998, 1999, 2000, 2001 -## Free Software Foundation, Inc. -## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 -## -## This program 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. - -# serial 47 AC_PROG_LIBTOOL - - -# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) -# ----------------------------------------------------------- -# If this macro is not defined by Autoconf, define it here. -m4_ifdef([AC_PROVIDE_IFELSE], - [], - [m4_define([AC_PROVIDE_IFELSE], - [m4_ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - - -# AC_PROG_LIBTOOL -# --------------- -AC_DEFUN([AC_PROG_LIBTOOL], -[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl -dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX -dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. - AC_PROVIDE_IFELSE([AC_PROG_CXX], - [AC_LIBTOOL_CXX], - [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX - ])]) -dnl And a similar setup for Fortran 77 support - AC_PROVIDE_IFELSE([AC_PROG_F77], - [AC_LIBTOOL_F77], - [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 -])]) - -dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. -dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run -dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. - AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [ifdef([AC_PROG_GCJ], - [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([A][M_PROG_GCJ], - [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([LT_AC_PROG_GCJ], - [define([LT_AC_PROG_GCJ], - defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) -])])# AC_PROG_LIBTOOL - - -# _AC_PROG_LIBTOOL -# ---------------- -AC_DEFUN([_AC_PROG_LIBTOOL], -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl -AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/mklib' -AC_SUBST(LIBTOOL)dnl - -# Prevent multiple expansion -define([AC_PROG_LIBTOOL], []) -])# _AC_PROG_LIBTOOL - - -# AC_LIBTOOL_SETUP -# ---------------- -AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.50)dnl -AC_REQUIRE([AC_ENABLE_SHARED])dnl -AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_LD])dnl -AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl -AC_REQUIRE([AC_PROG_NM])dnl - -AC_REQUIRE([AC_PROG_LN_S])dnl -AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! -AC_REQUIRE([AC_OBJEXT])dnl -AC_REQUIRE([AC_EXEEXT])dnl -dnl - -AC_LIBTOOL_SYS_MAX_CMD_LEN -AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -AC_LIBTOOL_OBJDIR - -AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -_LT_AC_PROG_ECHO_BACKSLASH - -case $host_os in -aix3*) - # 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. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# 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'] - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=mklib -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -AC_CHECK_TOOL(AR, ar, false) -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - AC_PATH_MAGIC - fi - ;; -esac - -AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -enable_win32_dll=yes, enable_win32_dll=no) - -AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -AC_ARG_WITH([pic], - [AC_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) -test -z "$pic_mode" && pic_mode=default - -# Use C for the default configuration in the libtool script -tagname= -AC_LIBTOOL_LANG_C_CONFIG -_LT_AC_TAGCONFIG -])# AC_LIBTOOL_SETUP - - -# _LT_AC_SYS_COMPILER -# ------------------- -AC_DEFUN([_LT_AC_SYS_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_AC_SYS_COMPILER - - -# _LT_AC_SYS_LIBPATH_AIX -# ---------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], -[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_AC_SYS_LIBPATH_AIX - - -# _LT_AC_SHELL_INIT(ARG) -# ---------------------- -AC_DEFUN([_LT_AC_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_AC_SHELL_INIT - - -# _LT_AC_PROG_ECHO_BACKSLASH -# -------------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. -AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[_LT_AC_SHELL_INIT([ -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; -esac - -echo=${ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -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 - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<EOF -[$]* -EOF - exit 0 -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -if test -z "$ECHO"; then -if test "X${echo_test_string+set}" != Xset; then -# 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' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : -else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "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 echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - 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-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -ECHO=$echo -if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi - -AC_SUBST(ECHO) -])])# _LT_AC_PROG_ECHO_BACKSLASH - - -# _LT_AC_LOCK -# ----------- -AC_DEFUN([_LT_AC_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -[*-*-cygwin* | *-*-mingw* | *-*-pw32*) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; - ]) -esac - -need_locks="$enable_libtool_lock" - -])# _LT_AC_LOCK - - -# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # 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 - $2=yes - fi - fi - $rm conftest* -]) - -if test x"[$]$2" = xyes; then - ifelse([$5], , :, [$5]) -else - ifelse([$6], , :, [$6]) -fi -])# AC_LIBTOOL_COMPILER_OPTION - - -# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ------------------------------------------------------------ -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # 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 - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - else - $2=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - ifelse([$4], , :, [$4]) -else - ifelse([$5], , :, [$5]) -fi -])# AC_LIBTOOL_LINKER_OPTION - - -# AC_LIBTOOL_SYS_MAX_CMD_LEN -# -------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], -[# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - testring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ - = "XX$testring") >/dev/null 2>&1 && - new_result=`expr "X$testring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - testring=$testring$testring - done - testring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -])# AC_LIBTOOL_SYS_MAX_CMD_LEN - - -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h)dnl -])# _LT_AC_CHECK_DLFCN - - -# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ------------------------------------------------------------------ -AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<EOF -[#line __oline__ "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include <dlfcn.h> -#endif - -#include <stdio.h> - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -}] -EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_unknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_AC_TRY_DLOPEN_SELF - - -# AC_LIBTOOL_DLOPEN_SELF -# ------------------- -AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -])# AC_LIBTOOL_DLOPEN_SELF - - -# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) -# --------------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler -AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - # 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 . - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . - $rm conftest* out/* - rmdir out - cd .. - rmdir conftest - $rm conftest* -]) -])# AC_LIBTOOL_PROG_CC_C_O - - -# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) -# ----------------------------------------- -# Check to see if we can do hard links to lock some files if needed -AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], -[AC_REQUIRE([_LT_AC_LOCK])dnl - -hard_links="nottested" -if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - 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 - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS - - -# AC_LIBTOOL_OBJDIR -# ----------------- -AC_DEFUN([AC_LIBTOOL_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -])# AC_LIBTOOL_OBJDIR - - -# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) -# ---------------------------------------------- -# Check hardcoding attributes. -AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_AC_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ - test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ - test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then - - # We can hardcode non-existant directories. - if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_AC_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_AC_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_AC_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH - - -# AC_LIBTOOL_SYS_LIB_STRIP -# ------------------------ -AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], -[striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) -fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -])# AC_LIBTOOL_SYS_LIB_STRIP - - -# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# ----------------------------- -# PORTME Fill in your ld.so characteristics -AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], -[AC_MSG_CHECKING([dynamic linker characteristics]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib<name>.so - # instead of lib<name>.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no -])# AC_LIBTOOL_SYS_DYNAMIC_LINKER - - -# _LT_AC_TAGCONFIG -# ---------------- -AC_DEFUN([_LT_AC_TAGCONFIG], -[AC_ARG_WITH([tags], - [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], - [include additional configurations @<:@automatic@:>@])], - [tagnames="$withval"]) - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - AC_MSG_WARN([output file `$ofile' does not exist]) - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) - else - AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in - "") ;; - *) AC_MSG_ERROR([invalid tag name: $tagname]) - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - AC_MSG_ERROR([tag name \"$tagname\" already exists]) - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then - AC_LIBTOOL_LANG_CXX_CONFIG - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - AC_LIBTOOL_LANG_F77_CONFIG - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - AC_LIBTOOL_LANG_GCJ_CONFIG - else - tagname="" - fi - ;; - - RC) - AC_LIBTOOL_LANG_RC_CONFIG - ;; - - *) - AC_MSG_ERROR([Unsupported tag name: $tagname]) - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - AC_MSG_ERROR([unable to update list of available tagged configurations.]) - fi -fi -])# _LT_AC_TAGCONFIG - - -# AC_LIBTOOL_DLOPEN -# ----------------- -# enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], - [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_DLOPEN - - -# AC_LIBTOOL_WIN32_DLL -# -------------------- -# declare package support for building win32 dll's -AC_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_WIN32_DLL - - -# AC_ENABLE_SHARED([DEFAULT]) -# --------------------------- -# implement the --enable-shared flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_SHARED], -[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([shared], - [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]AC_ENABLE_SHARED_DEFAULT) -])# AC_ENABLE_SHARED - - -# AC_DISABLE_SHARED -# ----------------- -#- set the default shared flag to --disable-shared -AC_DEFUN([AC_DISABLE_SHARED], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_SHARED(no) -])# AC_DISABLE_SHARED - - -# AC_ENABLE_STATIC([DEFAULT]) -# --------------------------- -# implement the --enable-static flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_STATIC], -[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([static], - [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]AC_ENABLE_STATIC_DEFAULT) -])# AC_ENABLE_STATIC - - -# AC_DISABLE_STATIC -# ----------------- -# set the default static flag to --disable-static -AC_DEFUN([AC_DISABLE_STATIC], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_STATIC(no) -])# AC_DISABLE_STATIC - - -# AC_ENABLE_FAST_INSTALL([DEFAULT]) -# --------------------------------- -# implement the --enable-fast-install flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_FAST_INSTALL], -[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([fast-install], - [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) -])# AC_ENABLE_FAST_INSTALL - - -# AC_DISABLE_FAST_INSTALL -# ----------------------- -# set the default to --disable-fast-install -AC_DEFUN([AC_DISABLE_FAST_INSTALL], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_FAST_INSTALL(no) -])# AC_DISABLE_FAST_INSTALL - - -# AC_LIBTOOL_PICMODE([MODE]) -# -------------------------- -# implement the --with-pic flag -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -AC_DEFUN([AC_LIBTOOL_PICMODE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -pic_mode=ifelse($#,1,$1,default) -])# AC_LIBTOOL_PICMODE - - -# AC_PROG_EGREP -# ------------- -# This is predefined starting with Autoconf 2.54, so this conditional -# definition can be removed once we require Autoconf 2.54 or later. -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], -[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], - [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi]) - EGREP=$ac_cv_prog_egrep - AC_SUBST([EGREP]) -])]) - - -# AC_PATH_TOOL_PREFIX -# ------------------- -# find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="ifelse([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -])# AC_PATH_TOOL_PREFIX - - -# AC_PATH_MAGIC -# ------------- -# find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# AC_PATH_MAGIC - - -# AC_PROG_LD -# ---------- -# find the path to the GNU or non-GNU linker -AC_DEFUN([AC_PROG_LD], -[AC_ARG_WITH([gnu-ld], - [AC_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], - [with_gnu_ld=no]) -AC_REQUIRE([LT_AC_PROG_SED])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - 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 - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_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. - case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in - *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break - ;; - *) - test "$with_gnu_ld" != yes && break - ;; - esac - fi - done - IFS="$lt_save_ifs" -else - lt_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$lt_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_PROG_LD_GNU -])# AC_PROG_LD - - -# AC_PROG_LD_GNU -# -------------- -AC_DEFUN([AC_PROG_LD_GNU], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -case `"$LD" -v 2>&1 </dev/null` in -*GNU* | *'with BFD'*) - lt_cv_prog_gnu_ld=yes - ;; -*) - lt_cv_prog_gnu_ld=no - ;; -esac]) -with_gnu_ld=$lt_cv_prog_gnu_ld -])# AC_PROG_LD_GNU - - -# AC_PROG_LD_RELOAD_FLAG -# ---------------------- -# find reload flag for linker -# -- PORTME Some linkers may need a different reload flag. -AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], -[AC_CACHE_CHECK([for $LD option to reload object files], - lt_cv_ld_reload_flag, - [lt_cv_ld_reload_flag='-r']) -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -])# AC_PROG_LD_RELOAD_FLAG - - -# AC_DEPLIBS_CHECK_METHOD -# ----------------------- -# how to check for library dependencies -# -- PORTME fill in with the dynamic library characteristics -AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], -[AC_CACHE_CHECK([how to recognise dependent libraries], -lt_cv_deplibs_check_method, -[lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix4* | aix5*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi4*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin* | mingw* | pw32*) - # win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='win32_libid' - ;; - -darwin* | rhapsody*) - # this will be overwritten by pass_all, but leave it in just in case - lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' - lt_cv_file_magic_cmd='/usr/bin/file -L' - case "$host_os" in - rhapsody* | darwin1.[[012]]) - lt_cv_file_magic_test_file=`/System/Library/Frameworks/System.framework/System` - ;; - *) # Darwin 1.3 on - lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' - ;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - irix5* | nonstopux*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" - ;; - *) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" - ;; - esac - lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux*) - case $host_cpu in - alpha* | hppa* | i*86 | ia64* | m68* | mips | mipsel | powerpc* | sparc* | s390* | sh*) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -nto-qnx) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' - else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' - fi - ;; - -osf3* | osf4* | osf5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' - lt_cv_file_magic_test_file=/shlib/libc.so - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - lt_cv_file_magic_test_file=/lib/libc.so - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown -])# AC_DEPLIBS_CHECK_METHOD - - -# AC_PROG_NM -# ---------- -# find the path to a BSD-compatible name lister -AC_DEFUN([AC_PROG_NM], -[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/${ac_tool_prefix}nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # 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 - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - esac - fi - done - IFS="$lt_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -])# AC_PROG_NM - - -# AC_CHECK_LIBM -# ------------- -# check for math library -AC_DEFUN([AC_CHECK_LIBM], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -])# AC_CHECK_LIBM - - -# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl convenience library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with -# '${top_srcdir}/' (note the single quotes!). If your package is not -# flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -AC_DEFUN([AC_LIBLTDL_CONVENIENCE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - case $enable_ltdl_convenience in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; - esac - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_CONVENIENCE - - -# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl installable library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-install to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided and an installed libltdl is not found, it is -# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' -# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single -# quotes!). If your package is not flat and you're not using automake, -# define top_builddir and top_srcdir appropriately in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -AC_DEFUN([AC_LIBLTDL_INSTALLABLE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - AC_CHECK_LIB(ltdl, lt_dlinit, - [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], - [if test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - else - enable_ltdl_install=yes - fi - ]) - if test x"$enable_ltdl_install" = x"yes"; then - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_INSTALLABLE - - -# AC_LIBTOOL_CXX -# -------------- -# enable support for C++ libraries -AC_DEFUN([AC_LIBTOOL_CXX], -[AC_REQUIRE([_LT_AC_LANG_CXX]) -])# AC_LIBTOOL_CXX - - -# _LT_AC_LANG_CXX -# --------------- -AC_DEFUN([_LT_AC_LANG_CXX], -[AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,CXX" | sed 's/^,//'`]) -])# _LT_AC_LANG_CXX - - -# AC_LIBTOOL_F77 -# -------------- -# enable support for Fortran 77 libraries -AC_DEFUN([AC_LIBTOOL_F77], -[AC_REQUIRE([_LT_AC_LANG_F77]) -])# AC_LIBTOOL_F77 - - -# _LT_AC_LANG_F77 -# --------------- -AC_DEFUN([_LT_AC_LANG_F77], -[AC_REQUIRE([AC_PROG_F77]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,F77" | sed 's/^,//'`]) -])# _LT_AC_LANG_F77 - - -# AC_LIBTOOL_GCJ -# -------------- -# enable support for GCJ libraries -AC_DEFUN([AC_LIBTOOL_GCJ], -[AC_REQUIRE([_LT_AC_LANG_GCJ]) -])# AC_LIBTOOL_GCJ - - -# _LT_AC_LANG_GCJ -# --------------- -AC_DEFUN([_LT_AC_LANG_GCJ], -[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], - [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], - [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], - [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,GCJ" | sed 's/^,//'`]) -])# _LT_AC_LANG_GCJ - - -# AC_LIBTOOL_RC -# -------------- -# enable support for Windows resource files -AC_DEFUN([AC_LIBTOOL_RC], -[AC_REQUIRE([LT_AC_PROG_RC]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,RC" | sed 's/^,//'`]) -])# AC_LIBTOOL_RC - - -# AC_LIBTOOL_LANG_C_CONFIG -# ------------------------ -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) -AC_DEFUN([_LT_AC_LANG_C_CONFIG], -[lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - -_LT_AC_SYS_COMPILER - -# -# Check for any special shared library compilation flags. -# -_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' - ;; - esac -fi -if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then - AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$]_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) - _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), - $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), - [], - [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) - - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_DLOPEN_SELF($1) - -# Report which librarie types wil actually be built -AC_MSG_CHECKING([if libtool supports shared libraries]) -AC_MSG_RESULT([$can_build_shared]) - -AC_MSG_CHECKING([whether to build shared libraries]) -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi - ;; -esac -AC_MSG_RESULT([$enable_shared]) - -AC_MSG_CHECKING([whether to build static libraries]) -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -AC_MSG_RESULT([$enable_static]) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_C_CONFIG - - -# AC_LIBTOOL_LANG_CXX_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) -AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], -[AC_LANG_PUSH(C++) -AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) - -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(allow_undefined_flag, $1)= -_LT_AC_TAGVAR(always_export_symbols, $1)=no -_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_direct, $1)=no -_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -_LT_AC_TAGVAR(hardcode_automatic, $1)=no -_LT_AC_TAGVAR(module_cmds, $1)= -_LT_AC_TAGVAR(module_expsym_cmds, $1)= -_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_AC_TAGVAR(no_undefined_flag, $1)= -_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Dependencies to place before and after the object being linked: -_LT_AC_TAGVAR(predep_objects, $1)= -_LT_AC_TAGVAR(postdep_objects, $1)= -_LT_AC_TAGVAR(predeps, $1)= -_LT_AC_TAGVAR(postdeps, $1)= -_LT_AC_TAGVAR(compiler_lib_search_path, $1)= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' -else - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - AC_PROG_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -_LT_AC_TAGVAR(ld_shlibs, $1)=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' - - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi - ;; - - dgux*) - case $cc_basename in - ec++) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - freebsd[12]*) - # C++ shared libraries reported to be fairly broken before switch to ELF - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - freebsd-elf*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - freebsd*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - ;; - gnu*) - ;; - hpux9*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - cxx) - # Compaq C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - m88k*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - sco*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; -esac -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_AC_TAGVAR(GCC, $1)="$GXX" -_LT_AC_TAGVAR(LD, $1)="$LD" - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -AC_LIBTOOL_POSTDEP_PREDEP($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -])# AC_LIBTOOL_LANG_CXX_CONFIG - -# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) -# ------------------------ -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -ifelse([$1],[],[cat > conftest.$ac_ext <<EOF -int a; -void foo (void) { a = 0; } -EOF -],[$1],[CXX],[cat > conftest.$ac_ext <<EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -EOF -],[$1],[F77],[cat > conftest.$ac_ext <<EOF - subroutine foo - implicit none - integer*4 a - a=0 - return - end -EOF -],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF -public class foo { - private int a; - public void bar (void) { - a = 0; - } -}; -EOF -]) -dnl Parse the compiler output and extract the necessary -dnl objects, libraries and library flags. -if AC_TRY_EVAL(ac_compile); then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - # The `*' in the case matches for architectures that use `case' in - # $output_verbose_cmd can trigger glob expansion during the loop - # eval without this substitution. - output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" - - for p in `eval $output_verbose_link_cmd`; do - case $p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" \ - || test $p = "-R"; then - prev=$p - continue - else - prev= - fi - - if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then - _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" - else - _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then - _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}" - else - _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}" - fi - fi - ;; - - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then - _LT_AC_TAGVAR(predep_objects, $1)="$p" - else - _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p" - fi - else - if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then - _LT_AC_TAGVAR(postdep_objects, $1)="$p" - else - _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling $1 test program" -fi - -$rm -f confest.$objext - -case " $_LT_AC_TAGVAR(postdeps, $1) " in -*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; -esac -])# AC_LIBTOOL_POSTDEP_PREDEP - -# AC_LIBTOOL_LANG_F77_CONFIG -# ------------------------ -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)]) -AC_DEFUN([_LT_AC_LANG_F77_CONFIG], -[AC_REQUIRE([AC_PROG_F77]) -AC_LANG_PUSH(Fortran 77) - -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(allow_undefined_flag, $1)= -_LT_AC_TAGVAR(always_export_symbols, $1)=no -_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_direct, $1)=no -_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -_LT_AC_TAGVAR(hardcode_automatic, $1)=no -_LT_AC_TAGVAR(module_cmds, $1)= -_LT_AC_TAGVAR(module_expsym_cmds, $1)= -_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_AC_TAGVAR(no_undefined_flag, $1)= -_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code=" subroutine t\n return\n end\n" - -# Code to be used in simple link tests -lt_simple_link_test_code=" program t\n end\n" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${F77-"f77"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -AC_MSG_CHECKING([if libtool supports shared libraries]) -AC_MSG_RESULT([$can_build_shared]) - -AC_MSG_CHECKING([whether to build shared libraries]) -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; -aix4*) - test "$enable_shared" = yes && enable_static=no - ;; -esac -AC_MSG_RESULT([$enable_shared]) - -AC_MSG_CHECKING([whether to build static libraries]) -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -AC_MSG_RESULT([$enable_static]) - -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_AC_TAGVAR(GCC, $1)="$G77" -_LT_AC_TAGVAR(LD, $1)="$LD" - -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_F77_CONFIG - - -# AC_LIBTOOL_LANG_GCJ_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) -AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], -[AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${GCJ-"gcj"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_RESTORE -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_GCJ_CONFIG - - -# AC_LIBTOOL_LANG_RC_CONFIG -# -------------------------- -# Ensure that the configuration vars for the Windows resource compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) -AC_DEFUN([_LT_AC_LANG_RC_CONFIG], -[AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${RC-"windres"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_RESTORE -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_RC_CONFIG - - -# AC_LIBTOOL_CONFIG([TAGNAME]) -# ---------------------------- -# If TAGNAME is not passed, then create an initial libtool script -# with a default configuration from the untagged config vars. Otherwise -# add code to config.status for appending the configuration named by -# TAGNAME from the matching tagged config vars. -AC_DEFUN([AC_LIBTOOL_CONFIG], -[# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM SED SHELL \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - _LT_AC_TAGVAR(compiler, $1) \ - _LT_AC_TAGVAR(CC, $1) \ - _LT_AC_TAGVAR(LD, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ - _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ - _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \ - _LT_AC_TAGVAR(old_archive_cmds, $1) \ - _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ - _LT_AC_TAGVAR(predep_objects, $1) \ - _LT_AC_TAGVAR(postdep_objects, $1) \ - _LT_AC_TAGVAR(predeps, $1) \ - _LT_AC_TAGVAR(postdeps, $1) \ - _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ - _LT_AC_TAGVAR(archive_cmds, $1) \ - _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ - _LT_AC_TAGVAR(postinstall_cmds, $1) \ - _LT_AC_TAGVAR(postuninstall_cmds, $1) \ - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ - _LT_AC_TAGVAR(allow_undefined_flag, $1) \ - _LT_AC_TAGVAR(no_undefined_flag, $1) \ - _LT_AC_TAGVAR(export_symbols_cmds, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ - _LT_AC_TAGVAR(hardcode_automatic, $1) \ - _LT_AC_TAGVAR(module_cmds, $1) \ - _LT_AC_TAGVAR(module_expsym_cmds, $1) \ - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ - _LT_AC_TAGVAR(exclude_expsyms, $1) \ - _LT_AC_TAGVAR(include_expsyms, $1); do - - case $var in - _LT_AC_TAGVAR(old_archive_cmds, $1) | \ - _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ - _LT_AC_TAGVAR(archive_cmds, $1) | \ - _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ - _LT_AC_TAGVAR(module_cmds, $1) | \ - _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ - _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\[$]0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` - ;; - esac - -ifelse([$1], [], - [cfgfile="${ofile}T" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - $rm -f "$cfgfile" - AC_MSG_NOTICE([creating $ofile])], - [cfgfile="$ofile"]) - - cat <<__EOF__ >> "$cfgfile" -ifelse([$1], [], -[#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: -# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 -# -# This program 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 sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG], -[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) - -# Is the compiler the GNU C compiler? -with_gcc=$_LT_AC_TAGVAR(GCC, $1) - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_[]_LT_AC_TAGVAR(LD, $1) - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext='$shrext' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# 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=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) - -# Commands used to build and install a shared archive. -archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) -archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) -module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" - -# Set to yes if exported symbols are required. -always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) - -# The commands to list exported symbols. -export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) - -# Symbols that must always be exported. -include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) - -ifelse([$1],[], -[# ### END LIBTOOL CONFIG], -[# ### END LIBTOOL TAG CONFIG: $tagname]) - -__EOF__ - -ifelse([$1],[], [ - case $host_os in - aix3*) - cat <<\EOF >> "$cfgfile" - -# 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. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -]) -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - test -f Makefile && make "$ltmain" -fi -])# AC_LIBTOOL_CONFIG - - -# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl - -_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - - AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI - - -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# 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. -symcode='[[BCDEGRST]]' - -# 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. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGISTW]]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -EOF - - if AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat <<EOF > conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <<EOF >> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[[]] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - - -# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) -# --------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], -[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) - ifelse([$1],[CXX],[ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - 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'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - icpc) - # Intel C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx) - # Digital/Compaq C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc) - # Lucid - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - 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'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - newsos6) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - linux*) - case $CC in - icc|ecc) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - ccc) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' - ;; - - solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sunos4*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - uts4*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then - AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), - [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" - ;; -esac -]) - - -# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) -# ------------------------------------ -# See if the linker supports building shared libraries. -AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], -[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -ifelse([$1],[CXX],[ - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -],[ - runpath_var= - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)= - _LT_AC_TAGVAR(archive_expsym_cmds, $1)= - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown - _LT_AC_TAGVAR(hardcode_automatic, $1)=no - _LT_AC_TAGVAR(module_cmds, $1)= - _LT_AC_TAGVAR(module_expsym_cmds, $1)= - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_AC_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp 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'. - _LT_AC_TAGVAR(exclude_expsyms, $1)="_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. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # 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 "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(ld_shlibs, $1)=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 - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - - # 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't use - # them. - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach <jrb3@best.com> says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - _LT_AC_TAGVAR(ld_shlibs, $1)=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 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sunos4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - # see comment about different semantics on the GNU ld section - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - bsdi4*) - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # 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. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi - ;; - - dgux*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - # 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 - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$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 $linker_flags~$rm $lib.exp' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - 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. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4.2uw2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv5*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -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 - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$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 $linker_flags~$rm $lib.exp' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_AC_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) - ;; - esac - fi - ;; -esac -])# AC_LIBTOOL_PROG_LD_SHLIBS - - -# _LT_AC_FILE_LTDLL_C -# ------------------- -# Be careful that the start marker always follows a newline. -AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include <windows.h> -# #undef WIN32_LEAN_AND_MEAN -# #include <stdio.h> -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include <cygwin/cygwin_dll.h> -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ -])# _LT_AC_FILE_LTDLL_C - - -# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) -# --------------------------------- -AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) - - -# old names -AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) -AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) -AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) -AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) -AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) - -# This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL]) - -AC_DEFUN([LT_AC_PROG_GCJ], -[AC_CHECK_TOOL(GCJ, gcj, no) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS) -]) - -AC_DEFUN([LT_AC_PROG_RC], -[AC_CHECK_TOOL(RC, windres, no) -]) - -############################################################ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -############################################################ -# LT_AC_PROG_SED -# -------------- -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -AC_DEFUN([LT_AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && break - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -SED=$lt_cv_path_SED -]) -AC_MSG_RESULT([$SED]) -]) -############################################################################# -# Additional Macros -############################################################################# - -# -# Check for C++ namespace support. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_namespaces.html -# -AC_DEFUN([AC_CXX_NAMESPACES], -[AC_CACHE_CHECK(whether the compiler implements namespaces, -ac_cv_cxx_namespaces, -[AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], - [using namespace Outer::Inner; return i;], - ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_namespaces" = yes; then - AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces]) -fi -]) - -# -# Check for hash_map extension. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_map.html -# -AC_DEFUN([AC_CXX_HAVE_EXT_HASH_MAP], -[AC_CACHE_CHECK(whether the compiler has ext/hash_map, -ac_cv_cxx_have_ext_hash_map, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include <ext/hash_map> -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[hash_map<int, int> t; return 0;], - ac_cv_cxx_have_ext_hash_map=std, ac_cv_cxx_have_ext_hash_map=no) - AC_TRY_COMPILE([#include <ext/hash_map> -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif],[hash_map<int, int> t; return 0;], - ac_cv_cxx_have_ext_hash_map=gnu, ac_cv_cxx_have_ext_hash_map=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_ext_hash_map" = std; then - AC_DEFINE(HAVE_STD_EXT_HASH_MAP,,[define if the compiler has ext/hash_map]) -fi -if test "$ac_cv_cxx_have_ext_hash_map" = gnu; then - AC_DEFINE(HAVE_GNU_EXT_HASH_MAP,,[define if the compiler has ext/hash_map]) -fi -]) - -# -# Check for hash_set extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_EXT_HASH_SET], -[AC_CACHE_CHECK(whether the compiler has ext/hash_set, -ac_cv_cxx_have_ext_hash_set, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include <ext/hash_set> -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[hash_set<int> t; return 0;], - ac_cv_cxx_have_ext_hash_set=std, ac_cv_cxx_have_ext_hash_set=no) - AC_TRY_COMPILE([#include <ext/hash_set> -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif],[hash_set<int> t; return 0;], - ac_cv_cxx_have_ext_hash_set=gnu, ac_cv_cxx_have_ext_hash_set=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_ext_hash_set" = std; then - AC_DEFINE(HAVE_STD_EXT_HASH_SET,,[define if the compiler has ext/hash_set in std]) -fi -if test "$ac_cv_cxx_have_ext_hash_set" = gnu; then - AC_DEFINE(HAVE_GNU_EXT_HASH_SET,,[define if the compiler has ext/hash_set in __gnu_cc]) -fi -]) - -# -# Check for standard iterator extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_STD_ITERATOR], -[AC_CACHE_CHECK(whether the compiler has the standard iterator, -ac_cv_cxx_have_std_iterator, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include <iterator> -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[iterator<int,int,int> t; return 0;], - ac_cv_cxx_have_std_iterator=yes, ac_cv_cxx_have_std_iterator=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_std_iterator" = yes; then - AC_DEFINE(HAVE_STD_ITERATOR,,[define if the compiler has STL iterators]) -fi -]) - -# -# Check for bidirectional iterator extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_BI_ITERATOR], -[AC_CACHE_CHECK(whether the compiler has the bidirectional iterator, -ac_cv_cxx_have_bi_iterator, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include <iterator> -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[bidirectional_iterator<int,int> t; return 0;], - ac_cv_cxx_have_bi_iterator=yes, ac_cv_cxx_have_bi_iterator=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_bi_iterator" = yes; then - AC_DEFINE(HAVE_BI_ITERATOR,,[define if the compiler has bidirectional iterator]) -fi -]) - -# -# Check for forward iterator extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_FWD_ITERATOR], -[AC_CACHE_CHECK(whether the compiler has forward iterators, -ac_cv_cxx_have_fwd_iterator, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include <iterator> -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[forward_iterator<int,int> t; return 0;], - ac_cv_cxx_have_fwd_iterator=yes, ac_cv_cxx_have_fwd_iterator=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_fwd_iterator" = yes; then - AC_DEFINE(HAVE_FWD_ITERATOR,,[define if the compiler has STL iterators]) -fi -]) - -# -# Check for slist extension. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html -# -AC_DEFUN([AC_CXX_HAVE_EXT_SLIST], -[AC_CACHE_CHECK(whether the compiler has ext/slist, -ac_cv_cxx_have_ext_slist, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include <ext/slist> -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[slist<int> s; return 0;], - ac_cv_cxx_have_ext_slist=std, ac_cv_cxx_have_ext_slist=no) - AC_TRY_COMPILE([#include <ext/slist> -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif],[slist<int> s; return 0;], - ac_cv_cxx_have_ext_slist=gnu, ac_cv_cxx_have_ext_slist=no) - - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_ext_slist" = std; then - AC_DEFINE(HAVE_EXT_SLIST,std,[define if the compiler has ext/slist]) -fi -if test "$ac_cv_cxx_have_ext_slist" = gnu; then - AC_DEFINE(HAVE_EXT_SLIST,gnu,[define if the compiler has ext/slist]) -fi -]) - -# -# Check for FLEX. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_namespaces.html -# -AC_DEFUN([AC_PROG_FLEX], -[AC_CACHE_CHECK(, -ac_cv_has_flex, -[AC_PROG_LEX() -]) -if test "$LEX" != "flex"; then - AC_MSG_ERROR([flex not found but required]) -fi -]) - -# -# Check for Bison. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_namespaces.html -# -AC_DEFUN([AC_PROG_BISON], -[AC_CACHE_CHECK(, -ac_cv_has_bison, -[AC_PROG_YACC() -]) -if test "$YACC" != "bison -y"; then - AC_MSG_ERROR([bison not found but required]) -else - AC_SUBST(YACC,[bison],[location of bison]) -fi -]) - -# -# Check for GNU Make. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/check_gnu_make.html -# -AC_DEFUN( - [CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command, - _cv_gnu_make_command='' ; -dnl Search all the common names for GNU make - for a in "$MAKE" make gmake gnumake ; do - if test -z "$a" ; then continue ; fi ; - if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then - _cv_gnu_make_command=$a ; - break; - fi - done ; - ) ; -dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise - if test "x$_cv_gnu_make_command" != "x" ; then - ifGNUmake='' ; - else - ifGNUmake='#' ; - AC_MSG_RESULT("Not found"); - fi - AC_SUBST(ifGNUmake) -] ) - -# -# Check for the ability to mmap a file. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html -# -AC_DEFUN([AC_FUNC_MMAP_FILE], -[AC_CACHE_CHECK(for mmap of files, -ac_cv_func_mmap_file, -[AC_LANG_SAVE - AC_LANG_C - AC_TRY_RUN([ -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif - -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - -#ifdef HAVE_FCNTL_H -#include <fcntl.h> -#endif - - int fd; - int main () { - fd = creat ("foo",0777); fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); unlink ("foo"); return (fd != MAP_FAILED);}], - ac_cv_func_mmap_file=yes, ac_cv_func_mmap_file=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_func_mmap_file" = yes; then - AC_DEFINE(HAVE_MMAP_FILE) - AC_SUBST(MMAP_FILE,[yes]) -fi -]) - -# -# Check for anonymous mmap macros. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html -# -AC_DEFUN([AC_HEADER_MMAP_ANONYMOUS], -[AC_CACHE_CHECK(for MAP_ANONYMOUS vs. MAP_ANON, -ac_cv_header_mmap_anon, -[AC_LANG_SAVE - AC_LANG_C - AC_TRY_COMPILE([#include <sys/mman.h> - #include <unistd.h> - #include <fcntl.h>], - [mmap (0, 1, PROT_READ, MAP_ANONYMOUS, -1, 0); return (0);], - ac_cv_header_mmap_anon=yes, ac_cv_header_mmap_anon=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_header_mmap_anon" = yes; then - AC_DEFINE(HAVE_MMAP_ANONYMOUS) -fi -]) - -# -# Configure a Makefile without clobbering it if it exists and is not out of -# date. This is modified from: -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html -# -AC_DEFUN([AC_CONFIG_MAKEFILE], -[AC_CONFIG_COMMANDS($1,${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/$1 $1,${srcdir}/autoconf/mkinstalldirs `dirname $1`) -]) - -
diff --git a/television/autoconf/config.guess b/television/autoconf/config.guess deleted file mode 100755 index cc726cd..0000000 --- a/television/autoconf/config.guess +++ /dev/null
@@ -1,1388 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - -timestamp='2003-02-22' - -# 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. - -# Originally written by Per Bothner <per@bothner.com>. -# Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to <config-patches@gnu.org>." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit 0;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit 0;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit 0 ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit 0 ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit 0 ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include <stdio.h> /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit 0 ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit 0 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit 0 ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit 0 ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit 0 ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit 0 ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit 0 ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit 0 ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit 0 ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit 0 ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit 0 ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <sys/systemcfg.h> - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo rs6000-ibm-aix3.2.5 - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit 0 ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit 0 ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit 0 ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit 0 ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit 0 ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit 0 ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include <stdlib.h> - #include <unistd.h> - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <unistd.h> - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo unknown-hitachi-hiuxwe2 - exit 0 ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit 0 ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit 0 ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit 0 ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit 0 ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit 0 ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit 0 ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit 0 ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit 0 ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit 0 ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit 0 ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit 0 ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <features.h> - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:3*) - echo i586-pc-interix3 - exit 0 ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit 0 ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit 0 ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit 0 ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - *:GNU:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 - ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit 0 ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit 0 ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit 0 ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit 0 ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit 0 ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <features.h> - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #ifdef __INTEL_COMPILER - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit 0 ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit 0 ;; - i*86:*:5:[78]*) - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` - echo ${UNAME_MACHINE}-pc-isc$UNAME_REL - elif /bin/uname -X 2>/dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit 0 ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit 0 ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit 0 ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit 0 ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit 0 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit 0 ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit 0 ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit 0 ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Richard.M.Bartel@ccMail.Census.GOV> - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes <hewes@openmarket.com>. - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit 0 ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit 0 ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit 0 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit 0 ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit 0 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit 0 ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit 0 ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit 0 ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Darwin:*:*) - case `uname -p` in - *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit 0 ;; - NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit 0 ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit 0 ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit 0 ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit 0 ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit 0 ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit 0 ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit 0 ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit 0 ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c <<EOF -#ifdef _SEQUENT_ -# include <sys/types.h> -# include <sys/utsname.h> -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include <sys/param.h> - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include <sys/param.h> -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit 0 ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - c34*) - echo c34-convex-bsd - exit 0 ;; - c38*) - echo c38-convex-bsd - exit 0 ;; - c4*) - echo c4-convex-bsd - exit 0 ;; - esac -fi - -cat >&2 <<EOF -$0: unable to guess system type - -This script, last modified $timestamp, has failed to recognize -the operating system you are using. It is advised that you -download the most up to date version of the config scripts from - - ftp://ftp.gnu.org/pub/gnu/config/ - -If the version you run ($0) is already up to date, please -send the following data and any information you think might be -pertinent to <config-patches@gnu.org> in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End:
diff --git a/television/autoconf/config.sub b/television/autoconf/config.sub deleted file mode 100755 index 9772e87..0000000 --- a/television/autoconf/config.sub +++ /dev/null
@@ -1,1489 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - -timestamp='2003-02-22' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# 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. - -# Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to <config-patches@gnu.org>." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit 0;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k \ - | m32r | m68000 | m68k | m88k | mcore \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64vr | mips64vrel \ - | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | msp430 \ - | ns16k | ns32k \ - | openrisc | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ - | strongarm \ - | tahoe | thumb | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xscale | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* \ - | m32r-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - crds | unos) - basic_machine=m68k-crds - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - or32 | or32-*) - basic_machine=or32-unknown - os=-coff - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2) - basic_machine=i686-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic4x | c4x*) - basic_machine=tic4x-unknown - os=-coff - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv9 | sparcv9b) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-ibm) - os=-aix - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End:
diff --git a/television/autoconf/configure.ac b/television/autoconf/configure.ac deleted file mode 100644 index e6b5b7b..0000000 --- a/television/autoconf/configure.ac +++ /dev/null
@@ -1,31 +0,0 @@ -dnl Process this file with autoconf 2.5x to create a configure script. - -dnl Initialize -AC_INIT([[llvm-tv]],[[pre-release]],[llvmbugs@cs.uiuc.edu]) - -dnl Place all of the extra autoconf files into the config subdirectory -AC_CONFIG_AUX_DIR([autoconf]) - -dnl Configure the makefile's configuration data -AC_CONFIG_FILES([Makefile.config]) - -dnl Configure Makefiles -AC_CONFIG_MAKEFILE(Makefile) -AC_CONFIG_MAKEFILE(Makefile.common) -AC_CONFIG_MAKEFILE(lib/Makefile) -AC_CONFIG_MAKEFILE(lib/Snapshot/Makefile) -AC_CONFIG_MAKEFILE(tools/Makefile) -AC_CONFIG_MAKEFILE(tools/llvm-tv/Makefile) - -dnl Verify that the source directory is valid -AC_CONFIG_SRCDIR(["Makefile.common.in"]) - -dnl Find the LLVM source and object directories, whose locations may -dnl have been specified by the user. By default, assume we've unpacked this -dnl project in projects/<project-name>, as is customary, and look in ../.. -dnl for the main LLVM source and object trees. -AC_ARG_WITH(llvmsrc,AS_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]),AC_SUBST(LLVM_SRC,[$withval]),AC_SUBST(LLVM_SRC,[`cd ${srcdir}/../..; pwd`])) -AC_ARG_WITH(llvmobj,AS_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]),AC_SUBST(LLVM_OBJ,[$withval]),AC_SUBST(LLVM_OBJ,[`cd ../..; pwd`])) - -dnl Create the output files -AC_OUTPUT
diff --git a/television/autoconf/install-sh b/television/autoconf/install-sh deleted file mode 100644 index 398a88e..0000000 --- a/television/autoconf/install-sh +++ /dev/null
@@ -1,251 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - : -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - chmodcmd="" - else - instcmd=$mkdirprog - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - : - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - : - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - : - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' - ' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - : - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - : - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0
diff --git a/television/autoconf/ltmain.sh b/television/autoconf/ltmain.sh deleted file mode 100644 index fe83ff4..0000000 --- a/television/autoconf/ltmain.sh +++ /dev/null
@@ -1,6290 +0,0 @@ -# ltmain.sh - Provide generalized library-building support services. -# NOTE: Changing this file will not affect anything until you rerun configure. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 -# Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 -# -# This program 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. - -# Check that we have a working $echo. -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<EOF -$* -EOF - exit 0 -fi - -# The name of this program. -progname=`$echo "$0" | ${SED} 's%^.*/%%'` -modename="$progname" - -# Constants. -PROGRAM=ltmain.sh -PACKAGE=libtool -VERSION=1.5 -TIMESTAMP=" (1.1220 2003/04/05 19:32:58)" - -default_mode= -help="Try \`$progname --help' for more information." -magic="%%%MAGIC variable%%%" -mkdir="mkdir" -mv="mv -f" -rm="rm -f" - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' -sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' -# test EBCDIC or ASCII -case `echo A|od -x` in - *[Cc]1*) # EBCDIC based system - SP2NL="tr '\100' '\n'" - NL2SP="tr '\r\n' '\100\100'" - ;; - *) # Assume ASCII based system - SP2NL="tr '\040' '\012'" - NL2SP="tr '\015\012' '\040\040'" - ;; -esac - -# 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). -# We save the old values to restore during execute mode. -if test "${LC_ALL+set}" = set; then - save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL -fi -if test "${LANG+set}" = set; then - save_LANG="$LANG"; LANG=C; export LANG -fi - -# Make sure IFS has a sensible default -: ${IFS=" "} - -if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - $echo "$modename: not configured to build any kind of library" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 -fi - -# Global variables. -mode=$default_mode -nonopt= -prev= -prevopt= -run= -show="$echo" -show_help= -execute_dlfiles= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" - -##################################### -# Shell function definitions: -# This seems to be the best place for them - -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -win32_libid () { - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ - grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | \ - sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` - if test "X$win32_nmres" = "Ximport" ; then - win32_libid_type="x86 archive import" - else - win32_libid_type="x86 archive static" - fi - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $echo $win32_libid_type -} - -# End of Shell function definitions -##################################### - -# Parse our command line options once, thoroughly. -while test "$#" -gt 0 -do - arg="$1" - shift - - case $arg in - -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - execute_dlfiles) - execute_dlfiles="$execute_dlfiles $arg" - ;; - tag) - tagname="$arg" - - # Check whether tagname contains only valid characters - case $tagname in - *[!-_A-Za-z0-9,/]*) - $echo "$progname: invalid tag name: $tagname" 1>&2 - exit 1 - ;; - esac - - case $tagname in - CC) - # Don't test for the "default" C tag, as we know, it's there, but - # not specially marked. - ;; - *) - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then - taglist="$taglist $tagname" - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" - else - $echo "$progname: ignoring unknown tag $tagname" 1>&2 - fi - ;; - esac - ;; - *) - eval "$prev=\$arg" - ;; - esac - - prev= - prevopt= - continue - fi - - # Have we seen a non-optional argument yet? - case $arg in - --help) - show_help=yes - ;; - - --version) - $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - $echo - $echo "Copyright (C) 2003 Free Software Foundation, Inc." - $echo "This is free software; see the source for copying conditions. There is NO" - $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit 0 - ;; - - --config) - ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 - # Now print the configurations for the tags. - for tagname in $taglist; do - ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0" - done - exit 0 - ;; - - --debug) - $echo "$progname: enabling shell trace mode" - set -x - ;; - - --dry-run | -n) - run=: - ;; - - --features) - $echo "host: $host" - if test "$build_libtool_libs" = yes; then - $echo "enable shared libraries" - else - $echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - $echo "enable static libraries" - else - $echo "disable static libraries" - fi - exit 0 - ;; - - --finish) mode="finish" ;; - - --mode) prevopt="--mode" prev=mode ;; - --mode=*) mode="$optarg" ;; - - --preserve-dup-deps) duplicate_deps="yes" ;; - - --quiet | --silent) - show=: - ;; - - --tag) prevopt="--tag" prev=tag ;; - --tag=*) - set tag "$optarg" ${1+"$@"} - shift - prev=tag - ;; - - -dlopen) - prevopt="-dlopen" - prev=execute_dlfiles - ;; - - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - - *) - nonopt="$arg" - break - ;; - esac -done - -if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 -fi - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - -if test -z "$show_help"; then - - # Infer the operation mode. - if test -z "$mode"; then - $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 - $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 - case $nonopt in - *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) - mode=link - for arg - do - case $arg in - -c) - mode=compile - break - ;; - esac - done - ;; - *db | *dbx | *strace | *truss) - mode=execute - ;; - *install*|cp|mv) - mode=install - ;; - *rm) - mode=uninstall - ;; - *) - # If we have no mode, but dlfiles were specified, then do execute mode. - test -n "$execute_dlfiles" && mode=execute - - # Just use the default operation mode. - if test -z "$mode"; then - if test -n "$nonopt"; then - $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 - else - $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 - fi - fi - ;; - esac - fi - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - $echo "$modename: unrecognized option \`-dlopen'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$modename --help --mode=$mode' for more information." - - # These modes are in order of execution frequency so that they run quickly. - case $mode in - # libtool compile mode - compile) - modename="$modename: compile" - # Get the compilation command and the source file. - base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_output= - arg_mode=normal - libobj= - - for arg - do - case "$arg_mode" in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; - - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. - case $arg in - -o) - if test -n "$libobj" ; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit 1 - fi - arg_mode=target - continue - ;; - - -static) - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # Add the arguments to base_compile. - base_compile="$base_compile $lastarg" - continue - ;; - - * ) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - case $lastarg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" - ;; - esac - - base_compile="$base_compile $lastarg" - done # for arg - - case $arg_mode in - arg) - $echo "$modename: you must specify an argument for -Xcompile" - exit 1 - ;; - target) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit 1 - ;; - *) - # Get the name of the library object. - [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSifmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.ii) xform=ii ;; - *.class) xform=class ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - *.java) xform=java ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit 1 - ;; - esac - - # Infer tagged configuration to use if any are available and - # if one wasn't chosen via the "--tag" command line option. - # Only attempt this if the compiler in the base compile - # command doesn't match the default compiler. - if test -n "$available_tags" && test -z "$tagname"; then - case $base_compile in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" - case "$base_compile " in - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit 1 -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi - - objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir= - else - xdir=$xdir/ - fi - lobj=${xdir}$objdir/$objname - - if test -z "$base_compile"; then - $echo "$modename: you must specify a compilation command" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - $run $rm $removelist - trap "$run $rm $removelist; exit 1" 1 2 15 - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit 1" 1 2 15 - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $run ln "$0" "$lockfile" 2>/dev/null; do - $show "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - $echo "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - $echo $srcfile > "$lockfile" - fi - - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi - - $run $rm "$libobj" "${libobj}T" - - # Create a libtool object file (analogous to a ".la" file), - # but don't create it if we're doing a dry run. - test -z "$run" && cat > ${libobj}T <<EOF -# $libobj - a libtool object file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# Name of the PIC object. -EOF - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - if test "$pic_mode" != no; then - command="$base_compile $srcfile $pic_flag" - else - # Don't build PIC code - command="$base_compile $srcfile" - fi - - if test ! -d "${xdir}$objdir"; then - $show "$mkdir ${xdir}$objdir" - $run $mkdir ${xdir}$objdir - status=$? - if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then - exit $status - fi - fi - - if test -z "$output_obj"; then - # Place PIC objects in $objdir - command="$command -o $lobj" - fi - - $run $rm "$lobj" "$output_obj" - - $show "$command" - if $run eval "$command"; then : - else - test -n "$output_obj" && $run $rm $removelist - exit 1 - fi - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - $show "$mv $output_obj $lobj" - if $run $mv $output_obj $lobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Append the name of the PIC object to the libtool object file. - test -z "$run" && cat >> ${libobj}T <<EOF -pic_object='$objdir/$objname' - -EOF - - # Allow error messages only from the first compilation. - suppress_output=' >/dev/null 2>&1' - else - # No PIC object so indicate it doesn't exist in the libtool - # object file. - test -z "$run" && cat >> ${libobj}T <<EOF -pic_object=none - -EOF - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - if test "$pic_mode" != yes; then - # Don't build PIC code - command="$base_compile $srcfile" - else - command="$base_compile $srcfile $pic_flag" - fi - if test "$compiler_c_o" = yes; then - command="$command -o $obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - command="$command$suppress_output" - $run $rm "$obj" "$output_obj" - $show "$command" - if $run eval "$command"; then : - else - $run $rm $removelist - exit 1 - fi - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - $show "$mv $output_obj $obj" - if $run $mv $output_obj $obj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Append the name of the non-PIC object the libtool object file. - # Only append if the libtool object file exists. - test -z "$run" && cat >> ${libobj}T <<EOF -# Name of the non-PIC object. -non_pic_object='$objname' - -EOF - else - # Append the name of the non-PIC object the libtool object file. - # Only append if the libtool object file exists. - test -z "$run" && cat >> ${libobj}T <<EOF -# Name of the non-PIC object. -non_pic_object=none - -EOF - fi - - $run $mv "${libobj}T" "${libobj}" - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - $run $rm "$lockfile" - fi - - exit 0 - ;; - - # libtool link mode - link | relink) - modename="$modename: link" - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - # It is impossible to link a dll without this setting, and - # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra - # flag for every libtool invocation. - # allow_undefined=no - - # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not - # even a static library is built. For now, we need to specify - # -no-undefined on the libtool link line when we can be certain - # that all symbols are satisfied, otherwise we get a static library. - allow_undefined=yes - ;; - *) - allow_undefined=yes - ;; - esac - libtool_args="$nonopt" - base_compile="$nonopt" - compile_command="$nonopt" - finalize_command="$nonopt" - - compile_rpath= - finalize_rpath= - compile_shlibpath= - finalize_shlibpath= - convenience= - old_convenience= - deplibs= - old_deplibs= - compiler_flags= - linker_flags= - dllsearchpath= - lib_search_path=`pwd` - inst_prefix_dir= - - avoid_version=no - dlfiles= - dlprefiles= - dlself=no - export_dynamic=no - export_symbols= - export_symbols_regex= - generated= - libobjs= - ltlibs= - module=no - no_install=no - objs= - non_pic_objects= - prefer_static_libs=no - preload=no - prev= - prevarg= - release= - rpath= - xrpath= - perm_rpath= - temp_rpath= - thread_safe=no - vinfo= - vinfo_number=no - - # We need to know -static, to get the right output filenames. - for arg - do - case $arg in - -all-static | -static) - if test "X$arg" = "X-all-static"; then - if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - else - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - fi - build_libtool_libs=no - build_old_libs=yes - prefer_static_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - base_compile="$base_compile $arg" - shift - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test - ;; - *) qarg=$arg ;; - esac - libtool_args="$libtool_args $qarg" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - compile_command="$compile_command @OUTPUT@" - finalize_command="$finalize_command @OUTPUT@" - ;; - esac - - case $prev in - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - compile_command="$compile_command @SYMFILE@" - finalize_command="$finalize_command @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - else - dlprefiles="$dlprefiles $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - if test ! -f "$arg"; then - $echo "$modename: symbol file \`$arg' does not exist" - exit 1 - fi - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat $save_arg` - do -# moreargs="$moreargs $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit 1 - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit 1 - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - done - else - $echo "$modename: link input file \`$save_arg' does not exist" - exit 1 - fi - arg=$save_arg - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) rpath="$rpath $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; - esac - fi - prev= - continue - ;; - xcompiler) - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" - prev= - compile_command="$compile_command $wl$qarg" - finalize_command="$finalize_command $wl$qarg" - continue - ;; - xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 - continue - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: more than one -exported-symbols argument is not allowed" - exit 1 - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - ;; - esac - continue - ;; - - -L*) - dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit 1 - fi - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "*) ;; - *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - case :$dllsearchpath: in - *":$dir:"*) ;; - *) dllsearchpath="$dllsearchpath:$dir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-pw32* | *-*-beos*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-mingw* | *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs -framework System" - continue - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - deplibs="$deplibs $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # gcc -m* arguments should be passed to the linker via $compiler_flags - # in order to pass architecture information to the linker - # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo - # but this is not reliable with gcc because gcc may use -mfoo to - # select a different linker, different libraries, etc, while - # -Wl,-mfoo simply passes -mfoo to the linker. - -m*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - if test "$with_gcc" = "yes" ; then - compiler_flags="$compiler_flags $arg" - fi - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - # The PATH hackery in wrapper scripts is required on Windows - # in order for the loader to find any dlls it needs. - $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 - $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - - -static) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Wl,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $wl$flag" - linker_flags="$linker_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # Some other compiler flag. - -* | +*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - - *.$objext) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit 1 - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit 1 - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - ;; - - *.$libext) - # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" - prev= - else - deplibs="$deplibs $arg" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - done # argument parsing loop - - if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Infer tagged configuration to use if any are available and - # if one wasn't chosen via the "--tag" command line option. - # Only attempt this if the compiler in the base link - # command doesn't match the default compiler. - if test -n "$available_tags" && test -z "$tagname"; then - case $base_compile in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" - case $base_compile in - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) - # The compiler in $compile_command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit 1 -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi - # Create the object directory. - if test ! -d "$output_objdir"; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test "$status" -ne 0 && test ! -d "$output_objdir"; then - exit $status - fi - fi - - # Determine the type of output - case $output in - "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - case $host in - *cygwin* | *mingw* | *pw32*) - # don't eliminate duplcations in $postdeps and $predeps - duplicate_compiler_generated_deps=yes - ;; - *) - duplicate_compiler_generated_deps=$duplicate_deps - ;; - esac - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if test "X$duplicate_deps" = "Xyes" ; then - case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - libs="$libs $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; - esac - pre_post_deps="$pre_post_deps $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - case $linkmode in - lib) - passes="conv link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit 1 - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - for pass in $passes; do - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; - esac - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - for deplib in $libs; do - lib= - found=no - case $deplib in - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 - continue - fi - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` - for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - # Search the libtool library - lib="$searchdir/lib${name}.la" - if test -f "$lib"; then - found=yes - break - fi - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if (${SED} -e '2q' $lib | - grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - library_names= - old_library= - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - ;; - *) - $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) lib="$deplib" ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - if test "$deplibs_check_method" != pass_all; then - $echo - $echo "*** Warning: Trying to link with static lib archive $deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because the file extensions .$libext of this argument makes me believe" - $echo "*** that it is just a static archive that I should not used here." - else - $echo - $echo "*** Warning: Linking the shared library $output against the" - $echo "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - if test "$found" = yes || test -f "$lib"; then : - else - $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit 1 - fi - - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 - fi - - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - - # Read the .la file - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 - fi - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - elif test "$linkmode" != prog && test "$linkmode" != lib; then - $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit 1 - fi - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 - exit 1 - fi - if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" - else - newdlfiles="$newdlfiles $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - abs_ladir="$ladir" - fi - ;; - esac - laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - $echo "$modename: warning: library \`$lib' was moved." 1>&2 - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$libdir" - absdir="$libdir" - fi - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - fi # $installed = yes - name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit 1 - fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" - fi - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" - need_relink=yes - fi - # This is a shared library - - # Warn about portability, can't link against -module's on some systems (darwin) - if test "$shouldnotlink" = yes && test "$pass" = link ; then - $echo - if test "$linkmode" = prog; then - $echo "*** Warning: Linking the executable $output against the loadable module" - else - $echo "*** Warning: Linking the shared library $output against the loadable module" - fi - $echo "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - realname="$2" - shift; shift - libname=`eval \\$echo \"$libname_spec\"` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw*) - major=`expr $current - $age` - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - soname=`$echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - $show "extracting exported symbol list from \`$soname'" - save_ifs="$IFS"; IFS='~' - eval cmds=\"$extract_expsyms_cmds\" - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - $show "generating import library for \`$soname'" - save_ifs="$IFS"; IFS='~' - eval cmds=\"$old_archive_from_expsyms_cmds\" - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5* ) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a module then we can not link against it, someone - # is ignoring the new warnings I added - if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then - $echo "** Warning, lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - $echo - $echo "** And there doesn't seem to be a static archive available" - $echo "** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="-L$inst_prefix_dir$libdir $add_dir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit 1 - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && \ - test "$hardcode_minus_L" != yes && \ - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="-L$inst_prefix_dir$libdir $add_dir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - $echo - $echo "*** Warning: This system can not link to static lib archive $lib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - $echo "*** But as you try to build a module library, libtool will still create " - $echo "*** a static module, that should work as long as the dlopening application" - $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - convenience="$convenience $dir/$old_library" - old_convenience="$old_convenience $dir/$old_library" - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - *) temp_deplibs="$temp_deplibs $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - newlib_search_path="$newlib_search_path $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - case $deplib in - -L*) path="$deplib" ;; - *.la) - dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$deplib" && dir="." - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 - absdir="$dir" - fi - ;; - esac - if grep "^installed=no" $deplib > /dev/null; then - path="$absdir/$objdir" - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit 1 - fi - if test "$absdir" != "$libdir"; then - $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 - fi - path="$absdir" - fi - depdepl= - case $host in - *-*-darwin*) - # we do not want to link against static libs, but need to link against shared - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$path/$depdepl" ; then - depdepl="$path/$depdepl" - fi - newlib_search_path="$newlib_search_path $path" - path="" - fi - ;; - *) - path="-L$path" - ;; - esac - - ;; - -l*) - case $host in - *-*-darwin*) - # Again, we only want to link against shared libraries - eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` - for tmp in $newlib_search_path ; do - if test -f "$tmp/lib$tmp_libs.dylib" ; then - eval depdepl="$tmp/lib$tmp_libs.dylib" - break - fi - done - path="" - ;; - *) continue ;; - esac - ;; - *) continue ;; - esac - case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$deplibs $depdepl" ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$deplibs $path" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - tmp_libs="$tmp_libs $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 - fi - - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 - fi - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - objs="$objs$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval shared_ext=\"$shrext\" - eval libname=\"$libname_spec\" - ;; - *) - if test "$module" = no; then - $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - eval shared_ext=\"$shrext\" - eval libname=\"$libname_spec\" - else - libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 - exit 1 - else - $echo - $echo "*** Warning: Linking the shared library $output against the non-libtool" - $echo "*** objects $objs is not portable!" - libobjs="$libobjs $objs" - fi - fi - - if test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 - fi - - set dummy $rpath - if test "$#" -gt 2; then - $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 - fi - install_libdir="$2" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 - fi - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - IFS="$save_ifs" - - if test -n "$8"; then - $echo "$modename: too many parameters to \`-version-info'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$2" - number_minor="$3" - number_revision="$4" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows) - current=`expr $number_major + $number_minor` - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - current=`expr $number_major + $number_minor - 1` - age="$number_minor" - revision="$number_minor" - ;; - esac - ;; - no) - current="$2" - revision="$3" - age="$4" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; - *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case $revision in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; - *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case $age in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; - *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - if test "$age" -gt "$current"; then - $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - minor_current=`expr $current + 1` - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current"; - ;; - - irix | nonstopux) - major=`expr $current - $age + 1` - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - iface=`expr $revision - $loop` - loop=`expr $loop - 1` - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - ;; - - osf) - major=.`expr $current - $age` - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - iface=`expr $current - $loop` - loop=`expr $loop - 1` - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - major=`expr $current - $age` - versuffix="-$major" - ;; - - *) - $echo "$modename: unknown library version type \`$version_type'" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - fi - - if test "$mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$echo "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - removelist="$removelist $p" - ;; - *) ;; - esac - done - if test -n "$removelist"; then - $show "${rm}r $removelist" - $run ${rm}r $removelist - fi - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - for path in $notinst_path; do - lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` - deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` - dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` - done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - deplibs="$deplibs -framework System" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $rm conftest.c - cat > conftest.c <<EOF - int main() { return 0; } -EOF - $rm conftest - $LTCC -o conftest conftest.c $deplibs - if test "$?" -eq 0 ; then - ldd_output=`ldd conftest` - for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" -ne "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $i "*) - newdeplibs="$newdeplibs $i" - i="" - ;; - esac - fi - if test -n "$i" ; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - $echo - $echo "*** Warning: dynamic linker does not accept needed library $i." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which I believe you do not have" - $echo "*** because a test_compile did reveal that the linker did not use it for" - $echo "*** its dynamic dependency list that programs get resolved with at runtime." - fi - fi - else - newdeplibs="$newdeplibs $i" - fi - done - else - # Error occurred in the first compile. Let's try to salvage - # the situation: Compile a separate program for each library. - for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then - $rm conftest - $LTCC -o conftest conftest.c $i - # Did it work? - if test "$?" -eq 0 ; then - ldd_output=`ldd conftest` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $i "*) - newdeplibs="$newdeplibs $i" - i="" - ;; - esac - fi - if test -n "$i" ; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - $echo - $echo "*** Warning: dynamic linker does not accept needed library $i." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because a test_compile did reveal that the linker did not use this one" - $echo "*** as a dynamic dependency that programs can get resolved with at runtime." - fi - fi - else - droppeddeps=yes - $echo - $echo "*** Warning! Library $i is needed by this library but I was not able to" - $echo "*** make it link in! You will probably need to install it or some" - $echo "*** library that it depends on before this library will be fully" - $echo "*** functional. Installing it before continuing would be even better." - fi - else - newdeplibs="$newdeplibs $i" - fi - done - fi - ;; - file_magic*) - set dummy $deplibs_check_method - file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - for a_deplib in $deplibs; do - name="`expr $a_deplib : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null \ - | grep " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for file magic test)" - else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a file magic. Last file checked: $potlib" - fi - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - for a_deplib in $deplibs; do - name="`expr $a_deplib : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval $echo \"$potent_lib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a regex pattern. Last file checked: $potlib" - fi - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` - done - fi - if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ - | grep . >/dev/null; then - $echo - if test "X$deplibs_check_method" = "Xnone"; then - $echo "*** Warning: inter-library dependencies are not supported in this platform." - else - $echo "*** Warning: inter-library dependencies are not known to be supported." - fi - $echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - fi - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - $echo - $echo "*** Warning: libtool could not satisfy all declared inter-library" - $echo "*** dependencies of module $libname. Therefore, libtool will create" - $echo "*** a static module, that should work as long as the dlopening" - $echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - $echo "*** The inter-library dependencies that have been dropped here will be" - $echo "*** automatically added whenever a program is linked with this library" - $echo "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - $echo - $echo "*** Since this library must not contain undefined symbols," - $echo "*** because either the platform does not support them or" - $echo "*** it was explicitly requested with -no-undefined," - $echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $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\" - dep_rpath="$dep_rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$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" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - realname="$2" - shift; shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - for link - do - linknames="$linknames $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - eval cmds=\"$export_symbols_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - if len=`expr "X$cmd" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - $show "$cmd" - $run eval "$cmd" || exit $? - skipped_export=false - else - # The command line is too long to execute in one step. - $show "using reloadable object file for export list..." - skipped_export=: - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex"; then - $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - $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 - - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - tmp_deplibs="$tmp_deplibs $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - 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 cmds=\"$module_expsym_cmds\" - else - eval cmds=\"$module_cmds\" - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" - else - eval cmds=\"$archive_cmds\" - fi - fi - - if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` && - 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 - - # 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/$save_output-${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" : ".*"` && - 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/$save_output-${k}.$objext - k=`expr $k + 1` - output=$output_objdir/$save_output-${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 reloadale object files - # after they are used. - i=0 - while test "$i" -lt "$k" - do - i=`expr $i + 1` - delfiles="$delfiles $output_objdir/$save_output-${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 - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" - else - eval cmds=\"$archive_cmds\" - fi - - # Append the command to remove the reloadable object files - # to the just-reset $cmds. - eval cmds=\"\$cmds~$rm $delfiles\" - fi - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - 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 $? - exit 0 - 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 - exit 1 - 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 - # -Wl from whole_archive_flag_spec - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${obj}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - 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" - eval cmds=\"$reload_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $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 - - exit 0 - 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. - # $show "echo timestamp > $libobj" - # $run eval "echo timestamp > $libobj" || exit $? - exit 0 - 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" - eval cmds=\"$reload_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $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 - - exit 0 - ;; - - prog) - case $host in - *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; - 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 - - 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 - - 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*) - case :$dllsearchpath: in - *":$libdir:"*) ;; - *) dllsearchpath="$dllsearchpath:$libdir";; - esac - ;; - 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 - $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - if test -n "$export_symbols_regex"; then - $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$output.exp" - $run $rm $export_symbols - $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - else - $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' - $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' - $run eval 'mv "$nlist"T "$nlist"' - fi - fi - - for arg in $dlprefiles; do - $show "extracting global C symbols from \`$arg'" - name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval '$echo ": $name " >> "$nlist"' - $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 - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $mv "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - 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 - : - else - grep -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' - else - $echo '/* NONE */' >> "$output_objdir/$dlsyms" - 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. */ -const struct { - 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 "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; - esac;; - *-*-hpux*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag";; - esac - esac - - # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? - - # 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. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - ;; - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit 1 - ;; - 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. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - $show "$link_command" - $run eval "$link_command" - status=$? - - # Delete the generated files. - if test -n "$dlsyms"; then - $show "$rm $output_objdir/${outputname}S.${objext}" - $run $rm "$output_objdir/${outputname}S.${objext}" - fi - - exit $status - 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 $? - exit 0 - 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 - relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` - 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)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $0 --fallback-echo"; then - case $0 in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; - *) qecho="$SHELL `pwd`/$0 --fallback-echo";; - 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 - *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - cwrappersource=`$echo ${objdir}/lt-${output}.c` - cwrapper=`$echo ${output}.exe` - $rm $cwrappersource $cwrapper - trap "$rm $cwrappersource $cwrapper; exit 1" 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> - -#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 '/' -#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 -#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 */ - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -const char *program_name = NULL; - -void * xmalloc (size_t num); -char * xstrdup (const char *string); -char * basename (const char *name); -char * fnqualify(const char *path); -char * strendzap(char *str, const char *pat); -void lt_fatal (const char *message, ...); - -int -main (int argc, char *argv[]) -{ - char **newargz; - int i; - - program_name = (char *) xstrdup ((char *) basename (argv[0])); - newargz = XMALLOC(char *, argc+2); -EOF - - cat >> $cwrappersource <<EOF - newargz[0] = "$SHELL"; -EOF - - cat >> $cwrappersource <<"EOF" - newargz[1] = fnqualify(argv[0]); - /* we know the script has the same name, without the .exe */ - /* so make sure newargz[1] doesn't end in .exe */ - strendzap(newargz[1],".exe"); - for (i = 1; i < argc; i++) - newargz[i+1] = xstrdup(argv[i]); - newargz[argc+1] = NULL; -EOF - - cat >> $cwrappersource <<EOF - execv("$SHELL",newargz); -EOF - - cat >> $cwrappersource <<"EOF" -} - -void * -xmalloc (size_t num) -{ - void * p = (void *) malloc (num); - if (!p) - lt_fatal ("Memory exhausted"); - - return p; -} - -char * -xstrdup (const char *string) -{ - return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL -; -} - -char * -basename (const char *name) -{ - const char *base; - -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha (name[0]) && name[1] == ':') - name += 2; -#endif - - for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) - base = name + 1; - return (char *) base; -} - -char * -fnqualify(const char *path) -{ - size_t size; - char *p; - char tmp[LT_PATHMAX + 1]; - - assert(path != NULL); - - /* Is it qualified already? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha (path[0]) && path[1] == ':') - return xstrdup (path); -#endif - if (IS_DIR_SEPARATOR (path[0])) - return xstrdup (path); - - /* prepend the current directory */ - /* doesn't handle '~' */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ - p = XMALLOC(char, size); - sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); - return p; -} - -char * -strendzap(char *str, const char *pat) -{ - size_t len, patlen; - - assert(str != NULL); - assert(pat != NULL); - - len = strlen(str); - patlen = strlen(pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp(str, pat) == 0) - *str = '\0'; - } - return str; -} - -static void -lt_error_core (int exit_status, const char * mode, - const char * message, va_list ap) -{ - fprintf (stderr, "%s: %s: ", program_name, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); - va_end (ap); -} -EOF - # we should really use a build-platform specific compiler - # here, but OTOH, the wrappers (shell script and this C one) - # are only useful if you want to execute the "real" binary. - # Since the "real" binary is built for $host, then this - # wrapper might as well be built for $host, too. - $run $LTCC -s -o $cwrapper $cwrappersource - ;; - esac - $rm $output - trap "$rm $output; exit 1" 1 2 15 - - $echo > $output "\ -#! $SHELL - -# $output - temporary wrapper script 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 script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' -sed_quote_subst='$sed_quote_subst' - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variable: - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$echo are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - echo=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$echo works! - : - else - # Restart under the correct shell, and then maybe \$echo will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ -" - $echo >> $output "\ - - # Find the directory that this script lives in. - thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` - done - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $echo >> $output "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || \\ - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $mkdir \"\$progdir\" - else - $rm \"\$progdir/\$file\" - fi" - - $echo >> $output "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $echo \"\$relink_command_output\" >&2 - $rm \"\$progdir/\$file\" - exit 1 - fi - fi - - $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $rm \"\$progdir/\$program\"; - $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $rm \"\$progdir/\$file\" - fi" - else - $echo >> $output "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $echo >> $output "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $echo >> $output "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $echo >> $output "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $echo >> $output "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2*) - $echo >> $output "\ - exec \$progdir\\\\\$program \${1+\"\$@\"} -" - ;; - - *) - $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} -" - ;; - esac - $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit 1 - fi - else - # The program doesn't exist. - \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 - \$echo \"This script is just a wrapper for \$program.\" 1>&2 - $echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" - chmod +x $output - fi - exit 0 - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - # Add in members from convenience archives. - for xlib in $addlibs; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` - done - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - eval cmds=\"$old_archive_from_new_cmds\" - else - eval cmds=\"$old_archive_cmds\" - - if len=`expr "X$cmds" : ".*"` && - 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 in parts - $echo "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - # GNU ar 2.10+ was changed to match POSIX; thus no paths are - # encoded into archives. This makes 'ar r' malfunction in - # this piecewise linking case whenever conflicting object - # names appear in distinct ar calls; check, warn and compensate. - if (for obj in $save_oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 - $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 - AR_FLAGS=cq - fi - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - for obj in $save_oldobjs - do - oldobjs="$objlist $obj" - objlist="$objlist $obj" - eval test_cmds=\"$old_archive_cmds\" - if len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~$old_archive_cmds\" - fi - fi - fi - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$generated"; then - $show "${rm}r$generated" - $run ${rm}r$generated - fi - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - $show "creating $output" - - # 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 - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - - # Only create the output if not a dry run. - if test -z "$run"; then - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit 1 - fi - newdependency_libs="$newdependency_libs $libdir/$name" - ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - for lib in $dlfiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 - fi - newdlfiles="$newdlfiles $libdir/$name" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 - fi - newdlprefiles="$newdlprefiles $libdir/$name" - done - dlprefiles="$newdlprefiles" - fi - $rm $output - # place dlname in correct position for cygwin - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; - esac - $echo > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $echo >> $output "\ -relink_command=\"$relink_command\"" - fi - done - fi - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" - $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? - ;; - esac - exit 0 - ;; - - # libtool install mode - install) - modename="$modename: install" - - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then - # Aesthetically quote it. - arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$arg " - arg="$1" - shift - else - install_prog= - arg="$nonopt" - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog$arg" - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - for arg - do - if test -n "$dest"; then - files="$files $dest" - dest="$arg" - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) prev="-f" ;; - -g) prev="-g" ;; - -m) prev="-m" ;; - -o) prev="-o" ;; - -s) - stripme=" -s" - continue - ;; - -*) ;; - - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - prev= - else - dest="$arg" - continue - fi - ;; - esac - - # Aesthetically quote the argument. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog $arg" - done - - if test -z "$install_prog"; then - $echo "$modename: you must specify an install program" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -z "$files"; then - if test -z "$dest"; then - $echo "$modename: no file or destination specified" 1>&2 - else - $echo "$modename: you must specify a destination" 1>&2 - fi - $echo "$help" 1>&2 - exit 1 - fi - - # Strip any trailing slash from the destination. - dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` - test "X$destdir" = "X$dest" && destdir=. - destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` - - # Not a directory, so check to see that there is only one file specified. - set dummy $files - if test "$#" -gt 2; then - $echo "$modename: \`$dest' is not a directory" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - library_names= - old_library= - relink_command= - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ - test "X$dir" = "X$file/" && dir= - dir="$dir$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - if test "$inst_prefix_dir" = "$destdir"; then - $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 - exit 1 - fi - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - $echo "$modename: warning: relinking \`$file'" 1>&2 - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - exit 1 - fi - fi - - # See the names of the shared library. - set dummy $library_names - if test -n "$2"; then - realname="$2" - shift - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - $show "$install_prog $dir/$srcname $destdir/$realname" - $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? - if test -n "$stripme" && test -n "$striplib"; then - $show "$striplib $destdir/$realname" - $run eval "$striplib $destdir/$realname" || exit $? - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - for linkname - do - if test "$linkname" != "$realname"; then - $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - fi - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - eval cmds=\"$postinstall_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Install the pseudo-library for information purposes. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - instname="$dir/$name"i - $show "$install_prog $instname $destdir/$name" - $run eval "$install_prog $instname $destdir/$name" || exit $? - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - - # Install the libtool object if requested. - if test -n "$destfile"; then - $show "$install_prog $file $destfile" - $run eval "$install_prog $file $destfile" || exit $? - fi - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` - - $show "$install_prog $staticobj $staticdest" - $run eval "$install_prog \$staticobj \$staticdest" || exit $? - fi - exit 0 - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - file=`$echo $file|${SED} 's,.exe$,,'` - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin*|*mingw*) - wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` - ;; - *) - wrapper=$file - ;; - esac - if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then - notinst_deplibs= - relink_command= - - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac - # If there is no directory component, then add one. - case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; - esac - - # Check the variables that should have been set. - if test -z "$notinst_deplibs"; then - $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 - exit 1 - fi - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - # If there is no directory component, then add one. - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - fi - libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 - finalize=no - fi - done - - relink_command= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac - # If there is no directory component, then add one. - case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; - esac - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - if test "$finalize" = yes && test -z "$run"; then - tmpdir="/tmp" - test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir="$tmpdir/libtool-$$" - if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : - else - $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 - continue - fi - file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` - - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - ${rm}r "$tmpdir" - continue - fi - file="$outputname" - else - $echo "$modename: warning: cannot relink \`$file'" 1>&2 - fi - else - # Install the binary that we compiled earlier. - file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyways - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` - ;; - esac - ;; - esac - $show "$install_prog$stripme $file $destfile" - $run eval "$install_prog\$stripme \$file \$destfile" || exit $? - test -n "$outputname" && ${rm}r "$tmpdir" - ;; - esac - done - - for file in $staticlibs; do - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - $show "$install_prog $file $oldlib" - $run eval "$install_prog \$file \$oldlib" || exit $? - - if test -n "$stripme" && test -n "$striplib"; then - $show "$old_striplib $oldlib" - $run eval "$old_striplib $oldlib" || exit $? - fi - - # Do each command in the postinstall commands. - eval cmds=\"$old_postinstall_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$future_libdirs"; then - $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 - fi - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $0 --finish$current_libdirs' - else - exit 0 - fi - ;; - - # libtool finish mode - finish) - modename="$modename: finish" - libdirs="$nonopt" - admincmds= - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - eval cmds=\"$finish_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || admincmds="$admincmds - $cmd" - done - IFS="$save_ifs" - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $run eval "$cmds" || admincmds="$admincmds - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - test "$show" = : && exit 0 - - $echo "----------------------------------------------------------------------" - $echo "Libraries have been installed in:" - for libdir in $libdirs; do - $echo " $libdir" - done - $echo - $echo "If you ever happen to want to link against installed libraries" - $echo "in a given directory, LIBDIR, you must either use libtool, and" - $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - $echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - $echo " during execution" - fi - if test -n "$runpath_var"; then - $echo " - add LIBDIR to the \`$runpath_var' environment variable" - $echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $echo " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $echo " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - $echo - $echo "See any operating system documentation about shared libraries for" - $echo "more information, such as the ld(1) and ld.so(8) manual pages." - $echo "----------------------------------------------------------------------" - exit 0 - ;; - - # libtool execute mode - execute) - modename="$modename: execute" - - # The first argument is the command name. - cmd="$nonopt" - if test -z "$cmd"; then - $echo "$modename: you must specify a COMMAND" 1>&2 - $echo "$help" - exit 1 - fi - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - if test ! -f "$file"; then - $echo "$modename: \`$file' is not a file" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - dir= - case $file in - *.la) - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Read the libtool library. - dlname= - library_names= - - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" - continue - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit 1 - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - ;; - - *) - $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -*) ;; - *) - # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` - args="$args \"$file\"" - done - - if test -z "$run"; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - if test "${save_LC_ALL+set}" = set; then - LC_ALL="$save_LC_ALL"; export LC_ALL - fi - if test "${save_LANG+set}" = set; then - LANG="$save_LANG"; export LANG - fi - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" - fi - $echo "$cmd$args" - exit 0 - fi - ;; - - # libtool clean and uninstall mode - clean | uninstall) - modename="$modename: $mode" - rm="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) rm="$rm $arg"; rmforce=yes ;; - -*) rm="$rm $arg" ;; - *) files="$files $arg" ;; - esac - done - - if test -z "$rm"; then - $echo "$modename: you must specify an RM program" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - rmdirs= - - origobjdir="$objdir" - for file in $files; do - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$file"; then - dir=. - objdir="$origobjdir" - else - objdir="$dir/$origobjdir" - fi - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test "$mode" = uninstall && objdir="$dir" - - # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then - case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if (test -L "$file") >/dev/null 2>&1 \ - || (test -h "$file") >/dev/null 2>&1 \ - || test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - . $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" - done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - - if test "$mode" = uninstall; then - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - eval cmds=\"$postuninstall_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - eval cmds=\"$old_postuninstall_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - # FIXME: should reinstall the best remaining shared library. - fi - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - - # Read the .lo file - . $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" \ - && test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" \ - && test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$mode" = clean ; then - noexename=$name - case $file in - *.exe) - file=`$echo $file|${SED} 's,.exe$,,'` - noexename=`$echo $name|${SED} 's,.exe$,,'` - # $file with .exe has already been added to rmfiles, - # add $file without .exe - rmfiles="$rmfiles $file" - ;; - esac - # Do a test to see if this is a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$noexename - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - $show "$rm $rmfiles" - $run $rm $rmfiles || exit_status=1 - done - objdir="$origobjdir" - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - $show "rmdir $dir" - $run rmdir $dir >/dev/null 2>&1 - fi - done - - exit $exit_status - ;; - - "") - $echo "$modename: you must specify a MODE" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 - ;; - esac - - if test -z "$exec_cmd"; then - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 - fi -fi # test -z "$show_help" - -if test -n "$exec_cmd"; then - eval exec $exec_cmd - exit 1 -fi - -# We need to display help for each of the modes. -case $mode in -"") $echo \ -"Usage: $modename [OPTION]... [MODE-ARG]... - -Provide generalized library-building support services. - - --config show all configuration variables - --debug enable verbose shell tracing --n, --dry-run display commands without modifying any files - --features display basic configuration information and exit - --finish same as \`--mode=finish' - --help display this help message and exit - --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] - --quiet same as \`--silent' - --silent don't print informational messages - --tag=TAG use configuration variables from tag TAG - --version print version information - -MODE must be one of the following: - - clean remove files from the build directory - compile compile a source file into a libtool object - execute automatically set library path, then run a program - finish complete the installation of libtool libraries - install install libraries or executables - link create a library or an executable - uninstall remove libraries from an installed directory - -MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE. - -Report bugs to <bug-libtool@gnu.org>." - exit 0 - ;; - -clean) - $echo \ -"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - -compile) - $echo \ -"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -prefer-pic try to building PIC objects only - -prefer-non-pic try to building non-PIC objects only - -static always build a \`.o' file suitable for static linking - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - -execute) - $echo \ -"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - -finish) - $echo \ -"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - -install) - $echo \ -"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - -link) - $echo \ -"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -static do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - -uninstall) - $echo \ -"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - -*) - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; -esac - -$echo -$echo "Try \`$modename --help' for more information about other modes." - -exit 0 - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End:
diff --git a/television/autoconf/mkinstalldirs b/television/autoconf/mkinstalldirs deleted file mode 100755 index 994d71c..0000000 --- a/television/autoconf/mkinstalldirs +++ /dev/null
@@ -1,101 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman <friedman@prep.ai.mit.edu> -# Created: 1993-05-16 -# Public domain - -# $Id$ - -errstatus=0 -dirmode="" - -usage="\ -Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." - -# process command line arguments -while test $# -gt 0 ; do - case "${1}" in - -h | --help | --h* ) # -h for help - echo "${usage}" 1>&2; exit 0 ;; - -m ) # -m PERM arg - shift - test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } - dirmode="${1}" - shift ;; - -- ) shift; break ;; # stop option processing - -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option - * ) break ;; # first non-opt arg - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in -0) exit 0 ;; -esac - -case $dirmode in -'') - if mkdir -p -- . 2>/dev/null; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - fi ;; -*) - if mkdir -m "$dirmode" -p -- . 2>/dev/null; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - fi ;; -esac - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" - - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# Local Variables: -# mode: shell-script -# sh-indentation: 3 -# End: -# mkinstalldirs ends here
diff --git a/television/configure b/television/configure deleted file mode 100755 index 4a561e2..0000000 --- a/television/configure +++ /dev/null
@@ -1,2356 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for llvm-tv pre-release. -# -# Report bugs to <llvmbugs@cs.uiuc.edu>. -# -# Copyright (C) 2003 Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_config_libobj_dir=. -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Identity of this package. -PACKAGE_NAME='llvm-tv' -PACKAGE_TARNAME='-llvm-tv-' -PACKAGE_VERSION='pre-release' -PACKAGE_STRING='llvm-tv pre-release' -PACKAGE_BUGREPORT='llvmbugs@cs.uiuc.edu' - -ac_unique_file=""Makefile.common.in"" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_SRC LLVM_OBJ LIBOBJS LTLIBOBJS' -ac_subst_files='' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -ac_prev= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures llvm-tv pre-release to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -_ACEOF - - cat <<_ACEOF -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] -_ACEOF - - cat <<\_ACEOF -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of llvm-tv pre-release:";; - esac - cat <<\_ACEOF - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-llvmsrc Location of LLVM Source Code - --with-llvmobj Location of LLVM Object Code - -Report bugs to <llvmbugs@cs.uiuc.edu>. -_ACEOF -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd $ac_popdir - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\_ACEOF -llvm-tv configure pre-release -generated by GNU Autoconf 2.59 - -Copyright (C) 2003 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit 0 -fi -exec 5>config.log -cat >&5 <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by llvm-tv $as_me pre-release, which was -generated by GNU Autoconf 2.59. Invocation command line was - - $ $0 $@ - -_ACEOF -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_sep= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status - ' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ac_aux_dir= -for ac_dir in autoconf $srcdir/autoconf; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f $ac_dir/shtool; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&2;} - { (exit 1); exit 1; }; } -fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - - - ac_config_files="$ac_config_files Makefile.config" - - - ac_config_commands="$ac_config_commands Makefile" - - - ac_config_commands="$ac_config_commands Makefile.common" - - - ac_config_commands="$ac_config_commands lib/Makefile" - - - ac_config_commands="$ac_config_commands lib/Snapshot/Makefile" - - - ac_config_commands="$ac_config_commands tools/Makefile" - - - ac_config_commands="$ac_config_commands tools/llvm-tv/Makefile" - - - - - - -# Check whether --with-llvmsrc or --without-llvmsrc was given. -if test "${with_llvmsrc+set}" = set; then - withval="$with_llvmsrc" - LLVM_SRC=$withval - -else - LLVM_SRC=`cd ${srcdir}/../..; pwd` - -fi; - -# Check whether --with-llvmobj or --without-llvmobj was given. -if test "${with_llvmobj+set}" = set; then - withval="$with_llvmobj" - LLVM_OBJ=$withval - -else - LLVM_OBJ=`cd ../..; pwd` - -fi; - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then we branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -cat >confdef2opt.sed <<\_ACEOF -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g -t quote -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g -t quote -d -: quote -s,[ `~#$^&*(){}\\|;'"<>?],\\&,g -s,\[,\\&,g -s,\],\\&,g -s,\$,$$,g -p -_ACEOF -# We use echo to avoid assuming a particular line-breaking character. -# The extra dot is to prevent the shell from consuming trailing -# line-breaks from the sub-command output. A line-break within -# single-quotes doesn't work because, if this script is created in a -# platform that uses two characters for line-breaks (e.g., DOS), tr -# would break. -ac_LF_and_DOT=`echo; echo .` -DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` -rm -f confdef2opt.sed - - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by llvm-tv $as_me pre-release, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\_ACEOF - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Configuration commands: -$config_commands - -Report bugs to <bug-autoconf@gnu.org>." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -llvm-tv config.status pre-release -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2003 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -# -# INIT-COMMANDS section. -# - -${srcdir}/autoconf/mkinstalldirs `dirname Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname Makefile.common` -${srcdir}/autoconf/mkinstalldirs `dirname lib/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname lib/Snapshot/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname tools/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname tools/llvm-tv/Makefile` - -_ACEOF - - - -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "Makefile.config" ) CONFIG_FILES="$CONFIG_FILES Makefile.config" ;; - "Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; - "Makefile.common" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile.common" ;; - "lib/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Makefile" ;; - "lib/Snapshot/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Snapshot/Makefile" ;; - "tools/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS tools/Makefile" ;; - "tools/llvm-tv/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS tools/llvm-tv/Makefile" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@LLVM_SRC@,$LLVM_SRC,;t t -s,@LLVM_OBJ@,$LLVM_OBJ,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_COMMANDS section. -# -for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue - ac_dest=`echo "$ac_file" | sed 's,:.*,,'` - ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_dir=`(dirname "$ac_dest") 2>/dev/null || -$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_dest" : 'X\(//\)[^/]' \| \ - X"$ac_dest" : 'X\(//\)$' \| \ - X"$ac_dest" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_dest" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 -echo "$as_me: executing $ac_dest commands" >&6;} - case $ac_dest in - Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; - Makefile.common ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/Makefile.common Makefile.common ;; - lib/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/Makefile lib/Makefile ;; - lib/Snapshot/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/Snapshot/Makefile lib/Snapshot/Makefile ;; - tools/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/tools/Makefile tools/Makefile ;; - tools/llvm-tv/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/tools/llvm-tv/Makefile tools/llvm-tv/Makefile ;; - esac -done -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi -
diff --git a/television/docs/Design.txt b/television/docs/Design.txt deleted file mode 100644 index 1bcacc5..0000000 --- a/television/docs/Design.txt +++ /dev/null
@@ -1,110 +0,0 @@ -Design of LLVM-TV ------------------ - -TVApplication implements the wxApp interface and is the launcher of LLVM-TV. -It is responsible for keeping track of all the windows, and the list of -available snapshots. It is also responsible for handling Unix signals sent to -the LLVM-TV process; this is the mechanism the LLVM optimizer uses for -communicating with LLVM-TV. - -TVFrame is responsible for the main LLVM-TV user interface - it sets up the -vertically-split main window having a tree of snapshots on the left -(TVTreeCtrl), and a tabbed view containing visualizers on the right -(TVNotebook). TVFrame is also responsible for the menu bar, and it is the first -object that deals with commands issued as a result of the user choosing menu -items. - -TVTreeItemData is the basic unit of visualization in LLVM-TV. It is also the -abstract superclass for all nodes that appear in the tree view on the left-hand -side of LLVM-TV's main window. The root of the tree is the Singleton -TVTreeRootItem, which is hidden (the user cannot select it) and has no -displayable data. The TVTreeRootItem contains TVTreeModuleItems, which point to -snapshots of LLVM Modules; the TVTreeModuleItems in turn contain -TVTreeFunctionItems, which point to snapshots of LLVM Functions within the -parent Modules. - -The TVHtmlWindow class is an ItemDisplayer that displays syntax-highlighted LLVM -assembly code for TVTreeItems (either Functions or Modules) in HTML format. - -A TVTreeItem uses an HTMLPrinter to display a Function or a Module in a -syntax-highlighted view. It also chooses a HTMLMarkup strategy class to decide -whether to use Cascading Style Sheets (CSS) or old-style "font" tags for syntax -highlighting of elements such as keywords, types, and basic-block names. -HTMLPrinter is a Visitor, implemented using the standard LLVM InstVisitor C++ -template. - -TVNotebook is responsible for implementing the tabbed interface which you see on -the right-hand side of the main window (the TVFrame). - -ItemDisplayer is the abstract superclass for objects that know how to visualize -LLVM Functions and/or Modules. ItemDisplayers can be displayed in tabs in the -TVNotebook view, or in their own windows (called PictureFrames). - -TVCodeViewer is the ItemDisplayer which implements the "interactive code view" -which highlights use-def chains. Each TVCodeViewer contains a TVCodeListCtrl, -which is responsible for the actual drawing of the list view, and which is where -most of the interesting stuff happens -- TVCodeViewer is essentially an Adapter -around TVCodeListCtrl to allow it to display itself either in a tab view or a -window. - -GraphDrawer is an abstract superclass for all graph-drawing visualizers. It -inherits the ItemDisplayer interface, so all GraphDrawers are also -ItemDisplayers. GraphDrawer simplifies the ItemDisplayer interface using the -Template Method pattern. Concrete GraphDrawers only need to be able to provide -an image object given a TVTreeItem; the abstract GraphDrawer class provides -for displaying the image in a convenient scrolling viewer (called a -PictureCanvas). - -CallGraphDrawer and CFGGraphDrawer are GraphDrawers for displaying the call -graph (for a Module) and the control-flow graph (for a Function), respectively. - -DSAGraphDrawer is an abstract class for Data Structure Graph viewers. -It implements GraphDrawer's Abstract Methods -drawFunctionGraph() and drawModuleGraph() as Template Methods which rely on -pure-virtual C++ methods that return the Pass object to write out the graph, -which is different for each of BUGraphDrawer, TDGraphDrawer, and -LocalGraphDrawer, as well as the filename to which they output the results of -their analysis. The functions createFunctionPass() and createModulePass() are -Factory Methods as they create passes of different classes that are subclasses -of FunctionPass or Pass, respectively. The algorithm for running the pass on a -Function or Module is shared among the 3 subclasses of DSAGraphDrawer. - -BUGraphDrawer, TDGraphDrawer, and LocalGraphDrawer are also ItemDisplayers, -which allows them to be displayed in tabs or in separate new windows. - - -Extending LLVM-TV ------------------ - -In order to add a new visualization to LLVM-TV, the programmer should add a new -concrete subclass of ItemDisplayer. The requirements for a new ItemDisplayer -subclass are: - -1) An ItemDisplayer must create and hold a wxWindows display widget (subclass of -wxWindow) to draw in. The widget should be of a type appropriate to the -visualization - for example, if you are displaying a list of things, use a -wxListCtrl; if you are displaying a tree, use a wxTreeCtrl. If you want to -display an image, you probably will want to create a subclass of GraphDrawer -instead (see below). When your getWindow() method is called, you should create -the display widget (if it has not already been created) and return a pointer to -it. - -2) An ItemDisplayer must respond to the displayItem(TVTreeItemData *) message by -updating its display widget to contain visual information about the given item. - -3) An ItemDisplayer must respond to the getDisplayTitle(TVTreeItemData *) -message by returning a string, suitable for a window or tab title, which -describes the visualization of the given item -- or if no item is passed in, a -string which describes the kind of visualization it generally performs (e.g., -"Dominator tree view of java.lang.System.arraycopy()" vs. "Dominator tree -view".) - -If you want to add a new visualization to LLVM-TV which *only* draws images and -allows the user to view them, you can subclass GraphDrawer. Instead of -requirements 1) and 2) above, a new subclass of GraphDrawer is required to -respond to the drawModuleGraph(Module *) and drawFunctionGraph(Function *) -messages by returning a wxImage object that contains an image representing the -LLVM item passed in. GraphDrawer will take care of displaying the image in a -scrolling canvas, either in a tab or a separate window. - -
diff --git a/television/docs/Features.txt b/television/docs/Features.txt deleted file mode 100644 index 5b5d2aa..0000000 --- a/television/docs/Features.txt +++ /dev/null
@@ -1,30 +0,0 @@ -LLVM-TV FEATURES - -1. Current -========== - -* Tabbed views of Modules and Functions: choose text or HTML -* Call graph display for a Module -* CFG display for a function -* Use/def chains for instructions - - not polished: separate from syntax-highlighted view, multi-column -* BU, TD, or Local DSGraphs display for global vars and functions -* Tabbed view of graphs (CallGraph, CFG, DSA, ...) - -2. Under development/debugging -============================== - -* Scintilla / syntax-highlighting editing control -* Cycling through snapshots (prev, next) while keeping same function in view - -3. Long-term ideas -================== - -* Some other kind of pointer analysis viewer? -* Cache display of complex computed structures (graphs) -* Calculate graphs in the background -- user should be able to change tabs while - the graph calculation is going on -* Rewrite LLVM-TV in XUL - + As portable as Mozilla - + HTML/CSS for code (can use links and mouseover!) - + SVG for graphs
diff --git a/television/docs/UserGuide.html b/television/docs/UserGuide.html deleted file mode 100644 index 86ee32a..0000000 --- a/television/docs/UserGuide.html +++ /dev/null
@@ -1,202 +0,0 @@ -<html> -<head> - <title>LLVM Visualization Tool User Guide</title> -</head> -<body> - -<h2><img src="images/llvmtv-logo.png" alt="[LLVM-TV Logo]">LLVM Visualization Tool User Guide</h2> - -<h3><u>Required Software:</u></h3> -In order to compile and run the LLVM Visualization Tool (LLVM-TV), the following software -must be installed: - -<ul> -<li><b>The Low Level Virtual Machine (LLVM) Compiler Infrastructure:</b> You -must check out the latest version from CVS. LLVM-TV does not work with -LLVM version 1.2, the latest released version at the time of this writing. -See the <a href="http://llvm.cs.uiuc.edu/docs/GettingStarted.html">LLVM Getting -Started Guide</a> for details.</li> -<li><b>Dot</b>: Included in the AT&T Research <a href="http://www.research.att.com/sw/tools/graphviz/">Graphviz</a> package, LLVM-TV uses Dot to draw directed -graphs. For best results, make sure you have TrueType fonts installed.</li> -</ul> -<p> - -<h3><u>Download:</u></h3> -<p>Once you have unpacked and compiled LLVM, download the LLVM Visualization -Tool sources and unpack them in the <tt>projects</tt> subdirectory of your LLVM -source tree.</p> -<pre> - % cd llvm/projects - % tar xzvf llvm-tv.tgz - % cd llvm-tv -</pre> - -<p> - -<h3><u>Compiling:</u></h3> -<p>You must then compile the LLVM Visualization Tool.</p> -<pre> - % ./configure --with-llvmsrc=[path] --with-llvmobj=[path] -</pre> -<p><i>If you're building in llvm/projects/llvm-tv, then you don't need - to specify these --with options.</i></p> -<pre> - % cd lib/wxwindows - % ./configure --enable-debug --prefix=`pwd` -</pre> -<p><i>Make absolutely sure that wxWindows's configure script detects the same - C++ compiler that you used to compile LLVM. Otherwise, you may get - weird link errors when trying to link the llvm-tv tool.</i></p> -<pre> - % cd ../.. - % gmake -</pre> - -<p> - -<h3><u>Using the LLVM Visualization Tool:</u></h3> - -The main purpose of the LLVM Visualization tool is to view the effects of transformations written in the LLVM framework. We call the points in time after a transformation has been run "snapshots." <p> - -Note: opt-snap and llvm-tv.exe may be found in the tools/Debug directory. -<p> - -<h4>Acquiring a Snapshot:</h4> - -<p>Using the LLVM tool 'opt', one runs transformations on an LLVM Bytecode file. -Please see the <a href="http://llvm.cs.uiuc.edu/docs/CommandGuide/opt.html">man -page</a> on opt for details on what transformations are available.</p> - -<p>In order to acquire snapshots after a transformation or a series of -transformations have been applied, you use the 'opt-snap' tool. You simply place -the option '-snapshot' after specifying your transformation options. You may ask -for a snapshot any number of times.</p> - -<p>Here is an example of using opt to acquire snapshots. We will run two -optimizations (loop-invariant code motion and global common-subexpression -elimination) on the program whose LLVM bytecode is in the file -<tt>bytecode-file.bc</tt>, and take a snapshot after each pass completes:</p> -<pre> - % opt-snap -debug -licm -snapshot -gcse -snapshot < bytecode-file.bc > /dev/null -</pre> - -<p>All snapshots are placed in the directory -<tt>/tmp/llvm-tv-<i>username</i>/snapshots</tt>, where <tt><i>username</i></tt> -is your login name.</p> - -<h4>Viewing a Snapshot:</h4> -<p>Begin by starting up the LLVM Visualization tool GUI. Make sure llvm-tv.exe -is in your PATH, then type:</p> - -<pre> - % llvm-tv.exe -</pre> - -<p>This should pop up a window such as the following:</p> -<img src="images/llvmtv-firstopen.jpg"><p> - -<p>Notice that all the snapshots are listed in the tree view structure on the left -side of the frame. Compilation units in LLVM have a simple, hierarchical -structure: -a Module contains Functions, which contain BasicBlocks, which contain -Instructions. The tree view will show you functions within the snapshot you are viewing.</p> - -<p> -From this screen shot, you can see that we have expanded a module revealing that it has several functions within it.</p> -<img src="images/llvmtv-expandmodule.jpg"> - -<p> -To the right of the tree view is a tabbed pane that allows you to easily browse -different views of the snapshot.</p> - -<b>TextView:</b><br> - -<p>The text view is a direct disassembly of the Module, showing the pointer size -of the target architecture for which it was compiled, endianness, the -user-defined types present in the module, global variables, and all function -definitions.</p> - -<img src="images/llvmtv-TextView.jpg"><p> - -<b>HTMLView:</b><br> - -<p>The HTML view is a syntax-highlighted view with LLVM keywords in blue, types -in green, and BasicBlock names in red. For brevity, the Module view does not -include the types and the functions are given as prototypes. External functions, -for which the Module has no code, are prepended with a `declare' keyword. Other -functions' code can be viewed by clicking on the appropriate node in the tree -list.</p> - -<img src="images/llvmtv-HTMLView.jpg"><p> - - -<b>DSGraph Views:</b><br> - -<p>LLVM has a powerful alias analysis framework and here we are showcasing its -novel Data Structure Analysis (DSA) algorithm. It has 3 components: the -Bottom-Up DSGraph, Top-down DSGraph, and Local DSGraph. These graphs show -points-to results analysis for global variables and other pointers in a -program. Here we see the results of a local data-structure analysis run:</p> - -<img src="images/llvmtv-LocalDSGraph.jpg"><p> - -<b>CodeView:</b><br> - -<p>Because LLVM is in SSA (Static Single Assignment) form, any use of a variable must -be preceded by exactly one definition. We can thus form def-use chains which -connect definitions of variables to their uses. The CodeView enables one to -click on any value and see where the uses of the variable occur, allowing a -visual way to inspect code. As a side effect, clicking on a BasicBlock entry -shows all users of the BasicBlock, which are branches that have the BasicBlock -as a target, thus showing how many incoming control-flow edges a block has.</p> - -<img src="images/llvmtv-CodeView.jpg"><p> - -<p>There are also more views under the View menu. Selecting one of these views will -open up a new window with that view in it. There are two new views that we have -not seen before: Call Graph view and Control Flow Graph view.</p> - -<img src="images/llvmtv-ViewMenu.jpg"><p> - -<b>Call Graph:</b><br> - -<p>The Call Graph shows the callers and callees of each function in the module. A graph of -functions, here each node represents a function and an arrow from node A to node -B means that function A calls function B at least once in its code.</p> - -<b>Control Flow Graph:</b><br> - -<p>The control flow graph displays graphically the control flow of the function, -identifying each basic block as a node and labeling all branches between blocks -as arrows.</p> - -<img src="images/llvmtv-ControlFlow.jpg"><p> - -Additionally, you can use the File menu to add more snapshots to the visualizer. -<br> -<img src="images/llvmtv-FileMenu.jpg"><p> - -<b>Add Module:</b><br> - -<p>This will add a given Module to the list of snapshots without having to run -opt-snap to deposit it into the snapshot collection. This is useful if you -want to compare different programs, instead of looking at multiple views -of the same program.</p> - -<b>Refresh:</b><br> - -<p>This option will re-read the snapshot collection directory to see if any new -Modules have been added manually by the user (by copying directly through the -filesystem).</p> - -<h4>Snapshots and Signaling:</h4> - -<p> -A neat feature of the LLVM Visualization tool is that the GUI will automatically -refresh the snapshot listing when opt-snap signals that a new snapshot has been -generated. This is primarily useful for long-running optimizations. -</p> - -</body> -</html> -
diff --git a/television/docs/images/LLVMTV-UML-LARGE.jpg b/television/docs/images/LLVMTV-UML-LARGE.jpg deleted file mode 100644 index f4de7dd..0000000 --- a/television/docs/images/LLVMTV-UML-LARGE.jpg +++ /dev/null Binary files differ
diff --git a/television/docs/images/LLVMTV-UML-MEDIUM.jpg b/television/docs/images/LLVMTV-UML-MEDIUM.jpg deleted file mode 100644 index be692d5..0000000 --- a/television/docs/images/LLVMTV-UML-MEDIUM.jpg +++ /dev/null Binary files differ
diff --git a/television/docs/images/LLVMTV-UML-SMALL.jpg b/television/docs/images/LLVMTV-UML-SMALL.jpg deleted file mode 100644 index c71f046..0000000 --- a/television/docs/images/LLVMTV-UML-SMALL.jpg +++ /dev/null Binary files differ
diff --git a/television/docs/images/LLVMTV-UML2.jpg b/television/docs/images/LLVMTV-UML2.jpg deleted file mode 100644 index ece01c5..0000000 --- a/television/docs/images/LLVMTV-UML2.jpg +++ /dev/null Binary files differ
diff --git a/television/docs/images/llvmtv-CodeView.jpg b/television/docs/images/llvmtv-CodeView.jpg deleted file mode 100644 index 6bc4125..0000000 --- a/television/docs/images/llvmtv-CodeView.jpg +++ /dev/null Binary files differ
diff --git a/television/docs/images/llvmtv-ControlFlow.jpg b/television/docs/images/llvmtv-ControlFlow.jpg deleted file mode 100644 index 3057d53..0000000 --- a/television/docs/images/llvmtv-ControlFlow.jpg +++ /dev/null Binary files differ
diff --git a/television/docs/images/llvmtv-FileMenu.jpg b/television/docs/images/llvmtv-FileMenu.jpg deleted file mode 100644 index c08f64f..0000000 --- a/television/docs/images/llvmtv-FileMenu.jpg +++ /dev/null Binary files differ
diff --git a/television/docs/images/llvmtv-HTMLView.jpg b/television/docs/images/llvmtv-HTMLView.jpg deleted file mode 100644 index af2058d..0000000 --- a/television/docs/images/llvmtv-HTMLView.jpg +++ /dev/null Binary files differ
diff --git a/television/docs/images/llvmtv-LocalDSGraph.jpg b/television/docs/images/llvmtv-LocalDSGraph.jpg deleted file mode 100644 index 1af0c39..0000000 --- a/television/docs/images/llvmtv-LocalDSGraph.jpg +++ /dev/null Binary files differ
diff --git a/television/docs/images/llvmtv-TextView.jpg b/television/docs/images/llvmtv-TextView.jpg deleted file mode 100644 index f432913..0000000 --- a/television/docs/images/llvmtv-TextView.jpg +++ /dev/null Binary files differ
diff --git a/television/docs/images/llvmtv-UML1.jpg b/television/docs/images/llvmtv-UML1.jpg deleted file mode 100644 index 010a14b..0000000 --- a/television/docs/images/llvmtv-UML1.jpg +++ /dev/null Binary files differ
diff --git a/television/docs/images/llvmtv-ViewMenu.jpg b/television/docs/images/llvmtv-ViewMenu.jpg deleted file mode 100644 index df2f9d7..0000000 --- a/television/docs/images/llvmtv-ViewMenu.jpg +++ /dev/null Binary files differ
diff --git a/television/docs/images/llvmtv-expandmodule.jpg b/television/docs/images/llvmtv-expandmodule.jpg deleted file mode 100644 index c992612..0000000 --- a/television/docs/images/llvmtv-expandmodule.jpg +++ /dev/null Binary files differ
diff --git a/television/docs/images/llvmtv-firstopen.jpg b/television/docs/images/llvmtv-firstopen.jpg deleted file mode 100644 index bf3b2c8..0000000 --- a/television/docs/images/llvmtv-firstopen.jpg +++ /dev/null Binary files differ
diff --git a/television/docs/images/llvmtv-logo.png b/television/docs/images/llvmtv-logo.png deleted file mode 100644 index 530cfa8..0000000 --- a/television/docs/images/llvmtv-logo.png +++ /dev/null Binary files differ
diff --git a/television/include/llvm-tv/Config.h b/television/include/llvm-tv/Config.h deleted file mode 100644 index fabe8fa..0000000 --- a/television/include/llvm-tv/Config.h +++ /dev/null
@@ -1,17 +0,0 @@ -#ifndef LLVM_TV_CONFIG_H -#define LLVM_TV_CONFIG_H - -#include <string> - -namespace { - - // To make sure we don't collide if working on the same machine, - // the llvm-tv data directory is user-specific - const std::string llvmtvPath = "/tmp/llvm-tv-" + - std::string(getenv("USER")); - const std::string snapshotsPath = llvmtvPath + "/snapshots"; - const std::string llvmtvPID = llvmtvPath + "/llvm-tv.pid"; - -} - -#endif
diff --git a/television/include/llvm-tv/Support/FileUtils.h b/television/include/llvm-tv/Support/FileUtils.h deleted file mode 100644 index 30dc189..0000000 --- a/television/include/llvm-tv/Support/FileUtils.h +++ /dev/null
@@ -1,36 +0,0 @@ -//===- FileUtils.h - File system utility functions for snapshotting -------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// File-system functionality useful for snapshotting (Unix-specific). -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TV_FILEUTILS_H -#define LLVM_TV_FILEUTILS_H - -#include <string> -#include <vector> - -namespace llvm { - -/// GetNumFilesInDir - returns a count of files in directory -/// -unsigned GetNumFilesInDir(const std::string &path); - -/// GetFilesInDir - populate vector with a listing of files in directory -/// -void GetFilesInDir(const std::string &path, std::vector<std::string> &list); - -bool DirectoryExists (const std::string &dirPath); - -void EnsureDirectoryExists (const std::string &dirPath); - -}; - -#endif
diff --git a/television/include/llvm-tv/Support/Snapshots.h b/television/include/llvm-tv/Support/Snapshots.h deleted file mode 100644 index c85c7e7..0000000 --- a/television/include/llvm-tv/Support/Snapshots.h +++ /dev/null
@@ -1,26 +0,0 @@ -//===- Snapshots.h - Snapshot utility functions ---------------*- C++ -*---===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TV_SUPPORT_SNAPSHOTS_H -#define LLVM_TV_SUPPORT_SNAPSHOTS_H - -#include <string> -#include <vector> - -namespace llvm { - -void ReadSnapshots(std::vector<std::string> &oldModules, - std::vector<Module*> NewModules); - -} - -#endif
diff --git a/television/lib/Makefile b/television/lib/Makefile deleted file mode 100644 index 8684254..0000000 --- a/television/lib/Makefile +++ /dev/null
@@ -1,4 +0,0 @@ -LEVEL = .. -DIRS = Snapshot - -include $(LEVEL)/Makefile.common
diff --git a/television/lib/Snapshot/FileUtils.cpp b/television/lib/Snapshot/FileUtils.cpp deleted file mode 100644 index ac36980..0000000 --- a/television/lib/Snapshot/FileUtils.cpp +++ /dev/null
@@ -1,70 +0,0 @@ -//===- FileUtils.cpp - File system utility functions for snapshotting -----===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file is Unix-specific; to become part of LLVM it needs to be made -// portable for the architectures/systems LLVM supports. -// -//===----------------------------------------------------------------------===// - -#include "llvm-tv/Support/FileUtils.h" -#include <sys/types.h> -#include <sys/stat.h> -#include <dirent.h> - -/// Returns the number of entries in the directory named PATH. -/// -/// FIXME: If we want to be portable, we can use opendir/readdir/closedir() -/// and stat(), instead of scandir() and alphasort(). Also, this function -/// will probably not skip directories (better verify this!) -/// -unsigned llvm::GetNumFilesInDir(const std::string &path) { - struct dirent **namelist; - int n = scandir(path.c_str(), &namelist, 0, alphasort); - int num = n; - if (n < 0) - perror("scandir"); - else { - while(n--) - free(namelist[n]); - free(namelist); - } - return num; -} - - -/// GetFilesInDir - returns a listing of files in directory -/// -void llvm::GetFilesInDir(const std::string &path, - std::vector<std::string> &list) -{ - struct dirent **namelist; - int n = scandir(path.c_str(), &namelist, 0, alphasort); - if (n < 0) - perror("scandir"); - else { - while(n--) { - list.push_back(std::string(namelist[n]->d_name)); - free(namelist[n]); - } - free(namelist); - } -} - -bool llvm::DirectoryExists (const std::string &dirPath) { - struct stat stbuf; - if (stat (dirPath.c_str (), &stbuf) < 0) - return false; - return S_ISDIR (stbuf.st_mode); -} - -void llvm::EnsureDirectoryExists (const std::string &dirPath) { - if (!DirectoryExists (dirPath)) - mkdir (dirPath.c_str (), 0777); -} -
diff --git a/television/lib/Snapshot/Makefile b/television/lib/Snapshot/Makefile deleted file mode 100644 index a58bcdd..0000000 --- a/television/lib/Snapshot/Makefile +++ /dev/null
@@ -1,5 +0,0 @@ -LEVEL = ../.. -LIBRARYNAME = LLVMTVSnapshot -SHARED_LIBRARY = 1 - -include $(LEVEL)/Makefile.common
diff --git a/television/lib/Snapshot/ReadSnapshots.cpp b/television/lib/Snapshot/ReadSnapshots.cpp deleted file mode 100644 index 2b71280..0000000 --- a/television/lib/Snapshot/ReadSnapshots.cpp +++ /dev/null
@@ -1,38 +0,0 @@ -//===- ReadSnapshots.cpp - View snapshots that were saved previously ------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// -//===----------------------------------------------------------------------===// - -#include "llvm/Module.h" -#include "llvm/Bytecode/Reader.h" -#include "llvm-tv/Support/FileUtils.h" -#include "llvm-tv/Support/Snapshots.h" -#include <string> -#include <vector> -using namespace llvm; - -namespace { - const std::string bytecodePath = "/tmp/llvm-tv/snapshots"; -} - -/// ReadSnapshots - load all bytecode files in a directory that haven't yet been -/// slurped in earlier. -/// -void llvm::ReadSnapshots(std::vector<std::string> &oldModules, - std::vector<Module*> NewModules) { - std::string Filename (bytecodePath); - std::vector<std::string> FileListing; - GetFilesInDir(bytecodePath, FileListing); - - for (std::vector<std::string>::iterator i = FileListing.begin(), - e = FileListing.end(); i != e; ++i) - if (std::find(oldModules.begin(), oldModules.end(), *i) != oldModules.end()) - NewModules.push_back(ParseBytecodeFile(*i)); -}
diff --git a/television/lib/Snapshot/WriteSnapshot.cpp b/television/lib/Snapshot/WriteSnapshot.cpp deleted file mode 100644 index fe4c415..0000000 --- a/television/lib/Snapshot/WriteSnapshot.cpp +++ /dev/null
@@ -1,164 +0,0 @@ -//===- Snapshot.cpp - Snapshot Module views and communicate with llvm-tv --===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// * If llvm-tv is not running, start it. -// * Send update to llvm-tv each time this pass is called on the command line, -// e.g. opt -snapshot -licm -snapshot -gcse -snapshot ... -// -//===----------------------------------------------------------------------===// - -#include "llvm/Module.h" -#include "llvm/Pass.h" -#include "llvm/Bytecode/WriteBytecodePass.h" -#include "llvm/ADT/StringExtras.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/Debug.h" -#include "llvm/Support/SystemUtils.h" -#include "llvm-tv/Support/FileUtils.h" -#include "llvm-tv/Config.h" -#include <csignal> -#include <cstdlib> -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif -#include <cstring> -#include <dirent.h> -#include <fstream> -#include <string> -#include <unistd.h> -#include <vector> -#include <sys/types.h> -using namespace llvm; - -extern char **environ; - -namespace { - struct Snapshot : public ModulePass { - /// getAnalysisUsage - this pass does not require or invalidate any analysis - /// - virtual void getAnalysisUsage(AnalysisUsage &AU) { - AU.setPreservesAll(); - } - - /// runOnModule - save the Module in a pre-defined location with our naming - /// strategy - bool runOnModule(Module &M); - - private: - bool sendSignalToLLVMTV(); - std::string findOption(unsigned Idx); - }; - - // Keep our place in the list of passes that opt was run with to give the - // snapshots appropriate names. - static unsigned int PassPosition = 1; - /// The name of the command-line option to invoke the snapshot pass - const std::string SnapshotCmd = "snapshot"; - RegisterOpt<Snapshot> X("snapshot", "Snapshot a module, signal llvm-tv"); -} - - -/// runOnModule - save snapshot to a pre-defined directory with a consecutive -/// number in the name (for alphabetization) and the name of the pass that ran -/// just before this one. Signal llvm-tv that fresh bytecode file has arrived -/// for consumption. -bool Snapshot::runOnModule(Module &M) { - // Make sure the snapshots dir exists, which it will unless this - // is the first time we've ever run the -snapshot pass. - EnsureDirectoryExists (llvmtvPath); - EnsureDirectoryExists (snapshotsPath); - - // Assumption: directory only has numbered .bc files, from 0 -> n-1, next one - // we add will be n.bc . Subtract 2 for "." and ".." - unsigned numFiles = GetNumFilesInDir(snapshotsPath) - 2; - - std::string Filename(snapshotsPath); - Filename = Filename + "/" + utostr(numFiles) + "-" + - findOption(PassPosition++) + ".bc"; - - std::ofstream os(Filename.c_str()); - WriteBytecodeToFile(&M, os); - os.close(); - - // Communicate to llvm-tv that we have added a new snapshot - if (!sendSignalToLLVMTV()) return false; - - // Since we were not successful in sending a signal to an already-running - // instance of llvm-tv, start a new instance and send a signal to it. - sys::Path llvmtvExe = FindExecutable("llvm-tv", ""); - if (llvmtvExe.isValid() && !llvmtvExe.isEmpty() && llvmtvExe.isFile() && - llvmtvExe.canExecute()) { - int pid = fork(); - // Child process morphs into llvm-tv - if (!pid) { - char *argv[1]; argv[0] = 0; - if (execve(llvmtvExe.toString().c_str(), argv, environ) == -1) { - perror("execve"); - return false; - } - } - - // parent waits for llvm-tv to write out its pid to a file - // and then sends it a signal - sleep(3); - sendSignalToLLVMTV(); - } else - std::cerr << "Cannot find llvm-tv in the path!\n"; - - return false; -} - -/// sendSignalToLLVMTV - read pid from file, send signal to llvm-tv process -/// -bool Snapshot::sendSignalToLLVMTV() { - // See if we can open a file with llvm-tv's pid in it - std::ifstream is(llvmtvPID.c_str()); - int pid = 0; - if (is.good() && is.is_open()) - is >> pid; - else - return true; - - is.close(); - if (pid > 0) - return (kill(pid, SIGUSR1) == -1); - - return true; -} - -/// findOption - read the environment variable OPTPASSES which should contain -/// the arguments passed to opt and select all those that start with a -/// dash. Return the last one before the Idx-th invocation of `-snapshot' -std::string Snapshot::findOption(unsigned Idx) { - unsigned currIdx = 0; - char *OptCmdline = getenv("OPTPASSES"); - if (!OptCmdline) return "noenv"; - std::vector<std::string> InputArgv; - InputArgv.push_back("filler"); - while (*OptCmdline) { - if (*OptCmdline == '-') { - size_t len = strcspn(OptCmdline, " "); - // Do not add in the '-' or the space after the switch - char *arg = strdup(OptCmdline+1); - arg[len - 1] = '\0'; - InputArgv.push_back(std::string(arg)); - free(arg); - } - OptCmdline += strcspn(OptCmdline, " ") + 1; - } - - std::vector<std::string>::iterator stringPos = InputArgv.begin(); - while (currIdx < Idx && stringPos != InputArgv.end()) { - stringPos = std::find(stringPos+1, InputArgv.end(), SnapshotCmd); - ++currIdx; - } - - return (stringPos == InputArgv.end()) ? "notfound" - : (stringPos == InputArgv.begin()) ? "clean" : *--stringPos; -}
diff --git a/television/tools/Makefile b/television/tools/Makefile deleted file mode 100644 index ba884f9..0000000 --- a/television/tools/Makefile +++ /dev/null
@@ -1,5 +0,0 @@ -LEVEL := .. -PARALLEL_DIRS := llvm-tv - -include $(LEVEL)/Makefile.common -
diff --git a/television/tools/llvm-tv/CFGGraphDrawer.cpp b/television/tools/llvm-tv/CFGGraphDrawer.cpp deleted file mode 100644 index 074f7e1..0000000 --- a/television/tools/llvm-tv/CFGGraphDrawer.cpp +++ /dev/null
@@ -1,27 +0,0 @@ -#include "CFGGraphDrawer.h" -#include "TVTreeItem.h" -#include "llvm/Function.h" -#include "llvm/ModuleProvider.h" -#include "llvm/Analysis/CFGPrinter.h" -#include "llvm/PassManager.h" -using namespace llvm; - -//===----------------------------------------------------------------------===// - -// CFGGraphDrawer implementation - -wxImage *CFGGraphDrawer::drawFunctionGraph (Function *fn) { - ModuleProvider *MP = new ExistingModuleProvider (fn->getParent ()); - FunctionPassManager PM (MP); - PM.add (createCFGOnlyPrinterPass ()); - PM.run (*fn); - MP->releaseModule (); // Don't delete it when you go away, says I - delete MP; - return buildwxImageFromDotFile ("cfg." + fn->getName() + ".dot"); -} - -std::string CFGGraphDrawer::getDisplayTitle (TVTreeItemData *item) { - std::string title ("Control-flow graph"); - if (item) title += " of " + item->getTitle (); - return title; -}
diff --git a/television/tools/llvm-tv/CFGGraphDrawer.h b/television/tools/llvm-tv/CFGGraphDrawer.h deleted file mode 100644 index 1f0ef76..0000000 --- a/television/tools/llvm-tv/CFGGraphDrawer.h +++ /dev/null
@@ -1,27 +0,0 @@ -//===-- CFGGraphDrawer.h - Creates an image representing a CFG ---*- C++ -*-==// -// -// Class for drawing CFG of a Function -// -//===----------------------------------------------------------------------===// - -#ifndef CFGGRAPHDRAWER_H -#define CFGGRAPHDRAWER_H - -#include "GraphDrawer.h" - -namespace llvm { - class Function; -} - -//===----------------------------------------------------------------------===// - -// CFGGraphDrawer interface - -class CFGGraphDrawer : public GraphDrawer { - public: - wxImage *drawFunctionGraph (llvm::Function *fn); - CFGGraphDrawer (wxWindow *parent) : GraphDrawer (parent) { } - std::string getDisplayTitle (TVTreeItemData *item); -}; - -#endif // CFGGRAPHDRAWER_H
diff --git a/television/tools/llvm-tv/CallGraphDrawer.cpp b/television/tools/llvm-tv/CallGraphDrawer.cpp deleted file mode 100644 index 3ebb65d..0000000 --- a/television/tools/llvm-tv/CallGraphDrawer.cpp +++ /dev/null
@@ -1,23 +0,0 @@ -#include "CallGraphDrawer.h" -#include "GraphPrinters.h" -#include "llvm/PassManager.h" -#include "TVTreeItem.h" -using namespace llvm; - -//===----------------------------------------------------------------------===// - -// CallGraphDrawer implementation - -wxImage *CallGraphDrawer::drawModuleGraph (Module *module) { - PassManager PM; - PM.add (createCallGraphPrinterPass ()); - PM.run (*module); - return buildwxImageFromDotFile ("callgraph.dot"); -} - -std::string CallGraphDrawer::getDisplayTitle (TVTreeItemData *item) { - std::string title ("Call graph"); - if (item) title += " of " + item->getTitle (); - return title; -} -
diff --git a/television/tools/llvm-tv/CallGraphDrawer.h b/television/tools/llvm-tv/CallGraphDrawer.h deleted file mode 100644 index 089e57e..0000000 --- a/television/tools/llvm-tv/CallGraphDrawer.h +++ /dev/null
@@ -1,21 +0,0 @@ -#ifndef CALLGRAPHDRAWER_H -#define CALLGRAPHDRAWER_H - -#include "GraphDrawer.h" - -namespace llvm { - class Module; -}; - -//===----------------------------------------------------------------------===// - -// CallGraphDrawer interface - -class CallGraphDrawer : public GraphDrawer { -public: - wxImage *drawModuleGraph (llvm::Module *M); - CallGraphDrawer (wxWindow *parent) : GraphDrawer (parent) { } - std::string getDisplayTitle (TVTreeItemData *item); -}; - -#endif // CALLGRAPHDRAWER_H
diff --git a/television/tools/llvm-tv/CodeViewer.cpp b/television/tools/llvm-tv/CodeViewer.cpp deleted file mode 100644 index 390482c..0000000 --- a/television/tools/llvm-tv/CodeViewer.cpp +++ /dev/null
@@ -1,158 +0,0 @@ -#include "CodeViewer.h" -#include "TVApplication.h" -#include "TVTreeItem.h" -#include "TVFrame.h" -#include "llvm/Function.h" -#include "llvm/Instruction.h" -#include "llvm/Value.h" -#include "llvm/ADT/StringExtras.h" -#include <wx/listctrl.h> -#include <map> -#include <sstream> -using namespace llvm; - -void TVCodeItem::SetLabel() { - std::string label; - if (!Val) - label = "<badref>"; - else if (BasicBlock *BB = dyn_cast<BasicBlock>(Val)) - label = BB->getName() + ":"; - else if (Instruction *I = dyn_cast<Instruction>(Val)) { - std::ostringstream out; - I->print(out); - label = out.str(); - // Post-processing for more attractive display - for (unsigned i = 0; i != label.length(); ++i) - if (label[i] == '\n') { // \n => space - label[i] = ' '; - } else if (label[i] == '\t') { // \t => 2 spaces - label[i] = ' '; - label.insert(label.begin()+i+1, ' '); - } else if (label[i] == ';') { // Delete comments! - unsigned Idx = label.find('\n', i+1); // Find end of line - label.erase(label.begin()+i, label.begin()+Idx); - --i; - } - - } else - label = "<invalid value>"; - - SetText(label.c_str()); -} - -//===----------------------------------------------------------------------===// - -void TVCodeListCtrl::refreshView() { - // Hide the list while rewriting it from scratch to speed up rendering - Hide(); - - // Clear out the list and then re-add all the items. - long index = 0; - ClearAll(); - for (Items::iterator i = itemList.begin(), e = itemList.end(); i != e; ++i) { - InsertItem(index, (**i).m_text.c_str()); - ItemToIndex[*i] = index; - ++index; - } - - Show(); -} - -template<class T> void wipe (T x) { delete x; } - -void TVCodeListCtrl::SetFunction (Function *F) { - // Empty out the code list. - if (!itemList.empty ()) - for_each (itemList.begin (), itemList.end (), wipe<TVCodeItem *>); - itemList.clear (); - ValueToItem.clear (); - - // Populate it with BasicBlocks and Instructions from F. - for (Function::iterator BB = F->begin(), BBe = F->end(); BB != BBe; ++BB) { - TVCodeItem *TCBB = new TVCodeItem(BB); - itemList.push_back(TCBB); - ValueToItem[BB] = TCBB; - for (BasicBlock::iterator I = BB->begin(), Ie = BB->end(); I != Ie; ++I) { - TVCodeItem *TCI = new TVCodeItem(I); - itemList.push_back(TCI); - ValueToItem[I] = TCI; - } - } - - // Since the function changed, we had better make sure that the list control - // matches what's in the code list. - refreshView (); -} - -TVCodeListCtrl::TVCodeListCtrl(wxWindow *_parent, llvm::Function *F) - : wxListCtrl(_parent, LLVM_TV_CODEVIEW_LIST, wxDefaultPosition, wxDefaultSize, - wxLC_LIST) { - SetFunction (F); -} - -TVCodeListCtrl::TVCodeListCtrl(wxWindow *_parent) - : wxListCtrl(_parent, LLVM_TV_CODEVIEW_LIST, wxDefaultPosition, wxDefaultSize, - wxLC_LIST) { -} - -void TVCodeListCtrl::changeItemTextAttrs (TVCodeItem *item, wxColour *newColor, - int newFontWeight) { - item->m_itemId = ItemToIndex[item]; - item->SetTextColour(*newColor); - wxFont Font = item->GetFont(); - Font.SetWeight(newFontWeight); - item->SetFont(Font); - SetItem(*item); -} - -void TVCodeListCtrl::OnItemSelected(wxListEvent &event) { - Value *V = itemList[event.GetIndex ()]->getValue(); - if (!V) return; - - // Highlight uses in red - for (User::use_iterator u = V->use_begin(), e = V->use_end(); u != e; ++u) - changeItemTextAttrs (ValueToItem[*u], wxRED, wxBOLD); - - // Highlight definitions of operands in green - if (User *U = dyn_cast<User>(V)) - for (User::op_iterator op = U->op_begin(), e = U->op_end(); op != e; ++op) - if (TVCodeItem *TCI = ValueToItem[*op]) - changeItemTextAttrs (TCI, wxGREEN, wxBOLD); -} - -void TVCodeListCtrl::OnItemDeselected(wxListEvent &event) { - Value *V = itemList[event.GetIndex ()]->getValue(); - if (!V) return; - - // Set uses back to normal - for (User::use_iterator u = V->use_begin(), e = V->use_end(); u != e; ++u) - changeItemTextAttrs (ValueToItem[*u], wxBLACK, wxNORMAL); - - // Set definitions of operands back to normal - if (User *U = dyn_cast<User>(V)) - for (User::op_iterator op = U->op_begin(), e = U->op_end(); op != e; ++op) - if (TVCodeItem *TCI = ValueToItem[*op]) - changeItemTextAttrs (ValueToItem[*op], wxBLACK, wxNORMAL); - -} - -BEGIN_EVENT_TABLE (TVCodeListCtrl, wxListCtrl) - EVT_LIST_ITEM_SELECTED(LLVM_TV_CODEVIEW_LIST, - TVCodeListCtrl::OnItemSelected) - EVT_LIST_ITEM_DESELECTED(LLVM_TV_CODEVIEW_LIST, - TVCodeListCtrl::OnItemDeselected) -END_EVENT_TABLE () - -//===----------------------------------------------------------------------===// - -void TVCodeViewer::displayItem (TVTreeItemData *item) { - item->viewCodeOn (this); -} - -void TVCodeViewer::viewFunctionCode (Function *F) { - myListCtrl->SetFunction (F); -} - -void TVCodeViewer::viewModuleCode (Module *F) { - myListCtrl->ClearAll(); -}
diff --git a/television/tools/llvm-tv/CodeViewer.h b/television/tools/llvm-tv/CodeViewer.h deleted file mode 100644 index 240dcba..0000000 --- a/television/tools/llvm-tv/CodeViewer.h +++ /dev/null
@@ -1,74 +0,0 @@ -//===-- CodeViewer.h - Interactive instruction stream viewer ----*- C++ -*-===// -// -// The interactive code explorer for llvm-tv. -// -//===----------------------------------------------------------------------===// - -#ifndef CODEVIEWER_H -#define CODEVIEWER_H - -#include <wx/wx.h> -#include <wx/listctrl.h> -#include <map> -#include <string> -#include <vector> -#include "ItemDisplayer.h" - -class TVApplication; - -namespace llvm { - class Module; - class Function; - class Value; -} - -/// TVCodeItem - contains an instruction, basic block, or function (which prints -/// out as the header) -/// -class TVCodeItem : public wxListItem { - private: - llvm::Value *Val; - std::string label; - - void SetLabel(); - public: - TVCodeItem(llvm::Value *V) : Val(V) { SetLabel(); } - llvm::Value* getValue() { return Val; } -}; - -class TVCodeListCtrl : public wxListCtrl { - typedef std::vector<TVCodeItem*> Items; - Items itemList; - std::map<llvm::Value*, TVCodeItem*> ValueToItem; - std::map<TVCodeItem*, long> ItemToIndex; - - void refreshView(); - void changeItemTextAttrs (TVCodeItem *item, wxColour *newColor, int newWgt); - - public: - void SetFunction (llvm::Function *F); - TVCodeListCtrl(wxWindow *_parent); - TVCodeListCtrl(wxWindow *_parent, llvm::Function *F); - void OnItemSelected(wxListEvent &event); - void OnItemDeselected(wxListEvent &event); - - DECLARE_EVENT_TABLE () -}; - -/// TVCodeViewer -/// -class TVCodeViewer : public ItemDisplayer { - TVCodeListCtrl *myListCtrl; -public: - TVCodeViewer (wxWindow *_parent) { - myListCtrl = new TVCodeListCtrl (_parent); - } - virtual ~TVCodeViewer () { delete myListCtrl; } - void displayItem (TVTreeItemData *data); - void viewFunctionCode (llvm::Function *F); - void viewModuleCode (llvm::Module *M); - std::string getDisplayTitle (TVTreeItemData *data) { return "Code view"; } - wxWindow *getWindow () { return myListCtrl; } -}; - -#endif
diff --git a/television/tools/llvm-tv/DSAGraphDrawer.cpp b/television/tools/llvm-tv/DSAGraphDrawer.cpp deleted file mode 100644 index 10d34de..0000000 --- a/television/tools/llvm-tv/DSAGraphDrawer.cpp +++ /dev/null
@@ -1,113 +0,0 @@ -//===-- DSGraphDrawer.cpp - DSGraph viewing ----------------------*- C++ -*-==// -// -// Classes for viewing DataStructure analysis graphs -// -//===----------------------------------------------------------------------===// - -#include "DSAGraphDrawer.h" -#include "TVTreeItem.h" -#include "GraphPrinters.h" -#include "llvm/Function.h" -#include "llvm/Module.h" -#include "llvm/Pass.h" -#include "llvm/PassManager.h" -#include "llvm/Target/TargetData.h" -using namespace llvm; - -//===----------------------------------------------------------------------===// - -// DSGraphDrawer implementation -wxImage *DSGraphDrawer::drawModuleGraph(Module *M) { - PassManager PM; - PM.add(new TargetData("llvm-tv", M)); - PM.add(getModulePass()); - PM.run(*M); - return buildwxImageFromDotFile(getFilename(M)); -} - -wxImage *DSGraphDrawer::drawFunctionGraph(Function *F) { - Module *M = F->getParent(); - PassManager PM; - PM.add(new TargetData("llvm-tv", M)); - PM.add(getFunctionPass(F)); - PM.run(*M); - return buildwxImageFromDotFile(getFilename(F)); -} - -//===----------------------------------------------------------------------===// - -// BUGraphDrawer implementation -Pass *BUGraphDrawer::getFunctionPass(Function *F) { - return createBUDSFunctionPrinterPass(F); -} - -Pass *BUGraphDrawer::getModulePass() { - return createBUDSModulePrinterPass(); -} - -std::string BUGraphDrawer::getFilename(Function *F) { - return "buds." + F->getName() + ".dot"; -} - -std::string BUGraphDrawer::getFilename(Module *M) { - return "buds.dot"; -} - -std::string BUGraphDrawer::getDisplayTitle (TVTreeItemData *item) { - if (item) - return "Bottom-up data structure " + item->dsGraphName (); - else - return "Bottom-up DSGraph"; -} - -//===----------------------------------------------------------------------===// - -// TDGraphDrawer implementation -Pass *TDGraphDrawer::getFunctionPass(Function *F) { - return createTDDSFunctionPrinterPass(F); -} - -Pass *TDGraphDrawer::getModulePass() { - return createTDDSModulePrinterPass(); -} - -std::string TDGraphDrawer::getFilename(Function *F) { - return "tdds." + F->getName() + ".dot"; -} - -std::string TDGraphDrawer::getFilename(Module *M) { - return "tdds.dot"; -} - -std::string TDGraphDrawer::getDisplayTitle (TVTreeItemData *item) { - if (item) - return "Top-down data structure " + item->dsGraphName (); - else - return "Top-down DSGraph"; -} - -//===----------------------------------------------------------------------===// - -// LocalGraphDrawer implementation -Pass *LocalGraphDrawer::getFunctionPass(Function *F) { - return createLocalDSFunctionPrinterPass(F); -} - -Pass *LocalGraphDrawer::getModulePass() { - return createLocalDSModulePrinterPass(); -} - -std::string LocalGraphDrawer::getFilename(Function *F) { - return "localds." + F->getName() + ".dot"; -} - -std::string LocalGraphDrawer::getFilename(Module *M) { - return "localds.dot"; -} - -std::string LocalGraphDrawer::getDisplayTitle (TVTreeItemData *item) { - if (item) - return "Local data structure " + item->dsGraphName (); - else - return "Local DSGraph"; -}
diff --git a/television/tools/llvm-tv/DSAGraphDrawer.h b/television/tools/llvm-tv/DSAGraphDrawer.h deleted file mode 100644 index 5d5f0cb..0000000 --- a/television/tools/llvm-tv/DSAGraphDrawer.h +++ /dev/null
@@ -1,80 +0,0 @@ -//===-- DSGraphDrawer.h - DSGraph viewing ------------------------*- C++ -*-==// -// -// Classes for viewing DataStructure analysis graphs -// -//===----------------------------------------------------------------------===// - -#ifndef DSAGRAPHDRAWER_H -#define DSAGRAPHDRAWER_H - -#include "GraphDrawer.h" -#include <wx/wx.h> -#include <string> - -namespace llvm { - class Function; - class Module; - class Pass; -} - -//===----------------------------------------------------------------------===// - -// DSGraphDrawer abstract class -// -class DSGraphDrawer : public GraphDrawer { -protected: - llvm::Function *F; - llvm::Module *M; - DSGraphDrawer (wxWindow *parent) : GraphDrawer (parent) { } - virtual llvm::Pass *getFunctionPass(llvm::Function *F) = 0; - virtual llvm::Pass *getModulePass() = 0; - virtual std::string getFilename(llvm::Function *F) = 0; - virtual std::string getFilename(llvm::Module *M) = 0; -public: - wxImage *drawFunctionGraph(llvm::Function *F); - wxImage *drawModuleGraph(llvm::Module *M); -}; - -//===----------------------------------------------------------------------===// - -// BUGraphDrawer -// -class BUGraphDrawer : public DSGraphDrawer { - llvm::Pass *getFunctionPass(llvm::Function *F); - llvm::Pass *getModulePass(); - std::string getFilename(llvm::Function *F); - std::string getFilename(llvm::Module *M); -public: - BUGraphDrawer (wxWindow *parent) : DSGraphDrawer (parent) { } - std::string getDisplayTitle (TVTreeItemData *item); -}; - -//===----------------------------------------------------------------------===// - -// TDGraphDrawer -// -class TDGraphDrawer : public DSGraphDrawer { - llvm::Pass *getFunctionPass(llvm::Function *F); - llvm::Pass *getModulePass(); - std::string getFilename(llvm::Function *F); - std::string getFilename(llvm::Module *M); -public: - TDGraphDrawer (wxWindow *parent) : DSGraphDrawer (parent) { } - std::string getDisplayTitle (TVTreeItemData *item); -}; - -//===----------------------------------------------------------------------===// - -// LocalGraphDrawer -// -class LocalGraphDrawer : public DSGraphDrawer { - llvm::Pass *getFunctionPass(llvm::Function *F); - llvm::Pass *getModulePass(); - std::string getFilename(llvm::Function *F); - std::string getFilename(llvm::Module *M); -public: - LocalGraphDrawer (wxWindow *parent) : DSGraphDrawer (parent) { } - std::string getDisplayTitle (TVTreeItemData *item); -}; - -#endif // DSAGRAPHDRAWER_H
diff --git a/television/tools/llvm-tv/GraphDrawer.cpp b/television/tools/llvm-tv/GraphDrawer.cpp deleted file mode 100644 index 86e2b22..0000000 --- a/television/tools/llvm-tv/GraphDrawer.cpp +++ /dev/null
@@ -1,49 +0,0 @@ -#include "wx/image.h" -#include "GraphDrawer.h" -#include "TVTreeItem.h" -#include "llvm/Support/FileUtilities.h" -#include <unistd.h> -#include <iostream> -using namespace llvm; - -//===----------------------------------------------------------------------===// - -// GraphDrawer shared implementation - -extern void FatalErrorBox (const std::string msg); - -wxImage *GraphDrawer::buildwxImageFromDotFile (const std::string filename) { - sys::Path File (filename); - if (! File.readable ()) - FatalErrorBox ("buildwxImageFromDotFile() got passed a bogus filename: '" - + filename + "'"); - - // We have a dot file, turn it into something we can load. - std::string cmd = "dot -Tpng " + filename + " -o image.png"; - if (system (cmd.c_str ()) != 0) - FatalErrorBox ("buildwxImageFromDotFile() failed when calling dot"); - unlink (filename.c_str ()); - - wxImage *img = new wxImage; - if (!img->LoadFile ("image.png")) - FatalErrorBox("buildwxImageFromDotFile() produced a non-loadable PNG file"); - - unlink ("image.png"); - return img; -} - -void GraphDrawer::displayItem (TVTreeItemData *item) { - wxImage *graphImage = item->graphOn (this); - if (!graphImage) { - // If we're drawing into a window, don't leave behind an embarrassing - // empty window AND an error message. (But don't destroy the window, - // because TVApp will get around to destroying it later.) - if (wxFrame *frame = dynamic_cast<wxFrame *>(myPictureCanvas->GetParent ())) - frame->Show (false); - std::string errMsg = "Sorry, you can't draw that kind of graph on " - + item->getTitle() + "."; - wxMessageBox (errMsg.c_str (), "Error"); - return; - } - myPictureCanvas->SetImage (graphImage); -}
diff --git a/television/tools/llvm-tv/GraphDrawer.h b/television/tools/llvm-tv/GraphDrawer.h deleted file mode 100644 index ce83d343..0000000 --- a/television/tools/llvm-tv/GraphDrawer.h +++ /dev/null
@@ -1,45 +0,0 @@ -//===-- GraphDrawer.h - Graph viewing abstract class -------------*- C++ -*-==// -// -// Superclass for graph-drawing classes. -// -//===----------------------------------------------------------------------===// - -#ifndef GRAPHDRAWER_H -#define GRAPHDRAWER_H - -#include "ItemDisplayer.h" -#include "PictureCanvas.h" -#include "wx/wx.h" -#include <iostream> - -namespace llvm { - class Module; - class Function; -}; - -class TVTreeItemData; - -/// GraphDrawer abstract class -/// -class GraphDrawer : public ItemDisplayer { - PictureCanvas *myPictureCanvas; - -protected: - static wxImage *buildwxImageFromDotFile (const std::string filename); - GraphDrawer (wxWindow *parent) - : myPictureCanvas (new PictureCanvas (parent)) { } - -public: - virtual ~GraphDrawer () { delete myPictureCanvas; } - wxWindow *getWindow () { return myPictureCanvas; } - void displayItem (TVTreeItemData *item); - - /// drawModuleGraph, drawFunctionGraph - Subclasses should override - /// these methods to return images if they support visualizing the - /// corresponding kind of object. - /// - virtual wxImage *drawModuleGraph (llvm::Module *M) { return 0; } - virtual wxImage *drawFunctionGraph (llvm::Function *F) { return 0; } -}; - -#endif // GRAPHDRAWER_H
diff --git a/television/tools/llvm-tv/GraphPrinters.cpp b/television/tools/llvm-tv/GraphPrinters.cpp deleted file mode 100644 index c93a0ae..0000000 --- a/television/tools/llvm-tv/GraphPrinters.cpp +++ /dev/null
@@ -1,234 +0,0 @@ -//===- GraphPrinters.cpp - DOT printers for various graph types -----------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines several printers for various different types of graphs used -// by the LLVM infrastructure. It uses the generic graph interface to convert -// the graph into a .dot graph. These graphs can then be processed with the -// "dot" tool to convert them to postscript or some other suitable format. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Function.h" -#include "llvm/Pass.h" -#include "llvm/Value.h" -#include "llvm/Analysis/CallGraph.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Support/GraphWriter.h" -#include <fstream> -using namespace llvm; - -template<typename GraphType> -static void WriteGraphToFile(std::ostream &O, const std::string &GraphName, - const GraphType >) { - std::string Filename = GraphName + ".dot"; - O << "Writing '" << Filename << "'..."; - std::ofstream F(Filename.c_str()); - - if (F.good()) - WriteGraph(F, GT); - else - O << " error opening file for writing!"; - O << "\n"; -} - - -//===----------------------------------------------------------------------===// -// Call Graph Printer -//===----------------------------------------------------------------------===// - -namespace llvm { - template<> - struct DOTGraphTraits<CallGraph*> : public DefaultDOTGraphTraits { - static std::string getGraphName(CallGraph *F) { - return "Call Graph"; - } - - static std::string getNodeLabel(CallGraphNode *Node, CallGraph *Graph) { - if (Node->getFunction()) - return ((Value*)Node->getFunction())->getName(); - else - return "Indirect call node"; - } - }; -} - -namespace { - struct CallGraphPrinter : public ModulePass { - virtual bool runOnModule(Module &M) { - WriteGraphToFile(std::cerr, "callgraph", &getAnalysis<CallGraph>()); - return false; - } - - void print(std::ostream &OS) const {} - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequired<CallGraph>(); - AU.setPreservesAll(); - } - }; - - RegisterAnalysis<CallGraphPrinter> P2("print-callgraph", - "Print Call Graph to 'dot' file"); -} - -//===----------------------------------------------------------------------===// -// Generic DataStructures Graph Printer -//===----------------------------------------------------------------------===// - -namespace { - - template<class DSType> - class DSModulePrinter : public ModulePass { - protected: - virtual std::string getFilename() = 0; - - public: - bool runOnModule(Module &M) { - DSType *DS = &getAnalysis<DSType>(); - std::string File = getFilename(); - std::ofstream of(File.c_str()); - if (of.good()) { - DS->getGlobalsGraph().print(of); - of.close(); - } else - std::cerr << "Error writing to " << File << "!\n"; - return false; - } - - void print(std::ostream &os) const {} - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.template addRequired<DSType>(); - AU.setPreservesAll(); - } - }; - - template<class DSType> - class DSFunctionPrinter : public ModulePass { - protected: - Function *F; - virtual std::string getFilename(Function &F) = 0; - - public: - DSFunctionPrinter(Function *_F) : F(_F) {} - - bool runOnModule(Module &M) { - DSType *DS = &getAnalysis<DSType>(); - std::string File = getFilename(*F); - std::ofstream of(File.c_str()); - if (of.good()) { - if (DS->hasGraph(*F)) { - DS->getDSGraph(*F).print(of); - of.close(); - } else - // Can be more creative and print the analysis name here - std::cerr << "No DSGraph for: " << F->getName() << "\n"; - } else - std::cerr << "Error writing to " << File << "!\n"; - return false; - } - - void print(std::ostream &os) const {} - - void getAnalysisUsage(AnalysisUsage &AU) const { - AU.template addRequired<DSType>(); - AU.setPreservesAll(); - } - }; -} - -//===----------------------------------------------------------------------===// -// BU DataStructures Graph Printer -//===----------------------------------------------------------------------===// - -namespace { - struct BUModulePrinter : public DSModulePrinter<BUDataStructures> { - std::string getFilename() { return "buds.dot"; } - }; - struct BUFunctionPrinter : public DSFunctionPrinter<BUDataStructures> { - BUFunctionPrinter(Function *F) : DSFunctionPrinter<BUDataStructures>(F) {} - std::string getFilename(Function &F) { - return "buds." + F.getName() + ".dot"; - } - }; -} - -//===----------------------------------------------------------------------===// -// TD DataStructures Graph Printer -//===----------------------------------------------------------------------===// - -namespace { - struct TDModulePrinter : public DSModulePrinter<TDDataStructures> { - std::string getFilename() { return "tdds.dot"; } - }; - struct TDFunctionPrinter : public DSFunctionPrinter<TDDataStructures> { - TDFunctionPrinter(Function *F) : DSFunctionPrinter<TDDataStructures>(F) {} - std::string getFilename(Function &F) { - return "tdds." + F.getName() + ".dot"; - } - }; -} - -//===----------------------------------------------------------------------===// -// Local DataStructures Graph Printer -//===----------------------------------------------------------------------===// - -namespace { - struct LocalModulePrinter : public DSModulePrinter<LocalDataStructures> { - std::string getFilename() { return "localds.dot"; } - }; - struct LocalFunctionPrinter : public DSFunctionPrinter<LocalDataStructures> { - LocalFunctionPrinter(Function *F) - : DSFunctionPrinter<LocalDataStructures>(F) {} - std::string getFilename(Function &F) { - return "localds." + F.getName() + ".dot"; - } - }; -} - -//===----------------------------------------------------------------------===// -// Pass Creation Methods -//===----------------------------------------------------------------------===// - -namespace llvm { - - Pass *createCallGraphPrinterPass () { return new CallGraphPrinter(); } - - // BU DataStructures - // - Pass *createBUDSModulePrinterPass () { - return new BUModulePrinter(); - } - - Pass *createBUDSFunctionPrinterPass (Function *F) { - return new BUFunctionPrinter(F); - } - - // TD DataStructures - // - Pass *createTDDSModulePrinterPass () { - return new TDModulePrinter(); - } - - Pass *createTDDSFunctionPrinterPass (Function *F) { - return new TDFunctionPrinter(F); - } - - // Local DataStructures - // - Pass *createLocalDSModulePrinterPass () { - return new LocalModulePrinter(); - } - - Pass *createLocalDSFunctionPrinterPass (Function *F) { - return new LocalFunctionPrinter(F); - } - -} // end namespace llvm
diff --git a/television/tools/llvm-tv/GraphPrinters.h b/television/tools/llvm-tv/GraphPrinters.h deleted file mode 100644 index a1d0fdf..0000000 --- a/television/tools/llvm-tv/GraphPrinters.h +++ /dev/null
@@ -1,40 +0,0 @@ -//===- GraphPrinters.h - DOT printers for various graph types ---*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines several printers for various different types of graphs used -// by the LLVM infrastructure. It uses the generic graph interface to convert -// the graph into a .dot graph. These graphs can then be processed with the -// "dot" tool to convert them to postscript or some other suitable format. -// -//===----------------------------------------------------------------------===// - -#ifndef GRAPHPRINTERS_H -#define GRAPHPRINTERS_H - -#include <iosfwd> -#include "llvm/Pass.h" -using namespace llvm; - -namespace llvm { - -Pass *createCallGraphPrinterPass (); - -Pass *createBUDSModulePrinterPass (); -Pass *createBUDSFunctionPrinterPass (Function *F); - -Pass *createTDDSModulePrinterPass (); -Pass *createTDDSFunctionPrinterPass (Function *F); - -Pass *createLocalDSModulePrinterPass (); -Pass *createLocalDSFunctionPrinterPass (Function *F); - - -} // end namespace llvm - -#endif // GRAPHPRINTERS_H
diff --git a/television/tools/llvm-tv/ItemDisplayer.h b/television/tools/llvm-tv/ItemDisplayer.h deleted file mode 100644 index f8b8903..0000000 --- a/television/tools/llvm-tv/ItemDisplayer.h +++ /dev/null
@@ -1,30 +0,0 @@ -//===-- ItemDisplayer.h - Interface for tabbed-view components --*- C++ -*-===// -// -// The interface for tabbed views. -// -//===----------------------------------------------------------------------===// - -#ifndef ITEMDISPLAYER_H -#define ITEMDISPLAYER_H - -#include <string> - -class TVTreeItemData; -class wxWindow; - -class ItemDisplayer { - public: - virtual void displayItem (TVTreeItemData *item) = 0; - - /// getWindow - ItemDisplayers are responsible for explicitly keeping track of - /// whatever "window" they are displaying the item into. - /// - virtual wxWindow *getWindow () = 0; - - /// getDisplayTitle - Return a title appropriate for when this - /// ItemDisplayer displays the given item, or if item is NULL, any item. - /// - virtual std::string getDisplayTitle (TVTreeItemData *item) = 0; -}; - -#endif // ITEMDISPLAYER_H
diff --git a/television/tools/llvm-tv/MakeMacOSBundle b/television/tools/llvm-tv/MakeMacOSBundle deleted file mode 100755 index 7de0dbd..0000000 --- a/television/tools/llvm-tv/MakeMacOSBundle +++ /dev/null
@@ -1,29 +0,0 @@ -#!/bin/sh -# make a MacOS bundle llvm-tv.app used to encapsulate llvm-tv -# brg Tue Apr 27 15:10:22 CDT 2004 -# -APP="$1" -WX="$2" -BINARY="$3" -make_dir () { - dir=$1 - if [ ! -d $dir ] - then - mkdir $dir - fi -} -make_dir ${APP}.app -CONTENTS=${APP}.app/Contents -make_dir $CONTENTS -make_dir ${CONTENTS}/MacOS -make_dir ${CONTENTS}/Resources -# don't know what we need this for... -#/Developer/Tools/Rez -t APPL Carbon.r $WX/lib/libwx_macd-2.4.0.r -o $APP -cp $BINARY ${CONTENTS}/MacOS/${APP} -sed -e "s/IDENTIFIER/llvm-tv/" \ - -e "s/EXECUTABLE/$APP/" \ - -e "s/VERSION/1.0/" $WX/src/mac/Info.plist.in > ${CONTENTS}/Info.plist -echo -n "APPL????" > ${CONTENTS}/PkgInfo -cp $WX/lib/libwx_macd-2.4.0.rsrc ${CONTENTS}/Resources/${APP}.rsrc -cp $WX/src/mac/wxmac.icns ${CONTENTS}/Resources/wxmac.icns -exit 0
diff --git a/television/tools/llvm-tv/Makefile b/television/tools/llvm-tv/Makefile deleted file mode 100644 index eaec9aa..0000000 --- a/television/tools/llvm-tv/Makefile +++ /dev/null
@@ -1,41 +0,0 @@ -LEVEL = ../.. -TOOLNAME = llvm-tv -LLVMLIBS = LLVMAnalysis.a LLVMBCReader LLVMBCWriter LLVMDataStructure \ - LLVMipa.a LLVMSupport.a LLVMTarget.a LLVMCore LLVMTransformUtils.a \ - LLVMSystem.a LLVMbzip2 - -# note: delete when FileUtils is assimilated into libsupport -USEDLIBS = LLVMTVSnapshot - -CPPFLAGS = $(shell wx-config --cflags) -TOOLLINKOPTSB = $(shell wx-config --libs) -WXDIR = $(shell wx-config --prefix) -WXLIB = $(WXDIR)/lib - -include $(LEVEL)/Makefile.common - -all :: $(LLVMToolDir)/llvm-tv.exe \ - $(LLVMToolDir)/opt-snap - -LLVMTV = $(PROJ_OBJ_ROOT)/Debug/bin/llvm-tv - -$(LLVMToolDir)/llvm-tv.exe: Makefile - echo exec env LD_LIBRARY_PATH=$(WXLIB):\$$LD_LIBRARY_PATH $(LLVMTV) \ - "2&>1 > /dev/null" > $@ - chmod u+x $@ - -$(LLVMToolDir)/opt-snap: Makefile - echo exec env LD_LIBRARY_PATH=$(WXLIB):\$$LD_LIBRARY_PATH \ - OPTPASSES=\"$$\*\" opt -load=$(LibDir)/libLLVMTVSnapshot.so $$\* > $@ - chmod u+x $@ - -ifeq ($(OS),Darwin) -all :: mac-app -clean :: clean-mac-app -endif - -mac-app: - @./MakeMacOSBundle llvm-tv "$(WXDIR)" "$(LLVMToolDir)/llvm-tv" - -clean-mac-app: - rm -rf llvm-tv.app
diff --git a/television/tools/llvm-tv/PictureCanvas.cpp b/television/tools/llvm-tv/PictureCanvas.cpp deleted file mode 100644 index 7124bfd..0000000 --- a/television/tools/llvm-tv/PictureCanvas.cpp +++ /dev/null
@@ -1,30 +0,0 @@ -#include "wx/image.h" -#include "PictureCanvas.h" - -//===----------------------------------------------------------------------===// - -// PictureCanvas implementation - -BEGIN_EVENT_TABLE (PictureCanvas, wxScrolledWindow) -END_EVENT_TABLE () - -void PictureCanvas::OnDraw (wxDC &aDC) { - if (!myBitmap) return; - aDC.DrawBitmap (*myBitmap, 0, 0, false); -} - -void PictureCanvas::imageChanged () { - if (myBitmap) - delete myBitmap; // Don't leak memory. - - if (!myImage) - return; // Maybe there isn't a new image. - - myBitmap = new wxBitmap (*myImage); - SetVirtualSize (myImage->GetWidth (), myImage->GetHeight ()); - SetScrollRate (1, 1); - if (wxFrame *frame = dynamic_cast<wxFrame *> (GetParent ())) { - frame->SetSizeHints (-1, -1, myImage->GetWidth (), myImage->GetHeight ()); - frame->Refresh (); - } -}
diff --git a/television/tools/llvm-tv/PictureCanvas.h b/television/tools/llvm-tv/PictureCanvas.h deleted file mode 100644 index 0985e5a..0000000 --- a/television/tools/llvm-tv/PictureCanvas.h +++ /dev/null
@@ -1,44 +0,0 @@ -//===-- PictureCanvas.h - Host of graph images -------------------*- C++ -*-==// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Visual pane for viewing analysis graphs -// -//===----------------------------------------------------------------------===// - -#ifndef PICTURECANVAS_H -#define PICTURECANVAS_H - -#include "wx/wx.h" -#include <iostream> -#include <functional> - -//===----------------------------------------------------------------------===// - -// PictureCanvas interface - -class PictureCanvas : public wxScrolledWindow { - wxImage *myImage; - wxBitmap *myBitmap; - - void imageChanged (); - public: - PictureCanvas () - : wxScrolledWindow (0), myImage (0), myBitmap (0) { - } - PictureCanvas (wxWindow *parent, wxImage *image = 0) - : wxScrolledWindow (parent), myImage (image), myBitmap (0) { - imageChanged (); - } - void SetImage (wxImage *img) { myImage = img; imageChanged (); } - void OnDraw (wxDC &aDC); - - DECLARE_EVENT_TABLE () -}; - -#endif // PICTURECANVAS_H
diff --git a/television/tools/llvm-tv/PictureFrame.cpp b/television/tools/llvm-tv/PictureFrame.cpp deleted file mode 100644 index 9b4dd51..0000000 --- a/television/tools/llvm-tv/PictureFrame.cpp +++ /dev/null
@@ -1,14 +0,0 @@ -#include "PictureFrame.h" -#include "TVApplication.h" - -// PictureFrame implementation - -bool PictureFrame::OnClose (wxCloseEvent &event) { - myApp->GoodbyeFrom (this); - Destroy (); - return true; -} - -BEGIN_EVENT_TABLE (PictureFrame, wxFrame) - EVT_CLOSE (PictureFrame::OnClose) -END_EVENT_TABLE ()
diff --git a/television/tools/llvm-tv/PictureFrame.h b/television/tools/llvm-tv/PictureFrame.h deleted file mode 100644 index 7ae2aa6..0000000 --- a/television/tools/llvm-tv/PictureFrame.h +++ /dev/null
@@ -1,39 +0,0 @@ -//===-- PictureFrame.h - Window containing PictureCanvas ---------*- C++ -*-==// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Window container for PictureCanvas objects. -// -//===----------------------------------------------------------------------===// - -#ifndef PICTUREFRAME_H -#define PICTUREFRAME_H - -#include "PictureCanvas.h" -#include "wx/wx.h" - -class TVApplication; - -/// PictureFrame - just a window that contains a PictureCanvas. -/// -class PictureFrame : public wxFrame { - TVApplication *myApp; - void setupAppearance () { - SetSize (wxRect (200, 200, 300, 300)); - Show (TRUE); - } - public: - PictureFrame (TVApplication *app, const char *windowTitle = "") - : wxFrame (NULL, -1, windowTitle), myApp (app) { - setupAppearance (); - } - bool OnClose (wxCloseEvent &event); - DECLARE_EVENT_TABLE () -}; - -#endif // PICTUREFRAME_H
diff --git a/television/tools/llvm-tv/TVApplication.cpp b/television/tools/llvm-tv/TVApplication.cpp deleted file mode 100644 index 3193b7b..0000000 --- a/television/tools/llvm-tv/TVApplication.cpp +++ /dev/null
@@ -1,131 +0,0 @@ -//===-- TVApplication.cpp - Main application class for llvm-tv ------------===// -// -// The gui for llvm-tv. -// -//===----------------------------------------------------------------------===// - -#include "CodeViewer.h" -#include "TVApplication.h" -#include "TVFrame.h" -#include "llvm-tv/Support/FileUtils.h" -#include "llvm-tv/Config.h" -#include <wx/image.h> -#include <cerrno> -#include <iostream> -#include <fstream> -#include <functional> -#include <signal.h> -#include <unistd.h> -#include <sys/stat.h> -#include <sys/types.h> - -///==---------------------------------------------------------------------==/// - -static TVApplication *TheApp; - -void sigHandler(int sigNum) { - TheApp->ReceivedSignal(); -} - -void TVApplication::ReceivedSignal () { - // Whenever we catch our prearranged signal, refresh the snapshot list. - myFrame->refreshSnapshotList(); -} - -/// FatalErrorBox - pop up an error message and quit. -/// -void FatalErrorBox (const std::string msg) { - wxMessageBox(msg.c_str (), "Fatal Error", wxOK | wxICON_ERROR); - exit (1); -} - -static void setUpMenus (wxFrame *frame) { - wxMenuBar *menuBar = new wxMenuBar (); - - wxMenu *fileMenu = new wxMenu ("", 0); - fileMenu->Append (wxID_OPEN, "Add module..."); - fileMenu->Append (LLVM_TV_REFRESH, "Refresh list"); - fileMenu->Append (wxID_EXIT, "Quit"); - menuBar->Append (fileMenu, "File"); - - wxMenu *viewMenu = new wxMenu ("", 0); - viewMenu->Append (LLVM_TV_CALLGRAPHVIEW, "View call graph"); - viewMenu->Append (LLVM_TV_CFGVIEW, "View control-flow graph"); - viewMenu->Append (LLVM_TV_BUDS_VIEW, "View BU datastructure graph"); - viewMenu->Append (LLVM_TV_TDDS_VIEW, "View TD datastructure graph"); - viewMenu->Append (LLVM_TV_LOCALDS_VIEW, "View Local datastructure graph"); - viewMenu->Append (LLVM_TV_CODEVIEW, "View code (interactive)"); - menuBar->Append (viewMenu, "View"); - - wxMenu *helpMenu = new wxMenu ("", 0); - helpMenu->Append (wxID_HELP_CONTENTS, "Help with LLVM-TV"); - helpMenu->Append (wxID_ABOUT, "About LLVM-TV"); - menuBar->Append (helpMenu, "Help"); - - frame->SetMenuBar (menuBar); -} - -IMPLEMENT_APP (TVApplication) - -/// saveMyPID - Save my process ID into a temporary file. -static void saveMyPID () { - EnsureDirectoryExists (llvmtvPath); - - std::ofstream pidFile (llvmtvPID.c_str ()); - if (pidFile.good () && pidFile.is_open ()) { - pidFile << getpid (); - pidFile.close (); - } else { - std::cerr << "Warning: could not save PID into " << llvmtvPID << "\n"; - } -} - -// eraseMyPID - Erase the PID file created by saveMyPID. -static void eraseMyPID () { - unlink (llvmtvPID.c_str ()); -} - -void TVApplication::GoodbyeFrom (wxWindow *dyingWindow) { - std::vector<wxWindow *>::iterator where = - find (allMyWindows.begin(), allMyWindows.end(), dyingWindow); - if (where != allMyWindows.end ()) - allMyWindows.erase (where); -} - -void TVApplication::Quit () { - // Destroy all the picture windows, then the toplevel window. - for_each (allMyWindows.begin (), allMyWindows.end (), - std::mem_fun (&wxWindow::Destroy)); - myFrame->Destroy (); -} - -bool TVApplication::OnInit () { - // Save my PID into the file where the snapshot-making pass knows to - // look for it. - saveMyPID (); - atexit (eraseMyPID); - - wxInitAllImageHandlers (); - - // Build top-level window. - myFrame = new TVFrame (this, "LLVM Visualizer"); - SetTopWindow (myFrame); - - // Build top-level window's menu bar. - setUpMenus (myFrame); - - // Read the snapshot list out of the given directory, - // and load the snapshot list view into the frame. - EnsureDirectoryExists (snapshotsPath); - - snapshotList = new TVSnapshotList(snapshotsPath); - - myFrame->initializeSnapshotListAndView(); - - // Set up signal handler so that we can get notified when - // the -snapshot pass hands us new snapshot bytecode files. - TheApp = this; - signal(SIGUSR1, sigHandler); - - return true; -}
diff --git a/television/tools/llvm-tv/TVApplication.h b/television/tools/llvm-tv/TVApplication.h deleted file mode 100644 index 06624fe..0000000 --- a/television/tools/llvm-tv/TVApplication.h +++ /dev/null
@@ -1,52 +0,0 @@ -//===-- TVApplication.h - Main application class for llvm-tv -----*- C++ -*--=// -// -// The gui for llvm-tv. -// -//===----------------------------------------------------------------------===// - -#ifndef TVAPPLICATION_H -#define TVAPPLICATION_H - -#include "TVSnapshotList.h" -#include "wx/wx.h" -#include <string> -#include <vector> - -///==---------------------------------------------------------------------==/// - -namespace llvm { - class Function; - class Module; -} - -class TVFrame; -class TVTreeItemData; -class ItemDisplayer; - - -/// FatalErrorBox - pop up an error message and quit. -/// -void FatalErrorBox (const std::string msg); - -/// TVApplication - This class shows a window containing a status bar and a menu -/// bar, and a list of files from a directory, that can be refreshed -/// using a menu item. -/// -class TVApplication : public wxApp { - TVFrame *myFrame; - std::vector<wxWindow *> allMyWindows; - std::vector<ItemDisplayer *> allMyDisplayers; - TVSnapshotList *snapshotList; - -public: - bool OnInit (); - void GoodbyeFrom (wxWindow *dyingWindow); - void ReceivedSignal (); - template <class Grapher> void OpenGraphView(TVTreeItemData *item); - void Quit (); - TVSnapshotList* getSnapshotList() { return snapshotList; } -}; - -DECLARE_APP (TVApplication) - -#endif // TVAPPLICATION_H
diff --git a/television/tools/llvm-tv/TVFrame.cpp b/television/tools/llvm-tv/TVFrame.cpp deleted file mode 100644 index 0b68b2c..0000000 --- a/television/tools/llvm-tv/TVFrame.cpp +++ /dev/null
@@ -1,283 +0,0 @@ -//===-- TVFrame.cpp - Main window class for LLVM-TV -----------------------===// -// -// The gui for llvm-tv. -// -//===----------------------------------------------------------------------===// - -#include "CallGraphDrawer.h" -#include "CFGGraphDrawer.h" -#include "CodeViewer.h" -#include "DSAGraphDrawer.h" -#include "PictureFrame.h" -#include "TVApplication.h" -#include "TVFrame.h" -#include "TVTextCtrl.h" -#include "TVTreeItem.h" -#include "llvm-tv/Config.h" -#include <cassert> -#include <dirent.h> -#include <errno.h> -#include <sstream> - -/// TreeCtrl constructor - creates the root and adds it to the tree -/// -TVTreeCtrl::TVTreeCtrl(wxWindow *parent, TVFrame *frame, const wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style) - : wxTreeCtrl(parent, id, pos, size, style), myFrame (frame) { - wxTreeItemId rootId = AddRoot("Snapshots", -1, -1,TVTreeRootItem::instance()); -} - -/// AddSnapshotsToTree - Given a list of snapshots the tree is populated -/// -void TVTreeCtrl::AddSnapshotsToTree(TVSnapshotList *list) { - wxTreeItemId rootId = GetRootItem(); - for (TVSnapshotList::iterator I = list->begin(), E = list->end(); - I != E; ++I) { - // Get the Module associated with this snapshot and add it to the tree - Module *M = I->getModule(); - wxTreeItemId id = AppendItem(rootId, I->label(), -1, -1, - new TVTreeModuleItem(I->label(), M)); - - // Loop over functions in the module and add them to the tree as children - for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) { - Function *F = I; - if (!F->isExternal()) { - const char *FuncName = F->getName().c_str(); - AppendItem(id, FuncName, -1, -1, new TVTreeFunctionItem(FuncName, I)); - } - } - } -} - -/// updateSnapshotList - Update the tree with the current snapshot list -/// -void TVTreeCtrl::updateSnapshotList(TVSnapshotList *myList) { - DeleteChildren(GetRootItem()); - AddSnapshotsToTree(myList); -} - -/// GetSelectedItemData - Return the currently-selected visualizable -/// object (TVTreeItemData object). -/// -TVTreeItemData *TVTreeCtrl::GetSelectedItemData () { - return dynamic_cast<TVTreeItemData *> (GetItemData (GetSelection ())); -} - -/// OnSelChanged - Inform the parent frame that the selection has changed, -/// and pass the newly selected item to it. -/// -void TVTreeCtrl::OnSelChanged(wxTreeEvent &event) { - myFrame->updateDisplayedItem (GetSelectedItemData ()); -} - -BEGIN_EVENT_TABLE(TVTreeCtrl, wxTreeCtrl) - EVT_TREE_SEL_CHANGED(LLVM_TV_TREE_CTRL, TVTreeCtrl::OnSelChanged) -END_EVENT_TABLE () - -///==---------------------------------------------------------------------==/// - -void TVTextCtrl::displayItem (TVTreeItemData *item) { - std::ostringstream Out; - item->print (Out); - myTextCtrl->SetValue (""); - myTextCtrl->AppendText (Out.str ().c_str ()); - myTextCtrl->ShowPosition (0); - myTextCtrl->SetInsertionPoint (0); -} - -///==---------------------------------------------------------------------==/// - -/// updateDisplayedItem - Updates right-hand pane with a view of the item that -/// is now selected. -/// -void TVFrame::updateDisplayedItem (TVTreeItemData *newlySelectedItem) { - // Tell the current visualizer widget to display the selected - // LLVM object in its window, which is displayed inside the notebook. - assert (newlySelectedItem - && "newlySelectedItem was null in updateDisplayedItem()"); - notebook->SetSelectedItem (newlySelectedItem); -} - -void TVFrame::refreshSnapshotList () { - - if (!myApp->getSnapshotList()->refreshList()) - FatalErrorBox ("trying to open directory " + myApp->getSnapshotList()->getSnapshotDirName() + ": " - + strerror(errno)); - if (myTreeCtrl != 0) - myTreeCtrl->updateSnapshotList(myApp->getSnapshotList()); -} - -void TVFrame::initializeSnapshotListAndView () { - refreshSnapshotList (); - SetStatusText ("Snapshot list has been loaded."); -} - -//==------------------------------------------------------------------------==// - -void TVNotebook::displaySelectedItemOnPage (int page) { - if (selectedItem) - displayers[page]->displayItem (selectedItem); -} - -void TVNotebook::SetSelectedItem (TVTreeItemData *newSelectedItem) { - selectedItem = newSelectedItem; - displaySelectedItemOnPage (GetSelection ()); -} - -bool TVNotebook::AddItemDisplayer (ItemDisplayer *displayer) { - int pageIndex = GetPageCount (); - displayers.resize (1 + pageIndex); - displayers[pageIndex] = displayer; - return AddPage (displayer->getWindow (), - displayer->getDisplayTitle (0).c_str (), true); -} - -void TVNotebook::OnSelChanged (wxNotebookEvent &event) { - int newPage = event.GetSelection (); - displayers[newPage]->getWindow ()->SetSizeHints (-1, -1, -1, -1, -1, -1); - displaySelectedItemOnPage (newPage); - event.Skip (); -} - -BEGIN_EVENT_TABLE (TVNotebook, wxNotebook) - EVT_NOTEBOOK_PAGE_CHANGED(LLVM_TV_NOTEBOOK, TVNotebook::OnSelChanged) -END_EVENT_TABLE () - -//==------------------------------------------------------------------------==// - -static const wxString Explanation - ("Click on a Module or Function in the left-hand pane\n" - "to display its code in the right-hand pane. Then, you\n" - "can choose from the View menu to see graphical code views.\n"); - -/// TVFrame constructor - used to set up typical appearance of visualizer's -/// top-level window. -/// -TVFrame::TVFrame (TVApplication *app, const char *title) - : wxFrame (NULL, -1, title), myApp (app) { - // Set up appearance - CreateStatusBar (); - SetSize (wxRect (100, 100, 500, 200)); - Show (FALSE); - splitterWindow = new wxSplitterWindow(this, LLVM_TV_SPLITTER_WINDOW, - wxDefaultPosition, wxDefaultSize, - wxSP_3D); - - // Create tree view of snapshots - myTreeCtrl = new TVTreeCtrl(splitterWindow, this, LLVM_TV_TREE_CTRL); - Resize(); - - // Create right-hand pane's display widget and stick it in a notebook control. - notebook = new TVNotebook (splitterWindow); - notebook->AddItemDisplayer (new TVTextCtrl (notebook, Explanation)); - notebook->AddItemDisplayer (new TDGraphDrawer (notebook)); - notebook->AddItemDisplayer (new BUGraphDrawer (notebook)); - notebook->AddItemDisplayer (new LocalGraphDrawer (notebook)); - notebook->AddItemDisplayer (new TVCodeViewer (notebook)); - - // Split window vertically - splitterWindow->SplitVertically(myTreeCtrl, notebook, 200); - Show (TRUE); -} - -/// OnHelp - display the help dialog -/// -void TVFrame::OnHelp (wxCommandEvent &event) { - wxMessageBox (Explanation, "Help with LLVM-TV"); -} - -/// OnExit - respond to a request to exit the program. -/// -void TVFrame::OnExit (wxCommandEvent &event) { - myApp->Quit (); -} - -/// OnExit - respond to a request to display the About box. -/// -void TVFrame::OnAbout (wxCommandEvent &event) { - wxMessageBox("LLVM Visualization Tool\n\n" - "By Misha Brukman, Tanya Brethour, and Brian Gaeke\n" - "Copyright (C) 2004 University of Illinois at Urbana-Champaign\n" - "http://llvm.cs.uiuc.edu", "About LLVM-TV"); -} - -/// OnRefresh - respond to a request to refresh the list -/// -void TVFrame::OnRefresh (wxCommandEvent &event) { - refreshSnapshotList (); -} - -void TVFrame::OnOpen (wxCommandEvent &event) { - wxFileDialog d (this, "Choose a bytecode file to display"); - int result = d.ShowModal (); - if (result == wxID_CANCEL) return; - // FIXME: the rest of this method can be moved into the "snapshots - // list" object - std::string command = std::string("cp ") + std::string(d.GetPath ().c_str ()) + " " + snapshotsPath; - system (command.c_str ()); - refreshSnapshotList (); -} - -void TVFrame::Resize() { - wxSize size = GetClientSize(); - myTreeCtrl->SetSize(0, 0, size.x, 2*size.y/3); -} - -// This method of TVApplication is placed in this file so that it can -// be instantiated by all its callers. -template<class Grapher> -void TVApplication::OpenGraphView (TVTreeItemData *item) { - PictureFrame *wind = new PictureFrame (this); - allMyWindows.push_back (wind); - ItemDisplayer *drawer = new Grapher (wind); - wind->SetTitle (drawer->getDisplayTitle (item).c_str ()); - allMyDisplayers.push_back (drawer); - drawer->displayItem (item); -} - -void TVFrame::CallGraphView(wxCommandEvent &event) { - // Get the selected LLVM object and open up a new call graph view window. - myApp->OpenGraphView<CallGraphDrawer> (myTreeCtrl->GetSelectedItemData ()); -} - -void TVFrame::CFGView(wxCommandEvent &event) { - // Get the selected LLVM object and open up a new CFG view window. - myApp->OpenGraphView<CFGGraphDrawer> (myTreeCtrl->GetSelectedItemData ()); -} - -void TVFrame::BUDSView(wxCommandEvent &event) { - // Get the selected LLVM object and open up a new BUDS view window. - myApp->OpenGraphView<BUGraphDrawer> (myTreeCtrl->GetSelectedItemData ()); -} - -void TVFrame::TDDSView(wxCommandEvent &event) { - // Get the selected LLVM object and open up a new TDDS view window. - myApp->OpenGraphView<TDGraphDrawer> (myTreeCtrl->GetSelectedItemData ()); -} - -void TVFrame::LocalDSView(wxCommandEvent &event) { - // Get the selected LLVM object and open up a new Local DS view window. - myApp->OpenGraphView<LocalGraphDrawer> (myTreeCtrl->GetSelectedItemData ()); -} - -void TVFrame::CodeView(wxCommandEvent &event) { - // Get the selected LLVM object and open up a new CodeViewer window. - myApp->OpenGraphView<TVCodeViewer> (myTreeCtrl->GetSelectedItemData ()); -} - -BEGIN_EVENT_TABLE (TVFrame, wxFrame) - EVT_MENU (wxID_OPEN, TVFrame::OnOpen) - EVT_MENU (LLVM_TV_REFRESH, TVFrame::OnRefresh) - EVT_MENU (wxID_EXIT, TVFrame::OnExit) - - EVT_MENU (wxID_HELP_CONTENTS, TVFrame::OnHelp) - EVT_MENU (wxID_ABOUT, TVFrame::OnAbout) - - EVT_MENU (LLVM_TV_CALLGRAPHVIEW, TVFrame::CallGraphView) - EVT_MENU (LLVM_TV_CFGVIEW, TVFrame::CFGView) - EVT_MENU (LLVM_TV_BUDS_VIEW, TVFrame::BUDSView) - EVT_MENU (LLVM_TV_TDDS_VIEW, TVFrame::TDDSView) - EVT_MENU (LLVM_TV_LOCALDS_VIEW, TVFrame::LocalDSView) - EVT_MENU (LLVM_TV_CODEVIEW, TVFrame::CodeView) -END_EVENT_TABLE ()
diff --git a/television/tools/llvm-tv/TVFrame.h b/television/tools/llvm-tv/TVFrame.h deleted file mode 100644 index 4b9512a..0000000 --- a/television/tools/llvm-tv/TVFrame.h +++ /dev/null
@@ -1,97 +0,0 @@ -//===-- TVFrame.h - Main window class for llvm-tv ----------------*- C++ -*-==// -// -// The gui for llvm-tv. -// -//===----------------------------------------------------------------------===// - -#ifndef TVFRAME_H -#define TVFRAME_H - -#include "TVSnapshotList.h" -#include "TVWindowIDs.h" -#include "wx/wx.h" -#include "wx/listctrl.h" -#include "wx/splitter.h" -#include "wx/treectrl.h" -#include "wx/notebook.h" -#include "ItemDisplayer.h" -#include <string> -#include <vector> - -/// TVTreeCtrl - A specialization of wxTreeCtrl that displays a list of LLVM -/// Modules and Functions from a snapshot -/// -class TVFrame; -class TVTreeCtrl : public wxTreeCtrl { - TVFrame *myFrame; -public: - TVTreeCtrl::TVTreeCtrl(wxWindow *parent, TVFrame *frame, const wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTR_HIDE_ROOT | wxTR_DEFAULT_STYLE - | wxSUNKEN_BORDER); - virtual ~TVTreeCtrl() { } - void AddSnapshotsToTree(TVSnapshotList*); - void updateSnapshotList(TVSnapshotList*); - void OnSelChanged(wxTreeEvent &event); - TVTreeItemData *GetSelectedItemData (); - - DECLARE_EVENT_TABLE(); -}; - -///==---------------------------------------------------------------------==/// - -/// TVNotebook - The class which is responsible for the "tab view" -/// containing visualizers, which appears on the right-hand side -/// of the main LLVM-TV window. -/// -class TVNotebook : public wxNotebook { - std::vector<ItemDisplayer *> displayers; - TVTreeItemData *selectedItem; - - void displaySelectedItemOnPage (int page); -public: - TVNotebook (wxWindow *_parent) - : wxNotebook (_parent, LLVM_TV_NOTEBOOK) { } - void OnSelChanged (wxNotebookEvent &event); - bool AddItemDisplayer (ItemDisplayer *displayWidget); - void SetSelectedItem (TVTreeItemData *newSelectedItem); - DECLARE_EVENT_TABLE () -}; - -///==---------------------------------------------------------------------==/// - -/// TVFrame - The main application window for LLVM-TV, which is responsible -/// for displaying the tree view, tab view, status bar, and menu bar. -/// -class TVApplication; -class TVFrame : public wxFrame { - TVApplication *myApp; - - wxSplitterWindow *splitterWindow; // divides this into left & right sides - TVTreeCtrl *myTreeCtrl; // left side - displays tree view of module - TVNotebook *notebook; // right side - tab views w/ item displayers - - void Resize(); - public: - TVFrame (TVApplication *app, const char *title); - void OnExit (wxCommandEvent &event); - void CallGraphView (wxCommandEvent &event); - void CFGView (wxCommandEvent &event); - void BUDSView (wxCommandEvent &event); - void TDDSView (wxCommandEvent &event); - void LocalDSView (wxCommandEvent &event); - void CodeView (wxCommandEvent &event); - void OnAbout (wxCommandEvent &event); - void OnHelp (wxCommandEvent &event); - void OnOpen (wxCommandEvent &event); - void OnRefresh (wxCommandEvent &event); - void CreateTree(long style, std::vector<TVSnapshot>&); - void refreshSnapshotList (); - void initializeSnapshotListAndView (); - void updateDisplayedItem (TVTreeItemData *newlyDisplayedItem); - - DECLARE_EVENT_TABLE (); -}; - -#endif // TVFRAME_H
diff --git a/television/tools/llvm-tv/TVHtmlWindow.h b/television/tools/llvm-tv/TVHtmlWindow.h deleted file mode 100644 index 045dc17..0000000 --- a/television/tools/llvm-tv/TVHtmlWindow.h +++ /dev/null
@@ -1,20 +0,0 @@ -#ifndef TVHTMLWINDOW_H -#define TVHTMLWINDOW_H - -#include "TVWindowIDs.h" -#include "ItemDisplayer.h" -#include "wx/html/htmlwin.h" - -class TVHtmlWindow : public ItemDisplayer { - wxHtmlWindow *myHtmlWindow; - public: - TVHtmlWindow (wxWindow *_parent, const wxString &_init = "") { - myHtmlWindow = new wxHtmlWindow (_parent, LLVM_TV_HTML_WINDOW); - myHtmlWindow->AppendToPage (_init); - } - void displayItem (TVTreeItemData *item); - wxWindow *getWindow () { return myHtmlWindow; } - std::string getDisplayTitle (TVTreeItemData *item) { return "HTML view"; } -}; - -#endif // TVHTMLWINDOW_H
diff --git a/television/tools/llvm-tv/TVSnapshot.cpp b/television/tools/llvm-tv/TVSnapshot.cpp deleted file mode 100644 index 64b91f8..0000000 --- a/television/tools/llvm-tv/TVSnapshot.cpp +++ /dev/null
@@ -1,13 +0,0 @@ -#include "TVSnapshot.h" -#include "llvm/Bytecode/Reader.h" -#include "llvm-tv/Config.h" -using namespace llvm; - -void TVSnapshot::readBytecodeFile () { - std::string errorStr; - M = ParseBytecodeFile (filename, &errorStr); - if (!M) - throw std::string ("Error reading bytecode from '" + filename + "': " - + errorStr); -} -
diff --git a/television/tools/llvm-tv/TVSnapshot.h b/television/tools/llvm-tv/TVSnapshot.h deleted file mode 100644 index b7f6f37..0000000 --- a/television/tools/llvm-tv/TVSnapshot.h +++ /dev/null
@@ -1,41 +0,0 @@ -//===-- TVSnapshot.h - Wrapper class for llvm-tv snapshots -------*- C++ -*-==// -// -// The gui for llvm-tv. -// -//===----------------------------------------------------------------------===// - -#ifndef TVSNAPSHOT_H -#define TVSNAPSHOT_H - -#include <string> -#include <vector> -#include <libgen.h> -#include "llvm/Module.h" -using namespace llvm; - -/// TVSnapshot - Wrapper class for snapshots. -/// -class TVSnapshot { - Module *M; - std::string filename; - std::string myLabel; - - void readBytecodeFile (); - void fixLabel () { myLabel = basename ((char*)myLabel.c_str ()) ; } - public: - //TVSnapshot () : M (0), filename (), myLabel (filename) { } - TVSnapshot (const std::string &_name) : M (0), filename (_name), myLabel (filename) { fixLabel(); } - TVSnapshot (const char *_name) : M (0), filename (_name), myLabel (filename) { fixLabel(); } - const char *label () const { return myLabel.c_str (); } - unsigned getTimestamp () const { return (unsigned) strtol (label(), 0, 0); } - bool operator < (const TVSnapshot &s) const { - return getTimestamp () < s.getTimestamp (); - } - Module *getModule () { - if (!M) - readBytecodeFile (); - return M; - } -}; - -#endif // TVSNAPSHOT_H
diff --git a/television/tools/llvm-tv/TVSnapshotList.cpp b/television/tools/llvm-tv/TVSnapshotList.cpp deleted file mode 100644 index be0a119..0000000 --- a/television/tools/llvm-tv/TVSnapshotList.cpp +++ /dev/null
@@ -1,41 +0,0 @@ -//===-- TVSnapshotList.cpp - List of snapshots class for llvm-tv -*- C++ -*--=// -// -// Encapsulates a list of snapshots and the directory they are in. -// -//===----------------------------------------------------------------------===// - -#include "TVSnapshotList.h" -#include <dirent.h> - - -//Each time this function is called the directory is rescanned -//for any new snapshots -bool TVSnapshotList::refreshList() { - // re-load the list of snapshots - const char *directoryName = mySnapshotDirName.c_str(); - clearList(); - DIR *d = opendir(directoryName); - if (!d) - return false; - - while (struct dirent *de = readdir (d)) - if (memcmp(de->d_name, ".", 2) && memcmp(de->d_name, "..", 3)) - addSnapshot(mySnapshotDirName + "/" + de->d_name); - - sortList(); - - closedir (d); - return true; -} - -//Sort the snapshot list -void TVSnapshotList::sortList() { - sort (mySnapshotList.begin (), mySnapshotList.end ()); -} - - -//Add a snapshot to our vector of snapshots -void TVSnapshotList::addSnapshot(std::string snapshotName) { - mySnapshotList.push_back(snapshotName); -} -
diff --git a/television/tools/llvm-tv/TVSnapshotList.h b/television/tools/llvm-tv/TVSnapshotList.h deleted file mode 100644 index f1413e4..0000000 --- a/television/tools/llvm-tv/TVSnapshotList.h +++ /dev/null
@@ -1,37 +0,0 @@ -//===-- TVSnapshotList.h - List of snapshots class for llvm-tv ---*- C++ -*--=// -// -// Encapsulates a list of snapshots and the directory they are in. -// -//===----------------------------------------------------------------------===// - -#ifndef TVSNAPSHOTLIST_H -#define TVSNAPSHOTLIST_H - -#include <string> -#include <vector> -#include "TVSnapshot.h" - -/// Containts a list of snapshots and the directory they are in. -/// Put into a class to easily pass between the application and frame -/// -class TVSnapshotList { - std::vector<TVSnapshot> mySnapshotList; - std::string mySnapshotDirName; -public: - TVSnapshotList(std::string dir) : mySnapshotDirName(dir) {} - std::string getSnapshotDirName() { return mySnapshotDirName; } - void setSnapshotDirName(std::string dir) { mySnapshotDirName = dir; } - void addSnapshot(std::string snapshotName); - void clearList() { mySnapshotList.clear(); } - void sortList(); - bool refreshList(); - - //Iterators - typedef std::vector<TVSnapshot>::iterator iterator; - iterator begin() { return mySnapshotList.begin(); } - iterator end() { return mySnapshotList.end(); } - -}; - - -#endif
diff --git a/television/tools/llvm-tv/TVTextCtrl.h b/television/tools/llvm-tv/TVTextCtrl.h deleted file mode 100644 index 6ba2d93..0000000 --- a/television/tools/llvm-tv/TVTextCtrl.h +++ /dev/null
@@ -1,21 +0,0 @@ -#ifndef TVTEXTCTRL_H -#define TVTEXTCTRL_H - -#include "TVWindowIDs.h" -#include "ItemDisplayer.h" -#include "wx/textctrl.h" - -class TVTextCtrl : public ItemDisplayer { - wxTextCtrl *myTextCtrl; - public: - TVTextCtrl (wxWindow *_parent, const wxString &_value = "") { - myTextCtrl = new wxTextCtrl (_parent, LLVM_TV_TEXT_CTRL, _value, - wxDefaultPosition, wxDefaultSize, - wxTE_READONLY | wxTE_MULTILINE | wxHSCROLL); - } - void displayItem (TVTreeItemData *item); - wxWindow *getWindow () { return myTextCtrl; } - std::string getDisplayTitle (TVTreeItemData *item) { return "Text view"; } -}; - -#endif // TVTEXTCTRL_H
diff --git a/television/tools/llvm-tv/TVTreeItem.cpp b/television/tools/llvm-tv/TVTreeItem.cpp deleted file mode 100644 index 5e8838c..0000000 --- a/television/tools/llvm-tv/TVTreeItem.cpp +++ /dev/null
@@ -1,24 +0,0 @@ -#include "TVTreeItem.h" -#include "llvm/Module.h" -using namespace llvm; - -static TVTreeRootItem* theInstance = 0; - -TVTreeRootItem* TVTreeRootItem::instance() { - if (theInstance == 0) { - theInstance = new TVTreeRootItem("Snapshot Root"); - } - return theInstance; -} - -void TVTreeModuleItem::print(std::ostream &os) { - myModule->print(os); -} - -void TVTreeFunctionItem::print(std::ostream &os) { - myFunc->print(os); -} - -std::string TVTreeFunctionItem::getTitle () { - return myFunc->getName () + "()"; -}
diff --git a/television/tools/llvm-tv/TVTreeItem.h b/television/tools/llvm-tv/TVTreeItem.h deleted file mode 100644 index e53c1e7..0000000 --- a/television/tools/llvm-tv/TVTreeItem.h +++ /dev/null
@@ -1,89 +0,0 @@ -//===-- TVTreeItem.h - Nodes for the tree view -------------------*- C++ -*-==// -// -// The gui for llvm-tv. -// -//===----------------------------------------------------------------------===// - -#ifndef TVTREEITEM_H -#define TVTREEITEM_H - -#include "GraphDrawer.h" -#include "CodeViewer.h" -#include <wx/wx.h> -#include <wx/treectrl.h> -#include <ostream> -#include <string> - -namespace llvm { - class Function; - class GlobalValue; - class Module; -} - -/// TVTreeItemData - Base class for LLVM TV Tree Data -/// -class TVTreeItemData : public wxTreeItemData { -public: - const wxChar *GetDesc() const { return m_desc.c_str(); } - virtual void print(std::ostream&) { } - virtual wxImage *graphOn(GraphDrawer *grapher) { return 0; } - virtual void viewCodeOn(TVCodeViewer *viewer) { } - virtual std::string getTitle () { return "an untitled object"; } - virtual std::string dsGraphName () { return "graph of " + getTitle (); } - -protected: - TVTreeItemData(const wxString& desc) : m_desc(desc) { } - void printFunctionHeader(llvm::Function *F); - void printFunction(llvm::Function *F); - void printModule(llvm::Module *M); - wxString m_desc; -}; - -/// TVTreeRootItem - Tree Item representing root of the hierarchy (Singleton) -/// -class TVTreeRootItem : public TVTreeItemData { -public: - static TVTreeRootItem* instance(); -protected: - TVTreeRootItem(const wxString& desc) : TVTreeItemData(desc) {} -}; - -/// TVTreeModuleItem - Tree Item containing a Module -/// -class TVTreeModuleItem : public TVTreeItemData { -private: - llvm::Module *myModule; -public: - TVTreeModuleItem(const wxString& desc, llvm::Module *mod) - : TVTreeItemData(desc), myModule(mod) {} - - void print(std::ostream &out); - wxImage *graphOn(GraphDrawer *grapher) { - return grapher->drawModuleGraph (myModule); - } - void viewCodeOn(TVCodeViewer *viewer) { viewer->viewModuleCode (myModule); } - - virtual std::string getTitle () { return m_desc.c_str(); } - virtual std::string dsGraphName () { return "globals graph"; } -}; - - -/// TVTreeFunctionItem - Tree Item containing a Function -/// -class TVTreeFunctionItem : public TVTreeItemData { -private: - llvm::Function *myFunc; -public: - TVTreeFunctionItem(const wxString& desc, llvm::Function *func) - : TVTreeItemData(desc), myFunc(func) {} - - void print(std::ostream &out); - wxImage *graphOn(GraphDrawer *grapher) { - return grapher->drawFunctionGraph (myFunc); - } - void viewCodeOn(TVCodeViewer *viewer) { viewer->viewFunctionCode (myFunc); } - - virtual std::string getTitle (); -}; - -#endif
diff --git a/television/tools/llvm-tv/TVWindowIDs.h b/television/tools/llvm-tv/TVWindowIDs.h deleted file mode 100644 index 2d38731..0000000 --- a/television/tools/llvm-tv/TVWindowIDs.h +++ /dev/null
@@ -1,24 +0,0 @@ -#ifndef TVWINDOWIDS_H -#define TVWINDOWIDS_H - -#include "wx/wx.h" - -/// Event IDs we use in the application -/// -enum { - LLVM_TV_REFRESH = wxID_HIGHEST + 1, - LLVM_TV_TREE_CTRL, - LLVM_TV_TEXT_CTRL, - LLVM_TV_HTML_WINDOW, - LLVM_TV_SPLITTER_WINDOW, - LLVM_TV_CALLGRAPHVIEW, - LLVM_TV_CFGVIEW, - LLVM_TV_BUDS_VIEW, - LLVM_TV_TDDS_VIEW, - LLVM_TV_LOCALDS_VIEW, - LLVM_TV_CODEVIEW, - LLVM_TV_CODEVIEW_LIST, - LLVM_TV_NOTEBOOK -}; - -#endif // TVWINDOWIDS_H