+##########################################
+# Check whether we have setmntent/getmntent
+if test "$getmntent" != "yes" ; then
+ getmntent="no"
+fi
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <mntent.h>
+int main(int argc, char **argv)
+{
+ FILE *mtab = setmntent(NULL, "r");
+ struct mntent *mnt = getmntent(mtab);
+ endmntent(mtab);
+ return 0;
+}
+EOF
+if compile_prog "" "" "getmntent"; then
+ getmntent="yes"
+fi
+echo "getmntent $getmntent"
+
+##########################################
+# Check whether we have getmntinfo
+# These are originally added for BSDs, but may also work
+# on other operating systems with getmntinfo(3).
+
+# getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD.
+# Note that NetBSD needs -Werror to catch warning as error.
+if test "$getmntinfo" != "yes" ; then
+ getmntinfo="no"
+fi
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <sys/param.h>
+#include <sys/mount.h>
+int main(int argc, char **argv)
+{
+ struct statfs *st;
+ return getmntinfo(&st, MNT_NOWAIT);
+}
+EOF
+if compile_prog "-Werror" "" "getmntinfo"; then
+ getmntinfo="yes"
+fi
+echo "getmntinfo $getmntinfo"
+
+# getmntinfo(3) for NetBSD.
+if test "$getmntinfo_statvfs" != "yes" ; then
+ getmntinfo_statvfs="no"
+fi
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <sys/statvfs.h>
+int main(int argc, char **argv)
+{
+ struct statvfs *st;
+ return getmntinfo(&st, MNT_NOWAIT);
+}
+EOF
+# Skip the test if the one with statfs arg is detected.
+if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
+ getmntinfo_statvfs="yes"
+ echo "getmntinfo_statvfs $getmntinfo_statvfs"
+fi
+
+##########################################
+# Check whether we have _Static_assert
+if test "$static_assert" != "yes" ; then
+ static_assert="no"
+fi
+cat > $TMPC << EOF
+#include <assert.h>
+#include <stdlib.h>
+#undef offsetof
+#ifdef __compiler_offsetof
+#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
+#else
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
+
+#define container_of(ptr, type, member) ({ \
+ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
+ (type *)( (char *)__mptr - offsetof(type,member) );})
+
+struct foo {
+ int a, b;
+};
+
+int main(int argc, char **argv)
+{
+ _Static_assert(offsetof(struct foo, a) == 0 , "Check");
+ return 0 ;
+}
+EOF
+if compile_prog "" "" "static_assert"; then
+ static_assert="yes"
+fi
+echo "Static Assert $static_assert"
+
+##########################################
+# Check whether we have bool / stdbool.h
+if test "$have_bool" != "yes" ; then
+ have_bool="no"
+fi
+cat > $TMPC << EOF
+#include <stdbool.h>
+int main(int argc, char **argv)
+{
+ bool var = true;
+ return var != false;
+}
+EOF
+if compile_prog "" "" "bool"; then
+ have_bool="yes"
+fi
+echo "bool $have_bool"
+
+##########################################
+# check march=armv8-a+crc+crypto
+if test "$march_armv8_a_crc_crypto" != "yes" ; then
+ march_armv8_a_crc_crypto="no"
+fi
+if test "$cpu" = "arm64" ; then
+ cat > $TMPC <<EOF
+#include <sys/auxv.h>
+#include <arm_acle.h>
+#include <arm_neon.h>
+
+int main(void)
+{
+ return 0;
+}
+EOF
+ if compile_prog "-march=armv8-a+crc+crypto" "" ""; then
+ march_armv8_a_crc_crypto="yes"
+ CFLAGS="$CFLAGS -march=armv8-a+crc+crypto -DARCH_HAVE_CRC_CRYPTO"
+ fi
+fi
+echo "march_armv8_a_crc_crypto $march_armv8_a_crc_crypto"
+
+