]> git.sur5r.net Git - ngadmin/blob - configure.ac
Merge remote-tracking branch 'upstream/master'
[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=yes@:>@])],
23         [], [with_readline=yes])
24
25 # enable/disable debug build
26 AC_ARG_ENABLE(debug,
27         [AS_HELP_STRING([--enable-debug], [enable debug mode [default=no]])],
28         [], [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=no])
34
35 # enable/disable build of NgCli
36 AC_ARG_ENABLE(cli,
37         [AS_HELP_STRING([--enable-cli], [enable NgCli [default=yes]])],
38         [], [enable_cli=yes])
39 AM_CONDITIONAL(ENABLE_CLI, test x$enable_cli = xyes)
40 if test x$enable_cli != xyes; then
41         with_readline="no"
42 fi
43
44 # enable/disable build of NgSpy
45 AC_ARG_ENABLE(spy,
46         [AS_HELP_STRING([--enable-spy], [enable NgSpy [default=no]])],
47         [], [enable_spy=no])
48 AM_CONDITIONAL(ENABLE_SPY, test x$enable_spy = xyes)
49
50 # enable/disable build of NgEmu
51 AC_ARG_ENABLE(emu,
52         [AS_HELP_STRING([--enable-emu], [enable NgEmu [default=no]])],
53         [], [enable_emu=no])
54 AM_CONDITIONAL(ENABLE_EMU, test x$enable_emu = xyes)
55
56 # tell if libngadmin build is required
57 if test x$enable_cli != xyes; then
58         require_lib="no"
59 else
60         require_lib="yes"
61 fi
62
63 # enable/disable build of libngadmin
64 AC_ARG_ENABLE(lib,
65         [AS_HELP_STRING([--enable-lib], [enable libngadmin [default=yes]])],
66         [], [enable_lib=yes])
67 AS_IF([test x$require_lib = xyes -a x$enable_lib = xno], [
68         AC_MSG_FAILURE([libngadmin build disabled but required])
69 ])
70 AM_CONDITIONAL(ENABLE_LIB, test x$enable_lib = xyes)
71
72
73
74 CFLAGS="-Wall -Wextra -Os"
75
76 if test "x${enable_debug}" = xyes; then
77         CFLAGS="$CFLAGS -g"
78 else
79         CFLAGS="$CFLAGS -fomit-frame-pointer"
80         LDFLAGS="$LDFLAGS -s"
81 fi
82
83
84 # check for header files
85 AC_CHECK_HEADERS([arpa/inet.h stdlib.h string.h sys/ioctl.h termios.h unistd.h])
86 AC_HEADER_STDBOOL
87
88 # check for typedefs, structures, and compiler characteristics
89 AC_C_INLINE
90 AC_TYPE_SIZE_T
91
92 # check for library functions
93 AC_FUNC_MALLOC
94 AC_CHECK_FUNCS([inet_ntoa memchr memset socket poll strcasecmp strdup strtol strtoul])
95
96 # check for clock_gettime
97 AC_CHECK_FUNC([clock_gettime], [
98         AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Define if you have clock_gettime])
99 ], [
100         AC_CHECK_LIB([rt], [clock_gettime], [
101                 AC_SUBST([RT_LIBS], [-lrt])
102                 AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Define if you have clock_gettime])
103         ], [
104                 AC_CHECK_FUNCS([gettimeofday])
105         ])
106 ])
107
108 # check for doxygen
109 AS_IF([test x$enable_doc = xyes], [
110         AC_CHECK_PROGS([DOXYGEN], [doxygen])
111         AS_IF([test -z "$DOXYGEN"], [
112                 AC_MSG_ERROR([Doxygen not found])
113         ])
114 ])
115 AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
116
117 # check for libreadline
118 AS_IF([test x$with_readline != xno], [
119         AC_CHECK_LIB([readline], [readline], [
120                 AC_SUBST([READLINE_LIBS], [-lreadline])
121                 AC_DEFINE([HAVE_LIBREADLINE], [1], [Define if you have libreadline])
122         ], [
123                 AC_MSG_FAILURE([readline test failed (--without-readline to disable)])
124         ])
125 ])
126
127
128
129 AC_CONFIG_FILES([
130         Makefile
131         raw/Makefile
132         raw/include/Makefile
133         raw/include/nsdp/Makefile
134         raw/src/Makefile
135         lib/Makefile
136         lib/doxyfile
137         lib/include/Makefile
138         lib/src/Makefile
139         lib/src/libngadmin.pc
140         cli/Makefile
141         cli/man/Makefile
142         cli/src/Makefile
143         spy/Makefile
144         spy/man/Makefile
145         spy/src/Makefile
146         emu/Makefile
147         emu/man/Makefile
148         emu/src/Makefile
149         wireshark/Makefile
150 ])
151
152 AC_OUTPUT
153
154
155 echo "
156 ${PACKAGE_NAME} version ${PACKAGE_VERSION}
157 Prefix.............: ${prefix}
158 Debug..............: ${enable_debug}
159 Doc................: ${enable_doc}
160 Compiler...........: ${CC} ${CFLAGS} ${CPPFLAGS}
161 Readline support...: ${with_readline}
162 Lib................: ${enable_lib}
163 Cli................: ${enable_cli}
164 Spy................: ${enable_spy}
165 Emulator...........: ${enable_emu}
166 "
167