Package versions newer than 0.28 require meson/ninja which OpenWrt does not support in its build environment. These files provide the minimum autotool configuration necessary to build later versions. Signed-off-by: Ted Hess <thess@kitschensync.net>lilik-openwrt-22.03
@ -0,0 +1,33 @@ | |||
ACLOCAL_AMFLAGS = -I m4 | |||
AUTOMAKE_OPTIONS = foreign 1.11 dist-xz subdir-objects | |||
bin_PROGRAMS = src/mpc | |||
src_mpc_SOURCES = \ | |||
src/main.c src/mpc.h \ | |||
src/list.c src/list.h \ | |||
src/password.c src/password.h \ | |||
src/status.c src/status.h \ | |||
src/args.c src/args.h \ | |||
src/format.c src/format.h \ | |||
src/song_format.c src/song_format.h \ | |||
src/util.c src/util.h \ | |||
src/command.c src/command.h \ | |||
src/queue.c src/queue.h \ | |||
src/sticker.c src/sticker.h \ | |||
src/tab.c src/tab.h \ | |||
src/idle.c src/idle.h \ | |||
src/message.c src/message.h \ | |||
src/search.c src/search.h \ | |||
src/output.c src/output.h \ | |||
src/options.c src/options.h \ | |||
src/path.c src/path.h \ | |||
src/Compiler.h | |||
if HAVE_ICONV | |||
src_mpc_SOURCES += src/charset.c src/charset.h | |||
endif | |||
src_mpc_CPPFLAGS = $(AM_CPPFLAGS) $(ICONV_CFLAGS) $(LIBMPDCLIENT_CFLAGS) | |||
src_mpc_LDADD = $(ICONV_LIBS) $(LIBMPDCLIENT_LIBS) | |||
@ -0,0 +1,61 @@ | |||
/* config.h.in. Generated from configure.ac by autoheader. */ | |||
/* Define if iconv() support is enabled */ | |||
#undef HAVE_ICONV | |||
/* Define to 1 if you have the <inttypes.h> header file. */ | |||
#undef HAVE_INTTYPES_H | |||
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ | |||
#undef HAVE_LANGINFO_CODESET | |||
/* Define to 1 if you have the <memory.h> header file. */ | |||
#undef HAVE_MEMORY_H | |||
/* Define to 1 if you have the <stdint.h> header file. */ | |||
#undef HAVE_STDINT_H | |||
/* Define to 1 if you have the <stdlib.h> header file. */ | |||
#undef HAVE_STDLIB_H | |||
/* Define to 1 if you have the <strings.h> header file. */ | |||
#undef HAVE_STRINGS_H | |||
/* Define to 1 if you have the <string.h> header file. */ | |||
#undef HAVE_STRING_H | |||
/* Define to 1 if you have the <sys/stat.h> header file. */ | |||
#undef HAVE_SYS_STAT_H | |||
/* Define to 1 if you have the <sys/types.h> header file. */ | |||
#undef HAVE_SYS_TYPES_H | |||
/* Define to 1 if you have the <unistd.h> header file. */ | |||
#undef HAVE_UNISTD_H | |||
/* Name of package */ | |||
#undef PACKAGE | |||
/* Define to the address where bug reports for this package should be sent. */ | |||
#undef PACKAGE_BUGREPORT | |||
/* Define to the full name of this package. */ | |||
#undef PACKAGE_NAME | |||
/* Define to the full name and version of this package. */ | |||
#undef PACKAGE_STRING | |||
/* Define to the one symbol short name of this package. */ | |||
#undef PACKAGE_TARNAME | |||
/* Define to the home page for this package. */ | |||
#undef PACKAGE_URL | |||
/* Define to the version of this package. */ | |||
#undef PACKAGE_VERSION | |||
/* Define to 1 if you have the ANSI C header files. */ | |||
#undef STDC_HEADERS | |||
/* Version number of package */ | |||
#undef VERSION |
@ -0,0 +1,177 @@ | |||
AC_PREREQ(2.60) | |||
AC_INIT(mpc, 0.30, musicpd-dev-team@lists.sourceforge.net) | |||
AC_CONFIG_MACRO_DIR([m4]) | |||
AC_CONFIG_SRCDIR(src/main.c) | |||
AM_INIT_AUTOMAKE([foreign 1.11 dist-xz subdir-objects]) | |||
AM_SILENT_RULES | |||
AC_CONFIG_HEADERS(config.h) | |||
dnl | |||
dnl programs | |||
dnl | |||
AC_PROG_CC_C99 | |||
AC_PROG_INSTALL | |||
AC_PROG_MAKE_SET | |||
PKG_PROG_PKG_CONFIG | |||
dnl | |||
dnl declare variables | |||
dnl | |||
AC_SUBST(AM_CFLAGS) | |||
AC_SUBST(AM_CPPFLAGS) | |||
dnl | |||
dnl OS specific defaults | |||
dnl | |||
case "$host" in | |||
*-mingw32* | *-windows* | *-cygwin*) | |||
AM_CFLAGS="$AM_CFLAGS -mms-bitfields -fno-strict-aliasing" | |||
;; | |||
esac | |||
if test -z "$prefix" || test "x$prefix" = xNONE; then | |||
local_lib= | |||
local_include= | |||
# aren't autotools supposed to be smart enough to figure this out? | |||
# oh well, the git-core Makefile managed to do some of the work for us :) | |||
case "`uname -s | tr A-Z a-z`" in | |||
darwin*) | |||
local_lib='/sw/lib /opt/local/lib' | |||
local_include='/sw/include /opt/local/include' | |||
;; | |||
freebsd* | openbsd*) | |||
local_lib=/usr/local/lib | |||
local_include=/usr/local/include | |||
;; | |||
netbsd*) | |||
local_lib=/usr/pkg/lib | |||
local_include=/usr/pkg/include | |||
LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/pkg/lib" | |||
;; | |||
esac | |||
for d in $local_lib; do | |||
if test -d "$d"; then | |||
LDFLAGS="$LDFLAGS -L$d" | |||
break | |||
fi | |||
done | |||
for d in $local_include; do | |||
if test -d "$d"; then | |||
CFLAGS="$CFLAGS -I$d" | |||
break | |||
fi | |||
done | |||
fi | |||
dnl | |||
dnl libc features | |||
dnl | |||
PKG_CHECK_MODULES([LIBMPDCLIENT], [libmpdclient >= 2.9],, | |||
[AC_MSG_ERROR([libmpdclient 2.9 is required])]) | |||
dnl | |||
dnl i18n / l10n (iconv) | |||
dnl | |||
AC_ARG_ENABLE(iconv, | |||
AS_HELP_STRING([--disable-iconv], | |||
[disable iconv support (default: enable)]),, | |||
[enable_iconv=yes]) | |||
if test x$enable_iconv = xyes; then | |||
AC_CHECK_FUNC(iconv, | |||
[ICONV_CFLAGS="" ICONV_LIBS=""], | |||
[AC_CHECK_LIB(intl, iconv, | |||
[ICONV_CFLAGS="" ICONV_LIBS="-lintl"], | |||
[enable_iconv=no])]) | |||
fi | |||
if test x$enable_iconv = xyes; then | |||
AC_CHECK_HEADER([locale.h],, [enable_iconv=no]) | |||
if test x$enable_iconv != xyes; then | |||
AC_MSG_WARN(locale.h not available - disabling iconv) | |||
fi | |||
fi | |||
if test x$enable_iconv = xyes; then | |||
AC_DEFINE(HAVE_ICONV, 1, [Define if iconv() support is enabled]) | |||
else | |||
ICONV_CPPFLAGS="" | |||
ICONV_LIBS="" | |||
fi | |||
AC_SUBST(ICONV_CPPFLAGS) | |||
AC_SUBST(ICONV_LIBS) | |||
AM_CONDITIONAL(HAVE_ICONV, test x$enable_iconv = xyes) | |||
dnl | |||
dnl CFLAGS | |||
dnl | |||
AX_APPEND_COMPILE_FLAGS([-Wall]) | |||
AX_APPEND_COMPILE_FLAGS([-Wextra]) | |||
AX_APPEND_COMPILE_FLAGS([-Wno-deprecated-declarations]) | |||
AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes]) | |||
AX_APPEND_COMPILE_FLAGS([-Wshadow]) | |||
AX_APPEND_COMPILE_FLAGS([-Wpointer-arith]) | |||
AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes]) | |||
AX_APPEND_COMPILE_FLAGS([-Wcast-qual]) | |||
AX_APPEND_COMPILE_FLAGS([-Wwrite-strings]) | |||
dnl | |||
dnl build options | |||
dnl | |||
AC_ARG_ENABLE(werror, | |||
AS_HELP_STRING([--enable-werror], | |||
[Treat warnings as errors @<:@default=disabled@:>@]),, | |||
enable_werror=no) | |||
if test "x$enable_werror" = xyes; then | |||
AM_CFLAGS="$AM_CFLAGS -Werror -pedantic-errors" | |||
fi | |||
AC_ARG_ENABLE(debug, | |||
AS_HELP_STRING([--enable-debug], | |||
[Enable debugging @<:@default=disabled@:>@]),, | |||
enable_debug=no) | |||
if test "x$enable_debug" = xno; then | |||
AM_CPPFLAGS="$AM_CPPFLAGS -DNDEBUG" | |||
AX_APPEND_COMPILE_FLAGS([-ffunction-sections]) | |||
AX_APPEND_COMPILE_FLAGS([-fdata-sections]) | |||
AX_APPEND_COMPILE_FLAGS([-fvisibility=hidden]) | |||
AX_APPEND_LINK_FLAGS([-Wl,--gc-sections]) | |||
fi | |||
AC_ARG_ENABLE(test, | |||
AS_HELP_STRING([--enable-test], | |||
[build the test programs (default: disabled)]),, | |||
enable_test=no) | |||
if test "x$enable_test" = xyes; then | |||
AM_PATH_CHECK(,, [AC_MSG_ERROR([check not found])]) | |||
fi | |||
AM_CONDITIONAL(ENABLE_TEST, test "x$enable_test" = xyes) | |||
dnl | |||
AC_OUTPUT(Makefile) |
@ -0,0 +1,65 @@ | |||
# =========================================================================== | |||
# http://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html | |||
# =========================================================================== | |||
# | |||
# SYNOPSIS | |||
# | |||
# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS]) | |||
# | |||
# 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. | |||
# | |||
# 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> | |||
# | |||
# This program is free software: you can redistribute it and/or modify it | |||
# under the terms of the GNU General Public License as published by the | |||
# Free Software Foundation, either version 3 of the License, or (at your | |||
# option) any later version. | |||
# | |||
# This program is distributed in the hope that it will be useful, but | |||
# WITHOUT ANY WARRANTY; without even the implied warranty of | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | |||
# Public License for more details. | |||
# | |||
# You should have received a copy of the GNU General Public License along | |||
# with this program. If not, see <http://www.gnu.org/licenses/>. | |||
# | |||
# As a special exception, the respective Autoconf Macro's copyright owner | |||
# gives unlimited permission to copy, distribute and modify the configure | |||
# scripts that are the output of Autoconf when processing the Macro. You | |||
# need not follow the terms of the GNU General Public License when using | |||
# or distributing such scripts, even though portions of the text of the | |||
# Macro appear in them. The GNU General Public License (GPL) does govern | |||
# all other use of the material that constitutes the Autoconf Macro. | |||
# | |||
# This special exception to the GPL applies to versions of the Autoconf | |||
# Macro released by the Autoconf Archive. When you make and distribute a | |||
# modified version of the Autoconf Macro, you may extend this special | |||
# exception to the GPL to apply to your modified version as well. | |||
#serial 4 | |||
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]) | |||
done | |||
])dnl AX_APPEND_COMPILE_FLAGS |
@ -0,0 +1,71 @@ | |||
# =========================================================================== | |||
# http://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> | |||
# | |||
# This program is free software: you can redistribute it and/or modify it | |||
# under the terms of the GNU General Public License as published by the | |||
# Free Software Foundation, either version 3 of the License, or (at your | |||
# option) any later version. | |||
# | |||
# This program is distributed in the hope that it will be useful, but | |||
# WITHOUT ANY WARRANTY; without even the implied warranty of | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | |||
# Public License for more details. | |||
# | |||
# You should have received a copy of the GNU General Public License along | |||
# with this program. If not, see <http://www.gnu.org/licenses/>. | |||
# | |||
# As a special exception, the respective Autoconf Macro's copyright owner | |||
# gives unlimited permission to copy, distribute and modify the configure | |||
# scripts that are the output of Autoconf when processing the Macro. You | |||
# need not follow the terms of the GNU General Public License when using | |||
# or distributing such scripts, even though portions of the text of the | |||
# Macro appear in them. The GNU General Public License (GPL) does govern | |||
# all other use of the material that constitutes the Autoconf Macro. | |||
# | |||
# This special exception to the GPL applies to versions of the Autoconf | |||
# Macro released by the Autoconf Archive. When you make and distribute a | |||
# modified version of the Autoconf Macro, you may extend this special | |||
# exception to the GPL to apply to your modified version as well. | |||
#serial 6 | |||
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 |
@ -0,0 +1,63 @@ | |||
# =========================================================================== | |||
# http://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html | |||
# =========================================================================== | |||
# | |||
# SYNOPSIS | |||
# | |||
# AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS]) | |||
# | |||
# DESCRIPTION | |||
# | |||
# For every FLAG1, FLAG2 it is checked whether the linker works with the | |||
# flag. If it does, the flag is added FLAGS-VARIABLE | |||
# | |||
# If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is | |||
# used. During the check the flag is always added to the linker's flags. | |||
# | |||
# If EXTRA-FLAGS is defined, it is added to the linker's default flags | |||
# when the check is done. The check is thus made with the flags: "LDFLAGS | |||
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to | |||
# issue an error when a bad flag is given. | |||
# | |||
# NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG. | |||
# Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS. | |||
# | |||
# LICENSE | |||
# | |||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> | |||
# | |||
# This program is free software: you can redistribute it and/or modify it | |||
# under the terms of the GNU General Public License as published by the | |||
# Free Software Foundation, either version 3 of the License, or (at your | |||
# option) any later version. | |||
# | |||
# This program is distributed in the hope that it will be useful, but | |||
# WITHOUT ANY WARRANTY; without even the implied warranty of | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | |||
# Public License for more details. | |||
# | |||
# You should have received a copy of the GNU General Public License along | |||
# with this program. If not, see <http://www.gnu.org/licenses/>. | |||
# | |||
# As a special exception, the respective Autoconf Macro's copyright owner | |||
# gives unlimited permission to copy, distribute and modify the configure | |||
# scripts that are the output of Autoconf when processing the Macro. You | |||
# need not follow the terms of the GNU General Public License when using | |||
# or distributing such scripts, even though portions of the text of the | |||
# Macro appear in them. The GNU General Public License (GPL) does govern | |||
# all other use of the material that constitutes the Autoconf Macro. | |||
# | |||
# This special exception to the GPL applies to versions of the Autoconf | |||
# Macro released by the Autoconf Archive. When you make and distribute a | |||
# modified version of the Autoconf Macro, you may extend this special | |||
# exception to the GPL to apply to your modified version as well. | |||
#serial 4 | |||
AC_DEFUN([AX_APPEND_LINK_FLAGS], | |||
[AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) | |||
AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) | |||
for flag in $1; do | |||
AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3]) | |||
done | |||
])dnl AX_APPEND_LINK_FLAGS |
@ -0,0 +1,74 @@ | |||
# =========================================================================== | |||
# http://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> | |||
# | |||
# This program is free software: you can redistribute it and/or modify it | |||
# under the terms of the GNU General Public License as published by the | |||
# Free Software Foundation, either version 3 of the License, or (at your | |||
# option) any later version. | |||
# | |||
# This program is distributed in the hope that it will be useful, but | |||
# WITHOUT ANY WARRANTY; without even the implied warranty of | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | |||
# Public License for more details. | |||
# | |||
# You should have received a copy of the GNU General Public License along | |||
# with this program. If not, see <http://www.gnu.org/licenses/>. | |||
# | |||
# As a special exception, the respective Autoconf Macro's copyright owner | |||
# gives unlimited permission to copy, distribute and modify the configure | |||
# scripts that are the output of Autoconf when processing the Macro. You | |||
# need not follow the terms of the GNU General Public License when using | |||
# or distributing such scripts, even though portions of the text of the | |||
# Macro appear in them. The GNU General Public License (GPL) does govern | |||
# all other use of the material that constitutes the Autoconf Macro. | |||
# | |||
# This special exception to the GPL applies to versions of the Autoconf | |||
# Macro released by the Autoconf Archive. When you make and distribute a | |||
# modified version of the Autoconf Macro, you may extend this special | |||
# exception to the GPL to apply to your modified version as well. | |||
#serial 4 | |||
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 |
@ -0,0 +1,74 @@ | |||
# =========================================================================== | |||
# http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html | |||
# =========================================================================== | |||
# | |||
# SYNOPSIS | |||
# | |||
# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) | |||
# | |||
# DESCRIPTION | |||
# | |||
# Check whether the given FLAG works with the linker or gives an error. | |||
# (Warnings, however, are ignored) | |||
# | |||
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on | |||
# success/failure. | |||
# | |||
# If EXTRA-FLAGS is defined, it is added to the linker's default flags | |||
# when the check is done. The check is thus made with the flags: "LDFLAGS | |||
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to | |||
# issue an error when a bad flag is given. | |||
# | |||
# INPUT gives an alternative input source to AC_LINK_IFELSE. | |||
# | |||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this | |||
# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. | |||
# | |||
# LICENSE | |||
# | |||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> | |||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> | |||
# | |||
# This program is free software: you can redistribute it and/or modify it | |||
# under the terms of the GNU General Public License as published by the | |||
# Free Software Foundation, either version 3 of the License, or (at your | |||
# option) any later version. | |||
# | |||
# This program is distributed in the hope that it will be useful, but | |||
# WITHOUT ANY WARRANTY; without even the implied warranty of | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | |||
# Public License for more details. | |||
# | |||
# You should have received a copy of the GNU General Public License along | |||
# with this program. If not, see <http://www.gnu.org/licenses/>. | |||
# | |||
# As a special exception, the respective Autoconf Macro's copyright owner | |||
# gives unlimited permission to copy, distribute and modify the configure | |||
# scripts that are the output of Autoconf when processing the Macro. You | |||
# need not follow the terms of the GNU General Public License when using | |||
# or distributing such scripts, even though portions of the text of the | |||
# Macro appear in them. The GNU General Public License (GPL) does govern | |||
# all other use of the material that constitutes the Autoconf Macro. | |||
# | |||
# This special exception to the GPL applies to versions of the Autoconf | |||
# Macro released by the Autoconf Archive. When you make and distribute a | |||
# modified version of the Autoconf Macro, you may extend this special | |||
# exception to the GPL to apply to your modified version as well. | |||
#serial 4 | |||
AC_DEFUN([AX_CHECK_LINK_FLAG], | |||
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF | |||
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl | |||
AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ | |||
ax_check_save_flags=$LDFLAGS | |||
LDFLAGS="$LDFLAGS $4 $1" | |||
AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], | |||
[AS_VAR_SET(CACHEVAR,[yes])], | |||
[AS_VAR_SET(CACHEVAR,[no])]) | |||
LDFLAGS=$ax_check_save_flags]) | |||
AS_VAR_IF(CACHEVAR,yes, | |||
[m4_default([$2], :)], | |||
[m4_default([$3], :)]) | |||
AS_VAR_POPDEF([CACHEVAR])dnl | |||
])dnl AX_CHECK_LINK_FLAGS |
@ -0,0 +1,37 @@ | |||
# =========================================================================== | |||
# http://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 1 | |||
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 |
@ -0,0 +1,132 @@ | |||
dnl AM_PATH_CHECK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) | |||
dnl Test for check, and define CHECK_CFLAGS and CHECK_LIBS | |||
dnl | |||
AC_DEFUN([AM_PATH_CHECK], | |||
[ | |||
AC_MSG_WARN([A@&t@M_PATH_CHECK() is deprecated]) | |||
AC_MSG_WARN([[use P@&t@KG_CHECK_MODULES([CHECK], [check >= 0.9.4]) instead]]) | |||
AC_ARG_WITH([check], | |||
[ --with-check=PATH prefix where check is installed [default=auto]]) | |||
min_check_version=ifelse([$1], ,0.8.2,$1) | |||
AC_MSG_CHECKING(for check - version >= $min_check_version) | |||
if test x$with_check = xno; then | |||
AC_MSG_RESULT(disabled) | |||
ifelse([$3], , AC_MSG_ERROR([disabling check is not supported]), [$3]) | |||
else | |||
if test "x$with_check" != x; then | |||
CHECK_CFLAGS="-I$with_check/include" | |||
CHECK_LIBS="-L$with_check/lib -lcheck" | |||
else | |||
CHECK_CFLAGS="" | |||
CHECK_LIBS="-lcheck" | |||
fi | |||
ac_save_CFLAGS="$CFLAGS" | |||
ac_save_LIBS="$LIBS" | |||
CFLAGS="$CFLAGS $CHECK_CFLAGS" | |||
LIBS="$CHECK_LIBS $LIBS" | |||
rm -f conf.check-test | |||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT([]) | |||
#include <check.h> | |||
int main () | |||
{ | |||
int major, minor, micro; | |||
char *tmp_version; | |||
system ("touch conf.check-test"); | |||
/* HP/UX 9 (%@#!) writes to sscanf strings */ | |||
tmp_version = strdup("$min_check_version"); | |||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |||
printf("%s, bad version string\n", "$min_check_version"); | |||
return 1; | |||
} | |||
if ((CHECK_MAJOR_VERSION != check_major_version) || | |||
(CHECK_MINOR_VERSION != check_minor_version) || | |||
(CHECK_MICRO_VERSION != check_micro_version)) | |||
{ | |||
printf("\n*** The check header file (version %d.%d.%d) does not match\n", | |||
CHECK_MAJOR_VERSION, CHECK_MINOR_VERSION, CHECK_MICRO_VERSION); | |||
printf("*** the check library (version %d.%d.%d).\n", | |||
check_major_version, check_minor_version, check_micro_version); | |||
return 1; | |||
} | |||
if ((check_major_version > major) || | |||
((check_major_version == major) && (check_minor_version > minor)) || | |||
((check_major_version == major) && (check_minor_version == minor) && (check_micro_version >= micro))) | |||
{ | |||
return 0; | |||
} | |||
else | |||
{ | |||
printf("\n*** An old version of check (%d.%d.%d) was found.\n", | |||
check_major_version, check_minor_version, check_micro_version); | |||
printf("*** You need a version of check being at least %d.%d.%d.\n", major, minor, micro); | |||
printf("***\n"); | |||
printf("*** If you have already installed a sufficiently new version, this error\n"); | |||
printf("*** probably means that the wrong copy of the check library and header\n"); | |||
printf("*** file is being found. Rerun configure with the --with-check=PATH option\n"); | |||
printf("*** to specify the prefix where the correct version was installed.\n"); | |||
} | |||
return 1; | |||
} | |||
])],, no_check=yes, [echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |||
CFLAGS="$ac_save_CFLAGS" | |||
LIBS="$ac_save_LIBS" | |||
if test "x$no_check" = x ; then | |||
AC_MSG_RESULT(yes) | |||
ifelse([$2], , :, [$2]) | |||
else | |||
AC_MSG_RESULT(no) | |||
if test -f conf.check-test ; then | |||
: | |||
else | |||
echo "*** Could not run check test program, checking why..." | |||
CFLAGS="$CFLAGS $CHECK_CFLAGS" | |||
LIBS="$CHECK_LIBS $LIBS" | |||
AC_TRY_LINK([ | |||
#include <stdio.h> | |||
#include <stdlib.h> | |||
#include <check.h> | |||
], , [ echo "*** The test program compiled, but did not run. This usually means" | |||
echo "*** that the run-time linker is not finding check. You'll need to set your" | |||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |||
echo "*** to the installed location Also, make sure you have run ldconfig if that" | |||
echo "*** is required on your system" | |||
echo "***" | |||
echo "*** If you have an old version installed, it is best to remove it, although" | |||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], | |||
[ echo "*** The test program failed to compile or link. See the file config.log for" | |||
echo "*** the exact error that occured." ]) | |||
CFLAGS="$ac_save_CFLAGS" | |||
LIBS="$ac_save_LIBS" | |||
fi | |||
CHECK_CFLAGS="" | |||
CHECK_LIBS="" | |||
rm -f conf.check-test | |||
ifelse([$3], , AC_MSG_ERROR([check not found]), [$3]) | |||
fi | |||
AC_SUBST(CHECK_CFLAGS) | |||
AC_SUBST(CHECK_LIBS) | |||
rm -f conf.check-test | |||
fi | |||
]) |