diff --git a/configure b/configure index b3f3abe..e7bddba 100755 --- a/configure +++ b/configure @@ -3099,6 +3099,16 @@ cat >>confdefs.h <<_ACEOF _ACEOF +# It's worth testing for this because it creates a very confusing error +if test "$default_port" = ""; then + as_fn_error $? "invalid empty string supplied with --with-pgport" "$LINENO" 5 +elif test ! `echo $default_port | sed -e 's/[0-9]//g'` = ''; then + as_fn_error $? "invalid port specification; must be a number" "$LINENO" 5 +elif test ! `echo $default_port | sed -e 's/^0//g'` = $default_port; then + as_fn_error $? "illegal leading 0 specified with --with-pgport" "$LINENO" 5 +elif test "$default_port" -lt "1" -o "$default_port" -gt "65535"; then + as_fn_error $? "port must be between 1 and 65535" "$LINENO" 5 +fi # # '-rpath'-like feature can be disabled diff --git a/configure.in b/configure.in index 0bd90d7..db6e2a0 100644 --- a/configure.in +++ b/configure.in @@ -164,6 +164,16 @@ but it's convenient if your clients have the right default compiled in. AC_DEFINE_UNQUOTED(DEF_PGPORT_STR, "${default_port}", [Define to the default TCP port number as a string constant.]) AC_SUBST(default_port) +# It's worth testing for this because it creates a very confusing error +if test "$default_port" = ""; then + AC_MSG_ERROR([invalid empty string supplied with --with-pgport]) +elif test ! `echo $default_port | sed -e 's/[[0-9]]//g'` = ''; then + AC_MSG_ERROR([invalid port specification; must be a number]) +elif test ! `echo $default_port | sed -e 's/^0//g'` = $default_port; then + AC_MSG_ERROR([illegal leading 0 specified with --with-pgport]) +elif test "$default_port" -lt "1" -o "$default_port" -gt "65535"; then + AC_MSG_ERROR([port must be between 1 and 65535]) +fi # # '-rpath'-like feature can be disabled