Using -DYY_BUF_SIZE=99999 (for whatever number, of course) on the command line is the only way to completely override the value, it seems to me.
The built-in flex skeleton/preamble precedes any %{...%} code given in the first (definitions) section of the .l source, and the skeleton is where the #ifndef YY_BUF_SIZE is. Therefore, to override within the .l file, it's best (to avoid possible warnings, etc.) to do
#undef YY_BUF_SIZE
#define YY_BUF_SIZE 99999
The potential pitfall of doing the override this way is that the skeleton also has the line
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
and therefore that value will not be affected by the redefinition. In my case that did not matter, but it's something to be aware of.
Unfortunately there is no way, as far as I know, to insert code before the built-in preamble. If there is, I'dbe grateful to learn.