Skip to content

Commit

Permalink
address endian issue in #92
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Jun 3, 2024
1 parent ba5af36 commit 304022f
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 57 deletions.
210 changes: 163 additions & 47 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,6 @@ PACKAGE_STRING=''
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

ac_unique_file="src/lwgeom.cpp"
# Factoring default headers for most tests.
ac_includes_default="\
#include <stddef.h>
Expand Down Expand Up @@ -652,7 +651,6 @@ OBJECTS
GEOS_LIBS
PKG_CPPFLAGS
GEOS_CONFIG
POSTGIS_PROJ_VERSION
PROJ_LIBS
OBJEXT
EXEEXT
Expand Down Expand Up @@ -2275,7 +2273,9 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
# AC_CONFIG_HEADERS([src/postgis_config.h:src/postgis_config.h.in])
ac_config_headers="$ac_config_headers src/postgis_config.h:src/postgis_config.h.in"
ac_config_files="$ac_config_files src/Makevars"
: ${R_HOME=`R RHOME`}
Expand Down Expand Up @@ -3751,8 +3751,10 @@ POSTGIS_PROJ_VERSION="${PROJ_VERSION_MAJOR}${PROJ_VERSION_MINOR}"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: POSTGIS_PROJ_VERSION: ${POSTGIS_PROJ_VERSION}" >&5
printf "%s\n" "$as_me: POSTGIS_PROJ_VERSION: ${POSTGIS_PROJ_VERSION}" >&6;}
#AC_SUBST([POSTGIS_PROJ_VERSION],["${PROJV12}"])
#AC_DEFINE_UNQUOTED([POSTGIS_PROJ_VERSION], [$POSTGIS_PROJ_VERSION], [PROJ library version])
printf "%s\n" "#define POSTGIS_PROJ_VERSION \"$POSTGIS_PROJ_VERSION\"" >>confdefs.h
#AC_SUBST(POSTGIS_PROJ_VERSION)
PKG_CPPFLAGS="${PKG_CPPFLAGS} -DPOSTGIS_PROJ_VERSION=${POSTGIS_PROJ_VERSION}"
if test ${POSTGIS_PROJ_VERSION} -lt 60 ; then
PKG_CPPFLAGS="${PKG_CPPFLAGS} -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H"
Expand Down Expand Up @@ -4265,8 +4267,6 @@ printf "%s\n" "$as_me: Package CPP flags: ${PKG_CPPFLAGS}" >&6;}
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: Package LIBS: ${LIBS}" >&5
printf "%s\n" "$as_me: Package LIBS: ${LIBS}" >&6;}
ac_config_files="$ac_config_files src/Makevars src/postgis_config.h"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
Expand Down Expand Up @@ -4357,43 +4357,7 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
# Transform confdefs.h into DEFS.
# Protect against shell expansion while executing Makefile rules.
# Protect against Makefile macro expansion.
#
# If the first sed substitution is executed (which looks for macros that
# take arguments), then branch to the quote section. Otherwise,
# look for a macro that doesn't take arguments.
ac_script='
:mline
/\\$/{
N
s,\\\n,,
b mline
}
t clear
:clear
s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
t quote
s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
t quote
b any
:quote
s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
s/\[/\\&/g
s/\]/\\&/g
s/\$/$$/g
H
:any
${
g
s/^\n//
s/\n/ /g
p
}
'
DEFS=`sed -n "$ac_script" confdefs.h`
DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
Expand Down Expand Up @@ -4821,11 +4785,15 @@ case $ac_config_files in *"
"*) set x $ac_config_files; shift; ac_config_files=$*;;
esac
case $ac_config_headers in *"
"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
config_files="$ac_config_files"
config_headers="$ac_config_headers"
_ACEOF
Expand All @@ -4846,10 +4814,15 @@ Usage: $0 [OPTION]... [TAG]...
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
--header=FILE[:TEMPLATE]
instantiate the configuration header FILE
Configuration files:
$config_files
Configuration headers:
$config_headers
Report bugs to the package provider."
_ACEOF
Expand Down Expand Up @@ -4912,7 +4885,18 @@ do
esac
as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
--he | --h | --help | --hel | -h )
--header | --heade | --head | --hea )
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
as_fn_append CONFIG_HEADERS " '$ac_optarg'"
ac_need_defaults=false;;
--he | --h)
# Conflict between --help and --header
as_fn_error $? "ambiguous option: \`$1'
Try \`$0 --help' for more information.";;
--help | --hel | -h )
printf "%s\n" "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
Expand Down Expand Up @@ -4968,8 +4952,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"src/postgis_config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/postgis_config.h:src/postgis_config.h.in" ;;
"src/Makevars") CONFIG_FILES="$CONFIG_FILES src/Makevars" ;;
"src/postgis_config.h") CONFIG_FILES="$CONFIG_FILES src/postgis_config.h" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
Expand All @@ -4982,6 +4966,7 @@ done
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files
test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers
fi
# Have a temporary directory for convenience. Make it in the build tree
Expand Down Expand Up @@ -5169,8 +5154,116 @@ fi
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
fi # test -n "$CONFIG_FILES"
# Set up the scripts for CONFIG_HEADERS section.
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
BEGIN {
_ACEOF
# Transform confdefs.h into an awk script `defines.awk', embedded as
# here-document in config.status, that substitutes the proper values into
# config.h.in to produce config.h.
# Create a delimiter string that does not exist in confdefs.h, to ease
# handling of long lines.
ac_delim='%!_!# '
for ac_last_try in false false :; do
ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
if test -z "$ac_tt"; then
break
elif $ac_last_try; then
as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
# For the awk script, D is an array of macro values keyed by name,
# likewise P contains macro parameters if any. Preserve backslash
# newline sequences.
eval set X " :F $CONFIG_FILES "
ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
sed -n '
s/.\{148\}/&'"$ac_delim"'/g
t rset
:rset
s/^[ ]*#[ ]*define[ ][ ]*/ /
t def
d
:def
s/\\$//
t bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3"/p
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
d
:bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3\\\\\\n"\\/p
t cont
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
t cont
d
:cont
n
s/.\{148\}/&'"$ac_delim"'/g
t clear
:clear
s/\\$//
t bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/"/p
d
:bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
b cont
' <confdefs.h | sed '
s/'"$ac_delim"'/"\\\
"/g' >>$CONFIG_STATUS || ac_write_fail=1
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
for (key in D) D_is_set[key] = 1
FS = ""
}
/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
line = \$ 0
split(line, arg, " ")
if (arg[1] == "#") {
defundef = arg[2]
mac1 = arg[3]
} else {
defundef = substr(arg[1], 2)
mac1 = arg[2]
}
split(mac1, mac2, "(") #)
macro = mac2[1]
prefix = substr(line, 1, index(line, defundef) - 1)
if (D_is_set[macro]) {
# Preserve the white space surrounding the "#".
print prefix "define", macro P[macro] D[macro]
next
} else {
# Replace #undef with comments. This is necessary, for example,
# in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
if (defundef == "undef") {
print "/*", prefix defundef, macro, "*/"
next
}
}
}
{ print }
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
fi # test -n "$CONFIG_HEADERS"
eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS "
shift
for ac_tag
do
Expand Down Expand Up @@ -5378,7 +5471,30 @@ which seems to be undefined. Please make sure it is defined" >&2;}
esac \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
;;
:H)
#
# CONFIG_HEADER
#
if test x"$ac_file" != x-; then
{
printf "%s\n" "/* $configure_input */" >&1 \
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
} >"$ac_tmp/config.h" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
printf "%s\n" "$as_me: $ac_file is unchanged" >&6;}
else
rm -f "$ac_file"
mv "$ac_tmp/config.h" "$ac_file" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
fi
else
printf "%s\n" "/* $configure_input */" >&1 \
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
|| as_fn_error $? "could not create -" "$LINENO" 5
fi
;;
esac
Expand Down
10 changes: 4 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
dnl Process this file with autoconf to produce a configure script.
dnl GDAL stuff largely copied from rgdal, (c) Roger Bivand
AC_INIT
# AC_CONFIG_HEADERS([src/postgis_config.h:src/postgis_config.h.in])
AC_CONFIG_SRCDIR([src/lwgeom.cpp])
AC_CONFIG_HEADERS([src/postgis_config.h:src/postgis_config.h.in])
AC_CONFIG_FILES(src/Makevars)

