Code

Add support for both, ncurses and ncursesw.
[liboping.git] / configure.ac
1 # Process this file with autoconf to produce a configure script.
3 AC_PREREQ([2.65])
4 AC_INIT([liboping],[1.6.2])
5 AC_CONFIG_SRCDIR([src/liboping.c])
6 AC_CONFIG_HEADERS([src/config.h])
7 AC_CONFIG_MACRO_DIR([m4])
8 AM_INIT_AUTOMAKE([dist-bzip2])
9 AC_LANG([C])
11 AC_PREFIX_DEFAULT("/opt/oping")
13 # API version
14 LIBOPING_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
15 LIBOPING_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
16 LIBOPING_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
17 AC_SUBST(LIBOPING_MAJOR)
18 AC_SUBST(LIBOPING_MINOR)
19 AC_SUBST(LIBOPING_PATCH)
21 # ABI version
22 LIBOPING_CURRENT=2
23 LIBOPING_REVISION=9
24 LIBOPING_AGE=2
25 AC_SUBST(LIBOPING_CURRENT)
26 AC_SUBST(LIBOPING_REVISION)
27 AC_SUBST(LIBOPING_AGE)
29 #
30 # Check for programs/utilities
31 #
32 AC_PROG_CC
33 AC_PROG_CPP
34 AC_PROG_INSTALL
35 AC_PROG_LN_S
36 AC_PROG_MAKE_SET
37 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
39 if test "x$PERL" = "x"
40 then
41         PERL="perl"
42 fi
43 AC_ARG_VAR(PERL, [Perl interpreter command])
45 # configure libtool
46 LT_INIT([dlopen])
48 # Checks for header files.
49 AC_HEADER_STDC
50 AC_HEADER_TIME
51 AC_CHECK_HEADERS([math.h signal.h fcntl.h inttypes.h netdb.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h locale.h langinfo.h])
53 # This sucks, but what can I do..?
54 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
55 [#if HAVE_STDINT_H
56 # include <stdint.h>
57 #endif
58 #if HAVE_SYS_TYPES_H
59 # include <sys/types.h>
60 #endif
61 ])
62 AC_CHECK_HEADERS(netinet/in.h, [], [],
63 [#if HAVE_STDINT_H
64 # include <stdint.h>
65 #endif
66 #if HAVE_SYS_TYPES_H
67 # include <sys/types.h>
68 #endif
69 #if HAVE_NETINET_IN_SYSTM_H
70 # include <netinet/in_systm.h>
71 #endif
72 ])
73 AC_CHECK_HEADERS(netinet/ip.h, [], [],
74 [#if HAVE_STDINT_H
75 # include <stdint.h>
76 #endif
77 #if HAVE_SYS_TYPES_H
78 # include <sys/types.h>
79 #endif
80 #if HAVE_NETINET_IN_SYSTM_H
81 # include <netinet/in_systm.h>
82 #endif
83 #if HAVE_NETINET_IN_H
84 # include <netinet/in.h>
85 #endif
86 ])
87 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
88 [#if HAVE_STDINT_H
89 # include <stdint.h>
90 #endif
91 #if HAVE_SYS_TYPES_H
92 # include <sys/types.h>
93 #endif
94 #if HAVE_NETINET_IN_SYSTM_H
95 # include <netinet/in_systm.h>
96 #endif
97 #if HAVE_NETINET_IN_H
98 # include <netinet/in.h>
99 #endif
100 #if HAVE_NETINET_IP_H
101 # include <netinet/ip.h>
102 #endif
103 ])
104 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
105 [#if HAVE_STDINT_H
106 # include <stdint.h>
107 #endif
108 #if HAVE_SYS_TYPES_H
109 # include <sys/types.h>
110 #endif
111 #if HAVE_NETINET_IN_SYSTM_H
112 # include <netinet/in_systm.h>
113 #endif
114 #if HAVE_NETINET_IN_H
115 # include <netinet/in.h>
116 #endif
117 #if HAVE_NETINET_IP_H
118 # include <netinet/ip.h>
119 #endif
120 ])
121 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
122 [#if HAVE_STDINT_H
123 # include <stdint.h>
124 #endif
125 #if HAVE_SYS_TYPES_H
126 # include <sys/types.h>
127 #endif
128 #if HAVE_SYS_TYPES_H
129 # include <sys/types.h>
130 #endif
131 #if HAVE_NETINET_IN_SYSTM_H
132 # include <netinet/in_systm.h>
133 #endif
134 #if HAVE_NETINET_IN_H
135 # include <netinet/in.h>
136 #endif
137 ])
138 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
139 [#if HAVE_STDINT_H
140 # include <stdint.h>
141 #endif
142 #if HAVE_SYS_TYPES_H
143 # include <sys/types.h>
144 #endif
145 #if HAVE_NETINET_IN_SYSTM_H
146 # include <netinet/in_systm.h>
147 #endif
148 #if HAVE_NETINET_IN_H
149 # include <netinet/in.h>
150 #endif
151 #if HAVE_NETINET_IP6_H
152 # include <netinet/ip6.h>
153 #endif
154 ])
156 # Checks for typedefs, structures, and compiler characteristics.
157 AC_TYPE_SIZE_T
158 AC_TYPE_SSIZE_T
159 AC_TYPE_UID_T
160 AC_TYPE_UINT16_T
161 AC_TYPE_UINT32_T
162 AC_TYPE_UINT8_T
164 socket_needs_socket="no"
165 AC_CHECK_FUNCS(socket, [],
166         AC_CHECK_LIB(socket, socket,
167                 [socket_needs_socket="yes"],
168                 AC_MSG_ERROR(cannot find socket)))
169 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
171 # Under Solaris, the `xnet' library provides `recvmsg' which complies with the
172 # X/Open CAE Specification.
173 with_libxnet="no"
174 AC_CHECK_LIB(xnet, __xnet_recvmsg, [with_libxnet="yes"],[])
175 if test "x$with_libxnet" = "xyes"
176 then
177         CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
178 fi
179 AM_CONDITIONAL(BUILD_WITH_LIBXNET, test "x$with_libxnet" = "xyes")
181 nanosleep_needs_rt="no"
182 AC_CHECK_FUNCS(nanosleep, [],
183         AC_CHECK_LIB(rt, nanosleep,
184                 [nanosleep_needs_rt="yes"],
185                 AC_MSG_ERROR(cannot find nanosleep)))
186 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
188 with_ncurses="no"
189 AC_CHECK_HEADERS(ncursesw/ncurses.h ncurses.h, [with_ncurses="yes"], [])
190 if test "x$with_ncurses" = "xyes"
191 then
192         have_ncursesw="no"
193         have_ncurses="no"
194         NCURSES_LIB=""
196         AC_CHECK_LIB(ncursesw, mvwprintw, [have_ncursesw="yes"], [have_ncursesw="no"])
197         AC_CHECK_LIB(ncurses, mvwprintw, [have_ncurses="yes"], [have_ncurses="no"])
199         if test "x$have_ncursesw" = "xyes"; then
200                 NCURSES_LIB="-lncursesw"
201         else if test "x$have_ncurses" = "xyes"; then
202                 NCURSES_LIB="-lncurses"
203         else
204                 with_ncurses="no"
205         fi; fi
206         AC_SUBST(NCURSES_LIB)
207 fi
208 AM_CONDITIONAL(BUILD_WITH_LIBNCURSES, test "x$with_ncurses" = "xyes")
210 AC_FUNC_STRERROR_R
212 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [Enable extensive debugging output.])],
214         if test "x$enable_debug" = "xyes"
215         then
216                 AC_DEFINE(WITH_DEBUG, 1, [Define to 1 if you want to get debugging output.])
217         fi
218 ], [])
219 AM_CONDITIONAL(BUILD_WITH_DEBUG, test "x$enable_debug" = "xyes")
221 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
223         if test "x$withval" != "xno" && test "x$withval" != "xyes"
224         then
225                 PERL_BINDINGS_OPTIONS="$withval"
226                 with_perl_bindings="yes"
227         else
228                 PERL_BINDINGS_OPTIONS=""
229                 with_perl_bindings="$withval"
230         fi
231 ],
233         PERL_BINDINGS_OPTIONS=""
234         with_perl_bindings="yes"
235 ])
237 if test "x$with_perl_bindings" = "xyes"
238 then
239         BINDINGS="perl-bindings"
240 else
241         BINDINGS=""
242 fi
244 AC_SUBST(PERL_BINDINGS_OPTIONS)
246 AC_SUBST(BINDINGS)
248 # Checks for library functions.
249 AC_FUNC_MALLOC
250 AC_FUNC_STRERROR_R
251 AC_CHECK_FUNCS([gettimeofday memset modf select socket sqrt strcasecmp strdup strerror strncasecmp strtoul])
253 AC_CONFIG_FILES([Makefile src/Makefile src/mans/Makefile bindings/Makefile])
254 AC_OUTPUT