From 998e1c178ce00d3d04657a2d967aa575e5a3b9b7 Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Fri, 26 Apr 2002 13:55:38 +0000 Subject: [PATCH] Add checking for syslog.h Enable multibyte support by default. Note that this is the first cut, and I'm gloing to remove #ifdef MULTIBYTE and others step by step... --- configure | 204 ++++++++++++++++++++++++++++++--------------------- configure.in | 38 ++-------- 2 files changed, 129 insertions(+), 113 deletions(-) diff --git a/configure b/configure index 6cc92cb3b1..1c6a0712c1 100755 --- a/configure +++ b/configure @@ -851,7 +851,6 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-integer-datetimes enable 64-bit integer date/time support --enable-recode enable character set recode support - --enable-multibyte enable multibyte character support --enable-nls[=LANGUAGES] enable Native Language Support --disable-shared do not build shared libraries --disable-rpath do not embed shared library search path in executables @@ -1655,73 +1654,12 @@ echo "${ECHO_T}$enable_recode" >&6 # # Multibyte support # -MULTIBYTE= -echo "$as_me:$LINENO: checking whether to build with multibyte character support" >&5 -echo $ECHO_N "checking whether to build with multibyte character support... $ECHO_C" >&6 - - - -# Check whether --enable-multibyte or --disable-multibyte was given. -if test "${enable_multibyte+set}" = set; then - enableval="$enable_multibyte" - - case $enableval in - yes) - MULTIBYTE=SQL_ASCII - ;; - no) - : - ;; - *) - enable_multibyte=yes - - case $enableval in - SQL_ASCII|EUC_JP|EUC_CN|EUC_KR|EUC_TW|JOHAB|UNICODE|MULE_INTERNAL|LATIN1|LATIN2|LATIN3|LATIN4|LATIN5|LATIN6|LATIN7|LATIN8|LATIN9|LATIN10|WIN1256|TCVN|WIN874|KOI8|WIN|ALT|ISO_8859_5|ISO_8859_6|ISO_8859_7|ISO_8859_8) - MULTIBYTE=$enableval;; - *) - { { echo "$as_me:$LINENO: error: argument to --enable-multibyte must be one of: - SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW, JOHAB, - UNICODE, MULE_INTERNAL, - LATIN1, LATIN2, LATIN3, LATIN4, LATIN5, - LATIN6, LATIN7, LATIN8, LATIN9, LATIN10, - WIN1256, TCVN, WIN874, KOI8, WIN, ALT, - ISO_8859_5, ISO_8859_6, ISO_8859_7, ISO_8859_8 -Or do not specify an argument to the option to use the default." >&5 -echo "$as_me: error: argument to --enable-multibyte must be one of: - SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW, JOHAB, - UNICODE, MULE_INTERNAL, - LATIN1, LATIN2, LATIN3, LATIN4, LATIN5, - LATIN6, LATIN7, LATIN8, LATIN9, LATIN10, - WIN1256, TCVN, WIN874, KOI8, WIN, ALT, - ISO_8859_5, ISO_8859_6, ISO_8859_7, ISO_8859_8 -Or do not specify an argument to the option to use the default." >&2;} - { (exit 1); exit 1; }; };; - esac - - ;; - esac - -else - enable_multibyte=no -fi; - - -if test "$enable_multibyte" = yes; then - +MULTIBYTE=SQL_ASCII cat >>confdefs.h <<\_ACEOF #define MULTIBYTE 1 _ACEOF - echo "$as_me:$LINENO: result: yes, default $MULTIBYTE" >&5 -echo "${ECHO_T}yes, default $MULTIBYTE" >&6 - -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - # @@ -5125,7 +5063,7 @@ echo "${ECHO_T}${python_libspec}" >&6 fi -## +v## ## Libraries ## @@ -12203,20 +12141,16 @@ echo "${ECHO_T}no" >&6 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -for ac_func in syslog -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then +echo "$as_me:$LINENO: checking for syslog" >&5 +echo $ECHO_N "checking for syslog... $ECHO_C" >&6 +if test "${ac_cv_func_syslog+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. */ + which can conflict with char syslog (); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -12224,7 +12158,7 @@ extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char $ac_func (); +char syslog (); char (*f) (); #ifdef F77_DUMMY_MAIN @@ -12239,10 +12173,10 @@ main () /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +#if defined (__stub_syslog) || defined (__stub___syslog) choke me #else -f = $ac_func; +f = syslog; #endif ; @@ -12261,23 +12195,127 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_cv_func_syslog=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -eval "$as_ac_var=no" +ac_cv_func_syslog=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +echo "$as_me:$LINENO: result: $ac_cv_func_syslog" >&5 +echo "${ECHO_T}$ac_cv_func_syslog" >&6 +if test $ac_cv_func_syslog = yes; then + if test "${ac_cv_header_syslog_h+set}" = set; then + echo "$as_me:$LINENO: checking for syslog.h" >&5 +echo $ECHO_N "checking for syslog.h... $ECHO_C" >&6 +if test "${ac_cv_header_syslog_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_syslog_h" >&5 +echo "${ECHO_T}$ac_cv_header_syslog_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking syslog.h usability" >&5 +echo $ECHO_N "checking syslog.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking syslog.h presence" >&5 +echo $ECHO_N "checking syslog.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: syslog.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: syslog.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: syslog.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: syslog.h: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: syslog.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: syslog.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: syslog.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: syslog.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: syslog.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: syslog.h: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for syslog.h" >&5 +echo $ECHO_N "checking for syslog.h... $ECHO_C" >&6 +if test "${ac_cv_header_syslog_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_syslog_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_syslog_h" >&5 +echo "${ECHO_T}$ac_cv_header_syslog_h" >&6 + +fi +if test $ac_cv_header_syslog_h = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_SYSLOG 1 _ACEOF fi -done + + +fi echo "$as_me:$LINENO: checking for optreset" >&5 diff --git a/configure.in b/configure.in index d3d53ee095..ce626a537b 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -dnl $Header: /cvsroot/pgsql/configure.in,v 1.181 2002/04/24 01:56:20 momjian Exp $ +dnl $Header: /cvsroot/pgsql/configure.in,v 1.182 2002/04/26 13:55:38 ishii Exp $ dnl Developers, please strive to achieve this order: dnl @@ -162,33 +162,8 @@ AC_MSG_RESULT([$enable_recode]) # # Multibyte support # -MULTIBYTE= -AC_MSG_CHECKING([whether to build with multibyte character support]) - -PGAC_ARG_OPTARG(enable, multibyte, [ --enable-multibyte enable multibyte character support], -[MULTIBYTE=SQL_ASCII], -[ - case $enableval in - SQL_ASCII|EUC_JP|EUC_CN|EUC_KR|EUC_TW|JOHAB|UNICODE|MULE_INTERNAL|LATIN1|LATIN2|LATIN3|LATIN4|LATIN5|LATIN6|LATIN7|LATIN8|LATIN9|LATIN10|WIN1256|TCVN|WIN874|KOI8|WIN|ALT|ISO_8859_5|ISO_8859_6|ISO_8859_7|ISO_8859_8) - MULTIBYTE=$enableval;; - *) - AC_MSG_ERROR( -[argument to --enable-multibyte must be one of: - SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW, JOHAB, - UNICODE, MULE_INTERNAL, - LATIN1, LATIN2, LATIN3, LATIN4, LATIN5, - LATIN6, LATIN7, LATIN8, LATIN9, LATIN10, - WIN1256, TCVN, WIN874, KOI8, WIN, ALT, - ISO_8859_5, ISO_8859_6, ISO_8859_7, ISO_8859_8 -Or do not specify an argument to the option to use the default.]);; - esac -], -[ - AC_DEFINE(MULTIBYTE, 1, [Set to 1 if you want to use multibyte characters (--enable-multibyte)]) - AC_MSG_RESULT([yes, default $MULTIBYTE]) -], -[AC_MSG_RESULT(no)]) - +MULTIBYTE=SQL_ASCII +AC_DEFINE(MULTIBYTE, 1, [Set to 1 if you want to use multibyte characters (--enable-multibyte)]) AC_SUBST(MULTIBYTE) # @@ -694,7 +669,7 @@ if test "$with_python" = yes; then fi -## +v## ## Libraries ## @@ -984,7 +959,10 @@ AC_TRY_LINK([#include ], AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]) -AC_CHECK_FUNCS([syslog]) +AC_CHECK_FUNC(syslog, + [AC_CHECK_HEADER(syslog.h, + [AC_DEFINE(HAVE_SYSLOG, 1, [])], + [])]) AC_CACHE_CHECK([for optreset], pgac_cv_var_int_optreset, [AC_TRY_LINK([#include ],