chiark / gitweb /
@@@ fltfmt wip
[mLib] / configure.ac
1 dnl -*-autoconf-*-
2 dnl
3 dnl Configuration script for mLib
4 dnl
5 dnl (c) 2008 Straylight/Edgeware
6 dnl
7
8 dnl----- Licensing notice ---------------------------------------------------
9 dnl
10 dnl This file is part of the mLib utilities library.
11 dnl
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.
16 dnl
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.
21 dnl
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.
26
27 dnl--------------------------------------------------------------------------
28 dnl Initialization.
29
30 mdw_AUTO_VERSION
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])
35 mdw_SILENT_RULES
36
37 AC_PROG_CC
38 AM_PROG_CC_C_O
39 LT_INIT
40 AX_CFLAGS_WARN_ALL
41 mdw_LIBTOOL_VERSION_INFO
42
43 AC_CHECK_PROGS([AUTOM4TE], [autom4te])
44
45 mdw_MANEXT([mLib])
46
47 AC_DEFINE_UNQUOTED([SRCDIR], ["$(cd $srcdir && pwd)"],
48                    [absolute pathname for the source directory.])
49
50 dnl--------------------------------------------------------------------------
51 dnl C programming environment.
52
53 MLIB_LIBS=
54
55 dnl Headers.
56 AC_CHECK_HEADERS([float.h])
57 AC_CHECK_HEADERS([stdint.h])
58 AC_CHECK_HEADERS([valgrind/valgrind.h])
59
60 dnl Libraries.
61 mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
62 AC_SEARCH_LIBS([sqrt], [m])
63 AC_SEARCH_LIBS([socket], [socket])
64 AC_SEARCH_LIBS([gethostbyname], [nsl resolv])
65 MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
66
67 dnl Functions.
68 AC_CHECK_FUNCS([snprintf])
69
70 dnl Types.
71 AC_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
75 @%:@include <sys/socket.h>
76 ])
77
78 dnl Which version of struct msghdr do we have?
79 AC_CHECK_MEMBERS([struct msgdr.msg_control],,, [
80 @%:@include <sys/types.h>
81 @%:@include <sys/socket.h>
82 ])
83
84 dnl Find out whether we're cross-compiling.
85 AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
86
87 dnl Floating-point formats.
88 mdw_PROBE_FLTFMT
89
90 dnl Set the master library list.
91 AC_SUBST([MLIB_LIBS])
92
93 dnl--------------------------------------------------------------------------
94 dnl Name resolution.
95
96 AC_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
102 mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
103 case $want_adns in
104   no) ;;
105   *) AC_SEARCH_LIBS([adns_init], [adns], [have_adns=yes], [have_adns=no]) ;;
106 esac
107 MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
108 case $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     ;;
125 esac
126 AM_CONDITIONAL([WITH_ADNS], [test "$use_adns" = yes])
127
128 dnl--------------------------------------------------------------------------
129 dnl Timers.
130
131 AC_CHECK_HEADERS([linux/perf_event.h])
132
133 mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
134 AC_SEARCH_LIBS([clock_gettime], [rt])
135 MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
136 if test "$ac_cv_search_clock_gettime" != no; then
137   AC_DEFINE([HAVE_CLOCK_GETTIME], [1],
138             [Define if you have the \`clock_gettime' function.])
139 fi
140
141 dnl--------------------------------------------------------------------------
142 dnl Python (used for testing).
143
144 AM_PATH_PYTHON([2.4],, [:])
145
146 dnl--------------------------------------------------------------------------
147 dnl Output.
148
149 AC_CONFIG_HEADERS([config/config.h])
150 AC_CONFIG_TESTDIR([t])
151
152 AC_CONFIG_FILES(
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]
162   [test/example/Makefile]
163   [trace/Makefile]
164   [ui/Makefile]
165   [utils/Makefile]
166   [t/Makefile t/atlocal])
167 AC_OUTPUT
168
169 dnl------ That's all, folks -------------------------------------------------