]> git.sur5r.net Git - ngadmin/blob - configure.ac
Only link readline on programs that need it
[ngadmin] / configure.ac
1
2 AC_PREREQ([2.68])
3 AC_INIT([ngadmin], [0.1], [admin@darkcoven.tk])
4 AC_CONFIG_MACRO_DIR([.])
5 AC_CONFIG_SRCDIR([raw/src/attr.c])
6 AC_CONFIG_HEADERS([config.h])
7
8 AM_INIT_AUTOMAKE
9
10 # check for programs
11 AC_PROG_CC
12 AM_PROG_CC_C_O
13 AC_PROG_LIBTOOL
14 AC_PROG_INSTALL
15
16 LT_PREREQ([2.4])
17 LT_INIT
18
19
20 # enable/disable readline
21 AC_ARG_WITH([readline],
22         [AS_HELP_STRING([--with-readline], [support fancy command line editing @<:@default=check@:>@])],
23         [with_readline="$withval"], [with_readline=yes])
24
25 # enable debug build
26 AC_ARG_ENABLE(debug,
27         [AS_HELP_STRING([--enable-debug], [enable debug mode [default=no]])],
28         [enable_debug=yes], [enable_debug=no])
29
30 # enable/disable documentation generation
31 AC_ARG_ENABLE(doc,
32         [AS_HELP_STRING([--enable-doc], [enable documentation generation [default=no]])],
33         [enable_doc=yes], [enable_doc=no])
34
35 # enable/disable build of NgSpy
36 AC_ARG_ENABLE(spy,
37         [AS_HELP_STRING([--enable-spy], [enable NgSpy [default=no]])],
38         [enable_spy=yes], [enable_spy=no])
39 AM_CONDITIONAL(ENABLE_SPY, test x$enable_spy = xyes)
40
41 # enable/disable build of NgEmu
42 AC_ARG_ENABLE(emu,
43         [AS_HELP_STRING([--enable-emu], [enable NgEmu [default=no]])],
44         [enable_emu=yes], [enable_emu=no])
45 AM_CONDITIONAL(ENABLE_EMU, test x$enable_emu = xyes)
46
47
48
49 AS_IF([test "x${enable_doc}" = "xyes"], [
50         AC_CHECK_PROGS([DOXYGEN], [doxygen])
51         AS_IF([test -z "$DOXYGEN"], [
52                 AC_MSG_ERROR([Doxygen not found])
53         ])
54 ])
55 AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
56
57
58 AS_IF([test "x${with_readline}" != "xno"], [
59         AC_CHECK_LIB([readline], [readline], [
60                 AC_SUBST([READLINE_LIBS], [-lreadline])
61                 AC_DEFINE([HAVE_LIBREADLINE], [1], [Define if you have libreadline])
62         ], [
63                 AC_MSG_FAILURE([readline test failed (--without-readline to disable)])
64         ])
65 ])
66
67
68
69 CFLAGS="-Wall -Wextra -Os"
70
71 if test "x${enable_debug}" = xyes; then
72         CFLAGS="$CFLAGS -g"
73 else
74         CFLAGS="$CFLAGS -fomit-frame-pointer"
75         LDFLAGS="$LDFLAGS -s"
76 fi
77
78
79 # check for header files
80 AC_CHECK_HEADERS([arpa/inet.h stdlib.h string.h sys/ioctl.h termios.h unistd.h])
81 AC_HEADER_STDBOOL
82
83 # check for typedefs, structures, and compiler characteristics
84 AC_C_INLINE
85 AC_TYPE_SIZE_T
86
87 # check for library functions
88 AC_FUNC_MALLOC
89 AC_CHECK_FUNCS([inet_ntoa memchr memset select socket strcasecmp strdup strtol strtoul])
90
91
92 AC_CONFIG_FILES([
93         Makefile
94         raw/Makefile
95         raw/include/Makefile
96         raw/src/Makefile
97         lib/Makefile
98         lib/include/Makefile
99         lib/src/Makefile
100         cli/Makefile
101         cli/man/Makefile
102         cli/src/Makefile
103 ])
104
105 AM_COND_IF([ENABLE_SPY], [
106         AC_CONFIG_FILES([
107                         spy/Makefile
108                         spy/man/Makefile
109                         spy/src/Makefile
110                 ])
111 ])
112
113 AM_COND_IF([ENABLE_EMU], [
114         AC_CONFIG_FILES([
115                         emu/Makefile
116                         emu/man/Makefile
117                         emu/src/Makefile
118                 ])
119 ])
120
121
122 AC_OUTPUT
123
124
125 echo "
126 ${PACKAGE_NAME} version ${PACKAGE_VERSION}
127 Prefix.............: ${prefix}
128 Debug..............: ${enable_debug}
129 Doc................: ${enable_doc}
130 Compiler...........: ${CC} ${CFLAGS} ${CPPFLAGS}
131 Readline suppport..: ${with_readline}
132 Spy................: ${enable_spy}
133 Emulator...........: ${enable_emu}
134 "
135
136