summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorJoachim Nilsson <troglobit@gmail.com>2019-09-28 13:30:55 +0200
committerJoachim Nilsson <troglobit@gmail.com>2019-09-28 13:30:55 +0200
commitdda691d94726f23f8fdac581198d9b0eec2d8db0 (patch)
treef58eb8b247c6d05d2f1d4fc0241b4648efc2d820 /m4
parent39d3f28a12cdbd817294262025d84a30815f8887 (diff)
parent5e93c69e3b6966bf2ff7af3d32122d23fea01450 (diff)
downloadlibnet-dda691d94726f23f8fdac581198d9b0eec2d8db0.tar.gz
Merge branch 'master' of https://github.com/sgeto/libnet into sgeto-master
Conflicts: .gitignore .travis.yml BUILD-FROM-GIT.txt Makefile.am Makefile.am.common Prepare acinclude.m4 autogen.sh configure.ac doc/html/Makefile.am doc/html/closed.png doc/html/globals_func.html doc/html/tab_s.png doc/libnet.doxygen.conf doc/man/Makefile.am doc/man/man3/Makefile.am doc/man/man3/libnet-functions.h.3 doc/man/man3/libnet-macros.h.3 include/libnet.h include/libnet/Makefile.am libnet/acinclude.m4 libnet/libnet-config.in libnet/m4/acinclude.m4 lua/Makefile lua/msvcbuild.bat sample/Makefile.am scripts/Push src/libnet_link_win32.c win32/Makefile.am
Diffstat (limited to 'm4')
-rw-r--r--m4/ax_check_link_flag.m474
-rw-r--r--m4/shell.m497
2 files changed, 171 insertions, 0 deletions
diff --git a/m4/ax_check_link_flag.m4 b/m4/ax_check_link_flag.m4
new file mode 100644
index 0000000..819409a
--- /dev/null
+++ b/m4/ax_check_link_flag.m4
@@ -0,0 +1,74 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
+#
+# DESCRIPTION
+#
+# Check whether the given FLAG works with the linker or gives an error.
+# (Warnings, however, are ignored)
+#
+# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
+# success/failure.
+#
+# If EXTRA-FLAGS is defined, it is added to the linker's default flags
+# when the check is done. The check is thus made with the flags: "LDFLAGS
+# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
+# issue an error when a bad flag is given.
+#
+# INPUT gives an alternative input source to AC_LINK_IFELSE.
+#
+# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
+# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 5
+
+AC_DEFUN([AX_CHECK_LINK_FLAG],
+[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
+AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
+AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
+ ax_check_save_flags=$LDFLAGS
+ LDFLAGS="$LDFLAGS $4 $1"
+ AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
+ [AS_VAR_SET(CACHEVAR,[yes])],
+ [AS_VAR_SET(CACHEVAR,[no])])
+ LDFLAGS=$ax_check_save_flags])
+AS_VAR_IF(CACHEVAR,yes,
+ [m4_default([$2], :)],
+ [m4_default([$3], :)])
+AS_VAR_POPDEF([CACHEVAR])dnl
+])dnl AX_CHECK_LINK_FLAGS
diff --git a/m4/shell.m4 b/m4/shell.m4
new file mode 100644
index 0000000..ff5cf1a
--- /dev/null
+++ b/m4/shell.m4
@@ -0,0 +1,97 @@
+# Check for a working shell.
+
+# Copyright (C) 2000-2001, 2007, 2009-2017 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# AC_PROG_SHELL
+# -------------
+# Check for a working (i.e. POSIX-compatible) shell.
+# Written by Paul Eggert <eggert@twinsun.com>,
+# from an idea suggested by Albert Chin-A-Young <china@thewrittenword.com>.
+AC_DEFUN([AC_PROG_SHELL],
+ [AC_MSG_CHECKING([for a POSIX-compliant shell])
+ AC_CACHE_VAL(ac_cv_path_shell,
+ [ac_command='
+ # Test the noclobber option, using the portable POSIX.2 syntax.
+ set -C
+ rm -f conftest.c
+ >conftest.c || exit
+ >|conftest.c || exit
+ !>conftest.c || exit
+ # Test that $(...) works.
+ test "$(expr 3 + 4)" -eq 7 || exit
+ '
+ # Solaris 11 /bin/sh (AT&T Research) 93u 2011-02-08 has a file
+ # descriptor bug that breaks zgrep and is hard to test for
+ # directly. At some point $(...) is reading a pipe from the
+ # subshell, but the pipe is also open in the parent shell, so
+ # the read deadlocks. Prefer some other shell if available.
+ ac_maybe_solaris_sh_bug='test "${.sh.version}"'
+
+ ac_cv_path_shell=no
+
+ case $SHELL in
+ /*)
+ rm -f conftest.c
+ if ("$SHELL" -c "$ac_command") 2>/dev/null; then
+ "$SHELL" -c "$ac_maybe_solaris_sh_bug" 2>/dev/null ||
+ ac_cv_path_shell=$SHELL
+ fi
+ esac
+
+ case $ac_cv_path_shell in
+ no)
+ # Prefer shells that are more likely to be installed in the
+ # same place on all hosts of this platform. Therefore, prefer
+ # shells in /bin and /usr/bin to shells in the installer's
+ # PATH. Also, loop through PATH first and then through
+ # shells, since less-"nice" shells in /bin and /usr/bin are
+ # more likely to be installed than "nicer" shells elsewhere.
+ ac_break_if_good_shell=:
+ as_save_IFS=$IFS; IFS=:
+ for as_dir in /bin /usr/bin $PATH
+ do
+ IFS=$as_save_IFS
+ case $as_dir in
+ /*)
+ for ac_base in sh bash ksh sh5; do
+ rm -f conftest.c
+ if ("$as_dir/$ac_base" -c "$ac_command") 2>/dev/null; then
+ if "$as_dir/$ac_base" -c "$ac_maybe_solaris_sh_bug" 2>/dev/null
+ then
+ test "$ac_cv_path_shell" = no
+ else
+ ac_break_if_good_shell=break
+ :
+ fi && ac_cv_path_shell=$as_dir/$ac_base
+ $ac_break_if_good_shell
+ fi
+ done
+ $ac_break_if_good_shell
+ esac
+ done
+ rm -f conftest.c
+ esac])
+ AC_MSG_RESULT($ac_cv_path_shell)
+ SHELL=$ac_cv_path_shell
+ if test "$SHELL" = no; then
+ SHELL=/bin/sh
+ AC_MSG_WARN([using $SHELL, even though it does not conform to POSIX])
+ fi
+ if "$SHELL" -c "$ac_maybe_solaris_sh_bug" 2>/dev/null; then
+ AC_MSG_WARN([using $SHELL, even though it may have file descriptor bugs])
+ fi
+ AC_SUBST(SHELL)])