: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
Expand Down Expand Up @@ -357,8 +357,8 @@ PROJ_VERSION_MINOR=`echo $proj_version | cut -d "." -f 2`
POSTGIS_PROJ_VERSION="${PROJ_VERSION_MAJOR}${PROJ_VERSION_MINOR}"
AC_MSG_NOTICE([POSTGIS_PROJ_VERSION: ${POSTGIS_PROJ_VERSION}])
#AC_SUBST([POSTGIS_PROJ_VERSION],["${PROJV12}"])
#AC_DEFINE_UNQUOTED([POSTGIS_PROJ_VERSION], [$POSTGIS_PROJ_VERSION], [PROJ library version])
AC_SUBST(POSTGIS_PROJ_VERSION)
AC_DEFINE_UNQUOTED([POSTGIS_PROJ_VERSION], ["$POSTGIS_PROJ_VERSION"], [PROJ library version])
#AC_SUBST(POSTGIS_PROJ_VERSION)
PKG_CPPFLAGS="${PKG_CPPFLAGS} -DPOSTGIS_PROJ_VERSION=${POSTGIS_PROJ_VERSION}"
if test ${POSTGIS_PROJ_VERSION} -lt 60 ; then
PKG_CPPFLAGS="${PKG_CPPFLAGS} -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H"
Expand Down Expand Up @@ -518,6 +518,4 @@ AC_SUBST([PKG_CPPFLAGS], ["${CPPFLAGS} ${PKG_CPPFLAGS} -I./liblwgeom -DHAVE_LIBL
AC_MSG_NOTICE([Package CPP flags: ${PKG_CPPFLAGS}])
AC_MSG_NOTICE([Package LIBS: ${LIBS}])

AC_CONFIG_FILES(src/Makevars
src/postgis_config.h)
AC_OUTPUT
2 changes: 1 addition & 1 deletion man/perimeter-deprecated.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/postgis_config.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* src/postgis_config.h. Generated from postgis_config.h.in by configure. */
/* postgis_config.h. Generated from postgis_config.h.in by configure. */
#ifndef POSTGIS_CONFIG_H
#define POSTGIS_CONFIG_H 1
Expand Down Expand Up @@ -121,7 +122,7 @@
#define POSTGIS_PGSQL_VERSION 100

/* PROJ library version */
#define POSTGIS_PROJ_VERSION 93
/* #undef POSTGIS_PROJ_VERSION */

/* PostGIS Raster build date */
/* #undef POSTGIS_RASTER_BUILD_DATE */
Expand Down
4 changes: 2 additions & 2 deletions src/postgis_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#define HAVE_GETTEXT 1

/* Define if the build is big endian */
/* #undef WORDS_BIGENDIAN */
#undef WORDS_BIGENDIAN

/* Define if you have the iconv() function and it works. */
#define HAVE_ICONV 1
Expand Down Expand Up @@ -121,7 +121,7 @@
#define POSTGIS_PGSQL_VERSION 100

/* PROJ library version */
#define POSTGIS_PROJ_VERSION @POSTGIS_PROJ_VERSION@
/* #undef POSTGIS_PROJ_VERSION */

/* PostGIS Raster build date */
/* #undef POSTGIS_RASTER_BUILD_DATE */
Expand Down

0 comments on commit 304022f

Please sign in to comment.