File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / ntp / m4 / ntp_lineeditlibs.m4
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:08:38 2012 UTC (12 years, 5 months ago) by misho
Branches: ntp, MAIN
CVS tags: v4_2_6p5p0, v4_2_6p5, HEAD
ntp 4.2.6p5

    1: AC_DEFUN([NTP_LINEEDITLIBS], [
    2:     NTP_ORIG_LIBS="$LIBS"
    3:     AC_ARG_WITH(
    4: 	[lineeditlibs],
    5: 	[AS_HELP_STRING(
    6: 	    [--with-lineeditlibs],
    7: 	    [edit,editline (readline may be specified if desired)]
    8: 	)],
    9: 	[use_lineeditlibs="$withval"],
   10: 	[use_lineeditlibs="edit,editline"]
   11:     )
   12:     AC_MSG_CHECKING([line editing libraries])
   13:     AC_MSG_RESULT([$use_lineeditlibs])
   14:     case "$use_lineeditlibs" in
   15:      no) 
   16: 	ntp_lib_lineedit=no
   17: 	;;
   18:      *)
   19: 	for lineedit_lib in `echo $use_lineeditlibs | sed -e 's/,/ /'`; do
   20: 	    for term_lib in "" termcap curses ncurses; do
   21: 		case "$term_lib" in
   22: 		 '') 
   23: 		    TRY_LIB="-l$lineedit_lib"
   24: 		    ;;
   25: 		 *)
   26: 		    TRY_LIB="-l$lineedit_lib -l$term_lib"
   27: 		    ;;
   28: 		esac
   29: 		LIBS="$NTP_ORIG_LIBS $TRY_LIB"
   30: 		AC_MSG_CHECKING([for readline() with $TRY_LIB])
   31: 		AC_TRY_LINK_FUNC([readline], [ntp_lib_lineedit="$TRY_LIB"])
   32: 		case "$ntp_lib_lineedit" in
   33: 		 '')
   34: 		    AC_MSG_RESULT([no])
   35: 		    ;;
   36: 		 *) 
   37: 		    # Use readline()
   38: 		    AC_MSG_RESULT([yes])
   39: 		    break
   40: 		esac
   41: 		case "$term_lib" in
   42: 		 '')
   43: 		    # do not try el_gets without a terminal library
   44: 		    ;;
   45: 		 *)
   46: 		    AC_MSG_CHECKING([for el_gets() with $TRY_LIB])
   47: 		    AC_TRY_LINK_FUNC([el_gets], [ntp_lib_lineedit="$TRY_LIB"])
   48: 		    case "$ntp_lib_lineedit" in
   49: 		     '')
   50: 			AC_MSG_RESULT([no])
   51: 			;;
   52: 		     *) # Use el_gets()
   53: 			AC_MSG_RESULT([yes])
   54: 			break
   55: 			;;
   56: 		    esac	# $ntp_lib_lineedit
   57: 		esac		# $term_lib
   58: 	    done
   59: 	    case "$ntp_lib_lineedit" in
   60: 	     '')
   61: 		;;
   62: 	     *)
   63: 		break
   64: 		;;
   65: 	    esac
   66: 	done
   67: 	LIBS="$NTP_ORIG_LIBS"
   68: 	;;
   69:     esac	# $use_lineeditlibs
   70: 
   71:     case "$ntp_lib_lineedit" in
   72:      '')
   73: 	ntp_lib_lineedit="no"
   74: 	;;
   75:      no)
   76: 	;;
   77:      *)
   78: 	EDITLINE_LIBS="$ntp_lib_lineedit"
   79: 	AC_SUBST([EDITLINE_LIBS])
   80: 	;;
   81:     esac	# $ntp_lib_lineedit
   82: 
   83:     case "$ntp_lib_lineedit" in
   84:      no)
   85: 	;;
   86:      *)
   87: 	AC_CHECK_HEADERS([readline.h readline/readline.h histedit.h])
   88: 	AC_CHECK_HEADERS([history.h readline/history.h])
   89: 
   90: 	case "$ac_cv_header_histedit_h" in
   91: 	 yes)
   92: 	    AC_CACHE_CHECK(
   93: 		[number of arguments to el_init()],
   94: 		[ntp_cv_el_init_args],
   95: 		[AC_COMPILE_IFELSE(
   96: 		    [AC_LANG_PROGRAM(
   97: 			[[
   98: 			    #include <stdio.h>
   99: 			    #include <histedit.h>
  100: 			]],
  101: 			[[
  102: 			    el_init("conftest", stdin, stdout, stderr);
  103: 			]]
  104: 		    )],
  105: 		    [ntp_cv_el_init_args=4],
  106: 		    [ntp_cv_el_init_args=3]
  107: 		)]
  108: 	    )
  109: 	    AC_DEFINE_UNQUOTED(
  110: 		[EL_INIT_ARGS], 
  111: 		[$ntp_cv_el_init_args],
  112: 		[number of args to el_init()]
  113: 		)
  114: 	esac
  115: 	
  116: 	AC_MSG_CHECKING([whether readline supports history])
  117: 	
  118: 	ntp_lib_lineedit_history="no"
  119: 	ORIG_LIBS="$LIBS"
  120: 	LIBS="$ORIG_LIBS $ntp_lib_lineedit"
  121: 	AC_TRY_LINK_FUNC([add_history], [ntp_lib_lineedit_history="yes"])
  122: 	LIBS="$ORIG_LIBS"
  123: 
  124: 	AC_MSG_RESULT([$ntp_lib_lineedit_history])
  125: 
  126: 	case "$ntp_lib_lineedit_history" in
  127: 	 yes)
  128: 	    AC_DEFINE([HAVE_READLINE_HISTORY], [1],
  129: 		[Define if your readline library has \`add_history'])
  130: 	esac
  131:     esac	# $ntp_lib_lineedit
  132:     AS_UNSET([NTP_ORIG_LIBS])
  133:     AS_UNSET([ORIG_LIBS])
  134:     AS_UNSET([TRY_LIB])
  135:     AS_UNSET([use_lineeditlibs])
  136: ])dnl
  137: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>