configure.in 8.91 KB
Newer Older
George Lebl's avatar
George Lebl committed
1 2 3
AC_INIT(src/calc.c)

AM_CONFIG_HEADER(config.h)
4
AM_INIT_AUTOMAKE(genius,1.0.1)
5 6 7 8

dnl make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS")

George Lebl's avatar
George Lebl committed
9 10
AM_MAINTAINER_MODE

11 12
AC_PROG_INTLTOOL([0.21])

13 14
dnl ================= Requirements ================================================

15
VTE_REQUIRED=0.8.19
16
LIBGNOMEUI_REQUIRED=2.0.0
17
LIBGLADE_REQUIRED=1.99.2
18
LIBGNOME_REQUIRED=2.0.0
19
GTK_REQUIRED=2.3.5
20
GLIB_REQUIRED=2.0.0
21
GTKSOURCEVIEW_REQUIRED=0.3.0
22
GTKSOURCEVIEW2_REQUIRED=2.0.2
23 24 25

dnl ===============================================================================

26 27 28
AC_ARG_ENABLE(extra-gcc-optimization,
[  --disable-extra-gcc-optimization  Compile without extra GCC optimization (if using GCC)],
use_extraopt="$enableval",use_extraopt=yes)
George Lebl's avatar
George Lebl committed
29
AC_PROG_CC
30 31 32
if test "x$GCC" = "xyes" -a "x$use_extraopt" = "xyes" ; then
	echo "Turning on extra gcc flags -finline-functions -frename-registers"
	CFLAGS="-finline-functions -frename-registers $CFLAGS"
33
fi
34 35
AC_ISC_POSIX
AC_HEADER_STDC
36 37
AM_PROG_LEX
AM_PROG_LIBTOOL
George Lebl's avatar
George Lebl committed
38 39
AC_PROG_YACC

40 41
AM_BINRELOC

George Lebl's avatar
George Lebl committed
42 43
GNOME_COMPILE_WARNINGS

44 45
dnl ================= Translation Stuf ==============================================

Jiri (George) Lebl's avatar
Jiri (George) Lebl committed
46
GETTEXT_PACKAGE=genius
47
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",[gettext package name])
48 49
AC_SUBST(GETTEXT_PACKAGE)

50
ALL_LINGUAS="ar az ca cs de dz el en_CA en_GB es fr ga hi hr it ja ko lv mk ml nb ne nl oc pa pl pt_BR pt rw sq sr@Latn sr sv zh_CN zh_TW"
51
AM_GLIB_GNU_GETTEXT
George Lebl's avatar
George Lebl committed
52

53 54 55 56 57 58 59 60
dnl ===============================================================================

AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)

# glib-genmarshal
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
George Lebl's avatar
George Lebl committed
61 62 63

dnl Check for termcap
AC_CHECK_LIB(termcap, tgetent,[TERMCAP_LIB="-ltermcap"],
64 65
	     [AC_CHECK_LIB(ncurses, tgetent,
                           [TERMCAP_LIB="-lncurses"
66
                            AC_DEFINE(USE_NCURSES,[1], [Use ncurses library])
67
                            AC_CHECK_HEADER(ncurses/curses.h, [
68
					    AC_DEFINE(INC_NCURSES,[1],[ncurses include])])], [
69
			   AC_MSG_ERROR(Termcap library not found)])])
George Lebl's avatar
George Lebl committed
70 71 72 73 74 75 76 77 78 79 80
AC_SUBST(TERMCAP_LIB)

dnl Check for readline
AC_CHECK_LIB(readline,readline, [READLINE_LIB="-lreadline"],
	     AC_MSG_ERROR(Readline library not found),
	     $TERMCAP_LIB)
AC_SUBST(READLINE_LIB)

GMP_LIB=""
AC_CHECK_LIB(gmp, __gmpz_init_set,[GMP_LIB=-lgmp], [
	AC_CHECK_LIB(gmp2, __gmpz_init_set_d,[GMP_LIB=-lgmp2
81
		AC_DEFINE(HAVE_GMP2_INCLUDE_DIR,[1],[Have gmp2 include directory])],
George Lebl's avatar
George Lebl committed
82 83 84
		AC_MSG_ERROR(GMP Library not found))])
AC_SUBST(GMP_LIB)

