8000 Do not link in libwsock32 on non-win32 platforms. Improve grammar · codeimmortal/postgres@cae912d · GitHub
[go: up one dir, main page]

Skip to content

Commit cae912d

Browse files
committed
Do not link in libwsock32 on non-win32 platforms. Improve grammar
of thread-safety comments.
1 parent 7078441 commit cae912d

File tree

3 files changed

+96
-79
lines changed

3 files changed

+96
-79
lines changed

configure

Lines changed: 72 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ Optional Features:
844844
--enable-debug build with debugging symbols (-g)
845845
--enable-depend turn on automatic dependency tracking
846846
--enable-cassert enable assertion checks (for debugging)
847-
--enable-thread-safety allow libpq and ecpg to be thread-safe
847+
--enable-thread-safety make client libraries thread-safe
848848
--disable-largefile omit support for large files
849849

850850
Optional Packages:
@@ -1381,7 +1381,7 @@ echo "$as_me: error: '$withval' is not a valid template name. Use 'list' for a l
13811381

13821382
else
13831383

1384-
# --with-template not given
1384+
# --with-template not given
13851385

13861386
case $host_os in
13871387
aix*) template=aix ;;
@@ -2354,9 +2354,13 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
23542354
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
23552355
ac_compiler_gnu=$ac_cv_c_compiler_gnu
23562356

2357+
2358+
#
23572359
# Read the template
2360+
#
23582361
. "$srcdir/src/template/$template" || exit
23592362

2363+
# adjust CFLAGS per template
23602364
if test "$ac_env_CFLAGS_set" = set; then
23612365
CFLAGS=$ac_env_CFLAGS_value
23622366
fi
@@ -2773,10 +2777,10 @@ done
27732777
IFS=$ac_save_IFS
27742778

27752779
#
2776-
# Enable libpq to be thread-safety
2780+
# Enable thread-safe client libraries
27772781
#
2778-
echo "$as_me:$LINENO: checking allow thread-safe libpq and ecpg" >&5
2779-
echo $ECHO_N "checking allow thread-safe libpq and ecpg... $ECHO_C" >&6
2782+
echo "$as_me:$LINENO: checking allow thread-safe client libraries" >&5
2783+
echo $ECHO_N "checking allow thread-safe client libraries... $ECHO_C" >&6
27802784

27812785

27822786
# Check whether --enable-thread-safety or --disable-thread-safety was given.
@@ -5294,65 +5298,6 @@ _ACEOF
52945298

52955299
fi
52965300

5297-
5298-
echo "$as_me:$LINENO: checking for main in -lwsock32" >&5
5299-
echo $ECHO_N "checking for main in -lwsock32... $ECHO_C" >&6
5300-
if test "${ac_cv_lib_wsock32_main+set}" = set; then
5301-
echo $ECHO_N "(cached) $ECHO_C" >&6
5302-
else
5303-
ac_check_lib_save_LIBS=$LIBS
5304-
LIBS="-lwsock32 $LIBS"
5305-
cat >conftest.$ac_ext <<_ACEOF
5306-
#line $LINENO "configure"
5307-
#include "confdefs.h"
5308-
5309-
5310-
#ifdef F77_DUMMY_MAIN
5311-
# ifdef __cplusplus
5312-
extern "C"
5313-
# endif
5314-
int F77_DUMMY_MAIN() { return 1; }
5315-
#endif
5316-
int
5317-
main ()
5318-
{
5319-
main ();
5320-
;
5321-
return 0;
5322-
}
5323-
_ACEOF
5324-
rm -f conftest.$ac_objext conftest$ac_exeext
5325-
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
5326-
(eval $ac_link) 2>&5
5327-
ac_status=$?
5328-
echo "$as_me:$LINENO: \$? = $ac_status" >&5
5329-
(exit $ac_status); } &&
5330-
{ ac_try='test -s conftest$ac_exeext'
5331-
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
5332-
(eval $ac_try) 2>&5
5333-
ac_status=$?
5334-
echo "$as_me:$LINENO: \$? = $ac_status" >&5
5335-
(exit $ac_status); }; }; then
5336-
ac_cv_lib_wsock32_main=yes
5337-
else
5338-
echo "$as_me: failed program was:" >&5
5339-
cat conftest.$ac_ext >&5
5340-
ac_cv_lib_wsock32_main=no
5341-
fi
5342-
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
5343-
LIBS=$ac_check_lib_save_LIBS
5344-
fi
5345-
echo "$as_me:$LINENO: result: $ac_cv_lib_wsock32_main" >&5
5346-
echo "${ECHO_T}$ac_cv_lib_wsock32_main" >&6
5347-
if test $ac_cv_lib_wsock32_main = yes; then
5348-
cat >>confdefs.h <<_ACEOF
5349-
#define HAVE_LIBWSOCK32 1
5350-
_ACEOF
5351-
5352-
LIBS="-lwsock32 $LIBS"
5353-
5354-
fi
5355-
53565301
echo "$as_me:$LINENO: checking for library containing getopt_long" >&5
53575302
echo $ECHO_N "checking for library containing getopt_long... $ECHO_C" >&6
53585303
if test "${ac_cv_search_getopt_long+set}" = set; then
@@ -5873,6 +5818,69 @@ _ACEOF
58735818

