1 dnl sxe-aux.m4 -- just some auxiliary macros
3 dnl -------------------------------------------------------------------------
5 dnl -------------------------------------------------------------------------
7 AC_DEFUN([SXE_USAGE_ERROR], [dnl
8 (echo "$progbasename: Usage error:"
10 echo " Use \`$progname --help' to show usage.") >&2 && exit 1])
12 dnl SXE_PRINT_VAR(var var ...) prints values of shell variables
13 AC_DEFUN([SXE_PRINT_VAR],[for var in patsubst([$1],[[
14 ]+],[ ]); do eval "echo \"$var = '\$$var'\""; done])
16 dnl SXE_ADD_RUNPATH_DIR(directory)
17 AC_DEFUN([SXE_ADD_RUNPATH_DIR], [dnl
20 if test "$xe_runpath_dir" != "/lib" -a \
21 "$xe_runpath_dir" != "/usr/lib" -a \
22 -n "`ls ${xe_runpath_dir}/*.s[[ol]] 2>/dev/null`"; then
23 eval "$xe_add_unique_runpath_dir"
26 ])dnl SXE_ADD_RUNPATH_DIR
29 AC_DEFUN([SXE_CHECK_USER_SPECIFIED_P], [dnl
30 ## arg1 var-name to check for
31 ## generates a variable `arg1'_uspecified_p
32 pushdef([VARNAME], [$1])
33 pushdef([VARNAME_USPECIFIED_P], [$1_uspecified_p])
34 pushdef([USER_VARNAME], [USER_$1])
36 AC_MSG_CHECKING([for user specified ]VARNAME)
37 if test "${[]VARNAME[]-unset}" != "unset"; then
38 VARNAME_USPECIFIED_P[]=yes;
39 USER_VARNAME=${[]VARNAME[]}
41 VARNAME_USPECIFIED_P[]=no;
44 AC_MSG_RESULT([$]VARNAME_USPECIFIED_P)
46 popdef([VARNAME_USPECIFIED_P])
47 popdef([USER_VARNAME])
48 ])dnl SXE_CHECK_USER_SPECIFIED_P
50 AC_DEFUN([SXE_CHECK_USER_VARS], [dnl
51 ## If we don't set CFLAGS here, AC_PROG_CC will set it.
52 ## But we know better what's good for us, so we do our own
53 ## computation of real CFLAGS later.
54 SXE_CHECK_USER_SPECIFIED_P([CFLAGS])
55 SXE_CHECK_USER_SPECIFIED_P([CPPFLAGS])
56 SXE_CHECK_USER_SPECIFIED_P([LDFLAGS])
57 SXE_CHECK_USER_SPECIFIED_P([XFLAGS])
58 SXE_CHECK_USER_SPECIFIED_P([LIBS])
59 SXE_CHECK_USER_SPECIFIED_P([CC])
60 SXE_CHECK_USER_SPECIFIED_P([CPP])
61 SXE_CHECK_USER_SPECIFIED_P([AR])
62 SXE_CHECK_USER_SPECIFIED_P([YACC])
63 SXE_CHECK_USER_SPECIFIED_P([YFLAGS])
64 SXE_CHECK_USER_SPECIFIED_P([XMKMF])
65 ])dnl SXE_CHECK_USER_VARS
68 dnl A meta defun that can create those nifty SXE_ADD_*_OBJ macros
69 m4_define([__SXE_MAKE_ADDER], [
70 ## arg1 is the name to be used throughout m4
71 ## arg2 is the library sans _la or _a to be used in the Makefiles
72 ## arg3 are comma-separated additional vars to substitute
73 ## defines SXE_ADD_<arg1>_OBJ
74 ## defines SXE_ADD_<arg1>_OBJS
75 ## defines SXE_SUBST_<arg1>_OBJS
77 m4_define([SXE_ADD_]$1[_OBJ], [
78 $2_objs="$$2_objs $2_a-]$[1]["
79 if test "$extra_verbose" = "yes"; then
80 echo " sxemacs (cat. $1) will be linked with \"]$[1][\""
84 m4_define([SXE_ADD_]$1[_OBJS], [
86 ]SXE_ADD_[]$1[]_OBJ([$i])[
90 m4_define([SXE_SUBST_]$1[_OBJS], [
92 ## subst additional vars
93 m4_foreach_w([var], $3, [AC_SUBST(var)])
94 ## also define a conditional
95 AM_CONDITIONAL([NEED_]translit([$2], [-.a-z], [__A-Z]),
99 ])dnl __SXE_MAKE_ADDER
102 dnl creates SXE_ADD_CORE_{OBJ,OBJS}
103 __SXE_MAKE_ADDER([CORE], [libsxecore])
105 dnl creates SXE_ADD_CRUFT_{OBJ,OBJS}
106 __SXE_MAKE_ADDER([CRUFT], [libcruft])
108 dnl creates SXE_ADD_DB_{OBJ,OBJS}
109 __SXE_MAKE_ADDER([DB], [libsxedb], [DB_CPPFLAGS DB_LDFLAGS DB_LIBS])
111 dnl creates SXE_ADD_ENT_{OBJ,OBJS}
112 __SXE_MAKE_ADDER([ENT], [libent])
114 dnl creates SXE_ADD_EVENTS_{OBJ,OBJS}
115 __SXE_MAKE_ADDER([EVENTS], [libsxeevents])
117 dnl creates SXE_ADD_MEMALLOC_{OBJ,OBJS}
118 __SXE_MAKE_ADDER([MEMALLOC], [libmemalloc])
120 dnl creates SXE_ADD_MM_{OBJ,OBJS}
121 __SXE_MAKE_ADDER([MM], [libmm])
123 dnl creates SXE_ADD_MULE_{OBJ,OBJS}
124 __SXE_MAKE_ADDER([MULE], [libmule])
126 dnl creates SXE_ADD_SXEUI_{OBJ,OBJS}
127 __SXE_MAKE_ADDER([SXEUI], [libsxeui])
129 dnl creates SXE_ADD_SXEUI_{OBJ,OBJS}
130 __SXE_MAKE_ADDER([SXEUITTY], [libsxeuiTTY])
132 dnl creates SXE_ADD_SXEUI_{OBJ,OBJS}
133 __SXE_MAKE_ADDER([SXEUIX11], [libsxeuiX11])
135 dnl SXE_ADD_STATMOD_A(foo.o ...)
136 AC_DEFUN([SXE_ADD_STATMOD_A], [
137 statmod_archives="$statmod_archives [$1]" && \
138 if test "$extra_verbose" = "yes"; then
139 echo " sxemacs (cat. static module) will be linked with \"[$1]\""
141 ])dnl SXE_ADD_STATMOD_A
142 AC_DEFUN([SXE_SUBST_STATMOD_A], [AC_SUBST(statmod_archives)])
144 dnl SXE_APPEND(value, varname)
145 AC_DEFUN([SXE_APPEND],
146 [SXE_CONSECUTIVE_UNDUP($2,"$[$2] [$1]")
147 if test "$extra_verbose" = "yes"; then
148 echo " Appending \"[$1]\" to [$2]
152 dnl SXE_PREPEND(value, varname)
153 AC_DEFUN([SXE_PREPEND],
154 [SXE_CONSECUTIVE_UNDUP($2,"[$1] $[$2]")
155 if test "$extra_verbose" = "yes"; then
156 echo " Prepending \"[$1]\" to [$2]
160 dnl SXE_APPEND(value, varname)
161 AC_DEFUN([SXE_APPEND_UNDUP],
162 [SXE_UNDUP($2,"$[$2] [$1]")
163 if test "$extra_verbose" = "yes"; then
164 echo " Appending and dedupping \"[$1]\" to [$2]
168 dnl SXE_PREPEND(value, varname)
169 AC_DEFUN([SXE_PREPEND_UNDUP],
170 [SXE_UNDUP($2,"[$1] $[$2]")
171 if test "$extra_verbose" = "yes"; then
172 echo " Prepending and dedupping \"[$1]\" to [$2]
177 AC_DEFUN([SXE_DIE], [{ echo "Error:" $1 >&2; exit 1; }])
181 AC_DEFUN([SXE_INIT_MSG_LEVEL], [
183 ])dnl SXE_INIT_MSG_LEVEL
185 AC_DEFUN([SXE_MSG_CHECKING], [
186 ## like AC_MSG_CHECKING but nestable
187 if test "$sxe_msg_level" -le 0; then
188 AC_MSG_CHECKING([$1])
190 sxe_msg_level=$(($sxe_msg_level + 1))
191 ])dnl SXE_MSG_CHECKING
193 AC_DEFUN([SXE_MSG_RESULT], [
194 ## like AC_MSG_RESULT but nestable
195 sxe_msg_level=$(($sxe_msg_level - 1))
196 if test "$sxe_msg_level" -le 0; then
201 dnl SXE_CHECK_FEATURE_DEPENDENCY(feature1, feature2)
202 AC_DEFUN([SXE_CHECK_FEATURE_DEPENDENCY],
203 [if test "$with_$1 $with_$2" = "yes no"; then
204 SXE_USAGE_ERROR("--with-$1 requires --with-$2")
205 elif test "$with_$2" = "no" ; then with_$1=no
206 elif test "$with_$1" = "yes"; then with_$2=yes
210 dnl SXE_STRIP_4TH_COMPONENT(var)
211 dnl Changes i986-pc-linux-gnu to i986-pc-linux, as God (not RMS) intended.
212 AC_DEFUN([SXE_STRIP_4TH_COMPONENT],
213 [$1=`echo "$$1" | sed '[s/^\([^-][^-]*-[^-][^-]*-[^-][^-]*\)-.*$/\1/]'`])
215 dnl AC_DEFUN([SXE_DEBUG_AC], [AS_MESSAGE($@)])
216 AC_DEFUN([SXE_DEBUG_AC], [])
218 dnl Do our best to deal with automounter brokenness
219 dnl SXE_CANONICALISE_PATH(varname)
220 AC_DEFUN([SXE_CANONICALISE_PATH], [dnl
221 ## arg #1 is the file/path to canonicalise
222 pushdef([tmpp], [$1])
224 SXE_DEBUG_AC([canonicalising \$]tmpp[: "]$[]tmpp["])
226 if test -d "/net"; then
227 if test -d "/tmp_mnt/net"; then
232 tmpp[]=$(echo "[$]tmpp[]" | \
233 sed -e "s|^${tdir}/|/net/|" \
235 -e "s|^/amd/|/net/|")
238 dnl if test -d "[$]tmpp"; then
239 dnl ## the easy way ...
240 dnl ## just let the filesystem implementation do the hard work
241 dnl tmpp[]=$(cd [$]tmpp[] && echo $(pwd))
242 dnl elif test -f "[$]tmpp"; then
243 dnl ## the easy way ...
244 dnl ## just let the filesystem implementation do the hard work
245 dnl tmpp[]=$(cd $(dirname [$]tmpp[]) && \
246 dnl echo $(pwd)/$(basename [$]tmpp[]))
250 while test "$canonicalised" = "no"; do
251 _SXE_CANONICALISE_STEP(tmpp,
252 [canonicalised="yes"], [canonicalised="no"])
256 SXE_DEBUG_AC([canonicalised \$]tmpp[: "]$[]tmpp["])
258 ])dnl SXE_CANONICALISE_PATH
260 AC_DEFUN([_SXE_CANONICALISE_STEP], [
261 ## _SXE_CANONICALISE_STEP( VAR, DO-ON-SUCCESS, DO-ON-FAILURE)
262 ## arg #1 is the varname to canonicalise
263 ## arg #2 is the code to execute on success
264 ## arg #3 is the code to execute on failure
265 pushdef([tmpvar], [$1])
266 pushdef([dosucc], [$2])
267 pushdef([dofail], [$3])
271 tmp4=$(basename "$tmp2")
272 ## assume we had success
274 while test "$tmp4" != "/" -a "$tmp4" != "."; do
275 if test "$tmp4" = ".." -a \
276 $(basename $(dirname "$tmp2")) = "."; then
277 ## we prepend and we know the path
278 ## is still dirty but wont do anything
279 ## alternative would be to prepend $(pwd) now
281 tmp3="$(basename $tmp2)/$tmp3"
282 elif test "$tmp4" = ".." -a \
283 $(basename $(dirname "$tmp2")) != ".."; then
284 tmp2=$(dirname "$tmp2")
285 elif test "$tmp4" = ".."; then
286 ## we prepend, but now we know the path
289 tmp3="$(basename $tmp2)/$tmp3"
290 elif test -n "$tmp3"; then
291 ## ordinary component, just prepend
292 tmp3="$(basename $tmp2)/$tmp3"
295 tmp3="$(basename $tmp2)"
297 tmp2=$(dirname "$tmp2")
298 tmp4=$(basename "$tmp2")
302 tmpvar[]=$(echo "$tmp3" | sed -e "s@//@/@g")
307 ])dnl _SXE_CANONICALISE_STEP
310 dnl SXE_PROTECT_LINKER_FLAGS(shell_var)
311 AC_DEFUN([SXE_PROTECT_LINKER_FLAGS], [
312 if test "$GCC" = "yes"; then
313 set x $[$1]; shift; [$1]=""
314 while test -n "[$]1"; do
316 -L | -l | -u ) [$1]="$[$1] [$]1 [$]2"; shift ;;
317 -L* | -l* | -u* | -Wl* | -pg ) [$1]="$[$1] [$]1" ;;
319 * ) [$1]="$[$1] -Xlinker [$]1" ;;
326 dnl Allow use of either ":" or spaces for lists of directories
327 AC_DEFUN([SXE_COLON_TO_SPACE],
328 [case "$[$1]" in *:* [)] [$1]="`echo '' $[$1] | sed -e 's/^ //' -e 's/:/ /g'`";; esac])dnl
331 dnl The construct foo=`echo $w1 $w2 $w3` fails on some systems if $w1 = -e or -n
332 dnl So we use the following instead.
333 dnl SXE_SPACE(var, words)
334 AC_DEFUN([SXE_SPACE],[
336 for W in $2; do if test -z "$T"; then T="$W"; else T="$T $W"; fi; done
340 dnl SXE_CONSECUTIVE_UNDUP(var, words)
341 AC_DEFUN([SXE_CONSECUTIVE_UNDUP],[
342 $1=`echo "$2" | ${AWK-awk} 'BEGIN {RS=" "} {if([$]1[] != SXEL) {printf "%s ", [$]1[]} SXEL=[$]1[]}' `
343 ])dnl SXE_CONSECUTIVE_UNDUP
345 dnl SXE_UNDUP(var, words)
346 AC_DEFUN([SXE_UNDUP],[
347 $1=`echo "$2" | ${AWK-awk} 'BEGIN {RS=" "} {VAL=[$]1[]; if(VAL in SXEL){}else{printf "%s ", VAL} SXEL[[VAL]]=1}' `
351 AC_DEFUN([SXE_LANG_WERROR], [dnl
352 dnl like AC_LANG_WERROR but working
353 dnl call goes: SXE_LANG_WERROR([on|off|push|pop|push+off|push+on])
356 if test -n "$ac_c_werror_flag"; then
357 sxe_cv_aux_werror_stack="on $sxe_cv_aux_werror_stack"
359 sxe_cv_aux_werror_stack="off $sxe_cv_aux_werror_stack"
362 pushdef([tmpon], [ac_c_werror_flag="-Werror"])
363 pushdef([tmpoff], [ac_c_werror_flag=""])
365 m4_if([$1], [on], [tmpon])
367 m4_if([$1], [off], [tmpoff])
369 m4_if([$1], [push], [tmppush])
370 m4_if([$1], [push+off], [
374 m4_if([$1], [push+on], [
380 ## thanks for the tip, Aidan
381 $(echo $sxe_cv_aux_werror_stack | \
382 read sxe_cv_tmp_stackcar sxe_cv_aux_werror_stack)
383 if test "$sxe_cv_tmp_stackcar" = "on"; then
385 elif test "$sxe_cv_tmp_stackcar" = "off"; then
388 ## rather turn it off than on, dont ya think?
393 ])dnl SXE_LANG_WERROR
396 AC_DEFUN([SXE_DUMP_LIBS], [
397 save_c_switch_site="$c_switch_site"
399 save_ld_switch_site="$ld_switch_site"
400 save_ld_switch_machine="$ld_switch_machine"
402 save_CFLAGS="$CFLAGS"
403 save_CPPFLAGS="$CPPFLAGS"
404 save_LDFLAGS="$LDFLAGS"
406 SXE_LANG_WERROR([push])
409 AC_DEFUN([SXE_RESTORE_LIBS], [
411 c_switch_site="$save_c_switch_site"
412 ld_switch_site="$save_ld_switch_site"
413 ld_switch_machine="$save_ld_switch_machine"
415 CFLAGS="$save_CFLAGS"
416 CPPFLAGS="$save_CPPFLAGS"
417 LDFLAGS="$save_LDFLAGS"
419 SXE_LANG_WERROR([pop])
420 ])dnl SXE_RESTORE_LIBS
422 AC_DEFUN([SXE_SEARCH_CONFIG_PROG], [
423 ## arg #1 program to search
424 pushdef([config_prog], [$1])
425 pushdef([have_config_prog], [have_]translit([$1], [-.], [__]))
426 pushdef([CONFIG_PROG], translit([$1], [-.a-z], [__A-Z]))
427 AC_CHECK_PROG(have_config_prog, config_prog, [yes], [no])
428 AC_PATH_PROG(CONFIG_PROG, config_prog, [echo])
429 popdef([config_prog])
430 popdef([have_config_prog])
431 popdef([CONFIG_PROG])
432 ])dnl SXE_SEARCH_CONFIG_PROG
435 AC_DEFUN([_SXE_CHECK_pkgconfig_based], [
436 ## assumes $PKG_CONFIG is defined
437 ## arg #1: MM param name
438 ## arg #2: lib to check
439 ## arg #3: version of that lib
441 pushdef([IO_LIB], [$1])
443 AC_REQUIRE([SXE_CHECK_PKGCONFIG])
445 AC_MSG_CHECKING([for ]IO_LIB[ support])
448 if test "$have_pkg_config" = "no" -o -z "$PKG_CONFIG"; then
449 AS_MESSAGE([*** pkg-config not found. See http://pkgconfig.sourceforge.net])
450 AS_MESSAGE([*** Cannot check for ]IO_LIB[.])
455 pushdef([IO_MOD], [$2])
456 pushdef([IO_MOD_REQUIRED_VERSION], [$3])
457 AC_MSG_CHECKING([whether ]IO_MOD[ is at least ]IO_MOD_REQUIRED_VERSION)
458 if test -n "$PKG_CONFIG" && \
459 $PKG_CONFIG --atleast-version IO_MOD_REQUIRED_VERSION IO_MOD; then
460 IO_LIB[]_version=`$PKG_CONFIG --modversion []IO_MOD[]`
461 AC_MSG_RESULT([yes ($]IO_LIB[_version)])
462 have_[]IO_LIB[]_pkg="yes"
463 ## define some useful variables
464 IO_LIB[]_libs=`$PKG_CONFIG --libs []IO_MOD[]`
465 IO_LIB[]_libs_L=`$PKG_CONFIG --libs-only-L []IO_MOD[]`
466 IO_LIB[]_libs_l=`$PKG_CONFIG --libs-only-l []IO_MOD[]`
467 IO_LIB[]_libs_other=`$PKG_CONFIG --libs-only-other []IO_MOD[]`
468 IO_LIB[]_cflags=`$PKG_CONFIG --cflags []IO_MOD[]`
469 IO_LIB[]_cflags_I=`$PKG_CONFIG --cflags-only-I []IO_MOD[]`
470 IO_LIB[]_cflags_other=`$PKG_CONFIG --cflags-only-other []IO_MOD[]`
471 elif test -n "$PKG_CONFIG"; then
472 IO_LIB[]_version=`$PKG_CONFIG --modversion []IO_MOD[]`
473 AC_MSG_RESULT([no ($]IO_LIB[_version)])
474 have_[]IO_LIB[]_pkg="no"
476 have_[]IO_LIB[]_pkg="uncertain"
477 AC_MSG_RESULT([$have_]IO_LIB[])
480 popdef([IO_MOD_REQUIRED_VERSION])
482 ])dnl _SXE_CHECK_pkgconfig_based
484 AC_DEFUN([_SXE_MM_CHECK_pkgconfig_based], [
485 ## assumes $PKG_CONFIG is defined
486 ## arg #1: MM param name
487 ## arg #2: lib to check
488 ## arg #3: version of that lib
489 ## arg #4: funs to check
490 ## arg #5: headers to check
491 ## arg #6: success action
492 ## arg #7: failure action
494 pushdef([MM_LIB], [$1])
495 pushdef([MM_SUCC], [$6])
496 pushdef([MM_FAIL], [$7])
498 AC_REQUIRE([SXE_CHECK_PKGCONFIG])
500 AC_MSG_CHECKING([for ]MM_LIB[ support])
503 if test "$have_pkg_config" = "no" -o -z "$PKG_CONFIG"; then
504 AS_MESSAGE([*** pkg-config not found. See http://pkgconfig.sourceforge.net])
505 AS_MESSAGE([*** Cannot check for ]MM_LIB[.])
511 pushdef([MM_MOD], [$2])
512 pushdef([MM_MOD_REQUIRED_VERSION], [$3])
513 pushdef([MM_MOD_FUNS], [$4])
514 pushdef([MM_MOD_HDRS], [$5])
515 AC_MSG_CHECKING([whether ]MM_MOD[ is at least ]MM_MOD_REQUIRED_VERSION)
516 if test -n "$PKG_CONFIG" && \
517 $PKG_CONFIG --atleast-version MM_MOD_REQUIRED_VERSION MM_MOD; then
518 actual_version=`$PKG_CONFIG --modversion []MM_MOD[]`
519 AC_MSG_RESULT([yes ($actual_version)])
520 AC_MSG_CHECKING([for ]mm_lib[ libraries])
521 MM_MOD_LIBS_L=`$PKG_CONFIG --libs-only-l []MM_MOD[]`
522 MM_MOD_LIBS=`echo $MM_MOD_LIBS_L | sed -e "s/-l//g"`
523 MM_MOD_LIB=`echo $MM_MOD_LIBS | sed -e "s/ .*$//"`
524 MM_MOD_OTHER_LIBS=`echo $MM_MOD_LIBS_L | sed -e "s/^[^ ]*//"`
525 AC_MSG_RESULT([$MM_MOD_LIBS])
527 ## backup our site flags
529 MM_MOD_LIBS_SITE=`$PKG_CONFIG --libs-only-L []MM_MOD[]`
530 MM_MOD_HDRS_SITE=`$PKG_CONFIG --cflags-only-I []MM_MOD[]`
531 SXE_PREPEND_UNDUP([$MM_MOD_HDRS_SITE], [CPPFLAGS])
532 SXE_PREPEND_UNDUP([$MM_MOD_LIBS_SITE], [LDFLAGS])
535 SXE_CHECK_HEADERS([]MM_MOD_HDRS[], [:], [MM_FAIL])
536 for i in MM_MOD_FUNS; do
537 AC_CHECK_LIB([$MM_MOD_LIB], [$i], [:], [MM_FAIL],
541 ## restore old values
543 elif test -n "$PKG_CONFIG"; then
544 actual_version=`$PKG_CONFIG --modversion []MM_MOD[]`
545 AC_MSG_RESULT([no ($actual_version)])
547 AC_MSG_RESULT([uncertain])
550 popdef([MM_MOD_FUNS])
551 popdef([MM_MOD_HDRS])
552 popdef([MM_MOD_REQUIRED_VERSION])
556 ])dnl _SXE_MM_CHECK_pkgconfig_based
559 AC_DEFUN([SXE_CHECK_SUFFICIENCY], [dnl
560 ## arg #1 is the option to check sufficiency on
561 ## arg #2 is a description
562 ## arg #3 are additional actions to perform when support is sufficient
563 ## arg #4 are additional actions to perform when support is insufficient
564 pushdef([og_group], translit([$1], [-], [_]))
565 pushdef([og_descr], [$2])
566 pushdef([OG_GROUP], translit([$1], [-a-z], [_A-Z]))
567 pushdef([IF_YES_DO], [$3])
568 pushdef([IF_NO_DO], [$4])
570 tmp=${[have_]og_group[]-uncertain}
571 if test "$with_[]og_group" != "no"; then
572 AC_MSG_CHECKING([for sufficient ]og_descr[ support])
573 AC_MSG_RESULT([$tmp])
574 if test "$tmp" = "yes"; then
575 AC_DEFINE([HAVE_]OG_GROUP, [1],
576 [Whether ]og_descr[ is doable])
587 AM_CONDITIONAL([HAVE_]OG_GROUP,
588 [test "$have_[]og_group" = "yes" -a "$with_[]og_group" != "no"])
594 ])dnl SXE_CHECK_SUFFICIENCY
597 AC_DEFUN([SXE_CHECK_HEADERS], [dnl
598 dnl One day, this macro will only check for headers if
599 dnl their presence is yet unknown
600 AC_CHECK_HEADERS($1,$2,$3,$4)
601 ])dnl SXE_CHECK_HEADERS
603 AC_DEFUN([SXE_CHECK_LIB_FUNCS], [dnl
604 pushdef([SXE_LIB], [$1])
605 pushdef([SXE_FUNCS], [$2])
608 for j in SXE_FUNCS; do
609 AC_CHECK_LIB([$i], [$j], [:], [:])
615 ])dnl SXE_CHECK_LIB_FUNCS
618 AC_DEFUN([_SXE_CHECK_PURE_OPT], [dnl
619 unq_opt=$(echo $1 | tr -d "'\"")
622 ## first autoconf's options
623 --enable-largefile | --disable-largefile | \
624 --enable-dependency-tracking | --disable-dependency-tracking | \
625 --enable-option-checking | --disable-option-checking | \
626 --enable-silent-rules | --disable-silent-rules | \
627 --with-x | --x-includes | --x-libraries | \
629 --program-prefix | --program-suffix | --program-transform-name | \
630 --prefix | --exec-prefix | --bindir | --sbindir | \
631 --libexecdir | --sysconfdir | \
632 --sharedstatedir | --localstatedir | \
633 --libdir | --includedir | --oldincludedir | \
634 --datarootdir | --datadir | --infodir | --localedir | \
635 --mandir | --docdir | --htmldir | --dvidir | --pdfdir | --psdir | \
636 -n | --no-create | -C | --config-cache | --cache-file | \
637 -q | --quiet | --silent | --version )
638 AC_MSG_CHECKING([if option $1 is known])
642 ## now the hard-coded libtool ones
643 --enable-ltdl-install | --disable-ltdl-install | \
644 --enable-ltdl-convenience | --disable-ltdl-convenience | \
645 --enable-libtool-lock | --disable-libtool-lock | \
646 --enable-fast-install | --disable-fast-install | \
647 --enable-shared | --disable-shared | \
648 --enable-static | --disable-static | \
649 --with-gcc-arch | --with-pic | --with-included-ltdl )
650 AC_MSG_CHECKING([if option $1 is known])
655 --enable-* | --disable-* )
656 AC_MSG_CHECKING([if option $1 is known])
657 strp_opt=$(echo $unq_opt | \
658 sed -e "s/^--enable-//g" -e "s/^--disable-//g")
659 OG_CHECK_OPTION([enable], [$strp_opt],
660 AC_MSG_RESULT([yes]),
662 [bogus_cmd_opts="$bogus_cmd_opts $unq_opt"])
665 --with-* | --without-* )
666 AC_MSG_CHECKING([if option $1 is known])
667 strp_opt=$(echo $unq_opt | \
668 sed -e "s/^--with-//g" -e "s/^--without-//g")
669 OG_CHECK_OPTION([with], [$strp_opt],
670 AC_MSG_RESULT([yes]),
672 [bogus_cmd_opts="$bogus_cmd_opts $unq_opt"])
675 ## strange constructions
679 AC_MSG_CHECKING([if option $1 is known])
681 bogus_cmd_opts="$bogus_cmd_opts $unq_opt"
690 ])dnl _SXE_CHECK_PURE_OPT
692 AC_DEFUN([SXE_CHECK_COMMAND_LINE], [dnl
693 dnl Check for bogus options
694 sxe_with_options="$sxe_with_options x"
695 cmd_line_args="$ac_configure_args"
697 ## make sure our bogus stuff is empty once we get into here
698 ## this allows us to call this stuff more than once
699 ## (which never happens of course)
702 for opt in $cmd_line_args; do
703 pure_opt=$(echo $opt | sed -e "s/=.*$//g")
704 _SXE_CHECK_PURE_OPT([$pure_opt])
707 dnl Final command line argument checks.
708 dnl --with-quantify or --with-purify imply --with-system-malloc
709 if test "$with_purify" = "yes" -o "$with_quantify" = "yes"; then
710 if test "$with_system_malloc" = "default"; then
711 with_system_malloc="yes"
714 ])dnl SXE_CHECK_COMMAND_LINE
717 AC_DEFUN([SXE_EXPAND_VAR], [dnl
718 ## arg #1 the variable to expand
719 ## arg #2 (optional) the variable to put the result in
721 pushdef([RES], ifelse($2,[],[sxe_cv_tmp_expand_var],$2))
725 while test "${RES}" != "${__tmp}"; do
727 RES=$(eval echo ${__tmp})
734 dnl sxe-aux.m4 ends here