85
AC_CHECK_LIB(mpfr, mpfr_pow_z, [],
86
	[AC_MSG_ERROR([New enough MPFR (2.2.0+) not found, see http://www.mpfr.org])],
87
	"$GMP_LIB")
88

89 90 91 92 93 94 95 96 97 98 99 100 101 102
# No schemas yet so ignore this section for now
#AC_PATH_PROG(GCONFTOOL, gconftool-2)
#dnl Specify the gconf configuration source,
#dnl default to xml::$(sysconfdir)/gconf/gconf.xml.defaults
#
#GCONF_CONFIG_SOURCE=
#
#AC_ARG_ENABLE(gconf-source, [  --enable-gconf-source=sourceaddress Where to install schema files.], GCONF_CONFIG_SOURCE=$enable_gconf_source,)
#if test "x$GCONF_CONFIG_SOURCE" = "x"; then
#        GCONF_CONFIG_SOURCE="xml::\${sysconfdir}/gconf/gconf.xml.defaults"
#fi
#
#AC_SUBST(GCONF_CONFIG_SOURCE)
#AC_SUBST(INSTALL_GCONF_CONFIG_SOURCE)
103

104
AC_ARG_ENABLE(gtksourceview,
105
[  --disable-gtksourceview Do not use GtkSourceView library even if detected],
106 107
use_gtksourceview="$enableval",use_gtksourceview=yes)

108
AC_ARG_ENABLE(gnome,
109
[  --disable-gnome         Compile without the GNOME frontend (no GUI, no plotting)],
110 111 112 113 114 115
use_gnome="$enableval",use_gnome=yes)

# Used for the 'genius' binary
PKG_CHECK_MODULES(GENIUS_NOGUI, glib-2.0 >= $GLIB_REQUIRED gmodule-2.0 >= $GLIB_REQUIRED)
AC_SUBST(GENIUS_NOGUI_CFLAGS)
AC_SUBST(GENIUS_NOGUI_LIBS)
116

117 118 119 120 121
# glib
PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)

122
GENIUS_MODULES="gtk+-2.0 >= $GTK_REQUIRED libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED vte >= $VTE_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED"
123

124 125 126 127 128 129
if test "x$use_gnome" = "xyes" ; then
  echo " 
Testing for presence of GNOME and GtkSourceView:
Note:
      You can compile without GNOME by using the --disable-gnome option
"
130 131
  PKG_CHECK_MODULES(GENIUS, $GENIUS_MODULES)

132
  if test "x$use_gtksourceview" = "xyes" ; then
133 134 135 136 137 138 139 140 141 142 143 144 145 146
    PKG_CHECK_MODULES(GSV, gtksourceview-2.0 >= $GTKSOURCEVIEW2_REQUIRED, have_gtksourceview2=yes, have_gtksourceview2=no)

    if test "x$have_gtksourceview2" != "xyes"; then
      PKG_CHECK_MODULES(GSV, gtksourceview-1.0 >= $GTKSOURCEVIEW_REQUIRED, have_gtksourceview=yes, have_gtksourceview=no)
    fi

    if test "x$have_gtksourceview2" = "xyes"; then
      AC_DEFINE(HAVE_GTKSOURCEVIEW,[1],[have gtksourceview])
      AC_DEFINE(HAVE_GTKSOURCEVIEW2,[1],[have gtksourceview2])
    elif test "x$have_gtksourceview" = "xyes"; then
      AC_DEFINE(HAVE_GTKSOURCEVIEW,[1],[have gtksourceview])
    else
      use_gtksourceview=no
    fi
147
  else
148
    PKG_CHECK_MODULES(GENIUS, $GENIUS_MODULES)
149 150 151
  fi

  VICIOUS_MODULES="gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED"
152
  VICIOUS_UI_LIBS="libviciousui.a"
153
  GTKEXTRA_LIBS="libgtkextra-genius.a"
154 155 156 157 158
  
  GNOME_GENIUS=gnome-genius
  GENIUS_READLINE_HELPER_FIFO=genius-readline-helper-fifo
  GNOME_GENIUS_DESKTOP_IN="gnome-genius.desktop.in"

159
else
160 161
  use_gtksourceview=no
  VICIOUS_MODULES="glib-2.0 >= $GLIB_REQUIRED gmodule-2.0 >= $GLIB_REQUIRED"
162
  VICIOUS_UI_LIBS=
163
  GTKEXTRA_LIBS=
164 165 166 167 168
  GENIUS_CFLAGS="$GENIUS_NOGUI_CFLAGS"
  GENIUS_LIBS="$GENIUS_NOGUI_LIBS"
  GNOME_GENIUS=
  GENIUS_READLINE_HELPER_FIFO=
  GNOME_GENIUS_DESKTOP_IN=
169
fi
170

171
AC_SUBST(VICIOUS_UI_LIBS)
172
AC_SUBST(GTKEXTRA_LIBS)
173 174
AC_SUBST(GENIUS_CFLAGS)
AC_SUBST(GENIUS_LIBS)
175 176
AC_SUBST(GSV_CFLAGS)
AC_SUBST(GSV_LIBS)
177 178 179
AC_SUBST(GNOME_GENIUS)
AC_SUBST(GENIUS_READLINE_HELPER_FIFO)
AC_SUBST(GNOME_GENIUS_DESKTOP_IN)
180

181
# This is used for vicious-extensions
182 183 184
PKG_CHECK_MODULES(VICIOUS, $VICIOUS_MODULES)
AC_SUBST(VICIOUS_CFLAGS)
AC_SUBST(VICIOUS_LIBS)
185

186 187 188 189 190 191 192 193 194 195 196
AC_CHECK_LIB(popt, poptGetArgs, [POPT_LIBS="-lpopt"],
AC_MSG_ERROR([popt is required to build genius.
You can download the latest version from ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/]))
AC_SUBST(POPT_LIBS)

dnl ******************************
dnl More compiler warnings
dnl ******************************

AC_ARG_ENABLE(more-warnings,
[  --enable-more-warnings  Maximum compiler warnings],
197 198 199 200 201 202 203 204
set_more_warnings="$enableval",[
if test -f $srcdir/CVS/Root; then
	is_cvs_version=true
	set_more_warnings=yes
else
	set_more_warnings=no
fi
])
205 206
warning_flags=
realsave_CFLAGS="$CFLAGS"
207
AC_MSG_CHECKING(for more warnings)
208 209
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
	AC_MSG_RESULT(yes)
210
	warning_flags="-Wall -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
211 212
	CFLAGS="$warning_flags $CFLAGS"

213
	for option in -Wno-sign-compare; do
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
		SAVE_CFLAGS="$CFLAGS"
		CFLAGS="$CFLAGS $option"
		AC_MSG_CHECKING([whether gcc understands $option])
		AC_TRY_COMPILE([], [],
			has_option=yes,
			has_option=no,)
		CFLAGS="$SAVE_CFLAGS"
		AC_MSG_RESULT($has_option)
		if test $has_option = yes; then
		  warning_flags="$warning_flags $option"
		fi
		unset has_option
		unset SAVE_CFLAGS
	done
	unset option
else
	AC_MSG_RESULT(no)
fi
CFLAGS="$realsave_CFLAGS"
233
EXTRA_WARNING_CFLAGS="$warning_flags"
234 235 236 237 238 239
#	-DG_DISABLE_DEPRECATED \
#	-DGDK_PIXBUF_DISABLE_DEPRECATED \
#	-DGDK_DISABLE_DEPRECATED \
#	-DGTK_DISABLE_DEPRECATED \
#	-DGNOME_DISABLE_DEPRECATED \

240
AC_SUBST(EXTRA_WARNING_CFLAGS)
George Lebl's avatar
George Lebl committed
241

242
dnl wordexp check, we use glob otherwise but that's not perfect
George Lebl's avatar
George Lebl committed
243
dnl warn the user, we do this on the end so that the user notices
244
AC_CHECK_FUNC(wordexp,AC_DEFINE(HAVE_WORDEXP,[1],[Have the wordexp function]),
245
  	      [AC_MSG_WARN([*** You don't have wordexp, glob will be used instead ***])])
George Lebl's avatar
George Lebl committed
246

247
dnl scrollkeeper checks 
248 249 250 251 252
AC_ARG_ENABLE([scrollkeeper],
	[AC_HELP_STRING([--disable-scrollkeeper],
		[do not make updates to the scrollkeeper database])],,
		enable_scrollkeeper=yes)
AM_CONDITIONAL([ENABLE_SK],[test "$enable_scrollkeeper" = "yes"])
253 254 255 256 257

AC_PATH_PROG(SCROLLKEEPER_CONFIG, scrollkeeper-config,no)
if test x$SCROLLKEEPER_CONFIG = xno; then
  AC_MSG_ERROR(Couldn't find scrollkeeper-config. Please install the scrollkeeper package)
fi
George Lebl's avatar
George Lebl committed
258

259 260 261 262 263 264 265
dnl mime checks
AC_ARG_ENABLE(update-mimedb,
	AC_HELP_STRING([--disable-update-mimedb],
		[do not update mime database after installation]),,
		enable_update_mimedb=yes)
AM_CONDITIONAL(ENABLE_UPDATE_MIMEDB, test x$enable_update_mimedb = xyes)

George Lebl's avatar
George Lebl committed
266 267 268 269 270 271 272 273 274 275 276
AC_OUTPUT([
genius.spec
Makefile
src/Makefile
lib/Makefile
lib/calculus/Makefile
lib/combinatorics/Makefile
lib/equation_solving/Makefile
lib/functions/Makefile
lib/linear_algebra/Makefile
lib/misc/Makefile
277
lib/sets/Makefile
George Lebl's avatar
George Lebl committed
278 279
lib/number_theory/Makefile
lib/statistics/Makefile
280
lib/symbolic/Makefile
281
ve/Makefile
282
gtkextra/Makefile
283 284 285
pixmaps/Makefile
pixmaps/32x32/Makefile
pixmaps/48x48/Makefile
George Lebl's avatar
George Lebl committed
286
po/Makefile.in
287 288
help/Makefile
help/C/Makefile
289 290 291 292 293
])

echo "
Configuration:

294 295 296 297
	Source code location:	     ${srcdir}
	Compiler:		     ${CC} 
	GNOME frontend:		     ${use_gnome}
	Using GtkSourceView:	     ${use_gtksourceview}
298

299
	Extra Compiler Warnings:     ${EXTRA_WARNING_CFLAGS}
300
"