Hi all,

I ran into a few problems building R 3.3.1 and came up wth the
attached patches (fingers crossed they don't get stripped, I've also
sent this email to Jeroen since that worked last time). Would it be
possible to review and merge them if they are OK?

The first one uses AC_SEARCH_LIBS instead of AC_CHECK_LIB, looking for
ncursesw before ncurses since ncurses is usually build with wide
character support in which case non-w prefixed libraries are not
created. ArchLinux (and Conda) then make fake ld linker libraries for
the non-w prefixed ones.

The second patch fixes a typo where CPPFLAGS is misspelt as CPPLAGS
which causes them to be forgotten about in the middle of configure.



Best regards,

Ray.
From 8a101b4c3a78555b416ef70753517638829ee6b5 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.andr...@gmail.com>
Date: Tue, 21 Jun 2016 14:22:30 +0100
Subject: [PATCH 1/2] Use AC_SEARCH_LIBS to search for ncursesw then ncurses

---
 configure    | 62 ++++++++++++++++++++++++++++++++++++++----------------------
 configure.ac |  2 +-
 2 files changed, 40 insertions(+), 24 deletions(-)

diff --git a/configure b/configure
index 00e091d..8187f09 100755
--- a/configure
+++ b/configure
@@ -22737,42 +22737,59 @@ fi
   if test "${use_readline}" = no; then
     ## only need ncurses if libreadline is not statically linked against it
     unset ac_cv_lib_readline_rl_callback_read_char
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lncurses" >&5
-$as_echo_n "checking for main in -lncurses... " >&6; }
-if ${ac_cv_lib_ncurses_main+:} false; then :
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing initscr" >&5
+$as_echo_n "checking for library containing initscr... " >&6; }
+if ${ac_cv_search_initscr+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lncurses  $LIBS"
+  ac_func_search_save_LIBS=$LIBS
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char initscr ();
 int
 main ()
 {
-return main ();
+return initscr ();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_ncurses_main=yes
-else
-  ac_cv_lib_ncurses_main=no
+for ac_lib in '' ncursesw curses; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_initscr=$ac_res
 fi
 rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+    conftest$ac_exeext
+  if ${ac_cv_search_initscr+:} false; then :
+  break
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_main" >&5
-$as_echo "$ac_cv_lib_ncurses_main" >&6; }
-if test "x$ac_cv_lib_ncurses_main" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBNCURSES 1
-_ACEOF
+done
+if ${ac_cv_search_initscr+:} false; then :
 
-  LIBS="-lncurses $LIBS"
+else
+  ac_cv_search_initscr=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_initscr" >&5
+$as_echo "$ac_cv_search_initscr" >&6; }
+ac_res=$ac_cv_search_initscr
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -ltermcap" >&5
@@ -25063,7 +25080,7 @@ _ACEOF
 # flags.
 r_save_CFLAGS=$CFLAGS
 CFLAGS="$CFLAGS $r_verb"
-(eval echo $as_me:25066: \"$ac_link\") >&5
+(eval echo $as_me:25083: \"$ac_link\") >&5
 r_c_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
 echo "$r_c_v_output" >&5
 CFLAGS=$r_save_CFLAGS
@@ -25138,7 +25155,7 @@ _ACEOF
 # flags.
 r_save_CFLAGS=$CFLAGS
 CFLAGS="$CFLAGS $r_cv_prog_c_v"
-(eval echo $as_me:25141: \"$ac_link\") >&5
+(eval echo $as_me:25158: \"$ac_link\") >&5
 r_c_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
 echo "$r_c_v_output" >&5
 CFLAGS=$r_save_CFLAGS
@@ -41669,7 +41686,6 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
 $as_echo "$MKDIR_P" >&6; }
 
-
 mkdir_p="$MKDIR_P"
 case $mkdir_p in
   [\\/$]* | ?:[\\/]*) ;;
diff --git a/configure.ac b/configure.ac
index 000d016..11902d1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -764,7 +764,7 @@ if test "${use_readline}" = yes; then
   if test "${use_readline}" = no; then
     ## only need ncurses if libreadline is not statically linked against it
     unset ac_cv_lib_readline_rl_callback_read_char
-    AC_CHECK_LIB(ncurses, main, [],
+    AC_SEARCH_LIBS([initscr], [ncursesw curses], [],
                  AC_CHECK_LIB(termcap, main, [],
                               AC_CHECK_LIB(termlib, main)))
     AC_CHECK_LIB(readline, rl_callback_read_char)
-- 
2.9.0

From 1261a569be90621109a20af0e680f233c74de751 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.andr...@gmail.com>
Date: Mon, 27 Jun 2016 02:39:42 +0100
Subject: [PATCH 2/2] configure: Fix typo (CPPLAGS)

This causes our CPPFLAGS to get cleared out and then custom
locations are not searched in for headers.

In this case, the headers for jpeglib (and probably more)
do not get picked up.
---
 configure | 2 +-
 m4/R.m4   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 8187f09..48dfca6 100755
--- a/configure
+++ b/configure
@@ -36184,7 +36184,7 @@ if test -n "${CURL_CONFIG}"; then
     CURL_LIBS=`${CURL_CONFIG} --libs`
   fi
 fi
-r_save_CPPFLAGS="${CPPLAGS}"
+r_save_CPPFLAGS="${CPPFLAGS}"
 CPPFLAGS="${CURL_CPPFLAGS} ${CPPFLAGS}"
 r_save_LIBS="${LIBS}"
 LIBS="${CURL_LIBS} ${LIBS}"
diff --git a/m4/R.m4 b/m4/R.m4
index 673b50c..8fb7290 100644
--- a/m4/R.m4
+++ b/m4/R.m4
@@ -4165,7 +4165,7 @@ if test -n "${CURL_CONFIG}"; then
     CURL_LIBS=`${CURL_CONFIG} --libs`
   fi
 fi
-r_save_CPPFLAGS="${CPPLAGS}"
+r_save_CPPFLAGS="${CPPFLAGS}"
 CPPFLAGS="${CURL_CPPFLAGS} ${CPPFLAGS}"
 r_save_LIBS="${LIBS}"
 LIBS="${CURL_LIBS} ${LIBS}"
-- 
2.9.0

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to