chiark / gitweb /
Expunge revision histories in files.
[runlisp] / aclocal.glob
1 dnl -*-fundamental-*-                                     *@--GLOB-HEADER--@*
2 dnl
3 dnl $Id: aclocal.glob,v 1.18 2004/04/08 01:36:24 mdw Exp $
4 dnl
5 dnl Common library of autoconf macros
6 dnl
7 dnl (c) 1997 Mark Wooding, except for macros and documentation where noted.
8 dnl
9
10 dnl----- Licensing notice ---------------------------------------------------
11 dnl
12 dnl This file is part of the Common Files Distribution (`common')
13 dnl 
14 dnl `Common' is free software; you can redistribute it and/or modify
15 dnl it under the terms of the GNU General Public License as published by
16 dnl the Free Software Foundation; either version 2 of the License, or
17 dnl (at your option) any later version.
18 dnl 
19 dnl `Common' is distributed in the hope that it will be useful,
20 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
21 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 dnl GNU General Public License for more details.
23 dnl 
24 dnl You should have received a copy of the GNU General Public License
25 dnl along with `common'; if not, write to the Free Software Foundation,
26 dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
28 dnl *@--NOTICE--@* Common File Distribution
29 dnl $Id: aclocal.glob,v 1.18 2004/04/08 01:36:24 mdw Exp $
30
31 dnl --- *@-mdw_REQUIRE-@* ---
32 dnl
33 dnl Author:     Mark Wooding
34 dnl
35 dnl Synopsis:   mdw_REQUIRE(MACRO, ARGS...)
36 dnl
37 dnl Arguments:  MACRO = name of a macro which should have been called
38 dnl             ARGS = arguments to pass
39 dnl
40 dnl Use:        Like `AC_REQUIRE', only it handles arguments.
41
42 AC_DEFUN([mdw_REQUIRE],
43 [ifdef([AC_PROVIDE_$1], ,
44 [AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl
45 indir($@)
46 AC_DIVERT_POP()dnl
47 ])])
48
49 dnl --- *@-mdw_CURSES-@* ---
50 dnl
51 dnl Author:     Mark Wooding
52 dnl
53 dnl Synopsis:   mdw_CURSES
54 dnl
55 dnl Arguments:  ---
56 dnl
57 dnl Use:        Searches for a `curses' library (one of `ncurses' or
58 dnl             `curses') using mdw_CHECK_MANYLIBS.  If one is found, the
59 dnl             preprocessor macro HAVE_CURSES is defined, and a search is
60 dnl             made for a `curses' header file (one of <ncurses.h>,
61 dnl             <ncurses/ncurses.h> or <curses.h>) using AC_CHECK_HEADERS
62 dnl             and the appropriate preprocessor symbol is defined.
63 dnl             Finally, a check is made for the function `wresize' using
64 dnl             AC_CHECK_FUNCS.
65
66 AC_DEFUN([mdw_CURSES],
67 [mdw_CHECK_MANYLIBS(newwin, ncurses curses, AC_DEFINE(HAVE_CURSES))
68 if test $mdw_cv_lib_newwin != no; then
69 AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h curses.h], [break])
70 if test "$ac_cv_header_ncurses_h" = "no" &&
71    test "$ac_cv_header_ncurses_ncurses_h" = "no" &&
72    test "$ac_cv_header_curses_h" = "no"; then
73      AC_MSG_WARN([couldn't find a \`curses' header.  Assuming \`curses.h'.])
74      AC_DEFINE(HAVE_CURSES_H)
75 fi
76 AC_CHECK_FUNCS(wresize)
77 fi])
78
79 dnl --- *@-mdw_TYPE_SSIZE_T-@* ---
80 dnl
81 dnl Author:     Mark Wooding
82 dnl
83 dnl Synopsis:   mdw_TYPE_SSIZE_T
84 dnl
85 dnl Arguments:  ---
86 dnl
87 dnl Use:        Checks whether the Posix type `ssize_t' is defined.  If not,
88 dnl             it defaults to `int'.
89
90 AC_DEFUN([mdw_TYPE_SSIZE_T],
91 [AC_REQUIRE([AC_HEADER_STDC])
92 AC_CACHE_CHECK(for ssize_t, mdw_cv_ssize_t,
93 [AC_EGREP_CPP(ssize_t,
94 [#include <sys/types.h>
95 #if HAVE_UNISTD_H
96 #include <unistd.h>
97 #endif
98 #if STDC_HEADERS
99 #include <stdlib.h>
100 #include <stddef.h>
101 #endif],
102 [mdw_cv_ssize_t=yes], [mdw_cv_ssize_t=no])])
103 if test $mdw_cv_ssize_t = no; then
104   AC_DEFINE(ssize_t, int)
105 fi])
106
107 dnl --- *@-mdw_DECL_ENVIRON-@* ---
108 dnl
109 dnl Author:     Mark Wooding
110 dnl
111 dnl Synopsis:   mdw_DECL_ENVIRON
112 dnl
113 dnl Arguments:  ---
114 dnl
115 dnl Use:        Searches for a declaration of the global `environ' variable.
116 dnl             If one is found in one of the `usual' places, DECL_ENVIRON
117 dnl             is defined as a preprocessor symbol.
118
119 AC_DEFUN([mdw_DECL_ENVIRON],
120 [AC_CACHE_CHECK([for declaration of \`environ'], mdw_cv_environ,
121 [AC_EGREP_CPP(environ, 
122 [#include <sys/types.h>
123 #if HAVE_UNISTD_H
124 #include <unistd.h>
125 #endif
126 #if STDC_HEADERS
127 #include <stdlib.h>
128 #include <stddef.h>
129 #endif], [mdw_cv_environ=yes], [mdw_cv_environ=no])])
130 if test $mdw_cv_environ = yes; then
131   AC_DEFINE(DECL_ENVIRON)
132 fi])
133
134 dnl --- *@-mdw_CHECK_MANYLIBS-@* ---
135 dnl
136 dnl Author:     Mark Wooding
137 dnl
138 dnl Synopsis:   mdw_CHECK_MANYLIBS(FUNC, LIBS, [IF-FOUND], [IF-NOT-FOUND],
139 dnl                     [INCLUDES], [ARGS])
140 dnl
141 dnl Arguments:  FUNC = a function to try to find
142 dnl             LIBS = a whitespace-separated list of libraries to search
143 dnl             IF-FOUND = what to do when the function is found
144 dnl             IF-NOT-FOUND = what to do when the function isn't found
145 dnl             INCLUDES = other include files to add
146 dnl             ARGS = arguments to pass the function
147 dnl
148 dnl Use:        Searches for a library which defines FUNC.  It first tries
149 dnl             without any libraries; then it tries each library specified
150 dnl             in LIBS in turn.  If it finds a match, it adds the
151 dnl             appropriate library to `LIBS'.
152 dnl
153 dnl             This is particularly handy under DIREIX: if you link with
154 dnl             `-lnsl' then you get non-NIS-aware versions of getpwnam and
155 dnl             so on, which is clearly a Bad Thing.
156
157 AC_DEFUN([mdw_CHECK_MANYLIBS],
158 [AC_CACHE_CHECK([for library containing $1], [mdw_cv_lib_$1],
159 [mdw_save_LIBS="$LIBS"
160 mdw_cv_lib_$1="no"
161 AC_TRY_LINK([$5], [$1($6)], [mdw_cv_lib_$1="none required"])
162 test "$mdw_cv_lib_$1" = "no" && for i in $2; do
163 LIBS="-l$i $mdw_save_LIBS"
164 AC_TRY_LINK([$5], [$1($6)],
165 [mdw_cv_lib_$1="-l$i"
166 break])
167 done
168 LIBS="$mdw_save_LIBS"])
169 if test "$mdw_cv_lib_$1" != "no"; then
170   test "$mdw_cv_lib_$1" = "none required" || LIBS="$mdw_cv_lib_$1 $LIBS"
171   $3
172 else :
173   $4
174 fi])
175
176 dnl --- *@-mdw__PERL_VERSION-@* ---
177 dnl
178 dnl AC_DEFUN relies on `[', `]' being quotes, so I have to drop down a level.
179
180 changequote(<<, >>)
181 define([mdw__PERL_VERSION], <<$1 -e 'exit ($] < $2);' >&5 2>&5>>)
182 changequote([, ])
183
184 dnl --- *@-mdw_PROG_PERL-@* ---
185 dnl
186 dnl Author:     Mark Wooding
187 dnl
188 dnl Synopsis:   mdw_PROG_PERL(VERSION, [IF-FOUND], [IF-NOT-FOUND])
189 dnl
190 dnl Arguments:  VERSION = version number of Perl required
191 dnl             IF-FOUND = what to do if it's found
192 dnl             IF-NOT-FOUND = what to do if it isn't
193 dnl
194 dnl Use:        Attempts to find a working version of Perl with a late
195 dnl             enough version number.  It supplies an option `--with-perl'
196 dnl             to allow the user to provide a Perl interpreter.  If one
197 dnl             isn't provided explicitly, it searches for `perl' and `perl5'
198 dnl             in the current PATH, asking them whether they have a late
199 dnl             enough version number.  The path of the working Perl is
200 dnl             put into the `PERL' environment variable; `AC_SUBST' is used
201 dnl             to substitute its value into Perl scripts.  If there is no
202 dnl             Perl to be found, the value of `PERL' is set to be `none'.
203
204 AC_DEFUN([mdw_PROG_PERL],
205 [AC_ARG_WITH([perl],
206 [  --with-perl=PERL       specify path to Perl version $1 or newer],
207 [PERL="$withval"],
208 if test -z "$PERL"; then
209 [AC_CACHE_CHECK([for Perl version $1 or later], mdw_cv_prog_perl,
210 [mdw_cv_prog_perl="none"
211 for p in `echo "$PATH:/usr/local/bin" | tr ":" " "`; do
212   case $p in /*) ;; *) p=`pwd`/$p ;; esac
213   if mdw__PERL_VERSION(["$p/perl"], $1); then
214     mdw_cv_prog_perl="$p/perl"
215     break
216   fi
217   if mdw__PERL_VERSION(["$p/perl5"], $1); then
218     mdw_cv_prog_perl="$p/perl5"
219     break
220   fi
221 done])
222 PERL="$mdw_cv_prog_perl"])
223 fi
224
225 AC_SUBST(PERL)dnl
226 if test "$PERL" = "none"; then :
227   $3
228 else :
229   $2
230 fi])
231
232 dnl --- *@-mdw_CHECK_PERL-@* ---
233 dnl
234 dnl Author:     Mark Wooding
235 dnl
236 dnl Synopsis:   mdw_CHECK_PERL(VERSION)
237 dnl
238 dnl Arguments:  VERSION = version number of Perl required
239 dnl
240 dnl Use:        Verifies that the Perl interpreter in the `PERL' shell
241 dnl             variable actually works and is of the right version.  If it's
242 dnl             not, an error is raised and configuration is aborted.
243
244 AC_DEFUN([mdw_CHECK_PERL],
245 [mdw_REQUIRE([mdw_PROG_PERL], [$1])
246 AC_MSG_CHECKING([whether Perl ($PERL) works])
247 if test "$PERL" != "none" && mdw__PERL_VERSION("$PERL", $1); then
248   AC_MSG_RESULT([yes])
249 else
250   AC_MSG_RESULT([no])
251   AC_MSG_ERROR([Perl version $1 or newer not found.
252 If you have a recent enough Perl, and I just failed to find it, try using
253 the --with-perl=PERL option to give me an explicit pathname.])
254 fi])
255
256 dnl --- *@-mdw_PERLLIB_CHECK-@* ---
257 dnl
258 dnl Author:     Mark Wooding
259 dnl
260 dnl Synopsis:   mdw_PERLLIB_CHECK(LIBRARY)
261 dnl
262 dnl Arguments:  LIBRARY = name of a Perl library to check for
263 dnl
264 dnl Use:        Ensures that a Perl script can `use LIBRARY;'.  If it can,
265 dnl             all's well and good; if it can't, `LIBRARY.pm' is added to
266 dnl             the variable `NEEDED_PERLLIBS' and a line which adds 
267 dnl             `pkgdatadir' to Perl's `@INC' array is placed in the
268 dnl             variable `INC_PERLLIBS'; `AC_SUBST' is called for both of
269 dnl             these variables.  It's expected that `NEEDED_PERLLIBS' will
270 dnl             be used in the `Makefile.in' to decide which versions from
271 dnl             the distribution need installing.
272 dnl
273 dnl             This macro isn't terribly useful in the general case.  It
274 dnl             Also implicitly assumes that `$PERL' is Perl 5 or later.
275
276 AC_DEFUN([mdw__PERLLIB_INIT],
277 [AC_SUBST(INC_PERLLIBS)dnl
278 AC_SUBST(NEEDED_PERLLIBS)dnl
279 ])
280
281 AC_DEFUN([mdw_PERLLIB_CHECK],
282 [AC_REQUIRE([mdw__PERLLIB_INIT])
283 mdw_REQUIRE([mdw_CHECK_PERL], 5)
284 AC_CACHE_CHECK([for Perl library $1], mdw_cv_perllib_$1,
285 [if $PERL -e 'use $1;' >&5 2>&5; then
286   mdw_cv_perllib_$1="yes"
287 else
288   mdw_cv_perllib_$1="no"
289 fi])
290
291 if test "$mdw_cv_perllib_$1" = "no"; then
292   NEEDED_PERLLIBS="$NEEDED_PERLLIBS $1.pm"
293
294   # --- Deal with autoconf lossage ---
295   #
296   # It doesn't want to define `prefix' until rather later on, so I have
297   # to bodge it here.
298
299   if test -z "$INC_PERLLIBS"; then
300     mdw_old_prefix="$prefix"
301     test "$prefix" = "NONE" && prefix="$ac_default_prefix";
302     INC_PERLLIBS="BEGIN { push @INC, \"`eval echo $datadir/$PACKAGE`\"; }"
303     prefix="$mdw_old_prefix";
304   fi
305 fi])
306
307 dnl --- *@-mdw_GCC_FLAGS-@* ---
308 dnl
309 dnl Author:     Mark Wooding
310 dnl
311 dnl Synopsis:   mdw_GCC_FLAGS([FLAGS], [CFLAGS], [C++FLAGS])
312 dnl
313 dnl Arguments:  FLAGS = GCC compiler flags to add (default is 
314 dnl                     `-pedantic -Wall')
315 dnl             CFLAGS = GCC C compiler flags to add (default is empty)
316 dnl             C++FLAGS = GCC C++ compiler flags to add (default is
317 dnl                     `-fhandle-exceptions').
318 dnl
319 dnl Use:        If the C compiler is GCC, add the compiler flags.
320
321 AC_DEFUN([mdw_GCC_FLAGS],
322 [if test "$GCC" = "yes"; then
323   CFLAGS="$CFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])"
324   CFLAGS="$CFLAGS ifelse([$2], [], [], [$2])"
325 fi
326 if test "$GXX" = "yes"; then
327   CXXFLAGS="$CXXFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])"
328   CXXFLAGS="$CXXFLAGS ifelse([$3], [], [-fhandle-exceptions], [$3])"
329 fi])
330
331 dnl --- *@-mdw_INIT_LIB-@* ---
332 dnl
333 dnl Author:     Mark Wooding
334 dnl
335 dnl Synopsis:   mdw_INIT_LIB(LIB, NAME, VERSION, [PACKAGE])
336 dnl
337 dnl Arguments:  LIB = the name of the library (and the package)
338 dnl             NAME = a presentable version of the library's name
339 dnl             VERSION = version of the library
340 dnl             PACKAGE = package name to pass on to AM_INIT_AUTOMAKE
341 dnl
342 dnl Use:        Sets up various useful variables.  This macro calls
343 dnl             AM_INIT_AUTOMAKE, which might be considered useful.  It also
344 dnl             provides variables for the use of `lib-config.in'.
345
346 AC_DEFUN([mdw_INIT_LIB],
347 [AM_INIT_AUTOMAKE(ifelse([$4], [], [$1], [$4]), [$3])
348 LIBRARY="$1" AC_SUBST(LIBRARY)
349 LIBNAME="$2" AC_SUBST(LIBNAME)])
350
351 dnl --- *@-mdw_LIB_CONFIG-@* ---
352 dnl
353 dnl Author:     Mark Wooding
354 dnl
355 dnl Synopsis:   mdw_LIB_CONFIG(LIB, NAME, VERSION, IF-FOUND, IF-NOT-FOUND)
356 dnl
357 dnl Arguments:  LIB = the name of the library (and its configuration program)
358 dnl             NAME = a presentable version of the library's name
359 dnl             VERSION = version of library required
360 dnl             IF-FOUND = what to do if found
361 dnl             IF-NOT-FOUND = what to do if not found  
362 dnl
363 dnl Use:        Configures a library client program, using a configuration
364 dnl             script provided by the library maintainer.
365 dnl
366 dnl             The default version is 1.0.0pre0; the default action is to
367 dnl             add everything to the CFLAGS and LIBS variables, and complain
368 dnl             if the library couldn't be found.
369 dnl
370 dnl             The variable LIB_VERSION contains the version number of
371 dnl             the library; LIB_CFLAGS is the C compiler flags required
372 dnl             and LIB_LIBS is the linker flags.
373
374 AC_DEFUN([mdw_LIB_CONFIG],
375 [pushdef([upname], translit([$1], [a-z], [A-Z]))dnl
376 AC_MSG_CHECKING([for $2 library])
377 if $1-config --check $3 >/dev/null 2>&1; then
378   upname[]_VERSION=`$1-config --version`
379   upname[]_CFLAGS=`$1-config --cflags`
380   upname[]_LIBS=`$1-config --libs`
381   AC_SUBST(upname[]_VERSION)
382   AC_SUBST(upname[]_CFLAGS)
383   AC_SUBST(upname[]_LIBS)
384   ifelse([$4], [],
385   [CFLAGS="$CFLAGS $upname[]_CFLAGS"
386   LIBS="$upname[]_LIBS $LIBS"],
387   $4)
388   AC_MSG_RESULT([$upname[]_VERSION])
389 else
390   ifelse([$5], [],
391   AC_MSG_ERROR([$2 library not found or too old.]),
392   $5)
393   AC_MSG_RESULT([not found])
394 fi
395 popdef([upname])])
396
397 dnl --- *@-mdw_MLIB-@* ---
398 dnl
399 dnl Author:     Mark Wooding
400 dnl
401 dnl Synopsis:   mdw_MLIB(VERSION, IF-FOUND, IF-NOT-FOUND
402 dnl
403 dnl Arguments:  VERSION = version of library required
404 dnl             IF-FOUND = what to do if found
405 dnl             IF-NOT-FOUND = what to do if not found  
406 dnl
407 dnl Use:        Configures an mLib client program.
408
409 AC_DEFUN([mdw_MLIB], [mdw_LIB_CONFIG(mLib, mLib, $@)])
410
411 dnl --- *@-mdw_MGLIB-@* ---
412 dnl
413 dnl Author:     Mark Wooding
414 dnl
415 dnl Synopsis:   mdw_MGLIB(VERSION, IF-FOUND, IF-NOT-FOUND
416 dnl
417 dnl Arguments:  VERSION = version of library required
418 dnl             IF-FOUND = what to do if found
419 dnl             IF-NOT-FOUND = what to do if not found  
420 dnl
421 dnl Use:        Configures an mgLib client program.
422
423 AC_DEFUN([mdw_MGLIB],
424 [mdw_REQUIRE([mdw_MLIB], [1.6.0])
425 mdw_LIB_CONFIG(mgLib, mgLib, $@)])
426
427 dnl --- *@-mdw_CATACOMB-@* ---
428 dnl
429 dnl Author:     Mark Wooding
430 dnl
431 dnl Synopsis:   mdw_CATACOMB([VERSION], [IF-FOUND], [IF-NOT-FOUND])
432 dnl
433 dnl Arguments:  VERSION = version of Catacomb required
434 dnl             IF-FOUND = what to do if found
435 dnl             IF-NOT-FOUND = what to do if not found  
436 dnl
437 dnl Use:        Configures the program as a Catacomb client.
438
439 AC_DEFUN([mdw_CATACOMB],
440 [mdw_REQUIRE([mdw_MLIB], [1.6.0])
441 mdw_LIB_CONFIG(catacomb, Catacomb, $@)])
442
443 dnl --- *@-mdw_PK-@* ---
444 dnl
445 dnl Author:     Mark Wooding
446 dnl
447 dnl Synopsis:   mdw_PK([VERSION], [IF-FOUND], [IF-NOT-FOUND])
448 dnl
449 dnl Arguments:  VERSION = version of PK required
450 dnl             IF-FOUND = what to do if found
451 dnl             IF-NOT-FOUND = what to do if not found  
452 dnl
453 dnl Use:        Configures the program as a PK client.
454
455 AC_DEFUN([mdw_PK],
456 [mdw_REQUIRE([mdw_MLIB], [1.6.0])
457 mdw_LIB_CONFIG(pk, PK, $@)])
458
459 dnl --- *@-mdw_OPT_NDEBUG-@* ---
460 dnl
461 dnl Author:     Mark Wooding
462 dnl
463 dnl Synopsis:   mdw_OPT_NDEBUG
464 dnl
465 dnl Arguments:  ---
466 dnl
467 dnl Use:        Turns on the `NDEBUG' flag, to disable useful things like
468 dnl             assertions.
469
470 AC_DEFUN([mdw_OPT_NDEBUG],
471 [AC_ARG_ENABLE(debugging,
472 [  --disable-debugging     spews vast swathes of useless information],
473 [if test "$enableval" = "no"; then
474   AC_DEFINE(NDEBUG, 1)
475 fi])])
476
477 dnl --- *@-mdw_OPT_EFENCE-@* ---
478 dnl
479 dnl Author:     Mark Wooding
480 dnl
481 dnl Synopsis:   mdw_OPT_EFENCE
482 dnl
483 dnl Arguments:  ---
484 dnl
485 dnl Use:        Links with the Electric Fence library.
486
487 AC_DEFUN([mdw_OPT_EFENCE],
488 [AC_ARG_WITH(electric-fence,
489 [  --with-electric-fence   link programs with Electric Fence],
490 [if test "$withval" = "yes"; then
491   AC_CHECK_LIB(efence, malloc)
492 fi])])
493
494 dnl --- *@-mdw_OPT_TRACE-@* ---
495 dnl
496 dnl Author:     Mark Wooding
497 dnl
498 dnl Synopsis:   mdw_OPT_TRACE
499 dnl
500 dnl Arguments:  ---
501 dnl
502 dnl Use:        Turns on the `NTRACE' flag, to disable useful things like
503 dnl             trace outputs.
504
505 AC_DEFUN([mdw_OPT_TRACE],
506 [AC_ARG_ENABLE(tracing,    
507 [  --disable-tracing       disable output of trace information],
508 [if test "$enableval" = "no"; then
509   AC_DEFINE(NTRACE, 1)
510 fi])])
511
512 dnl --- *@-mdw_OPT_mLib_TRACK-@* ---
513 dnl
514 dnl Author:     Mark Wooding
515 dnl
516 dnl Synopsis:   mdw_OPT_mLib_TRACK(PROGRAM)
517 dnl
518 dnl Arguments:  PROGRAM = name of this program or package.
519 dnl
520 dnl Use:        Controls the unsupported mLib memory tracker.  The
521 dnl             following are defined:
522 dnl
523 dnl               --enable-track          turns on malloc tracking
524 dnl               --enable-blame-PROGRAM  tracks malloc contexts in PROGRAM
525 dnl
526 dnl             There must be  a separate `blame' option for each program,
527 dnl             so that the various blame options in a hierarchy get
528 dnl             propagated properly.  This is an obsolete feature from the
529 dnl             days when mLib was provided as a subdirectory of other
530 dnl             packages.
531
532 AC_DEFUN([mdw_OPT_mLib_TRACK],
533 [AC_REQUIRE([mdw_OPT_TRACE])
534 AC_ARG_ENABLE(track,
535 [  --enable-track          enable tracking of malloc and free],
536 [AC_DEFINE(TRACK_ENABLE, 1)])
537 AC_ARG_ENABLE(blame-$1,
538 [  --enable-blame-$1
539                           track malloc contexts while in $1],
540 [AC_DEFINE(TRACK_BLAME, 1)])])
541
542 dnl --- *@-mdw_OPT_mLib_DEBUG-@* ---
543 dnl
544 dnl Author:     Mark Wooding
545 dnl
546 dnl Synopsis:   mdw_OPT_mLib_DEBUG(PROGRAM)
547 dnl
548 dnl Arguments:  PROGRAM = name of this program or package.
549 dnl
550 dnl Use:        Provides all of the above debugging options.
551
552 AC_DEFUN([mdw_OPT_mLib_DEBUG],
553 [mdw_REQUIRE([mdw_OPT_NDEBUG])
554 mdw_REQUIRE([mdw_OPT_mLib_TRACK], [$1])])
555
556 dnl --- *@-mdw_DEFINE_PATHS-@*
557 dnl
558 dnl Author:     Mark Wooding
559 dnl
560 dnl Synopsis:   mdw_DEFINE_FILES(CODE)
561 dnl
562 dnl Arguments:  CODE = shell script code to execute
563 dnl
564 dnl Use:        Fixes up various variables so that pathname defines can be
565 dnl             defined.  Within CODE, you may use the following macros:
566 dnl
567 dnl             mdw_PROG(NAME)          Transformed program name
568 dnl
569 dnl             mdw_PATH(PATH)          Expanded path (may contain variables)
570 dnl
571 dnl             mdw_DEFINE_PROG(SYMBOL, PROG)
572 dnl                                     Define a symbol as a transformed
573 dnl                                     program name.
574 dnl
575 dnl             mdw_DEFINE_PATH(SYMBOL, NAME)
576 dnl                                     Define a symbol as an expanded path
577
578 AC_DEFUN([mdw_DEFINE_PATHS],
579 [mdw_prefix=$prefix mdw_exec_prefix=$exec_prefix
580 mdw_transform=`echo "$program_transform_name"|sed 's,\\\\\\\\,\\\\,g; s,\\$\\$,$,g'`
581 test "$prefix" = "NONE" && prefix=$ac_default_prefix
582 test "$exec_prefix" = "NONE" && exec_prefix=$prefix
583 $1
584 prefix=$mdw_prefix exec_prefix=$mdw_exec_prefix])
585
586 AC_DEFUN([mdw_PROG], [`echo "$1"|sed "$mdw_transform"`])
587 AC_DEFUN([mdw_PATH], [dnl
588 `t="$1"; dnl
589 while :; do dnl
590 case "$t" in dnl
591 *\\$[]*) t=\`eval echo "$t"\`;; dnl
592 *) break;; dnl
593 esac; done; dnl
594 echo "$t"`])
595 AC_DEFUN([mdw_DEFINE_PROG], [AC_DEFINE_UNQUOTED([$1], ["mdw_PROG([$2])"])])
596 AC_DEFUN([mdw_DEFINE_PATH], [AC_DEFINE_UNQUOTED([$1], ["mdw_PATH([$2])"])])
597
598 dnl --- *@-mdw_DIR_TEXMF-@* ---
599 dnl
600 dnl Author:     Mark Wooding
601 dnl
602 dnl Synopsis:   mdw_DIR_TEXMF
603 dnl
604 dnl Arguments:  ---
605 dnl
606 dnl Use:        Sets the substitution `texmfdir' as a sensible TeX install
607 dnl             tree.
608
609 AC_DEFUN([mdw_DIR_TEXMF], [
610 AC_ARG_WITH([texmfdir], 
611 [  --with-texmfdir=DIR     set the TeX install directory to DIR],
612 [texmfdir=$withval],
613 [AC_MSG_CHECKING([where to put installed TeX files])
614 mdw_DEFINE_PATHS([
615 texmfdir='${datadir}/texmf'
616 for d in \
617   '${datadir}/texmf' '${prefix}/lib/texmf' \
618   '${prefix}/texmf' '${libdir}/lib/texmf'; do
619   if test -d "mdw_PATH([$d])"; then
620     texmfdir=$d
621     break
622   fi
623 done
624 AC_MSG_RESULT([$texmfdir])])])
625 AC_SUBST(texmfdir)])
626
627 dnl --- *@-mdw_MANEXT-@* ---
628 dnl
629 dnl Author:     Mark Wooding
630 dnl
631 dnl Synopsis:   mdw_MANEXT
632 dnl
633 dnl Arguments:  ---
634 dnl
635 dnl Use:        Sets the substitution `manext' for man page extensions.
636
637 AC_DEFUN([mdw_MANEXT], [
638 AC_ARG_WITH([man-ext],
639 [  --with-man-ext=EXT      give manpages the EXT extension (e.g., foo.3EXT)],
640 [manext=$withval], [manext=mLib])
641 AC_SUBST(manext)])
642
643 dnl----- That's all, folks --------------------------------- *@--GLOB-END--@*