Skip to content

Commit

Permalink
Add version, arch, system libs, and targets to Makefile.config
Browse files Browse the repository at this point in the history
Teach autoconf/configure.ac to AC_SUBST several additional values in
Makefile.config to make them available to Makefile code.  These will
be useful to generate CMake package modules from the Makefile build.

Contributed by Brad King.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201052 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
chapuni committed Feb 9, 2014
1 parent 3e308c8 commit 2fbf9e2
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 20 deletions.
15 changes: 15 additions & 0 deletions Makefile.config.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# Define LLVM specific info and directories based on the autoconf variables
LLVMPackageName := @PACKAGE_TARNAME@
LLVMVersion := @PACKAGE_VERSION@
LLVM_VERSION_MAJOR := @LLVM_VERSION_MAJOR@
LLVM_VERSION_MINOR := @LLVM_VERSION_MINOR@
LLVM_CONFIGTIME := @LLVM_CONFIGTIME@

###########################################################################
Expand Down Expand Up @@ -118,6 +120,7 @@ HOST_ARCH=@HOST_ARCH@
# Target hardware architecture
ARCH=@ARCH@
TARGET_NATIVE_ARCH := $(ARCH)
LLVM_NATIVE_ARCH := @LLVM_NATIVE_ARCH@

# Indicates, whether we're cross-compiling LLVM or not
LLVM_CROSS_COMPILING=@LLVM_CROSS_COMPILING@
Expand Down Expand Up @@ -207,13 +210,22 @@ POD2MAN := @POD2MAN@
PDFROFF := @PDFROFF@
ZIP := @ZIP@

HAVE_LIBZ := @HAVE_LIBZ@
HAVE_DLOPEN := @HAVE_DLOPEN@
HAVE_PTHREAD := @HAVE_PTHREAD@
HAVE_TERMINFO := @HAVE_TERMINFO@

LIBS := @LIBS@

# Targets that are possible to build
ALL_TARGETS := @ALL_TARGETS@

# Targets that we should build
TARGETS_TO_BUILD=@TARGETS_TO_BUILD@

# Targets supporting JIT
TARGETS_WITH_JIT := @TARGETS_WITH_JIT@

# Path to directory where object files should be stored during a build.
# Set OBJ_ROOT to "." if you do not want to use a separate place for
# object files.
Expand Down Expand Up @@ -250,6 +262,9 @@ ENABLE_CLANG_STATIC_ANALYZER = @ENABLE_CLANG_STATIC_ANALYZER@
# When ENABLE_WERROR is enabled, we'll pass -Werror on the command line
ENABLE_WERROR = @ENABLE_WERROR@

# When ENABLE_TERMINFO is enabled, we use terminfo.
ENABLE_TERMINFO = @ENABLE_TERMINFO@