58745819
fi
58755820

5821+
# WIN32:
5822+
if test "$PORTNAME" = "win32"
5823+
then
5824+
5825+
echo "$as_me:$LINENO: checking for main in -lwsock32" >&5
5826+
echo $ECHO_N "checking for main in -lwsock32... $ECHO_C" >&6
5827+
if test "${ac_cv_lib_wsock32_main+set}" = set; then
5828+
echo $ECHO_N "(cached) $ECHO_C" >&6
5829+
else
5830+
ac_check_lib_save_LIBS=$LIBS
5831+
LIBS="-lwsock32 $LIBS"
5832+
cat >conftest.$ac_ext <<_ACEOF
5833+
#line $LINENO "configure"
5834+
#include "confdefs.h"
5835+
5836+
5837+
#ifdef F77_DUMMY_MAIN
5838+
# ifdef __cplusplus
5839+
extern "C"
5840+
# endif
5841+
int F77_DUMMY_MAIN() { return 1; }
5842+
#endif
5843+
int
5844+
main ()
5845+
{
5846+
main ();
5847+
;
5848+
return 0;
5849+
}
5850+
_ACEOF
5851+
rm -f conftest.$ac_objext conftest$ac_exeext
5852+
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
5853+
(eval $ac_link) 2>&5
5854+
ac_status=$?
5855+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
5856+
(exit $ac_status); } &&
5857+
{ ac_try='test -s conftest$ac_exeext'
5858+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
5859+
(eval $ac_try) 2>&5
5860+
ac_status=$?
5861+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
5862+
(exit $ac_status); }; }; then
5863+
ac_cv_lib_wsock32_main=yes
5864+
else
5865+
echo "$as_me: failed program was:" >&5
5866+
cat conftest.$ac_ext >&5
5867+
ac_cv_lib_wsock32_main=no
5868+
fi
5869+
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
5870+
LIBS=$ac_check_lib_save_LIBS
5871+
fi
5872+
echo "$as_me:$LINENO: result: $ac_cv_lib_wsock32_main" >&5
5873+
echo "${ECHO_T}$ac_cv_lib_wsock32_main" >&6
5874+
if test $ac_cv_lib_wsock32_main = yes; then
5875+
cat >>confdefs.h <<_ACEOF
5876+
#define HAVE_LIBWSOCK32 1
5877+
_ACEOF
5878+
5879+
LIBS="-lwsock32 $LIBS"
5880+
5881+
fi
5882+
5883+
fi
58765884

58775885
if test "$with_readline" = yes; then
58785886

configure.in

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $Header: /cvsroot/pgsql/configure.in,v 1.279 2003/08/07 21:38:55 tgl Exp $
2+
dnl $Header: /cvsroot/pgsql/configure.in,v 1.280 2003/08/11 18:07:38 tgl Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -52,7 +52,7 @@ PGAC_ARG_REQ(with, template, [],
5252
esac
5353
],
5454
[
55-
# --with-template not given
55+
# --with-template not given
5656

5757
case $host_os in
5858
aix*) template=aix ;;
@@ -178,11 +178,11 @@ AC_MSG_RESULT([$default_port])
178178
# Need both of these because some places want an integer and some a string
179179
AC_DEFINE_UNQUOTED(DEF_PGPORT, ${default_port},
180180
[Define to the default TCP port number on which the server listens and
181-
to which clients will try to connect to. This can be overridden at
182-
run-time, but it's convenient if your clients have the right default
183-
compiled in. (--with-pgport=PORTNUM)])
181+
to which clients will try to connect. This can be overridden at run-time,
182+
but it's convenient if your clients have the right default compiled in.
183+
(--with-pgport=PORTNUM)])
184184
AC_DEFINE_UNQUOTED(DEF_PGPORT_STR, "${default_port}",
185-
[Define to the default TCP port number as string constant.])
185+
[Define to the default TCP port number as a string constant.])
186186
AC_SUBST(default_port)
187187

