Use pkg-config instead of automake m4 macros for check

This commit is contained in:
Pradana AUMARS 2021-06-27 22:04:43 +02:00
parent 0cc45de949
commit 45a80ef9b5
2 changed files with 233 additions and 163 deletions

394
configure vendored
View File

@ -664,6 +664,9 @@ LTLIBOBJS
LIBOBJS LIBOBJS
CHECK_LIBS CHECK_LIBS
CHECK_CFLAGS CHECK_CFLAGS
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
LT_SYS_LIBRARY_PATH LT_SYS_LIBRARY_PATH
OTOOL64 OTOOL64
OTOOL OTOOL
@ -790,7 +793,6 @@ with_aix_soname
with_gnu_ld with_gnu_ld
with_sysroot with_sysroot
enable_libtool_lock enable_libtool_lock
with_check
' '
ac_precious_vars='build_alias ac_precious_vars='build_alias
host_alias host_alias
@ -800,7 +802,12 @@ CFLAGS
LDFLAGS LDFLAGS
LIBS LIBS
CPPFLAGS CPPFLAGS
LT_SYS_LIBRARY_PATH' LT_SYS_LIBRARY_PATH
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
CHECK_CFLAGS
CHECK_LIBS'
# Initialize some variables set by options. # Initialize some variables set by options.
@ -1451,7 +1458,6 @@ Optional Packages:
--with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-sysroot[=DIR] Search for dependent libraries within DIR (or the --with-sysroot[=DIR] Search for dependent libraries within DIR (or the
compiler's sysroot if not specified). compiler's sysroot if not specified).
--with-check=PATH prefix where check is installed default=auto
Some influential environment variables: Some influential environment variables:
CC C compiler command CC C compiler command
@ -1463,6 +1469,14 @@ Some influential environment variables:
you have headers in a nonstandard directory <include dir> you have headers in a nonstandard directory <include dir>
LT_SYS_LIBRARY_PATH LT_SYS_LIBRARY_PATH
User-defined run-time library search path. User-defined run-time library search path.
PKG_CONFIG path to pkg-config utility
PKG_CONFIG_PATH
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
CHECK_CFLAGS
C compiler flags for CHECK, overriding pkg-config
CHECK_LIBS linker flags for CHECK, overriding pkg-config
Use these variables to override the choices made by `configure' or to help Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations. it to find libraries and programs with nonstandard names/locations.
@ -12577,170 +12591,226 @@ CC=$lt_save_CC
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: AM_PATH_CHECK() is deprecated" >&5
printf "%s\n" "$as_me: WARNING: AM_PATH_CHECK() is deprecated" >&2;}
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: use PKG_CHECK_MODULES([CHECK], [check >= 0.9.4]) instead" >&5
printf "%s\n" "$as_me: WARNING: use PKG_CHECK_MODULES([CHECK], [check >= 0.9.4]) instead" >&2;}
# Check whether --with-check was given.
if test ${with_check+y}
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_path_PKG_CONFIG+y}
then : then :
withval=$with_check; printf %s "(cached) " >&6
fi
min_check_version=0.8.2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for check - version >= $min_check_version" >&5
printf %s "checking for check - version >= $min_check_version... " >&6; }
if test x$with_check = xno; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
printf "%s\n" "disabled" >&6; }
as_fn_error $? "disabling check is not supported" "$LINENO" 5
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
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$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, &micro) != 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;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
else $as_nop else $as_nop
no_check=yes case $PKG_CONFIG in
fi [\\/]* | ?:[\\/]*)
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
CFLAGS="$ac_save_CFLAGS" *)
LIBS="$ac_save_LIBS" as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
if test "x$no_check" = x ; then do
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 IFS=$as_save_IFS
printf "%s\n" "yes" >&6; } case $as_dir in #(((
: '') as_dir=./ ;;
else */) ;;
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 *) as_dir=$as_dir/ ;;
printf "%s\n" "no" >&6; } esac
if test -f conf.check-test ; then for ac_exec_ext in '' $ac_executable_extensions; do
: if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
else ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext"
echo "*** Could not run check test program, checking why..." printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
CFLAGS="$CFLAGS $CHECK_CFLAGS" break 2
LIBS="$CHECK_LIBS $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdio.h>
#include <stdlib.h>
#include <check.h>
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
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"
else $as_nop
echo "*** The test program failed to compile or link. See the file config.log for"
echo "*** the exact error that occured."
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
CHECK_CFLAGS=""
CHECK_LIBS=""
rm -f conf.check-test
as_fn_error $? "check not found" "$LINENO" 5
fi
rm -f conf.check-test
fi fi
done
done
IFS=$as_save_IFS
;;
esac
fi
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
printf "%s\n" "$PKG_CONFIG" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
fi
if test -z "$ac_cv_path_PKG_CONFIG"; then
ac_pt_PKG_CONFIG=$PKG_CONFIG
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_path_ac_pt_PKG_CONFIG+y}
then :
printf %s "(cached) " >&6
else $as_nop
case $ac_pt_PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
if test -n "$ac_pt_PKG_CONFIG"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
if test "x$ac_pt_PKG_CONFIG" = x; then
PKG_CONFIG=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
PKG_CONFIG=$ac_pt_PKG_CONFIG
fi
else
PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
fi
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=0.9.0
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
PKG_CONFIG=""
fi
fi
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for check >= 0.9.4" >&5
printf %s "checking for check >= 0.9.4... " >&6; }
if test -n "$CHECK_CFLAGS"; then
pkg_cv_CHECK_CFLAGS="$CHECK_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"check >= 0.9.4\""; } >&5
($PKG_CONFIG --exists --print-errors "check >= 0.9.4") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_CHECK_CFLAGS=`$PKG_CONFIG --cflags "check >= 0.9.4" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$CHECK_LIBS"; then
pkg_cv_CHECK_LIBS="$CHECK_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"check >= 0.9.4\""; } >&5
($PKG_CONFIG --exists --print-errors "check >= 0.9.4") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_CHECK_LIBS=`$PKG_CONFIG --libs "check >= 0.9.4" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
CHECK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "check >= 0.9.4" 2>&1`
else
CHECK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "check >= 0.9.4" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$CHECK_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (check >= 0.9.4) were not met:
$CHECK_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables CHECK_CFLAGS
and CHECK_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables CHECK_CFLAGS
and CHECK_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
CHECK_CFLAGS=$pkg_cv_CHECK_CFLAGS
CHECK_LIBS=$pkg_cv_CHECK_LIBS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
fi
ac_config_files="$ac_config_files Makefile src/Makefile tests/Makefile" ac_config_files="$ac_config_files Makefile src/Makefile tests/Makefile"

View File

@ -5,7 +5,7 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC AC_PROG_CC
AM_PROG_AR AM_PROG_AR
LT_INIT LT_INIT
AM_PATH_CHECK PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
AC_CONFIG_FILES([ AC_CONFIG_FILES([
Makefile Makefile
src/Makefile src/Makefile