Add compressed SVG extension : .svgz.
[gliv.git] / configure.ac
blobec2237f0f70e7c8aee062abd890227c9311d8a0c
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT([gliv], esyscmd([echo -n $(head -n 1 NEWS)]), [guichaz@yahoo.fr])
3 AC_CONFIG_SRCDIR([src/main.c])
4 AM_INIT_AUTOMAKE
5 AM_CONFIG_HEADER([config.h])
6 AC_LANG([C])
9 # We check this before AC_PROG_CC fills blank CFLAGS with "-g -O2".
10 if test "x$CFLAGS" = "x"; then
11   DEFAULT_CFLAGS=yes
12 else
13   DEFAULT_CFLAGS=no
16 # Checks for programs.
17 AC_PROG_CC
18 AC_PROG_RANLIB
21 # Default CFLAGS.
22 if test "x$GCC" = "xyes" && test "$DEFAULT_CFLAGS" = "yes"; then
23   CFLAGS="-Wall -O2 -fomit-frame-pointer -ffast-math"
27 # Checks for LFS flags, we may not handle big files, but it doesn't hurt.
28 AC_SYS_LARGEFILE
31 AC_DEFUN([CHECK_MATH],
32          [OLD_CFLAGS="$CFLAGS"]
33          [CFLAGS="$CFLAGS -w"]
34          [AC_SEARCH_LIBS([$1],
35                          [m mx],
36                          [AC_DEFINE(AS_TR_CPP([HAVE_$1]),
37                                     1,
38                                     [Define to 1 if you have the `$1' function.])])]
39         [CFLAGS="$OLD_CFLAGS"])
41 CHECK_MATH([atan2])
44 # Checks for hypot (SVID 3, BSD 4.3).
45 # The replacement is #defined in the source.
46 CHECK_MATH([hypot])
49 # Checks for math functions using floats.
50 # Using floats instead of doubles makes gcc use SSE with -msse
51 # The replacement are #defined in math_floats.h.
52 CHECK_MATH([sqrtf])
53 CHECK_MATH([hypotf])
54 CHECK_MATH([atan2f])
55 CHECK_MATH([powf])
56 CHECK_MATH([ceilf])
57 CHECK_MATH([cosf])
58 CHECK_MATH([sinf])
59 CHECK_MATH([acosf])
60 CHECK_MATH([fmodf])
61 CHECK_MATH([fabsf])
63 # If we don't have ftello, we'll use ftell.
64 AC_CHECK_FUNCS([ftello])
67 # Checks for getdelim, this is a GNU extension.
68 CFLAGS="$CFLAGS -D_GNU_SOURCE"
69 AC_CHECK_FUNCS([getdelim], [
70   have_getdelim="yes"
71  ], [
72   have_getdelim="no"
75 AM_CONDITIONAL([GETDELIM], [test "$have_getdelim" = "yes"])
78 # Checks for getopt_long, another GNU extension.
79 AC_CHECK_FUNCS([getopt_long], [
80   have_getopt_long="yes"
81  ], [
82   have_getopt_long="no"
85 AM_CONDITIONAL([GETOPT_LONG], [test "$have_getopt_long" = "yes"])
88 if test "$have_getdelim"    = "no" ||
89    test "$have_getopt_long" = "no"; then
90      AM_CONDITIONAL([NEED_REPLACEMENTS], [true])
91      CFLAGS="$CFLAGS -I${srcdir}/../lib"
92 else
93      AM_CONDITIONAL([NEED_REPLACEMENTS], [false])
97 # Checks for flavours of varargs macros (borrowed from glib-2)
98 # ISO C99
99 AC_MSG_CHECKING([for ISO C99 varargs macros])
101 AC_TRY_COMPILE([],[
102   int a(int p1, int p2, int p3);
103   #define call_a(...) a(1,__VA_ARGS__)
104   call_a(2,3);
105  ], [have_iso_c_varargs=yes], [have_iso_c_varargs=no])
107 AC_MSG_RESULT([$have_iso_c_varargs])
109 if test $have_iso_c_varargs = yes; then
110   iso_c_varargs=1
111 else
112   iso_c_varargs=0
115 AC_DEFINE_UNQUOTED([HAVE_ISO_C_VARARGS], [$iso_c_varargs],
116                    [ISO C99 varargs macros in C])
118 if test $have_iso_c_varargs = no; then
119   AC_MSG_WARN([No ISO C99 variadic macros])
122 # Checks for X.
123 AC_PATH_XTRA
124 CFLAGS="$X_CFLAGS $CFLAGS"
125 LDFLAGS="$X_PRE_LIBS -lX11 $X_LIBS $X_EXTRA_LIBS $LDFLAGS"
128 # Checks for OpenGL.
129 AC_CHECK_LIB([GL], [glBegin], [LDFLAGS="-lGL $LDFLAGS"], [ogl="no"])
130 if test "x$ogl" = "xno"; then
131  AC_MSG_NOTICE([Maybe libGL requires libpthread...])
132  unset ac_cv_lib_GL_glBegin
133  AC_CHECK_LIB([GL], [glBegin], [LDFLAGS="-lpthread -lGL $LDFLAGS"],
134   AC_MSG_ERROR([Cannot use -lGL]), [-lpthread])
138 # Checks for gtk.
139 AM_PATH_GTK_2_0([2.2.0], [
140   CFLAGS="$GTK_CFLAGS $CFLAGS"
141   LDFLAGS="$GTK_LIBS $LDFLAGS"
142   GTK_VERSION="$($PKG_CONFIG --modversion gtk+-2.0)"
143  ], [exit 1], [gthread])
145 # Checks for GtkGLExt.
146 PKG_CHECK_MODULES(GTKGLEXT, [gtkglext-1.0 >= 0.7.0])
147 CFLAGS="$GTKGLEXT_CFLAGS $CFLAGS"
148 LDFLAGS="$GTKGLEXT_LIBS $LDFLAGS"
149 GTKGL_VERSION="$($PKG_CONFIG --modversion gtkglext-1.0)"
151 # I18n.
152 ALL_LINGUAS=$(echo po/*.po | sed 's|\.po||g' | sed 's|po/||g')
153 AM_GNU_GETTEXT_VERSION
154 AM_GNU_GETTEXT
155 CFLAGS="$CFLAGS -I../${srcdir}/intl"
156 LIBS="$LIBS $LIBINTL"
159 AC_CONFIG_FILES([
160  Makefile
161  lib/Makefile
162  intl/Makefile
163  po/Makefile.in
164  tools/Makefile
165  tools/glade/Makefile
166  tools/glade/actions/Makefile
167  tools/glade/options/Makefile
168  src/Makefile
169  gliv.spec
172 AC_OUTPUT
174 echo
175 echo "Using GTK+ $GTK_VERSION with GtkGLExt $GTKGL_VERSION"
176 echo