chiark / gitweb /
@@@ m4
[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])
1dbc6a5a 34AC_CONFIG_MACRO_DIRS([m4])
b012588c 35AM_INIT_AUTOMAKE([foreign subdir-objects])
3ac6fc5f 36mdw_SILENT_RULES
a0150d8d
MW
37
38AC_PROG_CC
39AM_PROG_CC_C_O
40AM_PROG_LIBTOOL
41AX_CFLAGS_WARN_ALL
42mdw_LIBTOOL_VERSION_INFO
43
7cf5c72a
MW
44AC_CHECK_PROGS([AUTOM4TE], [autom4te])
45
6b210fdf 46mdw_MANEXT([mLib])
a0150d8d
MW
47
48AC_DEFINE_UNQUOTED([SRCDIR], ["$(cd $srcdir && pwd)"],
49 [absolute pathname for the source directory.])
50
51dnl--------------------------------------------------------------------------
52dnl C programming environment.
53
5b2eac52
MW
54MLIB_LIBS=
55
a0150d8d
MW
56dnl Headers.
57AC_CHECK_HEADERS([float.h])
5007fea9 58AC_CHECK_HEADERS([stdint.h])
a0150d8d
MW
59
60dnl Libraries.
5b2eac52 61mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
a0150d8d
MW
62AC_SEARCH_LIBS([socket], [socket])
63AC_SEARCH_LIBS([gethostbyname], [nsl resolv])
5b2eac52 64MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
a0150d8d 65
eff136f6
MW
66dnl Functions.
67AC_CHECK_FUNCS([snprintf])
68
0ce34834 69dnl Types.
892da3f9
MW
70AC_CHECK_TYPE([socklen_t], [],
71 [AC_DEFINE([socklen_t], [int],
72 [Define to `int' if <sys/socket.h> does not define])],
73 [AC_INCLUDES_DEFAULT
74#include <sys/socket.h>
75])
0ce34834 76
a0150d8d
MW
77dnl Which version of struct msghdr do we have?
78AC_CHECK_MEMBERS([struct msgdr.msg_control],,, [
79#include <sys/types.h>
80#include <sys/socket.h>
81])
82
173ff44a 83dnl Find out whether we're cross-compiling.
51c4088b 84AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
173ff44a 85
5b2eac52
MW
86dnl Set the master library list.
87AC_SUBST([MLIB_LIBS])
88
a0150d8d
MW
89dnl--------------------------------------------------------------------------
90dnl Name resolution.
91
92AC_ARG_WITH([adns],
93 AS_HELP_STRING([--with-adns],
94 [use ADNS library for background name resolution]),
95 [want_adns=$withval],
96 [want_adns=auto])
97
5b2eac52 98mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
a0150d8d
MW
99case $want_adns in
100 no) ;;
101 *) AC_SEARCH_LIBS([adns_init], [adns], [have_adns=yes], [have_adns=no]) ;;
102esac
5b2eac52 103MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
a0150d8d
MW
104case $want_adns,$have_adns in
105 yes,no)
106 AC_MSG_ERROR([ADNS library not found but explicitly requested])
107 ;;
108 yes,yes | auto,yes)
109 use_adns=yes
110 AC_DEFINE([HAVE_ADNS], [1],
111 [define if you have (and want to use) the ADNS library.])
112 ;;
113 no,* | auto,no)
114 use_adns=no
115 mdw_DEFINE_PATHS([
116 AC_DEFINE_UNQUOTED([BRES_SERVER],
117 ["mdw_PATH($libexecdir)/$PACKAGE/mdw_PROG(bres)"],
118 [pathname to the standalone `bres' binary.'])
119 ])
120 ;;
121esac
122AM_CONDITIONAL([WITH_ADNS], [test "$use_adns" = yes])
123
7cf5c72a
MW
124dnl--------------------------------------------------------------------------
125dnl Python (used for testing).
126
127AM_PATH_PYTHON([2.4],, [:])
128
a0150d8d
MW
129dnl--------------------------------------------------------------------------
130dnl Output.
131
132AC_CONFIG_HEADER([config/config.h])
7cf5c72a 133AC_CONFIG_TESTDIR([t])
a0150d8d
MW
134
135AC_CONFIG_FILES(
18c831dc
MW
136 [Makefile]
137 [buf/Makefile]
138 [codec/Makefile]
139 [hash/Makefile]
140 [mem/Makefile]
141 [sel/Makefile]
142 [struct/Makefile]
143 [sys/Makefile]
144 [test/Makefile]
145 [trace/Makefile]
146 [ui/Makefile]
7cf5c72a
MW
147 [utils/Makefile]
148 [t/Makefile t/atlocal])
a0150d8d
MW
149AC_OUTPUT
150
51c4088b 151dnl------ That's all, folks -------------------------------------------------