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