Hi, i want to use ginac as a lib under Mac OS X 10.4..8. I compiled cln 1.1.13 without problems. But compiling ginac 1.3.6 gave me the well known ginsh_parser.yy error: if g++ -DHAVE_CONFIG_H -I. -I. -I.. -I./../ginac -I../ginac - DIN_GINAC -I/usr/local/include -g -O2 -MT ginsh_parser.o -MD -MP - MF ".deps/ginsh_parser.Tpo" -c -o ginsh_parser.o ginsh_parser.cc; \ then mv -f ".deps/ginsh_parser.Tpo" ".deps/ginsh_parser.Po"; else rm - f ".deps/ginsh_parser.Tpo"; exit 1; fi ginsh_parser.yy:50:6: error: missing binary operator before token "wrapper" ginsh_parser.yy:56:6: error: missing binary operator before token "wrapper" ginsh_parser.yy:860:6: error: missing binary operator before token "wrapper" ginsh_parser.yy:870:6: error: missing binary operator before token "wrapper" ginsh_parser.yy:922:6: error: missing binary operator before token "wrapper" ginsh_parser.yy: In function 'char** fcn_completion(const char*, int, int)': ginsh_parser.yy:859: error: invalid conversion from 'const char*' to 'char*' ginsh_parser.yy:869: error: invalid conversion from 'const char*' to 'char*' make[2]: *** [ginsh_parser.o] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 I'm using gcc --version i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5363) Copyright (C) 2005 Free Software Foundation, Inc. and yacc --version bison (GNU Bison) 2.3 Written by Robert Corbett and Richard Stallman. Is there another thing i have to instal? O shold i use a different version of gcc/Yacc? Thanks Jonathan
i got it to compile with the same compiler (4.0.1) same os (10.4.8) and same cln and ginac versions, the only diference might be the yacc and bison $bison --version GNU Bison version 1.28 i got these from fink --- Jonathan Heinen <Jonathan.Heinen@rwth-aachen.de> escribió:
Hi,
i want to use ginac as a lib under Mac OS X 10.4..8. I compiled cln 1.1.13 without problems. But compiling ginac 1.3.6 gave me the well known ginsh_parser.yy error:
__________________________________________________ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas
i got it to compile with the same compiler (4.0.1) same os (10.4.8) and same cln and ginac versions, the only diference might be the yacc and bison
$bison --version GNU Bison version 1.28
i got these from fink
Hi, As far as I can remember, bison 1.28 is the one that ships with Apple's dev tools /usr/bin/bison, not fink's. (Check your path, or "which bison" to confirm). IIRC, even far back as two/three years ago, fink's bison version was 1.35 and higher. The stable tree has had 2.0 for at least a year now, 2.3 is current (unstable). bison 1.28 was very troublesome to me (similar experience building ginsh), I'm a little surprised that it worked for you. Which bison did ginac's configure pick up? fink's bison also installs a /sw/bin/yacc that exec's "bison -y", which may be deceiving. Fang
--- David Fang <fang@csl.cornell.edu> escribió:
As far as I can remember, bison 1.28 is the one that ships with Apple's dev tools /usr/bin/bison, not fink's. (Check your path, or "which bison" to confirm).
ok you are right: $ which bison /usr/bin/bison $ which yacc /usr/bin/yacc and no, i just checked and there wasn't any bison or yacc on /sw/bin. Maybe i thought there was because i could have read it as a dependency for some package that i didn't install at the end :/ but to help to understand this, i attach my config.log that lead me to succesful compilation IIRC, even far back as
two/three years ago, fink's bison version was 1.35 and higher. The stable tree has had 2.0 for at least a year now, 2.3 is current (unstable). bison 1.28 was very troublesome to me (similar experience building ginsh), I'm a little surprised that it worked for you. Which bison did ginac's configure pick up? fink's bison also installs a /sw/bin/yacc that exec's "bison -y", which may be deceiving.
Fang
_______________________________________________ GiNaC-list mailing list GiNaC-list@ginac.de https://www.cebix.net/mailman/listinfo/ginac-list
__________________________________________________ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas
Hi, On Mon, Jan 29, 2007 at 11:11:38PM -0300, Charlls Quarra wrote:
i got it to compile with the same compiler (4.0.1) same os (10.4.8) and same cln and ginac versions, the only diference might be the yacc and bison
$bison --version GNU Bison version 1.28
Do you have GNU readline installed? If yes, could you please check what happens if you uninstall it (and use one shipped with your OS)? Best regards, Alexei -- All science is either physics or stamp collecting.
--- Sheplyakov Alexei <varg@theor.jinr.ru> escribió:
Do you have GNU readline installed?
i do have a readline installed in /usr/include and other in /sw/include (this one is from fink for sure) If yes, could
you please check what happens if you uninstall it (and use one shipped with your OS)?
i'm not sure i want to screw up my fink installation. But i sent a mail with my config.log attached, could you obtain the info you need from it? i can run other checks if you want __________________________________________________ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas
--- Sheplyakov Alexei <varg@theor.jinr.ru> escribi�:
Do you have GNU readline installed?
i do have a readline installed in /usr/include and other in /sw/include (this one is from fink for sure)
If yes, could
you please check what happens if you uninstall it (and use one shipped with your OS)?
i'm not sure i want to screw up my fink installation. But i sent a mail with my config.log attached, could you obtain the info you need from it? i can run other checks if you want
Perhaps a little off-topic: but installing and uninstalling packages won't "screw up" your fink installation -- it is smart about telling you if there is a problem with removing a package through the dependency system. readline (and many other libraries) are build-depends-only, meaning they are never required to be present for *installing* other packages, and may be temporarily installed/removed for the sake of *building* package. try this: fink list readline (or readline5) tells you the status of all readline packages, and if they are installed or not fink remove readline removes it from installation, but keeps the package around so it doesn't have to be rebuilt fink install readline installs it right back (and no harm done to fink :D) FYI: I was able to reproduce your config.log and your errors, they have been diagnosed. If you have fink's readline installed, you can help the configuration find it by passing: "CPPFLAGS=-I/sw/include LDFLAGS=-L/sw/lib" to your configure command. This will force the build to search there for headers and libraries first, before it finds anything in /usr/{include,lib}. Then the editline woes should go away. :) HTH, David Fang Computer Systems Laboratory Electrical & Computer Engineering Cornell University http://www.csl.cornell.edu/~fang/ -- (2400 baud? Netscape 3.0?? lynx??? No problem!)
--- David Fang <fang@csl.cornell.edu> escribió:
try this:
fink list readline (or readline5) tells you the status of all readline packages, and if they are installed or not
fink remove readline removes it from installation, but keeps the package around so it doesn't have to be rebuilt
fink install readline installs it right back
(and no harm done to fink :D)
ginsh_op_help.h sed -n -f ./ginsh_fcn_help.sed <ginsh.1 ginsh_fcn_help.h if g++ -DHAVE_CONFIG_H -I. -I. -I.. -I./../ginac -I../ginac -DIN_GINAC -I/sw/include -I/usr/local/include -I/sw/include -I/sw/include -MT ginsh_parser.o -MD -MP -MF ".deps/ginsh_parser.Tpo" -c -o ginsh_parser.o ginsh_parser.cc; \
ok i trust you :) $ fink list readline Information about 5919 packages read in 2 seconds. readline 4.3-1028 Comfortable terminal input library readline-java 0.8.0-1024 Readline support for Java readline-shlibs 4.3-1028 Comfortable terminal input library i readline5 5.0-1005 Comfortable terminal input library i readline5-shlibs 5.0-1005 Comfortable terminal input library term-readline-gnu-pm586 1.15-1004 Perl extension for the GNU Readline term-readline-pm 1.0203-12 Minimal interface to Readline p term-readline-pm586 [virtual package] term-readline-pm588 [virtual package] ok so apparently readline5 is installed; $ fink remove readline5 Information about 5919 packages read in 0 seconds. Reading buildlock packages... /sw/bin/dpkg-lockwait --remove readline5 (Reading database ... 36598 files and directories currently installed.) Removing readline5 ... install-info(history.info): deleting entry `* History: (history) ...' install-info(readline.info): deleting entry `* Readline: (readline) ...' install-info(rluserman.info): deleting entry `* RLuserman: (rluserman) ...' install-info(rluserman.info): deleting empty section `Libraries' OK but!! -shlibs has dependencies-> $ fink remove readline5-shlibs Information about 5919 packages read in 0 seconds. Reading buildlock packages... /sw/bin/dpkg-lockwait --remove readline5-shlibs dpkg: dependency problems prevent removal of readline5-shlibs: libxml2-bin depends on readline5-shlibs (>= 5.0-1004). /sw/bin/dpkg: error processing readline5-shlibs (--remove): dependency problems - not removing Errors were encountered while processing: readline5-shlibs ### execution of /sw/bin/dpkg-lockwait failed, exit code 1 ERROR: Can't remove package(s). If the above error message mentions dependency problems, you can try fink remove --recursive readline5-shlibs This will attempt to remove the package(s) specified as well as ALL packages that depend on it. Failed: can't remove package readline5-shlibs ok it doesn't matter, because at the end, i get to reproduce the compile error: Making all in ginsh sed -n -f ./ginsh_op_help.sed <ginsh.1 then mv -f ".deps/ginsh_parser.Tpo" ".deps/ginsh_parser.Po"; else rm -f ".deps/ginsh_parser.Tpo"; exit 1; fi ginsh_parser.yy:50:6: error: missing binary operator before token "wrapper" ginsh_parser.yy:56:6: error: missing binary operator before token "wrapper" ginsh_parser.yy:860:6: error: missing binary operator before token "wrapper" ginsh_parser.yy:870:6: error: missing binary operator before token "wrapper" ginsh_parser.yy:922:6: error: missing binary operator before token "wrapper" ginsh_parser.yy: In function 'char** fcn_completion(const char*, int, int)': ginsh_parser.yy:858: error: invalid conversion from 'const char*' to 'char*' ginsh_parser.yy:863: error: 'rl_filename_completion_function' was not declared in this scope ginsh_parser.yy:863: error: 'rl_completion_matches' was not declared in this scope ginsh_parser.yy:873: error: 'rl_completion_matches' was not declared in this scope make[2]: *** [ginsh_parser.o] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 Ok now i reinstall readline5 to make sure everything is ok, and everything compiles perfect again.
FYI: I was able to reproduce your config.log and your errors, they have been diagnosed.
eh?? no sorry, to be clear; my ginac compiled and compiles perfectly on OS X 10.4.8, i was just trying to help find the reason some guy on the list wasn't able to compile it on the same os. cheers __________________________________________________ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas
ok so apparently readline5 is installed; $ fink remove readline5 Information about 5919 packages read in 0 seconds. Reading buildlock packages...
OK but!! -shlibs has dependencies->
$ fink remove readline5-shlibs Information about 5919 packages read in 0 seconds. Reading buildlock packages... /sw/bin/dpkg-lockwait --remove readline5-shlibs dpkg: dependency problems prevent removal of readline5-shlibs: libxml2-bin depends on readline5-shlibs (>= 5.0-1004). /sw/bin/dpkg: error processing readline5-shlibs (--remove): dependency problems - not removing
Hi, Correct, you don't have to remove -shlibs, because those are *install* depended-upon by other packages as dynamic shared libraries. the readline5 package you removed was the *static* library, which doesn't have to stay around because other libraries basically copy what they need from it when they link against it.
ok it doesn't matter, because at the end, i get to reproduce the compile error: Making all in ginsh --------->8 snip 8<-------- ginsh_parser.yy:50:6: error: missing binary operator before token "wrapper"
One thing, before you just run 'make' again, you should re-configure because the absence/presence of readline5 will affect the outcome of "config.h", which is included (directly or indirectly) by everything. (If you configured with cache '-C', remove config.cache first too.) "./config.status --recheck && config.status" will re-run configure using the same parameters you passed the first time.
Ok now i reinstall readline5 to make sure everything is ok, and everything compiles perfect again.
FYI: I was able to reproduce your config.log and your errors, they have been diagnosed.
eh?? no sorry, to be clear; my ginac compiled and compiles perfectly on OS X 10.4.8, i was just trying to help find the reason some guy on the list wasn't able to compile it on the same os.
Ok. To summarize: To compile/link against packages in fink, be it readline or other library, one should just pass CPPFLAGS="-I/sw/include" LDFLAGS="-L/sw/lib" to configure before making. (Replace 'sw' with whatever your fink-root is.) David Fang Computer Systems Laboratory Electrical & Computer Engineering Cornell University http://www.csl.cornell.edu/~fang/ -- (2400 baud? Netscape 3.0?? lynx??? No problem!)
--- David Fang <fang@csl.cornell.edu> escribió:
One thing, before you just run 'make' again, you should re-configure because the absence/presence of readline5 will affect the outcome of "config.h",
since i never manage to remember how to reconfigure/boostrap correctly, if possible i delete the folder and untar it again before trying to build (as i did each time) cheers __________________________________________________ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas
i want to use ginac as a lib under Mac OS X 10.4..8. I compiled cln 1.1.13 without problems. But compiling ginac 1.3.6 gave me the well known ginsh_parser.yy error:
if g++ -DHAVE_CONFIG_H -I. -I. -I.. -I./../ginac -I../ginac - DIN_GINAC -I/usr/local/include -g -O2 -MT ginsh_parser.o -MD -MP - MF ".deps/ginsh_parser.Tpo" -c -o ginsh_parser.o ginsh_parser.cc; \ then mv -f ".deps/ginsh_parser.Tpo" ".deps/ginsh_parser.Po"; else rm - f ".deps/ginsh_parser.Tpo"; exit 1; fi ginsh_parser.yy:50:6: error: missing binary operator before token "wrapper" ginsh_parser.yy:56:6: error: missing binary operator before token "wrapper" ginsh_parser.yy:860:6: error: missing binary operator before token "wrapper" ginsh_parser.yy:870:6: error: missing binary operator before token "wrapper" ginsh_parser.yy:922:6: error: missing binary operator before token "wrapper" ginsh_parser.yy: In function 'char** fcn_completion(const char*, int, int)': ginsh_parser.yy:859: error: invalid conversion from 'const char*' to 'char*' ginsh_parser.yy:869: error: invalid conversion from 'const char*' to 'char*' make[2]: *** [ginsh_parser.o] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2
Hi, I just build cln-1.1.13, ginac-1.3.6 myself (OS X 10.4, dual G4) without problems, and bison didn't even play a role because ginac ships the resulting .cc sources with it (pre-built using bison 1.875, it seems). The only reason I can imagine why your build tried to run bison is if the timestamps were somehow not preserved upon unpacking, or you accidentally touched the yacc source. In the case of a timestamp problem can you try "touch ginsh/*.{h,cc}" to avoid re-running bison?
I'm using gcc --version i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5363) Copyright (C) 2005 Free Software Foundation, Inc.
and yacc --version bison (GNU Bison) 2.3 Written by Robert Corbett and Richard Stallman.
For comparison, my gcc: Using built-in specs. Target: powerpc-apple-darwin8 Configured with: /private/var/tmp/gcc/gcc-5363.obj~28/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8 Thread model: posix gcc version 4.0.1 (Apple Computer, Inc. build 5363)
Is there another thing i have to instal? O shold i use a different version of gcc/Yacc?
Just for kicks, I 'touched' the yacc file to force a rebuild using our version of bison, 2.3, and it still rebuilt fine for me. Can you give some more context on the failure? For example, what did your configure report about 'readline', since the line numbers referenced in your report are all related to readline configuration and the resulting preprocessor macros. (I'm using readline-5.0). You can find some _RL_ results in "config.h" too. Just a stab in the dark, does the problem go away if you wrap those conditionals in one more pair of enclosing parentheses? Speaking of fink, anyone on this list consider submitting a package for cln/ginac? They are much easier to build than they were a few years ago, thanks to various libtool and configury updates. Fang David Fang Computer Systems Laboratory Electrical & Computer Engineering Cornell University http://www.csl.cornell.edu/~fang/ -- (2400 baud? Netscape 3.0?? lynx??? No problem!)
i want to use ginac as a lib under Mac OS X 10.4..8. I compiled cln 1.1.13 without problems. But compiling ginac 1.3.6 gave me the well known ginsh_parser.yy error:
if g++ -DHAVE_CONFIG_H -I. -I. -I.. -I./../ginac -I../ginac - DIN_GINAC -I/usr/local/include -g -O2 -MT ginsh_parser.o -MD -MP - MF ".deps/ginsh_parser.Tpo" -c -o ginsh_parser.o ginsh_parser.cc; \ then mv -f ".deps/ginsh_parser.Tpo" ".deps/ginsh_parser.Po"; else rm - f ".deps/ginsh_parser.Tpo"; exit 1; fi ginsh_parser.yy:50:6: error: missing binary operator before token "wrapper" ginsh_parser.yy:56:6: error: missing binary operator before token "wrapper" ginsh_parser.yy:860:6: error: missing binary operator before token "wrapper" ginsh_parser.yy:870:6: error: missing binary operator before token "wrapper" ginsh_parser.yy:922:6: error: missing binary operator before token "wrapper" ginsh_parser.yy: In function 'char** fcn_completion(const char*, int, int)': ginsh_parser.yy:859: error: invalid conversion from 'const char*' to 'char*' ginsh_parser.yy:869: error: invalid conversion from 'const char*' to 'char*' make[2]: *** [ginsh_parser.o] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2
Just for kicks, I 'touched' the yacc file to force a rebuild using our version of bison, 2.3, and it still rebuilt fine for me. Can you give some more context on the failure? For example, what did your configure report about 'readline', since the line numbers referenced in your report are all related to readline configuration and the resulting preprocessor macros. (I'm using readline-5.0). You can find some _RL_ results in "config.h" too. Just a stab in the dark, does the problem go away if you wrap those conditionals in one more pair of enclosing parentheses?
Hi again... And I just answered my own question. The reason the above is happening is because your configure found /usr/include/readline and /usr/lib/libreadline which (on Mac OS X) is actually the BSD editline or histedit wrapper library (almost readline). See the symlink from /usr/lib/libreadline.dylib to /usr/lib/libedit.dylib. The "wrapper" token comes from the version string rl_library_version, which is something like "EditLine wrapper", and is picked up by the autoconf test GINAC_LIB_READLINE_VERSION (in ginac.m4). (This happens to me with my projects too. :D ) And since it is AC_DEFINE_UNQUOTED, it looks like the tokens: EditLine wrapper. Solution: if you just want to get going, hand-edit the generated "config.h" on the lines with *_RL_* with fake readline version numbers like major.minor = 5.0 or 4.3. A real solution requires accommodating the possibility of non-numeric version string in the config.h header or re-writing the test so that it is not a problem. Hope this sheds some light. Fang
On Mon, Jan 29, 2007 at 11:17:34PM -0500, David Fang wrote:
The reason the above is happening is because your configure found /usr/include/readline and /usr/lib/libreadline which (on Mac OS X) is actually the BSD editline or histedit wrapper library (almost readline). See the symlink from /usr/lib/libreadline.dylib to /usr/lib/libedit.dylib. The "wrapper" token comes from the version string rl_library_version, which is something like "EditLine wrapper", and is picked up by the autoconf test GINAC_LIB_READLINE_VERSION (in ginac.m4).
Thank you very much for investigation.
(This happens to me with my projects too. :D ) And since it is AC_DEFINE_UNQUOTED, it looks like the tokens: EditLine wrapper. Solution: if you just want to get going, hand-edit the generated "config.h" on the lines with *_RL_* with fake readline version numbers like major.minor = 5.0 or 4.3.
A real solution requires accommodating the possibility of non-numeric version string in the config.h header or re-writing the test so that it is not a problem.
Here is really dumb patch which does this: [PATCH] Fix libreadline version detection. Some vendor-supplied readline equivalents (e.g. one on Mac OS X) return non-numeric rl_library_version. Let's check for such an ill-formed version string. For now I assume that such a library is compatible with GNU readline 4.2. --- acinclude.m4 | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 4ab1387..c6f4d5d 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -24,7 +24,16 @@ int main() fprintf(fd, "%s\n", rl_library_version); fclose(fd); return 0; -}], ginac_cv_rlversion=`cat 'conftest.out'`, ginac_cv_rlversion='unknown', ginac_cv_rlversion='4.2')]) +}], + dnl Some vendor-supplied readline libraries (e.g. one on Mac OS X) + dnl return non-numeric versions. Grrr! + dnl Pretend that such versions are compatible with GNU readline 4.2 + [ginac_cv_rlversion=`sed -e 's/[^0-9.]//g' 'conftest.out'` + if test -z "$ginac_cv_rlversion"; then + ginac_cv_rlversion='4.2' + fi], + [ginac_cv_rlversion='unknown'], + [ginac_cv_rlversion='4.2'])]) if test "x${ginac_cv_rlversion}" != "xunknown"; then RL_VERSION_MAJOR=`echo ${ginac_cv_rlversion} | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` AC_DEFINE_UNQUOTED(GINAC_RL_VERSION_MAJOR, $RL_VERSION_MAJOR, [Major version of installed readline library.]) -- 1.4.4.3 -- All science is either physics or stamp collecting.
On Mon, Jan 29, 2007 at 11:17:34PM -0500, David Fang wrote:
The reason the above is happening is because your configure found /usr/include/readline and /usr/lib/libreadline which (on Mac OS X) is actually the BSD editline or histedit wrapper library (almost readline).
Thank you very much for investigation.
A real solution requires accommodating the possibility of non-numeric version string in the config.h header or re-writing the test so that it is not a problem.
Here is really dumb patch which does this:
[PATCH] Fix libreadline version detection.
Some vendor-supplied readline equivalents (e.g. one on Mac OS X) return non-numeric rl_library_version. Let's check for such an ill-formed version string. For now I assume that such a library is compatible with GNU readline 4.2.
Hi, Unfortunately, the problems don't stop there: ----------->8 snip 8<------------- f g++ -DHAVE_CONFIG_H -I. -I../../ginsh -I.. -I../../ginsh/../ginac -I../ginac -DIN_GINAC -I/usr/local/include -I/sw/include -g -O2 -MT ginsh_parser.o -MD -MP -MF ".deps/ginsh_parser.Tpo" -c -o ginsh_parser.o ../../ginsh/ginsh_parser.cc; \ then mv -f ".deps/ginsh_parser.Tpo" ".deps/ginsh_parser.Po"; else rm -f ".deps/ginsh_parser.Tpo"; exit 1; fi if g++ -DHAVE_CONFIG_H -I. -I../../ginsh -I.. -I../../ginsh/../ginac -I../ginac -DIN_GINAC -I/usr/local/include -I/sw/include -g -O2 -MT ginsh_lexer.o -MD -MP -MF ".deps/ginsh_lexer.Tpo" -c -o ginsh_lexer.o ../../ginsh/ginsh_lexer.cc; \ then mv -f ".deps/ginsh_lexer.Tpo" ".deps/ginsh_lexer.Po"; else rm -f ".deps/ginsh_lexer.Tpo"; exit 1; fi ../../ginsh/ginsh_parser.yy: In function 'char** fcn_completion(const char*, int, int)': ../../ginsh/ginsh_parser.yy:858: error: invalid conversion from 'const char*' to 'char*' ../../ginsh/ginsh_parser.yy:863: error: 'rl_filename_completion_function' was not declared in this scope ../../ginsh/ginsh_parser.yy:863: error: 'rl_completion_matches' was not declared in this scope ../../ginsh/ginsh_parser.yy:873: error: 'rl_completion_matches' was not declared in this scope make: *** [ginsh_parser.o] Error 1 ----------->8 snip 8<------------- Those three rl_ symbols also happen to be renamed without their "rl_" prefixes in the editline wrapper header/library. (I've found this problem with old versions of GNU readline too, BTW.) The workaround I devised in the magic-7.1 source is the following: #if defined(READLINE_4_DOT_2_PLUS) || (RL_VERSION_MAJOR >= 5) || (RL_VERSION_MAJOR == 4 && RL_VERSION_MINOR >= 2) #define filename_completion_function rl_filename_completion_function #define username_completion_function rl_username_completion_function #define completion_matches rl_completion_matches #endif ... and reference the names without "rl_" in source. IIRC, the symbol name broke from readline 4.1 to 4.2. For my temporary workaround, I used the reverse-definition of the above macros, using the non-rl_ symbols. These particular editline wrappers might logically be based on readline-pre-4.2 symbol names. The non-reverse macros above allow better link-ability with older readlines, or you could wrap the wrappers -- many solutions exist, thanks to autoconf. Assuming the completion function names are fixed, there's yet one more problem: editline defines the symbol extern char *rl_basic_word_break_characters; but the source really wants a "const char*". ../../ginsh/ginsh_parser.yy:858: error: invalid conversion from 'const char*' to 'char*' There appears to be an attempt to detect this in the beginning of ginsh_parser.yy. By 'faking' the readline version to 4.1 in config.h, I get the "const char*" declaration. Then, ginsh compiles, links, and runs some basic commands with no problems. (This was using my bison-2.3 regenerated parser, since it seems that 1.875 was mistaken.) I hope this is enough information to fix things. Depending on how the developers want to handle the readline version fiasco (:D ?), various patch solutions are at hand. FWIW, my projects use separate --with-readline=[PATH] and --with-editline=[PATH] style configure options to distinguish between the libraries. I got this idea from the ngspice source tree. Can you tell how much I love configuring for readline? :P Looking forward to testing the next RC. :) Cheers. David Fang Computer Systems Laboratory Electrical & Computer Engineering Cornell University http://www.csl.cornell.edu/~fang/ -- (2400 baud? Netscape 3.0?? lynx??? No problem!)
Hello, On Tue, Jan 30, 2007 at 11:41:46AM -0500, David Fang wrote:
Unfortunately, the problems don't stop there:
----------->8 snip 8<------------- f g++ -DHAVE_CONFIG_H -I. -I../../ginsh -I.. -I../../ginsh/../ginac -I../ginac -DIN_GINAC -I/usr/local/include -I/sw/include -g -O2 -MT ginsh_parser.o -MD -MP -MF ".deps/ginsh_parser.Tpo" -c -o ginsh_parser.o ../../ginsh/ginsh_parser.cc; \ then mv -f ".deps/ginsh_parser.Tpo" ".deps/ginsh_parser.Po"; else rm -f ".deps/ginsh_parser.Tpo"; exit 1; fi if g++ -DHAVE_CONFIG_H -I. -I../../ginsh -I.. -I../../ginsh/../ginac -I../ginac -DIN_GINAC -I/usr/local/include -I/sw/include -g -O2 -MT ginsh_lexer.o -MD -MP -MF ".deps/ginsh_lexer.Tpo" -c -o ginsh_lexer.o ../../ginsh/ginsh_lexer.cc; \ then mv -f ".deps/ginsh_lexer.Tpo" ".deps/ginsh_lexer.Po"; else rm -f ".deps/ginsh_lexer.Tpo"; exit 1; fi ../../ginsh/ginsh_parser.yy: In function 'char** fcn_completion(const char*, int, int)': ../../ginsh/ginsh_parser.yy:858: error: invalid conversion from 'const char*' to 'char*' ../../ginsh/ginsh_parser.yy:863: error: 'rl_filename_completion_function' was not declared in this scope ../../ginsh/ginsh_parser.yy:863: error: 'rl_completion_matches' was not declared in this scope ../../ginsh/ginsh_parser.yy:873: error: 'rl_completion_matches' was not declared in this scope make: *** [ginsh_parser.o] Error 1 ----------->8 snip 8<-------------
Those three rl_ symbols also happen to be renamed without their "rl_" prefixes in the editline wrapper header/library. (I've found this problem with old versions of GNU readline too, BTW.) The workaround I devised in the magic-7.1 source is the following:
#if defined(READLINE_4_DOT_2_PLUS) || (RL_VERSION_MAJOR >= 5) || (RL_VERSION_MAJOR == 4 && RL_VERSION_MINOR >= 2) #define filename_completion_function rl_filename_completion_function #define username_completion_function rl_username_completion_function #define completion_matches rl_completion_matches #endif
GiNaC already has proper hack for this (your solution is not good enough for C++ anyway: one need also to const_cast<char *> the arguments and convert pointers to functions so that compiler is happy about them). Thus, ginsh can be compiled with old (GNU) libreadline (or compatible non-GNU libraries). The only problem is how to decide if we got such an old version. This is especially difficult if the library do not provide any meaningful version information ("EditLine wrapper" is not really helpful). OK, let's forget about library versions and check for function/variables declarations themselves: diff --git a/INSTALL b/INSTALL index 8d0b703..7feed75 100644 --- a/INSTALL +++ b/INSTALL @@ -105,7 +105,7 @@ Problems building ginsh ----------------------- The most common reason why this doesn't succeed is the absence of -libreadline and/or the corresponding header files. Depending on what your +GNU libreadline and/or the corresponding header files. Depending on what your system/distribution is, you will have to install a package called libreadline and maybe libreadline-dev. If your system's vendor doesn't supply such packages, go to <ftp://ftp.gnu.org/gnu/readline/> and compile diff --git a/acinclude.m4 b/acinclude.m4 index 4ab1387..a45f957 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -4,35 +4,111 @@ dnl additions' names with AC_ but with GINAC_ in order to steer clear of dnl future trouble. dnl =========================================================================== -dnl Usage: GINAC_RLVERSION +dnl Usage: GINAC_HAVE_READLINE +dnl Will test for GNU libreadline (or compatible) and termcap. On success +dnl RL_LIBS is set to libraries to link with and CONFIG_READLINE is set +dnl to `yes'. If old (pre 4.2) libreadline is detected CONFIG_OLD_READLINE +dnl will be defined instead. dnl The maintainers of libreadline are complete morons: they don't care a shit dnl about compatiblilty (which is not so bad by itself) and at the same time dnl they don't export the version to the preprocessor so we could kluge around dnl incomatiblities. The only reliable way to figure out the version is by dnl checking the extern variable rl_library_version at runtime. @$%*! -AC_DEFUN([GINAC_LIB_READLINE_VERSION], -[AC_CACHE_CHECK([for version of libreadline], ginac_cv_rlversion, [ +dnl To add even more fun some vendors supply libraries which return non-numeric +dnl rl_library_version. +AC_DEFUN([GINAC_HAVE_READLINE],[ +AC_REQUIRE([GINAC_TERMCAP]) + +AC_CHECK_HEADERS(readline/readline.h readline/history.h) +save_LIBS="$LIBS" +AC_CHECK_LIB(readline, readline) +LIBS="$LIBTERMCAP $LIBS" + +if test "x$ac_cv_header_readline_readline_h" != "xyes" -o \ + "x$ac_cv_header_readline_history_h" != "xyes" -o \ + "x$ac_cv_lib_readline_readline" != "xyes"; then + CONFIG_READLINE="no" +fi + +if test "x$CONFIG_READLINE" != "xno"; then +dnl To be damn sure we got correct prototype don't use AC_CHECK_LIB +AC_CACHE_CHECK([for rl_filename_completion_function in libreadline], +ginac_cv_readline_type, [ +AC_TRY_RUN([ +#include <readline/readline.h> +static char** fcn_completion(const char* text, int start, int end) +{ + return rl_completion_matches(text, rl_filename_completion_function); +} +int main() +{ + rl_attempted_completion_function = fcn_completion; + return 0; +}], [ +dnl OK +ginac_cv_readline_type="new" ], [ +dnl failure -- check for older (<= 4.1) readline AC_TRY_RUN([ -#include <stdio.h> -#include <sys/types.h> #include <readline/readline.h> +static char** fcn_completion(const char* text, int start, int end) +{ + return completion_matches(text, filename_completion_function); +} +int main() +{ + rl_attempted_completion_function = (CPPFunction *)fcn_completion; + return 0; +}], [ +dnl OK +ginac_cv_readline_type="old" ], [ +dnl failure -- niether "new" nor "old" libreadline +ginac_cv_readline_type="none"], [])], [ +dnl cross-compiling -- assume "new" libreadline +ginac_cv_readline_type="new"])]) +fi # CONFIG_READLINE != no + +if test "x$ginac_cv_readline_type" = "xnone"; then + CONFIG_READLINE="no" +else + CONFIG_READLINE="yes" +fi +if test "x$CONFIG_READLINE" != "xno"; then +AC_CACHE_CHECK([if rl_basic_word_break_characters is const char*], +ginac_cv_rl_basic_word_break_const, [ +AC_TRY_RUN([ +#include <readline/readline.h> +static char* orig_basic_word_break_characters; int main() { - FILE *fd; - fd = fopen("conftest.out", "w"); - fprintf(fd, "%s\n", rl_library_version); - fclose(fd); - return 0; -}], ginac_cv_rlversion=`cat 'conftest.out'`, ginac_cv_rlversion='unknown', ginac_cv_rlversion='4.2')]) -if test "x${ginac_cv_rlversion}" != "xunknown"; then - RL_VERSION_MAJOR=`echo ${ginac_cv_rlversion} | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` - AC_DEFINE_UNQUOTED(GINAC_RL_VERSION_MAJOR, $RL_VERSION_MAJOR, [Major version of installed readline library.]) - RL_VERSION_MINOR=`echo ${ginac_cv_rlversion} | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` - AC_DEFINE_UNQUOTED(GINAC_RL_VERSION_MINOR, $RL_VERSION_MINOR, [Minor version of installed readline library.]) + orig_basic_word_break_characters = rl_basic_word_break_characters; + return 0; +}], [ +dnl OK -- so it is char* (pre-5.0 readline) +ginac_cv_rl_basic_word_break_const="no" +], [ +dnl failure -- assume it is const char* +ginac_cv_rl_basic_word_break_const="yes" ], [ +dnl cross-compiling -- assume it is const char* +ginac_cv_rl_basic_word_break_const="yes" ])]) +fi # CONFIG_READLINE != no + +if test "x$CONFIG_READLINE" = "xyes"; then + RL_LIBS="$LIBS" + AC_DEFINE(CONFIG_READLINE, ,[have GNU readline (or compatible)]) + if test "x$ginac_cv_rl_basic_word_break_const" = "xyes"; then + AC_DEFINE(CONFIG_RL_NEED_CONST_CAST, ,[Define if rl_basic_word_break_characters is const char*]) + fi + if test "x$ginac_cv_readline_type" = "xold"; then + AC_DEFINE(CONFIG_OLD_READLINE, , [Define if have GNU readline < 4.2 or compatible]) + fi else - GINAC_WARNING([I could not run a test of libreadline (needed for building ginsh).]) + GINAC_WARNING([Could not run a test of libreadline (needed for building ginsh).]) fi +LIBS="$save_LIBS" + +AC_SUBST(RL_LIBS) +AC_SUBST(CONFIG_READLINE) ]) dnl Usage: GINAC_TERMCAP diff --git a/configure.ac b/configure.ac index b022b3d..5aa3bb9 100644 --- a/configure.ac +++ b/configure.ac @@ -83,22 +83,8 @@ AC_LANG([C++]) dnl Check for stuff needed for building the GiNaC interactive shell (ginsh). AC_CHECK_HEADERS(unistd.h) GINAC_HAVE_RUSAGE -AC_CHECK_HEADERS(readline/readline.h readline/history.h) -if test "x${ac_cv_header_readline_readline_h}" != "xyes" -o "x${ac_cv_header_readline_history_h}" != "xyes"; then - GINAC_WARNING([I could not find the headers for libreadline (needed for building ginsh).]) -fi -GINAC_TERMCAP -save_LIBS=$LIBS -LIBS="$LIBTERMCAP $LIBS" -AC_CHECK_LIB(readline, readline) -if test "x${ac_cv_lib_readline_readline}" = "xyes"; then - GINAC_LIB_READLINE_VERSION -else - GINAC_WARNING([I could not find libreadline (needed by ginsh).]) -fi -GINSH_LIBS=$LIBS -LIBS=$save_LIBS -AC_SUBST(GINSH_LIBS) +dnl Check for libreadline +GINAC_HAVE_READLINE dnl Make sure all the necessary standard headers are installed on the system. AC_CHECK_HEADER(iosfwd, , GINAC_ERROR([The standard <iosfwd> header file could not be found.])) diff --git a/ginsh/Makefile.am b/ginsh/Makefile.am index 184fbbe..44376a7 100644 --- a/ginsh/Makefile.am +++ b/ginsh/Makefile.am @@ -2,7 +2,7 @@ bin_PROGRAMS = ginsh ginsh_SOURCES = ginsh_parser.yy ginsh_lexer.ll ginsh.h ginsh_extensions.h -ginsh_LDADD = ../ginac/libginac.la $(GINSH_LIBS) +ginsh_LDADD = ../ginac/libginac.la $(RL_LIBS) INCLUDES = -I$(srcdir)/../ginac -I../ginac -DIN_GINAC AM_YFLAGS = -d diff --git a/ginsh/ginsh_parser.yy b/ginsh/ginsh_parser.yy index b252609..f82c9f3 100644 --- a/ginsh/ginsh_parser.yy +++ b/ginsh/ginsh_parser.yy @@ -45,19 +45,21 @@ #define YYERROR_VERBOSE 1 +#ifdef CONFIG_READLINE // Original readline settings static int orig_completion_append_character; -#if (GINAC_RL_VERSION_MAJOR < 4) || (GINAC_RL_VERSION_MAJOR == 4 && GINAC_RL_VERSION_MINOR < 2) +#ifdef CONFIG_OLD_READLINE static char *orig_basic_word_break_characters; #else static const char *orig_basic_word_break_characters; #endif -#if (GINAC_RL_VERSION_MAJOR >= 5) +#ifdef CONFIG_RL_NEED_CONST_CAST #define GINAC_RL_COMPLETER_CAST(a) const_cast<char *>((a)) #else #define GINAC_RL_COMPLETER_CAST(a) (a) #endif +#endif // CONFIG_READLINE // Expression stack for %, %% and %%% static void push(const ex &e); @@ -850,6 +852,7 @@ static char *fcn_generator(const char *text, int state) return NULL; } +#ifdef CONFIG_READLINE static char **fcn_completion(const char *text, int start, int end) { if (rl_line_buffer[0] == '!') { @@ -857,7 +860,7 @@ static char **fcn_completion(const char *text, int start, int end) rl_completion_append_character = orig_completion_append_character; rl_basic_word_break_characters = orig_basic_word_break_characters; rl_completer_word_break_characters = GINAC_RL_COMPLETER_CAST(rl_basic_word_break_characters); -#if (GINAC_RL_VERSION_MAJOR < 4) || (GINAC_RL_VERSION_MAJOR == 4 && GINAC_RL_VERSION_MINOR < 2) +#ifdef CONFIG_OLD_READLINE return completion_matches(const_cast<char *>(text), (CPFunction *)filename_completion_function); #else return rl_completion_matches(text, rl_filename_completion_function); @@ -867,13 +870,14 @@ static char **fcn_completion(const char *text, int start, int end) rl_completion_append_character = '('; rl_basic_word_break_characters = " \t\n\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~"; rl_completer_word_break_characters = GINAC_RL_COMPLETER_CAST(rl_basic_word_break_characters); -#if (GINAC_RL_VERSION_MAJOR < 4) || (GINAC_RL_VERSION_MAJOR == 4 && GINAC_RL_VERSION_MINOR < 2) +#ifdef CONFIG_OLD_READLINE return completion_matches(const_cast<char *>(text), (CPFunction *)fcn_generator); #else return rl_completion_matches(text, fcn_generator); #endif } } +#endif // CONFIG_READLINE void greeting(void) { @@ -917,15 +921,17 @@ int main(int argc, char **argv) insert_help("print_latex", "print_latex(expression) - prints a LaTeX representation of the given expression"); insert_help("print_csrc", "print_csrc(expression) - prints a C source code representation of the given expression"); +#ifdef CONFIG_READLINE // Init readline completer rl_readline_name = argv[0]; -#if (GINAC_RL_VERSION_MAJOR < 4) || (GINAC_RL_VERSION_MAJOR == 4 && GINAC_RL_VERSION_MINOR < 2) +#ifdef CONFIG_OLD_READLINE rl_attempted_completion_function = (CPPFunction *)fcn_completion; #else rl_attempted_completion_function = fcn_completion; #endif orig_completion_append_character = rl_completion_append_character; orig_basic_word_break_characters = rl_basic_word_break_characters; +#endif // Init input file list, open first file num_files = argc - 1; Best regards, Alexei -- All science is either physics or stamp collecting.
#if defined(READLINE_4_DOT_2_PLUS) || (RL_VERSION_MAJOR >= 5) || (RL_VERSION_MAJOR == 4 && RL_VERSION_MINOR >= 2) #define filename_completion_function rl_filename_completion_function #define username_completion_function rl_username_completion_function #define completion_matches rl_completion_matches #endif
GiNaC already has proper hack for this (your solution is not good enough for C++ anyway: one need also to const_cast<char *> the arguments and convert pointers to functions so that compiler is happy about them). Thus, ginsh can be compiled with old (GNU) libreadline (or compatible non-GNU libraries). The only problem is how to decide if we got such an old version. This is especially difficult if the library do not provide any meaningful version information ("EditLine wrapper" is not really helpful). OK, let's forget about library versions and check for function/variables declarations themselves:
Hi, The the above #define hackery wasn't proposed as a permanent solution so much as a workaround for a user to move on as quickly as possible. :) I'm aware of the const-incorrectness of older readline, and here's an excerpt of my autoconf macro that conditionally applies the const_cast<char*>, specifically for the readline() prototype: (wrapped by AC_LANG_PUSH/POP(C++)) AC_COMPILE_IFELSE( AC_LANG_PROGRAM([ #include <cstdio> #if defined(HAVE_GNUREADLINE) #include <readline/readline.h> #elif defined(HAVE_BSDEDITLINE) #include <editline/readline.h> #endif ],[[[const char null[] = "foo"; readline(null) ]]]), dnl action on success [AC_MSG_RESULT([yes]) AC_DEFINE(READLINE_PROMPT_CONST, 1, [True if readline's argument is const char*])], dnl action on failure [AC_MSG_RESULT([no (you suck!)]) AC_DEFINE(READLINE_PROMPT_CONST, 0, [True if readline's argument is const char*]) ]) But I see in your patch and m4 file, that you test for const-correctness on the "basic_word_break" string, but it is also needed in other prototypes as well. It looks like all the same isues covered by CONFIG_OLD_READLINE, where old is <= 4.1. Since you use it more extensively, I'm sure you've covered more bases. :) In your experience, does testing for one or two const-incorrectnesses or readline indicate that mmuch/most of the rest of readline uses require const_cast<>? In other words, that one does not need to test different library symbols individually to "do the right thing"? FYI, if one really wanted to get the version of the underlying histedit library (around which the readline interface is wrapped by editline), one could check for: #define LIBEDIT_MAJOR 2 #define LIBEDIT_MINOR 9 (for example) in <histedit.h>. I never bothered to do this, as there are too many more important problems to tackle. :) Cheers, Fang [PATCH snipped] David Fang Computer Systems Laboratory Electrical & Computer Engineering Cornell University http://www.csl.cornell.edu/~fang/ -- (2400 baud? Netscape 3.0?? lynx??? No problem!)
Hello, On Mon, Jan 29, 2007 at 10:58:14PM -0500, David Fang wrote:
I just build cln-1.1.13, ginac-1.3.6 myself (OS X 10.4, dual G4) without problems, and bison didn't even play a role because ginac ships the resulting .cc sources with it (pre-built using bison 1.875, it seems). ^^^^^^^^^^^^^^^^^ Ouch! This version of bison is known to generate bad code, see http://www.ginac.de/pipermail/ginac-list/2006-July/000842.html for more details. Thus all gcc 4.1 users (read: all more or less up-to-date GNU/Linux distros users) will hit parser error bug again. :( In fact we've already had such a bug report, http://www.ginac.de/pipermail/ginac-list/2007-January/001020.html
I thought that was Fedora-specific issue, but apparently official version 1.3.6 fails too (to be more specific, make check fails due to parser errors). Removing input_parser.cc (so it will be regenerated with bison version 2.3) and recompiling solves the problem. I did not notice it earlier since I use git version (so input_{parser,lexer}.cc generated at compile time). Just in a case, $ g++ --version | head -n 1 g++ (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) $ bison --version | head -n 1 bison (GNU Bison) 2.3 I propose to make new bugfix-only release (e.g. regenerate input_parser.cc with "known-good" bison version)... Best regards, Alexei -- All science is either physics or stamp collecting.
Hi, Sheplyakov Alexei schrieb:
On Mon, Jan 29, 2007 at 10:58:14PM -0500, David Fang wrote:
I just build cln-1.1.13, ginac-1.3.6 myself (OS X 10.4, dual G4) without problems, and bison didn't even play a role because ginac ships the resulting .cc sources with it (pre-built using bison 1.875, it seems). ^^^^^^^^^^^^^^^^^ Ouch! This version of bison is known to generate bad code, see http://www.ginac.de/pipermail/ginac-list/2006-July/000842.html for more details. Thus all gcc 4.1 users (read: all more or less up-to-date GNU/Linux distros users) will hit parser error bug again. :( In fact we've already had such a bug report, http://www.ginac.de/pipermail/ginac-list/2007-January/001020.html
sorry, my fault. I was building it on a old SuSE installation and didn't consider this issue.
I propose to make new bugfix-only release (e.g. regenerate input_parser.cc with "known-good" bison version)...
Okay, I will do it. Are there any pending patches/bug fixes to be submitted soon? Regards, Jens
Dear Jens, On Tue, 30 Jan 2007, Jens Vollinga wrote:
Okay, I will do it. Are there any pending patches/bug fixes to be submitted soon?
Yes, the issue that I was talking about in my last post in ginac-devel. I will commit that to CVS tomorrow, I think. Best wishes, Chris
Hello! On Tue, Jan 30, 2007 at 03:42:59PM +0100, Jens Vollinga wrote:
I propose to make new bugfix-only release (e.g. regenerate input_parser.cc with "known-good" bison version)...
Okay, I will do it. Are there any pending patches/bug fixes to be submitted soon?
[PATCH] Fix libreadline version detection. Some broken libreadline versions (in particular one shipped with Mac OS X) report non-numeric rl_library_version. Reject such libraries and compile ginsh without libreadline. --- INSTALL | 5 +++-- acinclude.m4 | 9 ++++++++- ginsh/ginsh_parser.yy | 6 ++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/INSTALL b/INSTALL index 8d0b703..2c60d2d 100644 --- a/INSTALL +++ b/INSTALL @@ -104,12 +104,13 @@ install CLN properly on your system before continuing with GiNaC. Problems building ginsh ----------------------- -The most common reason why this doesn't succeed is the absence of +The most common reason why this doesn't succeed is the absence of GNU libreadline and/or the corresponding header files. Depending on what your system/distribution is, you will have to install a package called libreadline and maybe libreadline-dev. If your system's vendor doesn't supply such packages, go to <ftp://ftp.gnu.org/gnu/readline/> and compile -it yourself. +it yourself. Note that non-GNU versions of libreadline (in particular +one shipped with Mac OS X) are not supported at the moment. Problems with missing standard header files ------------------------------------------- diff --git a/acinclude.m4 b/acinclude.m4 index 4ab1387..64f4ec3 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -24,8 +24,15 @@ int main() fprintf(fd, "%s\n", rl_library_version); fclose(fd); return 0; -}], ginac_cv_rlversion=`cat 'conftest.out'`, ginac_cv_rlversion='unknown', ginac_cv_rlversion='4.2')]) +}], [ +dnl Some non-GNU readline implementations have non-numeric rl_library_version +ginac_cv_rlversion=`sed -e 's/[^0-9.]//g' 'conftest.out'`], [ ginac_cv_rlversion='unknown'], [ ginac_cv_rlversion='4.2'])]) +if test -z "$ginac_cv_rlversion"; then + GINAC_WARNING([Unsupported version of libreadline.]) + ginac_cv_rlversion='unknown' +fi if test "x${ginac_cv_rlversion}" != "xunknown"; then + AC_DEFINE(REALLY_HAVE_LIBREADLINE, ,[Define if GNU libreadline is installed]) RL_VERSION_MAJOR=`echo ${ginac_cv_rlversion} | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` AC_DEFINE_UNQUOTED(GINAC_RL_VERSION_MAJOR, $RL_VERSION_MAJOR, [Major version of installed readline library.]) RL_VERSION_MINOR=`echo ${ginac_cv_rlversion} | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` diff --git a/ginsh/ginsh_parser.yy b/ginsh/ginsh_parser.yy index b252609..954d54e 100644 --- a/ginsh/ginsh_parser.yy +++ b/ginsh/ginsh_parser.yy @@ -45,6 +45,7 @@ #define YYERROR_VERBOSE 1 +#ifdef REALLY_HAVE_LIBREADLINE // Original readline settings static int orig_completion_append_character; #if (GINAC_RL_VERSION_MAJOR < 4) || (GINAC_RL_VERSION_MAJOR == 4 && GINAC_RL_VERSION_MINOR < 2) @@ -58,6 +59,7 @@ static const char *orig_basic_word_break_characters; #else #define GINAC_RL_COMPLETER_CAST(a) (a) #endif +#endif // REALLY_HAVE_LIBREADLINE // Expression stack for %, %% and %%% static void push(const ex &e); @@ -850,6 +852,7 @@ static char *fcn_generator(const char *text, int state) return NULL; } +#ifdef REALLY_HAVE_LIBREADLINE static char **fcn_completion(const char *text, int start, int end) { if (rl_line_buffer[0] == '!') { @@ -874,6 +877,7 @@ static char **fcn_completion(const char *text, int start, int end) #endif } } +#endif // REALLY_HAVE_LIBREADLINE void greeting(void) { @@ -917,6 +921,7 @@ int main(int argc, char **argv) insert_help("print_latex", "print_latex(expression) - prints a LaTeX representation of the given expression"); insert_help("print_csrc", "print_csrc(expression) - prints a C source code representation of the given expression"); +#ifdef REALLY_HAVE_LIBREADLINE // Init readline completer rl_readline_name = argv[0]; #if (GINAC_RL_VERSION_MAJOR < 4) || (GINAC_RL_VERSION_MAJOR == 4 && GINAC_RL_VERSION_MINOR < 2) @@ -926,6 +931,7 @@ int main(int argc, char **argv) #endif orig_completion_append_character = rl_completion_append_character; orig_basic_word_break_characters = rl_basic_word_break_characters; +#endif // Init input file list, open first file num_files = argc - 1; ---- Best regards, Alexei -- All science is either physics or stamp collecting.
participants (6)
-
Charlls Quarra
-
Chris Dams
-
David Fang
-
Jens Vollinga
-
Jonathan Heinen
-
varg@theor.jinr.ru