Hi, > I attempted to import 'quotearg' module into an existing project tree by > following the instructions on this section of the manual: > > https://www.gnu.org/software/gnulib/manual/gnulib.html#Initial-import > > changing the existing project files configure.ac and top Makefile.am > accordingly. It seems that the 'lib' and 'm4' directories have been > successfully created and the relevant files copied. > > After that, I ran 'autoreconf' and attempted to build the project. The > first thing I noticed is that the existing project explicitly defined > _GNU_SOURCE in some source files. After importing the gnulib changes, this > is now also defined in config.h too so the compiler complained about double > references to the macro in the sources that explicitly defined it and also > included config.h. I resolved that by removing the definition in the > existing project tree source files and left the definition from config.h. > > So far so good. Then I attempted to take advantage of the qutoeaf > facilities provided by quotearg by including "#include "lib/quotearg.h"" in > the source and adding the following definitions > > /* Use these when there are spaces around the file name, > in the error message. */ > #define quoteaf(arg) \ > quotearg_style (shell_escape_always_quoting_style, arg) > #define quoteaf_n(n, arg) \ > quotearg_n_style (n, shell_escape_always_quoting_style, arg) > > borrowed from coreutils/src/system.h just to test locally if it works. > > I got this compile error: > > undefined reference to `quotearg_style' > > I added this to the top Makefile.am (among other things): > > ... > AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib > ... > LDADD = lib/libgnu.a > ... > > but it looks like no lib/libgnu.a file has been generated. > > What I am missing as part of this procedure?
I don't know what is missing. But there are two things to check: 1) gnulib-tool emits a number of instructions, at the end of its invocation. Have you followed them all? 2) Have you read chapter 3 of the Gnulib documentation? https://www.gnu.org/software/gnulib/manual/html_node/Invoking-gnulib_002dtool.html Bruno