]> git.sur5r.net Git - ngadmin/blob - configure.ac
3c247a569302ab3ed715cc8b019bb78b56d53e4d
[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=check])
24
25 # enable/disable documentation generation
26 AC_ARG_ENABLE(doc,
27         [AS_HELP_STRING([--enable-doc], [enable documentation generation [default=no]])],
28         [enable_doc=yes], [enable_doc=no])
29
30 # enable/disable build of NgSpy
31 AC_ARG_ENABLE(spy,
32         [AS_HELP_STRING([--enable-spy], [enable NgSpy [default=no]])],
33         [enable_spy=yes], [enable_spy=no])
34 AM_CONDITIONAL(ENABLE_SPY, test x$enable_spy = xyes)
35
36 # enable/disable build of NgEmu
37 AC_ARG_ENABLE(emu,
38         [AS_HELP_STRING([--enable-emu], [enable NgEmu [default=no]])],
39         [enable_emu=yes], [enable_emu=no])
40 AM_CONDITIONAL(ENABLE_EMU, test x$enable_emu = xyes)
41
42
43
44 if test "x${enable_doc}" = xyes; then
45         AC_CHECK_PROGS([DOXYGEN], [doxygen])
46         if test -z "$DOXYGEN"; then
47                 AC_MSG_ERROR([
48 ----------------------------------------
49 Doxygen not found
50 ----------------------------------------])
51         fi
52 fi
53 AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
54
55
56 # check for libraries
57 if test "x${with_readline}" != xno; then
58         AC_CHECK_LIB([readline], [readline], [], [
59                 if test "x${with_readline}" = xyes; then
60                         AC_MSG_ERROR([
61 ----------------------------------------
62 Unable to find readline library
63 ----------------------------------------])
64                 fi
65         ])
66 fi
67
68 AC_ARG_ENABLE(debug,
69         [AS_HELP_STRING([--enable-debug], [enable debug mode [default=no]])],
70         [enable_debug=yes], [enable_debug=no])
71
72 CFLAGS="-Wall -Wextra -Os"
73
74 if test "x${enable_debug}" = xyes; then
75         CFLAGS="$CFLAGS -g"
76 else
77         CFLAGS="$CFLAGS -fomit-frame-pointer"
78         LDFLAGS="$LDFLAGS -s"
79 fi
80
81
82 # check for header files
83 AC_CHECK_HEADERS([arpa/inet.h stdlib.h string.h sys/ioctl.h termios.h unistd.h])
84 AC_HEADER_STDBOOL
85
86 # check for typedefs, structures, and compiler characteristics
87 AC_C_INLINE
88 AC_TYPE_SIZE_T
89
90 # check for library functions
91 AC_FUNC_MALLOC
92 AC_CHECK_FUNCS([inet_ntoa memchr memset select socket strcasecmp strdup strtol strtoul])
93
94
95 AC_CONFIG_FILES([
96         Makefile
97         raw/Makefile
98         raw/include/Makefile
99         raw/src/Makefile
100         lib/Makefile
101         lib/include/Makefile
102         lib/src/Makefile
103         cli/Makefile
104         cli/man/Makefile
105         cli/src/Makefile
106 ])
107
108 AM_COND_IF([ENABLE_SPY], [
109         AC_CONFIG_FILES([
110                         spy/Makefile
111                         spy/man/Makefile
112                         spy/src/Makefile
113                 ])
114 ])
115
116 AM_COND_IF([ENABLE_EMU], [
117         AC_CONFIG_FILES([
118                         emu/Makefile
119                         emu/man/Makefile
120                         emu/src/Makefile
121                 ])
122 ])
123
124
125 AC_OUTPUT
126
127
128 echo "
129 ${PACKAGE_NAME} version ${PACKAGE_VERSION}
130 Prefix.............: ${prefix}
131 Debug..............: ${enable_debug}
132 Compiler...........: ${CC} ${CFLAGS} ${CPPFLAGS}
133 Readline suppport..: ${with_readline}
134 Spy................: ${enable_spy}
135 Emulator...........: ${enable_emu}
136 "
137
138