Bug 36651 - mesa requires bison and flex to build but configure does not check for them
mesa requires bison and flex to build but configure does not check for them
Status: VERIFIED FIXED
Product: Mesa
Classification: Unclassified
Component: Other
git
Other All
: medium normal
Assigned To: mesa-dev
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-04-28 00:25 UTC by Michal Suchanek
Modified: 2011-05-18 09:05 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
patch configure.ac, Makefiles, etc to check for flex/bison (2.33 KB, patch)
2011-05-08 11:15 UTC, Brian Paul
Details | Splinter Review
updated patch (2.85 KB, patch)
2011-05-12 15:31 UTC, Brian Paul
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Suchanek 2011-04-28 00:25:27 UTC
make[2]: Leaving directory `/mesa/src/mapi/glapi'
make[2]: Entering directory `/mesa/src/glsl'
flex --nounistd -oglcpp/glcpp-lex.c  glcpp/glcpp-lex.l
bison -v -o "glcpp/glcpp-parse.c" --defines=glcpp/glcpp-parse.h glcpp/glcpp-parse.y
/bin/bash: flex: command not found
/bin/bash: bison: command not found
flex --nounistd -oglsl_lexer.cpp  glsl_lexer.ll
bison -v -o "glsl_parser.cpp" -p "_mesa_glsl_" --defines=glsl_parser.h glsl_parser.yy
/bin/bash: flex: command not found
/bin/bash: bison: command not found
make[2]: *** No rule to make target `depend', needed by `default'.  Stop.
make[2]: Leaving directory `/mesa/src/glsl'
make[1]: *** [subdirs] Error 1
make[1]: Leaving directory `/mesa/src'
make: *** [default] Error 1
Comment 1 Brian Paul 2011-05-08 11:15:45 UTC
Created attachment 46450 [details] [review]
patch configure.ac, Makefiles, etc to check for flex/bison

I'm not an autoconf expert but I think the attached patch will do the job.  Can you review/test?  Thanks.
Comment 2 Michal Suchanek 2011-05-09 05:37:09 UTC
With this patch I could specify what flex and bison would Mesa use but it still configures with no flex nor bison.

checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gmake... no
checking for make... make
checking for python2... no
checking for python... python
checking for flex... no
checking for bison... no
checking for makedepend... /usr/bin/makedepend
checking for sed... /bin/sed
checking for a BSD-compatible install... /usr/bin/install -c
checking if compiling with clang... no
checking whether gcc version is sufficient... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking whether gcc supports -fvisibility=hidden... yes
checking whether g++ supports -fvisibility=hidden... yes
checking whether to enable assembly... yes, x86
checking for gcc option to produce PIC... -fPIC
checking for dlopen... no
checking for dlopen in -ldl... yes
checking for posix_memalign... yes
checking pkg-config files for X11 are available... yes
checking for X11... yes
checking for GLPROTO... yes
checking for LIBDRM... yes
checking for DRI2PROTO... yes
checking for XF86VIDMODE... yes
checking for DRIGL... yes
checking for LIBDRM_RADEON... yes
checking expat.h usability... yes
checking expat.h presence... yes
checking for expat.h... yes
checking for XML_ParserCreate in -lexpat... yes
checking for llvm-config... /usr/bin/llvm-config
configure: creating ./config.status
config.status: creating configs/autoconf
config.status: executing configs commands
configure: WARNING: unrecognized options: --enable-gallium-radeon

        prefix:          /usr/local
        exec_prefix:     ${prefix}
        libdir:          ${exec_prefix}/lib
        includedir:      ${prefix}/include

        OpenGL:          yes (ES1: no ES2: no)
        OpenVG:          no

        Driver:          dri
        OSMesa:          no
        DRI drivers:     no
        DRI driver dir:  ${libdir}/dri
        Use XCB:         no
        Shared dricore:  no

        GLU:             no
        GLw:             no (Motif: no)
        glut:            no

        EGL:             no

        llvm:            yes
        llvm-config:     /usr/bin/llvm-config
        llvm-version:    2.6

        Gallium:         yes
Comment 3 Dan Nicholson 2011-05-09 05:56:58 UTC
Review of attachment 46450 [details] [review]:

In order to make the substitution work, you need to add a place for configure to put the definition of found programs. In configs/autoconf, add these two lines somewhere:

FLEX = @FLEX@
BISON = @BISON@

The rest looks good to me. There are ways to make this more portable with autoconf, but we can save that for another patch.

::: configure.ac
@@ +34,3 @@
 AC_CHECK_PROGS([PYTHON2], [python2 python])
+AC_CHECK_PROGS([FLEX], [flex])
+AC_CHECK_PROGS([BISON], [bison])

There are some autoconf macros specifically for lex/yacc, but this should do for now. However, what's missing here is that we're not checking if the tools are not available and stopping if they're not available. configure will set the program to "no" if it finds nothing. Also, I'm not sure it's a big deal, but I prefer AC_PATH_PROG if we're not checking for multiple program names. Something like this might work:

AC_PATH_PROG([FLEX], [flex])
test "x$FLEX" = "xno" && AC_MSG_ERROR([flex is needed to build mesa])
AC_PATH_PROG([BISON], [bison])
test "x$BISON" = "xno" && AC_MSG_ERROR([bison is needed to build mesa])
Comment 4 Brian Paul 2011-05-12 15:31:46 UTC
Created attachment 46650 [details] [review]
updated patch

Thanks for the tips, Dan.  Here's an updated patch.  Note that AC_PATH_PROG returns "" not "no" when the program is not found.
Comment 5 Brian Paul 2011-05-18 06:52:19 UTC
I've committed the patch: de1df26b5c11a45f2b1ff2ddc7b8ec764356aa94
Comment 6 Michal Suchanek 2011-05-18 08:51:04 UTC
AFAIK this is only a part of the solution.

The patch makes configure check for flex but does not make it fail when flex is not found.
Comment 7 Brian Paul 2011-05-18 09:03:30 UTC
Are you sure you're looking at the updated patch?

See:

+AC_PATH_PROG([FLEX], [flex])
+test "x$FLEX" = "x" && AC_MSG_ERROR([flex is needed to build Mesa])
+
+AC_PATH_PROG([BISON], [bison])
+test "x$BISON" = "x" && AC_MSG_ERROR([bison is needed to build Mesa])
+

I removed flex/bison and tested and configure errors/exits as expected.
Comment 8 Michal Suchanek 2011-05-18 09:05:34 UTC
Yes, with the updated patch it works as expected.

I missed the previous one where the check was introduced.

Thanks