sim: bfin: move pkg-config & SDL checks to common code

This reduces the unique logic in bfin/configure to make it easier to
(eventually) unify it entirely.
This commit is contained in:
Mike Frysinger 2021-06-26 10:43:27 -04:00
parent f1fa7a3d88
commit d57b653328
12 changed files with 319 additions and 1196 deletions

View File

@ -1,3 +1,11 @@
2021-06-27 Mike Frysinger <vapier@gentoo.org>
* arch-subdir.mk.in: Move SDL_CFLAGS & SDL_LIBS from bfin/Makefile.in.
* m4/sim_ac_platform.m4: Call PKG_CHECK_MODULES and export SDL_CFLAGS
and SDL_LIBS.
* m4/sim_ac_toolchain.m4: Call PKG_PROG_PKG_CONFIG.
* aclocal.m4, configure, Makefile.in: Regenerate.
2021-06-23 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_BUILD_TARGET): Simplify sed script.

View File

@ -199,6 +199,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../config/pkg.m4 \
$(top_srcdir)/../config/plugins.m4 \
$(top_srcdir)/../config/zlib.m4 $(top_srcdir)/../libtool.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
@ -702,11 +703,16 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKGVERSION = @PKGVERSION@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
POSUB = @POSUB@
RANLIB = @RANLIB@
RANLIB_FOR_BUILD = @RANLIB_FOR_BUILD@
REPORT_BUGS_TEXI = @REPORT_BUGS_TEXI@
REPORT_BUGS_TO = @REPORT_BUGS_TO@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_LIBS = @SDL_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@

1
sim/aclocal.m4 vendored
View File

@ -1172,6 +1172,7 @@ m4_include([../config/depstand.m4])
m4_include([../config/gettext-sister.m4])
m4_include([../config/lead-dot.m4])
m4_include([../config/override.m4])
m4_include([../config/pkg.m4])
m4_include([../config/plugins.m4])
m4_include([../config/zlib.m4])
m4_include([../libtool.m4])

View File

@ -49,6 +49,8 @@ zlibdir = @zlibdir@
LIBINTL = @LIBINTL@
LIBINTL_DEP = @LIBINTL_DEP@
INTL_CFLAGS = @INCINTL@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_LIBS = @SDL_LIBS@
COMMON_LIBS = @LIBS@
WARN_CFLAGS = @WARN_CFLAGS@

View File

@ -1,3 +1,10 @@
2021-06-27 Mike Frysinger <vapier@gentoo.org>
* Makefile.in: Change to $(SDL_CFLAGS) & $(SDL_LIBS).
* configure.ac: Delete PKG_PROG_PKG_CONFIG &
PKG_CHECK_MODULES calls.
* aclocal.m4, configure: Regenerate.
2021-06-24 Mike Frysinger <vapier@gentoo.org>
* interp.c (bfin_syscall): Set sc.arg5 & sc.arg6.

View File

@ -59,8 +59,8 @@ SIM_EXTRA_HW_DEVICES = \
bfin_wp \
eth_phy
SIM_EXTRA_CFLAGS = @SDL_CFLAGS@
SIM_EXTRA_LIBS = @SDL_LIBS@ -lm
SIM_EXTRA_CFLAGS = $(SDL_CFLAGS)
SIM_EXTRA_LIBS = $(SDL_LIBS) -lm
## COMMON_POST_CONFIG_FRAG

1
sim/bfin/aclocal.m4 vendored
View File

@ -12,6 +12,5 @@
# PARTICULAR PURPOSE.
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_include([../../config/pkg.m4])
m4_include([../m4/sim_ac_option_default_model.m4])
m4_include([../m4/sim_ac_output.m4])

1181
sim/bfin/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -4,14 +4,4 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
SIM_AC_OPTION_DEFAULT_MODEL(bf537)
PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES(SDL, sdl, [
AC_CHECK_LIB(dl, dlopen, [
SDL_CFLAGS="${SDL_CFLAGS} -DHAVE_SDL"
SDL_LIBS="-ldl"
], [SDL_CFLAGS= SDL_LIBS=])
], [:])
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
SIM_AC_OUTPUT

