2000-10-09 23:06:01 +02:00
|
|
|
## Portability defines that help interoperate with classic and modern autoconfs
|
|
|
|
ifdef([AC_TR_SH],[
|
|
|
|
define([GLIB_TR_SH],[AC_TR_SH([$1])])
|
|
|
|
define([GLIB_TR_CPP],[AC_TR_CPP([$1])])
|
|
|
|
], [
|
|
|
|
define([GLIB_TR_SH],
|
|
|
|
[patsubst(translit([[$1]], [*+], [pp]), [[^a-zA-Z0-9_]], [_])])
|
|
|
|
define([GLIB_TR_CPP],
|
|
|
|
[patsubst(translit([[$1]],
|
|
|
|
[*abcdefghijklmnopqrstuvwxyz],
|
|
|
|
[PABCDEFGHIJKLMNOPQRSTUVWXYZ]),
|
|
|
|
[[^A-Z0-9_]], [_])])
|
|
|
|
])
|
|
|
|
|
|
|
|
# GLIB_DIVERT_BEFORE_HELP(STUFF)
|
|
|
|
# Put STUFF early enough so that they are available for $ac_help expansion.
|
|
|
|
# Handle both classic (<= v2.13) and modern autoconf
|
|
|
|
ifdef([AC_DIVERT],
|
|
|
|
[AC_DEFUN([GLIB_DIVERT_BEFORE_HELP],[AC_DIVERT([NOTICE],[$1])])],
|
|
|
|
[AC_DEFUN([GLIB_DIVERT_BEFORE_HELP],[dnl
|
|
|
|
AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
|
|
|
|
$1
|
|
|
|
AC_DIVERT_POP()])])
|
|
|
|
|
1998-12-19 03:13:34 +01:00
|
|
|
dnl GLIB_IF_VAR_EQ (ENV_VAR, VALUE [, EQUALS_ACTION] [, ELSE_ACTION])
|
|
|
|
AC_DEFUN(GLIB_IF_VAR_EQ,[
|
|
|
|
case "$[$1]" in
|
|
|
|
"[$2]"[)]
|
|
|
|
[$3]
|
|
|
|
;;
|
|
|
|
*[)]
|
|
|
|
[$4]
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
dnl GLIB_STR_CONTAINS (SRC_STRING, SUB_STRING [, CONTAINS_ACTION] [, ELSE_ACTION])
|
|
|
|
AC_DEFUN(GLIB_STR_CONTAINS,[
|
|
|
|
case "[$1]" in
|
|
|
|
*"[$2]"*[)]
|
|
|
|
[$3]
|
|
|
|
;;
|
|
|
|
*[)]
|
|
|
|
[$4]
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
dnl GLIB_ADD_TO_VAR (ENV_VARIABLE, CHECK_STRING, ADD_STRING)
|
|
|
|
AC_DEFUN(GLIB_ADD_TO_VAR,[
|
|
|
|
GLIB_STR_CONTAINS($[$1], [$2], [$1]="$[$1]", [$1]="$[$1] [$3]")
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl GLIB_SIZEOF (INCLUDES, TYPE, ALIAS [, CROSS-SIZE])
|
|
|
|
AC_DEFUN(GLIB_SIZEOF,
|
2000-10-09 23:06:01 +02:00
|
|
|
[pushdef([glib_Sizeof], GLIB_TR_SH([glib_cv_sizeof_$3]))dnl
|
|
|
|
AC_CACHE_CHECK([size of $2], glib_Sizeof,
|
1998-12-19 03:13:34 +01:00
|
|
|
[AC_TRY_RUN([#include <stdio.h>
|
2000-07-26 05:18:27 +02:00
|
|
|
#if STDC_HEADERS
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#endif
|
1998-12-19 03:13:34 +01:00
|
|
|
$1
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
FILE *f=fopen("conftestval", "w");
|
|
|
|
if (!f) exit(1);
|
|
|
|
fprintf(f, "%d\n", sizeof($2));
|
|
|
|
exit(0);
|
2000-10-09 23:06:01 +02:00
|
|
|
}],
|
|
|
|
[glib_Sizeof=`cat conftestval` dnl''
|
|
|
|
],
|
|
|
|
[glib_Sizeof=0],
|
|
|
|
ifelse([$4], [], [], [glib_Sizeof=$4]))])
|
2000-10-16 03:02:19 +02:00
|
|
|
AC_DEFINE_UNQUOTED(GLIB_TR_CPP(glib_sizeof_$3), [$[]glib_Sizeof], [Size of $3])
|
2000-10-09 23:06:01 +02:00
|
|
|
popdef([glib_Sizeof])dnl
|
1998-12-19 03:13:34 +01:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl GLIB_BYTE_CONTENTS (INCLUDES, TYPE, ALIAS, N_BYTES, INITIALIZER)
|
|
|
|
AC_DEFUN(GLIB_BYTE_CONTENTS,
|
2000-10-09 23:06:01 +02:00
|
|
|
[pushdef([glib_ByteContents], GLIB_TR_SH([glib_cv_byte_contents_$3]))dnl
|
|
|
|
AC_CACHE_CHECK([byte contents of $5], glib_ByteContents,
|
1998-12-19 03:13:34 +01:00
|
|
|
[AC_TRY_RUN([#include <stdio.h>
|
|
|
|
$1
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
static $2 tv = $5;
|
|
|
|
char *p = (char*) &tv;
|
|
|
|
int i;
|
|
|
|
FILE *f=fopen("conftestval", "w");
|
1998-12-19 04:44:30 +01:00
|
|
|
if (!f) exit(1);
|
1998-12-19 03:13:34 +01:00
|
|
|
for (i = 0; i < $4; i++)
|
|
|
|
fprintf(f, "%s%d", i?",":"", *(p++));
|
|
|
|
fprintf(f, "\n");
|
|
|
|
exit(0);
|
2000-10-09 23:06:01 +02:00
|
|
|
}],
|
|
|
|
[glib_ByteContents=`cat conftestval` dnl''
|
|
|
|
],
|
|
|
|
[glib_ByteContents=no],
|
|
|
|
[glib_ByteContents=no])])
|
2000-10-16 03:02:19 +02:00
|
|
|
AC_DEFINE_UNQUOTED(GLIB_TR_CPP(glib_byte_contents_$3), [$[]glib_ByteContents],
|
|
|
|
[Byte contents of $3])
|
2000-10-09 23:06:01 +02:00
|
|
|
popdef([glib_ByteContents])dnl
|
1998-12-19 03:13:34 +01:00
|
|
|
])
|
1998-12-19 04:44:30 +01:00
|
|
|
|
|
|
|
dnl GLIB_SYSDEFS (INCLUDES, DEFS_LIST, OFILE [, PREFIX])
|
|
|
|
AC_DEFUN(GLIB_SYSDEFS,
|
|
|
|
[glib_sysdefso="translit($3, [-_a-zA-Z0-9 *], [-_a-zA-Z0-9])"
|
1998-12-26 04:58:06 +01:00
|
|
|
glib_sysdef_msg=`echo $2 | sed 's/:[[^ ]]*//g'`
|
1999-01-05 00:37:40 +01:00
|
|
|
if test "x`(echo '\n') 2>/dev/null`" != 'x\n'; then
|
|
|
|
glib_nl='\\n'
|
|
|
|
else
|
|
|
|
glib_nl='\n'
|
|
|
|
fi
|
1998-12-26 04:58:06 +01:00
|
|
|
AC_MSG_CHECKING(system definitions for $glib_sysdef_msg)
|
1998-12-19 04:44:30 +01:00
|
|
|
cat >confrun.c <<_______EOF
|
|
|
|
#include <stdio.h>
|
|
|
|
$1
|
|
|
|
int main (int c, char **v) {
|
|
|
|
FILE *f = fopen ("$glib_sysdefso", "a");
|
|
|
|
if (!f) return 1;
|
|
|
|
_______EOF
|
1998-12-26 04:58:06 +01:00
|
|
|
for glib_sysdef_input in $2 ; do
|
|
|
|
glib_sysdef=`echo $glib_sysdef_input | sed 's/^\([[^:]]*\):.*$/\1/'`
|
|
|
|
glib_default=`echo $glib_sysdef_input | sed 's/^[[^:]]*:\(.*\)$/\1/'`
|
|
|
|
echo "#ifdef $glib_sysdef" >>confrun.c
|
1999-01-05 00:37:40 +01:00
|
|
|
echo " fprintf (f, \"#define GLIB_SYSDEF_%s %s%d${glib_nl}\", \"$glib_sysdef\", \"$4\", $glib_sysdef);" >>confrun.c
|
1998-12-26 04:58:06 +01:00
|
|
|
echo "#else" >>confrun.c
|
|
|
|
if test $glib_sysdef != $glib_default; then
|
1999-01-05 00:37:40 +01:00
|
|
|
echo " fprintf (f, \"#define GLIB_SYSDEF_%s %s%d${glib_nl}\", \"$glib_sysdef\", \"$4\", $glib_default);" >>confrun.c
|
1998-12-26 04:58:06 +01:00
|
|
|
else
|
1999-01-05 00:37:40 +01:00
|
|
|
echo " fprintf (f, \"#define GLIB_SYSDEF_%s${glib_nl}\", \"$glib_sysdef\");" >>confrun.c
|
1998-12-26 04:58:06 +01:00
|
|
|
fi
|
|
|
|
echo "#endif" >>confrun.c
|
1998-12-19 04:44:30 +01:00
|
|
|
done
|
|
|
|
echo "return 0; }" >>confrun.c
|
|
|
|
AC_TRY_RUN(`cat confrun.c`, AC_MSG_RESULT(done),
|
1998-12-26 04:58:06 +01:00
|
|
|
[ for glib_sysdef_input in $2 ; do
|
|
|
|
glib_sysdef=`echo $glib_sysdef_input | sed 's/^\([[^:]]*\):.*$/\1/'`
|
|
|
|
glib_default=`echo $glib_sysdef_input | sed 's/^[[^:]]*:\(.*\)$/\1/'`
|
|
|
|
if test $glib_sysdef != $glib_default; then
|
|
|
|
glib_default=" $4$glib_default"
|
|
|
|
else
|
|
|
|
glib_default=
|
|
|
|
fi
|
|
|
|
echo "#define GLIB_SYSDEF_$glib_sysdef$glib_default" >>$glib_sysdefso
|
1998-12-19 04:44:30 +01:00
|
|
|
done
|
1998-12-26 04:58:06 +01:00
|
|
|
AC_MSG_RESULT(failed)])
|
1998-12-19 04:44:30 +01:00
|
|
|
rm -f confrun.c
|
|
|
|
])
|