All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] igt: Fix detection of missing flex
@ 2017-05-26 11:11 Tvrtko Ursulin
  2017-05-30 11:59 ` Petri Latvala
  0 siblings, 1 reply; 2+ messages in thread
From: Tvrtko Ursulin @ 2017-05-26 11:11 UTC (permalink / raw)
  To: Intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

AM_PROG_FLEX macro will set the LEX variable using the missing
script when the flex is not present. This will confuse the
configure.ac check, which expects the AC_PROG_FLEX behaviour,
and will so fail to detect the missing flex:

	AS_IF([test x"$LEX" != "x:" -a x"$YACC" != xyacc],
		[enable_assembler=yes],
		[enable_assembler=no])

This is because AM_PROG_LEX sets the LEX variable to
"${SHELL} /home/sc/intel-gpu-tools/build-aux/missing flex",
while AC_PROG_LEX would set it to ":".

If for some reason we really need to keep AM_PROG_LEX,
alternative fix could be something like this placed before
the above AS_IF check:

	AC_MSG_CHECKING([checking for working flex])
	if ! eval "$LEX --version >/dev/null 2>&1"; then
		AC_MSG_RESULT([failed])
		LEX=:
	else
		AC_MSG_RESULT([pass])
	fi

Note the evil eval needed to recursively expand variables.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 5342e33c8293..82857a8325b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,7 +40,7 @@ AM_INIT_AUTOMAKE([1.12 foreign subdir-objects dist-bzip2])
 AM_PATH_PYTHON([3],, [:])
 
 AC_PROG_CC
-AM_PROG_LEX
+AC_PROG_LEX
 AC_PROG_YACC
 
 # check for gtk-doc
-- 
2.9.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH i-g-t] igt: Fix detection of missing flex
  2017-05-26 11:11 [PATCH i-g-t] igt: Fix detection of missing flex Tvrtko Ursulin
@ 2017-05-30 11:59 ` Petri Latvala
  0 siblings, 0 replies; 2+ messages in thread
From: Petri Latvala @ 2017-05-30 11:59 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: Intel-gfx

On Fri, May 26, 2017 at 12:11:04PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> AM_PROG_FLEX macro will set the LEX variable using the missing
> script when the flex is not present. This will confuse the
> configure.ac check, which expects the AC_PROG_FLEX behaviour,
> and will so fail to detect the missing flex:
> 
> 	AS_IF([test x"$LEX" != "x:" -a x"$YACC" != xyacc],
> 		[enable_assembler=yes],
> 		[enable_assembler=no])
> 
> This is because AM_PROG_LEX sets the LEX variable to
> "${SHELL} /home/sc/intel-gpu-tools/build-aux/missing flex",
> while AC_PROG_LEX would set it to ":".


Good catch!


> 
> If for some reason we really need to keep AM_PROG_LEX,
> alternative fix could be something like this placed before
> the above AS_IF check:
> 
> 	AC_MSG_CHECKING([checking for working flex])
> 	if ! eval "$LEX --version >/dev/null 2>&1"; then
> 		AC_MSG_RESULT([failed])
> 		LEX=:
> 	else
> 		AC_MSG_RESULT([pass])
> 	fi
> 
> Note the evil eval needed to recursively expand variables.


As far as I can tell, A*_PROG_LEX is only used to be able to select
whether to build the assembler. In other words, we don't need to
AM_PROG_LEX behaviour.

There's still a bug left though: If flex is not found, but lex is,
AC_PROG_LEX sets $LEX to 'lex', but assembler/Makefile.am hardcodes
'flex -i' anyway if the assembler is enabled. That still happens
whether AM_ or AC_ is used so this patch is still an improvement.


I would also like to note that the ratio of
characters-in-commit-message to characters-changed-in-code is quite
the winner. :P



Reviewed-by: Petri Latvala <petri.latvala@intel.com>




> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>  configure.ac | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 5342e33c8293..82857a8325b1 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -40,7 +40,7 @@ AM_INIT_AUTOMAKE([1.12 foreign subdir-objects dist-bzip2])
>  AM_PATH_PYTHON([3],, [:])
>  
>  AC_PROG_CC
> -AM_PROG_LEX
> +AC_PROG_LEX
>  AC_PROG_YACC
>  
>  # check for gtk-doc
> -- 
> 2.9.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-30 11:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-26 11:11 [PATCH i-g-t] igt: Fix detection of missing flex Tvrtko Ursulin
2017-05-30 11:59 ` Petri Latvala

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.