[llvm-commits] [llvm-top] r38519 - in /llvm-top/trunk: configure library.sh

Reid Spencer reid at x10sys.com
Tue Jul 10 19:58:34 PDT 2007


Author: reid
Date: Tue Jul 10 21:58:34 2007
New Revision: 38519

URL: http://llvm.org/viewvc/llvm-project?rev=38519&view=rev
Log:
Add support for the configure script. This will checkout and configure the
modules specified on the command line as well as any of their dependencies.
The configuration commands come from the ModuleInfo.txt file in each module.

Added:
    llvm-top/trunk/configure   (with props)
Modified:
    llvm-top/trunk/library.sh

Added: llvm-top/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/llvm-top/trunk/configure?rev=38519&view=auto

==============================================================================
--- llvm-top/trunk/configure (added)
+++ llvm-top/trunk/configure Tue Jul 10 21:58:34 2007
@@ -0,0 +1,52 @@
+#!/bin/sh
+#                               configure script
+# 
+# This file was developed by Reid Spencer and is distributed under the
+# University of Illinois Open Source License. See LICENSE.TXT for details.
+# 
+#===------------------------------------------------------------------------===#
+# This script allows LLVM modules to be configured including processing 
+# dependencies and optional configuration parameters. Use it like this:
+#
+#    cd llvm-top
+#    ./configure {module_names} {configure_options}
+#
+# where:
+#    {module_names} is a list of modules you want to configure (e.g. llvm, hlvm)
+#    {configure_options} is any options you want to pass to *all* the modules
+#      when they run their configure commands
+#
+# Note that the script will checkout and configure any dependent modules as well
+# as the ones specified in {module_names} so it is only necessary to specify the
+# minimal set you're interested in.
+
+# Get the library code
+. ./library.sh
+
+# Process the arguments so that anything starting with - is passed down to the
+# configure scripts while anything else is a module name. Collect the arguments
+# in appropriate variables for later use.
+for arg in "$@" ; do 
+  case "$arg" in
+    -*)
+      CONFIGURE_ARGS="$CONFIGURE_ARGS $arg"
+      ;;
+    *)
+      MODULE_NAMES="$MODULE_NAMES $arg"
+  esac
+done
+
+# Get (and possibly check out) the set of modules and their dependencies. This
+# sets the MODULE_DEPENDENCIES variable to the set of module names that should
+# be configured, in the correct order (least dependent first, no duplicates).
+MODULE_DEPENDENCIES=""
+get_dependencies $MODULE_NAMES
+
+# Now that we have a list of dependent modules, we must configure each of them
+# according to the specifications of the module.
+for mod in $MODULE_DEPENDENCIES ; do
+  configure_module "$mod" "$CONFIGURE_ARGS"
+done
+
+# Just indicate what modules we configured
+echo Modules configured:"$MODULE_DEPENDENCIES".

Propchange: llvm-top/trunk/configure

------------------------------------------------------------------------------
    svn:executable = *

Modified: llvm-top/trunk/library.sh
URL: http://llvm.org/viewvc/llvm-project/llvm-top/trunk/library.sh?rev=38519&r1=38518&r2=38519&view=diff

==============================================================================
--- llvm-top/trunk/library.sh (original)
+++ llvm-top/trunk/library.sh Tue Jul 10 21:58:34 2007
@@ -67,10 +67,12 @@
     mi="$module/ModuleInfo.txt"
     dep_modules=""
     if test -f "$mi" ; then
-      dep_modules=`grep -i DepModule: $mi | sed 's/DepModule: *//g'`
+      dep_modules=`grep -i DepModule: $mi | sed -e 's/DepModule: *//g'`
       if test "$?" -ne 0 ; then 
         die $? "Searching file '$mi' failed."
       fi
+    else
+      msg 0 "Module $module has not ModuleInfo.txt file"
     fi
     if test ! -z "$dep_modules" ; then
       msg 1 "Module '$module' depends on $dep_modules"
@@ -89,3 +91,38 @@
   done
   return 0
 }
+
+configure_module() {
+  module="$1"
+  config_opts="$2"
+  if test ! -d "$module" ; then
+    die 1 "Module $module did not get checked out!"
+  fi
+  LLVM_TOP=`pwd`
+  MODULE_INFO="$LLVM_TOP/$module/ModuleInfo.txt"
+  INSTALL_PREFIX="$LLVM_TOP/install"
+  if test -f "$MODULE_INFO" ; then
+    config_command=`grep -i ConfigCmd: $MODULE_INFO | sed -e 's/ConfigCmd: //'`
+    config_file=`grep -i ConfigFile: $mi | sed -e 's/ConfigFile: //'`
+  fi
+  if test -z "$config_command" ; then
+    msg 0 "Module $module has no ConfigCmd entry so it won't be configured"
+    return 0
+  fi
+  cd $module
+  if test -e "$config_file" ; then
+    msg 0 "Module $module is already configured"
+  else
+    config_command=`echo $config_command $config_opts | sed \
+      -e "s#@LLVM_TOP@#$LLVM_TOP#g" \
+      -e "s#@INSTALL_PREFIX@#$INSTALL_PREFIX#g" \
+      -e "s#@CONFIG_OPTS@#$config_opts#g"`
+    if test "$?" -ne 0 ; then 
+      die $? "Failed to generate configure command"
+    fi
+    msg 0 "Configuring Module $module with this command:"
+    msg 0 "  $config_command"
+    $config_command || die $? "Can't configure $module"
+  fi
+  cd $LLVM_TOP
+}





More information about the llvm-commits mailing list