Author: reid Date: Thu Jul 19 03:31:53 2007 New Revision: 40045 URL: http://llvm.org/viewvc/llvm-project?rev=40045&view=rev Log: Move stuff out of configure.ac that ought to be in module_support.m4 so that other modules can have the benefit too.
Modified: support/trunk/autoconf/configure.ac support/trunk/autoconf/m4/module_support.m4 Modified: support/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/support/trunk/autoconf/configure.ac?rev=40045&r1=40044&r2=40045&view=diff ============================================================================== --- support/trunk/autoconf/configure.ac (original) +++ support/trunk/autoconf/configure.ac Thu Jul 19 03:31:53 2007 @@ -33,26 +33,13 @@ dnl===-----------------------------------------------------------------------=== dnl Initialize autoconf and define the package name, version number and dnl email address for reporting bugs. -AC_INIT([[Support Module]],[[2.1svn]],[http://llvm.org/bugs],[llvm-support]) +AC_INIT([[Support Module]],[[2.1svn]],[http://llvm.org/bugs],[support]) THIS_IS_LLVM_MODULE([support]) -dnl Provide a copyright substitution and ensure the copyright notice is included -dnl in the output of --version option of the generated configure script. -AC_SUBST(LLVM_COPYRIGHT,["Copyright (c) 2003-2007 University of Illinois at Urbana-Champaign."]) -AC_COPYRIGHT([Copyright (c) 2003-2007 University of Illinois at Urbana-Champaign.]) - -dnl Indicate that we require autoconf 2.59 or later. Ths is needed because we -dnl use some autoconf macros only available in 2.59. -AC_PREREQ(2.60) - dnl Verify that the source directory is valid. This makes sure that we are dnl configuring LLVM and not some other package (it validates --srcdir argument) AC_CONFIG_SRCDIR([lib/System/Path.cpp]) -dnl Place all of the extra autoconf files into the config subdirectory. Tell -dnl various tools where the m4 autoconf macros are. -AC_CONFIG_AUX_DIR([autoconf]) - dnl Quit if the source directory has already been configured. dnl NOTE: This relies upon undocumented autoconf behavior. if test ${srcdir} != "." ; then @@ -729,7 +716,6 @@ 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) @@ -739,7 +725,6 @@ AC_SUBST(LLVM_INCLUDEDIR) AC_SUBST(LLVM_INFODIR) AC_SUBST(LLVM_MANDIR) -AC_SUBST(LLVM_CONFIGTIME) # Place the various directores into the config.h file as #defines so that we # can know about the installation paths within LLVM. Modified: support/trunk/autoconf/m4/module_support.m4 URL: http://llvm.org/viewvc/llvm-project/support/trunk/autoconf/m4/module_support.m4?rev=40045&r1=40044&r2=40045&view=diff ============================================================================== --- support/trunk/autoconf/m4/module_support.m4 (original) +++ support/trunk/autoconf/m4/module_support.m4 Thu Jul 19 03:31:53 2007 @@ -1,41 +1,112 @@ -dnl -dnl Provide the arguments and other processing needed for an LLVM module -dnl -dnl This script must be used after AC_INIT. It sets up various LLVM_MODULE -dnl variables, extracts the module's dependencies, validates the directory -dnl is correct, etc. +# +# Provide the arguments and other processing needed for an LLVM module +# +# This script must be used after AC_INIT. It checks various axioms, sets up +# various LLVM_MODULE variables, extracts the module's dependencies, validates +# the directory is correct, etc. AC_DEFUN([THIS_IS_LLVM_MODULE],[ + +dnl Get the llvm-top directory which is just any directory that contains all +dnl the modules and doesn't have to be an llvm-top checked out thing. This is +dnl important because its how we find all the modules. To support building a +dnl module in an obtuse place (other than llvm-top) we provide the +dnl with-llvm-top=/path/to/llvm/top option to allow the configure script to +dnl be told where it is. However, the default ".." usually just works. + LLVM_TOP=`cd .. ; pwd` + AC_ARG_WITH(llvm-top, + AS_HELP_STRING([--with-llvm-top], + [Specify where the llvm-top directory is]),,withval=default) + case "$withval" in + default) ;; dnl nothing to do, LLVM_TOP already defaulted + *) LLVM_TOP=$withval ;; + esac + if test ! -d "$LLVM_TOP" ; then + AC_MSG_ERROR("The LLVM_TOP directory ($LLVM_TOP) is not a directory!") + fi + AC_SUBST(LLVM_TOP,[$LLVM_TOP]) + +dnl Make sure we can find the support/autoconf dir .. everything depends on it! + if test ! -d "$LLVM_TOP/support/autoconf" ; then + AC_MSG_ERROR("Your llvm-top directory needs to have the support module checked out") + fi + +dnl We have a standardized auxilliary directory in LLVM so that we only need +dnl one copy of the various tools found there instead of copying them to all +dnl the modules as well. The support/autoconf directory is specified here as +dnl the auxilliary directory which must contain install-sh at least. + AC_CONFIG_AUX_DIR($LLVM_TOP/support/autoconf) + +dnl This stuff is based on autoconf 2.60, enforce it. + AC_PREREQ(2.60) + +dnl Get the copyright in a substitution variable + AC_SUBST(LLVM_COPYRIGHT,["Copyright (c) 2003-2007 University of Illinois at Urbana-Champaign."]) + +dnl Declare the copyright to autoconf + AC_COPYRIGHT([Copyright (c) 2003-2007 University of Illinois at Urbana-Champaign.]) + +dnl Set up the LLVM_MODULE_NAME variables. The NAME comes from the argument to +dnl this macro and should be the name of the module's directory. We verify that. +dnl This is necessary because we expect modules to be in a directory that is +dnl the official name of the modules. If they are not the construction of paths +dnl can go wrong. LLVM_MODULE_NAME="$1" + cwd=`pwd` + if test `basename $cwd` != "$1" ; then + AC_MSG_ERROR([Module $1 is checked out to $cwd which is not allowed]) + fi + AC_SUBST(LLVM_MODULE_NAME,"$1") + +dnl Set up other LLVM_MODULE_* variables that are copies of the values provided +dnl to the AC_INIT macro. LLVM_MODULE_FULLNAME="AC_PACKAGE_NAME" LLVM_MODULE_TARNAME="AC_PACKAGE_TARNAME" LLVM_MODULE_VERSION="AC_PACKAGE_VERSION" LLVM_MODULE_BUGREPORT="AC_PACKAGE_BUGREPORT" - LLVM_TOP=`cd .. ; pwd` + AC_SUBST(LLVM_MODULE_FULLNAME,"AC_PACKAGE_NAME") + AC_SUBST(LLVM_MODULE_TARNAME,"AC_PACKAGE_TARNAME") + AC_SUBST(LLVM_MODULE_VERSION,"AC_PACKAGE_VERSION") + AC_SUBST(LLVM_MODULE_BUGREPORT,"AC_PACKAGE_BUGREPORT") + +dnl We need to know which modules depend on this one. Fortunately, every module +dnl is required to document that in the ModuleInfo.txt file so we just extract +dnl it. LLVM_MODULE_DEPENDS_ON=`grep DepModules: ModuleInfo.txt | \ sed 's/DepModules: *//'` + for x in $LLVM_MODULE_DEPENDS_ON ; do + AC_MSG_NOTICE([$1 depends on $x]) + dnl we should probably validate the module names, but that would require + dnl several round trips via subversion .. slowness. + done + AC_SUBST(LLVM_MODULE_DEPENDS_ON,"$LLVM_MODULE_DEPENDS_ON") AC_CONFIG_SRCDIR([$2]) + +dnl The module can have a Makefile.config.in or a Makefile.common.in. In fact, +dnl it must have one of the two. Set these up to be configured and check thatw +dnl we have at least one. + has_configured_makefile=0 if test -r Makefile.config.in ; then AC_CONFIG_FILES([Makefile.config]) + has_configured_makefile=1 fi if test -r Makefile.common.in ; then AC_CONFIG_FILES([Makefile.common]) + has_configured_makefile=1 fi - AC_SUBST(LLVM_TOP,[$LLVM_TOP]) - AC_SUBST(LLVM_MODULE_NAME,"$1") - AC_SUBST(LLVM_MODULE_FULLNAME,"AC_PACKAGE_NAME") - AC_SUBST(LLVM_MODULE_TARNAME,"AC_PACKAGE_TARNAME") - AC_SUBST(LLVM_MODULE_VERSION,"AC_PACKAGE_VERSION") - AC_SUBST(LLVM_MODULE_BUGREPORT,"AC_PACKAGE_BUGREPORT") - AC_SUBST(LLVM_MODULE_DEPENDS_ON,"$LLVM_MODULE_DEPENDS_ON") - AC_ARG_WITH([llvmsrc], - AS_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]), - [llvm_src="$withval"],[llvm_src="]$1["]) - AC_SUBST(LLVM_SRC,$llvm_src) - AC_ARG_WITH([llvmobj], - AS_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]), - [llvm_obj="$withval"],[llvm_obj="]$2["]) - AC_SUBST(LLVM_OBJ,$llvm_obj) + if test "$has_configured_makefile" -eq 0 ; then + AC_MSG_ERROR("Your module is lacking a Makefile.common.in or Makefile.config.in file to hold configured variables") + fi + +dnl This is a quirky thing. This is basically getting the LLVM_TOP variable +dnl into the start of the config.status script which otherwise contains nothing +dnl from the configure script except things like srcdir and prefix. We need +dnl this for the CONFIG_LLVM_MAKEFILE which has to find the mkinstalldirs +dnl program in the support module's autoconf directory. AC_CONFIG_COMMANDS([setup],,[LLVM_TOP="${LLVM_TOP}"]) + +dnl Get the approximate time of configuration so it can be substituted + LLVM_CONFIGTIME=`date` + AC_SUBST(LLVM_CONFIGTIME) ]) dnl _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits