initialize var before usage
[dia.git] / configure.in
blobfe60bdcdf10aef916232a709f8b262957aa21c8f
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(app/diagram.c)
4 AM_INIT_AUTOMAKE(dia, 0.86)
6 dnl Specify a header configuration file
7 AM_CONFIG_HEADER(config.h)
9 dnl Initialize maintainer mode
10 AM_MAINTAINER_MODE
12 dnl Initialize libtool
13 AC_DISABLE_STATIC
14 AC_PROG_LIBTOOL
16 dnl Build time sanity check
17 AM_SANITY_CHECK
19 dnl Checks for programs.
20 AC_PROG_CC
21 AC_PROG_INSTALL
22 AC_PROG_LN_S
23 AC_PROG_MAKE_SET
24 AC_ISC_POSIX
26 dnl Checks for libraries.
27 AM_PATH_GTK(1.2.0)
29 dnl XIM support (on by default)
30 AC_ARG_ENABLE(xim,
31 [  --disable-xim           enable gnome code],,enable_xim=yes)
32 AC_MSG_CHECKING([whether to enable XIM support])
33 if test "x$enable_xim" != xno; then
34   AC_DEFINE(USE_XIM)
36 AC_MSG_RESULT($enable_xim)
38 APP_LIBS=""
39 AC_SUBST(APP_LIBS)
41 dnl
42 dnl GNOME
43 dnl
45 AC_MSG_CHECKING([whether GNOME specific code should be used])
46 AC_ARG_ENABLE(gnome,
47 [  --enable-gnome          enable gnome code],
48     GNOME=$enableval,
49     GNOME=no)
50 AC_ARG_ENABLE(gnome-print,
51 [  --enable-gnome-print    enable gnome-print support],,enable_gnome_print=no)
52 AC_ARG_ENABLE(bonobo,
53 [  --enable-bonobo         enable bonobo support],,enable_bonobo=no)
54 AC_MSG_RESULT($GNOME)
55 GNOME_CFLAGS=""
56 GNOME_LIBS=""
57 BONOBO_LIBS=""
58 if test "$GNOME" = "yes"; then
59   AC_DEFINE(GNOME)
60   components="gnomeui"
61   hcomponents=""
62   if test "$enable_gnome_print" = "yes"; then
63     AC_DEFINE(GNOME_PRINT)
64     components="$components print"
65   fi
66   if test "$enable_bonobo" = "yes"; then
67     hcomponents="$hcomponents bonobo"
68     BONOBO_LIBS=`gnome-config bonobo $components --libs`
70     AC_MSG_CHECKING(if bonobo uses oaf)
71     using_oaf="no"
72     if ( gnome-config --libs bonobo | grep oaf ) > /dev/null 2>&1 ; then
73       using_oaf="yes"
74       AC_DEFINE(USE_OAF)
75     fi
76     AC_MSG_RESULT($using_oaf)
77     AM_CONDITIONAL(USING_OAF, test x"$using_oaf" = xyes)
79     AC_MSG_CHECKING(if bonobo uses bonobox)
80     using_bonobox="no"
81     if ( gnome-config --libs bonobox ) > /dev/null 2>&1 ; then
82       using_bonobox="yes"
83       AC_DEFINE(USE_BONOBOX)
84       BONOBO_LIBS=`gnome-config bonobo bonobox $components --libs`
85     fi
86     AC_MSG_RESULT($using_bonobox)
87     AM_CONDITIONAL(USING_BONOBOX, test x"$using_bonobox" = xyes)
88     hcomponents="$hcomponents bonobox"
89   fi
90   GNOME_CFLAGS=`gnome-config $hcomponents $components --cflags`
91   GNOME_LIBS=`gnome-config $components --libs`
93 AM_CONDITIONAL(HAVE_GNOME_PRINT,
94         test "$GNOME" = "yes" && test "$enable_gnome_print" = "yes")
95 AM_CONDITIONAL(HAVE_BONOBO, 
96         test "$GNOME" = "yes" && test "$enable_bonobo" = "yes")
97 AC_SUBST(GNOME_CFLAGS)
98 AC_SUBST(GNOME_LIBS)
99 AC_SUBST(BONOBO_LIBS)
101 dnl Check if this Gnome has Bonobo
102 OLDCPPFLAGS=$CPPFLAGS
103 CPPFLAGS="$CPPFLAGS `glib-config --cflags`"
106 CPPFLAGS=$OLDCPPFLAGS
109 dnl Popt
112 AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [AC_DEFINE(HAVE_LIBPOPT)
113                    APP_LIBS="$APP_LIBS -lpopt"])
114 AC_CHECK_HEADERS(popt.h)
117 dnl libart_lgpl
120 AM_PATH_LIBART(2.1.0,dnl
121  [have_libart=yes
122   AC_DEFINE(HAVE_LIBART)],
123  [have_libart=no])
126 dnl gdk_pixbuf
129 AM_PATH_GDK_PIXBUF(0.7.0,,AC_MSG_ERROR([gdk-pixbuf >= 0.7.0 is required]))
132 dnl libpng
135 png_ok=no
136 AC_CHECK_LIB(png, png_read_info,
137   AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no),png_ok=no, -lz -lm)
138 if test "$png_ok" = yes; then
139   AC_MSG_CHECKING([for png_structp in png.h])
140   AC_TRY_COMPILE([#include <png.h>],
141                  [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;],
142                  png_ok=yes,
143                  png_ok=no)
144   AC_MSG_RESULT($png_ok)
145   if test "$png_ok" = yes; then
146     PNG_LIBS='-lpng -lz -lm'
147     AC_DEFINE(HAVE_LIBPNG)
148   fi
150 AC_SUBST(PNG_LIBS)
154 dnl Debugging
157 AC_ARG_ENABLE(debug, 
158 [  --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],
159   ,
160   enable_debug=minimum)
162 if test "x$enable_debug" = "xyes"; then
163   DEBUG_FLAGS="-g -DENABLE_DEBUG"
164 else
165   if test "x$enable_debug" = "xno"; then
166     DEBUG_FLAGS=""
167   else
168     DEBUG_FLAGS=""
169   fi
171 AC_SUBST(DEBUG_FLAGS)
174 dnl i18n
177 ALL_LINGUAS="ca da de el en_GB es fi fr ga hu it ja ko nl no pl pt ru sl sv tr uk zh_CN.GB2312 zh_TW.Big5"
179 AM_GNU_GETTEXT
180 localedir='${prefix}/${DATADIRNAME}/locale'
181 AC_SUBST(localedir)
183 dnl     
184 dnl Locate the gnome-xml library
186 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
187 if test "$XML_CONFIG" != "" 
188 then
189   AC_MSG_CHECKING(for libxml >= 1.8.5)
190   vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
191   if test "$vers" -ge 1008005; then
192     AC_MSG_RESULT(found)
193   else
194     AC_MSG_ERROR(you need libxml >= 1.8.5 for this version of dia)
195   fi
196   XML_LIBS="`$XML_CONFIG --libs`"
197   XML_CFLAGS="`$XML_CONFIG --cflags`"
198 else
199   AC_MSG_ERROR(Can't find libxml library.)
201 AC_SUBST(XML_LIBS)
202 AC_SUBST(XML_CFLAGS)
204 dnl Checks for header files.
205 AC_HEADER_DIRENT
206 AC_HEADER_STDC
207 AC_CHECK_HEADERS(stddef.h fcntl.h unistd.h)
209 dnl Checks for typedefs, structures, and compiler characteristics.
210 AC_C_CONST
212 dnl Checks for library functions.
213 AC_CHECK_FUNCS(select strcspn strdup strtol snprintf)
215 dnl Alpha needs -mieee or we get a segfault
216 dnl This shouldn't be needed but is here until a real solution is found
217 case "$host" in
218   alpha*-*-linux*)
219     CFLAGS="$CFLAGS -mieee"
220     ;;
221 esac
223 DIA_CHECK_CFLAG(-Wall)
224 DIA_CHECK_CFLAG(-Wunused)
225 DIA_CHECK_CFLAG(-Winline)
226 DIA_CHECK_CFLAG(-Wmissing-prototypes)
227 DIA_CHECK_CFLAG(-Wmissing-declarations)
229 dnl Relieve register pressure on i386. Other architectures may become unable
230 dnl to debug, and usually have more registers anyway.
231 case "$host" in 
232   i?86-pc-*)
233     DIA_CHECK_CFLAG(-fomit-frame-pointer)
234     ;;
235 esac
237 DIA_CHECK_CFLAG(-finline-functions)
238 DIA_CHECK_CFLAG(-fstrict-aliasing)
240 AC_OUTPUT(
241 Makefile
242 lib/Makefile
243 intl/Makefile
244 po/Makefile.in
245 objects/Makefile
246 objects/standard/Makefile
247 objects/network/Makefile
248 objects/UML/Makefile
249 objects/ER/Makefile
250 objects/FS/Makefile
251 objects/sybase/Makefile
252 objects/flowchart/Makefile
253 objects/custom/Makefile
254 objects/GRAFCET/Makefile
255 objects/chronogram/Makefile
256 objects/SADT/Makefile
257 shapes/Makefile
258 shapes/Circuit/Makefile
259 shapes/flowchart/Makefile
260 shapes/Contact/Makefile
261 shapes/network/Makefile
262 shapes/Pneumatic/Makefile
263 shapes/Electric/Makefile
264 shapes/Civil/Makefile
265 shapes/jigsaw/Makefile
266 shapes/MSE/Makefile
267 shapes/SDL/Makefile
268 app/Makefile
269 samples/Makefile
270 sheets/Makefile
271 sheets/UML/Makefile
272 sheets/ER/Makefile
273 sheets/GRAFCET/Makefile
274 plug-ins/Makefile
275 plug-ins/cgm/Makefile
276 plug-ins/pstricks/Makefile
277 plug-ins/dxf/Makefile
278 plug-ins/hpgl/Makefile
279 plug-ins/wpg/Makefile
280 plug-ins/svg/Makefile
281 plug-ins/shape/Makefile
284 echo "
286 Configuration:
287         Source code location:   ${srcdir}
288         Compiler:               ${CC}
290         Use gdk-pixbuf:                         ${have_gdkpixbuf}
291         Libart (AA rendering, png export):      ${have_libart}
293         Gnome support:                          ${GNOME}
294         Build bonobo component (not supported): ${enable_bonobo}
295         Gnome-print support (not recommended):  ${enable_gnome_print}
297 Now type make to build dia."