Using Yacc/Lex-- in your project

How to include Yacc/Lex-- in your project

Yacc/Lex-- consist entirely of declaration (or header) files. All you need to do, is to include those file in your project code. You can copy the header files into your source code, or you can use them from their installed location - it's entirely up to you, though you should read and understand the terms of the licence

You need to have Yacc and/or Lex compatible programs installed on your system to use Yacc/Lex--. In fact, if you don't there's very litte reason why you would want Yacc/Lex-- in the first place.

The included file ylmm.m4 defines the Autoconf macro AC_YLMM_PATH that you can use in your configure.ac file. It defines the substitution variable YLMM_CPPFLAGS to contain the path to the Yacc/Lex-- header files. Put that macro in your configuration file

    AC_YLMM_PATH
    
and in your Makefile.ams, do
    AM_CPPFLAGS		= $(YLMM_CPPFLAGS) 
    
The Autoconf macro AM_YLMM_PATH will automatically test for the presence of Yacc and Lex compatible programs on your system.

You can optionally pass three arguments to AC_YLMM_PATH, where the first is the minimum version of Yacc/Lex-- you need, the second is shell-script code executed if Yacc/Lex-- is found on the target system, and the third is shell-script code executed if Yacc/Lex-- isn't found on the target system. The full synopsis is therefor

    AC_PATH_YLMM([MINIMUM-VERSION [,ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
    

There's also a macro to check whether the C++ preprocessor understand variadic arguments. You may need to use that if you get errors from the preprocessor that it doesn't understand the variadic arguments. Just put

    AC_CHECK_CXXCPP_VARIADIC
    
in your configure.ac file.

Alternatively, you can use the included script ylmm-config to obtain the information.

Top of page
Christian Holm (home page)
Last update Fri Jul 8 12:58:03 2005
Created by DoxyGen 1.4.3-20050530