]> git.lyx.org Git - lyx.git/blob - configure.in
fixes because of SUN CC warnings, bmtable now compiled with C compilator, countChar...
[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 ### check the size of pointers and ints
63 # the defaults are given for cross compilation.
64 LYX_CXX_MUTABLE
65 LYX_CXX_PARTIAL
66 LYX_CXX_EXPLICIT
67 dnl we do not use stl stack, or at least not on gcc 2.7, which was the 
68 dnl cause for this test. 
69 dnl LYX_CXX_STL_STACK
70 LYX_CXX_STL_STRING
71 LYX_CXX_NAMESPACES
72 LYX_CXX_CHEADERS
73 LYX_STD_COUNT
74 dnl we disable rtti for now
75 dnl LYX_CXX_RTTI
76 AC_CHECK_HEADERS(ostream istream)
77 LYX_CXX_STL_MODERN_STREAMS
78
79 ### Library Files
80 dnl by testing these we check if it is ok to have
81 dnl -lc and -lm as args to the compiler
82 AC_CHECK_LIB(m, sin)
83 AC_CHECK_LIB(c, fopen)
84
85 ### Add extra directories to check for libraries.
86 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
87 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
88 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
89
90 ### Add extra directories to check for include files.
91 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
92 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
93 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
94
95 ### Add both includes and libraries
96 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
97 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
98 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
99   LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
100  
101 ### Check for the -liberty library
102 test "x$GXX" = xyes && lyx_use_liberty=yes
103 AC_ARG_WITH(liberty,
104   [  --without-liberty       do not try to link against libiberty.a],
105   [lyx_use_liberty=$withval])
106 if test x$lyx_use_liberty = xyes; then
107   # AC_CHECK_LIB(iberty,main,LIBS="-liberty $LIBS")
108   AC_CHECK_LIB(iberty,main)
109 fi
110
111 ### Check for X libraries
112 # Check for the pt library (for SCO, needed for X)
113 AC_CHECK_LIB(pt,ptsname,X_EXTRA_LIBS="-lpt $X_EXTRA_LIBS")
114 # The real thing.
115 AC_PATH_XTRA
116 LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
117 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
118
119 ## Check whether X is new enough to handle the input method stuff
120 AC_CHECK_FUNCS(XOpenIM)
121
122 ### Check for xforms and xpm (only if X has been found).
123 if test "$have_x" = yes ; then
124 # We surely need these two libraries and want to check carefully the
125 # version numbers... 
126 LYX_PATH_XPM
127 LYX_PATH_XFORMS
128 AC_SUBST(LYX_LIBS)
129 else
130 LYX_ERROR(dnl
131 [Cannot find X window libraries and/or headers. Check your installation. 
132    If you use a Linux system, check that you have installed 
133    the development tools.])
134 fi
135
136 ### Setup GNU gettext
137 dnl GNU gettext is written in C
138 AC_LANG_C
139 # Some tests that may be useful for gettext
140 AC_C_CONST
141 AC_C_INLINE
142 # Do the real setup now
143 AM_GNU_GETTEXT
144 # a hack for those who try to change LyX, but do not have gettext installed 
145 case  "${XGETTEXT}" in 
146  *:) XGETTEXT='cp ${srcdir}/lyx.pot ./${PACKAGE}.po ; :'
147 esac
148
149 AC_SUBST(LINGUAS)
150
151 AC_LANG_CPLUSPLUS
152
153 # some standard header files
154 AC_HEADER_DIRENT
155 AC_HEADER_MAJOR
156 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h)
157
158 # some annoying header files
159 #LYX_PATH_HEADER(stl_string_fwd.h)
160 LYX_STL_STRING_FWD
161
162 # some standard structures
163 AC_HEADER_STAT
164 AC_HEADER_TIME
165 AC_STRUCT_ST_BLKSIZE
166 AC_STRUCT_ST_BLOCKS
167 AC_STRUCT_ST_RDEV
168
169 # some standard types
170 AC_TYPE_MODE_T
171 AC_TYPE_OFF_T
172 AC_TYPE_PID_T
173 AC_TYPE_SIGNAL
174 AC_TYPE_SIZE_T
175 AC_TYPE_UID_T
176
177 # some functions we'd like to have
178 AC_ARG_WITH(broken-headers,
179     [  --with-broken-headers   define some functions on SunOS4 and SCO],
180     [lyx_broken_headers=$withval])
181 if test "x$lyx_broken_headers" = "xyes"; then
182   lyx_flags="$lyx_flags broken-headers"
183   AC_DEFINE(BROKEN_HEADERS, 1,
184     [Define on SunOS 4 and SCO, were some functions are missing from the headers])
185 fi
186 AC_CHECK_FUNCS(memmove memset strchr putenv setenv mkfifo)
187
188 dnl Until this is fixed in autoconf we provide our own version
189 LYX_FUNC_SELECT_ARGTYPES
190
191 # SunOS 4.1.3 does not have strerror and atexit
192 AC_REPLACE_FUNCS(strerror atexit)
193
194 ### and now some special lyx flags.
195 AC_ARG_WITH(two-colors,[  --with-two-colors       use two color pixmaps],
196   [AC_DEFINE(TWO_COLOR_ICONS)
197    lyx_flags="$lyx_flags two-colors"])
198 AC_ARG_ENABLE(assertions,
199   [  --enable-assertions     add runtime sanity checks in the program],,
200   [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
201         enable_assertions=yes;
202     else
203         enable_assertions=no;
204     fi;])
205 if test "x$enable_assertions" = xyes ; then
206    lyx_flags="$lyx_flags assertions"
207    AC_DEFINE(ENABLE_ASSERTIONS,1,
208     [Define if you want assertions to be enabled in the code])
209 fi
210
211 ### Finish the work.
212 AC_CONFIG_SUBDIRS(lib lib/reLyX)
213 AC_OUTPUT([Makefile \
214        development/lyx.spec \
215        lib/Makefile \
216        intl/Makefile \
217        po/Makefile.in \
218        src/Makefile \
219        src/mathed/Makefile \
220        src/insets/Makefile \
221        src/support/Makefile \
222 ],  [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
223
224
225 cat <<EOF
226
227 Configuration:
228   Source code location:       ${srcdir}
229   C++ Compiler:                   ${CXX}
230   C++ Compiler flags:             ${CXXFLAGS}
231   C   Compiler:                   ${CC}
232   C   Compiler flags:             ${CFLAGS}
233   LyX binary dir:             `eval "echo \`eval \"echo ${bindir}\"\`"`
234   LyX files dir:              `eval "echo \`eval \"echo ${datadir}/${PACKAGE}\"\`"`
235   Special flags:              ${lyx_flags}
236
237 EOF
238
239 # Display a final warning if there has been a LYX_ERROR
240 LYX_CHECK_ERRORS
241