diff --git a/configure b/configure index b6c54338c1..906e9b33b3 100755 --- a/configure +++ b/configure @@ -866,6 +866,7 @@ Optional Packages: --with-krb5[=DIR] build with Kerberos 5 support [/usr/athena] --with-krb-srvnam=NAME name of the service principal in Kerberos postgres --with-pam build with PAM support + --with-rendezvous build with Rendezvous support --with-openssl[=DIR] build with OpenSSL support [/usr/local/ssl] --without-readline do not use Readline --without-zlib do not use Zlib @@ -3360,6 +3361,46 @@ echo "${ECHO_T}$with_pam" >&6 +# +# Rendezvous +# +echo "$as_me:$LINENO: checking whether to build with Rendezvous support" >&5 +echo $ECHO_N "checking whether to build with Rendezvous support... $ECHO_C" >&6 + + + +# Check whether --with-rendezvous or --without-rendezvous was given. +if test "${with_rendezvous+set}" = set; then + withval="$with_rendezvous" + + case $withval in + yes) + +cat >>confdefs.h <<\_ACEOF +#define USE_RENDEZVOUS 1 +_ACEOF + + ;; + no) + : + ;; + *) + { { echo "$as_me:$LINENO: error: no argument expected for --with-rendezvous option" >&5 +echo "$as_me: error: no argument expected for --with-rendezvous option" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + +else + with_rendezvous=no + +fi; + +echo "$as_me:$LINENO: result: $with_rendezvous" >&5 +echo "${ECHO_T}$with_rendezvous" >&6 + + + # # OpenSSL # @@ -9038,6 +9079,119 @@ fi done +fi + +if test "$with_rendezvous" = yes ; then + if test "${ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h+set}" = set; then + echo "$as_me:$LINENO: checking for DNSServiceDiscovery/DNSServiceDiscovery.h" >&5 +echo $ECHO_N "checking for DNSServiceDiscovery/DNSServiceDiscovery.h... $ECHO_C" >&6 +if test "${ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" >&5 +echo "${ECHO_T}$ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking DNSServiceDiscovery/DNSServiceDiscovery.h usability" >&5 +echo $ECHO_N "checking DNSServiceDiscovery/DNSServiceDiscovery.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 DNSServiceDiscovery/DNSServiceDiscovery.h presence" >&5 +echo $ECHO_N "checking DNSServiceDiscovery/DNSServiceDiscovery.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: DNSServiceDiscovery/DNSServiceDiscovery.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for DNSServiceDiscovery/DNSServiceDiscovery.h" >&5 +echo $ECHO_N "checking for DNSServiceDiscovery/DNSServiceDiscovery.h... $ECHO_C" >&6 +if test "${ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" >&5 +echo "${ECHO_T}$ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" >&6 + +fi +if test $ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h = yes; then + : +else + { { echo "$as_me:$LINENO: error: header file is required for Rendezvous" >&5 +echo "$as_me: error: header file is required for Rendezvous" >&2;} + { (exit 1); exit 1; }; } +fi + + fi @@ -17327,6 +17481,7 @@ s,@with_krb4@,$with_krb4,;t t s,@with_krb5@,$with_krb5,;t t s,@krb_srvtab@,$krb_srvtab,;t t s,@with_pam@,$with_pam,;t t +s,@with_rendezvous@,$with_rendezvous,;t t s,@with_openssl@,$with_openssl,;t t s,@ELF_SYS@,$ELF_SYS,;t t s,@THREAD_LIBS@,$THREAD_LIBS,;t t diff --git a/configure.in b/configure.in index f70d3d2f72..5881542a4c 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.257 2003/06/09 03:41:46 tgl Exp $ +dnl $Header: /cvsroot/pgsql/configure.in,v 1.258 2003/06/11 06:56:06 momjian Exp $ dnl dnl Developers, please strive to achieve this order: dnl @@ -471,6 +471,17 @@ AC_MSG_RESULT([$with_pam]) AC_SUBST(with_pam) +# +# Rendezvous +# +AC_MSG_CHECKING([whether to build with Rendezvous support]) +PGAC_ARG_BOOL(with, rendezvous, no, + [ --with-rendezvous build with Rendezvous support], + [AC_DEFINE([USE_RENDEZVOUS], 1, [Define to 1 to build with Rendezvous support. (--with-rendezvous)])]) +AC_MSG_RESULT([$with_rendezvous]) +AC_SUBST(with_rendezvous) + + # # OpenSSL # @@ -759,6 +770,10 @@ if test "$with_pam" = yes ; then [AC_MSG_ERROR([header file or is required for PAM.])])]) fi +if test "$with_rendezvous" = yes ; then + AC_CHECK_HEADER(DNSServiceDiscovery/DNSServiceDiscovery.h, [], [AC_MSG_ERROR([header file is required for Rendezvous])]) +fi + ## ## Types, structures, compiler characteristics diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml index 4a606bcdfb..1605199839 100644 --- a/doc/src/sgml/installation.sgml +++ b/doc/src/sgml/installation.sgml @@ -1,4 +1,4 @@ - + <![%standalone-include[<productname>PostgreSQL</>]]> @@ -270,8 +270,7 @@ JAVACMD=$JAVA_HOME/bin/java <listitem> <para> <application>Kerberos</>, <application>OpenSSL</>, or <application>PAM</>, - if you want to support - authentication using these services. + if you want to support authentication using these services. </para> </listitem> </itemizedlist> @@ -906,6 +905,15 @@ JAVACMD=$JAVA_HOME/bin/java </listitem> </varlistentry> + <varlistentry> + <term><option>--with-rendezvous</option></term> + <listitem> + <para> + Build with Rendezvous support. + </para> + </listitem> + </varlistentry> + <varlistentry> <term><option>--without-zlib</option></term> <listitem> diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index ef4266be53..5b16d06a99 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -37,7 +37,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.331 2003/05/28 19:36:28 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.332 2003/06/11 06:56:06 momjian Exp $ * * NOTES * @@ -85,6 +85,10 @@ #include <getopt.h> #endif +#ifdef USE_RENDEZVOUS +#include <DNSServiceDiscovery/DNSServiceDiscovery.h> +#endif + #include "catalog/pg_database.h" #include "commands/async.h" #include "lib/dllist.h" @@ -366,6 +370,17 @@ checkDataDir(const char *checkdir) } +#ifdef USE_RENDEZVOUS + +/* reg_reply -- empty callback function for DNSServiceRegistrationCreate() */ +static void +reg_reply(DNSServiceRegistrationReplyErrorType errorCode, void *context) +{ + +} + +#endif + int PostmasterMain(int argc, char *argv[]) { @@ -723,6 +738,18 @@ PostmasterMain(int argc, char *argv[]) else elog(LOG, "IPv4 socket created"); } +#endif +#ifdef USE_RENDEZVOUS + if (service_name != NULL) + { + DNSServiceRegistrationCreate(NULL, /* default to hostname */ + "_postgresql._tcp.", + "", + htonl(PostPortNumber), + "", + (DNSServiceRegistrationReply)reg_reply, + NULL); + } #endif } diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index bc6d89ada1..b20cecf194 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -564,6 +564,9 @@ /* Define to 1 to build with PAM support. (--with-pam) */ #undef USE_PAM +/* Define to 1 to build with Rendezvous support. (--with-rendezvous) */ +#undef USE_RENDEZVOUS + /* Define to build with (Open)SSL support. (--with-openssl) */ #undef USE_SSL