Skip to content

Commit

Permalink
Move local autoconf macros under m4 directory
Browse files Browse the repository at this point in the history
  • Loading branch information
royhills committed Aug 14, 2024
1 parent a86b12c commit 6c7138a
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 172 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
mappings (4575 IAB + 5461 MAM + 35971 OUI + 6112 OUI36).
https://github.com/royhills/arp-scan/pull/185

* configure.ac, m4/*: Move local autoconf macros from acinclude.m4
to seperate files under m4/, which is specified with
AC_CONFIG_MACRO_DIRS in configure.ac. configure.ac now requires
at least autoconf 2.70 (was previously 2.69).

2024-03-29 Roy Hills <royhills@hotmail.com>

* arp-fingerprint: Added recent Windows and FreeBSD patterns.
Expand Down
171 changes: 0 additions & 171 deletions acinclude.m4

This file was deleted.

3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Process this file with autoconf to produce a configure script.

AC_INIT([arp-scan],[1.10.1-git],[https://github.com/royhills/arp-scan])
AC_PREREQ([2.69])
AC_PREREQ([2.70])
AC_CONFIG_SRCDIR([arp-scan.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE

AC_CONFIG_HEADERS([config.h])
Expand Down
29 changes: 29 additions & 0 deletions m4/gcc-format-security.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
dnl Check for support of the GCC -Wformat-security option.
dnl This option was introduced in GCC 3.0.
dnl
dnl Note that in this test, the test compilation fails if the option is
dnl supported, and succeeds if it is not supported.
dnl
dnl If this option is supported, then the test program will produce a
dnl warning like "format not a string literal and no format arguments".
dnl If it is not supported, then the test program will compile without
dnl warnings.
dnl
AC_DEFUN([GCC_FORMAT_SECURITY],[
if test "X$CC" != "X"; then
AC_MSG_CHECKING([whether ${CC} accepts -Wformat-security])
wfs_old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror -Wformat -Wformat-security"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[
char *fmt=NULL;
printf(fmt);
return 0;
]])],[
AC_MSG_RESULT(no)
CFLAGS="$wfs_old_cflags"
],[
AC_MSG_RESULT(yes)
CFLAGS="$wfs_old_cflags -Wformat -Wformat-security"
])
fi
])
30 changes: 30 additions & 0 deletions m4/gcc-fortify-source.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
dnl Check whether GCC accepts -D_FORTIFY_SOURCE
dnl
dnl This was introduced in GCC 4.1 and glibc 2.4, but was present in earlier
dnl versions on redhat systems (specifically GCC 3.4.3 and above).
dnl
dnl We define the GNUC_PREREQ macro to the same definition as __GNUC_PREREQ
dnl in <features.h>. We don't use __GNUC_PREREQ directly because <features.h>
dnl is not present on all the operating systems that we support, e.g. OpenBSD.
dnl
AC_DEFUN([GCC_FORTIFY_SOURCE],[
if test "X$CC" != "X"; then
AC_MSG_CHECKING([whether ${CC} accepts -D_FORTIFY_SOURCE])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
#define GNUC_PREREQ(maj, min) ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
#if !(GNUC_PREREQ (4, 1) \
|| (defined __GNUC_RH_RELEASE__ && GNUC_PREREQ (4, 0)) \
|| (defined __GNUC_RH_RELEASE__ && GNUC_PREREQ (3, 4) \
&& __GNUC_MINOR__ == 4 \
&& (__GNUC_PATCHLEVEL__ > 2 \
|| (__GNUC_PATCHLEVEL__ == 2 && __GNUC_RH_RELEASE__ >= 8))))
#error No FORTIFY_SOURCE support
#endif
]])],[
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
],[
AC_MSG_RESULT(no)
])
fi
])
53 changes: 53 additions & 0 deletions m4/gcc-stack-protect.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
dnl Useful macros for autoconf to check for ssp-patched gcc
dnl 1.0 - September 2003 - Tiago Sousa <mirage@kaotik.org>
dnl
dnl Modified by ffontaine pull request: use AC_LINK_IFELSE instead of
dnl AC_COMPILE_IFELSE because some systems may be missing the libssp library
dnl even though the compiler accepts the option.
dnl
dnl About ssp:
dnl GCC extension for protecting applications from stack-smashing attacks
dnl http://www.research.ibm.com/trl/projects/security/ssp/
dnl
dnl Usage:
dnl After calling the correct AC_LANG_*, use the corresponding macro:
dnl
dnl GCC_STACK_PROTECT_CC
dnl checks -fstack-protector with the C compiler, if it exists then updates
dnl CFLAGS and defines ENABLE_SSP_CC
dnl
dnl GCC_STACK_PROTECT_CXX
dnl checks -fstack-protector with the C++ compiler, if it exists then updates
dnl CXXFLAGS and defines ENABLE_SSP_CXX
dnl
AC_DEFUN([GCC_STACK_PROTECT_CC],[
ssp_cc=yes
if test "X$CC" != "X"; then
AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector])
ssp_old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fstack-protector"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[ssp_cc=no])
echo $ssp_cc
if test "X$ssp_cc" = "Xno"; then
CFLAGS="$ssp_old_cflags"
else
AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
fi
fi
])

AC_DEFUN([GCC_STACK_PROTECT_CXX],[
ssp_cxx=yes
if test "X$CXX" != "X"; then
AC_MSG_CHECKING([whether ${CXX} accepts -fstack-protector])
ssp_old_cxxflags="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -fstack-protector"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[ssp_cxx=no])
echo $ssp_cxx
if test "X$ssp_cxx" = "Xno"; then
CXXFLAGS="$ssp_old_cxxflags"
else
AC_DEFINE([ENABLE_SSP_CXX], 1, [Define if SSP C++ support is enabled.])
fi
fi
])
18 changes: 18 additions & 0 deletions m4/gcc-wextra.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
dnl Check for support of the GCC -Wextra option, which enables extra warnings.
dnl Support for this option was added in gcc 3.4.0.
dnl
AC_DEFUN([GCC_WEXTRA],[
gcc_wextra=yes
if test "X$CC" != "X"; then
AC_MSG_CHECKING([whether ${CC} accepts -Wextra])
gcc_old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wextra"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
gcc_wextra=no
CFLAGS="$ssp_old_cflags"
])
fi
])
34 changes: 34 additions & 0 deletions m4/libcap-capabilities.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
dnl Check for POSIX.1e capabilities support with libcap
AC_DEFUN([CHECK_LIBCAP],
[
AC_ARG_WITH(libcap,
AS_HELP_STRING([--with-libcap@<:@=auto/yes/no@:>@],[Build with libcap POSIX.1e capabilities support @<:@default=auto@:>@]),,
with_libcap=auto)
if test "X$with_libcap" = "Xno" ; then
have_libcap=no;
else
# Check for header file
AC_CHECK_HEADER(sys/capability.h, cap_headers=yes, cap_headers=no)
# Check for library
AC_CHECK_LIB(cap, cap_set_proc, cap_library=yes, cap_library=no)
# Check results are usable
if test "X$with_libcap" = "Xyes" -a "X$cap_library" = "Xno" ; then
AC_MSG_ERROR([libcap support was requested but the library was not found])
fi
if test "X$cap_library" = "Xyes" -a "X$cap_headers" = "Xno" ; then
AC_MSG_ERROR([libcap libraries found but headers are missing])
fi
fi
AC_MSG_CHECKING([whether to use libcap])
if test "X$cap_library" = "Xyes" -a "X$cap_library" = "Xyes"; then
AC_DEFINE(HAVE_LIBCAP,1,[Define to 1 if you have the libcap library])
AC_DEFINE(HAVE_SYS_CAPABILITY_H,1,[Define to 1 if you have the <sys/capability.h> header file])
LIBS="-lcap $LIBS"
AC_MSG_RESULT([yes])
AC_MSG_NOTICE([Including libcap POSIX.1e capability support])
else
AC_MSG_RESULT([no])
AC_MSG_NOTICE([POSIX.1e capabilities disabled or not supported])
fi
])

0 comments on commit 6c7138a

Please sign in to comment.