home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / lyx-0.13.2.tar.gz / lyx-0.13.2.tar / lyx-0.13.2 / config / configure.in < prev    next >
Text File  |  1998-04-23  |  7KB  |  227 lines

  1. #! /bin/bash
  2. dnl Process with autoconf to generate configure script   -*- sh -*-
  3.  
  4. AC_INIT(src/lyx.C)
  5. AC_PREREQ(2.12) dnl We want to use autoconf 2.12
  6. AC_CONFIG_HEADER(src/config.h)
  7. AC_CONFIG_AUX_DIR(config)
  8.  
  9. # automatically set the program suffix if none have been given
  10. # (Temporarily disabled).
  11. #if test "$program_suffix" = NONE ; then
  12. #  if test "$lyx_devel_version" = yes ; then
  13. #    program_suffix="-devel"
  14. #  else
  15. #    program_suffix=
  16. #  fi
  17. #fi
  18. if test "$program_suffix" = NONE ; then
  19.     program_suffix=
  20. fi
  21.  
  22. AC_SUBST(program_suffix)
  23.  
  24. LYX_GET_VERSION(${srcdir}/src/version.h)
  25.  
  26. # The list of languages known to LyX
  27. # This is needed by GNU gettext
  28. ALL_LINGUAS="da de es fi fr hu nl no sv tr"
  29.  
  30. AC_PREFIX_PROGRAM(lyx)
  31.  
  32. # OS/2 would put .exe there.
  33. PROGEXT=
  34. AC_SUBST(PROGEXT)
  35.  
  36. # fix the value of the prefixes.
  37. test "x$prefix" = xNONE && prefix=$ac_default_prefix
  38. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
  39.  
  40. ### create the build directories if necessary
  41. test ! -d src && mkdir src 
  42.  
  43. ### Set the execute permissions of the various scripts correctly
  44. for file in config/install-sh config/mkinstalldirs config/hack-gcc \
  45.             lib/configure ; do
  46.   chmod 755 ${srcdir}/${file}
  47. done
  48.  
  49. absbuilddir=`pwd`
  50. abstopsrcdir=`cd ${srcdir} ; pwd`
  51. AC_SUBST(absbuilddir)
  52. AC_SUBST(abstopsrcdir)
  53.  
  54. ### Check for programs
  55. AC_PROG_MAKE_SET
  56. AC_PROG_INSTALL
  57.  
  58. ### Check for a C++ compiler
  59. AC_LANG_CPLUSPLUS
  60. LYX_PROG_CXX
  61. AC_PROG_CXXCPP
  62. # some compilers need that
  63. LIBS="-lc -lm $LIBS"
  64.  
  65. ### check for special systems
  66. AC_AIX
  67. LYX_HPUX
  68. LYX_SUNOS4
  69. LYX_SCO
  70.  
  71. ### we will also need a C compiler to compile GNU gettext
  72. AC_PROG_CC
  73. AC_ISC_POSIX
  74.  
  75. ### check the size of pointers and ints
  76. # the defaults are given for cross compilation.
  77. AC_CHECK_SIZEOF(void *, 4)
  78. AC_CHECK_SIZEOF(int, 4)
  79. dnl AC_CHECK_SIZEOF(long) dnl we don't use this one
  80.  
  81. ### check for compiler brokenness
  82. LYX_GXX_STRENGTH_REDUCE
  83. LYX_CXX_EXPLICIT
  84. AC_ARG_WITH(broken-const,
  85.   [  --with-broken-const     disable the keyword 'const'],
  86.   [AC_DEFINE(BROKEN_CONST)
  87.    lyx_flags="$lyx_flags broken-const"])
  88. # A hack to work around gcc compiler errors
  89. AC_ARG_WITH(gcc-hack,[  --with-gcc-hack         add a wrapper around gcc])
  90. if test "x$with_gcc_hack" = xyes ; then
  91.   CXX_COMMAND='${top_srcdir}/config/hack-gcc ${CXX}'
  92.   lyx_flags="$lyx_flags gcc-hack"
  93. else
  94.   CXX_COMMAND='${CXX}'
  95. fi
  96. AC_SUBST(CXX_COMMAND)
  97.  
  98. ### Add extra directories to check for libraries.
  99. LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
  100. LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
  101. test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
  102.  
  103. ### Add extra directories to check for include files.
  104. LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
  105. LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
  106. test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
  107.  
  108. ### Add both includes and libraries
  109. LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
  110. LYX_LOOP_DIR($lyx_cv_extra_prefix,[
  111. LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
  112.   LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
  113.  
  114. ### Check for the -liberty library
  115. test "x$GXX" = xyes && lyx_use_liberty=yes
  116. AC_ARG_WITH(liberty,
  117.   [  --without-liberty       do not try to link against libiberty.a],
  118.   [lyx_use_liberty=$withval])
  119. if test x$lyx_use_liberty = xyes; then
  120.   AC_CHECK_LIB(iberty,main,LIBS="-liberty $LIBS")
  121. fi
  122.  
  123. ### Check for X libraries
  124. # Check for the pt library (for SCO, needed for X)
  125. AC_CHECK_LIB(pt,ptsname,X_EXTRA_LIBS="-lpt $X_EXTRA_LIBS")
  126. # The real thing.
  127. AC_PATH_XTRA
  128. LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
  129. CPPFLAGS="$CPPFLAGS $X_CFLAGS"
  130.  
  131. ### Check for xforms and xpm (only if X has been found).
  132. if test "$have_x" = yes ; then
  133. # We surely need these two libraries and want to check carefully the
  134. # version numbers... 
  135. LYX_PATH_XPM
  136. LYX_PATH_XFORMS
  137. AC_SUBST(LYX_LIBS)
  138. else
  139. LYX_ERROR(dnl
  140. [Cannot find X window libraries and/or headers. Check your installation. 
  141.    If you use a Linux system, check that you have installed 
  142.    the development tools.])
  143. fi
  144.  
  145. ### Setup GNU gettext
  146. AC_LANG_C
  147. sinclude(./lcmessage.m4)
  148. sinclude(./progtest.m4)
  149. sinclude(./gettext.m4)
  150. AM_GNU_GETTEXT
  151. # a hack for those who try to change LyX, but do not have gettext installed 
  152. case  "${XGETTEXT}" in 
  153.  *:) XGETTEXT='cp ${srcdir}/lyx.pot ./${PACKAGE}.po ; :'
  154. esac
  155. # The definition of MKINSTALLDIRS in gettext.m4 is not correct
  156. MKINSTALLDIRS='config/mkinstalldirs'
  157. # We want to have libintl.h in src/ and not in intl/
  158. # This is a bit of a hack, indeed.
  159. if test "x$nls_cv_header_intl" = xintl/libintl.h ; then
  160.   nls_cv_header_intl=src/libintl.h
  161. fi
  162. AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
  163. AC_SUBST(LINGUAS)
  164. AC_LANG_CPLUSPLUS
  165.  
  166. # some standard header files
  167. AC_HEADER_DIRENT
  168. AC_HEADER_MAJOR
  169. AC_HEADER_STAT
  170. AC_CHECK_HEADERS(errno.h sys/time.h)
  171. AC_HEADER_TIME
  172.  
  173. # some functions we'd like to have
  174. AC_ARG_WITH(broken-headers,
  175.     [  --with-broken-headers      define some functions on SunOS4 and SCO],
  176.     [lyx_broken_headers=$withval])
  177. if test "x$lyx_broken_headers" = "xyes"; then
  178.   lyx_flags="$lyx_flags broken-headers"
  179.   AC_DEFINE(BROKEN_HEADERS)
  180. fi
  181. AC_CHECK_FUNCS(memmove memset strchr)
  182.  
  183. # SunOS 4.1.3 does not have strerror and atexit
  184. AC_REPLACE_FUNCS(strerror atexit)
  185.  
  186. AC_CACHE_CHECK([for bool type],lyx_cv_have_bool,[
  187. AC_TRY_LINK(, [bool foo = true;], lyx_cv_have_bool=yes,lyx_cv_have_bool=no)])
  188. test $lyx_cv_have_bool = 'yes' && AC_DEFINE(HAVE_bool)
  189.  
  190. ### and now some special lyx flags.
  191. AC_ARG_WITH(two-colors,[  --with-two-colors       use two color pixmaps],
  192.   [AC_DEFINE(TWO_COLOR_ICONS)
  193.    lyx_flags="$lyx_flags two-colors"])
  194. AC_ARG_WITH(debug,[  --with-debug            output debug information by default],
  195.   [AC_DEFINE(DEBUG_AS_DEFAULT)
  196.    lyx_flags="$lyx_flags debug"])
  197.  
  198. ### See what is needed to install reLyX
  199. LYX_CHECK_RELYX
  200.  
  201. ### Finish the work.
  202. LYX_DIR=`eval "echo \`eval \"echo ${datadir}/${PACKAGE}\"\`"`
  203. AC_SUBST(LYX_DIR)
  204. INSTALL_TARGET=install-unix
  205. AC_SUBST(INSTALL_TARGET)
  206. AC_CONFIG_SUBDIRS(lib)
  207. AC_OUTPUT(Makefile src/Makefile lib/Makefile intl/Makefile po/Makefile.in \
  208.           $output_reLyX,
  209.   [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
  210.    test -n "lib/reLyX/reLyX" && chmod 755 "lib/reLyX/reLyX"])
  211.  
  212. cat <<EOF
  213.  
  214. Configuration:
  215.   Source code location:       ${srcdir}
  216.   Compiler:                   ${CXX}
  217.   Compiler flags:             ${CXXFLAGS}
  218.   LyX binary dir:             `eval "echo \`eval \"echo ${bindir}\"\`"`
  219.   LyX files dir:              `eval "echo \`eval \"echo ${datadir}/${PACKAGE}\"\`"`
  220.   Special flags:              ${lyx_flags}
  221.  
  222. EOF
  223.  
  224. # Display a final warning if there has been a LYX_ERROR
  225. LYX_CHECK_ERRORS
  226.  
  227.