BOOST = boost
endif
+if USE_INCLUDED_ICONV
+ICONV = libiconv
+endif
+
if USE_INCLUDED_ZLIB
ZLIB = zlib
endif
-SUBDIRS = $(BOOST) $(ZLIB)
+SUBDIRS = $(BOOST) $(ICONV) $(ZLIB)
include $(top_srcdir)/config/common.am
-# This is prepared for compilation, but currently only used for packaging,
-# because configure support for compilation is still missing.
-
# We do not build right now
-#noinst_LIBRARIES = liblyxiconv.a
+noinst_LIBRARIES = liblyxiconv.a
EXTRA_DIST = \
CMakeLists.txt \
1.14/libcharset/lib/ref-add.sin \
1.14/libcharset/lib/ref-del.sin
-# If/when we decide to build, this will do in liblyxiconv_a_SOURCES
-# But for now it confuses automake < 1.14, where we do not use subdir-objects.
-# The issue here is that there are two relocatable.c files, and they would
-# create the same .o file.
-EXTRA_DIST += \
+AM_CPPFLAGS += -I$(srcdir)/1.14/srclib -DLIBDIR=""
+
+# The two relocatable.c files confuse automake < 1.14, where we do not use
+# subdir-objects. Therefore we cannot put both in liblyxiconv_a_SOURCES
+# (they would both create the same .o file). Fortunately their contents is
+# identical, so it is enough to build only one.
+EXTRA_DIST += 1.14/libcharset/lib/relocatable.c
+
+liblyxiconv_a_SOURCES = \
1.14/include/export.h \
1.14/lib/aliases2.h \
1.14/lib/aliases_aix.h \
1.14/lib/viscii.h \
1.14/libcharset/include/export.h \
1.14/libcharset/lib/localcharset.c \
- 1.14/libcharset/lib/relocatable.c \
1.14/libcharset/lib/relocatable.h \
1.14/srclib/localcharset.h \
1.14/srclib/unitypes.in.h \
])
+dnl Usage: LYX_USE_INCLUDED_ICONV : select if the included iconv should
+dnl be used.
+AC_DEFUN([LYX_USE_INCLUDED_ICONV],[
+ AC_MSG_CHECKING([whether to use included iconv library])
+ AC_ARG_WITH(included-iconv,
+ [AC_HELP_STRING([--without-included-iconv], [do not use the iconv lib supplied with LyX, try to find one in the system directories - compilation will abort if nothing suitable is found])],
+ [lyx_cv_with_included_iconv=$withval],
+ [lyx_cv_with_included_iconv=no])
+ AM_CONDITIONAL(USE_INCLUDED_ICONV, test x$lyx_cv_with_included_iconv = xyes)
+ AC_MSG_RESULT([$lyx_cv_with_included_iconv])
+ if test x$lyx_cv_with_included_iconv = xyes ; then
+dnl Some bits from libiconv configure.ac to avoid a nested configure call:
+ AC_EILSEQ
+ AC_TYPE_MBSTATE_T
+ AC_CHECK_FUNCS([getc_unlocked mbrtowc wcrtomb mbsinit setlocale])
+dnl Ymbstate_t is used if HAVE_WCRTOMB || HAVE_MBRTOWC, see 3rdparty/libiconv/1.14/lib/loop_wchar.h.
+ if test $ac_cv_func_wcrtomb = yes || test $ac_cv_func_mbrtowc = yes; then
+ USE_MBSTATE_T=1
+ else
+ USE_MBSTATE_T=0
+ fi
+ AC_SUBST([USE_MBSTATE_T])
+ AC_CACHE_CHECK([whether <wchar.h> is standalone],
+ [gl_cv_header_wchar_h_standalone],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <wchar.h>
+ wchar_t w;]],
+ [[]])],
+ [gl_cv_header_wchar_h_standalone=yes],
+ [gl_cv_header_wchar_h_standalone=no])])
+ if test $gl_cv_header_wchar_h_standalone = yes; then
+ BROKEN_WCHAR_H=0
+ else
+ BROKEN_WCHAR_H=1
+ fi
+ AC_SUBST([BROKEN_WCHAR_H])
+dnl we want const correctness
+ AC_DEFINE_UNQUOTED([ICONV_CONST], [const],
+ [Define as const if the declaration of iconv() needs const.])
+ ICONV_CONST=const
+ AC_SUBST([ICONV_CONST])
+dnl we build a static lib
+ DLL_VARIABLE=
+ AC_SUBST([DLL_VARIABLE])
+ ICONV_INCLUDES='-I$(top_srcdir)/3rdparty/libiconv/1.14 -I$(top_builddir)/3rdparty/libiconv'
+ ICONV_LIBS='\$(top_builddir)/3rdparty/libiconv/liblyxiconv.a'
+ ICONV_ICONV_H_IN=3rdparty/libiconv/iconv.h:3rdparty/libiconv/1.14/include/iconv.h.in
+ else
+ ICONV_INCLUDES=
+ AM_ICONV
+ if test "$am_cv_func_iconv" = no; then
+ AC_MSG_ERROR([cannot find required library iconv.])
+ else
+ ICONV_LIBS="$LIBICONV"
+ fi
+ ICONV_ICONV_H_IN=
+ fi
+ AC_SUBST(ICONV_INCLUDES)
+ AC_SUBST(ICONV_LIBS)
+ AC_SUBST(ICONV_ICONV_H_IN)
+])
+
+
dnl Usage: LYX_USE_INCLUDED_ZLIB : select if the included zlib should
dnl be used.
AC_DEFUN([LYX_USE_INCLUDED_ZLIB],[
# Needed for our char_type
AC_CHECK_SIZEOF(wchar_t)
+# Taken from gettext, needed for libiconv
+AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
+ [AC_TRY_COMPILE([#include <stddef.h>
+ wchar_t foo = (wchar_t)'\0';], ,
+ [gt_cv_c_wchar_t=yes], [gt_cv_c_wchar_t=no])])
+if test $gt_cv_c_wchar_t = yes; then
+ AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
+ HAVE_WCHAR_T=1
+else
+ HAVE_WCHAR_T=0
+fi
+AC_SUBST([HAVE_WCHAR_T])
+
# Needed for Mingw-w64
AC_TYPE_LONG_LONG_INT
if test "$ac_cv_type_long_long_int" = yes; then
fi
### We need iconv for unicode support (Qt4 frontend requires it too)
-AM_ICONV
-if test "$am_cv_func_iconv" = no; then
- AC_MSG_ERROR([cannot find required library iconv.])
-else
- LIBS="$LIBS $LIBICONV"
-fi
+LYX_USE_INCLUDED_ICONV
### check for compression support
LYX_USE_INCLUDED_ZLIB
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
-# Taken from gettext
-AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
- [AC_TRY_COMPILE([#include <stddef.h>
- wchar_t foo = (wchar_t)'\0';], ,
- [gt_cv_c_wchar_t=yes], [gt_cv_c_wchar_t=no])])
-if test $gt_cv_c_wchar_t = yes; then
- AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
-fi
LYX_CHECK_DEF(PATH_MAX, limits.h, [int n = PATH_MAX;])
3rdparty/boost/Makefile \
3rdparty/hunspell/Makefile \
3rdparty/libiconv/Makefile \
+ $ICONV_ICONV_H_IN \
3rdparty/zlib/Makefile \
autotests/Makefile \
config/Makefile \
-EXTRA_DIST = iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 po.m4 progtest.m4
+EXTRA_DIST = eilseq.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 \
+ po.m4 progtest.m4
--- /dev/null
+#serial 1
+
+AC_PREREQ(2.50)
+
+# The EILSEQ errno value ought to be defined in <errno.h>, according to
+# ISO C 99 and POSIX. But some systems (like SunOS 4) don't define it,
+# and some systems (like BSD/OS) define it in <wchar.h> not <errno.h>.
+
+# Define EILSEQ as a C macro and as a substituted macro in such a way that
+# 1. on all systems, after inclusion of <errno.h>, EILSEQ is usable,
+# 2. on systems where EILSEQ is defined elsewhere, we use the same numeric
+# value.
+
+AC_DEFUN([AC_EILSEQ],
+[
+ AC_REQUIRE([AC_PROG_CC])dnl
+
+ dnl Check for any extra headers that could define EILSEQ.
+ AC_CHECK_HEADERS(wchar.h)
+
+ AC_CACHE_CHECK([for EILSEQ], ac_cv_decl_EILSEQ, [
+ AC_EGREP_CPP(yes,[
+#include <errno.h>
+#ifdef EILSEQ
+yes
+#endif
+ ], have_eilseq=1)
+ if test -n "$have_eilseq"; then
+ dnl EILSEQ exists in <errno.h>. Don't need to define EILSEQ ourselves.
+ ac_cv_decl_EILSEQ=yes
+ else
+ AC_EGREP_CPP(yes,[
+#include <errno.h>
+#if HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+#ifdef EILSEQ
+yes
+#endif
+ ], have_eilseq=1)
+ if test -n "$have_eilseq"; then
+ dnl EILSEQ exists in some other system header.
+ dnl Define it to the same value.
+ _AC_COMPUTE_INT([EILSEQ], ac_cv_decl_EILSEQ, [
+#include <errno.h>
+#if HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+/* The following two lines are a workaround against an autoconf-2.52 bug. */
+#include <stdio.h>
+#include <stdlib.h>
+])
+ else
+ dnl EILSEQ isn't defined by the system. Define EILSEQ ourselves, but
+ dnl don't define it as EINVAL, because iconv() callers want to
+ dnl distinguish EINVAL and EILSEQ.
+ ac_cv_decl_EILSEQ=ENOENT
+ fi
+ fi
+ ])
+ if test "$ac_cv_decl_EILSEQ" != yes; then
+ AC_DEFINE_UNQUOTED([EILSEQ], [$ac_cv_decl_EILSEQ],
+ [Define as good substitute value for EILSEQ.])
+ EILSEQ="$ac_cv_decl_EILSEQ"
+ AC_SUBST(EILSEQ)
+ fi
+])
############################### Core ##############################
-AM_CPPFLAGS += -I$(top_srcdir)/src $(BOOST_INCLUDES) $(ZLIB_INCLUDES)
+AM_CPPFLAGS += -I$(top_srcdir)/src
+AM_CPPFLAGS += $(BOOST_INCLUDES) $(ICONV_INCLUDES) $(ZLIB_INCLUDES)
AM_CPPFLAGS += $(ENCHANT_CFLAGS) $(HUNSPELL_CFLAGS)
AM_CPPFLAGS += $(QT_CPPFLAGS) $(QT_CORE_INCLUDES)
tests/CMakeLists.txt
OTHERLIBS = $(BOOST_LIBS) $(MYTHES_LIBS) $(ENCHANT_LIBS) $(HUNSPELL_LIBS) \
- @LIBS@ $(ZLIB_LIBS) $(SOCKET_LIBS) $(LIBSHLWAPI) $(LIBPSAPI)
+ @LIBS@ $(ICONV_LIBS) $(ZLIB_LIBS) $(SOCKET_LIBS) \
+ $(LIBSHLWAPI) $(LIBPSAPI)
noinst_LIBRARIES = liblyxcore.a
bin_PROGRAMS = lyx
endif
check_layout_CPPFLAGS = $(AM_CPPFLAGS)
-check_layout_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI)
+check_layout_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ \
+ $(ICONV_LIBS) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI)
check_layout_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS)
check_layout_SOURCES = \
insets/InsetLayout.cpp \
tests/dummy_functions.cpp
check_ExternalTransforms_CPPFLAGS = $(AM_CPPFLAGS)
-check_ExternalTransforms_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI)
+check_ExternalTransforms_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ \
+ $(ICONV_LIBS) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI)
check_ExternalTransforms_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS)
check_ExternalTransforms_SOURCES = \
graphics/GraphicsParams.cpp \
tests/dummy_functions.cpp
check_Length_CPPFLAGS = $(AM_CPPFLAGS)
-check_Length_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI)
+check_Length_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ \
+ $(ICONV_LIBS) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI)
check_Length_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS)
check_Length_SOURCES = \
Length.cpp \
tests/dummy_functions.cpp
check_ListingsCaption_CPPFLAGS = $(AM_CPPFLAGS)
-check_ListingsCaption_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI)
+check_ListingsCaption_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ \
+ $(ICONV_LIBS) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI)
check_ListingsCaption_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS)
check_ListingsCaption_SOURCES = \
tests/check_ListingsCaption.cpp \
EXTRA_DIST = lyxclient.1in CMakeLists.txt
-AM_CPPFLAGS += -I$(srcdir)/.. $(BOOST_INCLUDES) $(ZLIB_INCLUDES)
+AM_CPPFLAGS += -I$(srcdir)/.. \
+ $(BOOST_INCLUDES) $(ICONV_INCLUDES) $(ZLIB_INCLUDES)
lyxclient_LDADD = \
$(top_builddir)/src/support/liblyxsupport.a \
- $(BOOST_LIBS) @LIBS@ $(ZLIB_LIBS) $(SOCKET_LIBS) \
+ $(BOOST_LIBS) @LIBS@ $(ICONV_LIBS) $(ZLIB_LIBS) $(SOCKET_LIBS) \
$(QT_LIB) $(QT_LDFLAGS) $(LIBSHLWAPI) $(LIBPSAPI)
if INSTALL_MACOSX
noinst_LIBRARIES = liblyxfrontends.a
-AM_CPPFLAGS += -I$(srcdir)/.. $(BOOST_INCLUDES) $(ZLIB_INCLUDES)
+AM_CPPFLAGS += -I$(srcdir)/.. \
+ $(BOOST_INCLUDES) $(ICONV_INCLUDES) $(ZLIB_INCLUDES)
liblyxfrontends_a_SOURCES = \
alert.h \
check_PROGRAMS = \
biblio
-biblio_LDADD = $(BOOST_LIBS) $(ZLIB_LIBS)
+biblio_LDADD = $(BOOST_LIBS) $(ICONV_LIBS) $(ZLIB_LIBS)
biblio_SOURCES = \
tests/biblio.cpp \
tests/boost.cpp
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/frontends \
-I$(top_srcdir)/images \
- $(QT_INCLUDES) $(BOOST_INCLUDES) $(ZLIB_INCLUDES)
+ $(QT_INCLUDES) \
+ $(BOOST_INCLUDES) $(ICONV_INCLUDES) $(ZLIB_INCLUDES)
SOURCEFILES = \
ButtonPolicy.cpp \
#
##################################################################
-AM_CPPFLAGS += -I$(srcdir)/.. $(BOOST_INCLUDES) $(ZLIB_INCLUDES) \
+AM_CPPFLAGS += -I$(srcdir)/.. \
+ $(BOOST_INCLUDES) $(ICONV_INCLUDES) $(ZLIB_INCLUDES) \
$(QT_CPPFLAGS) $(QT_INCLUDES)
liblyxsupport_a_SOURCES = \
AM_CPPFLAGS += -I$(top_srcdir)/src/tex2lyx \
-I$(top_srcdir)/src -I$(top_builddir) -I$(top_builddir)/src \
- $(BOOST_INCLUDES) $(ZLIB_INCLUDES)
+ $(BOOST_INCLUDES) $(ICONV_INCLUDES) $(ZLIB_INCLUDES)
TEST_FILES = \
test/runtests.cmake \
$(top_builddir)/src/support/liblyxsupport.a \
$(LIBICONV) $(BOOST_LIBS) \
$(QT_LIB) $(QT_LDFLAGS) \
- @LIBS@ $(ZLIB_LIBS) $(LIBSHLWAPI) $(LIBPSAPI)
+ @LIBS@ $(ICONV_LIBS) $(ZLIB_LIBS) $(LIBSHLWAPI) $(LIBPSAPI)
if INSTALL_MACOSX
tex2lyx_LDFLAGS = -framework AppKit \