diff options
Diffstat (limited to '')
42 files changed, 2859 insertions, 0 deletions
diff --git a/m4.include/ax_append_compile_flags.m4 b/m4.include/ax_append_compile_flags.m4 new file mode 100644 index 0000000..9c85635 --- /dev/null +++ b/m4.include/ax_append_compile_flags.m4 @@ -0,0 +1,46 @@ +# ============================================================================ +# https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html +# ============================================================================ +# +# SYNOPSIS +# +# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# For every FLAG1, FLAG2 it is checked whether the compiler works with the +# flag. If it does, the flag is added FLAGS-VARIABLE +# +# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. +# CFLAGS) is used. During the check the flag is always added to the +# current language's flags. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: This macro depends on the AX_APPEND_FLAG and +# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with +# AX_APPEND_LINK_FLAGS. +# +# LICENSE +# +# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 7 + +AC_DEFUN([AX_APPEND_COMPILE_FLAGS], +[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) +AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) +for flag in $1; do + AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4]) +done +])dnl AX_APPEND_COMPILE_FLAGS diff --git a/m4.include/ax_append_flag.m4 b/m4.include/ax_append_flag.m4 new file mode 100644 index 0000000..dd6d8b6 --- /dev/null +++ b/m4.include/ax_append_flag.m4 @@ -0,0 +1,50 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_append_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) +# +# DESCRIPTION +# +# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space +# added in between. +# +# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. +# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains +# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly +# FLAG. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> +# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 8 + +AC_DEFUN([AX_APPEND_FLAG], +[dnl +AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF +AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) +AS_VAR_SET_IF(FLAGS,[ + AS_CASE([" AS_VAR_GET(FLAGS) "], + [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], + [ + AS_VAR_APPEND(FLAGS,[" $1"]) + AC_RUN_LOG([: FLAGS="$FLAGS"]) + ]) + ], + [ + AS_VAR_SET(FLAGS,[$1]) + AC_RUN_LOG([: FLAGS="$FLAGS"]) + ]) +AS_VAR_POPDEF([FLAGS])dnl +])dnl AX_APPEND_FLAG diff --git a/m4.include/ax_check_compile_flag.m4 b/m4.include/ax_check_compile_flag.m4 new file mode 100644 index 0000000..bd753b3 --- /dev/null +++ b/m4.include/ax_check_compile_flag.m4 @@ -0,0 +1,53 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# 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 current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> +# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 6 + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" + AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_VAR_IF(CACHEVAR,yes, + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS diff --git a/m4.include/ax_gcc_func_attribute.m4 b/m4.include/ax_gcc_func_attribute.m4 new file mode 100644 index 0000000..098c9aa --- /dev/null +++ b/m4.include/ax_gcc_func_attribute.m4 @@ -0,0 +1,238 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE) +# +# DESCRIPTION +# +# This macro checks if the compiler supports one of GCC's function +# attributes; many other compilers also provide function attributes with +# the same syntax. Compiler warnings are used to detect supported +# attributes as unsupported ones are ignored by default so quieting +# warnings when using this macro will yield false positives. +# +# The ATTRIBUTE parameter holds the name of the attribute to be checked. +# +# If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_<ATTRIBUTE>. +# +# The macro caches its result in the ax_cv_have_func_attribute_<attribute> +# variable. +# +# The macro currently supports the following function attributes: +# +# alias +# aligned +# alloc_size +# always_inline +# artificial +# cold +# const +# constructor +# constructor_priority for constructor attribute with priority +# deprecated +# destructor +# dllexport +# dllimport +# error +# externally_visible +# fallthrough +# flatten +# format +# format_arg +# gnu_inline +# hot +# ifunc +# leaf +# malloc +# noclone +# noinline +# nonnull +# noreturn +# nothrow +# optimize +# pure +# sentinel +# sentinel_position +# unused +# used +# visibility +# warning +# warn_unused_result +# weak +# weakref +# +# Unsupported function attributes will be tested with a prototype +# returning an int and not accepting any arguments and the result of the +# check might be wrong or meaningless so use with care. +# +# LICENSE +# +# Copyright (c) 2013 Gabriele Svelto <gabriele.svelto@gmail.com> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 9 + +AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [ + AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1]) + + AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ + m4_case([$1], + [alias], [ + int foo( void ) { return 0; } + int bar( void ) __attribute__(($1("foo"))); + ], + [aligned], [ + int foo( void ) __attribute__(($1(32))); + ], + [alloc_size], [ + void *foo(int a) __attribute__(($1(1))); + ], + [always_inline], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [artificial], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [cold], [ + int foo( void ) __attribute__(($1)); + ], + [const], [ + int foo( void ) __attribute__(($1)); + ], + [constructor_priority], [ + int foo( void ) __attribute__((__constructor__(65535/2))); + ], + [constructor], [ + int foo( void ) __attribute__(($1)); + ], + [deprecated], [ + int foo( void ) __attribute__(($1(""))); + ], + [destructor], [ + int foo( void ) __attribute__(($1)); + ], + [dllexport], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [dllimport], [ + int foo( void ) __attribute__(($1)); + ], + [error], [ + int foo( void ) __attribute__(($1(""))); + ], + [externally_visible], [ + int foo( void ) __attribute__(($1)); + ], + [fallthrough], [ + int foo( void ) {switch (0) { case 1: __attribute__(($1)); case 2: break ; }}; + ], + [flatten], [ + int foo( void ) __attribute__(($1)); + ], + [format], [ + int foo(const char *p, ...) __attribute__(($1(printf, 1, 2))); + ], + [format_arg], [ + char *foo(const char *p) __attribute__(($1(1))); + ], + [gnu_inline], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [hot], [ + int foo( void ) __attribute__(($1)); + ], + [ifunc], [ + int my_foo( void ) { return 0; } + static int (*resolve_foo(void))(void) { return my_foo; } + int foo( void ) __attribute__(($1("resolve_foo"))); + ], + [leaf], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [malloc], [ + void *foo( void ) __attribute__(($1)); + ], + [noclone], [ + int foo( void ) __attribute__(($1)); + ], + [noinline], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [nonnull], [ + int foo(char *p) __attribute__(($1(1))); + ], + [noreturn], [ + void foo( void ) __attribute__(($1)); + ], + [nothrow], [ + int foo( void ) __attribute__(($1)); + ], + [optimize], [ + __attribute__(($1(3))) int foo( void ) { return 0; } + ], + [pure], [ + int foo( void ) __attribute__(($1)); + ], + [sentinel], [ + int foo(void *p, ...) __attribute__(($1)); + ], + [sentinel_position], [ + int foo(void *p, ...) __attribute__(($1(1))); + ], + [returns_nonnull], [ + void *foo( void ) __attribute__(($1)); + ], + [unused], [ + int foo( void ) __attribute__(($1)); + ], + [used], [ + int foo( void ) __attribute__(($1)); + ], + [visibility], [ + int foo_def( void ) __attribute__(($1("default"))); + int foo_hid( void ) __attribute__(($1("hidden"))); + int foo_int( void ) __attribute__(($1("internal"))); + int foo_pro( void ) __attribute__(($1("protected"))); + ], + [warning], [ + int foo( void ) __attribute__(($1(""))); + ], + [warn_unused_result], [ + int foo( void ) __attribute__(($1)); + ], + [weak], [ + int foo( void ) __attribute__(($1)); + ], + [weakref], [ + static int foo( void ) { return 0; } + static int bar( void ) __attribute__(($1("foo"))); + ], + [ + m4_warn([syntax], [Unsupported attribute $1, the test may fail]) + int foo( void ) __attribute__(($1)); + ] + )], []) + ], + dnl GCC doesn't exit with an error if an unknown attribute is + dnl provided but only outputs a warning, so accept the attribute + dnl only if no warning were issued. + [AS_IF([test -s conftest.err], + [AS_VAR_SET([ac_var], [no])], + [AS_VAR_SET([ac_var], [yes])])], + [AS_VAR_SET([ac_var], [no])]) + ]) + + AS_IF([test yes = AS_VAR_GET([ac_var])], + [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1, + [Define to 1 if the system has the `$1' function attribute])], []) + + AS_VAR_POPDEF([ac_var]) +]) diff --git a/m4.include/ax_path_lib_pcre.m4 b/m4.include/ax_path_lib_pcre.m4 new file mode 100644 index 0000000..37dea13 --- /dev/null +++ b/m4.include/ax_path_lib_pcre.m4 @@ -0,0 +1,67 @@ +dnl @synopsis AX_PATH_LIB_PCRE [(A/NA)] +dnl +dnl check for pcre lib and set PCRE_LIBS and PCRE_CPPFLAGS accordingly. +dnl +dnl also provide --with-pcre option that may point to the $prefix of +dnl the pcre installation - the macro will check $pcre/include and +dnl $pcre/lib to contain the necessary files. +dnl +dnl the usual two ACTION-IF-FOUND / ACTION-IF-NOT-FOUND are supported +dnl and they can take advantage of the LIBS/CFLAGS additions. +dnl +dnl @author Guido U. Draheim <guidod@gmx.de> +dnl @author Slava Zanko <slavazanko@gmail.com> +dnl @version 2009-07-06 +dnl @license GPLWithACException + +AC_DEFUN([AX_PATH_LIB_PCRE],[dnl +AC_MSG_CHECKING([lib pcre]) +AC_ARG_WITH([pcre], + AS_HELP_STRING([--with-pcre@<:@=prefix@:>@], [Compile pcre part (via libpcre check)]), + , + [with_pcre="yes"] +) +if test x"$with_pcre" = "xno" ; then + AC_MSG_RESULT([disabled]) + m4_ifval($2,$2) +else + + AC_MSG_RESULT([(testing)]) + + if test "x$with_pcre" = "xyes" ; then + PCRE_CPPFLAGS="`pcre-config --cflags`" + PCRE_LIBS="`pcre-config --libs`" + else + test_PCRE_LIBS="-L$with_pcre/lib" + test_PCRE_CPPFLAGS="-I$with_pcre/include" + + OLDLDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS $test_PCRE_LIBS" + OLDCPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS $test_PCRE_CPPFLAGS" + + AC_CHECK_LIB(pcre, pcre_compile) + + if test x"$ac_cv_lib_pcre_pcre_compile" = x"yes" ; then + AC_MSG_RESULT(setting PCRE_LIBS -L$with_pcre/lib -lpcre) + + PCRE_LIBS=$test_PCRE_LIBS + PCRE_CPPFLAGS=$test_PCRE_CPPFLAGS + + AC_MSG_CHECKING([lib pcre]) + AC_MSG_RESULT([$PCRE_LIBS]) + m4_ifval($1,$1) + else + AC_MSG_CHECKING([lib pcre]) + AC_MSG_RESULT([no, (WARNING)]) + m4_ifval($2,$2) + fi + + CPPFLAGS="$OLDCFPPLAGS" + LDFLAGS="$OLDLDFLAGS" + + fi +fi + +AC_SUBST([PCRE_LIBS]) +AC_SUBST([PCRE_CPPFLAGS]) + +]) diff --git a/m4.include/ax_require_defined.m4 b/m4.include/ax_require_defined.m4 new file mode 100644 index 0000000..17c3eab --- /dev/null +++ b/m4.include/ax_require_defined.m4 @@ -0,0 +1,37 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_require_defined.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_REQUIRE_DEFINED(MACRO) +# +# DESCRIPTION +# +# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have +# been defined and thus are available for use. This avoids random issues +# where a macro isn't expanded. Instead the configure script emits a +# non-fatal: +# +# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found +# +# It's like AC_REQUIRE except it doesn't expand the required macro. +# +# Here's an example: +# +# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) +# +# LICENSE +# +# Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 2 + +AC_DEFUN([AX_REQUIRE_DEFINED], [dnl + m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) +])dnl AX_REQUIRE_DEFINED diff --git a/m4.include/dx_doxygen.m4 b/m4.include/dx_doxygen.m4 new file mode 100644 index 0000000..eda391a --- /dev/null +++ b/m4.include/dx_doxygen.m4 @@ -0,0 +1,325 @@ +# +# Copyright 2007 Oren Ben-Kiki +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. See the License for the specific language governing +# permissions and limitations under the License. +# + + +# Generate automatic documentation using Doxygen. Works in concert with the +# aminclude.m4 file and a compatible doxygen configuration file. Defines the +# following public macros: +# +# DX_???_FEATURE(ON|OFF) - control the default setting fo a Doxygen feature. +# Supported features are 'DOXYGEN' itself, 'DOT' for generating graphics, +# 'HTML' for plain HTML, 'CHM' for compressed HTML help (for MS users), 'CHI' +# for generating a separate .chi file by the .chm file, and 'MAN', 'RTF', +# 'XML', 'PDF' and 'PS' for the appropriate output formats. The environment +# variable DOXYGEN_PAPER_SIZE may be specified to override the default 'a4wide' +# paper size. +# +# By default, HTML, PDF and PS documentation is generated as this seems to be +# the most popular and portable combination. MAN pages created by Doxygen are +# usually problematic, though by picking an appropriate subset and doing some +# massaging they might be better than nothing. CHM and RTF are specific for MS +# (note that you can't generate both HTML and CHM at the same time). The XML is +# rather useless unless you apply specialized post-processing to it. +# +# The macro mainly controls the default state of the feature. The use can +# override the default by specifying --enable or --disable. The macros ensure +# that contradictory flags are not given (e.g., --enable-doxygen-html and +# --enable-doxygen-chm, --enable-doxygen-anything with --disable-doxygen, etc.) +# Finally, each feature will be automatically disabled (with a warning) if the +# required programs are missing. +# +# Once all the feature defaults have been specified, call DX_INIT_DOXYGEN with +# the following parameters: a one-word name for the project for use as a +# filename base etc., an optional configuration file name (the default is +# 'Doxyfile', the same as Doxygen's default), and an optional output directory +# name (the default is 'doxygen-doc'). + +## ----------## +## Defaults. ## +## ----------## + +DX_ENV="" +AC_DEFUN([DX_FEATURE_doc], ON) +AC_DEFUN([DX_FEATURE_dot], ON) +AC_DEFUN([DX_FEATURE_man], OFF) +AC_DEFUN([DX_FEATURE_html], ON) +AC_DEFUN([DX_FEATURE_chm], OFF) +AC_DEFUN([DX_FEATURE_chi], OFF) +AC_DEFUN([DX_FEATURE_rtf], OFF) +AC_DEFUN([DX_FEATURE_xml], OFF) +AC_DEFUN([DX_FEATURE_pdf], ON) +AC_DEFUN([DX_FEATURE_ps], ON) + +## --------------- ## +## Private macros. ## +## --------------- ## + +# DX_ENV_APPEND(VARIABLE, VALUE) +# ------------------------------ +# Append VARIABLE="VALUE" to DX_ENV for invoking doxygen. +AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])]) + +# DX_DIRNAME_EXPR +# --------------- +# Expand into a shell expression prints the directory part of a path. +AC_DEFUN([DX_DIRNAME_EXPR], + [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']]) + +# DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF) +# ------------------------------------- +# Expands according to the M4 (static) status of the feature. +AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])]) + +# DX_REQUIRE_PROG(VARIABLE, PROGRAM) +# ---------------------------------- +# Require the specified program to be found for the DX_CURRENT_FEATURE to work. +AC_DEFUN([DX_REQUIRE_PROG], [ +AC_PATH_TOOL([$1], [$2]) +if test x"$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = x1; then + AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION]) + AC_SUBST([DX_FLAG_]DX_CURRENT_FEATURE, 0) +fi +]) + +# DX_TEST_FEATURE(FEATURE) +# ------------------------ +# Expand to a shell expression testing whether the feature is active. +AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1]) + +# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE) +# ------------------------------------------------- +# Verify that a required features has the right state before trying to turn on +# the DX_CURRENT_FEATURE. +AC_DEFUN([DX_CHECK_DEPEND], [ +test x"$DX_FLAG_$1" = x"$2" \ +|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1, + requires, contradicts) doxygen-DX_CURRENT_FEATURE]) +]) + +# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE) +# ---------------------------------------------------------- +# Turn off the DX_CURRENT_FEATURE if the required feature is off. +AC_DEFUN([DX_CLEAR_DEPEND], [ +test x"$DX_FLAG_$1" = x"$2" || AC_SUBST([DX_FLAG_]DX_CURRENT_FEATURE, 0) +]) + +# DX_FEATURE_ARG(FEATURE, DESCRIPTION, +# CHECK_DEPEND, CLEAR_DEPEND, +# REQUIRE, DO-IF-ON, DO-IF-OFF) +# -------------------------------------------- +# Parse the command-line option controlling a feature. CHECK_DEPEND is called +# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND), +# otherwise CLEAR_DEPEND is called to turn off the default state if a required +# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional +# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and +# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature. +AC_DEFUN([DX_ARG_ABLE], [ + AC_DEFUN([DX_CURRENT_FEATURE], [$1]) + AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2]) + AC_ARG_ENABLE(doxygen-$1, + [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1], + [--enable-doxygen-$1]), + DX_IF_FEATURE([$1], [don't $2], [$2]))], + [ +case "$enableval" in +#( +y|Y|yes|Yes|YES) + AC_SUBST([DX_FLAG_$1], 1) + $3 +;; #( +n|N|no|No|NO) + AC_SUBST([DX_FLAG_$1], 0) +;; #( +*) + AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1]) +;; +esac +], [ +AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)]) +$4 +]) +if DX_TEST_FEATURE([$1]); then + $5 + : +fi +if DX_TEST_FEATURE([$1]); then + AM_CONDITIONAL(DX_COND_$1, :) + $6 + : +else + AM_CONDITIONAL(DX_COND_$1, false) + $7 + : +fi +]) + +## -------------- ## +## Public macros. ## +## -------------- ## + +# DX_XXX_FEATURE(DEFAULT_STATE) +# ----------------------------- +AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])]) +AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])]) +AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])]) +AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])]) +AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])]) +AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])]) +AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) +AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) +AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])]) +AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])]) + +# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR]) +# --------------------------------------------------------- +# PROJECT also serves as the base name for the documentation files. +# The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doxygen-doc". +AC_DEFUN([DX_INIT_DOXYGEN], [ + +# Files: +AC_SUBST([DX_PROJECT], [$1]) +AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])]) +AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])]) + +# Environment variables used inside doxygen.cfg: +SRCDIR=`cd $srcdir; pwd` +DX_ENV_APPEND(SRCDIR, $SRCDIR) +DX_ENV_APPEND(PROJECT, $DX_PROJECT) +DX_ENV_APPEND(DOCDIR, $DX_DOCDIR) +DX_ENV_APPEND(VERSION, $PACKAGE_VERSION) + +# Doxygen itself: +DX_ARG_ABLE(doc, [generate any doxygen documentation], + [], + [], + [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen) + DX_REQUIRE_PROG([DX_PERL], perl)], + [DX_ENV_APPEND(PERL_PATH, $DX_PERL)]) + +# Dot for graphics: +DX_ARG_ABLE(dot, [generate graphics for doxygen documentation], + [DX_CHECK_DEPEND(doc, 1)], + [DX_CLEAR_DEPEND(doc, 1)], + [DX_REQUIRE_PROG([DX_DOT], dot)], + [DX_ENV_APPEND(HAVE_DOT, YES) + DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])], + [DX_ENV_APPEND(HAVE_DOT, NO)]) + +# Man pages generation: +DX_ARG_ABLE(man, [generate doxygen manual pages], + [DX_CHECK_DEPEND(doc, 1)], + [DX_CLEAR_DEPEND(doc, 1)], + [], + [DX_ENV_APPEND(GENERATE_MAN, YES)], + [DX_ENV_APPEND(GENERATE_MAN, NO)]) + +# RTF file generation: +DX_ARG_ABLE(rtf, [generate doxygen RTF documentation], + [DX_CHECK_DEPEND(doc, 1)], + [DX_CLEAR_DEPEND(doc, 1)], + [], + [DX_ENV_APPEND(GENERATE_RTF, YES)], + [DX_ENV_APPEND(GENERATE_RTF, NO)]) + +# XML file generation: +DX_ARG_ABLE(xml, [generate doxygen XML documentation], + [DX_CHECK_DEPEND(doc, 1)], + [DX_CLEAR_DEPEND(doc, 1)], + [], + [DX_ENV_APPEND(GENERATE_XML, YES)], + [DX_ENV_APPEND(GENERATE_XML, NO)]) + +# (Compressed) HTML help generation: +DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation], + [DX_CHECK_DEPEND(doc, 1)], + [DX_CLEAR_DEPEND(doc, 1)], + [DX_REQUIRE_PROG([DX_HHC], hhc)], + [DX_ENV_APPEND(HHC_PATH, $DX_HHC) + DX_ENV_APPEND(GENERATE_HTML, YES) + DX_ENV_APPEND(GENERATE_HTMLHELP, YES)], + [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)]) + +# Separate CHI file generation. +DX_ARG_ABLE(chi, [generate doxygen separate compressed HTML help index file], + [DX_CHECK_DEPEND(chm, 1)], + [DX_CLEAR_DEPEND(chm, 1)], + [], + [DX_ENV_APPEND(GENERATE_CHI, YES)], + [DX_ENV_APPEND(GENERATE_CHI, NO)]) + +# Plain HTML pages generation: +DX_ARG_ABLE(html, [generate doxygen plain HTML documentation], + [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)], + [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)], + [], + [DX_ENV_APPEND(GENERATE_HTML, YES)], + [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)]) + +# PostScript file generation: +DX_ARG_ABLE(ps, [generate doxygen PostScript documentation], + [DX_CHECK_DEPEND(doc, 1)], + [DX_CLEAR_DEPEND(doc, 1)], + [DX_REQUIRE_PROG([DX_LATEX], latex) + DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) + DX_REQUIRE_PROG([DX_DVIPS], dvips) + DX_REQUIRE_PROG([DX_EGREP], egrep)]) + +# PDF file generation: +DX_ARG_ABLE(pdf, [generate doxygen PDF documentation], + [DX_CHECK_DEPEND(doc, 1)], + [DX_CLEAR_DEPEND(doc, 1)], + [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex) + DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) + DX_REQUIRE_PROG([DX_EGREP], egrep)]) + +# LaTeX generation for PS and/or PDF: +if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then + AM_CONDITIONAL(DX_COND_latex, :) + DX_ENV_APPEND(GENERATE_LATEX, YES) +else + AM_CONDITIONAL(DX_COND_latex, false) + DX_ENV_APPEND(GENERATE_LATEX, NO) +fi + +# Paper size for PS and/or PDF: +AC_ARG_VAR(DOXYGEN_PAPER_SIZE, + [a4wide (default), a4, letter, legal or executive]) +case "$DOXYGEN_PAPER_SIZE" in +#( +"") + AC_SUBST(DOXYGEN_PAPER_SIZE, "") +;; #( +a4wide|a4|letter|legal|executive) + DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE) +;; #( +*) + AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE']) +;; +esac + +#For debugging: +#echo DX_FLAG_doc=$DX_FLAG_doc +#echo DX_FLAG_dot=$DX_FLAG_dot +#echo DX_FLAG_man=$DX_FLAG_man +#echo DX_FLAG_html=$DX_FLAG_html +#echo DX_FLAG_chm=$DX_FLAG_chm +#echo DX_FLAG_chi=$DX_FLAG_chi +#echo DX_FLAG_rtf=$DX_FLAG_rtf +#echo DX_FLAG_xml=$DX_FLAG_xml +#echo DX_FLAG_pdf=$DX_FLAG_pdf +#echo DX_FLAG_ps=$DX_FLAG_ps +#echo DX_ENV=$DX_ENV +]) diff --git a/m4.include/gnulib/fstypename.m4 b/m4.include/gnulib/fstypename.m4 new file mode 100644 index 0000000..20d2f05 --- /dev/null +++ b/m4.include/gnulib/fstypename.m4 @@ -0,0 +1,23 @@ +#serial 6 + +dnl From Jim Meyering. +dnl +dnl See if struct statfs has the f_fstypename member. +dnl If so, define HAVE_STRUCT_STATFS_F_FSTYPENAME. +dnl + +# Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2011 Free Software +# Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FSTYPENAME], +[ + AC_CHECK_MEMBERS([struct statfs.f_fstypename],,, + [ + #include <sys/types.h> + #include <sys/param.h> + #include <sys/mount.h> + ]) +]) diff --git a/m4.include/gnulib/fsusage.m4 b/m4.include/gnulib/fsusage.m4 new file mode 100644 index 0000000..c15cfca --- /dev/null +++ b/m4.include/gnulib/fsusage.m4 @@ -0,0 +1,306 @@ +# serial 35 +# Obtaining file system usage information. + +# Copyright (C) 1997-1998, 2000-2001, 2003-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Written by Jim Meyering. + +AC_DEFUN([gl_FSUSAGE], +[ + AC_CHECK_HEADERS_ONCE([sys/param.h]) + AC_CHECK_HEADERS_ONCE([sys/vfs.h sys/fs_types.h]) + AC_CHECK_HEADERS([sys/mount.h], [], [], + [AC_INCLUDES_DEFAULT + [#if HAVE_SYS_PARAM_H + #include <sys/param.h> + #endif]]) + gl_FILE_SYSTEM_USAGE([gl_cv_fs_space=yes], [gl_cv_fs_space=no]) +]) + +# Try to determine how a program can obtain file system usage information. +# If successful, define the appropriate symbol (see fsusage.c) and +# execute ACTION-IF-FOUND. Otherwise, execute ACTION-IF-NOT-FOUND. +# +# gl_FILE_SYSTEM_USAGE([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) + +AC_DEFUN([gl_FILE_SYSTEM_USAGE], +[ + dnl Enable large-file support. This has the effect of changing the size + dnl of field f_blocks in 'struct statvfs' from 32 bit to 64 bit on + dnl glibc/Hurd, HP-UX 11, Solaris (32-bit mode). It also changes the size + dnl of field f_blocks in 'struct statfs' from 32 bit to 64 bit on + dnl Mac OS X >= 10.5 (32-bit mode). + AC_REQUIRE([AC_SYS_LARGEFILE]) + + ac_fsusage_space=no + + # Perform only the link test since it seems there are no variants of the + # statvfs function. This check is more than just AC_CHECK_FUNCS([statvfs]) + # because that got a false positive on SCO OSR5. Adding the declaration + # of a 'struct statvfs' causes this test to fail (as it should) on such + # systems. That system is reported to work fine with STAT_STATFS4 which + # is what it gets when this test fails. + if test $ac_fsusage_space = no; then + # glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0, + # OpenBSD >= 4.4, AIX, HP-UX, IRIX, Solaris, Cygwin, Interix, BeOS. + AC_CACHE_CHECK([for statvfs function (SVR4)], + [fu_cv_sys_stat_statvfs], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include <sys/types.h> +#ifdef __osf__ +"Do not use Tru64's statvfs implementation" +#endif + +#include <sys/statvfs.h> + +struct statvfs fsd; + +#if defined __APPLE__ && defined __MACH__ +#include <limits.h> +/* On Mac OS X >= 10.5, f_blocks in 'struct statvfs' is a 32-bit quantity; + that commonly limits file systems to 4 TiB. Whereas f_blocks in + 'struct statfs' is a 64-bit type, thanks to the large-file support + that was enabled above. In this case, don't use statvfs(); use statfs() + instead. */ +int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1]; +#endif +]], + [[statvfs (0, &fsd);]])], + [fu_cv_sys_stat_statvfs=yes], + [fu_cv_sys_stat_statvfs=no]) + ]) + if test $fu_cv_sys_stat_statvfs = yes; then + ac_fsusage_space=yes + # AIX >= 5.2 has statvfs64 that has a wider f_blocks field than statvfs. + # glibc, HP-UX, IRIX, Solaris have statvfs64 as well, but on these systems + # statvfs with large-file support is already equivalent to statvfs64. + AC_CACHE_CHECK([whether to use statvfs64], + [fu_cv_sys_stat_statvfs64], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/types.h> + #include <sys/statvfs.h> + struct statvfs64 fsd; + int check_f_blocks_larger_in_statvfs64 + [sizeof (((struct statvfs64 *) 0)->f_blocks) + > sizeof (((struct statvfs *) 0)->f_blocks) + ? 1 : -1]; + ]], + [[statvfs64 (0, &fsd);]])], + [fu_cv_sys_stat_statvfs64=yes], + [fu_cv_sys_stat_statvfs64=no]) + ]) + if test $fu_cv_sys_stat_statvfs64 = yes; then + AC_DEFINE([STAT_STATVFS64], [1], + [Define if statvfs64 should be preferred over statvfs.]) + else + AC_DEFINE([STAT_STATVFS], [1], + [Define if there is a function named statvfs. (SVR4)]) + fi + fi + fi + + # Check for this unconditionally so we have a + # good fallback on glibc/Linux > 2.6 < 2.6.36 + AC_CACHE_CHECK([for two-argument statfs with statfs.f_frsize member], + [fu_cv_sys_stat_statfs2_frsize], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_MOUNT_H +#include <sys/mount.h> +#endif +#ifdef HAVE_SYS_VFS_H +#include <sys/vfs.h> +#endif + int + main () + { + struct statfs fsd; + fsd.f_frsize = 0; + return statfs (".", &fsd) != 0; + }]])], + [fu_cv_sys_stat_statfs2_frsize=yes], + [fu_cv_sys_stat_statfs2_frsize=no], + [fu_cv_sys_stat_statfs2_frsize=no]) + ]) + if test $fu_cv_sys_stat_statfs2_frsize = yes; then + ac_fsusage_space=yes + AC_DEFINE([STAT_STATFS2_FRSIZE], [1], + [Define if statfs takes 2 args and struct statfs has a field named f_frsize. + (glibc/Linux > 2.6)]) + fi + + if test $ac_fsusage_space = no; then + # DEC Alpha running OSF/1 + AC_CACHE_CHECK([for 3-argument statfs function (DEC OSF/1)], + [fu_cv_sys_stat_statfs3_osf1], + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include <sys/param.h> +#include <sys/types.h> +#include <sys/mount.h> + int + main () + { + struct statfs fsd; + fsd.f_fsize = 0; + return statfs (".", &fsd, sizeof (struct statfs)) != 0; + }]])], + [fu_cv_sys_stat_statfs3_osf1=yes], + [fu_cv_sys_stat_statfs3_osf1=no], + [fu_cv_sys_stat_statfs3_osf1=no]) + ]) + if test $fu_cv_sys_stat_statfs3_osf1 = yes; then + ac_fsusage_space=yes + AC_DEFINE([STAT_STATFS3_OSF1], [1], + [Define if statfs takes 3 args. (DEC Alpha running OSF/1)]) + fi + fi + + if test $ac_fsusage_space = no; then + # glibc/Linux, Mac OS X, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4. + # (glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0, + # OpenBSD >= 4.4, AIX, HP-UX, OSF/1, Cygwin already handled above.) + # (On IRIX you need to include <sys/statfs.h>, not only <sys/mount.h> and + # <sys/vfs.h>.) + # (On Solaris, statfs has 4 arguments.) + AC_CACHE_CHECK([for two-argument statfs with statfs.f_bsize member (AIX, 4.3BSD)], + [fu_cv_sys_stat_statfs2_bsize], + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_MOUNT_H +#include <sys/mount.h> +#endif +#ifdef HAVE_SYS_VFS_H +#include <sys/vfs.h> +#endif + int + main () + { + struct statfs fsd; + fsd.f_bsize = 0; + return statfs (".", &fsd) != 0; + }]])], + [fu_cv_sys_stat_statfs2_bsize=yes], + [fu_cv_sys_stat_statfs2_bsize=no], + [fu_cv_sys_stat_statfs2_bsize=no]) + ]) + if test $fu_cv_sys_stat_statfs2_bsize = yes; then + ac_fsusage_space=yes + AC_DEFINE([STAT_STATFS2_BSIZE], [1], + [Define if statfs takes 2 args and struct statfs has a field named f_bsize. + (4.3BSD, SunOS 4, HP-UX)]) + fi + fi + + if test $ac_fsusage_space = no; then + # SVR3 + # (Solaris already handled above.) + AC_CACHE_CHECK([for four-argument statfs (SVR3)], + [fu_cv_sys_stat_statfs4], + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include <sys/types.h> +#include <sys/statfs.h> + int + main () + { + struct statfs fsd; + return statfs (".", &fsd, sizeof fsd, 0) != 0; + }]])], + [fu_cv_sys_stat_statfs4=yes], + [fu_cv_sys_stat_statfs4=no], + [fu_cv_sys_stat_statfs4=no]) + ]) + if test $fu_cv_sys_stat_statfs4 = yes; then + ac_fsusage_space=yes + AC_DEFINE([STAT_STATFS4], [1], + [Define if statfs takes 4 args. (SVR3, old Irix)]) + fi + fi + + if test $ac_fsusage_space = no; then + # 4.4BSD and older NetBSD + # (OSF/1 already handled above.) + # (On AIX, you need to include <sys/statfs.h>, not only <sys/mount.h>.) + # (On Solaris, statfs has 4 arguments and 'struct statfs' is not declared in + # <sys/mount.h>.) + AC_CACHE_CHECK([for two-argument statfs with statfs.f_fsize member (4.4BSD and NetBSD)], + [fu_cv_sys_stat_statfs2_fsize], + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include <sys/types.h> +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_MOUNT_H +#include <sys/mount.h> +#endif + int + main () + { + struct statfs fsd; + fsd.f_fsize = 0; + return statfs (".", &fsd) != 0; + }]])], + [fu_cv_sys_stat_statfs2_fsize=yes], + [fu_cv_sys_stat_statfs2_fsize=no], + [fu_cv_sys_stat_statfs2_fsize=no]) + ]) + if test $fu_cv_sys_stat_statfs2_fsize = yes; then + ac_fsusage_space=yes + AC_DEFINE([STAT_STATFS2_FSIZE], [1], + [Define if statfs takes 2 args and struct statfs has a field named f_fsize. + (4.4BSD, NetBSD)]) + fi + fi + + AS_IF([test $ac_fsusage_space = yes], [$1], [$2]) + +]) + + +# Check for SunOS statfs brokenness wrt partitions 2GB and larger. +# If <sys/vfs.h> exists and struct statfs has a member named f_spare, +# enable the work-around code in fsusage.c. +AC_DEFUN([gl_STATFS_TRUNCATES], +[ + AC_CACHE_CHECK([for statfs that truncates block counts], + [fu_cv_sys_truncating_statfs], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +#if !defined(sun) && !defined(__sun) +choke -- this is a workaround for a Sun-specific problem +#endif +#include <sys/types.h> +#include <sys/vfs.h> + ]], + [[struct statfs t; long c = *(t.f_spare); + if (c) return 0; + ]])], + [fu_cv_sys_truncating_statfs=yes], + [fu_cv_sys_truncating_statfs=no]) + ]) + if test $fu_cv_sys_truncating_statfs = yes; then + AC_DEFINE([STATFS_TRUNCATES_BLOCK_COUNTS], [1], + [Define if the block counts reported by statfs may be truncated to 2GB + and the correct values may be stored in the f_spare array. + (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem. + SunOS 4.1.1 seems not to be affected.)]) + fi +]) + + +# Prerequisites of lib/fsusage.c not done by gl_FILE_SYSTEM_USAGE. +AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA], +[ + AC_CHECK_HEADERS([sys/fs/s5param.h sys/statfs.h]) + gl_STATFS_TRUNCATES +]) diff --git a/m4.include/gnulib/mode_t.m4 b/m4.include/gnulib/mode_t.m4 new file mode 100644 index 0000000..0cd40db --- /dev/null +++ b/m4.include/gnulib/mode_t.m4 @@ -0,0 +1,26 @@ +# mode_t.m4 serial 2 +dnl Copyright (C) 2009-2016 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# For using mode_t, it's sufficient to use AC_TYPE_MODE_T and +# include <sys/types.h>. + +# Define PROMOTED_MODE_T to the type that is the result of "default argument +# promotion" (ISO C 6.5.2.2.(6)) of the type mode_t. +AC_DEFUN([gl_PROMOTED_TYPE_MODE_T], +[ + AC_REQUIRE([AC_TYPE_MODE_T]) + AC_CACHE_CHECK([for promoted mode_t type], [gl_cv_promoted_mode_t], [ + dnl Assume mode_t promotes to 'int' if and only if it is smaller than 'int', + dnl and to itself otherwise. This assumption is not guaranteed by the ISO C + dnl standard, but we don't know of any real-world counterexamples. + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], + [[typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];]])], + [gl_cv_promoted_mode_t='int'], + [gl_cv_promoted_mode_t='mode_t']) + ]) + AC_DEFINE_UNQUOTED([PROMOTED_MODE_T], [$gl_cv_promoted_mode_t], + [Define to the type that is the result of default argument promotions of type mode_t.]) +]) diff --git a/m4.include/gnulib/mountlist.m4 b/m4.include/gnulib/mountlist.m4 new file mode 100644 index 0000000..49029ed --- /dev/null +++ b/m4.include/gnulib/mountlist.m4 @@ -0,0 +1,338 @@ +# serial 15 +dnl Copyright (C) 2002-2006, 2009-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Jim Meyering. + +AC_PREREQ([2.60]) + +AC_DEFUN([gl_MOUNTLIST], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CHECK_FUNCS([listmntent]) + AC_CHECK_HEADERS_ONCE([sys/param.h sys/statvfs.h]) + + # We must include grp.h before ucred.h on OSF V4.0, since ucred.h uses + # NGROUPS (as the array dimension for a struct member) without a definition. + AC_CHECK_HEADERS([sys/ucred.h], [], [], [#include <grp.h>]) + + AC_CHECK_HEADERS([sys/mount.h], [], [], + [AC_INCLUDES_DEFAULT + [#if HAVE_SYS_PARAM_H + #include <sys/param.h> + #endif + ]]) + + AC_CHECK_HEADERS([mntent.h sys/fs_types.h]) + getfsstat_includes="\ +$ac_includes_default +#if HAVE_SYS_PARAM_H +# include <sys/param.h> /* needed by powerpc-apple-darwin1.3.7 */ +#endif +#if HAVE_SYS_UCRED_H +# include <grp.h> /* needed for definition of NGROUPS */ +# include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */ +#endif +#if HAVE_SYS_MOUNT_H +# include <sys/mount.h> +#endif +#if HAVE_SYS_FS_TYPES_H +# include <sys/fs_types.h> /* needed by powerpc-apple-darwin1.3.7 */ +#endif +" + AC_CHECK_MEMBERS([struct fsstat.f_fstypename],,,[$getfsstat_includes]) + + # Determine how to get the list of mounted file systems. + ac_list_mounted_fs= + + # If the getmntent function is available but not in the standard library, + # make sure LIBS contains the appropriate -l option. + AC_FUNC_GETMNTENT + + if test -z "$ac_list_mounted_fs"; then + # AIX. + AC_CACHE_CHECK([for mntctl function and struct vmount], + [fu_cv_sys_mounted_vmount], + [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <fshelp.h>]])], + [fu_cv_sys_mounted_vmount=yes], + [fu_cv_sys_mounted_vmount=no])]) + if test $fu_cv_sys_mounted_vmount = yes; then + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_VMOUNT], [1], + [Define if there is a function named mntctl that can be used to read + the list of mounted file systems, and there is a system header file + that declares 'struct vmount'. (AIX)]) + fi + fi + + if test $ac_cv_func_getmntent = yes; then + + # This system has the getmntent function. + # Determine whether it's the one-argument variant or the two-argument one. + + if test -z "$ac_list_mounted_fs"; then + # glibc, HP-UX, IRIX, Cygwin, Android, also (obsolete) 4.3BSD, SunOS. + AC_CACHE_CHECK([for one-argument getmntent function], + [fu_cv_sys_mounted_getmntent1], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +/* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */ +#include <stdio.h> + +#include <mntent.h> +#if defined __ANDROID__ /* Android */ +# undef MOUNTED +# define MOUNTED "/proc/mounts" +#elif !defined MOUNTED +# if defined _PATH_MOUNTED /* GNU libc */ +# define MOUNTED _PATH_MOUNTED +# endif +# if defined MNT_MNTTAB /* HP-UX. */ +# define MOUNTED MNT_MNTTAB +# endif +#endif +]], + [[struct mntent *mnt = 0; char *table = MOUNTED; + if (sizeof mnt && sizeof table) return 0; + ]])], + [fu_cv_sys_mounted_getmntent1=yes], + [fu_cv_sys_mounted_getmntent1=no]) + ]) + if test $fu_cv_sys_mounted_getmntent1 = yes; then + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_GETMNTENT1], [1], + [Define if there is a function named getmntent for reading the list + of mounted file systems, and that function takes a single argument. + (4.3BSD, SunOS, HP-UX, Irix)]) + AC_CHECK_FUNCS([setmntent endmntent hasmntopt]) + fi + fi + + if test -z "$ac_list_mounted_fs"; then + # Solaris >= 8. + AC_CACHE_CHECK([for getextmntent function], + [fu_cv_sys_mounted_getextmntent], + [AC_EGREP_HEADER([getextmntent], [sys/mnttab.h], + [fu_cv_sys_mounted_getextmntent=yes], + [fu_cv_sys_mounted_getextmntent=no])]) + if test $fu_cv_sys_mounted_getextmntent = yes; then + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_GETEXTMNTENT], [1], + [Define if there is a function named getextmntent for reading the list + of mounted file systems. (Solaris)]) + fi + fi + + if test -z "$ac_list_mounted_fs"; then + # Solaris < 8, also (obsolete) SVR4. + # Solaris >= 8 has the two-argument getmntent but is already handled above. + AC_CACHE_CHECK([for two-argument getmntent function], + [fu_cv_sys_mounted_getmntent2], + [AC_EGREP_HEADER([getmntent], [sys/mnttab.h], + [fu_cv_sys_mounted_getmntent2=yes], + [fu_cv_sys_mounted_getmntent2=no]) + ]) + if test $fu_cv_sys_mounted_getmntent2 = yes; then + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_GETMNTENT2], [1], + [Define if there is a function named getmntent for reading the list of + mounted file systems, and that function takes two arguments. (SVR4)]) + AC_CHECK_FUNCS([hasmntopt]) + fi + fi + + fi + + if test -z "$ac_list_mounted_fs"; then + # OSF/1, also (obsolete) Apple Darwin 1.3. + # powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h + + AC_CACHE_CHECK([for getfsstat function], + [fu_cv_sys_mounted_getfsstat], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include <sys/types.h> +#if HAVE_STRUCT_FSSTAT_F_FSTYPENAME +# define FS_TYPE(Ent) ((Ent).f_fstypename) +#else +# define FS_TYPE(Ent) mnt_names[(Ent).f_type] +#endif +$getfsstat_includes + ]], + [[struct statfs *stats; + int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); + char *t = FS_TYPE (*stats); + ]])], + [fu_cv_sys_mounted_getfsstat=yes], + [fu_cv_sys_mounted_getfsstat=no]) + ]) + if test $fu_cv_sys_mounted_getfsstat = yes; then + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_GETFSSTAT], [1], + [Define if there is a function named getfsstat for reading the + list of mounted file systems. (DEC Alpha running OSF/1)]) + fi + fi + + if test -z "$ac_list_mounted_fs"; then + # (obsolete) SVR3 + AC_CACHE_CHECK([for FIXME existence of three headers], + [fu_cv_sys_mounted_fread_fstyp], + [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ +#include <sys/statfs.h> +#include <sys/fstyp.h> +#include <mnttab.h> +]])], + [fu_cv_sys_mounted_fread_fstyp=yes], + [fu_cv_sys_mounted_fread_fstyp=no]) + ]) + if test $fu_cv_sys_mounted_fread_fstyp = yes; then + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_FREAD_FSTYP], [1], + [Define if (like SVR2) there is no specific function for reading the + list of mounted file systems, and your system has these header files: + <sys/fstyp.h> and <sys/statfs.h>. (SVR3)]) + fi + fi + + if test -z "$ac_list_mounted_fs"; then + # Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, also (obsolete) 4.4BSD. + # OSF/1 also has getmntinfo but is already handled above. + # We cannot use AC_CHECK_FUNCS([getmntinfo]) here, because at the linker + # level the function is sometimes called getmntinfo64 or getmntinfo$INODE64 + # on Mac OS X, __getmntinfo13 on NetBSD and Minix, _F64_getmntinfo on OSF/1. + AC_CACHE_CHECK([for getmntinfo function], + [fu_cv_sys_mounted_getmntinfo], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#if HAVE_SYS_PARAM_H +# include <sys/param.h> +#endif +#include <sys/types.h> +#if HAVE_SYS_MOUNT_H +# include <sys/mount.h> +#endif +#if HAVE_SYS_STATVFS_H +# include <sys/statvfs.h> +#endif +#include <stdlib.h> + ]], + [[int count = getmntinfo (NULL, MNT_WAIT); + ]])], + [fu_cv_sys_mounted_getmntinfo=yes], + [fu_cv_sys_mounted_getmntinfo=no]) + ]) + if test $fu_cv_sys_mounted_getmntinfo = yes; then + AC_CACHE_CHECK([whether getmntinfo returns statvfs structures], + [fu_cv_sys_mounted_getmntinfo2], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +#if HAVE_SYS_PARAM_H +# include <sys/param.h> +#endif +#include <sys/types.h> +#if HAVE_SYS_MOUNT_H +# include <sys/mount.h> +#endif +#if HAVE_SYS_STATVFS_H +# include <sys/statvfs.h> +#endif +extern +#ifdef __cplusplus +"C" +#endif +int getmntinfo (struct statfs **, int); + ]], [[]])], + [fu_cv_sys_mounted_getmntinfo2=no], + [fu_cv_sys_mounted_getmntinfo2=yes]) + ]) + if test $fu_cv_sys_mounted_getmntinfo2 = no; then + # Mac OS X, FreeBSD, OpenBSD, also (obsolete) 4.4BSD. + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_GETMNTINFO], [1], + [Define if there is a function named getmntinfo for reading the + list of mounted file systems and it returns an array of + 'struct statfs'. (4.4BSD, Darwin)]) + else + # NetBSD, Minix. + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_GETMNTINFO2], [1], + [Define if there is a function named getmntinfo for reading the + list of mounted file systems and it returns an array of + 'struct statvfs'. (NetBSD 3.0)]) + fi + fi + fi + + if test -z "$ac_list_mounted_fs"; then + # Haiku, also (obsolete) BeOS. + AC_CHECK_FUNCS([next_dev fs_stat_dev]) + AC_CHECK_HEADERS([fs_info.h]) + AC_CACHE_CHECK([for BEOS mounted file system support functions], + [fu_cv_sys_mounted_fs_stat_dev], + [if test $ac_cv_header_fs_info_h = yes \ + && test $ac_cv_func_next_dev = yes \ + && test $ac_cv_func_fs_stat_dev = yes; then + fu_cv_sys_mounted_fs_stat_dev=yes + else + fu_cv_sys_mounted_fs_stat_dev=no + fi + ]) + if test $fu_cv_sys_mounted_fs_stat_dev = yes; then + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_FS_STAT_DEV], [1], + [Define if there are functions named next_dev and fs_stat_dev for + reading the list of mounted file systems. (BeOS)]) + fi + fi + + if test -z "$ac_list_mounted_fs"; then + # Interix / BSD alike statvfs + # the code is really interix specific, so make sure, we're on it. + case "$host" in + *-interix*) + AC_CHECK_FUNCS([statvfs]) + if test $ac_cv_func_statvfs = yes; then + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_INTERIX_STATVFS], [1], + [Define if we are on interix, and ought to use statvfs plus + some special knowledge on where mounted file systems can be + found. (Interix)]) + fi + ;; + esac + fi + + if test -z "$ac_list_mounted_fs"; then + AC_MSG_ERROR([could not determine how to read list of mounted file systems]) + # FIXME -- no need to abort building the whole package + # Can't build mountlist.c or anything that needs its functions + fi + + if test $ac_list_mounted_fs = found; then + gl_cv_list_mounted_fs=yes + else + gl_cv_list_mounted_fs=no + fi +]) + +# Prerequisites of lib/mountlist.c not done by gl_MOUNTLIST. +AC_DEFUN([gl_PREREQ_MOUNTLIST_EXTRA], +[ + dnl Note gl_MOUNTLIST checks for mntent.h, not sys/mntent.h. + AC_CHECK_HEADERS([sys/mntent.h]) + AC_HEADER_MAJOR()dnl for use of makedev () + gl_FSTYPENAME +]) + +# Replace Autoconf's AC_FUNC_GETMNTENT to omit checks that are unnecessary +# nowadays. +AC_DEFUN([AC_FUNC_GETMNTENT], +[ + # getmntent is in the standard C library on most systems, but in -lgen on + # Unixware. + AC_SEARCH_LIBS([getmntent], [gen]) + AC_CHECK_FUNCS([getmntent]) +]) diff --git a/m4.include/gnulib/stat-size.m4 b/m4.include/gnulib/stat-size.m4 new file mode 100644 index 0000000..95f4828 --- /dev/null +++ b/m4.include/gnulib/stat-size.m4 @@ -0,0 +1,14 @@ +#serial 1 + +# Copyright (C) 2011-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_STAT_SIZE], +[ + # Don't call AC_STRUCT_ST_BLOCKS because it causes bugs. Details at + # https://lists.gnu.org/r/bug-gnulib/2011-06/msg00051.html + AC_CHECK_HEADERS_ONCE([sys/param.h]) +]) diff --git a/m4.include/gnulib/sys_types_h.m4 b/m4.include/gnulib/sys_types_h.m4 new file mode 100644 index 0000000..53f2c09 --- /dev/null +++ b/m4.include/gnulib/sys_types_h.m4 @@ -0,0 +1,67 @@ +# sys_types_h.m4 serial 12 +dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN_ONCE([gl_SYS_TYPES_H], +[ + AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) + + dnl Use sane struct stat types in OpenVMS 8.2 and later. + AC_DEFINE([_USE_STD_STAT], 1, [For standard stat data types on VMS.]) + + gl_NEXT_HEADERS([sys/types.h]) + + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + + dnl Ensure the type mode_t gets defined. + AC_REQUIRE([AC_TYPE_MODE_T]) + + dnl Whether to override the 'off_t' type. + AC_REQUIRE([gl_TYPE_OFF_T]) + + dnl Whether to override the 'dev_t' and 'ino_t' types. + m4_ifdef([gl_WINDOWS_STAT_INODES], [ + AC_REQUIRE([gl_WINDOWS_STAT_INODES]) + ], [ + WINDOWS_STAT_INODES=0 + ]) + AC_SUBST([WINDOWS_STAT_INODES]) +]) + +AC_DEFUN([gl_SYS_TYPES_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS], [ + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) +]) + +AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], +[ +]) + +# This works around a buggy version in autoconf <= 2.69. +# See <https://lists.gnu.org/r/autoconf/2016-08/msg00014.html> +# The 2.70 version isn't quoted properly, so override it too. + +m4_version_prereq([2.70.1], [], [ + +m4_undefine([AC_HEADER_MAJOR]) +AC_DEFUN([AC_HEADER_MAJOR], +[AC_CHECK_HEADERS_ONCE([sys/types.h]) +AC_CHECK_HEADER([sys/mkdev.h], + [AC_DEFINE([MAJOR_IN_MKDEV], [1], + [Define to 1 if `major', `minor', and `makedev' are + declared in <mkdev.h>.])]) +if test $ac_cv_header_sys_mkdev_h = no; then + AC_CHECK_HEADER([sys/sysmacros.h], + [AC_DEFINE([MAJOR_IN_SYSMACROS], [1], + [Define to 1 if `major', `minor', and `makedev' + are declared in <sysmacros.h>.])]) +fi +])# AC_HEADER_MAJOR + +]) diff --git a/m4.include/gnulib/windows-stat-inodes.m4 b/m4.include/gnulib/windows-stat-inodes.m4 new file mode 100644 index 0000000..936900a --- /dev/null +++ b/m4.include/gnulib/windows-stat-inodes.m4 @@ -0,0 +1,19 @@ +# windows-stat-inodes.m4 serial 1 +dnl Copyright (C) 2017-2018 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Enable inode identification in 'struct stat' on native Windows platforms. +dnl Set WINDOWS_STAT_INODES to +dnl - 0 -> keep the default (dev_t = 32-bit, ino_t = 16-bit), +dnl - 1 -> override types normally (dev_t = 32-bit, ino_t = 64-bit), +dnl - 2 -> override types in an extended way (dev_t = 64-bit, ino_t = 128-bit). +AC_DEFUN([gl_WINDOWS_STAT_INODES], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) WINDOWS_STAT_INODES=1 ;; + *) WINDOWS_STAT_INODES=0 ;; + esac +]) diff --git a/m4.include/mc-assert.m4 b/m4.include/mc-assert.m4 new file mode 100644 index 0000000..fd995c3 --- /dev/null +++ b/m4.include/mc-assert.m4 @@ -0,0 +1,21 @@ +dnl +dnl Check whether to enable/disable assertions. +dnl + +AC_DEFUN([mc_ASSERT], +[ + AC_ARG_ENABLE([assert], + AS_HELP_STRING([--enable-assert], [turn on assertions @<:@yes@:>@]), + [ + if test "x$enableval" = xno; then + enable_assert=no + else + enable_assert=yes + fi + ], + [enable_assert=yes]) + + if test "x$enable_assert" = xno; then + AC_DEFINE(G_DISABLE_ASSERT, 1, [Define to disable assertions]) + fi +]) diff --git a/m4.include/mc-background.m4 b/m4.include/mc-background.m4 new file mode 100644 index 0000000..b42833c --- /dev/null +++ b/m4.include/mc-background.m4 @@ -0,0 +1,23 @@ +dnl +dnl Support for background operations +dnl + +AC_DEFUN([mc_BACKGROUND], +[ + AC_ARG_ENABLE([background], + AS_HELP_STRING([--enable-background], [Support for background file operations @<:@yes@:>@]), + [ + if test "x$enableval" = xno; then + enable_background=no + else + enable_background=yes + fi + ], + [enable_background=yes]) + + if test "x$enable_background" = xyes; then + AC_DEFINE(ENABLE_BACKGROUND, 1, [Define to enable background file operations]) + fi + + AM_CONDITIONAL(ENABLE_BACKGROUND, [test "x$enable_background" = xyes]) +]) diff --git a/m4.include/mc-cflags.m4 b/m4.include/mc-cflags.m4 new file mode 100644 index 0000000..264f5c1 --- /dev/null +++ b/m4.include/mc-cflags.m4 @@ -0,0 +1,90 @@ +dnl @synopsis mc_CHECK_CFLAGS +dnl +dnl Check flags supported by C compiler +dnl +dnl @author Slava Zanko <slavazanko@gmail.com> +dnl @modified by Andrew Borodin <aborodin@vmail.ru> +dnl @version 2021-09-19 +dnl @license GPL +dnl @copyright Free Software Foundation, Inc. + +AC_DEFUN([mc_CHECK_CFLAGS],[ + AC_LANG_PUSH(C) + + mc_configured_cflags="" + +dnl AC_MSG_CHECKING([CC is $CC]) + + dnl https://stackoverflow.com/questions/52557417/how-to-check-support-compile-flag-in-autoconf-for-clang + case "$CC" in + clang*) + EXTRA_OPTION="-Werror" + ;; + *) + EXTRA_OPTION="" + ;; + esac + + dnl Sorted -f options: + case "$CC" in + gcc*) + AX_APPEND_COMPILE_FLAGS([-fdiagnostics-show-option], [mc_configured_cflags]) +dnl AX_APPEND_COMPILE_FLAGS([-fno-stack-protector], [mc_configured_cflags]) + ;; + *) + ;; + esac + + dnl Sorted -W options: + AX_APPEND_COMPILE_FLAGS([-Wassign-enum], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wbad-function-cast], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wcomment], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wconditional-uninitialized], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wdeclaration-after-statement], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wfloat-conversion], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wfloat-equal], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wformat], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wformat-security], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wformat-signedness], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wimplicit], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wimplicit-fallthrough], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wignored-qualifiers], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wlogical-not-parentheses], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wmaybe-uninitialized], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wmissing-braces], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wmissing-declarations], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wmissing-field-initializers], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wmissing-format-attribute], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wmissing-parameter-type], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wmissing-variable-declarations], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wnested-externs], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wno-long-long], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wno-unreachable-code], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wparentheses], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wpointer-arith], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wpointer-sign], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wredundant-decls], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wreturn-type], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wsequence-point], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wshadow], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wsign-compare], [mc_configured_cflags], [$EXTRA_OPTION]) +dnl AX_APPEND_COMPILE_FLAGS([-Wstrict-aliasing], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wswitch], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wswitch-default], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wtype-limits], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wundef], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wuninitialized], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wunreachable-code], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wunused-but-set-variable], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wunused-function], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wunused-label], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wunused-parameter], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wunused-result], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wunused-value], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wunused-variable], [mc_configured_cflags], [$EXTRA_OPTION]) + AX_APPEND_COMPILE_FLAGS([-Wwrite-strings], [mc_configured_cflags], [$EXTRA_OPTION]) + + AC_LANG_POP() +]) diff --git a/m4.include/mc-check-search-type.m4 b/m4.include/mc-check-search-type.m4 new file mode 100644 index 0000000..b96c59a --- /dev/null +++ b/m4.include/mc-check-search-type.m4 @@ -0,0 +1,56 @@ +dnl @synopsis mc_CHECK_SEARCH_TYPE +dnl +dnl Check search type in mc. Currently used glib-regexp or pcre +dnl +dnl @author Slava Zanko <slavazanko@gmail.com> +dnl @version 2009-06-19 +dnl @license GPL +dnl @copyright Free Software Foundation, Inc. + +AC_DEFUN([mc_CHECK_SEARCH_TYPE_PCRE],[ + AX_PATH_LIB_PCRE + if test x"${PCRE_LIBS}" = x; then + AC_MSG_ERROR([Your system don't have pcre library (or pcre devel stuff)]) + else + SEARCH_TYPE="pcre" + AC_DEFINE(SEARCH_TYPE_PCRE, 1, [Define to select 'pcre' search type]) + fi +]) + + +AC_DEFUN([mc_CHECK_SEARCH_TYPE_GLIB],[ + $PKG_CONFIG --max-version 2.14 glib-2.0 + if test $? -eq 0; then + AC_MSG_RESULT([[Selected 'glib' search engine, but you don't have glib >= 2.14. Trying to use 'pcre' engine], (WARNING)]) + mc_CHECK_SEARCH_TYPE_PCRE + else + AC_DEFINE(SEARCH_TYPE_GLIB, 1, [Define to select 'glib-regexp' search type]) + fi +]) + + +AC_DEFUN([mc_CHECK_SEARCH_TYPE],[ + + AC_ARG_WITH([search-engine], + AS_HELP_STRING([--with-search-engine=type], + [Select low-level search engine (since glib >= 2.14) @<:@glib|pcre@:>@]) + ) + case x$with_search_engine in + xglib) + SEARCH_TYPE="glib-regexp" + ;; + xpcre) + mc_CHECK_SEARCH_TYPE_PCRE + ;; + x) + SEARCH_TYPE="glib-regexp" + ;; + *) + AC_MSG_ERROR([Value of the search-engine is incorrect]) + ;; + esac + + if test x"$SEARCH_TYPE" = x"glib-regexp"; then + mc_CHECK_SEARCH_TYPE_GLIB + fi +]) diff --git a/m4.include/mc-ext2fs-attr.m4 b/m4.include/mc-ext2fs-attr.m4 new file mode 100644 index 0000000..6a57cd5 --- /dev/null +++ b/m4.include/mc-ext2fs-attr.m4 @@ -0,0 +1,29 @@ +dnl +dnl Support for attributes on a Linux second extended file system +dnl +AC_DEFUN([mc_EXT2FS_ATTR], +[ + ext2fs_attr_msg="no" + + PKG_CHECK_MODULES(EXT2FS, [ext2fs >= 1.42.4], [found_ext2fs=yes], [:]) + + if test x"$found_ext2fs" = "xyes"; then + PKG_CHECK_MODULES(E2P, [e2p >= 1.42.4], [found_e2p=yes], [:]) + + if test x"$found_e2p" = "xyes"; then + AC_DEFINE(ENABLE_EXT2FS_ATTR, 1, [Define to enable support for ext2fs attributes]) + AC_SUBST(EXT2FS_CFLAGS) + AC_SUBST(E2P_CFLAGS) + MCLIBS="$MCLIBS $E2P_LIBS" + ext2fs_attr_msg="yes" + else + AC_MSG_WARN([e2p library not found or version too old (must be >= 1.42.4)]) + ext2fs_attr_msg="no" + fi + else + AC_MSG_WARN([ext2fs library not found or version too old (must be >= 1.42.4)]) + ext2fs_attr_msg="no" + fi + + AM_CONDITIONAL(ENABLE_EXT2FS_ATTR, [test "x$ext2fs_attr_msg" = "xyes"]) +]) diff --git a/m4.include/mc-get-fs-info.m4 b/m4.include/mc-get-fs-info.m4 new file mode 100644 index 0000000..5afc9f1 --- /dev/null +++ b/m4.include/mc-get-fs-info.m4 @@ -0,0 +1,121 @@ + +dnl +dnl posix_allocate() function detection +dnl + +AC_DEFUN([gl_POSIX_FALLOCATE], [ + dnl * Old glibcs have broken posix_fallocate(). Make sure not to use it. + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + #define _XOPEN_SOURCE 600 + #include <stdlib.h> + #if defined(__GLIBC__) && (__GLIBC__ < 2 || __GLIBC_MINOR__ < 7) + possibly broken posix_fallocate + #endif + ]], + [[posix_fallocate(0, 0, 0);]])], + [AC_DEFINE( + [HAVE_POSIX_FALLOCATE], + [1], + [Define if you have a working posix_fallocate()]) + ]) +]) + +dnl +dnl Get from the coreutils package (stat-prog.m4 serial 7) +dnl + +AC_DEFUN([mc_cu_PREREQ_STAT_PROG], +[ + AC_REQUIRE([gl_FSUSAGE]) + AC_REQUIRE([gl_FSTYPENAME]) + AC_CHECK_HEADERS_ONCE([OS.h netinet/in.h sys/param.h sys/vfs.h]) + + dnl Check for vfs.h first, since this avoids a warning with nfs_client.h + dnl on Solaris 8. + test $ac_cv_header_sys_param_h = yes && + test $ac_cv_header_sys_mount_h = yes && + AC_CHECK_HEADERS([nfs/vfs.h], + [AC_CHECK_HEADERS([nfs/nfs_client.h])]) + + statvfs_includes="\ +AC_INCLUDES_DEFAULT +#include <sys/statvfs.h> +" + statfs_includes="\ +AC_INCLUDES_DEFAULT +#ifdef HAVE_SYS_VFS_H +# include <sys/vfs.h> +#elif defined HAVE_SYS_MOUNT_H && defined HAVE_SYS_PARAM_H +# include <sys/param.h> +# include <sys/mount.h> +# if defined HAVE_NETINET_IN_H && defined HAVE_NFS_NFS_CLNT_H && defined HAVE_NFS_VFS_H +# include <netinet/in.h> +# include <nfs/nfs_clnt.h> +# include <nfs/vfs.h> +# endif +#elif defined HAVE_OS_H +# include <fs_info.h> +#endif +" + if case "$fu_cv_sys_stat_statvfs$fu_cv_sys_stat_statvfs64" in + *yes*) ;; *) false;; esac && + { AC_CHECK_MEMBERS([struct statvfs.f_basetype],,, [$statvfs_includes]) + test $ac_cv_member_struct_statvfs_f_basetype = yes || + { AC_CHECK_MEMBERS([struct statvfs.f_fstypename],,, [$statvfs_includes]) + test $ac_cv_member_struct_statvfs_f_fstypename = yes || + { test $ac_cv_member_struct_statfs_f_fstypename != yes && + { AC_CHECK_MEMBERS([struct statvfs.f_type],,, [$statvfs_includes]) + test $ac_cv_member_struct_statvfs_f_type = yes; }; }; }; } + then + AC_CHECK_MEMBERS([struct statvfs.f_namemax],,, [$statvfs_includes]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [$statvfs_includes], + [static statvfs s; + return (s.s_fsid ^ 0) == 0;])], + [AC_DEFINE([STRUCT_STATVFS_F_FSID_IS_INTEGER], [1], + [Define to 1 if the f_fsid member of struct statvfs is an integer.])]) + else + AC_CHECK_MEMBERS([struct statfs.f_namelen, struct statfs.f_type, + struct statfs.f_frsize],,, [$statfs_includes]) + if test $ac_cv_header_OS_h != yes; then + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [$statfs_includes], + [static statfs s; + return (s.s_fsid ^ 0) == 0;])], + [AC_DEFINE([STRUCT_STATFS_F_FSID_IS_INTEGER], [1], + [Define to 1 if the f_fsid member of struct statfs is an integer.])]) + fi + fi +]) + + +dnl +dnl Filesystem information detection +dnl +dnl To get information about the disk, mount points, etc. +dnl + +AC_DEFUN([mc_GET_FS_INFO], [ + AC_CHECK_HEADERS([fcntl.h utime.h]) + + gl_MOUNTLIST + if test $gl_cv_list_mounted_fs = yes; then + gl_PREREQ_MOUNTLIST_EXTRA + AC_DEFINE(HAVE_INFOMOUNT_LIST, 1, + [Define if the list of mounted filesystems can be determined]) + else + AC_MSG_WARN([could not determine how to read list of mounted fs]); + fi + + gl_FSUSAGE + if test $gl_cv_fs_space = yes; then + gl_PREREQ_FSUSAGE_EXTRA + fi + gl_FSTYPENAME + + gl_POSIX_FALLOCATE + + mc_cu_PREREQ_STAT_PROG +]) diff --git a/m4.include/mc-glib.m4 b/m4.include/mc-glib.m4 new file mode 100644 index 0000000..ba4901f --- /dev/null +++ b/m4.include/mc-glib.m4 @@ -0,0 +1,87 @@ +dnl +dnl Check whether the g_module_* family of functions works +dnl on this system. We need to know that at the compile time to +dnl decide whether to link with X11. +dnl +AC_DEFUN([mc_G_MODULE_SUPPORTED], [ + + g_module_supported="" + + found_gmodule=no + PKG_CHECK_MODULES(GMODULE, [gmodule-no-export-2.0 >= 2.30], [found_gmodule=yes], [:]) + if test x"$found_gmodule" = xyes; then + g_module_supported="gmodule-no-export-2.0" + else + dnl try fallback to the generic gmodule + PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.30], [found_gmodule=yes], [:]) + if test x"$found_gmodule" = xyes; then + g_module_supported="gmodule-2.0" + fi + fi + + case x"$g_module_supported" in + xgmodule-no-export-2.0|xgmodule-2.0) + if test x`$PKG_CONFIG --variable=gmodule_supported "$g_module_supported"` = xtrue; then + AC_DEFINE([HAVE_GMODULE], [1], [Defined if gmodule functionality is supported]) + else + g_module_supported="" + fi + ;; + *) + g_module_supported="" + ;; + esac + + dnl + dnl Try to find static libraries for glib and gmodule. + dnl + if test x$with_glib_static = xyes; then + new_GLIB_LIBS= + for i in $GLIB_LIBS; do + case x$i in + x-lglib*) + lib=glib ;; + x-lgmodule*) + lib=gmodule ;; + *) + lib= + add="$i" ;; + esac + + if test -n "$lib"; then + lib1=`echo $i | sed 's/^-l//'` + if test -f "$GLIB_LIBDIR/lib${lib1}.a"; then + add="$GLIB_LIBDIR/lib${lib1}.a" + else + if test -f "$GLIB_LIBDIR/lib${lib}.a"; then + add="$GLIB_LIBDIR/lib${lib}.a" + else + AC_MSG_ERROR([Cannot find static $lib]) + fi + fi + fi + new_GLIB_LIBS="$new_GLIB_LIBS $add" + done + GLIB_LIBS="$new_GLIB_LIBS" + fi + +]) + +AC_DEFUN([mc_CHECK_GLIB], [ + dnl + dnl First try glib 2.x. + dnl Keep this check close to the beginning, so that the users + dnl without any glib won't have their time wasted by other checks. + dnl + + AC_ARG_WITH([glib_static], + AS_HELP_STRING([--with-glib-static], [Link glib statically @<:@no@:>@])) + + glib_found=no + PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.30], [glib_found=yes], [:]) + if test x"$glib_found" = xno; then + AC_MSG_ERROR([glib-2.0 not found or version too old (must be >= 2.30)]) + fi + +]) + diff --git a/m4.include/mc-i18n.m4 b/m4.include/mc-i18n.m4 new file mode 100644 index 0000000..8f14741 --- /dev/null +++ b/m4.include/mc-i18n.m4 @@ -0,0 +1,33 @@ +dnl @synopsis mc_I18N +dnl +dnl Check if environment is ready for get translations of docs from transifex +dnl +dnl @author Slava Zanko <slavazanko@gmail.com> +dnl @version 2011-02-10 +dnl @license GPL +dnl @copyright Free Software Foundation, Inc. + +AC_DEFUN([mc_I18N],[ + dnl User visible support for charset conversion. + AC_ARG_ENABLE([charset], + AS_HELP_STRING([--enable-charset], [Support for charset selection and conversion @<:@yes@:>@])) + have_charset= + charset_msg="no" + if test "x$enable_charset" != "xno"; then + AC_DEFINE(HAVE_CHARSET, 1, [Define to enable charset selection and conversion]) + have_charset=yes + charset_msg="yes" + + dnl Solaris has different name of Windows 1251 encoding + case $host_os in + solaris*) + CP1251="ANSI-1251" + ;; + *) + CP1251="CP1251" + ;; + esac + + AC_SUBST(CP1251) + fi +]) diff --git a/m4.include/mc-subshell.m4 b/m4.include/mc-subshell.m4 new file mode 100644 index 0000000..9f6734c --- /dev/null +++ b/m4.include/mc-subshell.m4 @@ -0,0 +1,50 @@ +dnl +dnl Subshell support. +dnl +AC_DEFUN([mc_SUBSHELL], [ + + AC_MSG_CHECKING([for subshell support]) + AC_ARG_WITH(subshell, + [ --with-subshell Compile in concurrent subshell @<:@yes@:>@ + --with-subshell=optional Don't run concurrent shell by default @<:@no@:>@], + [ + case "x$withval" in + xyes) + result="yes" + ;; + xoptional) + result="optional" + ;; + *) + result="no" + ;; + esac + ], + [ + dnl Default: enable the subshell support + result="yes" + ]) + + AC_MSG_RESULT([$result]) + + if test "x$result" != xno; then + AC_DEFINE(ENABLE_SUBSHELL, 1, [Define to enable subshell support]) + + dnl openpty() can simplify opening of master/slave devices for subshell + AC_CHECK_HEADERS([pty.h libutil.h util.h]) + AC_CHECK_FUNCS(openpty,, + AC_CHECK_LIB(util,openpty, + [AC_DEFINE(HAVE_OPENPTY) + LIBS="$LIBS -lutil"] + ) + ) + + if test "x$result" = xoptional; then + AC_DEFINE(SUBSHELL_OPTIONAL, 1, [Define to make subshell support optional]) + fi + fi + + subshell="$result" + + AM_CONDITIONAL(ENABLE_SUBSHELL, [test "x$result" != xno]) +]) diff --git a/m4.include/mc-tests.m4 b/m4.include/mc-tests.m4 new file mode 100644 index 0000000..0814aff --- /dev/null +++ b/m4.include/mc-tests.m4 @@ -0,0 +1,62 @@ +dnl @synopsis mc_UNIT_TESTS +dnl +dnl Check if unit tests enabled +dnl +dnl @author Slava Zanko <slavazanko@gmail.com> +dnl @version 2011-02-10 +dnl @license GPL +dnl @copyright Free Software Foundation, Inc. + +AC_DEFUN([mc_UNIT_TESTS],[ + + AC_ARG_ENABLE( + [tests], + AS_HELP_STRING([--enable-tests], [Enable unit tests (see http://libcheck.github.io/check/) @<:@auto@:>@]) + ) + + dnl 'tests_msg' holds the human-readable message to show in configure's summary text. + + if test x"$enable_tests" = "xno"; then + dnl The user explicitly specified '--disable-tests'. + tests_msg="no" + else + PKG_CHECK_MODULES( + CHECK, + [check >= 0.9.10], + [ + have_check=yes + tests_msg="yes" + ], + [ + AC_MSG_WARN(['Check' testing framework not found. Check your environment]) + tests_msg="no ('Check' testing framework not found)" + + dnl The following behavior, of "exit if feature requested but not found", is just a + dnl preference and can be safely removed. + if test x"$enable_tests" = "xyes"; then + AC_MSG_ERROR([You explicitly specified '--enable-tests', but this requirement cannot be met.]) + fi + ]) + AC_SUBST(CHECK_CFLAGS) + AC_SUBST(CHECK_LIBS) + fi + AM_CONDITIONAL(HAVE_TESTS, test x"$have_check" = "xyes") + + dnl sighandler_t is GNU extension + dnl AC_USE_SYSTEM_EXTENSIONS is reguired + AC_CHECK_TYPES([sighandler_t], [], [], [ + #include <signal.h> + ]) + + # on cygwin, the linker does not accept the "-z" option + case $host_os in + cygwin*) + TESTS_LDFLAGS="-Wl,--allow-multiple-definition" + ;; + *) + TESTS_LDFLAGS="-Wl,-z,muldefs" + ;; + esac + + AC_SUBST(TESTS_LDFLAGS) +]) diff --git a/m4.include/mc-use-termcap.m4 b/m4.include/mc-use-termcap.m4 new file mode 100644 index 0000000..4ae6957 --- /dev/null +++ b/m4.include/mc-use-termcap.m4 @@ -0,0 +1,32 @@ +dnl +dnl Try using termcap database and link with libtermcap if possible. +dnl +AC_DEFUN([mc_USE_TERMCAP], [ + screen_msg="$screen_msg with termcap database" + AC_MSG_NOTICE([using S-Lang screen library with termcap]) + AC_DEFINE(USE_TERMCAP, 1, [Define to use termcap database]) + AC_CHECK_LIB(termcap, tgoto, [MCLIBS="$MCLIBS -ltermcap"], , [$LIBS]) +]) + +dnl +dnl Check if the installed S-Lang library uses termcap +dnl +AC_DEFUN([mc_SLANG_TERMCAP], [ + unset ac_cv_lib_termcap_tgoto + + AC_CACHE_CHECK([if S-Lang uses termcap], [mc_cv_slang_termcap], [ + ac_save_LIBS="$LIBS" + LIBS="$LIBS -lslang" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include <slang.h> + ]], + [[SLtt_get_terminfo(); SLtt_tgetflag((char*)"");]])], + [mc_cv_slang_termcap=no], [mc_cv_slang_termcap=yes]) + + LIBS="$ac_save_LIBS" + ]) + + if test x"$mc_cv_slang_termcap" = xyes; then + mc_USE_TERMCAP + fi +]) diff --git a/m4.include/mc-version.m4 b/m4.include/mc-version.m4 new file mode 100644 index 0000000..51b6b77 --- /dev/null +++ b/m4.include/mc-version.m4 @@ -0,0 +1,21 @@ +dnl @synopsis mc_VERSION +dnl +dnl Get current version of Midnight Commander from git tags +dnl +dnl @author Slava Zanko <slavazanko@gmail.com> +dnl @version 2021-04-04 +dnl @license GPL +dnl @copyright Free Software Foundation, Inc. +dnl @modified Andrew Borodin <aborodin@vmail.ru> + +AC_DEFUN([mc_VERSION],[ + if test -f ${srcdir}/mc-version.h; then + VERSION=$(grep '^#define MC_CURRENT_VERSION' ${srcdir}/mc-version.h | sed 's/.*"\(.*\)"$/\1/') + else + VERSION="unknown" + fi + + dnl Version without dashes for the man page + MAN_VERSION=`echo $VERSION | sed 's/^\([[^\-]]*\).*/\1/'` + AC_SUBST(MAN_VERSION) +]) diff --git a/m4.include/mc-vfs.m4 b/m4.include/mc-vfs.m4 new file mode 100644 index 0000000..f14fcfe --- /dev/null +++ b/m4.include/mc-vfs.m4 @@ -0,0 +1,88 @@ +AC_DEFUN([mc_VFS_ADDNAME], +[ + if test x"$vfs_flags" = "x" ; then + vfs_flags="$1" + else + vfs_flags="$vfs_flags, $1" + fi +]) + +m4_include([m4.include/vfs/rpc.m4]) +m4_include([m4.include/vfs/socket.m4]) +m4_include([m4.include/vfs/mc-vfs-extfs.m4]) +m4_include([m4.include/vfs/mc-vfs-sfs.m4]) +m4_include([m4.include/vfs/mc-vfs-ftp.m4]) +m4_include([m4.include/vfs/mc-vfs-sftp.m4]) +m4_include([m4.include/vfs/mc-vfs-fish.m4]) +m4_include([m4.include/vfs/mc-vfs-undelfs.m4]) +m4_include([m4.include/vfs/mc-vfs-tarfs.m4]) +m4_include([m4.include/vfs/mc-vfs-cpiofs.m4]) + +dnl mc_VFS_CHECKS +dnl Check for various functions needed by libvfs. +dnl This has various effects: +dnl Sets MC_VFS_LIBS to libraries required +dnl Sets vfs_flags to "pretty" list of vfs implementations we include. +dnl Sets shell variable enable_vfs to yes (default, --with-vfs) or +dnl "no" (--without-vfs). + +dnl Private define +AC_DEFUN([mc_ENABLE_VFS_NET], +[ + dnl FIXME: network checks should probably be in their own macro. + AC_REQUIRE_SOCKET + if test x"$have_socket" = xyes; then + AC_CHECK_TYPE([nlink_t], , + [AC_DEFINE_UNQUOTED([nlink_t], [unsigned int], + [Define to 'unsigned int' if <sys/types.h> does not define.])]) + AC_CHECK_TYPES([socklen_t],,, + [ +#include <sys/types.h> +#include <sys/socket.h> + ]) + + AC_CHECK_RPC + + enable_vfs_net=yes + AC_DEFINE(ENABLE_VFS_NET, [1], [Define to enable network VFSes support]) + fi +]) + +AC_DEFUN([mc_VFS_CHECKS], +[ + vfs_type="normal" + + AC_ARG_ENABLE([vfs], + AS_HELP_STRING([--disable-vfs], [Disable VFS]), + [ + if test "x$enableval" = "xno"; then + enable_vfs=no + else + enable_vfs=yes + fi + ], + [enable_vfs=yes]) + + if test x"$enable_vfs" = x"yes" ; then + vfs_type="Midnight Commander Virtual Filesystem" + AC_MSG_NOTICE([Enabling VFS code]) + AC_DEFINE(ENABLE_VFS, [1], [Define to enable VFS support]) + fi + + mc_VFS_CPIOFS + mc_VFS_EXTFS + mc_VFS_FISH + mc_VFS_FTP + mc_VFS_SFS + mc_VFS_SFTP + mc_VFS_TARFS + mc_VFS_UNDELFS + + AM_CONDITIONAL(ENABLE_VFS, [test x"$enable_vfs" = x"yes"]) + + if test x"$enable_vfs_ftp" = x"yes" -o x"$enable_vfs_fish" = x"yes" -o x"$enable_vfs_sftp" = x"yes"; then + mc_ENABLE_VFS_NET + fi + + AM_CONDITIONAL([ENABLE_VFS_NET], [test x"$enable_vfs_net" = x"yes"]) +]) diff --git a/m4.include/mc-with-internal-edit.m4 b/m4.include/mc-with-internal-edit.m4 new file mode 100644 index 0000000..a801e1d --- /dev/null +++ b/m4.include/mc-with-internal-edit.m4 @@ -0,0 +1,46 @@ +dnl +dnl Internal editor support. +dnl +AC_DEFUN([mc_WITH_INTERNAL_EDIT], [ + + AC_ARG_WITH([internal_edit], + AS_HELP_STRING([--with-internal-edit], [Enable internal editor @<:@yes@:>@])) + + if test x$with_internal_edit != xno; then + AC_DEFINE(USE_INTERNAL_EDIT, 1, [Define to enable internal editor]) + use_internal_edit=yes + AC_MSG_NOTICE([using internal editor]) + edit_msg="yes" + else + use_internal_edit=no + edit_msg="no" + fi + + dnl ASpell support. + AC_ARG_ENABLE([aspell], + AS_HELP_STRING([--enable-aspell], [Enable aspell support for internal editor @<:@no@:>@]), + [ + if test "x$enableval" = xno; then + enable_aspell=no + else + enable_aspell=yes + fi + ], + [enable_aspell=no] + ) + + if test x$with_internal_edit != xno -a x$enable_aspell != xno; then + AC_CHECK_HEADERS([aspell.h], [], [ + AC_MSG_ERROR([Could not find aspell development headers]) + ], []) + + if test x"$g_module_supported" != x; then + AC_DEFINE(HAVE_ASPELL, 1, [Define to enable aspell support]) + edit_msg="yes with aspell support" + AC_MSG_NOTICE([using aspell for internal editor]) + else + enable_aspell=no + AC_MSG_NOTICE([aspell support is disabled because gmodule support is not available]) + fi + fi +]) diff --git a/m4.include/mc-with-screen-ncurses.m4 b/m4.include/mc-with-screen-ncurses.m4 new file mode 100644 index 0000000..80d8478 --- /dev/null +++ b/m4.include/mc-with-screen-ncurses.m4 @@ -0,0 +1,211 @@ +dnl check for ncurses in user supplied path +AC_DEFUN([mc_CHECK_NCURSES_BY_PATH], [ + + ac_ncurses_inc_path=[$1] + ac_ncurses_lib_path=[$2] + + if test x"$ac_ncurses_inc_path" != x; then + ac_ncurses_inc_path="-I"$ac_ncurses_inc_path + fi + + if test x"$ac_ncurses_lib_path" != x; then + ac_ncurses_lib_path="-L"$ac_ncurses_lib_path + fi + + saved_CPPFLAGS="$CPPFLAGS" + saved_LDFLAGS="$LDFLAGS" + CPPFLAGS="$CPPFLAGS $ac_ncurses_inc_path" + LDFLAGS="$LDFLAGS $ac_ncurses_lib_path" + + dnl Check for the headers + dnl Both headers should be in the same directory + dnl AIX term.h is unusable for mc + AC_MSG_CHECKING([for ncurses/ncurses.h and ncurses/term.h]) + AC_PREPROC_IFELSE( + [ + AC_LANG_PROGRAM([[#include <ncurses/ncurses.h> + #include <ncurses/term.h> + ]],[[return 0;]]) + ], + [ + AC_MSG_RESULT(yes) + if test x"$ac_ncurses_inc_path" = x; then + ac_ncurses_inc_path="-I/usr/include" + fi + if test x"$ac_ncurses_lib_path" = x; then + ac_ncurses_lib_path="-L/usr/lib" + fi + found_ncurses=yes + AC_DEFINE(HAVE_NCURSES_NCURSES_H, 1, + [Define to 1 if you have the <ncurses/ncurses.h> header file.]) + AC_DEFINE(HAVE_NCURSES_TERM_H, 1, + [Define to 1 if you have the <ncurses/term.h> header file.]) + ], + [ + AC_MSG_RESULT(no) + found_ncurses=no + error_msg_ncurses="ncurses header not found" + ], + ) + + if test x"$found_ncurses" = x"yes"; then + screen_type=ncurses + screen_msg="NCurses" + + AC_DEFINE(HAVE_NCURSES, 1, + [Define to use ncurses library for screen management]) + + MCLIBS="$MCLIBS $ac_ncurses_lib_path" + else + CPPFLAGS="$saved_CPPFLAGS" + LDFLAGS="$saved_LDPFLAGS" + AC_MSG_ERROR([$error_msg_ncurses]) + fi +]) + +dnl +dnl Use the ncurses library. It can only be requested explicitly, +dnl so just fail if anything goes wrong. +dnl +dnl If ncurses exports the ESCDELAY variable it should be set to 0 +dnl or you'll have to press Esc three times to dismiss a dialog box. +dnl +AC_DEFUN([mc_WITH_NCURSES], [ + dnl has_colors() is specific to ncurses, it's not in the old curses + save_LIBS="$LIBS" + ncursesw_found= + + dnl get the user supplied include path + AC_ARG_WITH([ncurses-includes], + AS_HELP_STRING([--with-ncurses-includes=@<:@DIR@:>@], + [set path to ncurses includes @<:@default=/usr/include@:>@; make sense only if --with-screen=ncurses; for /usr/local/include/ncurses specify /usr/local/include] + ), + [ac_ncurses_inc_path="$withval"], + [ac_ncurses_inc_path=""] + ) + + dnl get the user supplied lib path + AC_ARG_WITH([ncurses-libs], + AS_HELP_STRING([--with-ncurses-libs=@<:@DIR@:>@], + [set path to ncurses library @<:@default=/usr/lib@:>@; make sense only if --with-screen=ncurses] + ), + [ac_ncurses_lib_path="$withval"], + [ac_ncurses_lib_path=""] + ) + + dnl we need at least the inc path, the lib may be in a std location + if test x"$ac_ncurses_inc_path" != x; then + dnl check the user supplied location + mc_CHECK_NCURSES_BY_PATH([$ac_ncurses_inc_path],[$ac_ncurses_lib_path]) + + LIBS= + AC_SEARCH_LIBS([has_colors], [ncurses], [MCLIBS="$MCLIBS $LIBS"], + [AC_MSG_ERROR([Cannot find ncurses library])]) + AC_SEARCH_LIBS([stdscr], [tinfo ncurses], [MCLIBS="$MCLIBS $LIBS"], + [AC_MSG_ERROR([Cannot find a library providing stdscr])]) + + + screen_type=ncurses + screen_msg="NCurses" + AC_DEFINE(USE_NCURSES, 1, + [Define to use ncurses for screen management]) + else + LIBS= + AC_SEARCH_LIBS([addwstr], [ncursesw ncurses curses], [MCLIBS="$MCLIBS $LIBS";ncursesw_found=yes], + [AC_MSG_WARN([Cannot find ncurses library, that support wide characters])]) + + AC_SEARCH_LIBS([stdscr], [tinfow tinfo ncursesw ncurses curses], [MCLIBS="$MCLIBS $LIBS"], + [AC_MSG_ERROR([Cannot find a library providing stdscr])]) + + if test x"$ncursesw_found" = "x"; then + LIBS= + AC_SEARCH_LIBS([has_colors], [ncurses curses], [MCLIBS="$MCLIBS $LIBS"], + [AC_MSG_ERROR([Cannot find ncurses library])]) + AC_SEARCH_LIBS([stdscr], [tinfo ncurses curses], [MCLIBS="$MCLIBS $LIBS"], + [AC_MSG_ERROR([Cannot find a library providing stdscr])]) + fi + + dnl Check the header + ncurses_h_found= + AC_CHECK_HEADERS([ncursesw/curses.h ncurses/curses.h ncurses.h curses.h], + [ncurses_h_found=yes; break]) + + if test x"$ncurses_h_found" = "x"; then + AC_MSG_ERROR([Cannot find ncurses header file]) + fi + + screen_type=ncurses + screen_msg="NCurses" + AC_DEFINE(USE_NCURSES, 1, + [Define to use ncurses for screen management]) + fi + + dnl check for ESCDELAY + AC_CACHE_CHECK([for ESCDELAY variable], + [mc_cv_ncurses_escdelay], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[ + extern int ESCDELAY; + ESCDELAY = 0; + ]])], + [mc_cv_ncurses_escdelay=yes], + [mc_cv_ncurses_escdelay=no]) + ]) + if test x"$mc_cv_ncurses_escdelay" = xyes; then + AC_DEFINE(HAVE_ESCDELAY, 1, + [Define if ncurses has ESCDELAY variable]) + fi + + dnl check for resizeterm + AC_CHECK_FUNCS(resizeterm) + LIBS="$save_LIBS" +]) + +dnl +dnl Use the ncursesw library. It can only be requested explicitly, +dnl so just fail if anything goes wrong. +dnl +dnl If ncursesw exports the ESCDELAY variable it should be set to 0 +dnl or you'll have to press Esc three times to dismiss a dialog box. +dnl + +AC_DEFUN([mc_WITH_NCURSESW], [ + dnl has_colors() is specific to ncurses, it's not in the old curses + save_LIBS="$LIBS" + LIBS= + AC_SEARCH_LIBS([has_colors], [ncursesw], [MCLIBS="$MCLIBS $LIBS"], + [AC_MSG_ERROR([Cannot find ncursesw library])]) + AC_SEARCH_LIBS([stdscr], [tinfow ncursesw], [MCLIBS="$MCLIBS $LIBS"], + [AC_MSG_ERROR([Cannot find a library providing stdscr])]) + + + dnl Check the header + ncurses_h_found= + AC_CHECK_HEADERS([ncursesw/curses.h], + [ncursesw_h_found=yes; break]) + + if test x"$ncursesw_h_found" = "x"; then + AC_MSG_ERROR([Cannot find ncursesw header file]) + fi + + screen_type=ncursesw + screen_msg="NCursesw" + AC_DEFINE(USE_NCURSESW, 1, + [Define to use ncursesw for screen management]) + + AC_CACHE_CHECK([for ESCDELAY variable], + [mc_cv_ncursesw_escdelay], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[ + extern int ESCDELAY; + ESCDELAY = 0; + ]])], + [mc_cv_ncursesw_escdelay=yes], + [mc_cv_ncursesw_escdelay=no]) + ]) + if test x"$mc_cv_ncursesw_escdelay" = xyes; then + AC_DEFINE(HAVE_ESCDELAY, 1, + [Define if ncursesw has ESCDELAY variable]) + fi + + AC_CHECK_FUNCS(resizeterm) + LIBS="$save_LIBS" +]) diff --git a/m4.include/mc-with-screen-slang.m4 b/m4.include/mc-with-screen-slang.m4 new file mode 100644 index 0000000..c76de6e --- /dev/null +++ b/m4.include/mc-with-screen-slang.m4 @@ -0,0 +1,28 @@ + +dnl +dnl Use the slang library. +dnl +AC_DEFUN([mc_WITH_SLANG], [ + with_screen=slang + found_slang=no + PKG_CHECK_MODULES(SLANG, [slang >= 2.0], [found_slang=yes], [:]) + if test x"$found_slang" = xno; then + AC_MSG_ERROR([S-Lang >= 2.0.0 library not found]) + fi + + MCLIBS="$SLANG_LIBS $MCLIBS" + CPPFLAGS="$SLANG_CFLAGS $CPPFLAGS" + + dnl Check if termcap is needed. + if test x"$found_slang" = x"yes"; then + mc_SLANG_TERMCAP + if test x"$mc_cv_slang_termcap" = x"yes"; then + MCLIBS="$MCLIBS -ltermcap" + fi + fi + + screen_type=slang + screen_msg="S-Lang" + + AC_DEFINE(HAVE_SLANG, 1, [Define to use S-Lang library for screen management]) +]) diff --git a/m4.include/mc-with-screen.m4 b/m4.include/mc-with-screen.m4 new file mode 100644 index 0000000..dff4bfb --- /dev/null +++ b/m4.include/mc-with-screen.m4 @@ -0,0 +1,28 @@ +m4_include([m4.include/mc-with-screen-ncurses.m4]) +m4_include([m4.include/mc-with-screen-slang.m4]) + +dnl +dnl Select the screen library. +dnl + +AC_DEFUN([mc_WITH_SCREEN], [ + + AC_ARG_WITH([screen], + AS_HELP_STRING([--with-screen=@<:@LIB@:>@], + [Compile with screen library: slang or ncurses @<:@slang if found@:>@])) + + case x$with_screen in + x | xslang) + mc_WITH_SLANG + ;; + xncurses) + mc_WITH_NCURSES + ;; + xncursesw) + mc_WITH_NCURSESW + ;; + *) + AC_MSG_ERROR([Value of the screen library is incorrect]) + ;; + esac +]) diff --git a/m4.include/mc-with-x.m4 b/m4.include/mc-with-x.m4 new file mode 100644 index 0000000..fa26915 --- /dev/null +++ b/m4.include/mc-with-x.m4 @@ -0,0 +1,23 @@ + +dnl X11 support. +dnl Used to read keyboard modifiers when running under X11. +AC_DEFUN([mc_WITH_X], [ + + AC_PATH_XTRA + + if test x"$no_x" = xyes; then + textmode_x11_support="no" + else + AC_DEFINE([HAVE_TEXTMODE_X11_SUPPORT], [1], + [Define to enable getting events from X Window System]) + textmode_x11_support="yes" + + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + + if test x"$g_module_supported" = x; then + MCLIBS="$MCLIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS" + fi + fi + + AM_CONDITIONAL([HAVE_TEXTMODE_X11_SUPPORT], [test x"$textmode_x11_support" = x"yes"]) +]) diff --git a/m4.include/vfs/mc-vfs-cpiofs.m4 b/m4.include/vfs/mc-vfs-cpiofs.m4 new file mode 100644 index 0000000..d9c1e47 --- /dev/null +++ b/m4.include/vfs/mc-vfs-cpiofs.m4 @@ -0,0 +1,12 @@ +dnl CPIO filesystem support +AC_DEFUN([mc_VFS_CPIOFS], +[ + AC_ARG_ENABLE([vfs-cpio], + AS_HELP_STRING([--enable-vfs-cpio], [Support for cpio filesystem @<:@yes@:>@])) + if test "$enable_vfs" = "yes" -a x"$enable_vfs_cpio" != x"no"; then + enable_vfs_cpio="yes" + AC_DEFINE([ENABLE_VFS_CPIO], [1], [Support for cpio filesystem]) + mc_VFS_ADDNAME([cpio]) + fi + AM_CONDITIONAL(ENABLE_VFS_CPIO, [test "$enable_vfs" = "yes" -a x"$enable_vfs_cpio" = x"yes"]) +]) diff --git a/m4.include/vfs/mc-vfs-extfs.m4 b/m4.include/vfs/mc-vfs-extfs.m4 new file mode 100644 index 0000000..b57dbba --- /dev/null +++ b/m4.include/vfs/mc-vfs-extfs.m4 @@ -0,0 +1,34 @@ +dnl mc_EXTFS_CHECKS +dnl Check for tools used in extfs scripts. + +dnl FIXME: make this configurable +AC_DEFUN([mc_EXTFS_CHECKS], [ + AC_PATH_PROG([ZIP], [zip], [/usr/bin/zip]) + AC_PATH_PROG([UNZIP], [unzip], [/usr/bin/unzip]) + AC_CACHE_CHECK([for zipinfo code in unzip], [mc_cv_have_zipinfo], + [mc_cv_have_zipinfo=no + if $UNZIP -Z </dev/null >/dev/null 2>&1; then + mc_cv_have_zipinfo=yes + fi]) + if test x"$mc_cv_have_zipinfo" = xyes; then + HAVE_ZIPINFO=1 + else + HAVE_ZIPINFO=0 + fi + AC_SUBST([HAVE_ZIPINFO]) +]) + + +dnl Enable Extfs (classic) +AC_DEFUN([mc_VFS_EXTFS], +[ + AC_ARG_ENABLE([vfs-extfs], + AS_HELP_STRING([--enable-vfs-extfs], [Support for extfs filesystem @<:@yes@:>@])) + if test "$enable_vfs" = "yes" -a x"$enable_vfs_extfs" != x"no"; then + mc_EXTFS_CHECKS + enable_vfs_extfs="yes" + mc_VFS_ADDNAME([extfs]) + AC_DEFINE([ENABLE_VFS_EXTFS], [1], [Support for extfs]) + fi + AM_CONDITIONAL(ENABLE_VFS_EXTFS, [test "$enable_vfs" = "yes" -a x"$enable_vfs_extfs" = x"yes"]) +]) diff --git a/m4.include/vfs/mc-vfs-fish.m4 b/m4.include/vfs/mc-vfs-fish.m4 new file mode 100644 index 0000000..d3463ee --- /dev/null +++ b/m4.include/vfs/mc-vfs-fish.m4 @@ -0,0 +1,12 @@ +dnl Enable FISH protocol (classic) +AC_DEFUN([mc_VFS_FISH], +[ + AC_ARG_ENABLE([vfs-fish], + AS_HELP_STRING([--enable-vfs-fish], [Support for FISH filesystem @<:@yes@:>@])) + if test "$enable_vfs" = "yes" -a "x$enable_vfs_fish" != xno; then + enable_vfs_fish="yes" + mc_VFS_ADDNAME([fish]) + AC_DEFINE([ENABLE_VFS_FISH], [1], [Support for FISH vfs]) + fi + AM_CONDITIONAL(ENABLE_VFS_FISH, [test "$enable_vfs" = "yes" -a x"$enable_vfs_fish" = x"yes"]) +]) diff --git a/m4.include/vfs/mc-vfs-ftp.m4 b/m4.include/vfs/mc-vfs-ftp.m4 new file mode 100644 index 0000000..c87ef00 --- /dev/null +++ b/m4.include/vfs/mc-vfs-ftp.m4 @@ -0,0 +1,12 @@ +dnl Enable FTP filesystem (classic) +AC_DEFUN([mc_VFS_FTP], +[ + AC_ARG_ENABLE([vfs-ftp], + AS_HELP_STRING([--enable-vfs-ftp], [Support for FTP filesystem @<:@yes@:>@])) + if test "$enable_vfs" != "no" -a x"$enable_vfs_ftp" != x"no"; then + enable_vfs_ftp="yes" + mc_VFS_ADDNAME([ftp]) + AC_DEFINE([ENABLE_VFS_FTP], [1], [Support for FTP (classic)]) + fi + AM_CONDITIONAL([ENABLE_VFS_FTP], [test "$enable_vfs" = "yes" -a x"$enable_vfs_ftp" = x"yes"]) +]) diff --git a/m4.include/vfs/mc-vfs-sfs.m4 b/m4.include/vfs/mc-vfs-sfs.m4 new file mode 100644 index 0000000..ec4e6d2 --- /dev/null +++ b/m4.include/vfs/mc-vfs-sfs.m4 @@ -0,0 +1,12 @@ +dnl SFS support +AC_DEFUN([mc_VFS_SFS], +[ + AC_ARG_ENABLE([vfs-sfs], + AS_HELP_STRING([--enable-vfs-sfs], [Support for sfs filesystem @<:@yes@:>@])) + if test "$enable_vfs" = "yes" -a x"$enable_vfs_sfs" != x"no"; then + enable_vfs_sfs="yes" + mc_VFS_ADDNAME([sfs]) + AC_DEFINE([ENABLE_VFS_SFS], [1], [Support for sfs]) + fi + AM_CONDITIONAL(ENABLE_VFS_SFS, [test "$enable_vfs" = "yes" -a x"$enable_vfs_sfs" = x"yes"]) +]) diff --git a/m4.include/vfs/mc-vfs-sftp.m4 b/m4.include/vfs/mc-vfs-sftp.m4 new file mode 100644 index 0000000..581b144 --- /dev/null +++ b/m4.include/vfs/mc-vfs-sftp.m4 @@ -0,0 +1,22 @@ +dnl Enable SFTP filesystem +AC_DEFUN([mc_VFS_SFTP], +[ + AC_ARG_ENABLE([vfs-sftp], + AS_HELP_STRING([--enable-vfs-sftp], [Support for SFTP filesystem [auto]])) + if test "$enable_vfs" != "no" -a x"$enable_vfs_sftp" != x"no"; then + PKG_CHECK_MODULES(LIBSSH, [libssh2 >= 1.2.8], [found_libssh=yes], [:]) + if test x"$found_libssh" = "xyes"; then + mc_VFS_ADDNAME([sftp]) + AC_DEFINE([ENABLE_VFS_SFTP], [1], [Support for SFTP filesystem]) + MCLIBS="$MCLIBS $LIBSSH_LIBS" + enable_vfs_sftp="yes" + else + if test x"$enable_vfs_sftp" = x"yes"; then + dnl user explicitly requested feature + AC_MSG_ERROR([libssh2 >= 1.2.8 library not found]) + fi + enable_vfs_sftp="no" + fi + fi + AM_CONDITIONAL([ENABLE_VFS_SFTP], [test "$enable_vfs" = "yes" -a x"$enable_vfs_sftp" = x"yes"]) +]) diff --git a/m4.include/vfs/mc-vfs-tarfs.m4 b/m4.include/vfs/mc-vfs-tarfs.m4 new file mode 100644 index 0000000..5feb215 --- /dev/null +++ b/m4.include/vfs/mc-vfs-tarfs.m4 @@ -0,0 +1,12 @@ +dnl TAR filesystem support +AC_DEFUN([mc_VFS_TARFS], +[ + AC_ARG_ENABLE([vfs-tar], + AS_HELP_STRING([--enable-vfs-tar], [Support for tar filesystem @<:@yes@:>@])) + if test "$enable_vfs" = "yes" -a x"$enable_vfs_tar" != x"no"; then + enable_vfs_tar="yes" + mc_VFS_ADDNAME([tar]) + AC_DEFINE([ENABLE_VFS_TAR], [1], [Support for tar filesystem]) + fi + AM_CONDITIONAL(ENABLE_VFS_TAR, [test "$enable_vfs" = "yes" -a x"$enable_vfs_tar" = x"yes"]) +]) diff --git a/m4.include/vfs/mc-vfs-undelfs.m4 b/m4.include/vfs/mc-vfs-undelfs.m4 new file mode 100644 index 0000000..ab6fd3f --- /dev/null +++ b/m4.include/vfs/mc-vfs-undelfs.m4 @@ -0,0 +1,55 @@ +dnl mc_UNDELFS_CHECKS +dnl Check for ext2fs undel support. +dnl Set shell variable ext2fs_undel to "yes" if we have it, +dnl "no" otherwise. May define ENABLE_VFS_UNDELFS for cpp. +dnl Will set EXT2FS_UNDEL_LIBS to required libraries. + +AC_DEFUN([mc_UNDELFS_CHECKS], [ + ext2fs_undel=no + EXT2FS_UNDEL_LIBS= + + dnl Use result of mc_EXT2FS_ATTR that was called earlier + if test "x$ext2fs_attr_msg" = "xyes"; then + com_err=no + + PKG_CHECK_MODULES(COM_ERR, [com_err >= 1.42.4], [com_err=yes], [:]) + + if test x"$com_err" = "xyes"; then + EXT2FS_UNDEL_LIBS="$EXT2FS_LIBS $COM_ERR_LIBS" + ext2fs_undel=yes + fi + fi + +]) + +dnl +dnl Ext2fs undelete support +dnl +AC_DEFUN([mc_VFS_UNDELFS], +[ + AC_ARG_ENABLE([vfs-undelfs], + AS_HELP_STRING([--enable-vfs-undelfs], [Support for ext2 undelete filesystem @<:@no@:>@]), + [ + if test "x$enableval" = "xno"; then + enable_vfs_undelfs=no + else + enable_vfs_undelfs=yes + fi + ], + [enable_vfs_undelfs="no"]) + + if test x"$enable_vfs" = x"yes" -a x"$enable_vfs_undelfs" != x"no"; then + mc_UNDELFS_CHECKS + + if test x"$ext2fs_undel" = x"yes"; then + enable_vfs_undelfs="yes" + mc_VFS_ADDNAME([undelfs]) + AC_DEFINE(ENABLE_VFS_UNDELFS, [1], [Support for ext2 undelfs]) + AC_MSG_NOTICE([using ext2fs file recovery code]) + MCLIBS="$MCLIBS $EXT2FS_UNDEL_LIBS" + else + AC_MSG_ERROR([Ext2 libraries not found]) + fi + fi + AM_CONDITIONAL(ENABLE_VFS_UNDELFS, [test "$enable_vfs" = "yes" -a x"$enable_vfs_undelfs" = x"yes"]) +]) diff --git a/m4.include/vfs/rpc.m4 b/m4.include/vfs/rpc.m4 new file mode 100644 index 0000000..43490d9 --- /dev/null +++ b/m4.include/vfs/rpc.m4 @@ -0,0 +1,17 @@ +AC_DEFUN([AC_CHECK_RPC], +[ + AC_CHECK_FUNCS(pmap_set, , [ + AC_CHECK_LIB(rpc, pmap_set, [ + LIBS="-lrpc $LIBS" + AC_DEFINE(HAVE_PMAP_SET) + ])]) + AC_CHECK_FUNCS(pmap_getport pmap_getmaps rresvport) + dnl add for source routing support setsockopt + AC_CHECK_HEADERS(rpc/pmap_clnt.h, , , [ +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <rpc/rpc.h> +#include <rpc/pmap_prot.h> + ]) +]) diff --git a/m4.include/vfs/socket.m4 b/m4.include/vfs/socket.m4 new file mode 100644 index 0000000..3cbfe05 --- /dev/null +++ b/m4.include/vfs/socket.m4 @@ -0,0 +1,13 @@ +AC_DEFUN([AC_REQUIRE_SOCKET], +[ + AC_SEARCH_LIBS(socket, [xnet bsd socket inet], [have_socket=yes]) + if test x"$have_socket" = x"yes"; then + AC_SEARCH_LIBS(gethostbyname, [bsd socket inet netinet nsl]) + AC_CHECK_MEMBERS([struct linger.l_linger], , , [ +#include <sys/types.h> +#include <sys/socket.h> + ]) + else + AC_MSG_ERROR([Couldnt find socket functions]) + fi +]) |