1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
|
# Process this file with autoconf to produce a configure script.
AC_INIT([gliv], esyscmd([echo -n $(head -n 1 NEWS)]), [guichaz@gmail.com])
AC_CONFIG_SRCDIR([src/main.c])
AM_INIT_AUTOMAKE([foreign])
AM_CONFIG_HEADER([config.h])
AC_LANG([C])
AC_GNU_SOURCE
# We check this before AC_PROG_CC fills blank CFLAGS with "-g -O2".
if test "x$CFLAGS" = "x"; then
DEFAULT_CFLAGS=yes
else
DEFAULT_CFLAGS=no
fi
# Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB
# Default CFLAGS.
if test "x$GCC" = "xyes" && test "$DEFAULT_CFLAGS" = "yes"; then
CFLAGS="-Wall -O2 -fomit-frame-pointer -ffast-math"
fi
CFLAGS="$CFLAGS -I${srcdir}/../lib"
# Checks for LFS flags, we may not handle big files, but it doesn't hurt.
AC_SYS_LARGEFILE
AC_DEFUN([CHECK_MATH],
[OLD_CFLAGS="$CFLAGS"]
[CFLAGS="$CFLAGS -w"]
[AC_SEARCH_LIBS([$1],
[m mx],
[AC_DEFINE(AS_TR_CPP([HAVE_$1]),
1,
[Define to 1 if you have the `$1' function.])])]
[CFLAGS="$OLD_CFLAGS"])
CHECK_MATH([atan2])
# Checks for hypot (SVID 3, BSD 4.3).
# The replacement is #defined in the source.
CHECK_MATH([hypot])
# Checks for math functions using floats.
# Using floats instead of doubles makes gcc use SSE with -msse
# The replacement are #defined in math_floats.h.
CHECK_MATH([sqrtf])
CHECK_MATH([hypotf])
CHECK_MATH([atan2f])
CHECK_MATH([powf])
CHECK_MATH([ceilf])
CHECK_MATH([cosf])
CHECK_MATH([sinf])
CHECK_MATH([acosf])
CHECK_MATH([fmodf])
CHECK_MATH([fabsf])
CHECK_MATH([log10f])
# If we don't have ftello, we'll use ftell.
AC_CHECK_FUNCS([ftello])
# If we don't have fseeko, we'll use fseek.
AC_CHECK_FUNCS([fseeko])
# Checks for getdelim, this is a GNU extension.
CFLAGS="$CFLAGS -D_GNU_SOURCE"
AC_CHECK_FUNCS([getdelim], [
have_getdelim="yes"
], [
have_getdelim="no"
])
AM_CONDITIONAL([GETDELIM], [test "$have_getdelim" = "yes"])
# Checks for getopt_long, another GNU extension.
AC_CHECK_FUNCS([getopt_long], [
have_getopt_long="yes"
], [
have_getopt_long="no"
])
AM_CONDITIONAL([GETOPT_LONG], [test "$have_getopt_long" = "yes"])
if test "$have_getdelim" = "no" ||
test "$have_getopt_long" = "no"; then
AM_CONDITIONAL([NEED_REPLACEMENTS], [true])
else
AM_CONDITIONAL([NEED_REPLACEMENTS], [false])
fi
# Checks for flavours of varargs macros (borrowed from glib-2)
# ISO C99
AC_MSG_CHECKING([for ISO C99 varargs macros])
AC_TRY_COMPILE([],[
int a(int p1, int p2, int p3);
#define call_a(...) a(1,__VA_ARGS__)
call_a(2,3);
], [have_iso_c_varargs=yes], [have_iso_c_varargs=no])
AC_MSG_RESULT([$have_iso_c_varargs])
if test $have_iso_c_varargs = yes; then
iso_c_varargs=1
else
iso_c_varargs=0
fi
AC_DEFINE_UNQUOTED([HAVE_ISO_C_VARARGS], [$iso_c_varargs],
[ISO C99 varargs macros in C])
if test $have_iso_c_varargs = no; then
AC_MSG_WARN([No ISO C99 variadic macros])
fi
# 32bit or 64bit ?
AC_CHECK_SIZEOF([unsigned long])
# Checks for X.
AC_PATH_XTRA
CFLAGS="$X_CFLAGS $CFLAGS"
LIBS="$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS $LIBS"
# Checks for GtkGLExt.
PKG_CHECK_MODULES(GTKGLEXT, [gtkglext-1.0 >= 0.7.0])
CFLAGS="$GTKGLEXT_CFLAGS $CFLAGS"
LIBS="$GTKGLEXT_LIBS $LIBS"
GTKGL_VERSION="$($PKG_CONFIG --modversion gtkglext-1.0)"
# Checks for OpenGL.
AC_TRY_LINK([#include "GL/gl.h"],
[glBegin(GL_QUADS);],
[ogl="yes"],
[ogl="no"])
if test "x$ogl" = "xno"; then
AC_MSG_NOTICE([maybe libGL requires libpthread...])
LIBS="$LIBS -lpthread"
AC_TRY_LINK([#include "GL/gl.h"],
[glBegin(GL_QUADS);],
[],
AC_MSG_ERROR([cannot use -lGL]))
fi
# Checks for gtk.
AM_PATH_GTK_2_0([2.6.0], [
CFLAGS="$GTK_CFLAGS $CFLAGS"
LIBS="$GTK_LIBS $LIBS"
GTK_VERSION="$($PKG_CONFIG --modversion gtk+-2.0)"
], [exit 1], [gthread])
# I18n.
ALL_LINGUAS=$(echo po/*.po | sed -e 's|\.po||g' -e 's|po/||g')
AM_GNU_GETTEXT_VERSION
AM_GNU_GETTEXT
CFLAGS="$CFLAGS -I../${srcdir}/intl"
LIBS="$LIBS $LIBINTL"
AC_CONFIG_FILES([ intl/Makefile
Makefile
lib/Makefile
po/Makefile.in
tools/Makefile
tools/glade/Makefile
tools/glade/actions/Makefile
tools/glade/image_nr/Makefile
tools/glade/options/Makefile
man/Makefile
man/cs/Makefile
man/de/Makefile
man/en/Makefile
man/fr/Makefile
man/ru/Makefile
src/Makefile
gliv.spec
])
AC_OUTPUT
echo
echo "Using GTK+ $GTK_VERSION with GtkGLExt $GTKGL_VERSION"
echo
|