1*6a54128fSAndroid Build Coastguard Worker# from http://autoconf-archive.cryp.to/ax_tls.html 2*6a54128fSAndroid Build Coastguard Worker# 3*6a54128fSAndroid Build Coastguard Worker# This was licensed under the GPL with the following exception: 4*6a54128fSAndroid Build Coastguard Worker# 5*6a54128fSAndroid Build Coastguard Worker# As a special exception, the respective Autoconf Macro's copyright 6*6a54128fSAndroid Build Coastguard Worker# owner gives unlimited permission to copy, distribute and modify the 7*6a54128fSAndroid Build Coastguard Worker# configure scripts that are the output of Autoconf when processing 8*6a54128fSAndroid Build Coastguard Worker# the Macro. You need not follow the terms of the GNU General Public 9*6a54128fSAndroid Build Coastguard Worker# License when using or distributing such scripts, even though 10*6a54128fSAndroid Build Coastguard Worker# portions of the text of the Macro appear in them. The GNU General 11*6a54128fSAndroid Build Coastguard Worker# Public License (GPL) does govern all other use of the material that 12*6a54128fSAndroid Build Coastguard Worker# constitutes the Autoconf Macro. 13*6a54128fSAndroid Build Coastguard Worker# 14*6a54128fSAndroid Build Coastguard Worker# This special exception to the GPL applies to versions of the 15*6a54128fSAndroid Build Coastguard Worker# Autoconf Macro released by the Autoconf Macro Archive. When you make 16*6a54128fSAndroid Build Coastguard Worker# and distribute a modified version of the Autoconf Macro, you may 17*6a54128fSAndroid Build Coastguard Worker# extend this special exception to the GPL to apply to your modified 18*6a54128fSAndroid Build Coastguard Worker# version as well. 19*6a54128fSAndroid Build Coastguard Worker# 20*6a54128fSAndroid Build Coastguard WorkerAC_DEFUN([AX_TLS], [ 21*6a54128fSAndroid Build Coastguard Worker AC_MSG_CHECKING(for thread local storage (TLS) class) 22*6a54128fSAndroid Build Coastguard Worker AC_CACHE_VAL(ac_cv_tls, [ 23*6a54128fSAndroid Build Coastguard Worker ax_tls_keywords="__thread __declspec(thread) none" 24*6a54128fSAndroid Build Coastguard Worker for ax_tls_keyword in $ax_tls_keywords; do 25*6a54128fSAndroid Build Coastguard Worker case $ax_tls_keyword in 26*6a54128fSAndroid Build Coastguard Worker none) ac_cv_tls=none ; break ;; 27*6a54128fSAndroid Build Coastguard Worker *) 28*6a54128fSAndroid Build Coastguard Worker AC_TRY_COMPILE( 29*6a54128fSAndroid Build Coastguard Worker [#include <stdlib.h> 30*6a54128fSAndroid Build Coastguard Worker static void 31*6a54128fSAndroid Build Coastguard Worker foo(void) { 32*6a54128fSAndroid Build Coastguard Worker static ] $ax_tls_keyword [ int bar; 33*6a54128fSAndroid Build Coastguard Worker exit(1); 34*6a54128fSAndroid Build Coastguard Worker }], 35*6a54128fSAndroid Build Coastguard Worker [], 36*6a54128fSAndroid Build Coastguard Worker [ac_cv_tls=$ax_tls_keyword ; break], 37*6a54128fSAndroid Build Coastguard Worker ac_cv_tls=none 38*6a54128fSAndroid Build Coastguard Worker ) 39*6a54128fSAndroid Build Coastguard Worker esac 40*6a54128fSAndroid Build Coastguard Worker done 41*6a54128fSAndroid Build Coastguard Worker]) 42*6a54128fSAndroid Build Coastguard Worker 43*6a54128fSAndroid Build Coastguard Worker if test "$ac_cv_tls" != "none"; then 44*6a54128fSAndroid Build Coastguard Worker dnl AC_DEFINE([TLS], [], [If the compiler supports a TLS storage class define it to that here]) 45*6a54128fSAndroid Build Coastguard Worker AC_DEFINE_UNQUOTED([TLS], $ac_cv_tls, [If the compiler supports a TLS storage class define it to that here]) 46*6a54128fSAndroid Build Coastguard Worker fi 47*6a54128fSAndroid Build Coastguard Worker AC_MSG_RESULT($ac_cv_tls) 48*6a54128fSAndroid Build Coastguard Worker]) 49*6a54128fSAndroid Build Coastguard Worker 50*6a54128fSAndroid Build Coastguard Worker# =========================================================================== 51*6a54128fSAndroid Build Coastguard Worker# http://www.nongnu.org/autoconf-archive/check_gnu_make.html 52*6a54128fSAndroid Build Coastguard Worker# =========================================================================== 53*6a54128fSAndroid Build Coastguard Worker# 54*6a54128fSAndroid Build Coastguard Worker# SYNOPSIS 55*6a54128fSAndroid Build Coastguard Worker# 56*6a54128fSAndroid Build Coastguard Worker# CHECK_GNU_MAKE() 57*6a54128fSAndroid Build Coastguard Worker# 58*6a54128fSAndroid Build Coastguard Worker# DESCRIPTION 59*6a54128fSAndroid Build Coastguard Worker# 60*6a54128fSAndroid Build Coastguard Worker# This macro searches for a GNU version of make. If a match is found, the 61*6a54128fSAndroid Build Coastguard Worker# makefile variable `ifGNUmake' is set to the empty string, otherwise it 62*6a54128fSAndroid Build Coastguard Worker# is set to "#". This is useful for including a special features in a 63*6a54128fSAndroid Build Coastguard Worker# Makefile, which cannot be handled by other versions of make. The 64*6a54128fSAndroid Build Coastguard Worker# variable _cv_gnu_make_command is set to the command to invoke GNU make 65*6a54128fSAndroid Build Coastguard Worker# if it exists, the empty string otherwise. 66*6a54128fSAndroid Build Coastguard Worker# 67*6a54128fSAndroid Build Coastguard Worker# Here is an example of its use: 68*6a54128fSAndroid Build Coastguard Worker# 69*6a54128fSAndroid Build Coastguard Worker# Makefile.in might contain: 70*6a54128fSAndroid Build Coastguard Worker# 71*6a54128fSAndroid Build Coastguard Worker# # A failsafe way of putting a dependency rule into a makefile 72*6a54128fSAndroid Build Coastguard Worker# $(DEPEND): 73*6a54128fSAndroid Build Coastguard Worker# $(CC) -MM $(srcdir)/*.c > $(DEPEND) 74*6a54128fSAndroid Build Coastguard Worker# 75*6a54128fSAndroid Build Coastguard Worker# @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND))) 76*6a54128fSAndroid Build Coastguard Worker# @ifGNUmake@ include $(DEPEND) 77*6a54128fSAndroid Build Coastguard Worker# @ifGNUmake@ endif 78*6a54128fSAndroid Build Coastguard Worker# 79*6a54128fSAndroid Build Coastguard Worker# Then configure.in would normally contain: 80*6a54128fSAndroid Build Coastguard Worker# 81*6a54128fSAndroid Build Coastguard Worker# CHECK_GNU_MAKE() 82*6a54128fSAndroid Build Coastguard Worker# AC_OUTPUT(Makefile) 83*6a54128fSAndroid Build Coastguard Worker# 84*6a54128fSAndroid Build Coastguard Worker# Then perhaps to cause gnu make to override any other make, we could do 85*6a54128fSAndroid Build Coastguard Worker# something like this (note that GNU make always looks for GNUmakefile 86*6a54128fSAndroid Build Coastguard Worker# first): 87*6a54128fSAndroid Build Coastguard Worker# 88*6a54128fSAndroid Build Coastguard Worker# if ! test x$_cv_gnu_make_command = x ; then 89*6a54128fSAndroid Build Coastguard Worker# mv Makefile GNUmakefile 90*6a54128fSAndroid Build Coastguard Worker# echo .DEFAULT: > Makefile ; 91*6a54128fSAndroid Build Coastguard Worker# echo \ $_cv_gnu_make_command \$@ >> Makefile; 92*6a54128fSAndroid Build Coastguard Worker# fi 93*6a54128fSAndroid Build Coastguard Worker# 94*6a54128fSAndroid Build Coastguard Worker# Then, if any (well almost any) other make is called, and GNU make also 95*6a54128fSAndroid Build Coastguard Worker# exists, then the other make wraps the GNU make. 96*6a54128fSAndroid Build Coastguard Worker# 97*6a54128fSAndroid Build Coastguard Worker# LICENSE 98*6a54128fSAndroid Build Coastguard Worker# 99*6a54128fSAndroid Build Coastguard Worker# Copyright (c) 2008 John Darrington <[email protected]> 100*6a54128fSAndroid Build Coastguard Worker# 101*6a54128fSAndroid Build Coastguard Worker# Copying and distribution of this file, with or without modification, are 102*6a54128fSAndroid Build Coastguard Worker# permitted in any medium without royalty provided the copyright notice 103*6a54128fSAndroid Build Coastguard Worker# and this notice are preserved. 104*6a54128fSAndroid Build Coastguard Worker# 105*6a54128fSAndroid Build Coastguard Worker# Note: Modified by Ted Ts'o to add @ifNotGNUMake@ 106*6a54128fSAndroid Build Coastguard Worker 107*6a54128fSAndroid Build Coastguard WorkerAC_DEFUN( 108*6a54128fSAndroid Build Coastguard Worker [CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command, 109*6a54128fSAndroid Build Coastguard Worker _cv_gnu_make_command='' ; 110*6a54128fSAndroid Build Coastguard Workerdnl Search all the common names for GNU make 111*6a54128fSAndroid Build Coastguard Worker if test -n "$FORCE_NATIVE_MAKE" ; then 112*6a54128fSAndroid Build Coastguard Worker MAKES="make" 113*6a54128fSAndroid Build Coastguard Worker else 114*6a54128fSAndroid Build Coastguard Worker MAKES="make gmake gnumake" 115*6a54128fSAndroid Build Coastguard Worker fi 116*6a54128fSAndroid Build Coastguard Worker for a in "$MAKE" $MAKES ; do 117*6a54128fSAndroid Build Coastguard Worker if test -z "$a" ; then continue ; fi ; 118*6a54128fSAndroid Build Coastguard Worker if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then 119*6a54128fSAndroid Build Coastguard Worker _cv_gnu_make_command=$a ; 120*6a54128fSAndroid Build Coastguard Worker break; 121*6a54128fSAndroid Build Coastguard Worker fi 122*6a54128fSAndroid Build Coastguard Worker done ; 123*6a54128fSAndroid Build Coastguard Worker ) ; 124*6a54128fSAndroid Build Coastguard Workerdnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise 125*6a54128fSAndroid Build Coastguard Worker if test "x$_cv_gnu_make_command" != "x" ; then 126*6a54128fSAndroid Build Coastguard Worker ifGNUmake='' ; 127*6a54128fSAndroid Build Coastguard Worker ifNotGNUmake='#' ; 128*6a54128fSAndroid Build Coastguard Worker else 129*6a54128fSAndroid Build Coastguard Worker ifGNUmake='#' ; 130*6a54128fSAndroid Build Coastguard Worker ifNotGNUmake='' ; 131*6a54128fSAndroid Build Coastguard Worker AC_MSG_RESULT("Not found"); 132*6a54128fSAndroid Build Coastguard Worker fi 133*6a54128fSAndroid Build Coastguard Worker AC_SUBST(ifGNUmake) 134*6a54128fSAndroid Build Coastguard Worker AC_SUBST(ifNotGNUmake) 135*6a54128fSAndroid Build Coastguard Worker] ) 136*6a54128fSAndroid Build Coastguard Worker 137*6a54128fSAndroid Build Coastguard Worker# AX_CHECK_MOUNT_OPT: an autoconf macro to check for generic filesystem- 138*6a54128fSAndroid Build Coastguard Worker# agnostic 'mount' options. Written by Nicholas Clark. Looks for constants in 139*6a54128fSAndroid Build Coastguard Worker# sys/mount.h to predict whether the 'mount' utility will support a specific 140*6a54128fSAndroid Build Coastguard Worker# mounting option. 141*6a54128fSAndroid Build Coastguard Worker# 142*6a54128fSAndroid Build Coastguard Worker# This macro can be used to check for the presence of 'nodev' (or other mount 143*6a54128fSAndroid Build Coastguard Worker# options), which isn't uniformly implemented in the BSD family at the time of 144*6a54128fSAndroid Build Coastguard Worker# this writing. Tested on FreeBSD, NetBSD, OpenBSD, and Linux. 145*6a54128fSAndroid Build Coastguard Worker# 146*6a54128fSAndroid Build Coastguard Worker# Usage: 147*6a54128fSAndroid Build Coastguard Worker# 148*6a54128fSAndroid Build Coastguard Worker# AX_CHECK_MOUNT_OPT(option) 149*6a54128fSAndroid Build Coastguard Worker# 150*6a54128fSAndroid Build Coastguard Worker# Defines HAVE_MOUNT_$OPTION (in uppercase) if the option exists, and sets 151*6a54128fSAndroid Build Coastguard Worker# ac_cv_mount_$option (in original case) otherwise. 152*6a54128fSAndroid Build Coastguard Worker# 153*6a54128fSAndroid Build Coastguard Worker# Copyright (c) 2018 Nicholas Clark <[email protected]> 154*6a54128fSAndroid Build Coastguard Worker# 155*6a54128fSAndroid Build Coastguard Worker# Copying and distribution of this file, with or without modification, are 156*6a54128fSAndroid Build Coastguard Worker# permitted in any medium without royalty or attribution requirement. 157*6a54128fSAndroid Build Coastguard Worker 158*6a54128fSAndroid Build Coastguard WorkerAC_DEFUN([AX_CHECK_MOUNT_OPT], [__AX_CHECK_MOUNT_OPT(m4_tolower([$1]),m4_toupper([$1]))]) 159*6a54128fSAndroid Build Coastguard WorkerAC_DEFUN([__AX_CHECK_MOUNT_OPT], 160*6a54128fSAndroid Build Coastguard Worker[ 161*6a54128fSAndroid Build Coastguard Worker AS_ECHO_N("checking for mount '$1' option... ") 162*6a54128fSAndroid Build Coastguard Worker AC_TRY_COMPILE( 163*6a54128fSAndroid Build Coastguard Worker [#include <sys/mount.h>], 164*6a54128fSAndroid Build Coastguard Worker [void *temp = (void *)(MS_$2); (void) temp;], 165*6a54128fSAndroid Build Coastguard Worker [AC_DEFINE(HAVE_MOUNT_$2, 1, [Define to 1 if mount supports $1.]) 166*6a54128fSAndroid Build Coastguard Worker AS_VAR_SET(ac_cv_mount_$1, yes) 167*6a54128fSAndroid Build Coastguard Worker AS_ECHO("yes")], 168*6a54128fSAndroid Build Coastguard Worker [AC_TRY_COMPILE( 169*6a54128fSAndroid Build Coastguard Worker [#include <sys/mount.h>], 170*6a54128fSAndroid Build Coastguard Worker [void *temp = (void *)(MNT_$2); (void) temp;], 171*6a54128fSAndroid Build Coastguard Worker [AC_DEFINE(HAVE_MOUNT_$2, 1, [Define to 1 if mount supports $1.]) 172*6a54128fSAndroid Build Coastguard Worker AS_VAR_SET(ac_cv_mount_$1, yes) 173*6a54128fSAndroid Build Coastguard Worker AS_ECHO("yes")], 174*6a54128fSAndroid Build Coastguard Worker [AS_VAR_SET(ac_cv_mount_$1, no) 175*6a54128fSAndroid Build Coastguard Worker AS_ECHO("no")] 176*6a54128fSAndroid Build Coastguard Worker )] 177*6a54128fSAndroid Build Coastguard Worker ) 178*6a54128fSAndroid Build Coastguard Worker]) 179