autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

autoconf 2.53 & readline


From: Sam Steingold
Subject: autoconf 2.53 & readline
Date: 20 Jul 2002 17:32:42 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

I am trying to write readline.m4 file (for inclusion into aclocal.m4)
and I am having the following problem:

READLINE_FILE_COMPLETE is always defined to an empty string, not either
filename_completion_function or rl_filename_completion_function, while
READLINE_CONST (and the rest, like HAVE_READLINE_READLINE_H etc)
is always correct.
I would greatly appreciate some advice.

------------------------ readline.m4 -------------------------------
AC_DEFUN([CL_READLINE],[dnl
AC_REQUIRE([CL_TERMCAP])dnl
if test $ac_cv_search_tgetent != no ; then
  AC_CHECK_HEADERS(readline/readline.h)
  if test $ac_cv_header_readline_readline_h = yes ; then
    AC_SEARCH_LIBS(readline, readline)
    # newer versions of readline prepend "rl_"
    AC_CHECK_FUNCS(rl_filename_completion_function)
    if [ test $ac_cv_func_rl_filename_completion_function = no ];
    then RL_FCF = filename_completion_function;
    else RL_FCF = rl_filename_completion_function; fi
    CL_PROTO([${RL_FCF}], [
      CL_PROTO_CONST([
#include <stdio.h>
#include <readline/readline.h>
      ],[char* ${RL_FCF} (char *, int);], [char* ${RL_FCF}();],
      cl_cv_proto_readline_const) ],
      [extern char* ${RL_FCF}($cl_cv_proto_readline_const char*, int);])
      AC_DEFINE_UNQUOTED(READLINE_FILE_COMPLETE,${RL_FCF})
      AC_DEFINE_UNQUOTED(READLINE_CONST,$cl_cv_proto_readline_const)
  fi
fi
])
------------------------ readline.m4 -------------------------------

the following file defines the prototype-detection macros, it is
heavily used in my project and thus must be correct :-)
(it is also written by a _true expert_ :-)

------------------------ proto.m4 -------------------------------
dnl CL_PROTO(IDENTIFIER, ACTION-IF-NOT-FOUND, FINAL-PROTOTYPE)
AC_DEFUN([CL_PROTO],
[AC_MSG_CHECKING([for $1 declaration])
AC_CACHE_VAL(cl_cv_proto_[$1], [$2
cl_cv_proto_$1="$3"])
cl_cv_proto_$1=`echo "[$]cl_cv_proto_$1" | tr -s ' ' | sed -e 's/( /(/'`
AC_MSG_RESULT([$]{ac_t:-
         }[$]cl_cv_proto_$1)
])

dnl CL_PROTO_RET(INCLUDES, DECL, CACHE-ID, TYPE-IF-OK, TYPE-IF-FAILS)
AC_DEFUN([CL_PROTO_RET],
[AC_TRY_COMPILE([$1]
AC_LANG_EXTERN[$2
], [], $3="$4", $3="$5")
])

dnl CL_PROTO_TRY(INCLUDES, ANSI-DECL, TRAD-DECL, ACTION-IF-OK, ACTION-IF-FAILS)
AC_DEFUN([CL_PROTO_TRY],
[AC_TRY_COMPILE([$1]
AC_LANG_EXTERN
[#if defined(__STDC__) || defined(__cplusplus)
$2
#else
$3
#endif
], [], [$4], [$5])
])

dnl CL_PROTO_CONST(INCLUDES, ANSI-DECL, TRAD-DECL, CACHE-ID)
AC_DEFUN([CL_PROTO_CONST],
[CL_PROTO_TRY([$1], [$2], [$3], $4="", $4="const")]
)
------------------------ proto.m4 -------------------------------

thanks.

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.3 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Sufficiently advanced stupidity is indistinguishable from malice.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]