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