188188
#
@@ -223,9 +223,13 @@ case $template in
223223
esac
224224

225225
AC_PROG_CC([$pgac_cc_list])
226+
227+
#
226228
# Read the template
229+
#
227230
. "$srcdir/src/template/$template" || exit
228231

232+
# adjust CFLAGS per template
229233
if test "$ac_env_CFLAGS_set" = set; then
230234
CFLAGS=$ac_env_CFLAGS_value
231235
fi
@@ -311,11 +315,12 @@ done
311315
IFS=$ac_save_IFS
312316

313317
#
314-
# Enable libpq to be thread-safety
318+
# Enable thread-safe client libraries
315319
#
316-
AC_MSG_CHECKING([allow thread-safe libpq and ecpg])
317-
PGAC_ARG_BOOL(enable, thread-safety, no, [ --enable-thread-safety allow libpq and ecpg to be thread-safe],
318-
[AC_DEFINE([USE_THREADS], 1, [Define to 1 to build libpq and ecpg to be thread-safe. (--enable-thread-safety)])])
320+
AC_MSG_CHECKING([allow thread-safe client libraries])
321+
PGAC_ARG_BOOL(enable, thread-safety, no, [ --enable-thread-safety make client libraries thread-safe],
322+
[AC_DEFINE([USE_THREADS], 1,
323+
[Define to 1 to build client libraries as thread-safe code. (--enable-thread-safety)])])
319324
AC_MSG_RESULT([$enable_thread_safety])
320325
AC_SUBST(enable_thread_safety)
321326

@@ -631,7 +636,6 @@ AC_CHECK_LIB(BSD, main)
631636
AC_CHECK_LIB(gen, main)
632637
AC_CHECK_LIB(PW, main)
633638
AC_CHECK_LIB(resolv, main)
634-
AC_CHECK_LIB(wsock32, main)
635639
AC_SEARCH_LIBS(getopt_long, [getopt gnugetopt])
636640
# QNX:
637641
AC_CHECK_LIB(unix, main)
@@ -645,6 +649,11 @@ fi
645649
AC_SEARCH_LIBS(fdatasync, [rt posix4])
646650
# Cygwin:
647651
AC_CHECK_LIB(cygipc, shmget)
652+
# WIN32:
653+
if test "$PORTNAME" = "win32"
654+
then
655+
AC_CHECK_LIB(wsock32, main)
656+
fi
648657

649658
if test "$with_readline" = yes; then
650659
PGAC_CHECK_READLINE

src/include/pg_config.h.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
#undef ALIGNOF_SHORT
2626

2727
/* Define to the default TCP port number on which the server listens and to
28-
which clients will try to connect to. This can be overridden at run-time,
29-
but it's convenient if your clients have the right default compiled in.
28+
which clients will try to connect. This can be overridden at run-time, but
29+
it's convenient if your clients have the right default compiled in.
3030
(--with-pgport=PORTNUM) */
3131
#undef DEF_PGPORT
3232

33-
/* Define to the default TCP port number as string constant. */
33+
/* Define to the default TCP port number as a string constant. */
3434
#undef DEF_PGPORT_STR
3535

3636
/* Define to 1 if you want National Language Support. (--enable-nls) */
@@ -603,7 +603,7 @@
603603
/* Define to select SysV-style shared memory. */
604604
#undef USE_SYSV_SHARED_MEMORY
605605

606-
/* Define to 1 to build libpq and ecpg to be thread-safe.
606+
/* Define to 1 to build client libraries as thread-safe code.
607607
(--enable-thread-safety) */
608608
#undef USE_THREADS
609609

0 commit comments

Comments
 (0)
0