1# Process this file with autoconf to produce a configure script. 2 3AC_INIT([nip2], [8.7.1], [vipsip@jiscmail.ac.uk]) 4 5# foreign stops complaints about a missing README (we use README.md instead) 6# and missing INSTALL (the standard Gnu INSTALL is not very useful) 7AM_INIT_AUTOMAKE([-Wno-portability foreign]) 8 9AC_CONFIG_HEADERS(config.h) 10AC_CONFIG_MACRO_DIR([m4]) 11 12dnl 13dnl We do the version number components as m4 macros 14dnl so that we can base configure --help output off 15dnl of them. 16dnl 17 18m4_define([nip_major_version], [8]) 19m4_define([nip_minor_version], [7]) 20m4_define([nip_micro_version], [1]) 21m4_define([nip_version], 22 [nip_major_version.nip_minor_version.nip_micro_version]) 23 24MAJOR_VERSION=nip_major_version() 25MINOR_VERSION=nip_minor_version() 26MICRO_VERSION=nip_micro_version() 27 28AC_DEFINE_UNQUOTED(MAJOR_VERSION, $MAJOR_VERSION, [Major version number]) 29AC_DEFINE_UNQUOTED(MINOR_VERSION, $MINOR_VERSION, [Minor version number]) 30AC_DEFINE_UNQUOTED(MICRO_VERSION, $MICRO_VERSION, [Micro version number]) 31 32AC_CANONICAL_HOST 33 34AC_MSG_CHECKING([for native Win32]) 35case "$host" in 36 *-*-mingw*) 37 nip_os_win32=yes 38 ;; 39 *) 40 nip_os_win32=no 41 ;; 42esac 43AC_MSG_RESULT([$nip_os_win32]) 44 45if test x"$nip_os_win32" = "xyes"; then 46 AC_DEFINE(OS_WIN32,1,[native win32]) 47 48 # makes gcc use win native alignment 49 IP_CFLAGS="-mms-bitfields $IP_CFLAGS" 50fi 51 52# src/Makeile.am uses this to add an icon to the .exe 53AM_CONDITIONAL(OS_WIN32, test x"$nip_os_win32" = "xyes") 54 55AC_MSG_CHECKING([for Mac OS X]) 56case "$host" in 57 *-*-darwin*) 58 nip_os_darwin=yes 59 ;; 60 *) 61 nip_os_darwin=no 62 ;; 63esac 64AC_MSG_RESULT([$nip_os_darwin]) 65if test x"$nip_os_darwin" = "xyes"; then 66 AC_DEFINE(OS_DARWIN,1,[native Mac OS X]) 67fi 68 69AC_ARG_ENABLE(debug, 70 AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@], 71 [turn on debugging @<:@default=debug_default()@:>@]),, 72 enable_debug=no) 73 74if test "x$enable_debug" = "xyes"; then 75 NIP_DEBUG_FLAGS="-DDEBUG_FATAL -DDEBUG_LEAK" 76else 77 NIP_DEBUG_FLAGS="-DG_DISABLE_CAST_CHECKS" 78 79 if test "x$enable_debug" = "xno"; then 80 NIP_DEBUG_FLAGS="$GLIB_DEBUG_FLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS" 81 fi 82fi 83 84IP_CFLAGS="$NIP_DEBUG_FLAGS $IP_CFLAGS" 85 86# we want largefile support, if possible 87AC_SYS_LARGEFILE 88 89# Checks for programs. 90AC_PROG_AWK 91AC_PROG_CC 92AM_PROG_CC_C_O 93AC_PROG_LEX 94# we must have flex or lex 95if test x"$LEX" = x:; then 96 AC_MSG_ERROR([lex/flex not found: $PACKAGE requires one of these]) 97fi 98IP_LIBS="$IP_LIBS $LEXLIB" 99AC_PROG_INSTALL 100AC_PROG_LN_S 101AC_CHECK_TOOL(WINDRES, windres) 102AC_CHECK_TOOL(DLLWRAP, dllwrap) 103AC_CHECK_TOOL(DLLTOOL, dlltool) 104AC_CHECK_TOOL(OBJDUMP, objdump) 105AC_CHECK_TOOL(RANLIB, ranlib) 106AC_CHECK_TOOL(STRIP, strip) 107AC_CHECK_TOOL(BISON, bison) 108# we have to have bison :-( maybe we could ship the generated .c/.h files? not 109# clear on their portability 110if test x"$BISON" = x; then 111 AC_MSG_ERROR([bison not found: $PACKAGE uses bison-only features]) 112fi 113AC_CHECK_TOOL(AR, ar) 114AC_CHECK_TOOL(AS, as) 115AC_CHECK_TOOL(LD, ld) 116AC_LIBTOOL_WIN32_DLL 117AC_PROG_LIBTOOL 118 119# dmalloc option 120AM_WITH_DMALLOC 121 122# i18n 123GETTEXT_PACKAGE=nip2 124AC_SUBST(GETTEXT_PACKAGE) 125AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", 126 [The prefix for our gettext translation domains.]) 127# ALL_LINGUAS="en_GB malkovich" 128ALL_LINGUAS="en_GB" 129AM_GLIB_GNU_GETTEXT 130 131# check for flex ... nip needs to adjust itself a bit 132if test "${LEX}" = "flex"; then 133 AC_DEFINE(HAVE_FLEX,1,[using flex, rather than lex]) 134fi 135 136# flex >= 2.5.36 uses a nonstandard type for yyleng 137AC_MSG_CHECKING([whether yyleng is yy_size_t]) 138cat > conftest.l <<EOF 139%% 140%% 141yy_size_t yyleng; 142EOF 143$LEX conftest.l 144AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED [`cat $LEX_OUTPUT_ROOT.c`]], [ 145 AC_MSG_RESULT(yes) 146 AC_DEFINE(YYLENG_IS_YY_SIZE_T,1, 147 [Define to 1 if lex declares yyleng to be yy_size_t.]) 148], [ 149 AC_MSG_RESULT(no) 150]) 151rm -f conftest.l $LEX_OUTPUT_ROOT.c 152 153# get packages we need 154# gtk before 2.4.9 crashes with the way we use combobox :-( 155# vips before 7.30 used "vips-x.y" as the pkg name 156PKG_CHECK_MODULES(REQUIRED_PACKAGES, 157 gmodule-2.0 gthread-2.0 gtk+-2.0 >= 2.4.9 libxml-2.0 vips >= 7.30) 158IP_CFLAGS="$REQUIRED_PACKAGES_CFLAGS $IP_CFLAGS" 159IP_LIBS="$REQUIRED_PACKAGES_LIBS $IP_LIBS" 160 161# gdk_window_set_opacity() was added in gtk 2.12 162PKG_CHECK_EXISTS(gtk+-2.0 >= 2.12, 163 [nip_set_opacity=yes], 164 [nip_set_opacity=no] 165) 166 167if test x"$nip_set_opacity" = x"yes"; then 168 AC_DEFINE(HAVE_SET_OPACITY,1,[define if you have gdk_window_set_opacity()]) 169fi 170 171# GtkInfoBar was added in gtk 2.18 172PKG_CHECK_EXISTS(gtk+-2.0 >= 2.18, 173 [nip_use_infobar=yes], 174 [nip_use_infobar=no] 175) 176 177if test x"$nip_use_infobar" = x"yes"; then 178 AC_DEFINE(USE_INFOBAR,1,[define if you have GtkInfoBar]) 179fi 180 181# notebook action widgets came in 2.20 182PKG_CHECK_EXISTS(gtk+-2.0 >= 2.20, 183 [nip_use_notebook_action=yes], 184 [nip_use_notebook_action=no] 185) 186 187if test x"$nip_use_notebook_action" = x"yes"; then 188 AC_DEFINE(USE_NOTEBOOK_ACTION,1,[define if you have gtk_notebook_set_action_widget()]) 189fi 190 191# notebook group names widgets came in 2.24 192PKG_CHECK_EXISTS(gtk+-2.0 >= 2.24, 193 [nip_use_notebook_group_name=yes], 194 [nip_use_notebook_group_name=no] 195) 196 197if test x"$nip_use_notebook_group_name" = x"yes"; then 198 AC_DEFINE(USE_NOTEBOOK_GROUP_NAME,1,[define if you have gtk_notebook_set_group_name()]) 199fi 200 201# GRegex was added in glib-2.14 202# we need it for regex searching in the program window 203PKG_CHECK_EXISTS(glib-2.0 >= 2.14, 204 [nip_use_gregex=yes], 205 [nip_use_gregex=no] 206) 207 208if test x"$nip_use_gregex" = x"yes"; then 209 AC_DEFINE(HAVE_GREGEX,1,[define if you have GRegex]) 210fi 211 212# Check for the function strccpy in libgen 213AC_CHECK_HEADER(libgen.h, 214 AC_CHECK_LIB(gen, strccpy, 215 AC_DEFINE(HAVE_STRCCPY,1,[have strccpy() in -lgen]) 216 IP_LIBS="$IP_LIBS -lgen" 217 ), 218) 219 220# Checks for header files. 221AC_HEADER_DIRENT 222AC_HEADER_STDC 223AC_HEADER_SYS_WAIT 224AC_CHECK_HEADERS(limits.h pwd.h fnmatch.h sys/statvfs.h sys/vfs.h sys/mount.h sys/resource.h sys/wait.h malloc.h sys/time.h sys/param.h unistd.h) 225 226# Checks for typedefs, structures, and compiler characteristics. 227AC_C_CONST 228AC_STRUCT_TM 229 230# Checks for library functions. 231AC_FUNC_ALLOCA 232AC_FUNC_FNMATCH 233AC_FUNC_VPRINTF 234AC_CHECK_FUNCS(geteuid getcwd getpwnam getrlimit getpwent getwd putenv regcomp strcspn strspn strstr) 235 236# need fftw so we load and unload wisdom on startup/shutdown 237AC_ARG_WITH([fftw3], AS_HELP_STRING([--without-fftw3], [build without fftw3 (default: test)])) 238 239if test "x$with_fftw3" != "xno"; then 240 PKG_CHECK_MODULES(FFTW3, fftw3, 241 [AC_DEFINE(HAVE_FFTW3,1,[define if you have fftw3 installed.]) 242 with_fftw3=yes 243 ], 244 [AC_MSG_WARN([fftw3 not found; disabling fftw support]) 245 with_fftw3=no 246 ]) 247 IP_CFLAGS="$FFTW3_INCLUDES $FFTW3_CFLAGS $IP_CFLAGS" 248 IP_LIBS="$FFTW3_LIBS $IP_LIBS" 249fi 250 251# goffice needs libgsf to save plots to files 252AC_ARG_WITH([libgsf], AS_HELP_STRING([--without-libgsf], [build without libgsf (default: test)])) 253 254if test "x$with_libgsf" != "xno"; then 255 PKG_CHECK_MODULES(LIBGSF, libgsf-1, 256 [AC_DEFINE(HAVE_LIBGSF,1,[define if you have libgsf installed.]) 257 with_libgsf=yes 258 ], 259 [AC_MSG_WARN([libgsf not found; disabling save plot to file]) 260 with_libgsf=no 261 ]) 262 IP_CFLAGS="$LIBGSF_CFLAGS $LIBGSF_INCLUDES $IP_CFLAGS" 263 IP_LIBS="$LIBGSF_LIBS $IP_LIBS" 264fi 265 266# optional ... use libgoffice to draw plots 267# pretty basic functionality, really, but we need to be able to build without 268# it for testing 269AC_ARG_WITH([libgoffice], AS_HELP_STRING([--without-libgoffice], [build without libgoffice (default: test)])) 270 271if test "x$with_libgoffice" != "xno"; then 272 PKG_CHECK_MODULES(LIBGOFFICE, libgoffice-0.8, 273 [AC_DEFINE(HAVE_LIBGOFFICE,1,[define if you have libgoffice installed.]) 274 with_libgoffice=yes 275 ], 276 [AC_MSG_WARN([libgoffice not found; disabling plot display]) 277 with_libgoffice=no 278 ]) 279 IP_CFLAGS="$LIBGOFFICE_CFLAGS $LIBGOFFICE_INCLUDES $IP_CFLAGS" 280 IP_LIBS="$LIBGOFFICE_LIBS $IP_LIBS" 281fi 282 283# optional ... use libgvc to draw graphs of workspace dependencies 284AC_ARG_WITH([libgvc], AS_HELP_STRING([--without-libgvc], [build without libgvc (default: test)])) 285 286# gvc 2.30 is broken in a number of ways and we can't use it, see for example 287# http://lists.research.att.com/pipermail/graphviz-devel/2012/001544.html 288 289if test "x$with_libgvc" != "xno"; then 290 PKG_CHECK_MODULES(LIBGVC, libgvc > 2.30, 291 [AC_DEFINE(HAVE_LIBGVC,1,[define if you have libgvc installed.]) 292 with_libgvc=yes 293 ], 294 [AC_MSG_WARN([libgvc not found; disabling workspace dep graph display]) 295 with_libgvc=no 296 ]) 297 IP_CFLAGS="$LIBGVC_CFLAGS $LIBGVC_INCLUDES $IP_CFLAGS" 298 IP_LIBS="$LIBGVC_LIBS $IP_LIBS" 299fi 300 301# optional ... we add some gsl funcs as builtins if available 302AC_ARG_WITH([gsl], AS_HELP_STRING([--without-gsl], [build without gsl (default: test)])) 303 304if test "x$with_gsl" != "xno"; then 305 PKG_CHECK_MODULES(GSL, gsl, 306 [AC_DEFINE(HAVE_GSL,1,[define if you have gsl installed.]) 307 with_gsl=yes 308 ], 309 [AC_MSG_WARN([gsl not found; disabling extra numerical functions]) 310 with_gsl=no 311 ]) 312 IP_CFLAGS="$GSL_CFLAGS $GSL_INCLUDES $IP_CFLAGS" 313 IP_LIBS="$GSL_LIBS $IP_LIBS" 314fi 315 316# optional ... use this to open the help browser, if available 317AC_PATH_PROG(XDG_OPEN, xdg-open, no) 318 319if test "x$XDG_OPEN" != "xno"; then 320 AC_DEFINE(HAVE_XDG_OPEN,1,[define if you have xdg-open]) 321 AC_DEFINE_UNQUOTED(XDG_OPEN, "$XDG_OPEN", [path of xdg-open binary]) 322fi 323 324# optional ... use these to update desktop after install 325AC_PATH_PROG(UPDATE_MIME_DATABASE, update-mime-database, no) 326AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, update-desktop-database, no) 327 328nip_desktop_update=no 329if test "x$UPDATE_MIME_DATABASE" != "xno"; then 330 if test "x$UPDATE_DESKTOP_DATABASE" != "xno"; then 331 nip_desktop_update=yes 332 fi 333fi 334 335# stop the DBs being updated: useful for packagers 336AC_ARG_ENABLE(update-desktop, 337 AC_HELP_STRING([--disable-update-desktop], 338 [disable update of desktop database]), 339 [nip_desktop_update=$enableval],) 340 341if test x"$nip_desktop_update" = "xyes"; then 342 AM_CONDITIONAL(UPDATE_DESKTOP, true) 343else 344 AM_CONDITIONAL(UPDATE_DESKTOP, false) 345fi 346 347# we always need -lm 348IP_LIBS="$IP_LIBS -lm" 349 350AC_SUBST(IP_CFLAGS) 351AC_SUBST(IP_LIBS) 352 353# needed by test/test_all.sh 354# :( what's a better way to do this, argh 355TOP_SRCDIR=$ac_pwd 356AC_SUBST(TOP_SRCDIR) 357 358AC_OUTPUT([ 359 nip2.desktop 360 Makefile 361 man/Makefile 362 man/man1/Makefile 363 share/Makefile 364 share/nip2/Makefile 365 share/nip2/data/Makefile 366 share/nip2/rc/Makefile 367 share/nip2/start/Makefile 368 share/nip2/compat/Makefile 369 share/nip2/compat/7.8/Makefile 370 share/nip2/compat/7.9/Makefile 371 share/nip2/compat/7.10/Makefile 372 share/nip2/compat/7.12/Makefile 373 share/nip2/compat/7.14/Makefile 374 share/nip2/compat/7.16/Makefile 375 share/nip2/compat/7.24/Makefile 376 share/nip2/compat/7.26/Makefile 377 share/nip2/compat/7.28/Makefile 378 share/nip2/compat/7.38/Makefile 379 share/nip2/compat/7.40/Makefile 380 share/nip2/compat/8.2/Makefile 381 share/nip2/compat/8.3/Makefile 382 share/nip2/compat/8.4/Makefile 383 share/nip2/compat/8.5/Makefile 384 share/nip2/compat/8.6/Makefile 385 src/BITMAPS/Makefile 386 src/Makefile 387 test/Makefile 388 test/test_all.sh 389 po/Makefile.in 390 nip2.spec 391]) 392 393# generated script needs to be executable 394chmod +x test/test_all.sh 395 396AC_MSG_RESULT([ 397* general build options 398native win32: $nip_os_win32 399native os x: $nip_os_darwin 400update desktop after install: $nip_desktop_update 401debug: $enable_debug 402 403* optional packages and modules 404use fftw3 for FFT: $with_fftw3 405use gsl for numeric functions: $with_gsl 406use libgoffice to show plots: $with_libgoffice 407use libgsf to save plots to files: $with_libgsf 408use libgvc to show ws dep graphs: $with_libgvc 409 (requires gvc > 2.30) 410use gtkinfobar to show messages: $nip_use_infobar 411 (requires gtk+-2.0 >= 2.18) 412use notebook action widget: $nip_use_notebook_action 413 (requires gtk+-2.0 >= 2.20) 414use notebook group name: $nip_use_notebook_group_name 415 (requires gtk+-2.0 >= 2.24) 416allow regex searches: $nip_use_gregex 417 (requires glib-2.0 >= 2.14) 418display help files with xdg: $XDG_OPEN 419]) 420