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])
5 AM_CONFIG_HEADER([config.h])
9 # We check this before AC_PROG_CC fills blank CFLAGS with "-g -O2".
10 if test "x$CFLAGS" = "x"; then
16 # Checks for programs.
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.
31 AC_CHECK_LIB([m], [atan2], [
32 LDFLAGS="-lm $LDFLAGS"
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])
56 AC_CHECK_FUNCS([powf])
58 # If we don't have ftello, we'll use ftell.
59 AC_CHECK_FUNCS([ftello])
62 # Checks for getdelim, this is a GNU extension.
63 CFLAGS="$CFLAGS -D_GNU_SOURCE"
64 AC_CHECK_FUNCS([getdelim], [
70 AM_CONDITIONAL([GETDELIM], [test "$have_getdelim" = "yes"])
73 # Checks for getopt_long, another GNU extension.
74 AC_CHECK_FUNCS([getopt_long], [
75 have_getopt_long="yes"
80 AM_CONDITIONAL([GETOPT_LONG], [test "$have_getopt_long" = "yes"])
83 if test "$have_getdelim" = "no" ||
84 test "$have_getopt_long" = "no"; then
85 AM_CONDITIONAL([NEED_REPLACEMENTS], [true])
86 CFLAGS="$CFLAGS -I${srcdir}/../lib"
88 AM_CONDITIONAL([NEED_REPLACEMENTS], [false])
92 # Checks for flavours of varargs macros (borrowed from glib-2)
94 AC_MSG_CHECKING([for ISO C99 varargs macros])
97 int a(int p1, int p2, int p3);
98 #define call_a(...) a(1,__VA_ARGS__)
100 ], [have_iso_c_varargs=yes], [have_iso_c_varargs=no])
102 AC_MSG_RESULT([$have_iso_c_varargs])
104 if test $have_iso_c_varargs = yes; then
110 AC_DEFINE_UNQUOTED([HAVE_ISO_C_VARARGS], [$iso_c_varargs],
111 [ISO C99 varargs macros in C])
114 AC_MSG_CHECKING([for GNU C varargs macros])
117 int a(int p1, int p2, int p3);
118 #define call_a(params...) a(1,params)
120 ], [have_gnu_c_varargs=yes], [have_gnu_c_varargs=no])
122 AC_MSG_RESULT([$have_gnu_c_varargs])
124 if test $have_gnu_c_varargs = yes; then
130 AC_DEFINE_UNQUOTED([HAVE_GNU_C_VARARGS], [$gnu_c_varargs],
131 [GNU C varargs macros in C])
133 if test $have_gnu_c_varargs = no && $have_iso_c_varargs = no; then
134 AC_MSG_ERROR([no variadic macros, use gcc >= 2.95 or an ISO C99 compiler])
139 CFLAGS="$X_CFLAGS $CFLAGS"
140 LDFLAGS="$X_PRE_LIBS -lX11 $X_LIBS $X_EXTRA_LIBS $LDFLAGS"
144 AC_CHECK_LIB([GL], [glBegin], [LDFLAGS="-lGL $LDFLAGS"], [ogl="no"])
145 if test "x$ogl" = "xno"; then
146 AC_MSG_NOTICE([Maybe libGL requires libpthread...])
147 unset ac_cv_lib_GL_glBegin
148 AC_CHECK_LIB([GL], [glBegin], [LDFLAGS="-lpthread -lGL $LDFLAGS"],
149 AC_MSG_ERROR([Cannot use -lGL]), [-lpthread])
154 AM_PATH_GTK_2_0([2.2.0], [
155 CFLAGS="$GTK_CFLAGS $CFLAGS"
156 LDFLAGS="$GTK_LIBS $LDFLAGS"
157 GTK_VERSION="$($PKG_CONFIG --modversion gtk+-2.0)"
158 ], [exit 1], [gthread])
160 # Checks for GtkGLExt.
161 PKG_CHECK_MODULES(GTKGLEXT, [gtkglext-1.0 >= 0.7.0])
162 CFLAGS="$GTKGLEXT_CFLAGS $CFLAGS"
163 LDFLAGS="$GTKGLEXT_LIBS $LDFLAGS"
164 GTKGL_VERSION="$($PKG_CONFIG --modversion gtkglext-1.0)"
167 ALL_LINGUAS=$(echo po/*.po | sed 's|\.po||g' | sed 's|po/||g')
168 AM_GNU_GETTEXT_VERSION
170 CFLAGS="$CFLAGS -I../${srcdir}/intl"
171 LIBS="$LIBS $LIBINTL"
187 echo "Using GTK+ $GTK_VERSION with GtkGLExt $GTKGL_VERSION"