From 2b6c038a5e07b50cdbeca0a62efe319878937593 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Sun, 10 Oct 2004 19:09:33 +0000 Subject: [PATCH] Ensure timestamp on saved contents of configure.ac is not changed. Use correct options to automake. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16879 91177308-0d34-0410-b5e6-96231b3b80d8 --- autoconf/AutoRegen.sh | 11 +- autoconf/configure.am | 963 +++++++++++++++++++++++------------------ autoconf/depcomp | 522 ++++++++++++++++++++++ autoconf/install-sh | 437 +++++++++++-------- autoconf/missing | 353 +++++++++++++++ autoconf/mkinstalldirs | 161 ++++--- 6 files changed, 1782 insertions(+), 665 deletions(-) create mode 100755 autoconf/depcomp create mode 100755 autoconf/missing diff --git a/autoconf/AutoRegen.sh b/autoconf/AutoRegen.sh index f264054464e..90cf16aa637 100755 --- a/autoconf/AutoRegen.sh +++ b/autoconf/AutoRegen.sh @@ -7,10 +7,12 @@ if test "$1" = --with-automake ; then outfile=configure_am configfile=configure.am with_automake=1 -else +elif test -z "$1" ; then outfile=configure configfile=configure.ac with_automake=0 +else + die "Invalid option: $1" fi test -d autoconf && test -f autoconf/$configfile && cd autoconf test -f $configfile || die "Can't find 'autoconf' dir; please cd into it first" @@ -48,7 +50,7 @@ echo "" echo "Regenerating aclocal.m4 with aclocal" cwd=`pwd` if test $with_automake -eq 1 ; then - cp configure.ac .configure.ac.save + mv configure.ac .configure.ac.save cp configure.am configure.ac cp configure.am ../configure.ac fi @@ -61,9 +63,8 @@ autoheader -I autoconf -I autoconf/m4 autoconf/$configfile || die "autoheader fa if test $with_automake -eq 1 ; then echo "Regenerating makefiles with automake 1.9.2" cp autoconf/aclocal.m4 . - automake --foreign --add-missing --copy - rm configure.ac + automake --gnu --add-missing --copy --force-missing cd $cwd - cp .configure.ac.save configure.ac + mv .configure.ac.save configure.ac fi exit 0 diff --git a/autoconf/configure.am b/autoconf/configure.am index d6967fb9f64..b3a88313064 100644 --- a/autoconf/configure.am +++ b/autoconf/configure.am @@ -1,3 +1,19 @@ +dnl -- configure.am - Automake based configuration --------------------------=== +dnl +dnl The LLVM Compiler Infrastructure +dnl +dnl This file was developed by Reid Spencer and is distributed under the +dnl University of Illinois Open Source License. See LICENSE.TXT for details. +dnl +dnl ===----------------------------------------------------------------------=== +dnl + +dnl ===----------------------------------------------------------------------=== +dnl -- +dnl -- SECTION 1: Initialization & Setup +dnl -- +dnl ===----------------------------------------------------------------------=== + dnl Initialize autoconf AC_INIT([[LLVM]],[[1.4]],[llvmbugs@cs.uiuc.edu]) @@ -10,8 +26,8 @@ dnl AC_CONFIG_MACRO_DIR(autoconf/m4) dnl Verify that the source directory is valid AC_CONFIG_SRCDIR(["lib/VMCore/Module.cpp"]) -dnl Check which host for which we're compiling. This will tell us which LLVM -dnl compiler will be used for compiling SSA into object code. +dnl Check which host/target for which we're compiling. This will tell us which +dnl LLVM compiler will be used for compiling SSA into object code. AC_CANONICAL_TARGET dnl Quit if the source directory has already been configured. @@ -23,10 +39,522 @@ if test ${srcdir} != "." ; then fi dnl Initialize automake -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE([foreign dejagnu dist-zip nostdinc -Wnone -Wunsupported -Wsyntax -Wobsolete]) +dnl Make sure we are using the right version of autoconf +AC_PREREQ(2.59) + +dnl ===----------------------------------------------------------------------=== +dnl -- +dnl -- SECTION 2: Setup The Command Line Arguments For "configure" +dnl -- +dnl ===----------------------------------------------------------------------=== + +dnl Specify where to find the llvm-gcc install directory +AC_ARG_WITH(llvmgccdir, + AS_HELP_STRING([--with-llvmgccdir],[Location of LLVM GCC front-end]), + [case "${withval}" in + /*|*/*) LLVMGCCDIR=$withval ;; + *) AC_MSG_ERROR([bad value ${withval} for --with-llvmgccdir]) ;; + esac], + [LLVMGCCDIR=/usr/local/llvm-gcc]) +AC_SUBST(LLVMGCCDIR) + +dnl Specify whether to build optimized or not +AC_ARG_ENABLE(optimized, + AS_HELP_STRING([--enable-optimized],[Build an optimized version of LLVM + (default=no)]), + [case "${withval}" in + yes) ENABLE_OPTIMIZED=1 ;; + no) ENABLE_OPTIMIZED=0 ;; + "") ENABLE_OPTIMIZED=0 ;; + *) AC_MSG_ERROR([bad value ${withval} for --enable-optimized]) ;; + esac], + [ENABLE_OPTIMIZED=0]) +AC_SUBST(ENABLE_OPTIMIZED) +AM_CONDITIONAL(ENABLE_OPTIMIZED,test $ENABLE_OPTIMIZED = 1) + +dnl Specify whether to build profiled or not +AC_ARG_ENABLE(profiled, + AS_HELP_STRING([--enable-profiled],[Build a profiled version of LLVM + (default=no)]), + [case "${withval}" in + yes) ENABLE_PROFILED=1 ;; + no) ENABLE_PROFILED=0 ;; + "") ENABLE_PROFILED=0 ;; + *) AC_MSG_ERROR([bad value ${withval} for --enable-profiled]) ;; + esac], + [ENABLE_PROFILED=0]) +AC_SUBST(ENABLE_PROFILED,$ENABLE_PROFILED) +AM_CONDITIONAL(ENABLE_PROFILED,test $ENABLE_PROFILED = 1) + +dnl JIT Option +AC_ARG_ENABLE(jit, + AS_HELP_STRING([--enable-jit], + [Enable Just In Time Compiling (default is YES)]),, + enableval=default) + +if test ${enableval} = "no" +then + AC_SUBST(JIT,[[]]) +else + case $target in + *i*86*) AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) ;; + *sparc*) AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) ;; + *) AC_SUBST(JIT,[[]]) ;; + esac +fi + +dnl ===----------------------------------------------------------------------=== +dnl -- +dnl -- SECTION 3: Platform/Architecture Configuration +dnl -- +dnl ===----------------------------------------------------------------------=== dnl Set the "OS" Makefile variable based on the system we are building on. +AC_MSG_CHECKING([support for generic build operating system]) +case $build in + *-*-aix*) llvm_platform_type="AIX" ;; + *-*-cygwin*) llvm_platform_type="Cygwin" ;; + *-*-darwin*) llvm_platform_type="Darwin" ;; + *-*-freebsd*) llvm_platform_type="FreeBSD" ;; + *-*-interix*) llvm_platform_type="Interix" ;; + *-*-linux*) llvm_platform_type="Linux" ;; + *-*-solaris*) llvm_platform_type="SunOS" ;; + *-*-win32*) llvm_platform_type="Win32" ;; + *-*-mingw*) llvm_platform_type="Win32" ;; + *) + AC_MSG_ERROR([Platform is unknown, configure can't continue]) + llvm_platform_type="Unknown" + ;; +esac +AC_SUBST(OS,$llvm_platform_type) +AC_MSG_RESULT($llvm_platform_type) + +AC_MSG_CHECKING(target architecture) +dnl If we are targetting a Sparc machine running Solaris, pretend that it is +dnl V9, since that is all that we support at the moment, and autoconf will only +dnl tell us we're a sparc. +case $target in + sparc*-*-solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]]) ;; +esac + +dnl Determine what our target architecture is and configure accordingly. +dnl This will allow Makefiles to make a distinction between the hardware and +dnl the OS. +case $target in + i*86-*) ARCH="x86" ;; + sparc*-*) ARCH="Sparc" ;; + powerpc*-*) ARCH="PowerPC" ;; + *) ARCH="Unknown";; +esac +AM_CONDITIONAL(ARCH_X86,test $ARCH = "x86") +AM_CONDITIONAL(ARCH_SPARC,test $ARCH = "Sparc") +AM_CONDITIONAL(ARCH_PPC,test $ARCH = "PowerPC") +AM_CONDITIONAL(ARCH_UNKNOWN,test $ARCH = "Unknown") +AC_SUBST(ARCH,$ARCH) +AC_MSG_RESULT($ARCH) + +dnl Check for the endianness of the target +AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little])) + +dnl ===----------------------------------------------------------------------=== +dnl -- +dnl -- SECTION 4: Check For Programs We Need +dnl -- +dnl ===----------------------------------------------------------------------=== + +dnl Find the install program (needs to be done before canonical stuff) +AC_PROG_INSTALL + +dnl Check for compilation tools +AC_PROG_CXX +AC_PROG_CC(gcc) +AC_PROG_CPP + +dnl Checks for other build tools +AC_PROG_FLEX +AC_PROG_BISON +AC_PROG_LIBTOOL + +dnl Checks for tools we can get away with not having: +AC_PATH_PROG(DOT,[dot],[true dot]) +AC_PATH_PROG(ETAGS,[etags],[true etags]) +AC_PATH_PROG(PYTHON,[python],[true python]) +AC_PATH_PROG(QMTEST,[qmtest],[true qmtest]) + +dnl ===----------------------------------------------------------------------=== +dnl -- +dnl -- SECTION 5: Basic sanity checks on dependent programs we need +dnl -- +dnl ===----------------------------------------------------------------------=== + +dnl Ensure that compilation tools are GCC; we use GCC specific extensions +if test "$GCC" != "yes" +then + AC_MSG_ERROR([gcc required but not found]) +fi + +dnl Ensure that compilation tools are GCC; we use GCC specific extensions +if test "$GXX" != "yes" +then + AC_MSG_ERROR([g++ required but not found]) +fi + +dnl Verify that GCC is version 3.0 or higher +gccmajor=`$CC --version | head -n 1 | awk '{print $NF;}' | cut -d. -f1` +if test "$gccmajor" -lt "3" +then + AC_MSG_ERROR([gcc 3.x required, but you have a lower version]) +fi + +dnl Check for GNU Make. We use its extensions too, so don't build without it +AC_CHECK_GNU_MAKE +if test -z "$_cv_gnu_make_command" +then + AC_MSG_ERROR([GNU Make required but not found]) +fi + +dnl Find the LLVM GCC-based C/C++ front end +AC_MSG_CHECKING([for llvm-gcc]) +LLVM_GCC_CHECK=no +if test -d "$LLVMGCCDIR" +then + if test -x "$LLVMGCCDIR/bin/gcc" + then + LLVM_GCC_CHECK="$LLVMGCCDIR/bin/gcc" + fi +fi +llvmgccwarn=no +AC_MSG_RESULT($LLVM_GCC_CHECK) +if test "$LLVM_GCC_CHECK" = "no" +then + llvmgccwarn=yes +fi + +dnl Determine if the "gcc" found produces LLVM assembly. If so its "sane" +AC_MSG_CHECKING([whether llvm-gcc is sane]) +LLVM_GCC_SANE=no +if test -x "$LLVM_GCC_CHECK" +then + cp /dev/null conftest.c + "$LLVM_GCC_CHECK" -S -o - conftest.c | grep implementation > /dev/null 2>&1 + if test $? -eq 0 + then + LLVM_GCC_SANE=yes + fi + rm conftest.c + llvmcc1path=`"$LLVM_GCC_CHECK" --print-prog-name=cc1` + AC_SUBST(LLVMCC1,$llvmcc1path) + llvmcc1pluspath=`"$LLVM_GCC_CHECK" --print-prog-name=cc1plus` + AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath) +fi +AC_MSG_RESULT($LLVM_GCC_SANE) +if test "$LLVM_GCC_SANE" = "no" +then + llvmgccwarn=yes +fi + +dnl Check if we know how to tell etags we are using C++: +etags_version=`$ETAGS --version 2>&1` +case "$etags_version" in + *[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;; + *GNU\ Emacs*) ETAGSFLAGS="-l c++" ;; + *) ETAGSFLAGS="" ;; +esac +AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS) + +if test "$PYTHON" = "false" +then + AC_MSG_WARN([Python is required for the test suite, but it was not found]) +fi +if test "$QMTEST" = "false" +then + AC_MSG_WARN([QMTest is required for the test suite, but it was not found]) +fi + +dnl Verify that the version of python available is high enough for qmtest +pyversion=`$PYTHON -V 2>&1 | cut -d\ -f2` +pymajor=`echo $pyversion | cut -d. -f1` +pyminor=`echo $pyversion | cut -d. -f2` + +if test "$pymajor" -ge "2" +then + if test "$pymajor" -eq "2" + then + if test "$pyminor" -lt "2" + then + AC_MSG_WARN([QMTest requires Python 2.2 or later]) + fi + fi +else + AC_MSG_WARN([QMTest requires Python 2.2 or later]) +fi + +dnl ===----------------------------------------------------------------------=== +dnl -- +dnl -- SECTION 6: Check For Needed Libraries +dnl -- +dnl ===----------------------------------------------------------------------=== + +dnl libelf is for sparc only; we can ignore it if we don't have it +AC_CHECK_LIB(elf, elf_begin) + +dnl Check for bzip2 and zlib compression libraries needed for archive +dnl reading/writing +AC_CHECK_LIB(bz2,BZ2_bzCompressInit,[bzip2_found=1],[bzip2_found=0]) +AC_CHECK_LIB(z,gzopen,[zlib_found=1],[zlib_found=0]) + +dnl dlopen() is required for plugin support. +AC_SEARCH_LIBS(dlopen,dl, + AC_DEFINE([HAVE_DLOPEN],[1], + [Define if dlopen() is available on this platform.]), + AC_MSG_WARN([dlopen() not found - disabling plugin support])) + +dnl mallinfo is optional; the code can compile (minus features) without it +AC_SEARCH_LIBS(mallinfo,malloc, + AC_DEFINE([HAVE_MALLINFO],[1], + [Define if mallinfo() is available on this platform.])) + +dnl pthread locking functions are optional - but llvm will not be thread-safe +dnl without locks. +AC_SEARCH_LIBS(pthread_mutex_lock,pthread, + AC_DEFINE([HAVE_PTHREAD_MUTEX_LOCK],[1],[Have pthread_mutex_lock])) + + +dnl ===----------------------------------------------------------------------=== +dnl -- +dnl -- SECTION 7: Check For Needed Header Files +dnl -- +dnl ===----------------------------------------------------------------------=== + +dnl We don't check for ancient stuff or things that are guaranteed to be there +dnl by the C++ standard. We always use the versions of C headers. +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_HEADER_TIME +AC_HEADER_MMAP_ANONYMOUS + +dnl Checks for POSIX and other various system-specific header files +AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h malloc.h sys/mman.h) +AC_CHECK_HEADERS(sys/resource.h dlfcn.h link.h execinfo.h windows.h) + +dnl Check for things that need to be included in public headers, and so +dnl for which we may not have access to a HAVE_* preprocessor #define. +dnl (primarily used in DataTypes.h) +AC_CHECK_HEADER([sys/types.h]) +AC_CHECK_HEADER([inttypes.h]) +AC_CHECK_HEADER([stdint.h]) + +dnl Checks for compression headers: +AC_CHECK_HEADERS([bzlib.h],[bzlib_h_found=1],[bzlib_h_found=0],[]) +AC_CHECK_HEADERS([zlib.h],[zlib_h_found=1],[zlib_h_found=0],[]) + +dnl ===----------------------------------------------------------------------=== +dnl -- +dnl -- SECTION 8: Check for specific features (types/functions/options/etc) +dnl -- +dnl ===----------------------------------------------------------------------=== + +dnl Check for types +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_SIGNAL +AC_STRUCT_TM +AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found])) +AC_CHECK_TYPES([uint64_t],, + AC_CHECK_TYPES([u_int64_t],, + AC_MSG_ERROR([Type uint64_t or u_int64_t required but not found]))) + +dnl Check for various C features +AC_C_PRINTF_A +AC_FUNC_ISNAN +AC_FUNC_ISINF +AC_FUNC_ALLOCA +AC_FUNC_MMAP +if test "$ac_cv_func_mmap_fixed_mapped" = "no" +then + AC_MSG_WARN([mmap() required but not found]) +fi +AC_FUNC_MMAP_FILE +if test "$ac_cv_func_mmap_file" = "no" +then + AC_MSG_WARN([mmap() of files required but not found]) +fi +AC_CHECK_FUNCS(getcwd gettimeofday strdup strtoq strtoll backtrace isatty) +AC_CHECK_FUNCS(mkstemp getrusage) +AC_CHECK_FUNC(mprotect,, + AC_MSG_ERROR([Function mprotect() required but not found])) + +dnl Check for C++ extensions +AC_CXX_HAVE_HASH_MAP +AC_CXX_HAVE_HASH_SET +AC_CXX_HAVE_STD_ITERATOR +AC_CXX_HAVE_BI_ITERATOR +AC_CXX_HAVE_FWD_ITERATOR + +dnl Determine if the linker supports the -R option. +AC_LINK_USE_R + +dnl ===----------------------------------------------------------------------=== +dnl -- +dnl -- SECTION 9: Remaining LLVM specific configuration items +dnl -- +dnl ===----------------------------------------------------------------------=== + +dnl Set up substitutions for compression libraries +if test $zlib_found -eq 1 -a $zlib_h_found -eq 1; then + AC_DEFINE([HAVE_ZLIB],[1], + [Define if zlib library is available on this platform.]) + AC_SUBST([HAVE_ZLIB],[1]) +else + AC_SUBST([HAVE_ZLIB],[0]) +fi +if test $bzip2_found -eq 1 -a $bzlib_h_found -eq 1 ; then + AC_DEFINE([HAVE_BZIP2],[1], + [Define if bzip2 library is available on this platform.]) + AC_SUBST([HAVE_BZIP2],[1]) +else + AC_SUBST([HAVE_BZIP2],[0]) +fi + +dnl Get libtool's idea of what the shared library suffix is. +dnl This is a hack; it relies on undocumented behavior. +AC_MSG_CHECKING([for shared library suffix]) +eval "SHLIBEXT=$shrext_cmds" +AC_MSG_RESULT($SHLIBEXT) + +dnl Propagate it to the Makefiles and config.h (for gccld & bugpoint). +AC_SUBST(SHLIBEXT,$SHLIBEXT) +AC_DEFINE_UNQUOTED(SHLIBEXT,"$SHLIBEXT", + [Extension that shared libraries have, e.g., ".so".]) + +# Translate the various configuration directories and other basic +# information into substitutions that will end up in config.h.in so +# that these configured values can be hard-wired into a program. +eval LLVM_PREFIX="${prefix}"; +eval LLVM_BINDIR="${prefix}/bin"; +eval LLVM_LIBDIR="${prefix}/lib"; +eval LLVM_DATADIR="${prefix}/data"; +eval LLVM_DOCSDIR="${prefix}/docs"; +eval LLVM_ETCDIR="${prefix}/etc"; +eval LLVM_INCLUDEDIR="${prefix}/include"; +eval LLVM_INFODIR="${prefix}/info"; +eval LLVM_MANDIR="${prefix}/man"; +LLVM_CONFIGTIME=`date` + +AC_SUBST(LLVM_PREFIX) +AC_SUBST(LLVM_BINDIR) +AC_SUBST(LLVM_LIBDIR) +AC_SUBST(LLVM_DATADIR) +AC_SUBST(LLVM_DOCSDIR) +AC_SUBST(LLVM_ETCDIR) +AC_SUBST(LLVM_INCLUDEDIR) +AC_SUBST(LLVM_INFODIR) +AC_SUBST(LLVM_MANDIR) +AC_SUBST(LLVM_CONFIGTIME) + +AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX", + [Installation prefix directory]) +AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR", + [Installation directory for binary executables]) +AC_DEFINE_UNQUOTED(LLVM_LIBDIR, "$LLVM_LIBDIR", + [Installation directory for libraries]) +AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR", + [Installation directory for data files]) +AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DOCSDIR", + [Installation directory for documentation]) +AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR", + [Installation directory for config files]) +AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR", + [Installation directory for include files]) +AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR", + [Installation directory for .info files]) +AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR", + [Installation directory for man pages]) +AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME", + [Time at which LLVM was configured]) + +dnl ===----------------------------------------------------------------------=== +dnl -- SECTION 10: Define the output and put it out +dnl ===----------------------------------------------------------------------=== + +dnl Configure header files +AC_CONFIG_HEADERS([include/llvm/Config/config.h]) +AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h]) +AC_CONFIG_HEADERS([include/llvm/ADT/hash_map]) +AC_CONFIG_HEADERS([include/llvm/ADT/hash_set]) +AC_CONFIG_HEADERS([include/llvm/Support/ThreadSupport.h]) +AC_CONFIG_HEADERS([include/llvm/ADT/iterator]) + +dnl Configure makefiles +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([lib/Makefile]) +AC_CONFIG_FILES([lib/Analysis/IPA/Makefile]) +AC_CONFIG_FILES([lib/Analysis/Makefile]) +AC_CONFIG_FILES([lib/Analysis/DataStructure/Makefile]) +AC_CONFIG_FILES([lib/AsmParser/Makefile]) +AC_CONFIG_FILES([lib/System/Makefile]) +AC_CONFIG_FILES([lib/Bytecode/Reader/Makefile]) +AC_CONFIG_FILES([lib/Bytecode/Makefile]) +AC_CONFIG_FILES([lib/Bytecode/Writer/Makefile]) +AC_CONFIG_FILES([lib/Bytecode/Archive/Makefile]) +AC_CONFIG_FILES([lib/CodeGen/InstrSched/Makefile]) +AC_CONFIG_FILES([lib/CodeGen/Makefile]) +AC_CONFIG_FILES([lib/CodeGen/ModuloScheduling/Makefile]) +AC_CONFIG_FILES([lib/CodeGen/SelectionDAG/Makefile]) +AC_CONFIG_FILES([lib/Debugger/Makefile]) +AC_CONFIG_FILES([lib/ExecutionEngine/Interpreter/Makefile]) +AC_CONFIG_FILES([lib/ExecutionEngine/Makefile]) +AC_CONFIG_FILES([lib/ExecutionEngine/JIT/Makefile]) +AC_CONFIG_FILES([lib/Support/Makefile]) +AC_CONFIG_FILES([lib/Target/CBackend/Makefile]) +AC_CONFIG_FILES([lib/Target/Makefile]) +AC_CONFIG_FILES([lib/Target/Skeleton/Makefile]) +AC_CONFIG_FILES([lib/Target/PowerPC/Makefile]) +AC_CONFIG_FILES([lib/Target/SparcV9/Makefile]) +AC_CONFIG_FILES([lib/Target/SparcV9/LiveVar/Makefile]) +AC_CONFIG_FILES([lib/Target/SparcV9/RegAlloc/Makefile]) +AC_CONFIG_FILES([lib/Target/X86/Makefile]) +AC_CONFIG_FILES([lib/Transforms/Hello/Makefile]) +AC_CONFIG_FILES([lib/Transforms/Makefile]) +AC_CONFIG_FILES([lib/Transforms/IPO/Makefile]) +AC_CONFIG_FILES([lib/Transforms/Instrumentation/ProfilePaths/Makefile]) +AC_CONFIG_FILES([lib/Transforms/Instrumentation/Makefile]) +AC_CONFIG_FILES([lib/Transforms/Scalar/Makefile]) +AC_CONFIG_FILES([lib/Transforms/Utils/Makefile]) +AC_CONFIG_FILES([lib/VMCore/Makefile]) +AC_CONFIG_FILES([utils/Makefile]) +AC_CONFIG_FILES([utils/Burg/Makefile]) +AC_CONFIG_FILES([utils/fpcmp/Makefile]) +AC_CONFIG_FILES([utils/TableGen/Makefile]) +AC_CONFIG_FILES([tools/Makefile]) +AC_CONFIG_FILES([tools/analyze/Makefile]) +AC_CONFIG_FILES([tools/llvmc/Makefile]) +AC_CONFIG_FILES([tools/bugpoint/Makefile]) +AC_CONFIG_FILES([tools/extract/Makefile]) +AC_CONFIG_FILES([tools/gccas/Makefile]) +AC_CONFIG_FILES([tools/gccld/Makefile]) +AC_CONFIG_FILES([tools/llvm-bcanalyzer/Makefile]) +AC_CONFIG_FILES([tools/llc/Makefile]) +AC_CONFIG_FILES([tools/llee/Makefile]) +AC_CONFIG_FILES([tools/lli/Makefile]) +AC_CONFIG_FILES([tools/llvm-ar/Makefile]) +AC_CONFIG_FILES([tools/llvm-as/Makefile]) +AC_CONFIG_FILES([tools/llvm-db/Makefile]) +AC_CONFIG_FILES([tools/llvm-dis/Makefile]) +AC_CONFIG_FILES([tools/llvm-link/Makefile]) +AC_CONFIG_FILES([tools/llvm-nm/Makefile]) +AC_CONFIG_FILES([tools/llvm-prof/Makefile]) +AC_CONFIG_FILES([tools/opt/Makefile]) +AC_CONFIG_FILES([tools/llvm-ld/Makefile]) +AC_CONFIG_FILES([tools/llvm-stub/Makefile]) + +dnl Make a link from lib/System/platform to lib/System/$llvm_platform_type +dnl This helps the #inclusion of the system specific include files +dnl for the operating system abstraction library +AC_CONFIG_LINKS(lib/System/platform:lib/System/$llvm_platform_type) + dnl Configure all of the projects present in our source tree. for i in `ls ${srcdir}/projects` do @@ -47,436 +575,29 @@ do esac fi done - -dnl Configure header files -AC_CONFIG_HEADERS([include/llvm/Config/config.h]) - -dnl Configure other output files -AC_CONFIG_FILES([Makefile.config]) -AC_CONFIG_FILES([Makefile]) -AC_CONFIG_FILES([lib/Makefile]) - -AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h]) -AC_CONFIG_HEADERS([include/llvm/ADT/hash_map]) -AC_CONFIG_HEADERS([include/llvm/ADT/hash_set]) -AC_CONFIG_HEADERS([include/llvm/Support/ThreadSupport.h]) -AC_CONFIG_HEADERS([include/llvm/ADT/iterator]) - -dnl Do special configuration of Makefiles -dnl AC_CONFIG_MAKEFILE(Makefile) -dnl AC_CONFIG_MAKEFILE(Makefile.common) -dnl AC_CONFIG_MAKEFILE(examples/Makefile) -dnl AC_CONFIG_MAKEFILE(lib/Makefile) -dnl AC_CONFIG_MAKEFILE(runtime/Makefile) -dnl AC_CONFIG_MAKEFILE(test/Makefile) -dnl AC_CONFIG_MAKEFILE(test/Makefile.tests) -dnl AC_CONFIG_MAKEFILE(test/QMTest/llvm.py) -dnl AC_CONFIG_MAKEFILE(test/QMTest/llvmdb.py) -dnl AC_CONFIG_MAKEFILE(tools/Makefile) -dnl AC_CONFIG_MAKEFILE(utils/Makefile) -dnl AC_CONFIG_MAKEFILE(projects/Makefile) - -dnl Find the install program (needs to be done before canonical stuff) -AC_PROG_INSTALL - -dnl We will use the build machine information to set some variables. - -AC_MSG_CHECKING([support for generic build operating system]) -case $build in - *-*-aix*) - AC_SUBST(OS,[AIX]) - platform_type="AIX" - ;; - *-*-cygwin*) - AC_SUBST(OS,[Cygwin]) - platform_type="Cygwin" - ;; - *-*-darwin*) - AC_SUBST(OS,[Darwin]) - platform_type="Darwin" - ;; - *-*-freebsd*) - AC_SUBST(OS,[Linux]) - platform_type="FreeBSD" - ;; - *-*-interix*) - AC_SUBST(OS,[SunOS]) - platform_type="Interix" - ;; - *-*-linux*) - AC_SUBST(OS,[Linux]) - platform_type="Linux" - if test -d /home/vadve/lattner/local/x86/llvm-gcc - then - AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/]) - fi - ;; - *-*-solaris*) - AC_SUBST(OS,[SunOS]) - platform_type="SunOS" - if test -d /home/vadve/lattner/local/sparc/llvm-gcc - then - AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/]) - fi - ;; - *-*-win32*) - AC_SUBST(OS,[Win32]) - platform_type="Win32" - ;; - *-*-mingw*) - AC_SUBST(OS,[Win32]) - platform_type="Win32" - ;; - *) - AC_SUBST(OS,[Unknown]) - platform_type="Unknown" - ;; -esac - -dnl Make sure we aren't attempting to configure for an unknown system -if test "$platform_type" = "Unknown" ; then - AC_MSG_ERROR([Platform is unknown, configure can't continue]) -fi - -dnl Make a link from lib/System/platform to lib/System/$platform_type -dnl This helps the #inclusion of the system specific include files -dnl for the operating system abstraction library -AC_CONFIG_LINKS(lib/System/platform:lib/System/$platform_type) - - -AC_MSG_CHECKING(target architecture) -dnl If we are targetting a Sparc machine running Solaris, pretend that it is -dnl V9, since that is all that we support at the moment, and autoconf will only -dnl tell us we're a sparc. -case $target in - sparc*-*-solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]]) - ;; -esac - -dnl Determine what our target architecture is and configure accordingly. -dnl This will allow Makefiles to make a distinction between the hardware and -dnl the OS. -case $target in - i*86-*) - ARCH="x86" - AC_SUBST(ARCH,[x86]) - ;; - sparc*-*) - ARCH="Sparc" - AC_SUBST(ARCH,[Sparc]) - ;; - powerpc*-*) - ARCH="PowerPC" - AC_SUBST(ARCH,[PowerPC]) - ;; - *) - ARCH="Unknown" - AC_SUBST(ARCH,[Unknown]) - ;; -esac - -AC_MSG_RESULT($ARCH) - -dnl Check for compilation tools -AC_PROG_CXX -AC_PROG_CC(gcc) -dnl Ensure that compilation tools are GCC; we use GCC specific extensions -if test "$GCC" != "yes" -then - AC_MSG_ERROR([gcc required but not found]) -fi -AC_PROG_CPP -dnl Ensure that compilation tools are GCC; we use GCC specific extensions -if test "$GXX" != "yes" -then - AC_MSG_ERROR([g++ required but not found]) -fi - -dnl Verify that GCC is version 3.0 or higher -gccmajor=`$CC --version | head -n 1 | awk '{print $NF;}' | cut -d. -f1` -if test "$gccmajor" -lt "3" -then - AC_MSG_ERROR([gcc 3.x required, but you have a lower version]) -fi - -dnl Check for GNU Make. We use its extensions too, so don't build without it -AC_CHECK_GNU_MAKE -if test -z "$_cv_gnu_make_command" -then - AC_MSG_ERROR([GNU Make required but not found]) -fi - -dnl Checks for other tools -AC_PROG_FLEX -AC_PROG_BISON -AC_PROG_LIBTOOL - -dnl Checks for tools we can get away with not having: -AC_PATH_PROG(DOT,[dot],[true dot]) -AC_PATH_PROG(ETAGS,[etags],[true etags]) -dnl Check if we know how to tell etags we are using C++: -etags_version=`$ETAGS --version 2>&1` -case "$etags_version" in - *[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;; - *GNU\ Emacs*) ETAGSFLAGS="-l c++" ;; - *) ETAGSFLAGS="" ;; -esac -AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS) -AC_PATH_PROG(PYTHON,[python],[true python]) -if test "$PYTHON" = "false" -then - AC_MSG_WARN([Python is required for the test suite, but it was not found]) -fi -AC_PATH_PROG(QMTEST,[qmtest],[true qmtest]) -if test "$QMTEST" = "false" -then - AC_MSG_WARN([QMTest is required for the test suite, but it was not found]) -fi - -dnl Verify that the version of python available is high enough for qmtest -pyversion=`$PYTHON -V 2>&1 | cut -d\ -f2` -pymajor=`echo $pyversion | cut -d. -f1` -pyminor=`echo $pyversion | cut -d. -f2` - -if test "$pymajor" -ge "2" -then - if test "$pymajor" -eq "2" - then - if test "$pyminor" -lt "2" - then - AC_MSG_WARN([QMTest requires Python 2.2 or later]) - fi - fi -else - AC_MSG_WARN([QMTest requires Python 2.2 or later]) -fi - -dnl Checks for libraries: -dnl libelf is for sparc only; we can ignore it if we don't have it -AC_CHECK_LIB(elf, elf_begin) - -dnl Check for bzip2 and zlib compression libraries needed for archive reading/writing -AC_CHECK_LIB(bz2,BZ2_bzCompressInit,[bzip2_found=1],[bzip2_found=0]) -AC_CHECK_HEADERS([bzlib.h],[bzlib_h_found=1],[bzlib_h_found=0],[]) -AC_CHECK_LIB(z,gzopen,[zlib_found=1],[zlib_found=0]) -AC_CHECK_HEADERS([zlib.h],[zlib_h_found=1],[zlib_h_found=0],[]) -if test $zlib_found -eq 1 -a $zlib_h_found -eq 1; then - AC_DEFINE([HAVE_ZLIB],[1],[Define if zlib library is available on this platform.]) - AC_SUBST([HAVE_ZLIB],[1]) -else - AC_SUBST([HAVE_ZLIB],[0]) -fi -if test $bzip2_found -eq 1 -a $bzlib_h_found -eq 1 ; then - AC_DEFINE([HAVE_BZIP2],[1],[Define if bzip2 library is available on this platform.]) - AC_SUBST([HAVE_BZIP2],[1]) -else - AC_SUBST([HAVE_BZIP2],[0]) -fi -dnl dlopen() is required for plugin support. -AC_SEARCH_LIBS(dlopen,dl,AC_DEFINE([HAVE_DLOPEN],[1],[Define if dlopen() is available on this platform.]),AC_MSG_WARN([dlopen() not found - disabling plugin support])) - -dnl mallinfo is optional; the code can compile (minus features) without it -AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1],[Define if mallinfo() is available on this platform.])) - -dnl pthread locking functions are optional - but llvm will not be thread-safe -dnl without locks. -AC_SEARCH_LIBS(pthread_mutex_lock,pthread,AC_DEFINE([HAVE_PTHREAD_MUTEX_LOCK],[1],[Have pthread_mutex_lock])) -dnl AC_SUBST(HAVE_PTHREAD_MUTEX_LOCK) - -dnl Checks for header files. -dnl We don't check for ancient stuff or things that are guaranteed to be there -dnl by the C++ standard. We always use the versions of C headers. -AC_HEADER_STDC -AC_HEADER_SYS_WAIT - -dnl Checks for POSIX and other various system-specific header files -AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h malloc.h sys/mman.h sys/resource.h dlfcn.h link.h execinfo.h windows.h) - -dnl Check for things that need to be included in public headers, and so -dnl for which we may not have access to a HAVE_* preprocessor #define. -dnl (primarily used in DataTypes.h) -AC_CHECK_HEADER([sys/types.h]) -AC_CHECK_HEADER([inttypes.h]) -AC_CHECK_HEADER([stdint.h]) - -dnl Check for types -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found])) -AC_CHECK_TYPES([uint64_t],, - AC_CHECK_TYPES([u_int64_t],, - AC_MSG_ERROR([Type uint64_t or u_int64_t required but not found]))) -AC_HEADER_TIME -AC_STRUCT_TM - -dnl Check for various C features -AC_C_PRINTF_A - -dnl Check for the endianness of the target -AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little])) - -dnl Check for C++ extensions -AC_CXX_HAVE_HASH_MAP -AC_CXX_HAVE_HASH_SET -AC_CXX_HAVE_STD_ITERATOR -AC_CXX_HAVE_BI_ITERATOR -AC_CXX_HAVE_FWD_ITERATOR - -AC_FUNC_ISNAN -AC_FUNC_ISINF - -dnl Checks for library functions. -AC_FUNC_ALLOCA -AC_FUNC_MMAP -if test "$ac_cv_func_mmap_fixed_mapped" = "no" -then - AC_MSG_WARN([mmap() required but not found]) -fi -AC_FUNC_MMAP_FILE -if test "$ac_cv_func_mmap_file" = "no" -then - AC_MSG_WARN([mmap() of files required but not found]) -fi -AC_HEADER_MMAP_ANONYMOUS -AC_TYPE_SIGNAL -AC_CHECK_FUNCS(getcwd gettimeofday strdup strtoq strtoll backtrace isatty mkstemp getrusage) -AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found])) - -dnl Determine if the linker supports the -R option. -AC_LINK_USE_R - -dnl --enable/--with command-line options: -dnl Check whether they want to do an optimized build: -AC_ARG_ENABLE(optimized,AS_HELP_STRING(--enable-optimized,Compile with optimizations enabled (default is NO)),,enableval=no) -if test ${enableval} = "no" -then - AC_SUBST(ENABLE_OPTIMIZED,[[]]) -else - AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]]) -fi - -dnl JIT Option -AC_ARG_ENABLE(jit,AS_HELP_STRING(--enable-jit,Enable Just In Time Compiling (default is YES)),,enableval=default) -if test ${enableval} = "no" -then - AC_SUBST(JIT,[[]]) -else - case $target in - *i*86*) - AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) - ;; - *sparc*) - AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) - ;; - *) - AC_SUBST(JIT,[[]]) - ;; - esac -fi - -dnl Find the LLVM GCC-based C/C++ front end -AC_ARG_WITH(llvmgccdir,AS_HELP_STRING(--with-llvmgccdir,Location of LLVM GCC front-end),AC_SUBST(LLVMGCCDIR,[$withval])) -AC_MSG_CHECKING([for llvm-gcc]) -LLVM_GCC_CHECK=no -if test -d "$LLVMGCCDIR" -then - if test -x "$LLVMGCCDIR/bin/gcc" - then - LLVM_GCC_CHECK="$LLVMGCCDIR/bin/gcc" - fi -fi -llvmgccwarn=no -AC_MSG_RESULT($LLVM_GCC_CHECK) -if test "$LLVM_GCC_CHECK" = "no" -then - llvmgccwarn=yes -fi -AC_MSG_CHECKING([whether llvm-gcc is sane]) -LLVM_GCC_SANE=no -if test -x "$LLVM_GCC_CHECK" -then - cp /dev/null conftest.c - "$LLVM_GCC_CHECK" -S -o - conftest.c | grep implementation > /dev/null 2>&1 - if test $? -eq 0 - then - LLVM_GCC_SANE=yes - fi - rm conftest.c - llvmcc1path=`"$LLVM_GCC_CHECK" --print-prog-name=cc1` - AC_SUBST(LLVMCC1,$llvmcc1path) - llvmcc1pluspath=`"$LLVM_GCC_CHECK" --print-prog-name=cc1plus` - AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath) -fi -AC_MSG_RESULT($LLVM_GCC_SANE) -if test "$LLVM_GCC_SANE" = "no" -then - llvmgccwarn=yes -fi - -dnl Get libtool's idea of what the shared library suffix is. -dnl (This is a hack; it relies on undocumented behavior.) -AC_MSG_CHECKING([for shared library suffix]) -eval "SHLIBEXT=$shrext_cmds" -AC_MSG_RESULT($SHLIBEXT) -dnl Propagate it to the Makefiles and config.h (for gccld & bugpoint). -AC_SUBST(SHLIBEXT,$SHLIBEXT) -AC_DEFINE_UNQUOTED(SHLIBEXT,"$SHLIBEXT", - [Extension that shared libraries have, e.g., ".so".]) - -# Translate the various configuration directories and other basic -# information into substitutions that will end up in config.h.in so -# that these configured values can be hard-wired into a program. -eval LLVM_PREFIX="${prefix}"; -eval LLVM_BINDIR="${prefix}/bin"; -eval LLVM_LIBDIR="${prefix}/lib"; -eval LLVM_DATADIR="${prefix}/data"; -eval LLVM_DOCSDIR="${prefix}/docs"; -eval LLVM_ETCDIR="${prefix}/etc"; -eval LLVM_INCLUDEDIR="${prefix}/include"; -eval LLVM_INFODIR="${prefix}/info"; -eval LLVM_MANDIR="${prefix}/man"; -LLVM_CONFIGTIME=`date` -AC_SUBST(LLVM_PREFIX) -AC_SUBST(LLVM_BINDIR) -AC_SUBST(LLVM_LIBDIR) -AC_SUBST(LLVM_DATADIR) -AC_SUBST(LLVM_DOCSDIR) -AC_SUBST(LLVM_ETCDIR) -AC_SUBST(LLVM_INCLUDEDIR) -AC_SUBST(LLVM_INFODIR) -AC_SUBST(LLVM_MANDIR) -AC_SUBST(LLVM_CONFIGTIME) -AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX", [Installation prefix directory]) -AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR", [Installation directory for binary executables]) -AC_DEFINE_UNQUOTED(LLVM_LIBDIR, "$LLVM_LIBDIR", [Installation directory for libraries]) -AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR", [Installation directory for data files]) -AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DOCSDIR", [Installation directory for documentation]) -AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR", [Installation directory for config files]) -AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR", [Installation directory for include files]) -AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR", [Installation directory for .info files]) -AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR", [Installation directory for man pages]) -AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME", [Time at which LLVM was configured]) - dnl Create the output files AC_OUTPUT +dnl ===----------------------------------------------------------------------=== +dnl -- SECTION 11: Output warnings to user (always last so they see it) +dnl ===----------------------------------------------------------------------=== + dnl Warn if we don't have a compression library if test $bzip2_found -ne 1 ; then if test $zlib_found -ne 1 ; then AC_MSG_WARN([*** Neither zlib nor bzip2 compression libraries were found.]) AC_MSG_WARN([*** Bytecode archives will not support compression!]) - AC_MSG_WARN([*** To correct, install the libraries and and re-run configure.]) + AC_MSG_WARN([*** To correct, install the libraries and re-run configure.]) fi fi dnl Warn loudly if llvm-gcc was not obviously working if test $llvmgccwarn = yes then - AC_MSG_WARN([***** llvm C/C++ front end was not found, or does not]) - AC_MSG_WARN([***** appear to be working.]) - AC_MSG_WARN([***** ]) - AC_MSG_WARN([***** Please check configure's --with-llvmgccdir option.]) - AC_MSG_WARN([***** Runtime libraries (in llvm/runtime) will not be built,]) - AC_MSG_WARN([***** but you should be able to build the llvm tools.]) + AC_MSG_WARN([***** llvm C/C++ front end was not found, or does not]) + AC_MSG_WARN([***** appear to be working.]) + AC_MSG_WARN([***** ]) + AC_MSG_WARN([***** Please check configure's --with-llvmgccdir option.]) + AC_MSG_WARN([***** Runtime libraries (in llvm/runtime) will not be built,]) + AC_MSG_WARN([***** but you should be able to build the llvm tools.]) fi - diff --git a/autoconf/depcomp b/autoconf/depcomp new file mode 100755 index 00000000000..11e2d3bfe1c --- /dev/null +++ b/autoconf/depcomp @@ -0,0 +1,522 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2004-05-31.23 + +# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. + +# 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, 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 Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit 0 + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit 0 + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + outname="$stripped.o" + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # Dependencies are output in .lo.d with libtool 1.4. + # With libtool 1.5 they are output both in $dir.libs/$base.o.d + # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the + # latter, because the former will be cleaned when $dir.libs is + # erased. + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir$base.o.d" + tmpdepfile3="$dir.libs/$base.d" + "$@" -Wc,-MD + else + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + tmpdepfile3="$dir$base.d" + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + elif test -f "$tmpdepfile2"; then + tmpdepfile="$tmpdepfile2" + else + tmpdepfile="$tmpdepfile3" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/autoconf/install-sh b/autoconf/install-sh index 398a88e1421..dd97db7aa1c 100644 --- a/autoconf/install-sh +++ b/autoconf/install-sh @@ -1,19 +1,38 @@ #!/bin/sh -# # install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). + +scriptversion=2004-09-10.20 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. # -# Copyright 1991 by the Massachusetts Institute of Technology +# Copyright (C) 1994 X Consortium # -# 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. +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in 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: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# 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 +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it @@ -23,13 +42,11 @@ # 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}" @@ -41,211 +58,265 @@ stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" -transformbasename="" -transform_arg="" -instcmd="$mvprog" chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" +chowncmd= +chgrpcmd= +stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" -src="" -dst="" -dir_arg="" +src= +dst= +dir_arg= +dstarg= +no_target_directory= -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... - -d) dir_arg=true - shift - continue;; +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. - -o) chowncmd="$chownprog $2" - shift - shift - continue;; +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; +while test -n "$1"; do + case $1 in + -c) shift + continue;; - -s) stripcmd="$stripprog" - shift - continue;; + -d) dir_arg=true + shift + continue;; - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; + --help) echo "$usage"; exit 0;; - *) 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 + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - : -fi + -o) chowncmd="$chownprog $2" + shift + shift + continue;; -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - chmodcmd="" - else - instcmd=$mkdirprog - fi -else + -s) stripcmd=$stripprog + shift + continue;; -# 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}" + -t) dstarg=$2 shift + shift + continue;; - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - : - fi + -T) no_target_directory=true + shift + continue;; - pathcomp="${pathcomp}/" + --version) echo "$0 $scriptversion"; exit 0;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 fi -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac - 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 test -n "$dir_arg"; then + dst=$src + src= -# If we're going to rename the final executable, determine the name now. + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi -# don't allow the sed command to completely eliminate the filename + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - : - fi + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi -# Make a temp file name in the proper directory. + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - dsttmp=$dstdir/#inst.$$# + # Make sure that the destination directory exists. -# Move or copy the file name to the temp name + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" - $doit $instcmd $src $dsttmp && + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + IFS=$oIFS - trap "rm -f ${dsttmp}" 0 && + pathcomp= -# and set any options; do chmod last to preserve setuid bits + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi -# 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 test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - 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 && + else + dstfile=`basename "$dst"` -# Now rename the file to the real destination. + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 -fi && + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + # 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 $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && -exit 0 + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit; } +done + +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit +} + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/autoconf/missing b/autoconf/missing new file mode 100755 index 00000000000..64b5f901dd5 --- /dev/null +++ b/autoconf/missing @@ -0,0 +1,353 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2004-09-07.08 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004 +# Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 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, 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. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to ." + exit 0 + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit 0 + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case "$1" in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/autoconf/mkinstalldirs b/autoconf/mkinstalldirs index 994d71ce7a7..6fbe5e11762 100755 --- a/autoconf/mkinstalldirs +++ b/autoconf/mkinstalldirs @@ -1,31 +1,56 @@ #! /bin/sh # mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain -# $Id$ +scriptversion=2004-02-15.20 + +# Original author: Noah Friedman +# Created: 1993-05-16 +# Public domain. +# +# This file is maintained in Automake, please report +# bugs to or send patches to +# . errstatus=0 dirmode="" usage="\ -Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." +Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... + +Create each directory DIR (with mode MODE, if specified), including all +leading file name components. + +Report bugs to ." # 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 + case $1 in + -h | --help | --h*) # -h for help + echo "$usage" + exit 0 + ;; + -m) # -m PERM arg + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + dirmode=$1 + shift + ;; + --version) + echo "$0 $scriptversion" + exit 0 + ;; + --) # stop option processing + shift + break + ;; + -*) # unknown option + echo "$usage" 1>&2 + exit 1 + ;; + *) # first non-opt arg + break + ;; + esac done for file @@ -38,64 +63,88 @@ do done case $# in -0) exit 0 ;; + 0) exit 0 ;; esac +# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and +# mkdir -p a/c at the same time, both will detect that a is missing, +# one will create a, then the other will try to create a and die with +# a "File exists" error. This is a problem when calling mkinstalldirs +# from a parallel make. We use --version in the probe to restrict +# ourselves to GNU mkdir, which is thread-safe. 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 ;; + '') + if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + test -d ./-p && rmdir ./-p + test -d ./--version && rmdir ./--version + fi + ;; + *) + if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && + test ! -d ./--version; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + else + # Clean up after NextStep and OpenStep mkdir. + for d in ./-m ./-p ./--version "./$dirmode"; + do + test -d $d && rmdir $d + done + fi + ;; esac for file do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift + 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 + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case $pathcomp in + -*) pathcomp=./$pathcomp ;; + esac - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" - mkdir "$pathcomp" || lasterr=$? + mkdir "$pathcomp" || lasterr=$? - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi + if test ! -z "$lasterr"; then + errstatus=$lasterr fi fi - fi + fi + fi - pathcomp="$pathcomp/" - done + pathcomp="$pathcomp/" + done done exit $errstatus # Local Variables: # mode: shell-script -# sh-indentation: 3 +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" # End: -# mkinstalldirs ends here