]> git.sur5r.net Git - ngadmin/blob - configure.ac
Add debug mode support
[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
31 if test "x${enable_doc}" = xyes; then
32         AC_CHECK_PROGS([DOXYGEN], [doxygen])
33         if test -z "$DOXYGEN"; then
34                 AC_MSG_ERROR([
35 ----------------------------------------
36 Doxygen not found
37 ----------------------------------------])
38         fi
39 fi
40 AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
41
42
43 # check for libraries
44 if test "x${with_readline}" != xno; then
45         AC_CHECK_LIB([readline], [readline], [], [
46                 if test "x${with_readline}" = xyes; then
47                         AC_MSG_ERROR([
48 ----------------------------------------
49 Unable to find readline library
50 ----------------------------------------])
51                 fi
52         ])
53 fi
54
55 AC_ARG_ENABLE(debug,
56         [AS_HELP_STRING([--enable-debug], [enable debug mode [default=no]])],
57         [enable_debug=yes], [enable_debug=no])
58
59 CFLAGS="-Wall -Wextra -Os"
60
61 if test "x${enable_debug}" = xyes; then
62         CFLAGS="$CFLAGS -g"
63 else
64         CFLAGS="$CFLAGS -fomit-frame-pointer"
65         LDFLAGS="$LDFLAGS -s"
66 fi
67
68
69 # check for header files
70 AC_CHECK_HEADERS([arpa/inet.h stdlib.h string.h sys/ioctl.h termios.h unistd.h])
71 AC_HEADER_STDBOOL
72
73 # check for typedefs, structures, and compiler characteristics
74 AC_C_INLINE
75 AC_TYPE_SIZE_T
76
77 # check for library functions
78 AC_FUNC_MALLOC
79 AC_CHECK_FUNCS([inet_ntoa memchr memset select socket strcasecmp strdup strtol strtoul])
80
81
82 AC_CONFIG_FILES([
83         Makefile
84         raw/Makefile
85         raw/include/Makefile
86         raw/src/Makefile
87         lib/Makefile
88         lib/include/Makefile
89         lib/src/Makefile
90         cli/Makefile
91         cli/man/Makefile
92         cli/src/Makefile
93 ])
94
95 AC_OUTPUT
96
97
98 echo "
99 ${PACKAGE_NAME} version ${PACKAGE_VERSION}
100 Prefix.............: ${prefix}
101 Debug..............: ${enable_debug}
102 Compiler...........: ${CC} ${CFLAGS} ${CPPFLAGS}
103 Readline suppport..: ${with_readline}
104 "
105
106