X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=m4%2Fpsi_const.m4;h=6b86d11e0b529106cad7810b0a8e0820cee1a38e;hp=79373d36a1da6d5eb82206bd4acd05c9d5293d5d;hb=77a446cbcdce6558c00066e5f13e43e8b1b18ff7;hpb=b1720af16e5d7765e2effcd16e23f351c2f82e54 diff --git a/m4/psi_const.m4 b/m4/psi_const.m4 index 79373d3..6b86d11 100644 --- a/m4/psi_const.m4 +++ b/m4/psi_const.m4 @@ -1,12 +1,18 @@ -# add_str_const(name, value) -add_str_const() { - cat >>$PSI_CONSTS <<<" {PSI_T_STRING, \"string\", \"psi\\\\$1\", $2, PSI_T_QUOTED_STRING}, " +# psi_add_str_const(name, value) +# Add a pre-defined string constant to $PSI_CONSTS +psi_add_str_const() { + grep -q "\"psi\\\\\\\\$1\"" $PSI_CONSTS || cat >>$PSI_CONSTS <<<" {PSI_T_STRING, \"string\", \"psi\\\\$1\", $2, PSI_T_QUOTED_STRING}, " } -# add_int_const(name, value) -add_int_const() { - cat >>$PSI_CONSTS <<<" {PSI_T_INT, \"int\", \"psi\\\\$1\", \"$2\", PSI_T_NUMBER}, " + +# psi_add_int_const(name, value) +# Add a pre-defined int constant to $PSI_CONSTS +psi_add_int_const() { + grep -q "\"psi\\\\\\\\$1\"" $PSI_CONSTS || cat >>$PSI_CONSTS <<<" {PSI_T_INT, \"int\", \"psi\\\\$1\", \"$2\", PSI_T_NUMBER}, " } + dnl PSI_CONST(const name, type) +dnl Check the value of a str/int constant and add it to the list of pre-defined +dnl constants. AC_DEFUN(PSI_CONST, [ AC_CACHE_CHECK(value of $1, psi_cv_const_$1, [ psi_const_val= @@ -29,10 +35,10 @@ AC_DEFUN(PSI_CONST, [ then case $2 in str*) - add_str_const "$1" "$psi_cv_const_$1" + psi_add_str_const "$1" "$psi_cv_const_$1" ;; int) - add_int_const "$1" "$psi_cv_const_$1" + psi_add_int_const "$1" "$psi_cv_const_$1" ;; esac fi