1 ## Portability defines that help interoperate with classic and modern autoconfs
3 define([GLIB_TR_SH],[AC_TR_SH([$1])])
4 define([GLIB_TR_CPP],[AC_TR_CPP([$1])])
7 [patsubst(translit([[$1]], [*+], [pp]), [[^a-zA-Z0-9_]], [_])])
9 [patsubst(translit([[$1]],
10 [*abcdefghijklmnopqrstuvwxyz],
11 [PABCDEFGHIJKLMNOPQRSTUVWXYZ]),
15 # GLIB_DIVERT_BEFORE_HELP(STUFF)
16 # Put STUFF early enough so that they are available for $ac_help expansion.
17 # Handle both classic (<= v2.13) and modern autoconf
19 [AC_DEFUN([GLIB_DIVERT_BEFORE_HELP],[AC_DIVERT([NOTICE],[$1])])],
20 [AC_DEFUN([GLIB_DIVERT_BEFORE_HELP],[dnl
21 AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
25 dnl GLIB_IF_VAR_EQ (ENV_VAR, VALUE [, EQUALS_ACTION] [, ELSE_ACTION])
26 AC_DEFUN(GLIB_IF_VAR_EQ,[
36 dnl GLIB_STR_CONTAINS (SRC_STRING, SUB_STRING [, CONTAINS_ACTION] [, ELSE_ACTION])
37 AC_DEFUN(GLIB_STR_CONTAINS,[
47 dnl GLIB_ADD_TO_VAR (ENV_VARIABLE, CHECK_STRING, ADD_STRING)
48 AC_DEFUN(GLIB_ADD_TO_VAR,[
49 GLIB_STR_CONTAINS($[$1], [$2], [$1]="$[$1]", [$1]="$[$1] [$3]")
52 dnl GLIB_SIZEOF (INCLUDES, TYPE, ALIAS [, CROSS-SIZE])
54 [pushdef([glib_Sizeof], GLIB_TR_SH([glib_cv_sizeof_$3]))dnl
55 AC_CACHE_CHECK([size of $2], glib_Sizeof,
56 [AC_TRY_RUN([#include <stdio.h>
64 FILE *f=fopen("conftestval", "w");
66 fprintf(f, "%d\n", sizeof($2));
69 [glib_Sizeof=`cat conftestval` dnl''
72 ifelse([$4], [], [], [glib_Sizeof=$4]))])
73 AC_DEFINE_UNQUOTED(GLIB_TR_CPP(glib_sizeof_$3), [$[]glib_Sizeof])
74 popdef([glib_Sizeof])dnl
77 dnl GLIB_BYTE_CONTENTS (INCLUDES, TYPE, ALIAS, N_BYTES, INITIALIZER)
78 AC_DEFUN(GLIB_BYTE_CONTENTS,
79 [pushdef([glib_ByteContents], GLIB_TR_SH([glib_cv_byte_contents_$3]))dnl
80 AC_CACHE_CHECK([byte contents of $5], glib_ByteContents,
81 [AC_TRY_RUN([#include <stdio.h>
86 char *p = (char*) &tv;
88 FILE *f=fopen("conftestval", "w");
90 for (i = 0; i < $4; i++)
91 fprintf(f, "%s%d", i?",":"", *(p++));
95 [glib_ByteContents=`cat conftestval` dnl''
97 [glib_ByteContents=no],
98 [glib_ByteContents=no])])
99 AC_DEFINE_UNQUOTED(GLIB_TR_CPP(glib_byte_contents_$3), [$[]glib_ByteContents])
100 popdef([glib_ByteContents])dnl
103 dnl GLIB_SYSDEFS (INCLUDES, DEFS_LIST, OFILE [, PREFIX])
104 AC_DEFUN(GLIB_SYSDEFS,
105 [glib_sysdefso="translit($3, [-_a-zA-Z0-9 *], [-_a-zA-Z0-9])"
106 glib_sysdef_msg=`echo $2 | sed 's/:[[^ ]]*//g'`
107 if test "x`(echo '\n') 2>/dev/null`" != 'x\n'; then
112 AC_MSG_CHECKING(system definitions for $glib_sysdef_msg)
113 cat >confrun.c <<_______EOF
116 int main (int c, char **v) {
117 FILE *f = fopen ("$glib_sysdefso", "a");
121 for glib_sysdef_input in $2 ; do
122 glib_sysdef=`echo $glib_sysdef_input | sed 's/^\([[^:]]*\):.*$/\1/'`
123 glib_default=`echo $glib_sysdef_input | sed 's/^[[^:]]*:\(.*\)$/\1/'`
124 echo "#ifdef $glib_sysdef" >>confrun.c
125 echo " fprintf (f, \"#define GLIB_SYSDEF_%s %s%d${glib_nl}\", \"$glib_sysdef\", \"$4\", $glib_sysdef);" >>confrun.c
126 echo "#else" >>confrun.c
127 if test $glib_sysdef != $glib_default; then
128 echo " fprintf (f, \"#define GLIB_SYSDEF_%s %s%d${glib_nl}\", \"$glib_sysdef\", \"$4\", $glib_default);" >>confrun.c
130 echo " fprintf (f, \"#define GLIB_SYSDEF_%s${glib_nl}\", \"$glib_sysdef\");" >>confrun.c
132 echo "#endif" >>confrun.c
134 echo "return 0; }" >>confrun.c
135 AC_TRY_RUN(`cat confrun.c`, AC_MSG_RESULT(done),
136 [ for glib_sysdef_input in $2 ; do
137 glib_sysdef=`echo $glib_sysdef_input | sed 's/^\([[^:]]*\):.*$/\1/'`
138 glib_default=`echo $glib_sysdef_input | sed 's/^[[^:]]*:\(.*\)$/\1/'`
139 if test $glib_sysdef != $glib_default; then
140 glib_default=" $4$glib_default"
144 echo "#define GLIB_SYSDEF_$glib_sysdef$glib_default" >>$glib_sysdefso
146 AC_MSG_RESULT(failed)])