Commit | Line | Data |
---|---|---|
a0150d8d MW |
1 | dnl -*-autoconf-*- |
2 | dnl | |
3 | dnl Configuration script for mLib | |
4 | dnl | |
5 | dnl (c) 2008 Straylight/Edgeware | |
6 | dnl | |
7 | ||
51c4088b | 8 | dnl----- Licensing notice --------------------------------------------------- |
a0150d8d MW |
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 | |
b3a0ac5e | 31 | AC_INIT([mLib], AUTO_VERSION, [mdw@distorted.org.uk], [mLib]) |
a0150d8d MW |
32 | AC_CONFIG_SRCDIR([mLib.pc.in]) |
33 | AC_CONFIG_AUX_DIR([config]) | |
b012588c | 34 | AM_INIT_AUTOMAKE([foreign subdir-objects]) |
3ac6fc5f | 35 | mdw_SILENT_RULES |
a0150d8d MW |
36 | |
37 | AC_PROG_CC | |
38 | AM_PROG_CC_C_O | |
39 | AM_PROG_LIBTOOL | |
40 | AX_CFLAGS_WARN_ALL | |
41 | mdw_LIBTOOL_VERSION_INFO | |
42 | ||
7cf5c72a MW |
43 | AC_CHECK_PROGS([AUTOM4TE], [autom4te]) |
44 | ||
6b210fdf | 45 | mdw_MANEXT([mLib]) |
a0150d8d MW |
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 | ||
5b2eac52 MW |
53 | MLIB_LIBS= |
54 | ||
a0150d8d MW |
55 | dnl Headers. |
56 | AC_CHECK_HEADERS([float.h]) | |
5007fea9 | 57 | AC_CHECK_HEADERS([stdint.h]) |
a0150d8d MW |
58 | |
59 | dnl Libraries. | |
5b2eac52 | 60 | mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS |
b64eb60f | 61 | AC_SEARCH_LIBS([sqrt], [m]) |
a0150d8d MW |
62 | AC_SEARCH_LIBS([socket], [socket]) |
63 | AC_SEARCH_LIBS([gethostbyname], [nsl resolv]) | |
5b2eac52 | 64 | MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS |
a0150d8d | 65 | |
eff136f6 MW |
66 | dnl Functions. |
67 | AC_CHECK_FUNCS([snprintf]) | |
68 | ||
0ce34834 | 69 | dnl Types. |
892da3f9 MW |
70 | AC_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 |
77 | dnl Which version of struct msghdr do we have? |
78 | AC_CHECK_MEMBERS([struct msgdr.msg_control],,, [ | |
79 | #include <sys/types.h> | |
80 | #include <sys/socket.h> | |
81 | ]) | |
82 | ||
173ff44a | 83 | dnl Find out whether we're cross-compiling. |
51c4088b | 84 | AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes]) |
173ff44a | 85 | |
5b2eac52 MW |
86 | dnl Set the master library list. |
87 | AC_SUBST([MLIB_LIBS]) | |
88 | ||
a0150d8d MW |
89 | dnl-------------------------------------------------------------------------- |
90 | dnl Name resolution. | |
91 | ||
92 | AC_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 | 98 | mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS |
a0150d8d MW |
99 | case $want_adns in |
100 | no) ;; | |
101 | *) AC_SEARCH_LIBS([adns_init], [adns], [have_adns=yes], [have_adns=no]) ;; | |
102 | esac | |
5b2eac52 | 103 | MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS |
a0150d8d MW |
104 | case $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 | ;; | |
121 | esac | |
122 | AM_CONDITIONAL([WITH_ADNS], [test "$use_adns" = yes]) | |
123 | ||
b64eb60f MW |
124 | dnl-------------------------------------------------------------------------- |
125 | dnl Timers. | |
126 | ||
127 | AC_CHECK_HEADERS([linux/perf_event.h]) | |
128 | ||
129 | mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS | |
130 | AC_SEARCH_LIBS([clock_gettime], [rt]) | |
131 | MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS | |
132 | if test "$ac_cv_search_clock_gettime" != no; then | |
133 | AC_DEFINE([HAVE_CLOCK_GETTIME], [1], | |
134 | [Define if you have the \`clock_gettime' function.]) | |
135 | fi | |
136 | ||
7cf5c72a MW |
137 | dnl-------------------------------------------------------------------------- |
138 | dnl Python (used for testing). | |
139 | ||
140 | AM_PATH_PYTHON([2.4],, [:]) | |
141 | ||
a0150d8d MW |
142 | dnl-------------------------------------------------------------------------- |
143 | dnl Output. | |
144 | ||
145 | AC_CONFIG_HEADER([config/config.h]) | |
7cf5c72a | 146 | AC_CONFIG_TESTDIR([t]) |
a0150d8d MW |
147 | |
148 | AC_CONFIG_FILES( | |
18c831dc MW |
149 | [Makefile] |
150 | [buf/Makefile] | |
151 | [codec/Makefile] | |
152 | [hash/Makefile] | |
153 | [mem/Makefile] | |
154 | [sel/Makefile] | |
155 | [struct/Makefile] | |
156 | [sys/Makefile] | |
157 | [test/Makefile] | |
158 | [trace/Makefile] | |
159 | [ui/Makefile] | |
7cf5c72a MW |
160 | [utils/Makefile] |
161 | [t/Makefile t/atlocal]) | |
a0150d8d MW |
162 | AC_OUTPUT |
163 | ||
51c4088b | 164 | dnl------ That's all, folks ------------------------------------------------- |