The automake manual recommends against acinclude.m4: "The first possibility (the historical practice) is to list all your macros in `acinclude.m4'. This file will be included in `aclocal.m4' when you run `aclocal', and its macro(s) will henceforth be visible to `autoconf'. However if it contains numerous macros, it will rapidly become difficult to maintain, and it will be almost impossible to share macros between packages." Signed-off-by: Laszlo Papp <djszapi@archlinux.us> --- m4/gcc-inline.m4 | 19 +++++++++++++++++++ m4/gcc-ssp.m4 | 19 +++++++++++++++++++ m4/gcc-ssplib.m4 | 17 +++++++++++++++++ m4/gcc-visibility.m4 | 19 +++++++++++++++++++ 4 files changed, 74 insertions(+), 0 deletions(-) create mode 100644 m4/gcc-inline.m4 create mode 100644 m4/gcc-ssp.m4 create mode 100644 m4/gcc-ssplib.m4 create mode 100644 m4/gcc-visibility.m4 diff --git a/m4/gcc-inline.m4 b/m4/gcc-inline.m4 new file mode 100644 index 0000000..e58a225 --- /dev/null +++ b/m4/gcc-inline.m4 @@ -0,0 +1,19 @@ +dnl GCC_GNU89_INLINE_CC +dnl checks -fgnu89-inline with the C compiler, if it exists then defines +dnl ENABLE_GNU89_INLINE_CC in both configure script and Makefiles +AC_DEFUN([GCC_GNU89_INLINE_CC],[ + AC_LANG_ASSERT(C) + if test "X$CC" != "X"; then + AC_CACHE_CHECK([for -fgnu89-inline], + gnu89_inline_cv_cc, + [ gnu89_inline_old_cflags="$CFLAGS" + CFLAGS="$CFLAGS -fgnu89-inline" + AC_TRY_COMPILE(,, gnu89_inline_cv_cc=yes, gnu89_inline_cv_cc=no) + CFLAGS="$gnu89_inline_old_cflags" + ]) + if test $gnu89_inline_cv_cc = yes; then + AC_DEFINE([ENABLE_GNU89_INLINE_CC], 1, [Define if gnu89 inlining semantics should be used.]) + fi + AM_CONDITIONAL([ENABLE_GNU89_INLINE_CC], test "x$gnu89_inline_cv_cc" = "xyes") + fi +]) diff --git a/m4/gcc-ssp.m4 b/m4/gcc-ssp.m4 new file mode 100644 index 0000000..1924bd1 --- /dev/null +++ b/m4/gcc-ssp.m4 @@ -0,0 +1,19 @@ +dnl GCC_STACK_PROTECT_CC +dnl checks -fstack-protector-all with the C compiler, if it exists then updates +dnl CFLAGS and defines ENABLE_SSP_CC +AC_DEFUN([GCC_STACK_PROTECT_CC],[ + AC_LANG_ASSERT(C) + if test "X$CC" != "X"; then + AC_CACHE_CHECK([whether ${CC} accepts -fstack-protector-all], + ssp_cv_cc, + [ssp_old_cflags="$CFLAGS" + CFLAGS="$CFLAGS -fstack-protector-all" + AC_TRY_COMPILE(,, ssp_cv_cc=yes, ssp_cv_cc=no) + CFLAGS="$ssp_old_cflags" + ]) + if test $ssp_cv_cc = yes; then + CFLAGS="$CFLAGS -fstack-protector-all" + AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.]) + fi + fi +]) diff --git a/m4/gcc-ssplib.m4 b/m4/gcc-ssplib.m4 new file mode 100644 index 0000000..ef51d38 --- /dev/null +++ b/m4/gcc-ssplib.m4 @@ -0,0 +1,17 @@ +dnl GCC_STACK_PROTECT_LIB +dnl adds -lssp to LIBS if it is available +dnl ssp is usually provided as part of libc, but was previously a separate lib +dnl It does not hurt to add -lssp even if libc provides SSP - in that case +dnl libssp will simply be ignored. +AC_DEFUN([GCC_STACK_PROTECT_LIB],[ + AC_CACHE_CHECK([whether libssp exists], ssp_cv_lib, + [ssp_old_libs="$LIBS" + LIBS="$LIBS -lssp" + AC_TRY_LINK(,, ssp_cv_lib=yes, ssp_cv_lib=no) + LIBS="$ssp_old_libs" + ]) + if test $ssp_cv_lib = yes; then + LIBS="$LIBS -lssp" + fi +]) + diff --git a/m4/gcc-visibility.m4 b/m4/gcc-visibility.m4 new file mode 100644 index 0000000..84a5347 --- /dev/null +++ b/m4/gcc-visibility.m4 @@ -0,0 +1,19 @@ +dnl GCC_VISIBILITY_CC +dnl checks -fvisibility=internal with the C compiler, if it exists then +dnl defines ENABLE_VISIBILITY_CC in both configure script and Makefiles +AC_DEFUN([GCC_VISIBILITY_CC],[ + AC_LANG_ASSERT(C) + if test "X$CC" != "X"; then + AC_CACHE_CHECK([whether ${CC} accepts -fvisibility=internal], + visibility_cv_cc, + [visibility_old_cflags="$CFLAGS" + CFLAGS="$CFLAGS -fvisibility=internal" + AC_TRY_COMPILE(,, visibility_cv_cc=yes, visibility_cv_cc=no) + CFLAGS="$visibility_old_cflags" + ]) + if test $visibility_cv_cc = yes; then + AC_DEFINE([ENABLE_VISIBILITY_CC], 1, [Define if symbol visibility C support is enabled.]) + fi + AM_CONDITIONAL([ENABLE_VISIBILITY_CC], test "x$visibility_cv_cc" = "xyes") + fi +]) -- 1.6.5