replace: Fix checking for config.h #define in readline.h
[vlendec/samba-autobuild/.git] / lib / replace / system / readline.h
1 #ifndef _system_readline_h
2 #define _system_readline_h
3 /* 
4    Unix SMB/CIFS implementation.
5
6    Readline wrappers
7    
8      ** NOTE! The following LGPL license applies to the replace
9      ** library. This does NOT imply that all of Samba is released
10      ** under the LGPL
11    
12    This library is free software; you can redistribute it and/or
13    modify it under the terms of the GNU Lesser General Public
14    License as published by the Free Software Foundation; either
15    version 3 of the License, or (at your option) any later version.
16
17    This library is distributed in the hope that it will be useful,
18    but WITHOUT ANY WARRANTY; without even the implied warranty of
19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20    Lesser General Public License for more details.
21
22    You should have received a copy of the GNU Lesser General Public
23    License along with this library; if not, see <http://www.gnu.org/licenses/>.
24
25 */
26
27 #ifdef HAVE_LIBREADLINE
28 #  ifdef HAVE_READLINE_READLINE_H
29 #    ifdef HAVE_READLINE_READLINE_WORKAROUND
30 #      define _FUNCTION_DEF
31 #    endif
32 #    include <readline/readline.h>
33 #    ifdef HAVE_READLINE_HISTORY_H
34 #      include <readline/history.h>
35 #    endif
36 #  else
37 #    ifdef HAVE_READLINE_H
38 #      include <readline.h>
39 #      ifdef HAVE_HISTORY_H
40 #        include <history.h>
41 #      endif
42 #    else
43 #      undef HAVE_LIBREADLINE
44 #    endif
45 #  endif
46 #endif
47
48 #ifdef HAVE_NEW_LIBREADLINE
49 #ifdef HAVE_CPPFUNCTION
50 #  define RL_COMPLETION_CAST (CPPFunction *)
51 #elif defined(HAVE_RL_COMPLETION_T)
52 #  define RL_COMPLETION_CAST (rl_completion_t *)
53 #else
54 #  define RL_COMPLETION_CAST
55 #endif
56 #else
57 /* This type is missing from libreadline<4.0  (approximately) */
58 #  define RL_COMPLETION_CAST
59 #endif /* HAVE_NEW_LIBREADLINE */
60
61 #endif