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