dnl Process this file with autoconf to produce a configure script. AC_INIT(src) AM_CONFIG_HEADER(config.h) AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE(scigraphica, 0.8.0) dnl --- Checks for programs. AM_ACLOCAL_INCLUDE(macros) AC_ISC_POSIX AC_PROG_CC AC_PROG_RANLIB AC_PROG_MAKE_SET AC_STDC_HEADERS AC_ARG_PROGRAM AC_PROG_LIBTOOL dnl Extra include and library paths readline_path="" AC_ARG_WITH(readline-path, --with-readline-path=DIR specify readline library path, readline_path=$withval) termcap_path="" AC_ARG_WITH(termcap-path, --with-termcap-path=DIR specify termcap library path, termcap_path=$withval) LIBS="$LIBS -L$termcap_path -L$readline_path" readline_include_path="" AC_ARG_WITH(readline-include-path, --with-readline-include-path=DIR specify readline include path, readline_include_path=$withval) termcap_include_path="" AC_ARG_WITH(termcap-include-path, --with-termcap-include-path=DIR specify termcap include path, termcap_include_path=$withval) CFLAGS="$CFLAGS -I$termcap_include_path -I$readline_include_path" dnl Check for termcap - fatal if it fails AC_CHECK_LIB(termcap, tgoto,[TERMCAP_LIB="-ltermcap"], AC_MSG_ERROR(Termcap not found)) dnl Check for readline AC_CHECK_LIB(readline,readline, [LIBS="$LIBS -lreadline $TERMCAP_LIB"], AC_MSG_ERROR(Readline library not found), $TERMCAP_LIB) # SuSE-7.1 seems to need libncurses: # not fatal if it fails, not all readlines use it AC_CHECK_LIB(ncurses,tgoto, [LIBS="$LIBS -lncurses"],,) # FreeBSD needs -pthread flag with gcc if test `uname` = FreeBSD ; then AC_CHECK_LIB(c_r,pthread_create, [LIBS="$LIBS -pthread"],,) fi AC_CHECK_LIB(readline,rl_free_line_state, [CFLAGS="$CFLAGS -DREADLINE_4"]) dnl echo "Readline library 4 or newer not found, terminal may be flakey...",$TERMCAP_LIB) AC_SUBST(READLINE_LIB) AC_PATH_PROG(XML_CONFIG,xml-config,no) if test x$XML_CONFIG = xno; then AC_MSG_ERROR(Couldn't find xml-config) fi XML_LIBS=`xml-config --libs` XML_CFLAGS=`xml-config --cflags` AC_SUBST(XML_LIBS) AC_SUBST(XML_CFLAGS) dnl Check to make sure that we have libxml >= 1.7.2 installed old_LIBS="$LIBS" LIBS="$XML_LIBS $LIBS" AC_CHECK_FUNC(xmlSAXUserParseFile,, AC_MSG_ERROR([*** libxml >= 1.7.2 is required to compile libglade])) LIBS="$old_LIBS" dnl Set up Gnome dnl Hmm, this causes autoheader to fail for LIBSM... dnl GNOME_X_CHECKS AC_ARG_ENABLE(imlib, [ --disable-imlib Compile without imlib], , [with_imlib=yes AM_PATH_GDK_IMLIB(1.9.7, [LIBS="$LIBS $GDK_IMLIB_LIBS" CFLAGS="$CFLAGS $GDK_IMLIB_CFLAGS -DWITH_GDK_IMLIB"], AC_MSG_RESULT(Cannot find GdkImlib: disabling image handling))]) #AM_PATH_IMLIB(1.9.7, # [LIBS="$LIBS $IMLIB_LIBS" CFLAGS="$CFLAGS $IMLIB_CFLAGS -DWITH_IMLIB"], # (Cannot find Imlib: Is imlib-config in path?)) #AM_PATH_GDK_IMLIB(1.9.7, # [LIBS="$LIBS $GDK_IMLIB_LIBS" CFLAGS="$CFLAGS $GDK_IMLIB_CFLAGS -DWITH_GDK_IMLIB"], # AC_MSG_RESULT(Cannot find GdkImlib: disabling image handling)) AM_PATH_GTK(1.2.0, [LIBS="$LIBS $GTK_LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS"], AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?)) AM_PATH_GTK_EXTRA(0.99.17, [LIBS="$LIBS $GTK_EXTRA_LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS"], AC_MSG_ERROR(Cannot find GTK+EXTRA: Is gtkextra-config in path?)) enable_gnome=no dnl GNOME_INIT_HOOK (script-if-gnome-enabled, [failflag], [additional-inits]) GNOME_INIT_HOOK(enable_gnome=yes LIBS="$LIBS `$GNOME_CONFIG --libs gnome gnomeui`" CFLAGS="$CFLAGS `$GNOME_CONFIG --cflags gnome gnomeui` -DWITH_GNOME" GNOME_VERSION="`$GNOME_CONFIG --modversion`" ,no_gnome) ### Check for Bonobo bonobo="" if eval "test x$enable_gnome != xno"; then #AM_PATH_LIBART(,[LIBS="$LIBS $LIBART_LIBS" CFLAGS="$CFLAGS $LIBART_CFLAGS -DWITH_LIBART"], # AC_MSG_RESULT(Cannot find LIBART, disabling anti-aliasing)) AM_PATH_GNOME_PRINT(,[CFLAGS="$CFLAGS -DWITH_GNOME_PRINT"], AC_MSG_RESULT(Cannot find GNOME-PRINT, continuing)) AC_CHECK_PROG(libart_config_found,libart-config, yes,no) AC_CHECK_LIB(art_lgpl, art_pixbuf_new_rgb, [libart_found=yes], AC_MSG_RESULT(Cannot find LIBART, disabling anti-aliasing)) if eval "test x$libart_found != xno && test x$libart_config_found != xno"; then LIBART_CFLAGS="`libart-config --cflags`" AC_SUBST(LIBART_CFLAGS) CFLAGS="$CFLAGS $LIBART_CFLAGS -DWITH_LIBART" LIBART_LIBS="`libart-config --libs`" AC_SUBST(LIBART_LIBS) LIBS="$LIBS $LIBART_LIBS" fi AC_ARG_WITH(bonobo, --with-bonobo compile with bonobo support, [ bonobo=$withval bonobo_msg=no AC_MSG_CHECKING(for Bonobo >= 0.18) if gnome-config --libs bonobox_print > /dev/null 2>&1; then verstxt=`gnome-config --modversion bonobox_print` vers=`echo "$verstxt" | sed -e "s/^bonobo-//" | \ awk -F. '{ printf "%d", $1 * 1000 + $2; }'` if test "$vers" -ge 18; then bonobo_ok=true AC_SUBST(WITH_BONOBO) AM_CONDITIONAL(WITH_BONOBO,$bonobo_ok) AC_DEFINE(WITH_BONOBO) BONOBO_CFLAGS=`gnome-config --cflags bonobox_print` BONOBO_LIBS="-lbonobo-print `gnome-config --libs bonobox_print`" bonobo_msg=yes else bonobo_ok=false fi else bonobo_ok=false fi if $bonobo_ok; then AC_MSG_RESULT($vers found) AC_MSG_CHECKING(if Bonobo uses OAF) if ( gnome-config --libs bonobo | grep oaf ) > /dev/null 2>&1 ; then enable_oaf="yes" else enable_oaf="no" fi AC_MSG_RESULT("$enable_oaf") if test "x$enable_oaf" = "xyes"; then AC_PATH_PROG(OAF_CONFIG,oaf-config,no) if test x$OAF_CONFIG = xno; then AC_MSG_ERROR("You enabled OAF support but oaf-config was not found") else dnl Success OAF_LIBS=`$OAF_CONFIG --libs` OAF_CFLAGS=`$OAF_CONFIG --cflags` fi else OAF_LIBS= OAF_CFLAGS= fi AC_SUBST(OAF_LIBS) AC_SUBST(OAF_CFLAGS) AC_SUBST(BONOBO_LIBS) AC_SUBST(BONOBO_CFLAGS) else AC_MSG_RESULT(not found) fi]) fi dnl dnl gnome-pty-support checks dnl AC_MSG_CHECKING([for Unix98 sendmsg]) AC_TRY_LINK([ #include #include #include ],[ struct msghdr hdr; hdr.msg_control = NULL; hdr.msg_controllen = 0; sendmsg (0, &hdr, 0); ],[ AC_DEFINE(HAVE_SENDMSG) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)]) dnl AC_CHECK_UTMP dnl AC_CHECK_LASTLOG AC_CHECK_HEADERS(pty.h util.h libutil.h ttyent.h) AC_CHECK_LIB(util, openpty, [ AC_CHECK_LIB(util, login_tty, [AC_DEFINE(HAVE_LOGIN_TTY)]) AC_DEFINE(HAVE_OPENPTY) AC_DEFINE(HAVE_LIBUTIL) UTIL_LIBS="-lutil" AC_SUBST(UTIL_LIBS) ]) AC_CHECK_FUNCS(grantpt utmpxname utmpname getutmpx getutent getttyent) AC_CHECK_FUNCS(updwtmpx updwtmp fcntl flock strrchr seteuid setreuid) AC_CHECK_HEADER(stropts.h, AC_DEFINE(HAVE_STROPTS_H)) AC_CHECK_HEADER(dlfcn.h, AC_DEFINE(HAVE_DLFCN_H)) dnl And workaround for a Autoconf 2.4 bug: if test x$ac_cv_func_grantpt = xyes; then : else AC_CHECK_LIB(pt, grantpt) fi dnl --- Checks for libraries. dnl --- Check for printing subsys dnl these printer tests might need to be better arranged. dnl I think there should be a standard printing.m4 program or something. lp_path=":" AC_ARG_ENABLE(lp_path, [ --with-lp=DIR set lp command location], if eval "test x$with_lp != x"; then lp_path=$with_lp fi) lpr_path=":" AC_ARG_ENABLE(lpr_path, [ --with-lpr=DIR set lpr command location], if eval "test x$with_lpr != x"; then lpr_path=$with_lpr fi) dnl tests for lp if eval "test x$with_lpr = x"; then AC_PATH_PROG(LP_COMMAND, "lp", $lp_path, $PATH:/usr/bin:/usr/sbin:/usr/ucb:/usr/bsd) if test $ac_cv_path_LP_COMMAND != ":"; then AC_DEFINE_UNQUOTED(PRINT_COMMAND, "$ac_cv_path_LP_COMMAND") using_lp=1 fi fi dnl tests for lpr if eval "test x$using_lp = x"; then AC_PATH_PROG(LPR_COMMAND, "lpr", $lpr_path, $PATH:/usr/bin:/usr/sbin:/usr/ucb:/usr/bsd) if test $ac_cv_path_LPR_COMMAND != ":"; then AC_DEFINE_UNQUOTED(PRINT_COMMAND, "$ac_cv_path_LPR_COMMAND") using_lpr=1 fi fi test "x$prefix" = xNONE && prefix=$ac_default_prefix AC_DEFINE_UNQUOTED(LOCALEDIR, "${prefix}/share/locale") dnl ************************************************** dnl * Check for Python dnl ************************************************** dnl AC_CHECK_PROG(python_val, python, true, false) numpy=false if $python_val; then pysga_prefix="" AC_ARG_WITH(python-script-prefix, --with-python-script-prefix=DIR specify python script installation prefix, pysga_prefix=$withval) python_prefix="" AC_ARG_WITH(python-prefix, --with-python-prefix=DIR specify alternative (non-system) python installation directory, python_prefix=$withval) if test x$python_prefix = x; then PY_PREFIX=`python -c 'import sys ; print sys.prefix'` PY_EXEC_PREFIX=`python -c 'import sys ; print sys.exec_prefix'` else echo "Using alternative python installation under $python_prefix" PY_PREFIX=$python_prefix PY_EXEC_PREFIX=$python_prefix fi changequote(<<, >>)dnl PY_VERSION=`python -c 'import sys ; print sys.version[0:3]'` PY_VVERSION=`python -c 'import sys ; print sys.version[0:5]'` changequote([, ])dnl echo "Searching for arrayobject.h" if test -f $PY_PREFIX/include/python$PY_VERSION/Python.h; then PY_LIBS="python$PY_VERSION" PY_LIB_LOC="$PY_EXEC_PREFIX/lib/python$PY_VERSION/" array_loc=`find $PY_PREFIX/include/python$PY_VERSION/ -name arrayobject.h | sed s/arrayobject\.h//` if test x$array_loc = x; then echo "...trying from $PY_PREFIX" array_loc=`find $PY_PREFIX/ -name arrayobject.h | sed s/arrayobject\.h//` fi echo arrayobject.h location: $array_loc PY_CFLAGS="-I$PY_PREFIX/include/python$PY_VERSION" if test -n $array_loc; then if test -d $array_loc; then PY_CFLAGS="$PY_CFLAGS -I$array_loc -DWITH_NUMERIC_PYTHON" numpy=true fi fi PY_MAKEFILE="$PY_EXEC_PREFIX/lib/python$PY_VERSION/config/Makefile" PY_LOCALMODLIBS=`sed -n -e 's/^LOCALMODLIBS=\(.*\)/\1/p' $PY_MAKEFILE` PY_BASEMODLIBS=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $PY_MAKEFILE` PY_OTHER_LIBS=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $PY_MAKEFILE` PY_EXTRA_LIBS="$PY_LOCALMODLIBS $PY_BASEMODLIBS $PY_OTHER_LIBS" AC_SUBST(PY_LIBS) AC_SUBST(PY_LIB_LOC) AC_SUBST(PY_CFLAGS) AC_SUBST(PY_EXTRA_LIBS) else python_val=false echo Python.h header file not found fi fi AM_CONDITIONAL(WITH_PYTHON, $python_val) if eval "test x$array_loc = x"; then echo Numerical python not found! exit fi if test x$pysga_prefix = x; then PYTHON_MOD_DIR=${datadir}/scigraphica/python else PYTHON_MOD_DIR=$pysga_prefix fi AC_SUBST(PYTHON_MOD_DIR) dnl if test x$enable_gnome = xno; then CFLAGS="$CFLAGS -I../zvt -I../../zvt" LIBS="$LIBS -L../zvt -lsgvt" dnl fi UNAME=`uname -s -m -r -p` GTK_EXTRA_VERSION=`$GTK_EXTRA_CONFIG --version` GTK_VERSION=`$GTK_CONFIG --version` XML_VERSION=`$XML_CONFIG --version` # strip duplicate entries in compiler flags echo "stripping compiler flags" COMPILER_FLAGS="" for i in $CC $CFLAGS $XML_CFLAGS $GDK_IMLIB_CFLAGS $GTK_CFLAGS $GTK_EXTRA_CFLAGS \ $PY_CFLAGS $LIBS $XML_LIBS $GDK_IMLIB_LIBS $GTK_LIBS $GTK_EXTRA_LIBS $LDFLAGS do found="false" for k in $COMPILER_FLAGS do test "$i" = "$k" && { found="true" ; break ; } done test "$found" = "false" && COMPILER_FLAGS="$COMPILER_FLAGS $i" done AC_DEFINE_UNQUOTED(VERSION_INFO, "sg-$VERSION\\n$UNAME\\n\ gtk-$GTK_VERSION gtkextra-$GTK_EXTRA_VERSION $GNOME_VERSION\\n\ xml-$XML_VERSION python-$PY_VVERSION $array_loc\\n"\ __DATE__ " " __TIME__ "\\n\ Compiler flags:$COMPILER_FLAGS\\n\ (C) 2000 Adrian E. Feiguin\\n" ) AC_DEFINE_UNQUOTED(SG_ROOT, "$prefix") AC_DEFINE_UNQUOTED(SG_DOCVIEWER, "netscape -noraise -remote openURL\\\\(%s,newwindow\\\\) >>/dev/null 2>&1 || netscape %s") AC_OUTPUT( Makefile sg.spec sg-mdk.spec docs/Makefile examples/Makefile src/Makefile src/python/Makefile pixmaps/Makefile zvt/Makefile macros/Makefile )