From 503373dd9cc296a098ba38f02b590b36cfcf3987 Mon Sep 17 00:00:00 2001 From: Phil Shafer Date: Wed, 26 May 2021 23:02:46 -0400 Subject: [PATCH 1/7] adjust gcc test (for gcc9) --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 58b4da62..4ebb26ee 100644 --- a/configure.ac +++ b/configure.ac @@ -335,9 +335,10 @@ AM_CONDITIONAL([HAVE_LIBM], [test "$HAVE_LIBM" != "no"]) AC_MSG_CHECKING([compiler for gcc]) HAVE_GCC=no if test "${CC}" != ""; then - HAVE_GCC=`${CC} --version 2>&1 | grep GCC` + HAVE_GCC=`${CC} --version 2>&1 | grep -i GCC` if test "${HAVE_GCC}" != ""; then HAVE_GCC=yes + AC_DEFINE([HAVE_GCC], [1], [Using real gcc]) else HAVE_GCC=no fi From 0aba11ba48c851d2532464c7fdf3a21667ba7cee Mon Sep 17 00:00:00 2001 From: Phil Shafer Date: Wed, 26 May 2021 23:03:32 -0400 Subject: [PATCH 2/7] push/pop gcc diagnostic setting to avoid triggering -Wcast-function-type issues on dlfunc --- libxo/xo_encoder.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/libxo/xo_encoder.c b/libxo/xo_encoder.c index 475b6d70..0bfb58ef 100644 --- a/libxo/xo_encoder.c +++ b/libxo/xo_encoder.c @@ -206,6 +206,34 @@ xo_encoder_find (const char *name) return NULL; } +/* + * Return the encoder function for a specific shared library. This is + * really just a means of keeping the annoying gcc verbiage out of the + * main code. And that's only need because gcc breaks dlfunc's + * promise that I can cast it's return value to a function: "The + * precise return type of dlfunc() is unspecified; applications must + * cast it to an appropriate function pointer type." + */ +static xo_encoder_init_func_t +xo_encoder_func (void *dlp) +{ + xo_encoder_init_func_t func; + +#ifdef HAVE_GCC + what the heck? +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-function-type" +#endif /* HAVE_GCC */ + + func = (xo_encoder_init_func_t) dlfunc(dlp, XO_ENCODER_INIT_NAME); + +#ifdef HAVE_GCC +#pragma GCC diagnostic pop /* Restore previous setting */ +#endif /* HAVE_GCC */ + + return func; +} + static xo_encoder_node_t * xo_encoder_discover (const char *name) { @@ -234,7 +262,7 @@ xo_encoder_discover (const char *name) */ xo_encoder_init_func_t func; - func = (xo_encoder_init_func_t) dlfunc(dlp, XO_ENCODER_INIT_NAME); + func = xo_encoder_func(dlp); if (func) { xo_encoder_init_args_t xei; From ed63a58e863de793f942b37881386a961845706f Mon Sep 17 00:00:00 2001 From: Phil Shafer Date: Wed, 26 May 2021 23:05:22 -0400 Subject: [PATCH 3/7] remove "what" --- libxo/xo_encoder.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libxo/xo_encoder.c b/libxo/xo_encoder.c index 0bfb58ef..0255f1f7 100644 --- a/libxo/xo_encoder.c +++ b/libxo/xo_encoder.c @@ -220,7 +220,6 @@ xo_encoder_func (void *dlp) xo_encoder_init_func_t func; #ifdef HAVE_GCC - what the heck? #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-function-type" #endif /* HAVE_GCC */ From cc4dcc298c8ac6c96efed68b507b2b37e2015832 Mon Sep 17 00:00:00 2001 From: Phil Shafer Date: Wed, 26 May 2021 23:10:23 -0400 Subject: [PATCH 4/7] need gcc8 for -Wcast-function-type --- libxo/xo_encoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libxo/xo_encoder.c b/libxo/xo_encoder.c index 0255f1f7..5d195e06 100644 --- a/libxo/xo_encoder.c +++ b/libxo/xo_encoder.c @@ -219,14 +219,14 @@ xo_encoder_func (void *dlp) { xo_encoder_init_func_t func; -#ifdef HAVE_GCC +#if defined(HAVE_GCC) && __GNUC__ > 8 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-function-type" #endif /* HAVE_GCC */ func = (xo_encoder_init_func_t) dlfunc(dlp, XO_ENCODER_INIT_NAME); -#ifdef HAVE_GCC +#if defined(HAVE_GCC) && __GNUC__ > 8 #pragma GCC diagnostic pop /* Restore previous setting */ #endif /* HAVE_GCC */ From e97e331a2af7c85e79f29210a7e03d0c36a07f2b Mon Sep 17 00:00:00 2001 From: Phil Shafer Date: Wed, 26 May 2021 23:22:29 -0400 Subject: [PATCH 5/7] handle /usr/local/bin/msgfmt (vs /opt/) --- bin/Zaliases | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/Zaliases b/bin/Zaliases index df7e8977..0d4e9040 100644 --- a/bin/Zaliases +++ b/bin/Zaliases @@ -1,13 +1,21 @@ set top_src=`pwd` alias Zautoreconf "(cd $top_src ; autoreconf --install)" +if [ -x /opt/local/bin/msgfmt ]; then + GETTEXT=--with-gettext=/opt/local +elif [ -x /usr/local/bin/msgfmt ]; then + GETTEXT=--with-gettext=/usr/local +else + GETTEXT= +fi + set opts=' \ --with-libslax-prefix=/Users/phil/work/root \ --enable-debug \ --enable-warnings \ --enable-printflike \ ---with-gettext=/opt/local \ --prefix ${HOME}/work/root \ +${GETTEXTDIR} \ ' set opts=`echo $opts` From 3061f6b6f4991ba80c51452966e16ca02ea4fd6d Mon Sep 17 00:00:00 2001 From: Phil Shafer Date: Wed, 26 May 2021 23:26:19 -0400 Subject: [PATCH 6/7] Use csh syntax (Zaliases) --- bin/Zaliases | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/Zaliases b/bin/Zaliases index 0d4e9040..9b3492b8 100644 --- a/bin/Zaliases +++ b/bin/Zaliases @@ -1,13 +1,13 @@ set top_src=`pwd` alias Zautoreconf "(cd $top_src ; autoreconf --install)" -if [ -x /opt/local/bin/msgfmt ]; then - GETTEXT=--with-gettext=/opt/local -elif [ -x /usr/local/bin/msgfmt ]; then - GETTEXT=--with-gettext=/usr/local +if ( -x /opt/local/bin/msgfmt ) then + set gettext='--with-gettext=/opt/local' +else if ( -x /usr/local/bin/msgfmt ) then + set gettext='--with-gettext=/usr/local' else - GETTEXT= -fi + set gettext='' +endif set opts=' \ --with-libslax-prefix=/Users/phil/work/root \ @@ -15,7 +15,7 @@ set opts=' \ --enable-warnings \ --enable-printflike \ --prefix ${HOME}/work/root \ -${GETTEXTDIR} \ +${gettext} \ ' set opts=`echo $opts` From 1b34f4caad7f510078fdf0fc3971b68cc7df096b Mon Sep 17 00:00:00 2001 From: Phil Shafer Date: Thu, 27 May 2021 02:28:30 -0400 Subject: [PATCH 7/7] freebsd need make=gmake --- bin/Zaliases | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/Zaliases b/bin/Zaliases index 9b3492b8..f7c4ddff 100644 --- a/bin/Zaliases +++ b/bin/Zaliases @@ -1,6 +1,12 @@ set top_src=`pwd` alias Zautoreconf "(cd $top_src ; autoreconf --install)" +switch ( `uname` ) + case FreeBSD*: + set ZENV="MAKE=gmake " + breaksw +endsw + if ( -x /opt/local/bin/msgfmt ) then set gettext='--with-gettext=/opt/local' else if ( -x /usr/local/bin/msgfmt ) then @@ -22,7 +28,7 @@ set opts=`echo $opts` setenv CONFIGURE_OPTS "$opts" setenv ADB_PATH $top_src/build/libxo/.libs -alias Zconfigure "(cd $top_src/build; ../configure $opts)" +alias Zconfigure "(cd $top_src/build; env $ZENV ../configure $opts)" alias Zbuild "(cd $top_src/build; make \!* )" alias mi "(cd $top_src/build; make && make install); ."