2007-11-04 11:45:55 -05:00
|
|
|
dnl acinclude.m4 - configure macros used by pacman and libalpm
|
2007-10-31 22:30:09 -04:00
|
|
|
dnl Add some custom macros for pacman and libalpm
|
|
|
|
|
|
|
|
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
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl GCC_STACK_PROTECT_CC
|
2007-11-06 17:07:33 -05:00
|
|
|
dnl checks -fstack-protector-all with the C compiler, if it exists then updates
|
2007-10-31 22:30:09 -04:00
|
|
|
dnl CFLAGS and defines ENABLE_SSP_CC
|
|
|
|
AC_DEFUN([GCC_STACK_PROTECT_CC],[
|
|
|
|
AC_LANG_ASSERT(C)
|
|
|
|
if test "X$CC" != "X"; then
|
2007-11-06 17:07:33 -05:00
|
|
|
AC_CACHE_CHECK([whether ${CC} accepts -fstack-protector-all],
|
2007-10-31 22:30:09 -04:00
|
|
|
ssp_cv_cc,
|
|
|
|
[ssp_old_cflags="$CFLAGS"
|
2007-11-06 17:07:33 -05:00
|
|
|
CFLAGS="$CFLAGS -fstack-protector-all"
|
2007-10-31 22:30:09 -04:00
|
|
|
AC_TRY_COMPILE(,, ssp_cv_cc=yes, ssp_cv_cc=no)
|
|
|
|
CFLAGS="$ssp_old_cflags"
|
|
|
|
])
|
|
|
|
if test $ssp_cv_cc = yes; then
|
2007-11-06 17:07:33 -05:00
|
|
|
CFLAGS="$CFLAGS -fstack-protector-all"
|
2007-10-31 22:30:09 -04:00
|
|
|
AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
])
|
2007-10-31 23:19:03 -04:00
|
|
|
|
2010-09-27 02:04:10 -04:00
|
|
|
dnl GCC_FORTIFY_SOURCE_CC
|
|
|
|
dnl checks -D_FORTIFY_SOURCE with the C compiler, if it exists then updates
|
|
|
|
dnl CFLAGS
|
|
|
|
AC_DEFUN([GCC_FORTIFY_SOURCE_CC],[
|
|
|
|
AC_LANG_ASSERT(C)
|
|
|
|
if test "X$CC" != "X"; then
|
|
|
|
AC_MSG_CHECKING(for FORTIFY_SOURCE support)
|
|
|
|
AC_TRY_COMPILE([#include <features.h>], [
|
|
|
|
int main() {
|
|
|
|
#if !(__GNUC_PREREQ (4, 1) )
|
|
|
|
#error No FORTIFY_SOURCE support
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2007-10-31 23:19:03 -04:00
|
|
|
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
|
2010-11-16 21:12:26 -05:00
|
|
|
AM_CONDITIONAL([ENABLE_VISIBILITY_CC], test "x$visibility_cv_cc" = "xyes")
|
2007-10-31 23:19:03 -04:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
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
|
2010-11-16 21:12:26 -05:00
|
|
|
AM_CONDITIONAL([ENABLE_GNU89_INLINE_CC], test "x$gnu89_inline_cv_cc" = "xyes")
|
2007-10-31 23:19:03 -04:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2010-11-16 21:12:26 -05:00
|
|
|
dnl Checks for getmntinfo and determines whether it uses statfs or statvfs
|
|
|
|
AC_DEFUN([FS_STATS_TYPE],
|
|
|
|
[AC_CACHE_CHECK([filesystem statistics type], fs_stats_cv_type,
|
|
|
|
[AC_CHECK_FUNC(getmntinfo,
|
|
|
|
[AC_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([[
|
|
|
|
# include <sys/param.h>
|
|
|
|
# include <sys/mount.h>
|
|
|
|
#if HAVE_SYS_UCRED_H
|
|
|
|
#include <sys/ucred.h>
|
|
|
|
#endif
|
|
|
|
extern int getmntinfo (struct statfs **, int);
|
|
|
|
]],
|
|
|
|
[])],
|
|
|
|
[fs_stats_cv_type="struct statfs"],
|
|
|
|
[fs_stats_cv_type="struct statvfs"])],
|
|
|
|
[AC_CHECK_FUNC(getmntent,
|
|
|
|
[fs_stats_cv_type="struct statvfs"])]
|
|
|
|
)]
|
|
|
|
)
|
|
|
|
AC_DEFINE_UNQUOTED(FSSTATSTYPE, [$fs_stats_cv_type],
|
|
|
|
[Defined as the filesystem stats type ('statvfs' or 'statfs')])
|
|
|
|
])
|
|
|
|
|