[gq-commit] gq configure.in,1.46,1.47
Status: Beta
Brought to you by:
sur5r
From: <sta...@us...> - 2003-10-05 13:57:32
|
Update of /cvsroot/gqclient/gq In directory sc8-pr-cvs1:/tmp/cvs-serv10638 Modified Files: configure.in Log Message: * more UTF-8 related functions get checked for * checking both snprintf and g_snprintf for reorderable arguments * Check if snprintf follows the C99 standard or not * Removing redundant -I options from CPPFLAGS and CFLAGS, I hope it works. It shortens the compiler commandline considerably. I like it like this. Index: configure.in =================================================================== RCS file: /cvsroot/gqclient/gq/configure.in,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** configure.in 4 Oct 2003 10:18:13 -0000 1.46 --- configure.in 5 Oct 2003 13:57:19 -0000 1.47 *************** *** 188,196 **** ,[#include <glib/gunicode.h>]) ! AC_CHECK_FUNCS(g_unichar_isspace g_unichar_isdigit) ! AC_CHECK_LIB(xml2, xmlSAXUserParseFile, [AC_DEFINE(HAVE_LIBXML2,,[Define if libxml2 is available on your system]) XML_CFLAGS=`$PKG_CONFIG --cflags libxml-2.0` --- 188,196 ---- ,[#include <glib/gunicode.h>]) ! AC_CHECK_FUNCS(g_unichar_isspace g_unichar_isdigit g_utf8_strchr g_string_append_unichar g_string_new_len) ! AC_CHECK_LIB(xml2, xmlCreateIOParserCtxt, [AC_DEFINE(HAVE_LIBXML2,,[Define if libxml2 is available on your system]) XML_CFLAGS=`$PKG_CONFIG --cflags libxml-2.0` *************** *** 204,227 **** LIBS="-lxml $LIBS"]) - - - - - - - - - - - - - - - - - - - - DEBUG=1 AC_ARG_ENABLE(debugging, --- 204,207 ---- *************** *** 511,541 **** dnl in i18n message catalogs) ! AC_CACHE_CHECK([reorderable printf arguments], gq_cv_print_reordering, ! [ ! AC_TRY_RUN([ ! #include <stdio.h> ! #include <string.h> ! int main(int argc, char **argv) { ! char buf[80]; ! sprintf(buf, "%2\$d %1\$d", 1, 2); ! if (strcmp(buf, "2 1") == 0) ! return 0; ! return 1; ! } ! ], ! gq_cv_print_reordering=yes, ! gq_cv_print_reordering=no, ! gq_cv_print_reordering=no ! ) ! ] ! ) ! if test "$gq_cv_print_reordering" = no ; then ! AC_CHECK_FUNC(g_snprintf, [HAVE_G_SNPRINTF=1]) ! AC_CHECK_FUNCS(g_printf g_sprintf) ! if test "x$HAVE_G_SNPRINTF" != "x" ; then ! gq_cv_print_reordering=yes ! AC_DEFINE(USE_G_PRINTF,1,[Define if the standard C *printf functions should be replaced their glib versions]) fi --- 491,523 ---- dnl in i18n message catalogs) ! for PRINTF in snprintf g_snprintf; do ! AC_CACHE_CHECK([reorderable $PRINTF arguments], gq_cv_${PRINTF}_reordering, ! [ ! AC_TRY_RUN([ ! #include <stdio.h> ! #include <string.h> ! int main(int argc, char **argv) { ! char buf[80]; ! $PRINTF(buf, sizeof(buf), "%2\$d %1\$d", 1, 2); ! if (strcmp(buf, "2 1") == 0) ! return 0; ! return 1; ! } ! ], ! eval "gq_cv_${PRINTF}_reordering=yes", ! eval "gq_cv_${PRINTF}_reordering=no", ! eval "gq_cv_${PRINTF}_reordering=no" ! ) ! ] ! ) ! done ! if test "$gq_cv_snprintf_reordering" = no ; then ! dnl AC_CHECK_FUNC(g_snprintf, [HAVE_G_SNPRINTF=1]) ! dnl AC_CHECK_FUNCS(g_printf g_sprintf) ! if test "gq_cv_g_snprintf_reordering" == "yes" ; then ! gq_cv_snprintf_reordering=yes ! AC_DEFINE(USE_G_SNPRINTF,1,[Define if the standard C snprintf function should be replaced its glib version]) fi *************** *** 580,585 **** --- 562,647 ---- fi + + + + + AC_CACHE_CHECK([if snprinf follow the C99 standard], gq_cv_c99_snprintf, + [ + AC_TRY_RUN([ + #include <stdio.h> + #include <string.h> + int main(int argc, char **argv) { + char buf[4]; + size_t rc; + rc = snprintf(buf, 4, "12345"); + if (rc == 6) return 0; + return 1; + } + ], + gq_cv_c99_snprintf=yes, + gq_cv_c99_snprintf=no, + gq_cv_c99_snprintf=no + ) + ] + ) + if test "$gq_cv_c99_snprintf" = yes ; then + AC_DEFINE(HAVE_C99_SNPRINTF,1, + [Define if the standard C snprintf function behaves C99 conformant]) + fi + + + + + + + + + + + + + + + + + + + + + dnl delay this assignment for as long as possible to not interfere with tests CFLAGS="$CFLAGS -DLOCALEDIR=\\\"$localedir\\\"" + + # clean up CPPFLAGS and CFLAGS + + INCLS="" + + AC_MSG_NOTICE([removing redundant -I options from CPPFLAGS and CFLAGS]) + + for META in CPPFLAGS CFLAGS ; do + FLAGS="" + for CF in `eval 'echo $'$META`; do + case "$CF" in + -I*) for IN in $INCLS ; do + if test "$IN" = "$CF" ; then + # double -I detected + AC_MSG_NOTICE([removing multiply used $CF from $META]) + CF= + break; + fi + done + if test "x$CF" != x ; then + INCLS="$INCLS $CF" + fi + ;; + + *) : ;; + esac + if test "x$CF" != x ; then + FLAGS="$FLAGS $CF" + fi + done + eval "$META='$FLAGS'" + done AC_OUTPUT([ |