]> git.sur5r.net Git - ngadmin/blob - configure.ac
Use portable way to handle timeouts
[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 socket poll strcasecmp strdup strtol strtoul])
90
91 AC_CHECK_FUNC([clock_gettime], [
92         AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Define if you have clock_gettime])
93 ], [
94         AC_CHECK_LIB([rt], [clock_gettime], [
95                 AC_SUBST([RT_LIBS], [-lrt])
96                 AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Define if you have clock_gettime])
97         ], [
98                 AC_CHECK_FUNCS([gettimeofday])
99         ])
100 ])
101
102
103 AC_CONFIG_FILES([
104         Makefile
105         raw/Makefile
106         raw/include/Makefile
107         raw/include/nsdp/Makefile
108         raw/src/Makefile
109         lib/Makefile
110         lib/include/Makefile
111         lib/src/Makefile
112         lib/src/libngadmin.pc
113         cli/Makefile
114         cli/man/Makefile
115         cli/src/Makefile
116 ])
117
118 AM_COND_IF([ENABLE_SPY], [
119         AC_CONFIG_FILES([
120                 spy/Makefile
121                 spy/man/Makefile
122                 spy/src/Makefile
123         ])
124 ])
125
126 AM_COND_IF([ENABLE_EMU], [
127         AC_CONFIG_FILES([
128                 emu/Makefile
129                 emu/man/Makefile
130                 emu/src/Makefile
131         ])
132 ])
133
134 AM_COND_IF([HAVE_DOXYGEN], [
135         AC_CONFIG_FILES([
136                 lib/doxyfile
137         ])
138 ])
139
140 AC_OUTPUT
141
142
143 echo "
144 ${PACKAGE_NAME} version ${PACKAGE_VERSION}
145 Prefix.............: ${prefix}
146 Debug..............: ${enable_debug}
147 Doc................: ${enable_doc}
148 Compiler...........: ${CC} ${CFLAGS} ${CPPFLAGS}
149 Readline suppport..: ${with_readline}
150 Spy................: ${enable_spy}
151 Emulator...........: ${enable_emu}
152 "
153
154