Debian Codegraph @

debian/external_deps/fetk/maloc/tools/configure.ac

raw
1 dnl ##########################################################################
2 dnl MALOC = < Minimal Abstraction Layer for Object-oriented C >
3 dnl Copyright (C) 1994-- Michael Holst
4 dnl
5 dnl This program is free software; you can redistribute it and/or modify it
6 dnl under the terms of the GNU General Public License as published by the
7 dnl Free Software Foundation; either version 2 of the License, or (at your
8 dnl option) any later version.
9 dnl
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 dnl See the GNU General Public License for more details.
14 dnl
15 dnl You should have received a copy of the GNU General Public License along
16 dnl with this program; if not, write to the Free Software Foundation, Inc.,
17 dnl 675 Mass Ave, Cambridge, MA 02139, USA.
18 dnl
19 dnl rcsid="INTENTIONALLY LEFT BLANK"
20 dnl ##########################################################################
21
22 dnl ##########################################################################
23 dnl File: configure.ac
24 dnl
25 dnl Purpose: configure.ac script for a typical MALOC application.
26 dnl
27 dnl Author: Michael Holst
28 dnl ##########################################################################
29
30 dnl 0. autoconf initialization
31 AC_INIT(malocapp, 1.0, [email protected])
32 AC_CONFIG_SRCDIR(main.c)
33 AC_CONFIG_AUX_DIR(config)
34 AC_PREFIX_DEFAULT(${HOME})
35 AC_CANONICAL_BUILD
36 AC_CANONICAL_HOST
37 AC_CANONICAL_TARGET
38
39 dnl 1. automake initialization (uncomment only if rebuilding Makefile.in's)
40 AM_INIT_AUTOMAKE([foreign])
41 FETK_VERSION="1:0:0"
42 AC_SUBST(FETK_VERSION)
43 AM_MAINTAINER_MODE
44
45 dnl 2. checks for programs
46 AC_LANG_C
47 AC_PROG_CC
48 AC_PROG_CPP
49
50 dnl 3. checks for libraries
51 AC_CHECK_LIB(m,pow,[math_lib="-lm"],[math_lib=""])
52 AC_SUBST(math_lib)
53 AC_CHECK_LIB(iberty,strerrno,[liberty_lib="-liberty"],[liberty_lib=""])
54 AC_SUBST(liberty_lib)
55 nsl_lib="";
56 AC_CHECK_FUNC(gethostbyname,[try_nsl=""],[try_nsl="yes"])
57 if test -n "${try_nsl}"; then
58 AC_CHECK_LIB(nsl,gethostbyname,[nsl_lib="-lnsl"],[nsl_lib=""])
59 fi
60 AC_SUBST(nsl_lib)
61 socket_lib="";
62 AC_CHECK_FUNC(connect,[try_socket=""],[try_socket="yes"])
63 if test -n "${try_socket}"; then
64 AC_CHECK_LIB(socket,connect,[socket_lib="-lsocket"],[socket_lib=""])
65 fi
66 AC_SUBST(socket_lib)
67 thread_lib="";
68 AC_CHECK_FUNC(thr_create,[try_thread=""],[try_thread="yes"])
69 if test -n "${try_thread}"; then
70 AC_CHECK_LIB(thread,thr_create,[thread_lib="-lthread"],[thread_lib=""])
71 fi
72 AC_SUBST(thread_lib)
73
74 dnl 4. checks for header files
75 dnl 5. checks for typedefs
76 dnl 6. checks for structures
77 dnl 7. checks for compiler characteristics
78 dnl 8. checks for library functions
79 dnl 9. checks for system services
80 dnl 10. checks for anything else
81
82 dnl # ------------------------------------------------
83 dnl # CHECK WHETHER TO DISABLE CPU-VENDOR-HOST TRIPLET
84 dnl # ------------------------------------------------
85 fetk_cpu_vendor_os="";
86 AC_MSG_CHECKING([whether you want to disable the CPU-VENDOR-OS install triplet])
87 AC_ARG_ENABLE(triplet,
88 [ --disable-triplet disable CPU-VENDOR-OS install triplet [[default=no]]],
89 [ triplet_kill="yes"],
90 [ triplet_kill="" ]
91 )
92 if test "${triplet_kill}" = yes; then
93 AC_MSG_RESULT([yes])
94 fetk_cpu_vendor_os="";
95 else
96 AC_MSG_RESULT([no])
97 fetk_cpu_vendor_os="${host_cpu}-${host_vendor}-${host_os}";
98 fi
99 AC_SUBST(fetk_cpu_vendor_os)
100
101 dnl # ---------------------------
102 dnl # HANDLE THE READLINE LIBRARY
103 dnl # ---------------------------
104 rl_lib="";
105 AC_MSG_CHECKING([whether your environment defines FETK_RL_LIBRARY])
106 if test -n "${FETK_RL_LIBRARY}"; then
107 AC_MSG_RESULT([yes])
108 rl_lib_path="-L${FETK_RL_LIBRARY} ";
109 else
110 AC_MSG_RESULT([no])
111 rl_lib_path="";
112 fi
113 LDFLAGS_SAVE=${LDFLAGS};
114 LDFLAGS=${rl_lib_path};
115 AC_CHECK_LIB(ncurses,tgetnum,
116 [ncurses_lib="-lncurses"],
117 [ncurses_lib=""],
118 [${math_lib}])
119 AC_CHECK_LIB(readline,readline,
120 [rl_use="yes";rl_lib="${rl_lib_path}-lreadline ${ncurses_lib}"],
121 [rl_use="";rl_lib=""],
122 [${rl_lib_path} ${ncurses_lib} ${math_lib}])
123 if test -n "${rl_use}"; then
124 AC_CHECK_LIB(readline,add_history,
125 [rl_use="yes";rl_lib="${rl_lib_path}-lreadline ${ncurses_lib}"],
126 [rl_use="";rl_lib=""],
127 [${rl_lib_path} ${ncurses_lib} ${math_lib}])
128 fi
129 LDFLAGS=${LDFLAGS_SAVE};
130 AC_SUBST(rl_lib)
131
132 dnl # ----------------------
133 dnl # HANDLE THE MPI LIBRARY
134 dnl # ----------------------
135 mpi_lib="";
136 AC_MSG_CHECKING([whether your environment defines FETK_MPI_LIBRARY])
137 if test -n "${FETK_MPI_LIBRARY}"; then
138 AC_MSG_RESULT([yes])
139 mpi_lib_path="-L${FETK_MPI_LIBRARY} ";
140 else
141 AC_MSG_RESULT([no])
142 mpi_lib_path="";
143 fi
144 LDFLAGS_SAVE=${LDFLAGS};
145 LDFLAGS=${mpi_lib_path};
146 mpi_use="";
147 AC_CHECK_LIB(mpi,main,
148 [mpi_use="yes";mpi_lib="${mpi_lib_path}-lmpi"],
149 [mpi_use="";mpi_lib=""],${mpi_lib_path})
150 if test -z "${mpi_use}"; then
151 AC_CHECK_LIB(mpich,main,
152 [mpi_use="yes";mpi_lib="${mpi_lib_path}-lmpich"],
153 [mpi_use="";mpi_lib=""],${mpi_lib_path})
154 fi
155 LDFLAGS=${LDFLAGS_SAVE};
156 AC_SUBST(mpi_lib)
157
158 AC_MSG_RESULT([----------- begin processing APP configure options ---------])
159
160 dnl # --------------------------------
161 dnl # HANDLE ANSI/PEDANTIC COMPILATION
162 dnl # --------------------------------
163 AC_MSG_CHECKING([whether you want pedantic ANSI compilation])
164 AC_ARG_ENABLE(pansi,
165 [ --enable-pansi enable pedantic ANSI compilation],
166 [ pansi_use="yes" ],
167 [ pansi_use="" ]
168 )
169 if test -z "${pansi_use}"; then
170 AC_MSG_RESULT([no])
171 wall=""
172 wall_pedantic=""
173 wall_pedantic_ansi=""
174 pedantic_ansi=""
175 else
176 AC_MSG_RESULT([yes])
177 wall="-Wall"
178 wall_pedantic="-Wall -pedantic"
179 wall_pedantic_ansi="-Wall -pedantic -ansi"
180 pedantic_ansi="-pedantic -ansi"
181 fi
182 AC_SUBST(wall)
183 AC_SUBST(wall_pedantic)
184 AC_SUBST(wall_pedantic_ansi)
185 AC_SUBST(pedantic_ansi)
186
187 dnl # ----------------
188 dnl # HANDLE PROFILING
189 dnl # ----------------
190 AC_MSG_CHECKING([whether you want profiling])
191 AC_ARG_ENABLE(gprof,
192 [ --enable-gprof enable gprof profiling [default=no]],
193 [ gprof_use="yes" ],
194 [ gprof_use="" ]
195 )
196 if test -z "${gprof_use}"; then
197 AC_MSG_RESULT([no])
198 profile=""
199 profile_lib=""
200 else
201 AC_MSG_RESULT([yes])
202 profile="-pg"
203 profile_lib="-pg"
204 fi
205 AC_SUBST(profile)
206 AC_SUBST(profile_lib)
207
208 dnl # ---------------------------------
209 dnl # HANDLE THE ELECTRIC FENCE LIBRARY
210 dnl # ---------------------------------
211 AC_MSG_CHECKING([whether you want ElectricFence])
212 AC_ARG_ENABLE(efence,
213 [ --enable-efence enable ElectricFence malloc lib [default=no]],
214 [ efence_use="yes" ],
215 [ efence_use="" ]
216 )
217 if test -z "${efence_use}"; then
218 AC_MSG_RESULT([no])
219 zfence="";
220 zfence_lib="";
221 else
222 AC_MSG_RESULT([yes ...poking around for it])
223 AC_CHECK_LIB(efence,main,
224 [efence_use="yes";zfence="zfence";zfence_lib="-lefence"],
225 [efence_use="";zfence="";zfence_lib=""])
226 fi
227 AC_SUBST(zfence)
228 AC_SUBST(zfence_lib)
229
230 dnl # -----------------------------
231 dnl # HANDLE BUILDING LIBRARY TESTS
232 dnl # -----------------------------
233 AC_MSG_CHECKING([whether you want to build library test programs])
234 AC_ARG_ENABLE(vtst,
235 [ --enable-vtst enable building of library tests [default=no]],
236 [ vtst="tests";AC_MSG_RESULT([yes]) ],
237 [ vtst="";AC_MSG_RESULT([no]) ]
238 )
239 AC_SUBST(vtst)
240
241 AC_MSG_RESULT([------------ end processing APP configure options ----------])
242
243 AC_MSG_RESULT([---------- begin configuring for MALOC linkage ------------])
244
245 dnl # ------------------------
246 dnl # HANDLE THE MALOC LIBRARY
247 dnl # ------------------------
248
249 dnl # MALOC header location ENV specification
250 AC_MSG_CHECKING([whether your environment defines FETK_INCLUDE])
251 if test -n "${FETK_INCLUDE}"; then
252 AC_MSG_RESULT([yes])
253 maloc_inc_path="-I${FETK_INCLUDE} ";
254 else
255 AC_MSG_RESULT([no])
256 maloc_inc_path="";
257 fi
258
259 dnl # MALOC library location ENV specification
260 AC_MSG_CHECKING([whether your environment defines FETK_LIBRARY])
261 if test -n "${FETK_LIBRARY}"; then
262 AC_MSG_RESULT([yes])
263 maloc_lib_path="-L${FETK_LIBRARY} ";
264 else
265 AC_MSG_RESULT([no])
266 maloc_lib_path="";
267 fi
268
269 dnl # Setup temp LDFLAGS and look for MALOC library/header
270 LDFLAGS_SAVE=${LDFLAGS};
271 CPPFLAGS_SAVE=${CPPFLAGS};
272 LDFLAGS=${maloc_lib_path};
273 CPPFLAGS=${maloc_inc_path};
274 maloc_found="";
275 AC_CHECK_HEADER(maloc/maloc.h,
276 [maloc_found="yes";maloc_inc="${maloc_inc_path}"],
277 [maloc_found="";maloc_inc=""])
278 if test -n "${maloc_found}"; then
279 AC_CHECK_LIB(maloc,maloc_link,
280 [maloc_found="yes";maloc_lib="${maloc_lib_path}-lmaloc"],
281 [maloc_found="";maloc_lib=""],
282 [${maloc_lib_path}-lmaloc ${rl_lib} ${liberty_lib} ${socket_lib} ${nsl_lib} ${thread_lib} ${math_lib} ${zfence_lib} ${profile_lib}])
283 fi
284 if test -z "${maloc_found}"; then
285 AC_MSG_ERROR([MALOC libraries OR headers missing ...EXITING ON ERROR])
286 else
287 AC_MSG_RESULT([MALOC libraries AND headers were found ...rocking on...])
288 fi
289
290 dnl # Return LDFLAGS and CPPFLAGS to normal
291 LDFLAGS=${LDFLAGS_SAVE};
292 CPPFLAGS=${CPPFLAGS_SAVE};
293 AC_SUBST(maloc_lib)
294 AC_SUBST(maloc_inc)
295
296 dnl # Check whether MALOC actually needs the READLINE library
297 AC_CHECK_LIB(maloc,maloc_needs_rl,
298 [rl_use="yes"],
299 [rl_use=""],
300 [${maloc_lib} ${rl_lib} ${liberty_lib} ${socket_lib} ${nsl_lib} ${thread_lib} ${math_lib} ${zfence_lib} ${profile_lib}])
301
302 dnl # Check whether MALOC actually needs the MPI library
303 AC_CHECK_LIB(maloc,maloc_needs_mpi,
304 [mpi_use="yes"],
305 [mpi_use=""],
306 [${maloc_lib} ${mpi_lib} ${rl_lib} ${liberty_lib} ${socket_lib} ${nsl_lib} ${thread_lib} ${math_lib} ${zfence_lib} ${profile_lib}])
307
308 AC_MSG_RESULT([---------- end configuring for MALOC linkage --------------])
309
310 dnl 11. generate the makefiles
311 AC_OUTPUT([
312 Makefile
313 tests/Makefile
314 tests/zfence/Makefile
315 tests/aloc/Makefile
316 tests/vsh/Makefile
317 tests/psh/Makefile
318 ])
319