3 dnl Configuration script for mLib
5 dnl (c) 2008 Straylight/Edgeware
8 dnl----- Licensing notice ---------------------------------------------------
10 dnl This file is part of the mLib utilities library.
12 dnl mLib is free software; you can redistribute it and/or modify
13 dnl it under the terms of the GNU Library General Public License as
14 dnl published by the Free Software Foundation; either version 2 of the
15 dnl License, or (at your option) any later version.
17 dnl mLib is distributed in the hope that it will be useful,
18 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
19 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 dnl GNU Library General Public License for more details.
22 dnl You should have received a copy of the GNU Library General Public
23 dnl License along with mLib; if not, write to the Free
24 dnl Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
25 dnl MA 02111-1307, USA.
27 dnl--------------------------------------------------------------------------
31 AC_INIT([mLib], AUTO_VERSION, [mdw@distorted.org.uk], [mLib])
32 AC_CONFIG_SRCDIR([mLib.pc.in])
33 AC_CONFIG_AUX_DIR([config])
34 AM_INIT_AUTOMAKE([foreign subdir-objects])
41 mdw_LIBTOOL_VERSION_INFO
43 AC_CHECK_PROGS([AUTOM4TE], [autom4te])
47 AC_DEFINE_UNQUOTED([SRCDIR], ["$(cd $srcdir && pwd)"],
48 [absolute pathname for the source directory.])
50 dnl--------------------------------------------------------------------------
51 dnl C programming environment.
53 dnl Set the master library list.
58 AC_CHECK_HEADERS([float.h])
59 AC_CHECK_HEADERS([stdint.h])
60 AC_CHECK_HEADERS([valgrind/valgrind.h])
61 AC_CHECK_HEADERS([wchar.h])
64 mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
65 AC_SEARCH_LIBS([sqrt], [m])
66 AC_SEARCH_LIBS([socket], [socket])
67 AC_SEARCH_LIBS([gethostbyname], [nsl resolv])
68 MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
71 AC_CHECK_FUNCS([mbrtowc])
72 AC_CHECK_FUNCS([snprintf])
73 AC_CHECK_FUNCS([wcwidth])
76 AC_CHECK_TYPE([socklen_t], [],
77 [AC_DEFINE([socklen_t], [int],
78 [Define to `int' if <sys/socket.h> does not define])],
80 @%:@include <sys/socket.h>
83 dnl Which version of struct msghdr do we have?
84 AC_CHECK_MEMBERS([struct msgdr.msg_control],,, [
85 @%:@include <sys/types.h>
86 @%:@include <sys/socket.h>
89 dnl Find out whether we're cross-compiling.
90 AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
92 dnl Floating-point formats.
95 dnl--------------------------------------------------------------------------
96 dnl Terminal characteristics.
98 mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
100 AC_ARG_WITH([unibilium],
101 AS_HELP_STRING([--with-unibilium], [support `unibilium' library]),
102 [want_unibilium=$withval],
103 [want_unibilium=auto])
105 case $want_unibilium in
106 no) have_unibilium=no ;;
107 *) have_unibilium=check ;;
109 case $have_unibilium in
111 PKG_CHECK_MODULES([unibilium], [unibilium >= 2.0.0],
112 [CFLAGS="$CFLAGS $unibilium_CFLAGS"
113 LIBS="$LIBS $unibilium_LIBS"],
118 case $have_unibilium in check) have_unibilium=yes ;; esac
119 case $want_unibilium,$have_unibilium in
121 AC_MSG_ERROR([`unibilium' library not found but explicitly requested])
125 AC_DEFINE([HAVE_UNIBILIUM], [1],
126 [define if you have (and want to use) the `unibilium' library.])
132 AM_CONDITIONAL([WITH_UNIBILIUM], [test "$use_unibilium" = yes])
134 AC_ARG_WITH([terminfo],
135 AS_HELP_STRING([--with-terminfo], [support `terminfo' library]),
136 [want_terminfo=$withval],
137 [want_terminfo=auto])
139 case $want_terminfo in
140 no) have_terminfo=no ;;
141 *) have_terminfo=check ;;
143 case $have_terminfo in
144 check) AC_CHECK_HEADERS([term.h], [], [have_terminfo=no]) ;;
146 case $have_terminfo in
148 AC_SEARCH_LIBS([tparm], [tinfo], [], [have_terminfo=no])
149 AC_CHECK_FUNCS([tiparm])
152 case $have_terminfo in check) have_terminfo=yes ;; esac
154 case $want_terminfo,$have_terminfo in
156 AC_MSG_ERROR([`terminfo' library not found but explicitly requested])
160 AC_DEFINE([HAVE_TERMINFO], [1],
161 [define if you have (and want to use) the `terminfo' library.])
167 AM_CONDITIONAL([WITH_TERMINFO], [test "$use_terminfo" = yes])
169 AC_ARG_WITH([termcap],
170 AS_HELP_STRING([--with-termcap], [support `termcap' library]),
171 [want_termcap=$withval],
174 case $want_termcap in
175 no) have_termcap=no ;;
176 *) have_termcap=check ;;
178 case $have_termcap in
179 check) AC_CHECK_HEADERS([termcap.h], [], [have_termcap=no]) ;;
181 case $have_termcap in
183 AC_SEARCH_LIBS([tgoto], [termcap], [], [have_termcap=no])
184 AC_SEARCH_LIBS([tgetstr], [termcap], [], [have_termcap=no])
187 case $have_termcap in check) have_termcap=yes ;; esac
189 case $want_termcap,$have_termcap in
191 AC_MSG_ERROR([`termcap' library not found but explicitly requested])
195 AC_DEFINE([HAVE_TERMCAP], [1],
196 [define if you have (and want to use) the `termcap' library.])
202 AM_CONDITIONAL([WITH_TERMCAP], [test "$use_termcap" = yes])
204 MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
206 dnl--------------------------------------------------------------------------
210 AS_HELP_STRING([--with-adns],
211 [use ADNS library for background name resolution]),
212 [want_adns=$withval],
215 mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
217 case $want_adns in no) ;; *) have_adns=check ;; esac
219 check) AC_CHECK_HEADERS([adns.h], [], [have_adns=no]) ;;
222 check) AC_SEARCH_LIBS([adns_init], [adns], [], [have_adns=no]) ;;
224 case $have_adns in check) have_adns=yes ;; esac
226 case $want_adns,$have_adns in
228 AC_MSG_ERROR([ADNS library not found but explicitly requested])
232 AC_DEFINE([HAVE_ADNS], [1],
233 [define if you have (and want to use) the ADNS library.])
238 AC_DEFINE_UNQUOTED([BRES_SERVER],
239 ["mdw_PATH($libexecdir)/$PACKAGE/mdw_PROG(bres)"],
240 [pathname to the standalone `bres' binary.'])
244 AM_CONDITIONAL([WITH_ADNS], [test "$use_adns" = yes])
246 MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
248 dnl--------------------------------------------------------------------------
251 AC_CHECK_HEADERS([linux/perf_event.h])
253 mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
254 AC_SEARCH_LIBS([clock_gettime], [rt])
255 MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
256 if test "$ac_cv_search_clock_gettime" != no; then
257 AC_DEFINE([HAVE_CLOCK_GETTIME], [1],
258 [Define if you have the \`clock_gettime' function.])
261 dnl--------------------------------------------------------------------------
262 dnl Python (used for testing).
264 AM_PATH_PYTHON([2.4],, [:])
266 dnl--------------------------------------------------------------------------
269 AC_CONFIG_HEADERS([config/config.h])
270 AC_CONFIG_TESTDIR([t])
281 [test/Makefile] [test/example/Makefile]
283 [ui/Makefile] [ui/example/Makefile]
285 [t/Makefile t/atlocal])
288 dnl------ That's all, folks -------------------------------------------------