Hi Bob, * Bob Rossi wrote on Thu, Jul 07, 2005 at 04:34:25PM CEST: > > Something like a > > --with-readline[=included] > > might be useful, although I don't know of an established convention for > > the optional `=included' part. > > > > > Also, AC_CHECK_LIB can not even look for libreadline.a until after the > > > "make" is done. Is there a way to ./configure && make && make install > > > the readline package, and then continue with CGDB's configure? > > > > Well, if you use your prepackaged readline, there is no need to check > > for either the headers nor the library -- you know they _will_ be there. > > (Of course, in that case your configure.ac should set appropriate flags > > for preprocessor and linker/libs.) > > Thanks for the general philosophy on how to accomplish this task, it's > much needed. I have several questions though, > > I understand how to set the libs flag, > LIBS="$LIBS -lreadline -lhistory" Nope. Most likely, you want LIBS="-lreadline -lhistory $LIBS" instead. New libraries go in front, as they might depend on libraries already put in LIBS. > however, I can't simply set the -I and -L flags because the path is > relative to the current build directory, right? Oh, well. Not a trivial question here. If readline libs are built by use of libtool, you should put AC_PROG_LIBTOOL in your toplevel configure and put program_LDADD = relative/path/to/subpackage/libNAME.la in the corresponding Makefile.am. (In order to allow using installed readline, you can make use of Automake conditionals in Makefile.am -- see Automake documentation about this.) If not: I actually don't know how to portably do this so that rpath issues are _really_ solved. But see below. > Is there a way to get the absolute path to the $srcdir/readline-5.0 in > the configure.in, so that I can simply say > -I$ABSOLUTE_srcdir/readline-5.0 -L$ABSOLUTE_srcdir/readline-5.0? > > or do I have to have each Makefile.am specify the relatvie path back to > $srcdir/readline-5.0, and only if the internal readline is chosen? I don't think you'll want to use absolute paths if you can avoid it, for rpath encoding reasons. But you can use them like this (conveniently abstracted out into separate Makefile variables): -I$(top_srcdir)/readline-5.0/include -L$(top_builddir)/readline-5.0/lib Please don't destroy the possibility of having a build tree separate from the source tree. Thus, if readline has headers which are created only during the build, then you should also add -I$(top_builddir)/readline-5.0/include to the preprocessor search path. > BTW, what's the appropriate way to set the CFLAGS, CPPFLAGS and LDFLAGS? > This is what I have been doing, > > LDFLAGS="-L$opt_with_readline_prefix/lib $LDFLAGS" > CFLAGS="-I$opt_with_readline_prefix/include > -I$opt_with_readline_prefix/include/readline $CFLAGS" > CPPFLAGS="-I$opt_with_readline_prefix/include > -I$opt_with_readline_prefix/include/readline $CPPFLAGS" Don't set any of these at all -- they are supposed to be reserved for the user. If you use Automake, read info Automake 'Flag Variables Ordering' (also be sure to have a look at info Autoconf 'Preset Output Variables' anyway) for the supposed names you should use. (Note there is a difference here for the flags you might have to set for some of the Autoconf tests and which are supposed for users to be set in the resulting Makefile -- that's what snippets like save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I..." # ... test CPPFLAGS=$save_CPPFLAGS in the configure script are for.) And preprocessor flags should go in *CPPFLAGS only, not *CFLAGS. I believe *CPPFLAGS and *LDFLAGS should be appended to. Regards, Ralf _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf