On Fri, Mar 14, 2014 at 12:17:54PM +0000, Philip Martin wrote:
> Stefan Sperling <s...@elego.de> writes:
> 
> > One possible solution to this problem is to make sure that SVN_INTL_LIBS
> > is always defined, either to an empty string, or to the appropriate
> > linke flags (e.g. "-lintl", or "-lintl -liconv").
> > This is what I want to achieve.
> 
> The docs for AC_SEARCH_LIB say you can check the variable
> ac_cv_search_bindtextdomian to determine whether a library was needed
> but it might be simpler to simply do an AC_LINKIFELSE to see if it works
> with no library and AC_CHECK_LIB for -lintl if it fails.

Would something like this work on linux?

I'm now afraid of breaking the build for everyone else with
changes like these :)

Index: configure.ac
===================================================================
--- configure.ac        (revision 1577708)
+++ configure.ac        (working copy)
@@ -684,6 +684,7 @@ AC_ARG_ENABLE(nls,
   [enable_nls=$enableval],[enable_nls=yes])
 
 USE_NLS="no"
+SVN_INTL_LIBS=""
 if test "$enable_nls" = "yes"; then
   dnl First, check to see if there is a working msgfmt.
   AC_PATH_PROG(MSGFMT, msgfmt, none)
@@ -690,8 +691,16 @@ if test "$enable_nls" = "yes"; then
   AC_PATH_PROG(MSGMERGE, msgmerge, none)
   AC_PATH_PROG(XGETTEXT, xgettext, none)
   if test "$MSGFMT" != "none"; then
-    AC_SEARCH_LIBS(bindtextdomain, [intl], [],
+    AC_SEARCH_LIBS(bindtextdomain, [intl],
                    [
+                      # in case libintl needs to be linked explicitly,
+                      # $ac_cv_search_bindtextdomain contains -l linker flags
+                      if echo "$ac_cv_search_bindtextdomain" | grep -q '^-l'
+                      then
+                        SVN_INTL_LIBS="$ac_cv_search_bindtextdomain"
+                      fi
+                   ],
+                   [
                     enable_nls="no"
                    ])
     if test "$enable_nls" = "no"; then
@@ -702,6 +711,10 @@ if test "$enable_nls" = "yes"; then
       AC_SEARCH_LIBS(bindtextdomain, [intl],
                      [
                       enable_nls="yes"
+                      if echo "$ac_cv_search_bindtextdomain" | grep -q '^-l'
+                      then
+                        SVN_INTL_LIBS="$ac_cv_search_bindtextdomain"
+                      fi
                       # This is here so that -liconv ends up in LIBS
                       # if it worked with -liconv.
                       AC_CHECK_LIB(iconv, libiconv_open)
@@ -720,7 +733,6 @@ if test "$enable_nls" = "yes"; then
   fi
 fi
 
-dnl Currently SVN_INTL_LIBS is always empty.
 AC_SUBST(SVN_INTL_LIBS)
 
 AH_BOTTOM([

Reply via email to