Skip to content

Commit

Permalink
configure.ac: Rework cython detection slightly
Browse files Browse the repository at this point in the history
Detecting cython version runs cython needlessly many times (one
for AS_ECHO(), one for major and one for minor version
extraction). Speaking of AS_ECHO(), the argument needs escaping
as it's not a single shell word.

Instead of fixing the escaping, let's rework the check a bit so
that cython is executed just once and AS_ECHO() is then replaced
with AC_MSG_CHECKING() AC_MSG_RESULT() combo.

The need for escaping can be seen with newer autotools-2.71.

Signed-off-by: Michal Privoznik <[email protected]>
Acked-by: Tom Hromatka <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
  • Loading branch information
zippy2 authored and pcmoore committed Apr 3, 2023
1 parent 5aceb9d commit 37889ff
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ dnl cython checks
dnl ####
AC_CHECK_PROGS(cython, cython3 cython, "no")
AS_IF([test "$cython" != no], [
AS_ECHO("checking cython version... $($cython -V 2>&1 | cut -d' ' -f 3)")
CYTHON_VER_MAJ=$($cython -V 2>&1 | cut -d' ' -f 3 | cut -d'.' -f 1);
CYTHON_VER_MIN=$($cython -V 2>&1 | cut -d' ' -f 3 | cut -d'.' -f 2);
AC_MSG_CHECKING([cython version])
CYTHON_VER_FULL=$(cython -V 2>&1 | cut -d' ' -f 3);
CYTHON_VER_MAJ=$(echo $CYTHON_VER_FULL | cut -d'.' -f 1);
CYTHON_VER_MIN=$(echo $CYTHON_VER_FULL | cut -d'.' -f 2);
AC_MSG_RESULT([$CYTHON_VER_FULL])
],[
CYTHON_VER_MAJ=0
CYTHON_VER_MIN=0
Expand Down

0 comments on commit 37889ff

Please sign in to comment.