diff options
author | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-11-18 21:24:39 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-11-23 02:01:21 +0100 |
commit | d2b3a983e16f15d636619ebd61a3fa08c889b080 (patch) | |
tree | 54740409709b76c7045bcb634b5b79377f7798c3 /m4 |
Initial commit
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'm4')
-rw-r--r-- | m4/ac_define_dir.m4 | 35 | ||||
-rw-r--r-- | m4/compiler.m4 | 40 |
2 files changed, 75 insertions, 0 deletions
diff --git a/m4/ac_define_dir.m4 b/m4/ac_define_dir.m4 new file mode 100644 index 0000000..3b48c8b --- /dev/null +++ b/m4/ac_define_dir.m4 @@ -0,0 +1,35 @@ +dnl @synopsis AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION]) +dnl +dnl This macro sets VARNAME to the expansion of the DIR variable, +dnl taking care of fixing up ${prefix} and such. +dnl +dnl VARNAME is then offered as both an output variable and a C +dnl preprocessor symbol. +dnl +dnl Example: +dnl +dnl AC_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.]) +dnl +dnl @category Misc +dnl @author Stepan Kasal <kasal@ucw.cz> +dnl @author Andreas Schwab <schwab@suse.de> +dnl @author Guido U. Draheim <guidod@gmx.de> +dnl @author Alexandre Oliva +dnl @version 2006-10-13 +dnl @license AllPermissive + +AC_DEFUN([AC_DEFINE_DIR], [ + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix +dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn +dnl refers to ${prefix}. Thus we have to use `eval' twice. + eval ac_define_dir="\"[$]$2\"" + eval ac_define_dir="\"$ac_define_dir\"" + AC_SUBST($1, "$ac_define_dir") + AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3]) + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE +]) + diff --git a/m4/compiler.m4 b/m4/compiler.m4 new file mode 100644 index 0000000..058c73f --- /dev/null +++ b/m4/compiler.m4 @@ -0,0 +1,40 @@ +dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Simon Josefsson +dnl -- derivated from coreutils m4/warnings.m4 + +# UL_AS_VAR_APPEND(VAR, VALUE) +# ---------------------------- +# Provide the functionality of AS_VAR_APPEND if Autoconf does not have it. +m4_ifdef([AS_VAR_APPEND], +[m4_copy([AS_VAR_APPEND], [UL_AS_VAR_APPEND])], +[m4_define([UL_AS_VAR_APPEND], +[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])]) + +# UL_ADD_WARN(COMPILER_OPTION [, VARNAME]) +# ------------------------ +# Adds parameter to WARN_CFLAGS (or to $VARNAME) if the compiler supports it. +AC_DEFUN([UL_WARN_ADD], [ + m4_define([warnvarname], m4_default([$2],WARN_CFLAGS)) + AS_VAR_PUSHDEF([ul_Warn], [ul_cv_warn_$1])dnl + AC_CACHE_CHECK([whether compiler handles $1], m4_defn([ul_Warn]), [ + # store AC_LANG_WERROR status, then turn it on + save_ac_[]_AC_LANG_ABBREV[]_werror_flag="${ac_[]_AC_LANG_ABBREV[]_werror_flag}" + AC_LANG_WERROR + + ul_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="-Werror ${CPPFLAGS} $1" + AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])], + [AS_VAR_SET(ul_Warn, [yes])], + [AS_VAR_SET(ul_Warn, [no])]) + # restore AC_LANG_WERROR + ac_[]_AC_LANG_ABBREV[]_werror_flag="${save_ac_[]_AC_LANG_ABBREV[]_werror_flag}" + + CPPFLAGS="$ul_save_CPPFLAGS" + ]) + AS_VAR_IF(ul_Warn, [yes], [UL_AS_VAR_APPEND(warnvarname, [" $1"])]) +]) + |