###{{{############################################################### # This file is part of libco - object library for C # # Copyright (c) 2002 # # Peter Rockai (yenar) # # Michal Dvoracek (lampa) # # # # This program is free software; you can redistribute it and/or # # modify it under the terms of the GNU General Public # # License as published by the Free Software Foundation; either # # version 2 of the License, or (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # # General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; see the file COPYING. If not, write to # # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, # # Boston, MA 02111-1307, USA. # ###############################################################}}}### AC_DEFUN(YAAD_CHECK_PACKAGE, [ # {{{ YAAD_CHECK_PACKAGE ($1, $2, $3, $4) # {{{ check for includes AC_ARG_WITH($1-include, AC_HELP_STRING( [--with-$1-include=DIR], [specify $1 include directory, default=guess] ), [ TRY_IFLAGS="-I$withval" ], [ TRY_IFLAGS="" ] ) TRY_IFLAGS="$TRY_IFLAGS \ -I$prefix/include -I$prefix/include/$1 \ -I$prefix/$1/include -I$prefix/lib/$1/include \ -I/usr/local/include -I/usr/include \ -I/usr/local/include/$1 -I/usr/include/$1 \ -I/usr/local/$1/include -I/usr/lib/$1/include \ -I/usr/include/$1 $5" AC_MSG_CHECKING(for $1 includes) IFLAGS=nothing_found AC_TRY_COMPILE([#include <$2>],,[ IFLAGS= TRY_IFLAGS= ]) old_CFLAGS="$CFLAGS" for i in $TRY_IFLAGS; do CFLAGS="$old_CFLAGS" CFLAGS="$CFLAGS $i" AC_TRY_COMPILE([#include <$2>],,[ IFLAGS=$i break ]) done CFLAGS="$old_CFLAGS" if test "x$IFLAGS" = "xnothing_found"; then AC_MSG_RESULT(not found) AC_MSG_ERROR(could not find $1!) else AC_MSG_RESULT(found $IFLAGS) fi dnl here add include to include path CFLAGS="$CFLAGS $IFLAGS" # }}} # {{{ check for library AC_ARG_WITH($1-lib, AC_HELP_STRING( [--with-$1-lib=DIR], [specify $1 lib directory, default=guess] ), [ TRY_LIBFLAGS="-L$withval" ], [ TRY_LIBFLAGS="" ] ) TRY_LIBFLAGS="$TRY_LIBFLAGS \ -L$prefix/lib -L$prefix/lib/$1 \ -L$prefix/$1/lib -I$prefix/lib/$1/lib \ -L/usr/local/lib -L/usr/lib -L/lib -L/usr/local/$1/lib -L/usr/local/lib/$1 \ -L/usr/local/lib/$1/lib -L/usr/lib/$1 \ -L/usr/lib/$1/lib $6" AC_MSG_CHECKING(for $1 libraries) LIBFLAGS=nothing_found old_LIBS=$LIBS LIBS="$LIBS -l$4" AC_TRY_LINK_FUNC($3, [ LIBFLAGS= TRY_LIBFLAGS= ]) for i in $TRY_LIBFLAGS; do LIBS=$old_LIBS LIBS="$LIBS $i -l$4" AC_TRY_LINK_FUNC($3, [ LIBFLAGS=$i break ]) done LIBS=$old_LIBS if test "x$LIBFLAGS" = "xnothing_found"; then AC_MSG_RESULT(not found) AC_MSG_ERROR([Please (re)install the $1 distribution]) else AC_MSG_RESULT(found $LIBFLAGS) fi dnl here add lib to libs LIBS="$LIBS $LIBFLAGS" # }}} # }}} ]) AC_DEFUN(YAAD_CHECK_DEBUG, [ # {{{ YAAD_CHECK_DEBUG AC_ARG_ENABLE(debug, AC_HELP_STRING( [--enable-debug=LVL], [set debugging level to LVL (0-16) 0=quiet 16=most verbose] [(for developers only), default=disabled,] [(enabled without value defaults to 8)] ) ) if test "$enable_debug" = "no"; then enable_debug=0; else if test -z "$enable_debug"; then enable_debug="0"; fi if test "$enable_debug" = "yes"; then enable_debug="8"; fi fi dnl AC_ARG_ENABLE(debug-log, [ --enable-debug-log log debugging output]) dnl if ! test "$enable_debug_log" = "no"; then dnl if ! test -z "$enable_debug_log"; then dnl AC_DEFINE_UNQUOTED(DEBUG_LOG) dnl fi dnl fi AC_DEFINE_UNQUOTED(DEBUGLVL,$enable_debug) # }}} ]) AC_DEFUN(YAAD_CHECK_LATEX, [ # {{{ YAAD_CHECK_LATEX AC_CHECK_PROGS(LATEX, cslatex latex, false) $LATEX 2>&5 >&5 << EOF \documentclass{article} \usepackage{slovak} \begin{document} Test \end{document} EOF if test "$?" -ne "0"; then AC_MSG_WARN([LaTeX is missing/broken; you can build]); AC_MSG_WARN([but you won't be able to print!]); fi rm -f texput.??? # }}} ]) AC_DEFUN(YAAD_CHECK_DMALLOC, [ # {{{ YAAD_CHECK_DMALLOC DMALLOC_LIBS="" AC_ARG_ENABLE(dmalloc, AC_HELP_STRING( [--enable-dmalloc], [use dmalloc malloc debugger (for developers only), default=disabled] ) ) if ! test "$enable_dmalloc" = "no"; then if ! test -z "$enable_dmalloc"; then AC_DEFINE_UNQUOTED(USE_DMALLOC) YAAD_CHECK_PACKAGE(dmalloc, dmalloc.h, dmalloc_shutdown, dmalloc) DMALLOC_LIBS="-ldmalloc" CFLAGS="$CFLAGS -Wno-redundant-decls" fi fi AC_SUBST(DMALLOC_LIBS) # }}} ]) AC_DEFUN(YAAD_CHECK_WERROR, [ # {{{ YAAD_CHECK_WERROR AC_ARG_ENABLE(werror, AC_HELP_STRING( [--enable-werror], [enable -Werror compile flag (for developers only), default=disabled] ) ) if ! test "$enable_werror" = "no"; then if ! test -z "$enable_werror"; then CFLAGS="$CFLAGS -Wno-strict-prototypes -Werror" fi fi # }}} ]) AC_DEFUN(YAAD_CHECK_PROFILE, [ # {{{ YAAD_CHECK_PROFILE AC_ARG_ENABLE(profile, AC_HELP_STRING( [--enable-profile], [enable profiler (gprof) support (for developers only),] [default=disabled] ) ) if ! test "$enable_profile" = "no"; then if test -n "$enable_profile"; then CFLAGS="$CFLAGS -pg" AC_CHECK_LIB(c_p, printf, [LIBS="$LIBS -lc_p"], [AC_MSG_WARN(Profile-enabled libc not found)]) fi fi # }}} ]) AC_DEFUN(YAAD_CHECK_OPTIMIZE, [ # {{{ YAAD_CHECK_OPTIMIZE AC_ARG_ENABLE(optimize, AC_HELP_STRING( [--enable-optimize=LEVEL], [enable compile-time optimizations (LEVEL=no,low,normal,high),] [default=normal] ) ) if test "$enable_optimize" = "no"; then CFLAGS="$CFLAGS -O0" elif test "$enable_optimize" = "high"; then CFLAGS="$CFLAGS -O6" elif test "$enable_optimize" = "low"; then CFLAGS="$CFLAGS -O" else CFLAGS="$CFLAGS -O2" fi # }}} ]) AC_DEFUN(YAAD_INIT, [ # {{{ YAAD_INIT ($1, $2) # {{{ get system type AC_CANONICAL_SYSTEM # }}} # {{{ initialize automake AM_INIT_AUTOMAKE($1, $2) # }}} # {{{ initialize config.h header AH_TEMPLATE(DEBUGLVL, [set level of debugging output (larger=more output)]) AH_TEMPLATE(PREFIX, [installation prefix... should not be used if possible]) AM_CONFIG_HEADER(config.h) AC_DEFINE_UNQUOTED(PREFIX, "$prefix") # }}} # }}} ]) AC_DEFUN(YAAD_INIT_C, [ # {{{ YAAD_INIT_C # {{{ initialize config.h header AH_TEMPLATE(USE_DMALLOC, [set if we have dmalloc library and want to use it]) # }}} # {{{ check for C and libc features # {{{ check for standard (ISO) C headers AC_HEADER_STDC # }}} # {{{ check for "inline" keyword AC_C_INLINE # }}} # {{{ check for "const" keyword AC_C_CONST # }}} # {{{ check for "strcoll" function AC_FUNC_STRCOLL # }}} # {{{ check for "atoll" function AC_CHECK_FUNCS(atoll) # }}} AC_CHECK_HEADERS([unistd.h]) # }}} # {{{ set standard LIBS and CFLAGS LIBS="-L/usr/local/lib -L/usr/lib -L/lib" CFLAGS="-Wall -W -Winline -Wmissing-prototypes -Wstrict-prototypes \ -Wredundant-decls -Wundef -Wshadow -Wcast-qual -Wnested-externs \ $CFLAGS" # }}} # }}} ]) AC_DEFUN(YAAD_CHECK_COMMON, [ # {{{ check for --enable-* flags YAAD_CHECK_OPTIMIZE YAAD_CHECK_DEBUG YAAD_CHECK_DMALLOC YAAD_CHECK_WERROR YAAD_CHECK_PROFILE # }}} ]) AC_DEFUN(YAAD_CHECK_CO, [ # {{{ YAAD_CHECK_CO YAAD_CHECK_PACKAGE(co, co_object.h, _libco_static_init, co) AC_PATH_PROG(COPP, copp, not found, \ $PATH $prefix/bin $exec_prefix/bin $bindir) if test "x$GENMSG" = "xnot found"; then AC_ERROR(No copp found! Please check your libco installation.) fi dnl YAAD_GETTEXT_CO dnl libco already includes gettext # }}} ]) ### DEPRECATED MACROS AC_DEFUN(YAAD_GETTEXT_MISC, [ # {{{ YAAD_GETTEXT_MISC LOCALEDIR="${datadir}/locale"; LOCALEDIR=`echo "$LOCALEDIR" | sed -e "s,\\\${prefix},${prefix},"` AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR") AH_TEMPLATE(LOCALEDIR, set to directory where locale-specific files reside) AC_CONFIG_COMMANDS(po-makefile, mv po/Makefile \ po/Makefile.bad && sed -e \ "s/--keyword=_/--keyword=i18n --keyword=co_i18n --keyword=_co_i18n/" \ < po/Makefile.bad | \ sed -e "s/--keyword=N_/--keyword=i18n_noop --keyword=_co_i18n_noop/" \ > po/Makefile && rm -f po/Makefile.bad) # }}} ]) AC_DEFUN(YAAD_GETTEXT_CO, [ # {{{ YAAD_GETTEXT_CO MKINSTALLDIRS= if test -n "$ac_aux_dir"; then MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" fi if test -z "$MKINSTALLDIRS"; then MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" fi AC_SUBST(MKINSTALLDIRS) AC_MSG_CHECKING([whether NLS is requested]) AC_ARG_ENABLE(nls, [ --disable-nls do not use Native Language Support], USE_NLS=$enableval, USE_NLS=yes) AC_MSG_RESULT($USE_NLS) AC_SUBST(USE_NLS) if test "$USE_NLS" = "yes"; then AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if translation of program messages to the user's native language is requested.]) dnl Search for GNU msgfmt in the PATH. AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) dnl Search for GNU xgettext in the PATH. AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) for lang in $ALL_LINGUAS; do GMOFILES="$GMOFILES $lang.gmo" POFILES="$POFILES $lang.po" done CATOBJEXT=.gmo if test "x$ALL_LINGUAS" = "x"; then LINGUAS= else AC_MSG_CHECKING(for catalogs to be installed) NEW_LINGUAS= for presentlang in $ALL_LINGUAS; do useit=no for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do case "$desiredlang" in "$presentlang"*) useit=yes;; esac done if test $useit = yes; then NEW_LINGUAS="$NEW_LINGUAS $presentlang" fi done LINGUAS=$NEW_LINGUAS AC_MSG_RESULT($LINGUAS) fi if test -n "$LINGUAS"; then for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done fi POSUB=po AC_SUBST(CATALOGS) AC_SUBST(CATOBJEXT) AC_SUBST(GMOFILES) AC_SUBST(POFILES) AC_SUBST(POSUB) AC_OUTPUT_COMMANDS([for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" case "$ac_file" in *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; esac # PO directories have a Makefile.in generated from Makefile.in.in. case "$ac_file" in */Makefile.in) # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" fi ;; esac done]) fi YAAD_GETTEXT_MISC # }}} ])