Fix autoconf llvm srcdir location for generic projects.
[oota-llvm.git] / projects / sample / autoconf / configure.ac
index c0715ead5cbd66ab037661eb2f6fbffefcbd6486..221dcc45edc0df7f657ce272838d896e8773104a 100644 (file)
@@ -3,14 +3,26 @@ dnl * Initialize
 dnl **************************************************************************
 AC_INIT([[[SAMPLE]]],[[[x.xx]]],[bugs@yourdomain])
 
-dnl Place all of the extra autoconf files into the config subdirectory
-AC_CONFIG_AUX_DIR([autoconf])
+dnl Identify where LLVM source tree is
+LLVM_SRC_ROOT="../../"
+LLVM_OBJ_ROOT="../../"
 
-dnl Configure a header file
+dnl Tell autoconf that this is an LLVM project being configured
+dnl This provides the --with-llvmsrc and --with-llvmobj options
+LLVM_CONFIG_PROJECT($LLVM_SRC_ROOT,$LLVM_OBJ_ROOT)
 
-dnl Configure Makefiles
-dnl List every Makefile that ecists within your source tree
+dnl Tell autoconf that the auxilliary files are actually located in
+dnl the LLVM autoconf directory, not here.
+AC_CONFIG_AUX_DIR($LLVM_SRC/autoconf)
 
+dnl Verify that the source directory is valid
+AC_CONFIG_SRCDIR(["Makefile.common.in"])
+
+dnl Configure a common Makefile
+AC_CONFIG_FILES(Makefile.common)
+
+dnl Configure project makefiles
+dnl List every Makefile that exists within your source tree
 AC_CONFIG_MAKEFILE(Makefile)
 AC_CONFIG_MAKEFILE(lib/Makefile)
 AC_CONFIG_MAKEFILE(lib/sample/Makefile)
@@ -25,9 +37,6 @@ dnl **************************************************************************
 dnl * Check for programs.
 dnl **************************************************************************
 
-dnl Verify that the source directory is valid
-AC_CONFIG_SRCDIR(["Makefile.common.in"])
-
 dnl **************************************************************************
 dnl * Check for libraries.
 dnl **************************************************************************
@@ -52,13 +61,9 @@ dnl **************************************************************************
 dnl * Set the location of various third-party software packages
 dnl **************************************************************************
 
-dnl Location of LLVM source code
-AC_ARG_WITH(llvmsrc,AC_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]),AC_SUBST(LLVM_SRC,[$withval]),AC_SUBST(LLVM_SRC,[`cd ${srcdir}/../..; pwd`]))
-
-dnl Location of LLVM object code
-AC_ARG_WITH(llvmobj,AC_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]),AC_SUBST(LLVM_OBJ,[$withval]),AC_SUBST(LLVM_OBJ,[`cd ../..; pwd`]))
-
 dnl **************************************************************************
 dnl * Create the output files
 dnl **************************************************************************
-AC_OUTPUT(Makefile.common)
+
+dnl This must be last
+AC_OUTPUT