]> git.sur5r.net Git - ngadmin/blobdiff - configure.ac
Merge branch 'autotools'
[ngadmin] / configure.ac
index ed7bdaf23ecc9f9033119da803cd6a2478b8ad9a..eeafab3a7ce657fbeed0e170679384b29d85a466 100644 (file)
@@ -20,41 +20,51 @@ LT_INIT
 # 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,
        [AS_HELP_STRING([--enable-doc], [enable documentation generation [default=no]])],
        [enable_doc=yes], [enable_doc=no])
 
+# enable/disable build of NgSpy
+AC_ARG_ENABLE(spy,
+       [AS_HELP_STRING([--enable-spy], [enable NgSpy [default=no]])],
+       [enable_spy=yes], [enable_spy=no])
+AM_CONDITIONAL(ENABLE_SPY, test x$enable_spy = xyes)
+
+# enable/disable build of NgEmu
+AC_ARG_ENABLE(emu,
+       [AS_HELP_STRING([--enable-emu], [enable NgEmu [default=no]])],
+       [enable_emu=yes], [enable_emu=no])
+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])
-       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"])
 
 
-# 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"
 
@@ -87,11 +97,29 @@ AC_CONFIG_FILES([
        lib/Makefile
        lib/include/Makefile
        lib/src/Makefile
+       lib/src/libngadmin.pc
        cli/Makefile
        cli/man/Makefile
        cli/src/Makefile
 ])
 
+AM_COND_IF([ENABLE_SPY], [
+       AC_CONFIG_FILES([
+                       spy/Makefile
+                       spy/man/Makefile
+                       spy/src/Makefile
+               ])
+])
+
+AM_COND_IF([ENABLE_EMU], [
+       AC_CONFIG_FILES([
+                       emu/Makefile
+                       emu/man/Makefile
+                       emu/src/Makefile
+               ])
+])
+
+
 AC_OUTPUT
 
 
@@ -99,8 +127,11 @@ echo "
 ${PACKAGE_NAME} version ${PACKAGE_VERSION}
 Prefix.............: ${prefix}
 Debug..............: ${enable_debug}
+Doc................: ${enable_doc}
 Compiler...........: ${CC} ${CFLAGS} ${CPPFLAGS}
 Readline suppport..: ${with_readline}
+Spy................: ${enable_spy}
+Emulator...........: ${enable_emu}
 "