chiark / gitweb /
@@@ fltfmt wip
[mLib] / configure.ac
CommitLineData
a0150d8d
MW
1dnl -*-autoconf-*-
2dnl
3dnl Configuration script for mLib
4dnl
5dnl (c) 2008 Straylight/Edgeware
6dnl
7
51c4088b 8dnl----- Licensing notice ---------------------------------------------------
a0150d8d
MW
9dnl
10dnl This file is part of the mLib utilities library.
11dnl
12dnl mLib is free software; you can redistribute it and/or modify
13dnl it under the terms of the GNU Library General Public License as
14dnl published by the Free Software Foundation; either version 2 of the
15dnl License, or (at your option) any later version.
16dnl
17dnl mLib is distributed in the hope that it will be useful,
18dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
19dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20dnl GNU Library General Public License for more details.
21dnl
22dnl You should have received a copy of the GNU Library General Public
23dnl License along with mLib; if not, write to the Free
24dnl Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
25dnl MA 02111-1307, USA.
26
27dnl--------------------------------------------------------------------------
28dnl Initialization.
29
30mdw_AUTO_VERSION
b3a0ac5e 31AC_INIT([mLib], AUTO_VERSION, [mdw@distorted.org.uk], [mLib])
a0150d8d
MW
32AC_CONFIG_SRCDIR([mLib.pc.in])
33AC_CONFIG_AUX_DIR([config])
b012588c 34AM_INIT_AUTOMAKE([foreign subdir-objects])
3ac6fc5f 35mdw_SILENT_RULES
a0150d8d
MW
36
37AC_PROG_CC
38AM_PROG_CC_C_O
0335afec 39LT_INIT
a0150d8d
MW
40AX_CFLAGS_WARN_ALL
41mdw_LIBTOOL_VERSION_INFO
42
7cf5c72a
MW
43AC_CHECK_PROGS([AUTOM4TE], [autom4te])
44
6b210fdf 45mdw_MANEXT([mLib])
a0150d8d
MW
46
47AC_DEFINE_UNQUOTED([SRCDIR], ["$(cd $srcdir && pwd)"],
48 [absolute pathname for the source directory.])
49
50dnl--------------------------------------------------------------------------
51dnl C programming environment.
52
5b2eac52
MW
53MLIB_LIBS=
54
a0150d8d
MW
55dnl Headers.
56AC_CHECK_HEADERS([float.h])
5007fea9 57AC_CHECK_HEADERS([stdint.h])
b1a20bee 58AC_CHECK_HEADERS([valgrind/valgrind.h])
a0150d8d
MW
59
60dnl Libraries.
5b2eac52 61mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
b64eb60f 62AC_SEARCH_LIBS([sqrt], [m])
a0150d8d
MW
63AC_SEARCH_LIBS([socket], [socket])
64AC_SEARCH_LIBS([gethostbyname], [nsl resolv])
5b2eac52 65MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
a0150d8d 66
eff136f6
MW
67dnl Functions.
68AC_CHECK_FUNCS([snprintf])
69
0ce34834 70dnl Types.
892da3f9
MW
71AC_CHECK_TYPE([socklen_t], [],
72 [AC_DEFINE([socklen_t], [int],
73 [Define to `int' if <sys/socket.h> does not define])],
74 [AC_INCLUDES_DEFAULT
b1a20bee 75@%:@include <sys/socket.h>
892da3f9 76])
0ce34834 77
a0150d8d
MW
78dnl Which version of struct msghdr do we have?
79AC_CHECK_MEMBERS([struct msgdr.msg_control],,, [
b1a20bee
MW
80@%:@include <sys/types.h>
81@%:@include <sys/socket.h>
a0150d8d
MW
82])
83
173ff44a 84dnl Find out whether we're cross-compiling.
51c4088b 85AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
173ff44a 86
b1a20bee
MW
87dnl Floating-point formats.
88mdw_PROBE_FLTFMT
89
5b2eac52
MW
90dnl Set the master library list.
91AC_SUBST([MLIB_LIBS])
92
a0150d8d
MW
93dnl--------------------------------------------------------------------------
94dnl Name resolution.
95
96AC_ARG_WITH([adns],
97 AS_HELP_STRING([--with-adns],
98 [use ADNS library for background name resolution]),
99 [want_adns=$withval],
100 [want_adns=auto])
101
5b2eac52 102mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
a0150d8d
MW
103case $want_adns in
104 no) ;;
105 *) AC_SEARCH_LIBS([adns_init], [adns], [have_adns=yes], [have_adns=no]) ;;
106esac
5b2eac52 107MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
a0150d8d
MW
108case $want_adns,$have_adns in
109 yes,no)
110 AC_MSG_ERROR([ADNS library not found but explicitly requested])
111 ;;
112 yes,yes | auto,yes)
113 use_adns=yes
114 AC_DEFINE([HAVE_ADNS], [1],
115 [define if you have (and want to use) the ADNS library.])
116 ;;
117 no,* | auto,no)
118 use_adns=no
119 mdw_DEFINE_PATHS([
120 AC_DEFINE_UNQUOTED([BRES_SERVER],
121 ["mdw_PATH($libexecdir)/$PACKAGE/mdw_PROG(bres)"],
122 [pathname to the standalone `bres' binary.'])
123 ])
124 ;;
125esac
126AM_CONDITIONAL([WITH_ADNS], [test "$use_adns" = yes])
127
b64eb60f
MW
128dnl--------------------------------------------------------------------------
129dnl Timers.
130
131AC_CHECK_HEADERS([linux/perf_event.h])
132
133mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
134AC_SEARCH_LIBS([clock_gettime], [rt])
135MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
136if test "$ac_cv_search_clock_gettime" != no; then
137 AC_DEFINE([HAVE_CLOCK_GETTIME], [1],
138 [Define if you have the \`clock_gettime' function.])
139fi
140
7cf5c72a
MW
141dnl--------------------------------------------------------------------------
142dnl Python (used for testing).
143
144AM_PATH_PYTHON([2.4],, [:])
145
a0150d8d
MW
146dnl--------------------------------------------------------------------------
147dnl Output.
148
0335afec 149AC_CONFIG_HEADERS([config/config.h])
7cf5c72a 150AC_CONFIG_TESTDIR([t])
a0150d8d
MW
151
152AC_CONFIG_FILES(
18c831dc
MW
153 [Makefile]
154 [buf/Makefile]
155 [codec/Makefile]
156 [hash/Makefile]
157 [mem/Makefile]
158 [sel/Makefile]
159 [struct/Makefile]
160 [sys/Makefile]
161 [test/Makefile]
c4ccbbf9 162 [test/example/Makefile]
18c831dc
MW
163 [trace/Makefile]
164 [ui/Makefile]
7cf5c72a
MW
165 [utils/Makefile]
166 [t/Makefile t/atlocal])
a0150d8d
MW
167AC_OUTPUT
168
51c4088b 169dnl------ That's all, folks -------------------------------------------------