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 creates SXE_ADD_SXEUI_{OBJ,OBJS}
136 __SXE_MAKE_ADDER([SXEUIGTK], [libsxeuiGtk])
138 dnl SXE_ADD_STATMOD_A(foo.o ...)
139 AC_DEFUN([SXE_ADD_STATMOD_A], [
140 statmod_archives="$statmod_archives [$1]" && \
141 if test "$extra_verbose" = "yes"; then
142 echo " sxemacs (cat. static module) will be linked with \"[$1]\""
144 ])dnl SXE_ADD_STATMOD_A
145 AC_DEFUN([SXE_SUBST_STATMOD_A], [AC_SUBST(statmod_archives)])
147 dnl SXE_APPEND(value, varname)
148 AC_DEFUN([SXE_APPEND],
149 [SXE_CONSECUTIVE_UNDUP($2,"$[$2] [$1]")
150 if test "$extra_verbose" = "yes"; then
151 echo " Appending \"[$1]\" to [$2]
155 dnl SXE_PREPEND(value, varname)
156 AC_DEFUN([SXE_PREPEND],
157 [SXE_CONSECUTIVE_UNDUP($2,"[$1] $[$2]")
158 if test "$extra_verbose" = "yes"; then
159 echo " Prepending \"[$1]\" to [$2]
163 dnl SXE_APPEND(value, varname)
164 AC_DEFUN([SXE_APPEND_UNDUP],
165 [SXE_UNDUP($2,"$[$2] [$1]")
166 if test "$extra_verbose" = "yes"; then
167 echo " Appending and dedupping \"[$1]\" to [$2]
171 dnl SXE_PREPEND(value, varname)
172 AC_DEFUN([SXE_PREPEND_UNDUP],
173 [SXE_UNDUP($2,"[$1] $[$2]")
174 if test "$extra_verbose" = "yes"; then
175 echo " Prepending and dedupping \"[$1]\" to [$2]
180 AC_DEFUN([SXE_DIE], [{ echo "Error:" $1 >&2; exit 1; }])
184 AC_DEFUN([SXE_INIT_MSG_LEVEL], [
186 ])dnl SXE_INIT_MSG_LEVEL
188 AC_DEFUN([SXE_MSG_CHECKING], [
189 ## like AC_MSG_CHECKING but nestable
190 if test "$sxe_msg_level" -le 0; then
191 AC_MSG_CHECKING([$1])
193 sxe_msg_level=$(($sxe_msg_level + 1))
194 ])dnl SXE_MSG_CHECKING
196 AC_DEFUN([SXE_MSG_RESULT], [
197 ## like AC_MSG_RESULT but nestable
198 sxe_msg_level=$(($sxe_msg_level - 1))
199 if test "$sxe_msg_level" -le 0; then
204 dnl SXE_CHECK_FEATURE_DEPENDENCY(feature1, feature2)
205 AC_DEFUN([SXE_CHECK_FEATURE_DEPENDENCY],
206 [if test "$with_$1 $with_$2" = "yes no"; then
207 SXE_USAGE_ERROR("--with-$1 requires --with-$2")
208 elif test "$with_$2" = "no" ; then with_$1=no
209 elif test "$with_$1" = "yes"; then with_$2=yes
213 dnl SXE_STRIP_4TH_COMPONENT(var)
214 dnl Changes i986-pc-linux-gnu to i986-pc-linux, as God (not RMS) intended.
215 AC_DEFUN([SXE_STRIP_4TH_COMPONENT],
216 [$1=`echo "$$1" | sed '[s/^\([^-][^-]*-[^-][^-]*-[^-][^-]*\)-.*$/\1/]'`])
218 dnl AC_DEFUN([SXE_DEBUG_AC], [AS_MESSAGE($@)])
219 AC_DEFUN([SXE_DEBUG_AC], [])
221 dnl Do our best to deal with automounter brokenness
222 dnl SXE_CANONICALISE_PATH(varname)
223 AC_DEFUN([SXE_CANONICALISE_PATH], [dnl
224 ## arg #1 is the file/path to canonicalise
225 pushdef([tmpp], [$1])
227 SXE_DEBUG_AC([canonicalising \$]tmpp[: "]$[]tmpp["])
229 if test -d "/net"; then
230 if test -d "/tmp_mnt/net"; then
235 tmpp[]=$(echo "[$]tmpp[]" | \
236 sed -e "s|^${tdir}/|/net/|" \
238 -e "s|^/amd/|/net/|")
241 dnl if test -d "[$]tmpp"; then
242 dnl ## the easy way ...
243 dnl ## just let the filesystem implementation do the hard work
244 dnl tmpp[]=$(cd [$]tmpp[] && echo $(pwd))
245 dnl elif test -f "[$]tmpp"; then
246 dnl ## the easy way ...
247 dnl ## just let the filesystem implementation do the hard work
248 dnl tmpp[]=$(cd $(dirname [$]tmpp[]) && \
249 dnl echo $(pwd)/$(basename [$]tmpp[]))
253 while test "$canonicalised" = "no"; do
254 _SXE_CANONICALISE_STEP(tmpp,
255 [canonicalised="yes"], [canonicalised="no"])
259 SXE_DEBUG_AC([canonicalised \$]tmpp[: "]$[]tmpp["])
261 ])dnl SXE_CANONICALISE_PATH
263 AC_DEFUN([_SXE_CANONICALISE_STEP], [
264 ## _SXE_CANONICALISE_STEP( VAR, DO-ON-SUCCESS, DO-ON-FAILURE)
265 ## arg #1 is the varname to canonicalise
266 ## arg #2 is the code to execute on success
267 ## arg #3 is the code to execute on failure
268 pushdef([tmpvar], [$1])
269 pushdef([dosucc], [$2])
270 pushdef([dofail], [$3])
274 tmp4=$(basename "$tmp2")
275 ## assume we had success
277 while test "$tmp4" != "/" -a "$tmp4" != "."; do
278 if test "$tmp4" = ".." -a \
279 $(basename $(dirname "$tmp2")) = "."; then
280 ## we prepend and we know the path
281 ## is still dirty but wont do anything
282 ## alternative would be to prepend $(pwd) now
284 tmp3="$(basename $tmp2)/$tmp3"
285 elif test "$tmp4" = ".." -a \
286 $(basename $(dirname "$tmp2")) != ".."; then
287 tmp2=$(dirname "$tmp2")
288 elif test "$tmp4" = ".."; then
289 ## we prepend, but now we know the path
292 tmp3="$(basename $tmp2)/$tmp3"
293 elif test -n "$tmp3"; then
294 ## ordinary component, just prepend
295 tmp3="$(basename $tmp2)/$tmp3"
298 tmp3="$(basename $tmp2)"
300 tmp2=$(dirname "$tmp2")
301 tmp4=$(basename "$tmp2")
305 tmpvar[]=$(echo "$tmp3" | sed -e "s@//@/@g")
310 ])dnl _SXE_CANONICALISE_STEP
313 dnl SXE_PROTECT_LINKER_FLAGS(shell_var)
314 AC_DEFUN([SXE_PROTECT_LINKER_FLAGS], [
315 if test "$GCC" = "yes"; then
316 set x $[$1]; shift; [$1]=""
317 while test -n "[$]1"; do
319 -L | -l | -u ) [$1]="$[$1] [$]1 [$]2"; shift ;;
320 -L* | -l* | -u* | -Wl* | -pg ) [$1]="$[$1] [$]1" ;;
322 * ) [$1]="$[$1] -Xlinker [$]1" ;;
329 dnl Allow use of either ":" or spaces for lists of directories
330 AC_DEFUN([SXE_COLON_TO_SPACE],
331 [case "$[$1]" in *:* [)] [$1]="`echo '' $[$1] | sed -e 's/^ //' -e 's/:/ /g'`";; esac])dnl
334 dnl The construct foo=`echo $w1 $w2 $w3` fails on some systems if $w1 = -e or -n
335 dnl So we use the following instead.
336 dnl SXE_SPACE(var, words)
337 AC_DEFUN([SXE_SPACE],[
339 for W in $2; do if test -z "$T"; then T="$W"; else T="$T $W"; fi; done
343 dnl SXE_CONSECUTIVE_UNDUP(var, words)
344 AC_DEFUN([SXE_CONSECUTIVE_UNDUP],[
345 $1=`echo "$2" | awk -v RS=" " '{if([$]1[] != SXEL) {printf "%s ", [$]1[]} SXEL=[$]1[]}' `
346 ])dnl SXE_CONSECUTIVE_UNDUP
348 dnl SXE_UNDUP(var, words)
349 AC_DEFUN([SXE_UNDUP],[
350 $1=`echo "$2" | awk -v RS=" " '{VAL=[$]1[]; if(VAL in SXEL){}else{printf "%s ", VAL} SXEL[[VAL]]=1}' `
354 AC_DEFUN([SXE_LANG_WERROR], [dnl
355 dnl like AC_LANG_WERROR but working
356 dnl call goes: SXE_LANG_WERROR([on|off|push|pop|push+off|push+on])
359 if test -n "$ac_c_werror_flag"; then
360 sxe_cv_aux_werror_stack="on $sxe_cv_aux_werror_stack"
362 sxe_cv_aux_werror_stack="off $sxe_cv_aux_werror_stack"
365 pushdef([tmpon], [ac_c_werror_flag="-Werror"])
366 pushdef([tmpoff], [ac_c_werror_flag=""])
368 m4_if([$1], [on], [tmpon])
370 m4_if([$1], [off], [tmpoff])
372 m4_if([$1], [push], [tmppush])
373 m4_if([$1], [push+off], [
377 m4_if([$1], [push+on], [
383 ## thanks for the tip, Aidan
384 $(echo $sxe_cv_aux_werror_stack | \
385 read sxe_cv_tmp_stackcar sxe_cv_aux_werror_stack)
386 if test "$sxe_cv_tmp_stackcar" = "on"; then
388 elif test "$sxe_cv_tmp_stackcar" = "off"; then
391 ## rather turn it off than on, dont ya think?
396 ])dnl SXE_LANG_WERROR
399 AC_DEFUN([SXE_DUMP_LIBS], [
400 save_c_switch_site="$c_switch_site"
402 save_ld_switch_site="$ld_switch_site"
403 save_ld_switch_machine="$ld_switch_machine"
405 save_CFLAGS="$CFLAGS"
406 save_CPPFLAGS="$CPPFLAGS"
407 save_LDFLAGS="$LDFLAGS"
409 SXE_LANG_WERROR([push])
412 AC_DEFUN([SXE_RESTORE_LIBS], [
414 c_switch_site="$save_c_switch_site"
415 ld_switch_site="$save_ld_switch_site"
416 ld_switch_machine="$save_ld_switch_machine"
418 CFLAGS="$save_CFLAGS"
419 CPPFLAGS="$save_CPPFLAGS"
420 LDFLAGS="$save_LDFLAGS"
422 SXE_LANG_WERROR([pop])
423 ])dnl SXE_RESTORE_LIBS
425 AC_DEFUN([SXE_SEARCH_CONFIG_PROG], [
426 ## arg #1 program to search
427 pushdef([config_prog], [$1])
428 pushdef([have_config_prog], [have_]translit([$1], [-.], [__]))
429 pushdef([CONFIG_PROG], translit([$1], [-.a-z], [__A-Z]))
430 AC_CHECK_PROG(have_config_prog, config_prog, [yes], [no])
431 AC_PATH_PROG(CONFIG_PROG, config_prog, [echo])
432 popdef([config_prog])
433 popdef([have_config_prog])
434 popdef([CONFIG_PROG])
435 ])dnl SXE_SEARCH_CONFIG_PROG
438 AC_DEFUN([_SXE_CHECK_pkgconfig_based], [
439 ## assumes $PKG_CONFIG is defined
440 ## arg #1: MM param name
441 ## arg #2: lib to check
442 ## arg #3: version of that lib
444 pushdef([IO_LIB], [$1])
446 AC_REQUIRE([SXE_CHECK_PKGCONFIG])
448 AC_MSG_CHECKING([for ]IO_LIB[ support])
451 if test "$have_pkg_config" = "no" -o -z "$PKG_CONFIG"; then
452 AS_MESSAGE([*** pkg-config not found. See http://pkgconfig.sourceforge.net])
453 AS_MESSAGE([*** Cannot check for ]IO_LIB[.])
458 pushdef([IO_MOD], [$2])
459 pushdef([IO_MOD_REQUIRED_VERSION], [$3])
460 AC_MSG_CHECKING([whether ]IO_MOD[ is at least ]IO_MOD_REQUIRED_VERSION)
461 if test -n "$PKG_CONFIG" && \
462 $PKG_CONFIG --atleast-version IO_MOD_REQUIRED_VERSION IO_MOD; then
463 IO_LIB[]_version=`$PKG_CONFIG --modversion []IO_MOD[]`
464 AC_MSG_RESULT([yes ($]IO_LIB[_version)])
465 have_[]IO_LIB[]_pkg="yes"
466 ## define some useful variables
467 IO_LIB[]_libs=`$PKG_CONFIG --libs []IO_MOD[]`
468 IO_LIB[]_libs_L=`$PKG_CONFIG --libs-only-L []IO_MOD[]`
469 IO_LIB[]_libs_l=`$PKG_CONFIG --libs-only-l []IO_MOD[]`
470 IO_LIB[]_libs_other=`$PKG_CONFIG --libs-only-other []IO_MOD[]`
471 IO_LIB[]_cflags=`$PKG_CONFIG --cflags []IO_MOD[]`
472 IO_LIB[]_cflags_I=`$PKG_CONFIG --cflags-only-I []IO_MOD[]`
473 IO_LIB[]_cflags_other=`$PKG_CONFIG --cflags-only-other []IO_MOD[]`
474 elif test -n "$PKG_CONFIG"; then
475 IO_LIB[]_version=`$PKG_CONFIG --modversion []IO_MOD[]`
476 AC_MSG_RESULT([no ($]IO_LIB[_version)])
477 have_[]IO_LIB[]_pkg="no"
479 have_[]IO_LIB[]_pkg="uncertain"
480 AC_MSG_RESULT([$have_]IO_LIB[])
483 popdef([IO_MOD_REQUIRED_VERSION])
485 ])dnl _SXE_CHECK_pkgconfig_based
487 AC_DEFUN([_SXE_MM_CHECK_pkgconfig_based], [
488 ## assumes $PKG_CONFIG is defined
489 ## arg #1: MM param name
490 ## arg #2: lib to check
491 ## arg #3: version of that lib
492 ## arg #4: funs to check
493 ## arg #5: headers to check
494 ## arg #6: success action
495 ## arg #7: failure action
497 pushdef([MM_LIB], [$1])
498 pushdef([MM_SUCC], [$6])
499 pushdef([MM_FAIL], [$7])
501 AC_REQUIRE([SXE_CHECK_PKGCONFIG])
503 AC_MSG_CHECKING([for ]MM_LIB[ support])
506 if test "$have_pkg_config" = "no" -o -z "$PKG_CONFIG"; then
507 AS_MESSAGE([*** pkg-config not found. See http://pkgconfig.sourceforge.net])
508 AS_MESSAGE([*** Cannot check for ]MM_LIB[.])
514 pushdef([MM_MOD], [$2])
515 pushdef([MM_MOD_REQUIRED_VERSION], [$3])
516 pushdef([MM_MOD_FUNS], [$4])
517 pushdef([MM_MOD_HDRS], [$5])
518 AC_MSG_CHECKING([whether ]MM_MOD[ is at least ]MM_MOD_REQUIRED_VERSION)
519 if test -n "$PKG_CONFIG" && \
520 $PKG_CONFIG --atleast-version MM_MOD_REQUIRED_VERSION MM_MOD; then
521 actual_version=`$PKG_CONFIG --modversion []MM_MOD[]`
522 AC_MSG_RESULT([yes ($actual_version)])
523 AC_MSG_CHECKING([for ]mm_lib[ libraries])
524 MM_MOD_LIBS_L=`$PKG_CONFIG --libs-only-l []MM_MOD[]`
525 MM_MOD_LIBS=`echo $MM_MOD_LIBS_L | sed -e "s/-l//g"`
526 MM_MOD_LIB=`echo $MM_MOD_LIBS | sed -e "s/ .*$//"`
527 MM_MOD_OTHER_LIBS=`echo $MM_MOD_LIBS_L | sed -e "s/^[^ ]*//"`
528 AC_MSG_RESULT([$MM_MOD_LIBS])
530 ## backup our site flags
532 MM_MOD_LIBS_SITE=`$PKG_CONFIG --libs-only-L []MM_MOD[]`
533 MM_MOD_HDRS_SITE=`$PKG_CONFIG --cflags-only-I []MM_MOD[]`
534 SXE_PREPEND_UNDUP([$MM_MOD_HDRS_SITE], [CPPFLAGS])
535 SXE_PREPEND_UNDUP([$MM_MOD_LIBS_SITE], [LDFLAGS])
538 SXE_CHECK_HEADERS([]MM_MOD_HDRS[], [:], [MM_FAIL])
539 for i in MM_MOD_FUNS; do
540 AC_CHECK_LIB([$MM_MOD_LIB], [$i], [:], [MM_FAIL],
544 ## restore old values
546 elif test -n "$PKG_CONFIG"; then
547 actual_version=`$PKG_CONFIG --modversion []MM_MOD[]`
548 AC_MSG_RESULT([no ($actual_version)])
550 AC_MSG_RESULT([uncertain])
553 popdef([MM_MOD_FUNS])
554 popdef([MM_MOD_HDRS])
555 popdef([MM_MOD_REQUIRED_VERSION])
559 ])dnl _SXE_MM_CHECK_pkgconfig_based
562 AC_DEFUN([SXE_CHECK_SUFFICIENCY], [dnl
563 ## arg #1 is the option to check sufficiency on
564 ## arg #2 is a description
565 ## arg #3 are additional actions to perform when support is sufficient
566 ## arg #4 are additional actions to perform when support is insufficient
567 pushdef([og_group], translit([$1], [-], [_]))
568 pushdef([og_descr], [$2])
569 pushdef([OG_GROUP], translit([$1], [-a-z], [_A-Z]))
570 pushdef([IF_YES_DO], [$3])
571 pushdef([IF_NO_DO], [$4])
573 tmp=${[have_]og_group[]-uncertain}
574 if test "$with_[]og_group" != "no"; then
575 AC_MSG_CHECKING([for sufficient ]og_descr[ support])
576 AC_MSG_RESULT([$tmp])
577 if test "$tmp" = "yes"; then
578 AC_DEFINE([HAVE_]OG_GROUP, [1],
579 [Whether ]og_descr[ is doable])
590 AM_CONDITIONAL([HAVE_]OG_GROUP,
591 [test "$have_[]og_group" = "yes" -a "$with_[]og_group" != "no"])
597 ])dnl SXE_CHECK_SUFFICIENCY
600 AC_DEFUN([SXE_CHECK_HEADERS], [dnl
601 dnl One day, this macro will only check for headers if
602 dnl their presence is yet unknown
603 AC_CHECK_HEADERS($1,$2,$3,$4)
604 ])dnl SXE_CHECK_HEADERS
606 AC_DEFUN([SXE_CHECK_LIB_FUNCS], [dnl
607 pushdef([SXE_LIB], [$1])
608 pushdef([SXE_FUNCS], [$2])
611 for j in SXE_FUNCS; do
612 AC_CHECK_LIB([$i], [$j], [:], [:])
618 ])dnl SXE_CHECK_LIB_FUNCS
621 AC_DEFUN([_SXE_CHECK_PURE_OPT], [dnl
622 unq_opt=$(echo $1 | tr -d "'\"")
625 ## first autoconf's options
626 --enable-largefile | --disable-largefile | \
627 --enable-dependency-tracking | --disable-dependency-tracking | \
628 --enable-option-checking | --disable-option-checking | \
629 --with-x | --x-includes | --x-libraries | \
631 --program-prefix | --program-suffix | --program-transform-name | \
632 --prefix | --exec-prefix | --bindir | --sbindir | \
633 --libexecdir | --sysconfdir | \
634 --sharedstatedir | --localstatedir | \
635 --libdir | --includedir | --oldincludedir | \
636 --datarootdir | --datadir | --infodir | --localedir | \
637 --mandir | --docdir | --htmldir | --dvidir | --pdfdir | --psdir | \
638 -n | --no-create | -C | --config-cache | --cache-file | \
639 -q | --quiet | --silent | --version )
640 AC_MSG_CHECKING([if option $1 is known])
644 ## now the hard-coded libtool ones
645 --enable-ltdl-install | --disable-ltdl-install | \
646 --enable-ltdl-convenience | --disable-ltdl-convenience | \
647 --enable-libtool-lock | --disable-libtool-lock | \
648 --enable-fast-install | --disable-fast-install | \
649 --enable-shared | --disable-shared | \
650 --enable-static | --disable-static | \
651 --with-gcc-arch | --with-pic | --with-included-ltdl )
652 AC_MSG_CHECKING([if option $1 is known])
657 --enable-* | --disable-* )
658 AC_MSG_CHECKING([if option $1 is known])
659 strp_opt=$(echo $unq_opt | \
660 sed -e "s/^--enable-//g" -e "s/^--disable-//g")
661 OG_CHECK_OPTION([enable], [$strp_opt],
662 AC_MSG_RESULT([yes]),
664 [bogus_cmd_opts="$bogus_cmd_opts $unq_opt"])
667 --with-* | --without-* )
668 AC_MSG_CHECKING([if option $1 is known])
669 strp_opt=$(echo $unq_opt | \
670 sed -e "s/^--with-//g" -e "s/^--without-//g")
671 OG_CHECK_OPTION([with], [$strp_opt],
672 AC_MSG_RESULT([yes]),
674 [bogus_cmd_opts="$bogus_cmd_opts $unq_opt"])
677 ## strange constructions
681 AC_MSG_CHECKING([if option $1 is known])
683 bogus_cmd_opts="$bogus_cmd_opts $unq_opt"
692 ])dnl _SXE_CHECK_PURE_OPT
694 AC_DEFUN([SXE_CHECK_COMMAND_LINE], [dnl
695 dnl Check for bogus options
696 sxe_with_options="$sxe_with_options x"
697 cmd_line_args="$ac_configure_args"
699 ## make sure our bogus stuff is empty once we get into here
700 ## this allows us to call this stuff more than once
701 ## (which never happens of course)
704 for opt in $cmd_line_args; do
705 pure_opt=$(echo $opt | sed -e "s/=.*$//g")
706 _SXE_CHECK_PURE_OPT([$pure_opt])
709 dnl Final command line argument checks.
710 dnl --with-quantify or --with-purify imply --with-system-malloc
711 if test "$with_purify" = "yes" -o "$with_quantify" = "yes"; then
712 if test "$with_system_malloc" = "default"; then
713 with_system_malloc="yes"
716 ])dnl SXE_CHECK_COMMAND_LINE
719 AC_DEFUN([SXE_EXPAND_VAR], [dnl
720 ## arg #1 the variable to expand
721 ## arg #2 (optional) the variable to put the result in
723 pushdef([RES], ifelse($2,[],[sxe_cv_tmp_expand_var],$2))
727 while test "${RES}" != "${__tmp}"; do
729 RES=$(eval echo ${__tmp})
736 dnl sxe-aux.m4 ends here