1# generated automatically by aclocal 1.16.3 -*- Autoconf -*- 2 3# Copyright (C) 1996-2020 Free Software Foundation, Inc. 4 5# This file is free software; the Free Software Foundation 6# gives unlimited permission to copy and/or distribute it, 7# with or without modifications, as long as this notice is preserved. 8 9# This program is distributed in the hope that it will be useful, 10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without 11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A 12# PARTICULAR PURPOSE. 13 14m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) 15# Check for the extension used for executables on build platform. 16# This is necessary for cross-compiling where the build platform 17# may differ from the host platform. 18AC_DEFUN([AC_BUILD_EXEEXT], 19[ 20AC_MSG_CHECKING([for executable suffix on build platform]) 21AC_CACHE_VAL(ac_cv_build_exeext, 22[if test "$CYGWIN" = yes || test "$MINGW32" = yes; then 23 ac_cv_build_exeext=.exe 24else 25 ac_build_prefix=${build_alias}- 26 27 AC_CHECK_PROG(BUILD_CC, ${ac_build_prefix}gcc, ${ac_build_prefix}gcc) 28 if test -z "$BUILD_CC"; then 29 AC_CHECK_PROG(BUILD_CC, gcc, gcc) 30 if test -z "$BUILD_CC"; then 31 AC_CHECK_PROG(BUILD_CC, cc, cc, , , /usr/ucb/cc) 32 fi 33 fi 34 test -z "$BUILD_CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) 35 ac_build_link='${BUILD_CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AS_MESSAGE_LOG_FD' 36 rm -f conftest* 37 echo 'int main () { return 0; }' > conftest.$ac_ext 38 ac_cv_build_exeext= 39 if AC_TRY_EVAL(ac_build_link); then 40 for file in conftest.*; do 41 case $file in 42 *.c | *.o | *.obj | *.dSYM) ;; 43 *) ac_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; 44 esac 45 done 46 else 47 AC_MSG_ERROR([installation or configuration problem: compiler cannot create executables.]) 48 fi 49 rm -f conftest* 50 test x"${ac_cv_build_exeext}" = x && ac_cv_build_exeext=blank 51fi]) 52BUILD_EXEEXT="" 53test x"${ac_cv_build_exeext}" != xblank && BUILD_EXEEXT=${ac_cv_build_exeext} 54AC_MSG_RESULT(${ac_cv_build_exeext}) 55ac_build_exeext=$BUILD_EXEEXT 56AC_SUBST(BUILD_EXEEXT)]) 57 58# 59# Check for GNU Make. This is originally from 60# http://www.gnu.org/software/ac-archive/htmldoc/check_gnu_make.html 61# 62AC_DEFUN([AC_CHECK_GNU_MAKE], 63[AC_CACHE_CHECK([for GNU make],[llvm_cv_gnu_make_command], 64dnl Search all the common names for GNU make 65[llvm_cv_gnu_make_command='' 66 for a in "$MAKE" make gmake gnumake ; do 67 if test -z "$a" ; then continue ; fi ; 68 if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) 69 then 70 llvm_cv_gnu_make_command=$a ; 71 break; 72 fi 73 done]) 74dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, 75dnl '#' otherwise 76 if test "x$llvm_cv_gnu_make_command" != "x" ; then 77 ifGNUmake='' ; 78 else 79 ifGNUmake='#' ; 80 AC_MSG_RESULT("Not found"); 81 fi 82 AC_SUBST(ifGNUmake) 83]) 84 85AC_DEFUN([CXX_FLAG_CHECK], 86 [AC_SUBST($1, `$CXX -Werror patsubst($2, [^-Wno-], [-W]) -fsyntax-only -xc /dev/null 2>/dev/null && echo $2`)]) 87 88# Combine AC_DEFINE and AC_SUBST 89AC_DEFUN([LLVM_DEFINE_SUBST], [ 90AC_DEFINE([$1], [$2], [$3]) 91AC_SUBST([$1], ['$2']) 92]) 93 94# 95# This function determins if the HUGE_VAL macro is compilable with the 96# -pedantic switch or not. XCode < 2.4.1 doesn't get it right. 97# 98AC_DEFUN([AC_HUGE_VAL_CHECK],[ 99 AC_CACHE_CHECK([for HUGE_VAL sanity], [ac_cv_huge_val_sanity],[ 100 AC_LANG_PUSH([C++]) 101 ac_save_CXXFLAGS=$CXXFLAGS 102 CXXFLAGS="$CXXFLAGS -pedantic" 103 AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], 104 [[double x = HUGE_VAL; return x != x;]])], 105 [ac_cv_huge_val_sanity=yes],[ac_cv_huge_val_sanity=no], 106 [ac_cv_huge_val_sanity=yes]) 107 CXXFLAGS=$ac_save_CXXFLAGS 108 AC_LANG_POP([C++]) 109 ]) 110 AC_SUBST(HUGE_VAL_SANITY,$ac_cv_huge_val_sanity) 111]) 112 113# 114# Get the linker version string. 115# 116# This macro is specific to LLVM. 117# 118AC_DEFUN([AC_LINK_GET_VERSION], 119 [AC_CACHE_CHECK([for linker version],[llvm_cv_link_version], 120 [ 121 version_string="$(${LD:-ld} -v 2>&1 | head -1)" 122 123 # Check for ld64. 124 if (echo "$version_string" | grep -q "ld64"); then 125 llvm_cv_link_version=$(echo "$version_string" | sed -e "s#.*ld64-\([^ ]*\)\( (.*)\)\{0,1\}#\1#") 126 else 127 llvm_cv_link_version=$(echo "$version_string" | sed -e "s#[^0-9]*\([0-9.]*\).*#\1#") 128 fi 129 ]) 130 AC_DEFINE_UNQUOTED([HOST_LINK_VERSION],"$llvm_cv_link_version", 131 [Linker version detected at compile time.]) 132]) 133 134# 135# Determine if the system can handle the -R option being passed to the linker. 136# 137# This macro is specific to LLVM. 138# 139AC_DEFUN([AC_LINK_USE_R], 140[AC_CACHE_CHECK([for compiler -Wl,-R<path> option],[llvm_cv_link_use_r], 141[ AC_LANG_PUSH([C]) 142 oldcflags="$CFLAGS" 143 CFLAGS="$CFLAGS -Wl,-R." 144 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])], 145 [llvm_cv_link_use_r=yes],[llvm_cv_link_use_r=no]) 146 CFLAGS="$oldcflags" 147 AC_LANG_POP([C]) 148]) 149if test "$llvm_cv_link_use_r" = yes ; then 150 AC_DEFINE([HAVE_LINK_R],[1],[Define if you can use -Wl,-R. to pass -R. to the linker, in order to add the current directory to the dynamic linker search path.]) 151 fi 152]) 153 154# 155# Determine if the system can handle the -rdynamic option being passed 156# to the compiler. 157# 158# This macro is specific to LLVM. 159# 160AC_DEFUN([AC_LINK_EXPORT_DYNAMIC], 161[AC_CACHE_CHECK([for compiler -rdynamic option], 162 [llvm_cv_link_use_export_dynamic], 163[ AC_LANG_PUSH([C]) 164 oldcflags="$CFLAGS" 165 CFLAGS="$CFLAGS -rdynamic" 166 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])], 167 [llvm_cv_link_use_export_dynamic=yes],[llvm_cv_link_use_export_dynamic=no]) 168 CFLAGS="$oldcflags" 169 AC_LANG_POP([C]) 170]) 171if test "$llvm_cv_link_use_export_dynamic" = yes ; then 172 AC_DEFINE([HAVE_LINK_EXPORT_DYNAMIC],[1],[Define if you can use -rdynamic.]) 173 fi 174]) 175 176# 177# Determine if the system can handle the --version-script option being 178# passed to the linker. 179# 180# This macro is specific to LLVM. 181# 182AC_DEFUN([AC_LINK_VERSION_SCRIPT], 183[AC_CACHE_CHECK([for compiler -Wl,--version-script option], 184 [llvm_cv_link_use_version_script], 185[ AC_LANG_PUSH([C]) 186 oldcflags="$CFLAGS" 187 188 # The following code is from the autoconf manual, 189 # "11.13: Limitations of Usual Tools". 190 # Create a temporary directory $tmp in $TMPDIR (default /tmp). 191 # Use mktemp if possible; otherwise fall back on mkdir, 192 # with $RANDOM to make collisions less likely. 193 : ${TMPDIR=/tmp} 194 { 195 tmp=` 196 (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null 197 ` && 198 test -n "$tmp" && test -d "$tmp" 199 } || { 200 tmp=$TMPDIR/foo$$-$RANDOM 201 (umask 077 && mkdir "$tmp") 202 } || exit $? 203 204 echo "{" > "$tmp/export.map" 205 echo " global: main;" >> "$tmp/export.map" 206 echo " local: *;" >> "$tmp/export.map" 207 echo "};" >> "$tmp/export.map" 208 209 CFLAGS="$CFLAGS -Wl,--version-script=$tmp/export.map" 210 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])], 211 [llvm_cv_link_use_version_script=yes],[llvm_cv_link_use_version_script=no]) 212 rm "$tmp/export.map" 213 rmdir "$tmp" 214 CFLAGS="$oldcflags" 215 AC_LANG_POP([C]) 216]) 217if test "$llvm_cv_link_use_version_script" = yes ; then 218 AC_SUBST(HAVE_LINK_VERSION_SCRIPT,1) 219 fi 220]) 221 222 223# 224# Some Linux machines run a 64-bit kernel with a 32-bit userspace. 'uname -m' 225# shows these as x86_64. Ask the system 'gcc' what it thinks. 226# 227AC_DEFUN([AC_IS_LINUX_MIXED], 228[AC_CACHE_CHECK(for 32-bit userspace on 64-bit system,llvm_cv_linux_mixed, 229[ AC_LANG_PUSH([C]) 230 AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 231 [[#ifndef __x86_64__ 232 error: Not x86-64 even if uname says so! 233 #endif 234 ]])], 235 [llvm_cv_linux_mixed=no], 236 [llvm_cv_linux_mixed=yes]) 237 AC_LANG_POP([C]) 238]) 239]) 240 241# 242# Determine if the compiler accepts -fvisibility-inlines-hidden 243# 244# This macro is specific to LLVM. 245# 246AC_DEFUN([AC_CXX_USE_VISIBILITY_INLINES_HIDDEN], 247[AC_CACHE_CHECK([for compiler -fvisibility-inlines-hidden option], 248 [llvm_cv_cxx_visibility_inlines_hidden], 249[ AC_LANG_PUSH([C++]) 250 oldcxxflags="$CXXFLAGS" 251 CXXFLAGS="$CXXFLAGS -O0 -fvisibility-inlines-hidden -Werror" 252 AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 253 [template <typename T> struct X { void __attribute__((noinline)) f() {} };], 254 [X<int>().f();])], 255 [llvm_cv_cxx_visibility_inlines_hidden=yes],[llvm_cv_cxx_visibility_inlines_hidden=no]) 256 CXXFLAGS="$oldcxxflags" 257 AC_LANG_POP([C++]) 258]) 259if test "$llvm_cv_cxx_visibility_inlines_hidden" = yes ; then 260 AC_SUBST([ENABLE_VISIBILITY_INLINES_HIDDEN],[1]) 261else 262 AC_SUBST([ENABLE_VISIBILITY_INLINES_HIDDEN],[0]) 263fi 264]) 265 266