Debian Codegraph @

debian/external_deps/fetk/gamer/configure.ac

raw
1 dnl ##########################################################################
2 dnl File: configure.ac
3 dnl
4 dnl Purpose: configure.ac script for GAMER
5 dnl (Geometry-preserving Adaptive MeshER).
6 dnl
7 dnl Author: Michael Holst
8 dnl ##########################################################################
9
10 dnl 0. autoconf initialization
11 AC_INIT(gamer, 1.0, [email protected])
12 AC_CONFIG_SRCDIR(src/aaa_inc/gamer/gamer.h)
13 AC_CONFIG_HEADERS(src/aaa_inc/gamercf.h)
14 AC_CONFIG_AUX_DIR(config)
15 AC_PREFIX_DEFAULT(${HOME})
16 AC_CANONICAL_BUILD
17 AC_CANONICAL_HOST
18 AC_CANONICAL_TARGET
19
20 dnl 1. automake initialization
21 AM_INIT_AUTOMAKE([foreign])
22 FETK_VERSION="1:0:0"
23 AC_SUBST(FETK_VERSION)
24 AM_MAINTAINER_MODE
25
26 dnl 2. checks for programs
27 AC_LANG_C
28 AC_PROG_CC
29 AC_PROG_CPP
30 AC_PROG_CXX
31 AC_DISABLE_STATIC
32 AM_PROG_LIBTOOL
33
34 dnl 3. checks for libraries
35 AC_CHECK_LIB(m,pow,[math_lib="-lm"],[math_lib=""])
36 AC_SUBST(math_lib)
37 AC_CHECK_LIB(iberty,strerrno,[liberty_lib="-liberty"],[liberty_lib=""])
38 AC_SUBST(liberty_lib)
39 nsl_lib="";
40 AC_CHECK_FUNC(gethostbyname,[try_nsl=""],[try_nsl="yes"])
41 if test -n "${try_nsl}"; then
42 AC_CHECK_LIB(nsl,gethostbyname,[nsl_lib="-lnsl"],[nsl_lib=""])
43 fi
44 AC_SUBST(nsl_lib)
45 socket_lib="";
46 AC_CHECK_FUNC(connect,[try_socket=""],[try_socket="yes"])
47 if test -n "${try_socket}"; then
48 AC_CHECK_LIB(socket,connect,[socket_lib="-lsocket"],[socket_lib=""])
49 fi
50 AC_SUBST(socket_lib)
51 thread_lib="";
52 AC_CHECK_FUNC(thr_create,[try_thread=""],[try_thread="yes"])
53 if test -n "${try_thread}"; then
54 AC_CHECK_LIB(thread,thr_create,[thread_lib="-lthread"],[thread_lib=""])
55 fi
56 AC_SUBST(thread_lib)
57
58 dnl 4. checks for header files
59 dnl 5. checks for typedefs
60 dnl 6. checks for structures
61 dnl 7. checks for compiler characteristics
62 dnl 8. checks for library functions
63 dnl 9. checks for system services
64 dnl 10. checks for anything else
65
66 dnl # ------------------------------------------------
67 dnl # CHECK WHETHER TO DISABLE CPU-VENDOR-HOST TRIPLET
68 dnl # ------------------------------------------------
69 fetk_cpu_vendor_os="";
70 AC_MSG_CHECKING([whether you want to disable the CPU-VENDOR-OS install triplet])
71 AC_ARG_ENABLE(triplet,
72 [ --disable-triplet disable CPU-VENDOR-OS install triplet [[default=no]]],
73 [ triplet_kill="yes"],
74 [ triplet_kill="" ]
75 )
76 if test "${triplet_kill}" = yes; then
77 AC_MSG_RESULT([yes])
78 fetk_cpu_vendor_os="";
79 else
80 AC_MSG_RESULT([no])
81 fetk_cpu_vendor_os="${host_cpu}-${host_vendor}-${host_os}";
82 fi
83 AC_SUBST(fetk_cpu_vendor_os)
84
85 dnl # ---------------------------------------------------
86 dnl # HANDLE VARIOUS ARCHITECTURE-SPECIFIC CONFIGURATIONS
87 dnl # ---------------------------------------------------
88 if test "${host_os}" = "cygwin"; then
89 AC_DEFINE(HAVE_CYGWIN)
90 fi
91
92 dnl # ---------------------------
93 dnl # HANDLE THE READLINE LIBRARY
94 dnl # ---------------------------
95 rl_lib="";
96 AC_MSG_CHECKING([whether your environment defines FETK_RL_LIBRARY])
97 if test -n "${FETK_RL_LIBRARY}"; then
98 AC_MSG_RESULT([yes])
99 rl_lib_path="-L${FETK_RL_LIBRARY} ";
100 else
101 AC_MSG_RESULT([no])
102 rl_lib_path="";
103 fi
104 LDFLAGS_SAVE=${LDFLAGS};
105 LDFLAGS=${rl_lib_path};
106 AC_CHECK_LIB(ncurses,tgetnum,
107 [ncurses_lib="-lncurses"],
108 [ncurses_lib=""],
109 [${math_lib}])
110 AC_CHECK_LIB(readline,readline,
111 [rl_use="yes";rl_lib="${rl_lib_path}-lreadline ${ncurses_lib}"],
112 [rl_use="";rl_lib=""],
113 [${rl_lib_path} ${ncurses_lib} ${math_lib}])
114 if test -n "${rl_use}"; then
115 AC_CHECK_LIB(readline,add_history,
116 [rl_use="yes";rl_lib="${rl_lib_path}-lreadline ${ncurses_lib}"],
117 [rl_use="";rl_lib=""],
118 [${rl_lib_path} ${ncurses_lib} ${math_lib}])
119 fi
120 LDFLAGS=${LDFLAGS_SAVE};
121 AC_SUBST(rl_lib)
122
123 dnl # ----------------------
124 dnl # HANDLE THE MPI LIBRARY
125 dnl # ----------------------
126 mpi_lib="";
127 AC_MSG_CHECKING([whether your environment defines FETK_MPI_LIBRARY])
128 if test -n "${FETK_MPI_LIBRARY}"; then
129 AC_MSG_RESULT([yes])
130 mpi_lib_path="-L${FETK_MPI_LIBRARY} ";
131 else
132 AC_MSG_RESULT([no])
133 mpi_lib_path="";
134 fi
135 LDFLAGS_SAVE=${LDFLAGS};
136 LDFLAGS=${mpi_lib_path};
137 mpi_use="";
138 AC_CHECK_LIB(mpi,main,
139 [mpi_use="yes";mpi_lib="${mpi_lib_path}-lmpi"],
140 [mpi_use="";mpi_lib=""],${mpi_lib_path})
141 if test -z "${mpi_use}"; then
142 AC_CHECK_LIB(mpich,main,
143 [mpi_use="yes";mpi_lib="${mpi_lib_path}-lmpich"],
144 [mpi_use="";mpi_lib=""],${mpi_lib_path})
145 fi
146 LDFLAGS=${LDFLAGS_SAVE};
147 AC_SUBST(mpi_lib)
148
149 dnl # -----------------------
150 dnl # HANDLE SYMBOL EMBEDDING
151 dnl # -----------------------
152 AC_MSG_CHECKING([whether EMBED macro can be used without compilation errors])
153 AC_TRY_COMPILE(,
154 [#define EMBED(rctag) \
155 static const char* rctag; \
156 static void* use_rcsid=(0 ? &use_rcsid : (void*)&rcsid);
157 EMBED(rcsid)],
158 [embed_ok=yes;AC_DEFINE(HAVE_EMBED)],[embed_ok=no])
159 AC_MSG_RESULT(${embed_ok})
160
161 AC_MSG_RESULT([----------- begin processing GAMER configure options ---------])
162
163 dnl # ------------------------
164 dnl # HANDLE DEBUG COMPILATION
165 dnl # ------------------------
166 AC_MSG_CHECKING([whether you want debug compilation])
167 AC_ARG_ENABLE(vdebug,
168 [ --enable-vdebug enable debug compilation [default=no]],
169 [ vdebug_use="yes" ],
170 [ vdebug_use="" ]
171 )
172 if test -z "${vdebug_use}"; then
173 AC_MSG_RESULT([no])
174 else
175 AC_MSG_RESULT([yes])
176 AC_DEFINE(HAVE_DEBUG)
177 fi
178
179 dnl # --------------------------------
180 dnl # HANDLE ANSI/PEDANTIC COMPILATION
181 dnl # --------------------------------
182 AC_MSG_CHECKING([whether you want pedantic ANSI compilation])
183 AC_ARG_ENABLE(pansi,
184 [ --enable-pansi enable pedantic ANSI compilation],
185 [ pansi_use="yes" ],
186 [ pansi_use="" ]
187 )
188 if test -z "${pansi_use}"; then
189 AC_MSG_RESULT([no])
190 wall=""
191 wall_pedantic=""
192 wall_pedantic_ansi=""
193 pedantic_ansi=""
194 else
195 AC_MSG_RESULT([yes])
196 wall="-Wall"
197 wall_pedantic="-Wall -pedantic"
198 wall_pedantic_ansi="-Wall -pedantic -ansi"
199 pedantic_ansi="-pedantic -ansi"
200 fi
201 AC_SUBST(wall)
202 AC_SUBST(wall_pedantic)
203 AC_SUBST(wall_pedantic_ansi)
204 AC_SUBST(pedantic_ansi)
205
206 dnl # ----------------
207 dnl # HANDLE PROFILING
208 dnl # ----------------
209 AC_MSG_CHECKING([whether you want profiling])
210 AC_ARG_ENABLE(gprof,
211 [ --enable-gprof enable gprof profiling [default=no]],
212 [ gprof_use="yes" ],
213 [ gprof_use="" ]
214 )
215 if test -z "${gprof_use}"; then
216 AC_MSG_RESULT([no])
217 profile=""
218 profile_lib=""
219 else
220 AC_MSG_RESULT([yes])
221 profile="-pg"
222 profile_lib="-pg"
223 fi
224 AC_SUBST(profile)
225 AC_SUBST(profile_lib)
226
227 dnl # ---------------------------------
228 dnl # HANDLE THE ELECTRIC FENCE LIBRARY
229 dnl # ---------------------------------
230 AC_MSG_CHECKING([whether you want ElectricFence])
231 AC_ARG_ENABLE(efence,
232 [ --enable-efence enable ElectricFence malloc lib [default=no]],
233 [ efence_use="yes" ],
234 [ efence_use="" ]
235 )
236 if test -z "${efence_use}"; then
237 AC_MSG_RESULT([no])
238 zfence="";
239 zfence_lib="";
240 else
241 AC_MSG_RESULT([yes ...poking around for it])
242 AC_CHECK_LIB(efence,main,
243 [efence_use="yes";zfence="zfence";zfence_lib="-lefence"],
244 [efence_use="";zfence="";zfence_lib=""])
245 fi
246 AC_SUBST(zfence)
247 AC_SUBST(zfence_lib)
248
249 AC_MSG_RESULT([------------ end processing GAMER configure options ----------])
250
251 AC_MSG_RESULT([---------- begin configuring for MALOC linkage ------------])
252
253 dnl # ------------------------
254 dnl # HANDLE THE MALOC LIBRARY
255 dnl # ------------------------
256
257 dnl # MALOC header location ENV specification
258 AC_MSG_CHECKING([whether your environment defines FETK_INCLUDE])
259 if test -n "${FETK_INCLUDE}"; then
260 AC_MSG_RESULT([yes])
261 maloc_inc_path="-I${FETK_INCLUDE} ";
262 else
263 AC_MSG_RESULT([no])
264 maloc_inc_path="";
265 fi
266
267 dnl # MALOC library location ENV specification
268 AC_MSG_CHECKING([whether your environment defines FETK_LIBRARY])
269 if test -n "${FETK_LIBRARY}"; then
270 AC_MSG_RESULT([yes])
271 maloc_lib_path="-L${FETK_LIBRARY} ";
272 else
273 AC_MSG_RESULT([no])
274 maloc_lib_path="";
275 fi
276
277 dnl # Setup temp LDFLAGS and look for MALOC library/header
278 LDFLAGS_SAVE=${LDFLAGS};
279 CPPFLAGS_SAVE=${CPPFLAGS};
280 LDFLAGS=${maloc_lib_path};
281 CPPFLAGS=${maloc_inc_path};
282 maloc_found="";
283 AC_CHECK_HEADER(maloc/maloc.h,
284 [maloc_found="yes";maloc_inc="${maloc_inc_path}"],
285 [maloc_found="";maloc_inc=""])
286 if test -n "${maloc_found}"; then
287 AC_CHECK_LIB(maloc,maloc_link,
288 [maloc_found="yes";maloc_lib="${maloc_lib_path}-lmaloc"],
289 [maloc_found="";maloc_lib=""],
290 [${maloc_lib_path}-lmaloc ${rl_lib} ${liberty_lib} ${socket_lib} ${nsl_lib} ${thread_lib} ${math_lib} ${zfence_lib} ${profile_lib} ${mpi_lib}])
291 fi
292 if test -z "${maloc_found}"; then
293 AC_MSG_ERROR([MALOC libraries OR headers missing ...EXITING ON ERROR])
294 else
295 AC_MSG_RESULT([MALOC libraries AND headers were found ...rocking on...])
296 fi
297
298 dnl # Return LDFLAGS and CPPFLAGS to normal
299 LDFLAGS=${LDFLAGS_SAVE};
300 CPPFLAGS=${CPPFLAGS_SAVE};
301 AC_SUBST(maloc_lib)
302 AC_SUBST(maloc_inc)
303
304 dnl # Check whether MALOC actually needs the READLINE library
305 AC_CHECK_LIB(maloc,maloc_needs_rl,
306 [rl_use="yes"],
307 [rl_use=""],
308 [${maloc_lib} ${rl_lib} ${liberty_lib} ${socket_lib} ${nsl_lib} ${thread_lib} ${math_lib} ${zfence_lib} ${profile_lib}])
309
310 dnl # Check whether MALOC actually needs the MPI library
311 AC_CHECK_LIB(maloc,maloc_needs_mpi,
312 [mpi_use="yes"],
313 [mpi_use=""],
314 [${maloc_lib} ${mpi_lib} ${rl_lib} ${liberty_lib} ${socket_lib} ${nsl_lib} ${thread_lib} ${math_lib} ${zfence_lib} ${profile_lib}])
315
316 AC_MSG_RESULT([---------- end configuring for MALOC linkage --------------])
317
318 dnl ##########################################################################
319 dnl 11. templates
320 dnl ##########################################################################
321
322 AH_TEMPLATE([HAVE_CYGWIN],
323 [Am I running in a Cygwin/Win32 environment?])
324
325 AH_TEMPLATE([HAVE_EMBED],
326 [Does EMBED macro for embedding rcsid symbols into binaries work?])
327
328 AH_TEMPLATE([HAVE_DEBUG],
329 [Do I compile as a debug version?])
330
331 AH_TOP([
332 /*
333 * ***************************************************************************
334 * GAMER = < Geometry-preserving Adaptive MeshER >
335 * Copyright (C) 2007-2008 -- Michael Holst and Zeyun Yu
336 *
337 * This library is free software; you can redistribute it and/or
338 * modify it under the terms of the GNU Lesser General Public
339 * License as published by the Free Software Foundation; either
340 * version 2.1 of the License, or (at your option) any later version.
341 *
342 * This library is distributed in the hope that it will be useful,
343 * but WITHOUT ANY WARRANTY; without even the implied warranty of
344 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
345 * Lesser General Public License for more details.
346 *
347 * You should have received a copy of the GNU Lesser General Public
348 * License along with this library; if not, write to the Free Software
349 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
350 * ***************************************************************************
351 */
352
353 /*
354 * ***************************************************************************
355 * File: acconfig.h
356 *
357 * Purpose: Generates the main configuration header "gamercf.h" for GAMER.
358 *
359 * Author: Michael Holst
360 * ***************************************************************************
361 */
362
363 #ifndef _GAMERCF_H_
364 #define _GAMERCF_H_
365 ])
366
367 AH_BOTTOM([
368 /*
369 * ***************************************************************************
370 * Undo the damage done by the autoconf tools
371 * ***************************************************************************
372 */
373 #undef HAVE_DLFCN_H
374 #undef HAVE_INTTYPES_H
375 #undef HAVE_MEMORY_H
376 #undef HAVE_STDINT_H
377 #undef HAVE_STDLIB_H
378 #undef HAVE_STRINGS_H
379 #undef HAVE_STRING_H
380 #undef HAVE_SYS_STAT_H
381 #undef HAVE_SYS_TYPES_H
382 #undef HAVE_UNISTD_H
383
384 /*
385 * ***************************************************************************
386 * Define some RCS tag embedding and debug I/O macros
387 * ***************************************************************************
388 */
389
390 /* Embedded RCS tags ("ident filename" prints module versions in filename) */
391 #if defined(HAVE_EMBED)
392 # define VEMBED(rctag) \
393 VPRIVATE const char* rctag; \
394 static void* use_rcsid=(0 ? &use_rcsid : (void*)&rcsid);
395 #else
396 # define VEMBED(rctag)
397 #endif
398
399 /* Produce additional debugging I/O */
400 #if defined(HAVE_DEBUG)
401 # define VDEBUGIO(str) fprintf(stderr,str)
402 #else
403 # define VDEBUGIO(str)
404 #endif
405
406 #endif /* _GAMERCF_H_ */
407 ])
408
409 dnl ##########################################################################
410 dnl 12. Test for doxygen and graphviz
411 dnl ##########################################################################
412
413 cwd=`pwd`
414 cd ${srcdir}
415 TOPDIR=`pwd`
416 cd ${cwd}
417
418 AC_ARG_WITH(doxygen, [AC_HELP_STRING([--with-doxygen],[Doxygen path])],
419 with_doxygen=$withval, with_doxygen=no)
420
421 if test "$with_doxygen" = "no"; then
422 AC_PATH_PROG(doxygen_path, doxygen)
423 if test -z "${doxygen_path}"; then
424 AC_MSG_WARN([Unable to find doxygen!])
425 fi
426 else
427 doxygen_path=$with_doxygen
428 fi
429
430 AC_ARG_WITH(dot, [AC_HELP_STRING([--with-dot],[Dot path])],
431 with_dot=$withval, with_dot=no)
432
433 if test "$with_dot" = "no"; then
434 AC_PATH_PROG(dot_path, dot)
435 if test -z "${dot_path}"; then
436 AC_MSG_WARN([Unable to find dot!])
437 fi
438 else
439 dot_path=$with_dot
440 fi
441
442 if test "$dot_path" = ""; then
443 sed -e 's%@have_dot@%'NO'%' $TOPDIR/doc/doxygen/gamer.dox.in > $TOPDIR/doc/doxygen/gamer.dox.in.temp
444 sed -e 's%@dot_path@%''%' $TOPDIR/doc/doxygen/gamer.dox.in.temp > $TOPDIR/doc/doxygen/gamer.dox.in.temp.2
445 else
446 sed -e 's%@have_dot@%'YES'%' $TOPDIR/doc/doxygen/gamer.dox.in > $TOPDIR/doc/doxygen/gamer.dox.in.temp
447 sed -e 's%@dot_path@%'${dot_path}'%' $TOPDIR/doc/doxygen/gamer.dox.in.temp > $TOPDIR/doc/doxygen/gamer.dox.in.temp.2
448 fi
449
450 sed -e 's%@topdir@%'${TOPDIR}'%' $TOPDIR/doc/doxygen/gamer.dox.in.temp.2 > $TOPDIR/doc/doxygen/gamer.dox
451 rm -f $TOPDIR/doc/doxygen/gamer.dox.in.temp*
452
453 AM_CONDITIONAL(MAKE_DOC, test "$doxygen_path" != "")
454 AC_SUBST(MAKE_DOC)
455 AC_SUBST(doxygen_path)
456
457
458 dnl ##########################################################################
459 dnl 13. generate the makefiles
460 dnl ##########################################################################
461
462 AC_OUTPUT([
463 Makefile
464 src/Makefile
465
466 src/base/Makefile
467
468 src/triangle/Makefile
469 src/tetgen/Makefile
470 src/biom/Makefile
471
472 src/aaa_inc/Makefile
473 src/aaa_inc/gamer/Makefile
474
475 src/aaa_lib/Makefile
476
477 doc/Makefile
478 doc/doxygen/Makefile
479 ])
480