3,966 changes: 2,079 additions & 1,887 deletions configure

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#
# In general, the safest way to proceed is to run the following:
# % aclocal -I . && autoheader && autoconf && automake --add-missing
# % aclocal -I . && autoheader && autoconf && automake --add-missing -c

AC_PREREQ([2.68])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AC_INIT([AutoFDO], [0.14], [autofdo@googlegroups.com])
AC_CONFIG_MACRO_DIR([m4])
AM_CONFIG_HEADER(glog/src/config.h)
AC_CONFIG_HEADERS(config.h glog/src/config.h)
AM_INIT_AUTOMAKE([subdir-objects])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_RANLIB

AX_CXX_COMPILE_STDCXX_11
AM_INIT_AUTOMAKE([subdir-objects])
AX_LLVM([ProfileData])

ac_cv_have_libgflags=1
AC_DEFINE(HAVE_LIB_GFLAGS, 1, [define if you have google gflags library])
Expand Down
3 changes: 3 additions & 0 deletions glog/src/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
/* define if you have google gflags library */
#undef HAVE_LIB_GFLAGS

/* define if the LLVM library is available */
#undef HAVE_LLVM

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

Expand Down
9 changes: 9 additions & 0 deletions glog/src/windows/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,24 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

/* Define to 1 if you have the `crypto' library (-lcrypto). */
#undef HAVE_LIBCRYPTO

/* Define to 1 if you have the <libunwind.h> header file. */
#undef HAVE_LIBUNWIND_H

/* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ

/* define if you have google gflags library */
#undef HAVE_LIB_GFLAGS

/* define if you have libunwind */
#undef HAVE_LIB_UNWIND

/* Define if there is a working LLVM library. */
#undef HAVE_LLVM

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

Expand Down
133 changes: 133 additions & 0 deletions m4/ax_llvm.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# ===========================================================================
# Based on http://www.gnu.org/software/autoconf-archive/ax_llvm.html
# Modifications by Diego Novillo <dnovillo@google.com>
# ===========================================================================
#
# SYNOPSIS
#
# AX_LLVM([llvm-libs])
#
# DESCRIPTION
#
# Test for the existance of llvm, and make sure that it can be linked with
# the llvm-libs argument that is passed on to llvm-config i.e.:
#
# llvm-config --libs <llvm-libs>
#
# llvm-config will also include any libraries that are depended upon.
#
# LICENSE
#
# Copyright (c) 2008 Andy Kitchen <agimbleinthewabe@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.

#serial 12

AC_DEFUN([AX_LLVM],
[
AC_ARG_WITH(
[llvm],
AS_HELP_STRING(
[--with-llvm@<:@=PATH-TO-LLVM-CONFIG@:>@],
[ use LLVM libraries (default is yes). It is possible to specify the
full path to the llvm-config binary. If not given, llvm-config will be
searched in your path.
]),
[
if test "$withval" = "no"; then
want_llvm="no"
elif test "$withval" = "yes"; then
want_llvm="yes"
ac_llvm_config_path=$(which llvm-config)
else
want_llvm="yes"
ac_llvm_config_path="$withval"
fi
],
[want_llvm="yes"]
)
succeeded=no
if test -z "$ac_llvm_config_path"; then
ac_llvm_config_path=$(which llvm-config)
fi
if test "x$want_llvm" = "xyes"; then
if test -f "$ac_llvm_config_path"; then
LLVM_CXXFLAGS=$($ac_llvm_config_path --cppflags)
shared_mode=$($ac_llvm_config_path --shared-mode)
rpath=""
if test "x$shared_mode" = "xstatic"; then
LLVM_LDFLAGS="$($ac_llvm_config_path --ldflags) \
$($ac_llvm_config_path --libs $1) \
-ldl -lpthread -ltinfo"
elif test "x$shared_mode" = "xshared"; then
rpath="$($ac_llvm_config_path --libdir)"
LLVM_LDFLAGS="-rpath $rpath \
$($ac_llvm_config_path --ldflags) \
$($ac_llvm_config_path --libs $1)"
fi
AC_REQUIRE([AC_PROG_CXX])
CXXFLAGS_SAVED="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $LLVM_CXXFLAGS"
export CXXFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $LLVM_LDFLAGS"
export LDFLAGS
AC_CACHE_CHECK(
whether we can compile and link with llvm([$1]),
ax_cv_llvm,
[
AC_LANG_PUSH([C++])
AC_LINK_IFELSE(
[
AC_LANG_PROGRAM(
[[#include "llvm/ProfileData/SampleProf.h"]],
[[
llvm::sampleprof::SampleRecord *R;
R = new llvm::sampleprof::SampleRecord();
return llvm::sampleprof::SPVersion();
]]
)
],
ax_cv_llvm=yes,
ax_cv_llvm=no
)
AC_LANG_POP([C++])
]
)
if test "x$ax_cv_llvm" = "xyes"; then
succeeded=yes
fi
CXXFLAGS="$CXXFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
if test "x$shared_mode" = "xstatic"; then
AC_MSG_NOTICE([Using static LLVM libraries.])
elif test "x$shared_mode" = "xshared"; then
AC_MSG_NOTICE([Using shared LLVM libraries. Setting -rpath to $rpath.])
else
AC_MSG_ERROR([Could not determine whether to use shared or static LLVM libraries])
fi
else
succeeded=no
fi
fi
if test "$succeeded" != "yes" ; then
AC_MSG_WARN(
[[could not detect the LLVM libraries. Support for LLVM profiles disabled.]]
)
else
AC_SUBST(LLVM_CXXFLAGS)
AC_SUBST(LLVM_LDFLAGS)
AC_DEFINE(HAVE_LLVM,,[define if the LLVM library is available])
fi
])