Correctly install gliv.desktop, even through a RPM.
[gliv.git] / configure.ac
bloba7a9c2aa832284b6dc553c46fd6ebdc8ef0977ea
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
30 # Checks for libm.
31 AC_CHECK_LIB([m], [atan2], [
32   LDFLAGS="-lm $LDFLAGS"
33 ],[
34   AC_MSG_ERROR([Cannot use -lm])
38 # Checks for hypot (SVID 3, BSD 4.3).
39 # The replacement is #defined in the source.
40 AC_CHECK_FUNCS([hypot])
43 # Checks for math functions using floats.
44 # Using floats instead of doubles makes gcc use SSE with -msse
45 # The replacement are #defined in math_floats.h.
46 AC_CHECK_FUNCS([sqrtf])
47 AC_CHECK_FUNCS([hypotf])
48 AC_CHECK_FUNCS([atan2f])
49 AC_CHECK_FUNCS([powf])
50 AC_CHECK_FUNCS([ceilf])
51 AC_CHECK_FUNCS([cosf])
52 AC_CHECK_FUNCS([sinf])
53 AC_CHECK_FUNCS([acosf])
54 AC_CHECK_FUNCS([fmodf])
55 AC_CHECK_FUNCS([fabsf])
57 # If we don't have ftello, we'll use ftell.
58 AC_CHECK_FUNCS([ftello])
61 # Checks for getdelim, this is a GNU extension.
62 CFLAGS="$CFLAGS -D_GNU_SOURCE"
63 AC_CHECK_FUNCS([getdelim], [
64   have_getdelim="yes"
65  ], [
66   have_getdelim="no"
69 AM_CONDITIONAL([GETDELIM], [test "$have_getdelim" = "yes"])
72 # Checks for getopt_long, another GNU extension.
73 AC_CHECK_FUNCS([getopt_long], [
74   have_getopt_long="yes"
75  ], [
76   have_getopt_long="no"
79 AM_CONDITIONAL([GETOPT_LONG], [test "$have_getopt_long" = "yes"])
82 if test "$have_getdelim"    = "no" ||
83    test "$have_getopt_long" = "no"; then
84      AM_CONDITIONAL([NEED_REPLACEMENTS], [true])
85      CFLAGS="$CFLAGS -I${srcdir}/../lib"
86 else
87      AM_CONDITIONAL([NEED_REPLACEMENTS], [false])
91 # Checks for flavours of varargs macros (borrowed from glib-2)
92 # ISO C99
93 AC_MSG_CHECKING([for ISO C99 varargs macros])
95 AC_TRY_COMPILE([],[
96   int a(int p1, int p2, int p3);
97   #define call_a(...) a(1,__VA_ARGS__)
98   call_a(2,3);
99  ], [have_iso_c_varargs=yes], [have_iso_c_varargs=no])
101 AC_MSG_RESULT([$have_iso_c_varargs])
103 if test $have_iso_c_varargs = yes; then
104   iso_c_varargs=1
105 else
106   iso_c_varargs=0
109 AC_DEFINE_UNQUOTED([HAVE_ISO_C_VARARGS], [$iso_c_varargs],
110                    [ISO C99 varargs macros in C])
112 if test $have_iso_c_varargs = no; then
113   AC_MSG_WARN([No ISO C99 variadic macros])
116 # Checks for X.
117 AC_PATH_XTRA
118 CFLAGS="$X_CFLAGS $CFLAGS"
119 LDFLAGS="$X_PRE_LIBS -lX11 $X_LIBS $X_EXTRA_LIBS $LDFLAGS"
122 # Checks for OpenGL.
123 AC_CHECK_LIB([GL], [glBegin], [LDFLAGS="-lGL $LDFLAGS"], [ogl="no"])
124 if test "x$ogl" = "xno"; then
125  AC_MSG_NOTICE([Maybe libGL requires libpthread...])
126  unset ac_cv_lib_GL_glBegin
127  AC_CHECK_LIB([GL], [glBegin], [LDFLAGS="-lpthread -lGL $LDFLAGS"],
128   AC_MSG_ERROR([Cannot use -lGL]), [-lpthread])
132 # Checks for gtk.
133 AM_PATH_GTK_2_0([2.2.0], [
134   CFLAGS="$GTK_CFLAGS $CFLAGS"
135   LDFLAGS="$GTK_LIBS $LDFLAGS"
136   GTK_VERSION="$($PKG_CONFIG --modversion gtk+-2.0)"
137  ], [exit 1], [gthread])
139 # Checks for GtkGLExt.
140 PKG_CHECK_MODULES(GTKGLEXT, [gtkglext-1.0 >= 0.7.0])
141 CFLAGS="$GTKGLEXT_CFLAGS $CFLAGS"
142 LDFLAGS="$GTKGLEXT_LIBS $LDFLAGS"
143 GTKGL_VERSION="$($PKG_CONFIG --modversion gtkglext-1.0)"
145 # I18n.
146 ALL_LINGUAS=$(echo po/*.po | sed 's|\.po||g' | sed 's|po/||g')
147 AM_GNU_GETTEXT_VERSION
148 AM_GNU_GETTEXT
149 CFLAGS="$CFLAGS -I../${srcdir}/intl"
150 LIBS="$LIBS $LIBINTL"
153 AC_CONFIG_FILES([
154  Makefile
155  lib/Makefile
156  intl/Makefile
157  po/Makefile.in
158  tools/Makefile
159  tools/glade/Makefile
160  tools/glade/actions/Makefile
161  tools/glade/options/Makefile
162  src/Makefile
163  gliv.spec
166 AC_OUTPUT
168 echo
169 echo "Using GTK+ $GTK_VERSION with GtkGLExt $GTKGL_VERSION"
170 echo