]> git.lyx.org Git - lyx.git/blob - configure.in
6b97c2f2f39d5940683f80480ecb256f6e5c07bb
[lyx.git] / configure.in
1 dnl Process with autoconf to generate configure script   -*- sh -*-
2
3 AC_INIT(src/lyx.C)
4 AC_PREREQ(2.13) dnl We want to use autoconf 2.13
5 AM_CONFIG_HEADER(src/config.h)
6 dnl This is a trick to make autoheader do the right thing
7 dnl AM_CONFIG_HEADER(src/config.h)
8 AC_CONFIG_AUX_DIR(config)
9 LYX_GET_VERSION(${srcdir}/src/version.h)
10
11 AC_CANONICAL_SYSTEM
12 AC_VALIDATE_CACHE_SYSTEM_TYPE
13
14 AM_INIT_AUTOMAKE(lyx, $VERSION)
15
16 # The list of languages known to LyX
17 # This is needed by GNU gettext
18 ALL_LINGUAS="ca cs da de es fi fr hu it nl no pl pt ru sl sv tr wa"
19
20 AC_PREFIX_PROGRAM(lyx)
21
22 # fix the value of the prefixes.
23 test "x$prefix" = xNONE && prefix=$ac_default_prefix
24 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
25
26 ### Set the execute permissions of the various scripts correctly
27 for file in config/install-sh config/mkinstalldirs lib/configure ; do
28   chmod 755 ${srcdir}/${file}
29 done
30
31 ### Check for programs
32 AC_PROG_MAKE_SET
33 AC_PROG_INSTALL
34 #AC_PROG_RANLIB
35 AC_CHECK_PROG(KPSEWHICH, kpsewhich, kpsewhich, :)
36 if test "x$KPSEWHICH" = xkpsewhich ; then
37     AC_DEFINE(HAVE_KPSEWHICH, 1,
38     [Define this if you have the kpsewhich program working on your system.])
39 fi
40
41 ### we will also need a C compiler to compile GNU gettext
42 AC_PROG_CC
43
44 ### check for special systems
45 AC_ISC_POSIX
46 AC_AIX
47 LYX_HPUX
48 LYX_SUNOS4
49 LYX_SCO
50
51 ### Check for program extensions (.exe or nothing)
52 AC_EXEEXT
53
54 ### Check for a C++ compiler
55 AC_LANG_CPLUSPLUS
56 LYX_PROG_CXX
57 AC_PROG_CXXCPP
58 AC_DISABLE_SHARED
59 AC_LIBTOOL_WIN32_DLL
60 AM_PROG_LIBTOOL
61
62 ### Some checks on what the C++ compiler can(not) do
63 LYX_CXX_MUTABLE
64 LYX_CXX_PARTIAL
65 LYX_CXX_EXPLICIT
66 dnl we do not use stl stack, or at least not on gcc 2.7, which was the 
67 dnl cause for this test. 
68 dnl LYX_CXX_STL_STACK
69 LYX_CXX_STL_STRING
70 LYX_CXX_NAMESPACES
71 LYX_CXX_CHEADERS
72 LYX_STD_COUNT
73 dnl we disable rtti for now
74 dnl LYX_CXX_RTTI
75 AC_CHECK_HEADERS(ostream istream sstream)
76 LYX_CXX_STL_MODERN_STREAMS
77
78 ### We need a regex implementation, so we provide our own if none is found.
79 LYX_REGEX
80
81 ### Library Files
82 dnl by testing these we check if it is ok to have
83 dnl -lc and -lm as args to the compiler
84 AC_CHECK_LIB(m, sin)
85 AC_CHECK_LIB(c, fopen)
86
87 ### Add extra directories to check for libraries.
88 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
89 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
90 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
91
92 ### Add extra directories to check for include files.
93 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
94 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
95 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
96
97 ### Add both includes and libraries
98 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
99 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
100 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
101   LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
102  
103 ### Check for the -liberty library
104 test "x$GXX" = xyes && lyx_use_liberty=yes
105 AC_ARG_WITH(liberty,
106   [  --without-liberty       do not try to link against libiberty.a],
107   [lyx_use_liberty=$withval])
108 if test x$lyx_use_liberty = xyes; then
109   # AC_CHECK_LIB(iberty,main,LIBS="-liberty $LIBS")
110   AC_CHECK_LIB(iberty,main)
111 fi
112
113 ### Check for X libraries
114 # Check for the pt library (for SCO, needed for X)
115 AC_CHECK_LIB(pt,ptsname,X_EXTRA_LIBS="-lpt $X_EXTRA_LIBS")
116 # The real thing.
117 AC_PATH_XTRA
118 LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
119 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
120
121 ## Check whether X is new enough to handle the input method stuff
122 AC_CHECK_FUNCS(XOpenIM)
123
124 ### Check for xforms and xpm (only if X has been found).
125 if test "$have_x" = yes ; then
126 # We surely need these two libraries and want to check carefully the
127 # version numbers... 
128 LYX_PATH_XPM
129 LYX_PATH_XFORMS
130 AC_SUBST(LYX_LIBS)
131 else
132 LYX_ERROR(dnl
133 [Cannot find X window libraries and/or headers. Check your installation. 
134    If you use a Linux system, check that you have installed 
135    the development tools.])
136 fi
137
138 ### Setup GNU gettext
139 dnl GNU gettext is written in C
140 AC_LANG_C
141 # Some tests that may be useful for gettext
142 AC_C_CONST
143 AC_C_INLINE
144 # Do the real setup now
145 AM_GNU_GETTEXT
146 # a hack for those who try to change LyX, but do not have gettext installed 
147 case  "${XGETTEXT}" in 
148  *:) XGETTEXT='cp ${srcdir}/lyx.pot ./${PACKAGE}.po ; :'
149 esac
150
151 AC_SUBST(LINGUAS)
152
153 AC_LANG_CPLUSPLUS
154
155 # some standard header files
156 AC_HEADER_DIRENT
157 AC_HEADER_MAJOR
158 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h)
159
160 # some annoying header files
161 #LYX_PATH_HEADER(stl_string_fwd.h)
162 LYX_STL_STRING_FWD
163
164 # some standard structures
165 AC_HEADER_STAT
166 AC_HEADER_TIME
167 AC_STRUCT_ST_BLKSIZE
168 AC_STRUCT_ST_BLOCKS
169 AC_STRUCT_ST_RDEV
170
171 # some standard types
172 AC_TYPE_MODE_T
173 AC_TYPE_OFF_T
174 AC_TYPE_PID_T
175 AC_TYPE_SIGNAL
176 AC_TYPE_SIZE_T
177 AC_TYPE_UID_T
178
179 # some functions we'd like to have
180 AC_ARG_WITH(broken-headers,
181     [  --with-broken-headers   define some functions on SunOS4 and SCO],
182     [lyx_broken_headers=$withval])
183 if test "x$lyx_broken_headers" = "xyes"; then
184   lyx_flags="$lyx_flags broken-headers"
185   AC_DEFINE(BROKEN_HEADERS, 1,
186     [Define on SunOS 4 and SCO, were some functions are missing from the headers])
187 fi
188 AC_CHECK_FUNCS(memmove memset strchr putenv setenv mkfifo)
189
190 dnl Until this is fixed in autoconf we provide our own version
191 LYX_FUNC_SELECT_ARGTYPES
192
193 dnl check whether we have to work around solaris broken putenv()
194 LYX_FUNC_PUTENV_ARGTYPE
195
196 # SunOS 4.1.3 does not have strerror and atexit
197 AC_REPLACE_FUNCS(strerror atexit)
198
199 ### and now some special lyx flags.
200 AC_ARG_WITH(two-colors,[  --with-two-colors       use two color pixmaps],
201   [AC_DEFINE(TWO_COLOR_ICONS,1,
202      [You might want to define TWO_COLOR_ICONS if you want to spare
203  your colormap.  This will use monochrome icons instead of colored ones.])
204    lyx_flags="$lyx_flags two-colors"])
205 AC_ARG_ENABLE(assertions,
206   [  --enable-assertions     add runtime sanity checks in the program],,
207   [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
208         enable_assertions=yes;
209     else
210         enable_assertions=no;
211     fi;])
212 if test "x$enable_assertions" = xyes ; then
213    lyx_flags="$lyx_flags assertions"
214    AC_DEFINE(ENABLE_ASSERTIONS,1,
215     [Define if you want assertions to be enabled in the code])
216 fi
217
218 ### Finish the work.
219 AC_CONFIG_SUBDIRS(lib lib/reLyX)
220 AC_OUTPUT([Makefile \
221        development/lyx.spec \
222        lib/Makefile \
223        intl/Makefile \
224        po/Makefile.in \
225        src/Makefile \
226        src/mathed/Makefile \
227        src/insets/Makefile \
228        src/support/Makefile \
229 ],  [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
230
231
232 cat <<EOF
233
234 Configuration:
235   Source code location:       ${srcdir}
236   C++ Compiler:                   ${CXX}
237   C++ Compiler flags:             ${CXXFLAGS}
238   C   Compiler:                   ${CC}
239   C   Compiler flags:             ${CFLAGS}
240   LyX binary dir:             `eval "echo \`eval \"echo ${bindir}\"\`"`
241   LyX files dir:              `eval "echo \`eval \"echo ${datadir}/${PACKAGE}\"\`"`
242   Special flags:              ${lyx_flags}
243
244 EOF
245
246 # Display a final warning if there has been a LYX_ERROR
247 LYX_CHECK_ERRORS
248