When I try compile postgresql with --libeditpreferred option,
compilation fails when readline is also installed on the system. You can
see error report on:

http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=dot_moth&dt=2009-08-06%2012:46:04

The main problem is in src/bin/psql/input.h where is following ifdef
magic:

  #define USE_READLINE 1
  #if defined(HAVE_READLINE_READLINE_H)
        #include <readline/readline.h>
  #elif defined(HAVE_EDITLINE_READLINE_H)
        #include <editline/readline.h>
  #elif defined(HAVE_READLINE_H)
        #include <readline.h>
  #endif
  
  #if defined(HAVE_READLINE_HISTORY_H)
        #include <readline/history.h>
  #elif defined(HAVE_EDITLINE_HISTORY_H)
        #include <editline/history.h>
  #elif defined(HAVE_HISTORY_H)
        #include <history.h>
  #endif
  

The problem is that libedit does not distribute editline/history.h and
configure detects that there is readline/history.h and sets
HAVE_READLINE_HISTORY_H macro. Finally input.h includes
editline/readline.h and readline/history.h which causes symbol
conflicts.

It seems to me that editline never distributed history.h file and
HAVE_EDITLINE_HISTORY_H is nonsense. But I'm not sure.

I attached suggested fix, but it needs also some work in ./configure -
depends if libedit/history.h existed. Anyone knows a history?

I need to backported this fix for branches 8.2 - 8.4, because
OpenSolaris PostgreSQL binaries build is broken now.

        Zdenek









diff -r dd477d7938da src/bin/psql/input.h
--- a/src/bin/psql/input.h	Wed Jun 03 00:38:34 2009 +0000
+++ b/src/bin/psql/input.h	Thu Aug 06 22:24:58 2009 +0200
@@ -18,17 +18,16 @@
 #define USE_READLINE 1
 #if defined(HAVE_READLINE_READLINE_H)
 #include <readline/readline.h>
+#if defined(HAVE_READLINE_HISTORY_H)
+#include <readline/history.h>
+#endif
 #elif defined(HAVE_EDITLINE_READLINE_H)
 #include <editline/readline.h>
 #elif defined(HAVE_READLINE_H)
 #include <readline.h>
+#if defined(HAVE_HISTORY_H)
+#include <history.h>
 #endif
-#if defined(HAVE_READLINE_HISTORY_H)
-#include <readline/history.h>
-#elif defined(HAVE_EDITLINE_HISTORY_H)
-#include <editline/history.h>
-#elif defined(HAVE_HISTORY_H)
-#include <history.h>
 #endif
 #endif
 
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to