]> git.lyx.org Git - lyx.git/blob - configure.in
removed some dead code from BufferView, added a check for kpsewhich in configure...
[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 config/hack-gcc \
28             lib/configure ; do
29   chmod 755 ${srcdir}/${file}
30 done
31
32 ### Check for programs
33 AC_PROG_MAKE_SET
34 AC_PROG_INSTALL
35 AC_PROG_RANLIB
36 AC_CHECK_PROG(KPSEWHICH, kpsewhich, kpsewhich, :)
37 if test "x$KPSEWHICH" = xkpsewhich ; then
38     AC_DEFINE(HAVE_KPSEWHICH, 1,
39     [Define this if you have the kpsewhich program working on your system.])
40 fi
41
42 ### we will also need a C compiler to compile GNU gettext
43 AC_PROG_CC
44
45 ### check for special systems
46 AC_ISC_POSIX
47 AC_AIX
48 LYX_HPUX
49 LYX_SUNOS4
50 LYX_SCO
51
52 ### Check for program extensions (.exe or nothing)
53 AC_EXEEXT
54
55 ### Check for a C++ compiler
56 AC_LANG_CPLUSPLUS
57 LYX_PROG_CXX
58 AC_PROG_CXXCPP
59
60 ### Compiler Characteristics
61 AC_C_CONST
62 AC_C_INLINE
63
64 ### check the size of pointers and ints
65 # the defaults are given for cross compilation.
66 AC_CHECK_SIZEOF(void *, 4)
67 AC_CHECK_SIZEOF(int, 4)
68 LYX_CXX_MUTABLE
69 LYX_CXX_PARTIAL
70 LYX_CXX_EXPLICIT
71 LYX_CXX_STL_STACK
72 LYX_CXX_STL_STRING
73 LYX_CXX_NAMESPACES
74 LYX_CXX_RTTI
75
76 ### check for compiler brokenness
77 LYX_GXX_STRENGTH_REDUCE
78
79 ### Libarary 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 # A hack to work around gcc compiler errors
86 AC_ARG_WITH(gcc-hack,[  --with-gcc-hack         add a wrapper around gcc])
87 if test "x$with_gcc_hack" = xyes ; then
88   CXX_COMMAND='${top_srcdir}/config/hack-gcc ${CXX}'
89   lyx_flags="$lyx_flags gcc-hack"
90 else
91   CXX_COMMAND='${CXX}'
92 fi
93 AC_SUBST(CXX_COMMAND)
94
95 ### Add extra directories to check for libraries.
96 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
97 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
98 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
99
100 ### Add extra directories to check for include files.
101 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
102 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
103 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
104
105 ### Add both includes and libraries
106 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
107 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
108 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
109   LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
110  
111 ### Check for the -liberty library
112 test "x$GXX" = xyes && lyx_use_liberty=yes
113 AC_ARG_WITH(liberty,
114   [  --without-liberty       do not try to link against libiberty.a],
115   [lyx_use_liberty=$withval])
116 if test x$lyx_use_liberty = xyes; then
117   # AC_CHECK_LIB(iberty,main,LIBS="-liberty $LIBS")
118   AC_CHECK_LIB(iberty,main)
119 fi
120
121 ### Check for X libraries
122 # Check for the pt library (for SCO, needed for X)
123 AC_CHECK_LIB(pt,ptsname,X_EXTRA_LIBS="-lpt $X_EXTRA_LIBS")
124 # The real thing.
125 AC_PATH_XTRA
126 LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
127 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
128
129 ## Check whether X is new enough to handle the input method stuff
130 AC_CHECK_FUNC(XOpenIM)
131
132 ### Check for xforms and xpm (only if X has been found).
133 if test "$have_x" = yes ; then
134 # We surely need these two libraries and want to check carefully the
135 # version numbers... 
136 LYX_PATH_XPM
137 LYX_PATH_XFORMS
138 AC_SUBST(LYX_LIBS)
139 else
140 LYX_ERROR(dnl
141 [Cannot find X window libraries and/or headers. Check your installation. 
142    If you use a Linux system, check that you have installed 
143    the development tools.])
144 fi
145
146
147 ### Setup GNU gettext
148 dnl GNU gettext is written in C
149 AC_LANG_C
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
156 AC_SUBST(LINGUAS)
157
158 AC_LANG_CPLUSPLUS
159
160 # some standard header files
161 AC_HEADER_DIRENT
162 AC_HEADER_MAJOR
163 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h)
164
165 # some standard structures
166 AC_HEADER_STAT
167 AC_HEADER_TIME
168 AC_STRUCT_ST_BLKSIZE
169 AC_STRUCT_ST_BLOCKS
170 AC_STRUCT_ST_RDEV
171
172 # some standard types
173 AC_TYPE_MODE_T
174 AC_TYPE_OFF_T
175 AC_TYPE_PID_T
176 AC_TYPE_SIGNAL
177 AC_TYPE_SIZE_T
178 AC_TYPE_UID_T
179
180 # some functions we'd like to have
181 AC_ARG_WITH(broken-headers,
182     [  --with-broken-headers      define some functions on SunOS4 and SCO],
183     [lyx_broken_headers=$withval])
184 if test "x$lyx_broken_headers" = "xyes"; then
185   lyx_flags="$lyx_flags broken-headers"
186   AC_DEFINE(BROKEN_HEADERS, 1,
187     [Define on SunOS 4 and SCO, were some functions are missing from the headers])
188 fi
189 AC_CHECK_FUNCS(memmove memset strchr putenv setenv mkfifo)
190
191 dnl Until this is fixed in autoconf we provide our own version
192 LYX_FUNC_SELECT_ARGTYPES
193
194 # SunOS 4.1.3 does not have strerror and atexit
195 AC_REPLACE_FUNCS(strerror atexit)
196
197 dnl This check should be removed. If the compiler does not understand
198 dnl bool it is so broken that we should not support it. (Lgb)
199 dnl AC_CACHE_CHECK([for bool type],lyx_cv_have_bool,[
200 dnl AC_TRY_LINK(, [bool foo = true;], lyx_cv_have_bool=yes,lyx_cv_have_bool=no)])
201 dnl if test $lyx_cv_have_bool = 'yes' ; then
202 dnl    AC_DEFINE(HAVE_bool,1,
203 dnl  [Define if the bool type is known to your compiler])
204 dnl fi
205
206 ### and now some special lyx flags.
207 AC_ARG_WITH(two-colors,[  --with-two-colors       use two color pixmaps],
208   [AC_DEFINE(TWO_COLOR_ICONS)
209    lyx_flags="$lyx_flags two-colors"])
210 AC_ARG_WITH(debug,[  --with-debug            output debug information by default],
211   [AC_DEFINE(DEBUG_AS_DEFAULT,1,
212     [Define if you want debugging turned on as default.])
213    lyx_flags="$lyx_flags debug"])
214
215 ### Finish the work.
216 AC_CONFIG_SUBDIRS(lib lib/reLyX)
217 AC_OUTPUT([Makefile \
218        lib/Makefile \
219        intl/Makefile \
220        po/Makefile.in \
221        src/Makefile \
222        src/mathed/Makefile \
223        src/insets/Makefile \
224        src/support/Makefile \
225 ],  [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
226
227
228 cat <<EOF
229
230 Configuration:
231   Source code location:       ${srcdir}
232   C++ Compiler:                   ${CXX}
233   C++ Compiler flags:             ${CXXFLAGS}
234   C   Compiler:                   ${CC}
235   C   Compiler flags:             ${CFLAGS}
236   LyX binary dir:             `eval "echo \`eval \"echo ${bindir}\"\`"`
237   LyX files dir:              `eval "echo \`eval \"echo ${datadir}/${PACKAGE}\"\`"`
238   Special flags:              ${lyx_flags}
239
240 EOF
241
242 # Display a final warning if there has been a LYX_ERROR
243 LYX_CHECK_ERRORS
244