PageRenderTime 54ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/lyx-2.0.4/configure.ac

#
m4 | 388 lines | 266 code | 58 blank | 64 comment | 0 complexity | e2e302c43f83af7e32626aa5242ef9a7 MD5 | raw file
Possible License(s): LGPL-2.0, GPL-2.0
  1. dnl Process with autoconf to generate configure script -*- sh -*-
  2. AC_INIT(LyX,2.0.4,[lyx-devel@lists.lyx.org],[lyx])
  3. # Use ISO format only. The frontend needs to parse this
  4. AC_SUBST(LYX_DATE, ["2012-06-25"])
  5. AC_PREREQ(2.52)
  6. AC_CONFIG_SRCDIR(src/main.cpp)
  7. AC_CONFIG_HEADERS([config.h])
  8. AC_CONFIG_AUX_DIR(config)
  9. # First check the version
  10. LYX_CHECK_VERSION
  11. LYX_VERSION_SUFFIX
  12. # Check how the files should be packaged
  13. AC_CANONICAL_TARGET
  14. LYX_USE_PACKAGING
  15. # We need to define these variables here and the no-define option of
  16. # AM_INIT_AUTOMAKE above because we alter $PACKAGE in LYX_USE_PACKAGING.
  17. AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
  18. dnl Default maintainer mode to true for development versions
  19. if test "${enable_maintainer_mode+set}" != set; then
  20. enable_maintainer_mode=$lyx_devel_version
  21. fi
  22. AM_MAINTAINER_MODE
  23. save_PACKAGE=$PACKAGE
  24. AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.8])
  25. m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
  26. PACKAGE=$save_PACKAGE
  27. # Allow to build some parts of the code as one big chunk
  28. m4_define([ALLPARTS],[boost,client,insets,mathed,core,tex2lyx,frontend_qt4])
  29. AC_ARG_ENABLE(monolithic-build,
  30. AC_HELP_STRING([--enable-monolithic-build@<:@=LIST@:>@],
  31. [Use monolithic build for modules in LIST (default: ALLPARTS)]),
  32. [test "$enable_monolithic_build" = yes && enable_monolithic_build="ALLPARTS"
  33. test "$enable_monolithic_build" = no && enable_monolithic_build=
  34. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=" ,"
  35. for i in $enable_monolithic_build ; do
  36. eval "enable_monolithic_$i=yes"
  37. done
  38. IFS="$ac_save_ifs"],
  39. [enable_monolithic_build=])
  40. AM_CONDITIONAL(MONOLITHIC_BOOST, test "x$enable_monolithic_boost" = "xyes")
  41. AM_CONDITIONAL(MONOLITHIC_CLIENT, test "x$enable_monolithic_client" = "xyes")
  42. AM_CONDITIONAL(MONOLITHIC_INSETS, test "x$enable_monolithic_insets" = "xyes")
  43. AM_CONDITIONAL(MONOLITHIC_MATHED, test "x$enable_monolithic_mathed" = "xyes")
  44. AM_CONDITIONAL(MONOLITHIC_CORE, test "x$enable_monolithic_core" = "xyes")
  45. AM_CONDITIONAL(MONOLITHIC_TEX2LYX, test "x$enable_monolithic_tex2lyx" = "xyes")
  46. AM_CONDITIONAL(MONOLITHIC_FRONTEND_QT4, test "x$enable_monolithic_frontend_qt4" = "xyes")
  47. ### Set the execute permissions of the various scripts correctly
  48. for file in config/install-sh ; do
  49. chmod 755 ${srcdir}/${file}
  50. done
  51. # Check for installed python
  52. AM_PATH_PYTHON(2.4.0,, :)
  53. ### we need to know the byte order for unicode conversions
  54. AC_C_BIGENDIAN
  55. ### check which frontend we want to use
  56. LYX_USE_FRONTENDS
  57. ### Check for a C++ compiler
  58. LYX_PROG_CXX
  59. ### Objective-C compiler
  60. AC_PROG_OBJC
  61. _AM_DEPENDENCIES([OBJC])
  62. ### Add extra directories to check for libraries.
  63. LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
  64. LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
  65. test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
  66. ### Add extra directories to check for include files.
  67. LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
  68. LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
  69. test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
  70. ### Add both includes and libraries
  71. LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
  72. LYX_LOOP_DIR($lyx_cv_extra_prefix,[
  73. LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
  74. LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
  75. ### These are needed in windows
  76. AC_CHECK_LIB(shlwapi, main, [LIBSHLWAPI=-lshlwapi])
  77. AC_SUBST(LIBSHLWAPI)
  78. AC_CHECK_LIB(psapi, main, [LIBPSAPI=-lpsapi])
  79. AC_SUBST(LIBPSAPI)
  80. AC_CHECK_LIB(gdi32, main)
  81. LYX_USE_INCLUDED_BOOST
  82. LYX_USE_INCLUDED_MYTHES
  83. # Needed for our char_type
  84. AC_CHECK_SIZEOF(wchar_t)
  85. ### We need iconv for unicode support (Qt4 frontend requires it too)
  86. AM_ICONV
  87. if test "$am_cv_func_iconv" = no; then
  88. LYX_ERROR([Cannot find required library iconv])
  89. else
  90. LIBS="$LIBS $LIBICONV"
  91. fi
  92. ### check for compression support
  93. AC_CHECK_HEADERS(zlib.h,
  94. [AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_LIB_ERROR(libz,zlib))],
  95. [LYX_LIB_ERROR(zlib.h,zlib)])
  96. ### check which frontend we want to use
  97. dnl The code below is not in a macro, because this would cause big
  98. dnl problems with the AC_REQUIRE contained in QT4_DO_IT_ALL.
  99. for frontend in $FRONTENDS ; do
  100. case "$frontend" in
  101. qt4)
  102. QT4_DO_IT_ALL
  103. FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt4\$(EXEEXT)"
  104. FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt4"
  105. RPM_FRONTEND="qt4"
  106. FRONTEND_INFO="${FRONTEND_INFO}\
  107. Qt 4 Frontend:\n\
  108. Qt 4 version:\t\t${QT4_VERSION}\n"
  109. dnl qt 4 build will fail without moc or uic
  110. if test -z "$MOC4"; then
  111. LYX_ERROR([moc 4 binary not found !])
  112. fi
  113. if test -z "$UIC4"; then
  114. LYX_ERROR([uic 4 binary not found !])
  115. fi
  116. if test -z "$QT4_LIB"; then
  117. LYX_ERROR([qt 4 library not found !])
  118. fi
  119. ;;
  120. *)
  121. LYX_ERROR(Unknown frontend '$frontend');;
  122. esac
  123. done
  124. # fix the value of the prefixes.
  125. test "x$prefix" = xNONE && prefix=$default_prefix
  126. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
  127. if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
  128. LYX_WARNING([The installation prefix \"${prefix}\" contains a space, which
  129. causes problems with the Makefiles. The installation will be done in
  130. directory \"`pwd`/installprefix\" instead. Please move its contents to
  131. the right place after installation.])
  132. prefix=`pwd`/installprefix
  133. fi
  134. ### Setup GNU gettext
  135. dnl GNU gettext is written in C
  136. AC_LANG_PUSH(C)
  137. dnl Dirty trick ahead: disable macro AC_GNU_SOURCE because it triggers a bug with autoconf 2.62.
  138. dnl this can be removed if gettext is been updated to avoid that.
  139. m4_undefine([AC_GNU_SOURCE])
  140. m4_defun([AC_GNU_SOURCE],[])
  141. AM_GNU_GETTEXT([no-libtool])
  142. AM_GNU_GETTEXT_VERSION([0.16.1])
  143. AC_LANG_POP(C)
  144. # some standard header files
  145. AC_HEADER_MAJOR
  146. AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h locale.h utime.h sys/utime.h)
  147. # some standard structures
  148. AC_HEADER_STAT
  149. AC_HEADER_TIME
  150. # some standard types
  151. AC_CHECK_TYPE(mode_t,[AC_DEFINE(HAVE_MODE_T, 1, [Define this to 1 if your compiler supports the mode_t type.])])
  152. AC_TYPE_OFF_T
  153. AC_TYPE_PID_T
  154. AC_TYPE_SIGNAL
  155. AC_TYPE_SIZE_T
  156. AC_TYPE_UID_T
  157. LYX_CHECK_DEF(PATH_MAX, limits.h, [int n = PATH_MAX;])
  158. AC_CHECK_FUNCS(chmod close _close fork getpid _getpid lstat mkfifo open _open pclose _pclose popen _popen readlink strerror)
  159. # Check the form of mkdir()
  160. AC_FUNC_MKDIR
  161. AC_FUNC_SELECT_ARGTYPES
  162. LYX_CHECK_SPELL_ENGINES
  163. lyx_client_subdir=true
  164. AC_LANG_PUSH(C)
  165. dnl LIBS already contains some X extra libs that may interfere.
  166. save_LIBS="$LIBS"
  167. LIBS=
  168. AC_CHECK_FUNCS(fcntl,
  169. [AC_SEARCH_LIBS([gethostbyname], [nsl])
  170. AC_SEARCH_LIBS([socket], [socket], [],
  171. [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
  172. [], [-lnsl])])],
  173. [lyx_client_subdir=false])
  174. AC_SUBST(SOCKET_LIBS,$LIBS)
  175. LIBS="$save_LIBS"
  176. AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
  177. AC_LANG_POP(C)
  178. lyx_win_res=false;
  179. case ${host} in
  180. *mingw*|*cygwin*) lyx_win_res=true;;
  181. esac
  182. AM_CONDITIONAL(LYX_WIN_RESOURCE, $lyx_win_res)
  183. LYX_SET_VERSION_INFO
  184. ### Some information on what just happened
  185. real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
  186. real_pkgdatadir=`eval "echo \`eval \"echo \\\`eval \\\"echo ${pkgdatadir}\\\"\\\`\"\`"`
  187. real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
  188. VERSION_INFO="Configuration\n\
  189. Host type: ${host}\n\
  190. Special build flags: ${lyx_flags}\n\
  191. C Compiler: ${CC} ${CC_VERSION}\n\
  192. C Compiler LyX flags: ${AM_CPPFLAGS} ${AM_CFLAGS}\n\
  193. C Compiler flags: ${CPPFLAGS} ${CFLAGS}\n\
  194. C++ Compiler: ${CXX} ${CXX_VERSION}\n\
  195. C++ Compiler LyX flags: ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\
  196. C++ Compiler flags: ${CPPFLAGS} ${CXXFLAGS}\n\
  197. Linker flags: ${AM_LDFLAGS}\n\
  198. Linker user flags: ${LDFLAGS}\n\
  199. ${FRONTEND_INFO}\
  200. Packaging: ${lyx_use_packaging}\n\
  201. LyX binary dir: ${real_bindir}\n\
  202. LyX files dir: ${real_pkgdatadir}\n"
  203. AC_SUBST(VERSION_INFO)
  204. AC_SUBST(RPM_FRONTEND)
  205. AC_SUBST(AM_CPPFLAGS)
  206. AC_SUBST(AM_CXXFLAGS)
  207. AC_SUBST(AM_CFLAGS)
  208. AC_SUBST(AM_LDFLAGS)
  209. AC_SUBST(real_pkgdatadir)
  210. ## Some config.h stuff
  211. AH_TOP([
  212. /* -*- C++ -*- */
  213. /*
  214. * \file config.h
  215. * This file is part of LyX, the document processor.
  216. * Licence details can be found in the file COPYING.
  217. *
  218. * This is the compilation configuration file for LyX.
  219. * It was generated by autoconfs configure.
  220. * You might want to change some of the defaults if something goes wrong
  221. * during the compilation.
  222. */
  223. #ifndef _CONFIG_H
  224. #define _CONFIG_H
  225. ])
  226. AH_BOTTOM([
  227. /************************************************************
  228. ** You should not need to change anything beyond this point */
  229. #ifndef HAVE_STRERROR
  230. #if defined(__cplusplus)
  231. extern "C"
  232. #endif
  233. char * strerror(int n);
  234. #endif
  235. #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
  236. # define USE_BOOST_FORMAT 1
  237. #else
  238. # define USE_BOOST_FORMAT 0
  239. #endif
  240. #define BOOST_USER_CONFIG <config.h>
  241. #if !defined(ENABLE_ASSERTIONS)
  242. # define BOOST_DISABLE_ASSERTS 1
  243. #endif
  244. #define BOOST_ENABLE_ASSERT_HANDLER 1
  245. #define BOOST_DISABLE_THREADS 1
  246. #define BOOST_NO_WREGEX 1
  247. #define BOOST_NO_WSTRING 1
  248. // TR1 regex not supported in GCC <= 4.5
  249. #ifndef LYX_USE_TR1
  250. # if __GNUC__ == 4
  251. # define LYX_USE_TR1
  252. # endif
  253. #endif
  254. #ifdef __CYGWIN__
  255. # define NOMINMAX
  256. # define BOOST_POSIX 1
  257. # define BOOST_POSIX_API 1
  258. # define BOOST_POSIX_PATH 1
  259. #endif
  260. /*
  261. * the FreeBSD libc uses UCS4, but libstdc++ has no proper wchar_t
  262. * support compiled in:
  263. * http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#3_9
  264. * And we are not interested at all what libc
  265. * does: What we need is a 32bit wide wchar_t, and a libstdc++ that
  266. * has the needed wchar_t support and uses UCS4. Whether it
  267. * implements this with the help of libc, or whether it has own code
  268. * does not matter for us, because we do not use libc directly (Georg)
  269. */
  270. #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4 && !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
  271. # define USE_WCHAR_T
  272. #endif
  273. #endif
  274. ])
  275. MSYS_AC_CANONICAL_PATH(lyx_abs_top_srcdir, ${srcdir})
  276. MSYS_AC_CANONICAL_PATH(lyx_abs_installed_localedir, ${real_localedir})
  277. MSYS_AC_CANONICAL_PATH(lyx_abs_installed_datadir, ${real_pkgdatadir})
  278. AC_DEFINE_UNQUOTED([LYX_ABS_TOP_SRCDIR],
  279. "${lyx_abs_top_srcdir}", [Top source directory])
  280. AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_LOCALEDIR],
  281. "${lyx_abs_installed_localedir}",[Hard coded locale directory])
  282. AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_DATADIR],
  283. "${lyx_abs_installed_datadir}",[Hard system support directory])
  284. AC_DEFINE_UNQUOTED([PROGRAM_SUFFIX],
  285. "${version_suffix}",[Program version suffix])
  286. AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
  287. AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
  288. AC_DEFINE_UNQUOTED([LYX_DIR_VER],"$lyx_dir_ver",[Versioned env var for system dir])
  289. AC_DEFINE_UNQUOTED([LYX_USERDIR_VER],"$lyx_userdir_ver",[Versioned env var for user dir])
  290. AC_DEFINE_UNQUOTED([LYX_MAJOR_VERSION],$lyx_major,[Major version number])
  291. AC_DEFINE_UNQUOTED([LYX_MINOR_VERSION],$lyx_minor,[Minor version number])
  292. AC_DEFINE_UNQUOTED([LYX_RELEASE_LEVEL],$lyx_release,[Release version number])
  293. AC_DEFINE_UNQUOTED([LYX_RELEASE_PATCH],$lyx_patch,[Patch version number])
  294. AC_CONFIG_FILES([Makefile \
  295. lyx.1:lyx.1in \
  296. boost/Makefile \
  297. config/Makefile \
  298. development/Makefile \
  299. development/MacOSX/Makefile \
  300. development/MacOSX/Info.plist \
  301. development/MacOSX/lyxrc.dist \
  302. development/MacOSX/spotlight/Makefile \
  303. development/cygwin/Makefile \
  304. development/cygwin/lyxrc.dist \
  305. development/lyx.spec \
  306. intl/Makefile \
  307. lib/Makefile \
  308. lib/doc/Makefile \
  309. lib/lyx2lyx/lyx2lyx_version.py \
  310. lib/lyx2lyx/Makefile \
  311. m4/Makefile \
  312. po/Makefile.in \
  313. sourcedoc/Doxyfile \
  314. sourcedoc/Makefile \
  315. src/client/Makefile \
  316. src/client/lyxclient.1:src/client/lyxclient.1in \
  317. src/Makefile \
  318. src/tex2lyx/Makefile \
  319. src/tex2lyx/tex2lyx.1:src/tex2lyx/tex2lyx.1in \
  320. src/support/Makefile \
  321. src/frontends/Makefile \
  322. src/frontends/qt4/Makefile
  323. ])
  324. AC_OUTPUT
  325. # show version information
  326. echo
  327. printf "$VERSION_INFO"
  328. echo
  329. # Display a final warning if there has been a LYX_ERROR
  330. LYX_CHECK_ERRORS