285
sim/configure vendored
View File

@ -694,6 +694,8 @@ am__isrc
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
SDL_LIBS
SDL_CFLAGS
lt_cv_dlopen_libs
OTOOL64
OTOOL
@ -729,6 +731,9 @@ LIBINTL
USE_NLS
LIBOBJS
C_DIALECT
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
RANLIB
AR
LDFLAGS_FOR_BUILD
@ -848,7 +853,12 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
CPP'
CPP
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
SDL_CFLAGS
SDL_LIBS'
ac_subdirs_all='bfin
bpf
cris
@ -1546,6 +1556,13 @@ Some influential environment variables:
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
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
SDL_CFLAGS C compiler flags for SDL, overriding pkg-config
SDL_LIBS linker flags for SDL, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@ -4717,6 +4734,126 @@ else
fi
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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PKG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PKG_CONFIG="$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
test -z "$as_dir" && as_dir=.
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_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$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
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
$as_echo "$PKG_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
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
test -z "$as_dir" && as_dir=.
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"
$as_echo "$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
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
$as_echo "$ac_pt_PKG_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_pt_PKG_CONFIG" = x; then
PKG_CONFIG=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
PKG_CONFIG=""
fi
fi
# Require C11 or newer. Autoconf-2.70 provides ac_cv_prog_cc_c11 when using
# AC_PROG_CC, but we're still using Autoconf-2.69, and the newest it understands
# is C99. So handle it ourselves.
@ -12041,7 +12178,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 12044 "configure"
#line 12181 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -12147,7 +12284,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 12150 "configure"
#line 12287 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -12568,6 +12705,148 @@ fi
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sdl" >&5
$as_echo_n "checking for sdl... " >&6; }
if test -n "$SDL_CFLAGS"; then
pkg_cv_SDL_CFLAGS="$SDL_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl\""; } >&5
($PKG_CONFIG --exists --print-errors "sdl") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$SDL_LIBS"; then
pkg_cv_SDL_LIBS="$SDL_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl\""; } >&5
($PKG_CONFIG --exists --print-errors "sdl") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = no; then
pkg_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $pkg_cv_SDL_LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
else
pkg_failed=yes
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$pkg_save_LDFLAGS
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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
SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "sdl" 2>&1`
else
SDL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "sdl" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$SDL_PKG_ERRORS" >&5
:
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
:
else
SDL_CFLAGS=$pkg_cv_SDL_CFLAGS
SDL_LIBS=$pkg_cv_SDL_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
$as_echo_n "checking for dlopen in -ldl... " >&6; }
if ${ac_cv_lib_dl_dlopen+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char dlopen ();
int
main ()
{
return dlopen ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_dl_dlopen=yes
else
ac_cv_lib_dl_dlopen=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
SDL_CFLAGS="${SDL_CFLAGS} -DHAVE_SDL"
SDL_LIBS="-ldl"
else
SDL_CFLAGS= SDL_LIBS=
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }

View File

@ -162,4 +162,13 @@ AC_CHECK_LIB(socket, bind)
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(m, fabs)
AC_CHECK_LIB(m, log2)
PKG_CHECK_MODULES(SDL, sdl, [dnl
AC_CHECK_LIB(dl, dlopen, [dnl
SDL_CFLAGS="${SDL_CFLAGS} -DHAVE_SDL"
SDL_LIBS="-ldl"
], [SDL_CFLAGS= SDL_LIBS=])
], [:])
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
])

View File

@ -49,6 +49,7 @@ AC_SUBST(LDFLAGS_FOR_BUILD)
AC_SUBST(CFLAGS)
AC_CHECK_TOOL(AR, ar)
AC_PROG_RANLIB
PKG_PROG_PKG_CONFIG
# Require C11 or newer. Autoconf-2.70 provides ac_cv_prog_cc_c11 when using
# AC_PROG_CC, but we're still using Autoconf-2.69, and the newest it understands