Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Switch to using AM_ICONV
This helps us to deal with the iconv mess on FreeBSD, GhostBSD, etc. where
it *might* be provided by the system's /usr/include/iconv.h and not require
-liconv, but you might also end up using /usr/local/include/iconv.h and then
you *do* have to use -liconv. And you might find the first with autoconf
and think you don't need -liconv, then end up with /usr/local/include in
your include path for *other* packages, then end up failing to build.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Oct 30, 2014
1 parent fa3a36f commit d8c0225
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 26 deletions.
8 changes: 4 additions & 4 deletions Makefile.am
Expand Up @@ -15,8 +15,8 @@ AM_CFLAGS = @WFLAGS@
AM_CPPFLAGS = -DLOCALEDIR="\"$(localedir)\""

openconnect_SOURCES = xml.c main.c
openconnect_CFLAGS = $(AM_CFLAGS) $(SSL_CFLAGS) $(DTLS_SSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS) $(ZLIB_CFLAGS) $(LIBSTOKEN_CFLAGS) $(LIBOATH_CFLAGS) $(LIBPSKC_CFLAGS) $(GSSAPI_CFLAGS)
openconnect_LDADD = libopenconnect.la $(LIBXML2_LIBS) $(LIBPROXY_LIBS) $(LIBINTL) $(LIBICONV)
openconnect_CFLAGS = $(AM_CFLAGS) $(SSL_CFLAGS) $(DTLS_SSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS) $(ZLIB_CFLAGS) $(LIBSTOKEN_CFLAGS) $(LIBOATH_CFLAGS) $(LIBPSKC_CFLAGS) $(GSSAPI_CFLAGS) $(ICONV_CFLAGS)
openconnect_LDADD = libopenconnect.la $(LIBXML2_LIBS) $(LIBPROXY_LIBS) $(LIBINTL) $(ICONV_LIBS)

library_srcs = ssl.c http.c auth.c library.c compat.c dtls.c cstp.c \
mainloop.c script.c ntlm.c digest.c
Expand Down Expand Up @@ -58,8 +58,8 @@ library_srcs += $(lib_srcs_posix)
endif

libopenconnect_la_SOURCES = version.c $(library_srcs)
libopenconnect_la_CFLAGS = $(AM_CFLAGS) $(SSL_CFLAGS) $(DTLS_SSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS) $(ZLIB_CFLAGS) $(P11KIT_CFLAGS) $(TSS_CFLAGS) $(LIBSTOKEN_CFLAGS) $(LIBOATH_CFLAGS) $(LIBPSKC_CFLAGS) $(GSSAPI_CFLAGS)
libopenconnect_la_LIBADD = $(SSL_LIBS) $(DTLS_SSL_LIBS) $(LIBXML2_LIBS) $(LIBPROXY_LIBS) $(ZLIB_LIBS) $(LIBINTL) $(P11KIT_LIBS) $(TSS_LIBS) $(LIBSTOKEN_LIBS) $(LIBOATH_LIBS) $(LIBPSKC_LIBS) $(GSSAPI_LIBS) $(LIBICONV)
libopenconnect_la_CFLAGS = $(AM_CFLAGS) $(SSL_CFLAGS) $(DTLS_SSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS) $(ZLIB_CFLAGS) $(P11KIT_CFLAGS) $(TSS_CFLAGS) $(LIBSTOKEN_CFLAGS) $(LIBOATH_CFLAGS) $(LIBPSKC_CFLAGS) $(GSSAPI_CFLAGS) $(ICONV_CFLAGS)
libopenconnect_la_LIBADD = $(SSL_LIBS) $(DTLS_SSL_LIBS) $(LIBXML2_LIBS) $(LIBPROXY_LIBS) $(ZLIB_LIBS) $(LIBINTL) $(P11KIT_LIBS) $(TSS_LIBS) $(LIBSTOKEN_LIBS) $(LIBOATH_LIBS) $(LIBPSKC_LIBS) $(GSSAPI_LIBS) $(ICONV_LIBS)
if OPENBSD_LIBTOOL
# OpenBSD's libtool doesn't have -version-number, but its -version-info arg
# does what GNU libtool's -version-number does. Which arguably is what the
Expand Down
28 changes: 6 additions & 22 deletions configure.ac
Expand Up @@ -184,31 +184,15 @@ AC_DISABLE_STATIC

AC_CHECK_FUNC(nl_langinfo, [AC_DEFINE(HAVE_NL_LANGINFO, 1, [Have nl_langinfo() function])], [])

have_iconv=no
if test "$ac_cv_func_nl_langinfo" = "yes"; then
LIBICONV=
AC_MSG_CHECKING([for iconv support])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <iconv.h>],[
iconv_t ic = iconv_open("","");])],
[AC_MSG_RESULT(yes)
have_iconv=yes],
[oldLIBS="$LIBS"
LIBS="$LIBS -liconv"
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <iconv.h>],[
iconv_t ic = iconv_open("","");])],
[AC_MSG_RESULT(yes (with -liconv))
have_iconv=yes
LIBICONV=-liconv],
[AC_MSG_RESULT(no)])
LIBS="$oldLIBS"])
if test "$have_iconv" = "yes"; then
AC_SUBST(LIBICONV)
AC_DEFINE(HAVE_ICONV, 1, [Have iconv() function])
AM_ICONV
if test "$am_cv_func_iconv" = "yes"; then
AC_SUBST(ICONV_LIBS, [$LTLIBICONV])
AC_SUBST(ICONV_CFLAGS, [$INCICONV])
AC_DEFINE(HAVE_ICONV, 1, [Have iconv() function])
fi
fi
AM_CONDITIONAL(OPENCONNECT_ICONV, [test "$have_iconv" = "yes"])
AM_CONDITIONAL(OPENCONNECT_ICONV, [test "$am_cv_func_iconv" = "yes"])

AC_ARG_ENABLE([nls],
[ --disable-nls do not use Native Language Support],
Expand Down

0 comments on commit d8c0225

Please sign in to comment.