# When ENABLE_OPTIMIZED is enabled, LLVM code is optimized and output is put
# into the "Release" directories. Otherwise, LLVM code is not optimized and
# output is put in the "Debug" directories.
Expand Down
24 changes: 18 additions & 6 deletions autoconf/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ dnl===-----------------------------------------------------------------------===
dnl Initialize autoconf and define the package name, version number and
dnl address for reporting bugs.
AC_INIT([LLVM],[3.5svn],[http://llvm.org/bugs/])
AC_DEFINE([LLVM_VERSION_MAJOR], [3], [Major version of the LLVM API])
AC_DEFINE([LLVM_VERSION_MINOR], [5], [Minor version of the LLVM API])
LLVM_DEFINE_SUBST([LLVM_VERSION_MAJOR], [3], [Major version of the LLVM API])
LLVM_DEFINE_SUBST([LLVM_VERSION_MINOR], [5], [Minor version of the LLVM API])

dnl Provide a copyright substitution and ensure the copyright notice is included
dnl in the output of --version option of the generated configure script.
Expand Down Expand Up @@ -432,6 +432,7 @@ esac

dnl Define a substitution, ARCH, for the target architecture
AC_SUBST(ARCH,$llvm_cv_target_arch)
AC_SUBST(LLVM_NATIVE_ARCH,$LLVM_NATIVE_ARCH)

dnl Determine what our host architecture.
dnl This will allow MCJIT regress tests runs only for supported
Expand Down Expand Up @@ -768,6 +769,9 @@ else
esac
fi

TARGETS_WITH_JIT="AArch64 ARM Mips PowerPC SystemZ X86"
AC_SUBST(TARGETS_WITH_JIT,$TARGETS_WITH_JIT)

dnl Allow enablement of building and installing docs
AC_ARG_ENABLE(docs,
AS_HELP_STRING([--enable-docs],
Expand Down Expand Up @@ -917,6 +921,10 @@ if test "$llvm_cv_enable_crash_overrides" = "yes" ; then
[Define to enable crash handling overrides])
fi

dnl List all possible targets
ALL_TARGETS="X86 Sparc PowerPC AArch64 ARM Mips XCore MSP430 CppBackend NVPTX Hexagon SystemZ R600"
AC_SUBST(ALL_TARGETS,$ALL_TARGETS)

dnl Allow specific targets to be specified for building (or not)
TARGETS_TO_BUILD=""
AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],
Expand All @@ -928,7 +936,7 @@ if test "$enableval" = host-only ; then
enableval=host
fi
case "$enableval" in
all) TARGETS_TO_BUILD="X86 Sparc PowerPC AArch64 ARM Mips XCore MSP430 CppBackend NVPTX Hexagon SystemZ R600" ;;
all) TARGETS_TO_BUILD="$ALL_TARGETS" ;;
*)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do
case "$a_target" in
x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
Expand Down Expand Up @@ -1189,6 +1197,10 @@ AC_ARG_ENABLE(terminfo,AS_HELP_STRING(
*) AC_MSG_ERROR([Invalid setting for --enable-terminfo. Use "yes" or "no"]) ;;
esac],
llvm_cv_enable_terminfo="yes")
case "$llvm_cv_enable_terminfo" in
yes) AC_SUBST(ENABLE_TERMINFO,[1]) ;;
no) AC_SUBST(ENABLE_TERMINFO,[0]) ;;
esac

dnl --enable-libedit: check whether the user wants to turn off libedit.
AC_ARG_ENABLE(libedit,AS_HELP_STRING(
Expand Down Expand Up @@ -1500,7 +1512,7 @@ if test "$llvm_cv_os_type" = "MingW" ; then
fi

dnl dlopen() is required for plugin support.
AC_SEARCH_LIBS(dlopen,dl,AC_DEFINE([HAVE_DLOPEN],[1],
AC_SEARCH_LIBS(dlopen,dl,LLVM_DEFINE_SUBST([HAVE_DLOPEN],[1],
[Define if dlopen() is available on this platform.]),
AC_MSG_WARN([dlopen() not found - disabling plugin support]))

Expand All @@ -1513,8 +1525,8 @@ dnl The curses library is optional; used for querying terminal info
if test "$llvm_cv_enable_terminfo" = "yes" ; then
dnl We need the has_color functionality in curses for it to be useful.
AC_SEARCH_LIBS(setupterm,tinfo terminfo curses ncurses ncursesw,
AC_DEFINE([HAVE_TERMINFO],[1],
[Define if the setupterm() function is supported this platform.]))
LLVM_DEFINE_SUBST([HAVE_TERMINFO],[1],
[Define if the setupterm() function is supported this platform.]))
fi

dnl The libedit library is optional; used by lib/LineEditor
Expand Down
5 changes: 5 additions & 0 deletions autoconf/m4/define_subst.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Combine AC_DEFINE and AC_SUBST
AC_DEFUN([LLVM_DEFINE_SUBST], [
AC_DEFINE([$1], [$2], [$3])
AC_SUBST([$1], ['$2'])
])
Loading

0 comments on commit 2fbf9e2

Please sign in to comment.