Hello, śr., 3 mar 2021 o 18:10 Eric Bollengier <e...@baculasystems.com> napisał(a):
> Hello Radek, > > On 3/3/21 17:40, Radosław Korzeniewski wrote: > > Hello, > > > > The readline manual (from Debian) gives: > > > > READLINE(3) > > > > Library Functions Manual > > > > READLINE(3) > > > > NAME > > readline - get a line from a user with editing > > > > SYNOPSIS > > #include <stdio.h> > > #include <readline/readline.h> > > #include <readline/history.h> > > > > So, I assume that a correct way to include readline headers is as above. > > But is this Linux specific? > > Yes, this is specific and probably some version of linux only (recent > ones, but probably not old ones, or the one installed manually). > Debian 9 and readline 7.0 is far from "recent". I'm not sure if you can install readline manually using include location other than "*/readline/readline.h". To verify that I compiled some readline library starting from version 2.0 (released in 1994) then 4.0, 5.0, 6.0. Every time (except ver 2.0 which does not support this configure parameter) the library uses --includedir=... parameter + "readline" directory for header files location. # ls -l /opt/readline-*/*/readline.h /usr/local/include/*/readline.h -rw-r--r-- 1 root root 24120 Mar 3 20:30 /opt/readline-4.0/include/readline/readline.h -rw-r--r-- 1 root root 33704 Mar 3 20:33 /opt/readline-5.0/include/readline/readline.h -rw-r--r-- 1 root root 35121 Mar 3 20:35 /opt/readline-6.0/include/readline/readline.h -rw-r--r-- 1 root staff 24120 Mar 3 20:29 /usr/local/include/readline/readline.h Let's check the readline-6.0 installdirs target: installdirs: $(srcdir)/support/mkinstalldirs -$(SHELL) $(srcdir)/support/mkinstalldirs $(DESTDIR)$(includedir) \ $(DESTDIR)$(includedir)/readline $(DESTDIR)$(libdir) \ $(DESTDIR)$(infodir) $(DESTDIR)$(man3dir) It "mkinstalldirs" for $(DESTDIR)$(includedir)/readline. So headers are always installed at: "*/readline/" directory. > > I'm asking as Bacula uses: > > > > #include "readline.h" > > #include "history.h" > > > > which in my understanding is incorrect. > > This is not incorrect, everything depends on the ./configure detection, > it includes the different path to the readline via something like CFLAGS > or an other Makefile variable. Changing these two lines requires to > update the configure and test on many platforms. Did you see a problem > while compiling ? > It is incorrect as the readline.h and history.h are external to Bacula so it should not use "local" includes. > > What do you think? > > If all systems are using it, it's ok, but I believe that it's not the > case. Systems where the readline is directly inside include/ will not > compile with <readline/readline.h> while they can compile with the > current code. Some people might call that a regression :-) > The question is why would a readline be available at an incorrect location not designed by readline developers? If readline developers designed his library to be used as <readline/readline.h> then in my opinion we use it incorrectly, right? I'm pretty sure that we use it incorrectly as the whole code goes like this: #ifdef HAVE_READLINE #define READLINE_LIBRARY 1 #include "readline.h" #include "history.h" ... But our code is not a readline library code, so why do we define this macro: READLINE_LIBRARY at all? What I understand from the readline code is that this macro is used to distinguish between "internal" and "public" usages. We should use a public interface of readline, right? So if public then readline developers designed it as: <readline/*.h> What do you think? -- Radosław Korzeniewski rados...@korzeniewski.net
_______________________________________________ Bacula-devel mailing list Bacula-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-devel