]> git.sur5r.net Git - ngadmin/commitdiff
Only link readline on programs that need it
authordarkcoven <admin@darkcoven.tk>
Mon, 7 Oct 2013 20:18:20 +0000 (22:18 +0200)
committerdarkcoven <admin@darkcoven.tk>
Mon, 7 Oct 2013 20:18:20 +0000 (22:18 +0200)
cli/src/Makefile.am
configure.ac

index e6e9ee2b4e4fe8ff9bcd2f93da279dc86b17a36f..5f60acf3a3bc3147965c3b4ddd8d16de530c31a7 100644 (file)
@@ -6,5 +6,5 @@ ngcli_SOURCES = admin.c com_bitrate.c com_cabletest.c com_defaults.c com_firmwar
                common.c com_name.c com_netconf.c com_password.c com_ports.c com_qos.c \
                com_quit.c com_restart.c com_scan.c com_stormfilter.c com_tree.c com_vlan.c
 ngcli_CPPFLAGS = -I$(top_srcdir)/lib/include/
                common.c com_name.c com_netconf.c com_password.c com_ports.c com_qos.c \
                com_quit.c com_restart.c com_scan.c com_stormfilter.c com_tree.c com_vlan.c
 ngcli_CPPFLAGS = -I$(top_srcdir)/lib/include/
-ngcli_LDADD = $(top_builddir)/lib/src/libngadmin.la
+ngcli_LDADD = $(top_builddir)/lib/src/libngadmin.la $(READLINE_LIBS)
 
 
index 3c247a569302ab3ed715cc8b019bb78b56d53e4d..ff5d01905cf2a2ba51460de988db07709342760d 100644 (file)
@@ -20,7 +20,12 @@ LT_INIT
 # enable/disable readline
 AC_ARG_WITH([readline],
        [AS_HELP_STRING([--with-readline], [support fancy command line editing @<:@default=check@:>@])],
 # enable/disable readline
 AC_ARG_WITH([readline],
        [AS_HELP_STRING([--with-readline], [support fancy command line editing @<:@default=check@:>@])],
-       [with_readline="$withval"], [with_readline=check])
+       [with_readline="$withval"], [with_readline=yes])
+
+# enable debug build
+AC_ARG_ENABLE(debug,
+       [AS_HELP_STRING([--enable-debug], [enable debug mode [default=no]])],
+       [enable_debug=yes], [enable_debug=no])
 
 # enable/disable documentation generation
 AC_ARG_ENABLE(doc,
 
 # enable/disable documentation generation
 AC_ARG_ENABLE(doc,
@@ -41,33 +46,25 @@ AM_CONDITIONAL(ENABLE_EMU, test x$enable_emu = xyes)
 
 
 
 
 
 
-if test "x${enable_doc}" = xyes; then
+AS_IF([test "x${enable_doc}" = "xyes"], [
        AC_CHECK_PROGS([DOXYGEN], [doxygen])
        AC_CHECK_PROGS([DOXYGEN], [doxygen])
-       if test -z "$DOXYGEN"; then
-               AC_MSG_ERROR([
-----------------------------------------
-Doxygen not found
-----------------------------------------])
-       fi
-fi
+       AS_IF([test -z "$DOXYGEN"], [
+               AC_MSG_ERROR([Doxygen not found])
+       ])
+])
 AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
 
 
 AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
 
 
-# check for libraries
-if test "x${with_readline}" != xno; then
-       AC_CHECK_LIB([readline], [readline], [], [
-               if test "x${with_readline}" = xyes; then
-                       AC_MSG_ERROR([
-----------------------------------------
-Unable to find readline library
-----------------------------------------])
-               fi
+AS_IF([test "x${with_readline}" != "xno"], [
+       AC_CHECK_LIB([readline], [readline], [
+               AC_SUBST([READLINE_LIBS], [-lreadline])
+               AC_DEFINE([HAVE_LIBREADLINE], [1], [Define if you have libreadline])
+       ], [
+               AC_MSG_FAILURE([readline test failed (--without-readline to disable)])
        ])
        ])
-fi
+])
+
 
 
-AC_ARG_ENABLE(debug,
-       [AS_HELP_STRING([--enable-debug], [enable debug mode [default=no]])],
-       [enable_debug=yes], [enable_debug=no])
 
 CFLAGS="-Wall -Wextra -Os"
 
 
 CFLAGS="-Wall -Wextra -Os"
 
@@ -129,6 +126,7 @@ echo "
 ${PACKAGE_NAME} version ${PACKAGE_VERSION}
 Prefix.............: ${prefix}
 Debug..............: ${enable_debug}
 ${PACKAGE_NAME} version ${PACKAGE_VERSION}
 Prefix.............: ${prefix}
 Debug..............: ${enable_debug}
+Doc................: ${enable_doc}
 Compiler...........: ${CC} ${CFLAGS} ${CPPFLAGS}
 Readline suppport..: ${with_readline}
 Spy................: ${enable_spy}
 Compiler...........: ${CC} ${CFLAGS} ${CPPFLAGS}
 Readline suppport..: ${with_readline}
 Spy................: ${enable_spy}