summaryrefslogtreecommitdiff
path: root/source4/lib/cmdline/config.m4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-02-22 13:09:51 +0000
committerStefan Metzmacher <metze@samba.org>2004-02-22 13:09:51 +0000
commit42887e406a8751f9f852292d175682c5743d03ae (patch)
tree55021193cab2ea94d4d3969d84f72945cfbeed7d /source4/lib/cmdline/config.m4
parent4282138ebbf2b2f708903cdfe713786a8c3e6960 (diff)
downloadsamba-42887e406a8751f9f852292d175682c5743d03ae.tar.gz
samba-42887e406a8751f9f852292d175682c5743d03ae.tar.bz2
samba-42887e406a8751f9f852292d175682c5743d03ae.zip
- creat the LIBCMDLINE subsystem
including readline and popt - creat the CONFIG subsystem including param/* dynconfig.* and passdb/secrets.* metze (This used to be commit bfd7fd21c8e38c0065fc41dde10e863a169878c2)
Diffstat (limited to 'source4/lib/cmdline/config.m4')
-rw-r--r--source4/lib/cmdline/config.m479
1 files changed, 79 insertions, 0 deletions
diff --git a/source4/lib/cmdline/config.m4 b/source4/lib/cmdline/config.m4
new file mode 100644
index 0000000000..6e9a8f4508
--- /dev/null
+++ b/source4/lib/cmdline/config.m4
@@ -0,0 +1,79 @@
+#################################################
+
+###############################################
+# Readline included by default unless explicitly asked not to
+test "${with_readline+set}" != "set" && with_readline=yes
+
+# test for where we get readline() from
+AC_MSG_CHECKING(whether to use readline)
+AC_ARG_WITH(readline,
+[ --with-readline[=DIR] Look for readline include/libs in DIR (default=auto) ],
+[ case "$with_readline" in
+ yes)
+ AC_MSG_RESULT(yes)
+
+ AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
+ AC_CHECK_HEADERS(readline/history.h)
+
+ AC_CHECK_HEADERS(readline.h readline/readline.h,[
+ for termlib in ncurses curses termcap terminfo termlib tinfo; do
+ AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
+ done
+ AC_CHECK_LIB(readline, rl_callback_handler_install,
+ [TERMLIBS="-lreadline $TERMLIBS"
+ AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline])
+ break], [TERMLIBS=], $TERMLIBS)])
+ ;;
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+
+ # Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
+ # alternate readline path
+ _ldflags=${LDFLAGS}
+ _cppflags=${CPPFLAGS}
+
+ # Add additional search path
+ LDFLAGS="-L$with_readline/lib $LDFLAGS"
+ CPPFLAGS="-I$with_readline/include $CPPFLAGS"
+
+ AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
+ AC_CHECK_HEADERS(readline/history.h)
+
+ AC_CHECK_HEADERS(readline.h readline/readline.h,[
+ for termlib in ncurses curses termcap terminfo termlib; do
+ AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
+ done
+ AC_CHECK_LIB(readline, rl_callback_handler_install,
+ [TERMLDFLAGS="-L$with_readline/lib"
+ TERMCPPFLAGS="-I$with_readline/include"
+ LDFLAGS="-L$with_readline/lib $LDFLAGS"
+ CPPFLAGS="-I$with_readline/include $CPPFLAGS"
+ TERMLIBS="-lreadline $TERMLIBS"
+ AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline])
+ break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)])
+
+ ;;
+ esac],
+ AC_MSG_RESULT(no)
+)
+
+# The readline API changed slightly from readline3 to readline4, so
+# code will generate warnings on one of them unless we have a few
+# special cases.
+AC_CHECK_LIB(readline, rl_completion_matches,
+ [AC_DEFINE(HAVE_NEW_LIBREADLINE, 1,
+ [Do we have rl_completion_matches?])],
+ [],
+ [$TERMLIBS])
+
+TMP_LIBCMDLINE_OBJS="lib/cmdline/readline.o lib/cmdline/popt_common.o"
+TMP_LIBCMDLINE_LIBS="$TERMLIBS"
+
+SMB_SUBSYSTEM(LIBCMDLINE,[],
+ [${TMP_LIBCMDLINE_OBJS}],
+ [],
+ [],
+ [${TMP_LIBCMDLINE_LIBS}])