mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-14 06:57:01 +00:00
173 lines
4.4 KiB
Plaintext
173 lines
4.4 KiB
Plaintext
|
# Configure paths for Libsigc++
|
||
|
# Based on Gtk-- script by Erik Andersen and Tero Pulkkinen
|
||
|
|
||
|
dnl Test for Libsigc++, and define SIGC_CFLAGS and SIGC_LIBS
|
||
|
dnl to be used as follows:
|
||
|
dnl AM_PATH_SIGC(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||
|
dnl
|
||
|
AC_DEFUN(AM_PATH_SIGC,
|
||
|
[dnl
|
||
|
dnl Get the cflags and libraries from the sigc-config script
|
||
|
dnl
|
||
|
|
||
|
dnl
|
||
|
dnl Prefix options
|
||
|
dnl
|
||
|
AC_ARG_WITH(sigc-prefix,
|
||
|
[ --with-sigc-prefix=PREFIX
|
||
|
Prefix where libsigc++ is installed (optional)]
|
||
|
, sigc_config_prefix="$withval", sigc_config_prefix="")
|
||
|
|
||
|
AC_ARG_WITH(sigc-exec-prefix,
|
||
|
[ --with-sigc-exec-prefix=PREFIX
|
||
|
Exec prefix where libsigc++ is installed (optional)]
|
||
|
, sigc_config_exec_prefix="$withval", sigc_config_exec_prefix="")
|
||
|
|
||
|
AC_ARG_ENABLE(sigctest,
|
||
|
[ --disable-sigctest Do not try to compile and run a test libsigc++
|
||
|
program],
|
||
|
, enable_sigctest=yes)
|
||
|
|
||
|
dnl
|
||
|
dnl Prefix handling
|
||
|
dnl
|
||
|
if test x$sigc_config_exec_prefix != x ; then
|
||
|
sigc_config_args="$sigc_config_args --exec-prefix=$sigc_config_exec_prefix"
|
||
|
if test x${SIGC_CONFIG+set} != xset ; then
|
||
|
SIGC_CONFIG=$sigc_config_exec_prefix/bin/sigc-config
|
||
|
fi
|
||
|
fi
|
||
|
if test x$sigc_config_prefix != x ; then
|
||
|
sigc_config_args="$sigc_config_args --prefix=$sigc_config_prefix"
|
||
|
if test x${SIGC_CONFIG+set} != xset ; then
|
||
|
SIGC_CONFIG=$sigc_config_prefix/bin/sigc-config
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
dnl
|
||
|
dnl See if sigc-config is alive
|
||
|
dnl
|
||
|
AC_PATH_PROG(SIGC_CONFIG, sigc-config, no)
|
||
|
sigc_version_min=$1
|
||
|
|
||
|
dnl
|
||
|
dnl Version check
|
||
|
dnl
|
||
|
AC_MSG_CHECKING(for libsigc++ - version >= $sigc_version_min)
|
||
|
no_sigc=""
|
||
|
if test "$SIGC_CONFIG" = "no" ; then
|
||
|
no_sigc=yes
|
||
|
else
|
||
|
sigc_version=`$SIGC_CONFIG --version`
|
||
|
|
||
|
SIGC_CFLAGS=`$SIGC_CONFIG $sigc_config_args --cflags`
|
||
|
SIGC_LIBS=`$SIGC_CONFIG $sigc_config_args --libs`
|
||
|
SIGC_MACROS=`$SIGC_CONFIG $sigc_config_args --libs`
|
||
|
|
||
|
sigc_major_version=`echo $sigc_version | \
|
||
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||
|
sigc_minor_version=`echo $sigc_version | \
|
||
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||
|
sigc_micro_version=`echo $sigc_version | \
|
||
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||
|
|
||
|
sigc_major_min=`echo $sigc_version_min | \
|
||
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||
|
sigc_minor_min=`echo $sigc_version_min | \
|
||
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||
|
sigc_micro_min=`echo $sigc_version_min | \
|
||
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||
|
|
||
|
sigc_version_proper=`expr \
|
||
|
$sigc_major_version \> $sigc_major_min \| \
|
||
|
$sigc_major_version \= $sigc_major_min \& \
|
||
|
$sigc_minor_version \> $sigc_minor_min \| \
|
||
|
$sigc_major_version \= $sigc_major_min \& \
|
||
|
$sigc_minor_version \= $sigc_minor_min \& \
|
||
|
$sigc_micro_version \>= $sigc_micro_min `
|
||
|
|
||
|
if test "$sigc_version_proper" = "1" ; then
|
||
|
AC_MSG_RESULT([$sigc_major_version.$sigc_minor_version.$sigc_micro_version])
|
||
|
else
|
||
|
AC_MSG_RESULT(no)
|
||
|
no_sigc=yes
|
||
|
fi
|
||
|
|
||
|
if test "X$no_sigc" = "Xyes" ; then
|
||
|
enable_sigctest=no
|
||
|
fi
|
||
|
|
||
|
AC_LANG_SAVE
|
||
|
AC_LANG_CPLUSPLUS
|
||
|
|
||
|
dnl
|
||
|
dnl
|
||
|
dnl
|
||
|
if test "x$enable_sigctest" = "xyes" ; then
|
||
|
AC_MSG_CHECKING(if libsigc++ sane)
|
||
|
ac_save_CXXFLAGS="$CXXFLAGS"
|
||
|
ac_save_LIBS="$LIBS"
|
||
|
CXXFLAGS="$CXXFLAGS $SIGC_CFLAGS"
|
||
|
LIBS="$LIBS $SIGC_LIBS"
|
||
|
|
||
|
rm -f conf.sigctest
|
||
|
AC_TRY_RUN([
|
||
|
#include <stdio.h>
|
||
|
#include <sigc++/signal_system.h>
|
||
|
|
||
|
#ifdef SIGC_CXX_NAMESPACES
|
||
|
using namespace SigC;
|
||
|
#endif
|
||
|
|
||
|
int foo1(int i)
|
||
|
{
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
int main(int argc,char **argv)
|
||
|
{
|
||
|
if (sigc_major_version!=$sigc_major_version ||
|
||
|
sigc_minor_version!=$sigc_minor_version ||
|
||
|
sigc_micro_version!=$sigc_micro_version)
|
||
|
{ printf("(%d.%d.%d) ",
|
||
|
sigc_major_version,sigc_minor_version,sigc_micro_version);
|
||
|
return 1;
|
||
|
}
|
||
|
Signal1<int,int> sig1;
|
||
|
sig1.connect(slot(foo1));
|
||
|
sig1(1);
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
],[
|
||
|
AC_MSG_RESULT(yes)
|
||
|
],[
|
||
|
AC_MSG_RESULT(no)
|
||
|
no_sigc=yes
|
||
|
]
|
||
|
,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||
|
|
||
|
CXXFLAGS="$ac_save_CXXFLAGS"
|
||
|
LIBS="$ac_save_LIBS"
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
dnl
|
||
|
dnl
|
||
|
if test "x$no_sigc" = x ; then
|
||
|
ifelse([$2], , :, [$2])
|
||
|
else
|
||
|
SIGC_CFLAGS=""
|
||
|
SIGC_LIBS=""
|
||
|
SIGC_MACROS=""
|
||
|
ifelse([$3], , :, [$3])
|
||
|
fi
|
||
|
|
||
|
AC_LANG_RESTORE
|
||
|
|
||
|
AC_SUBST(SIGC_CFLAGS)
|
||
|
AC_SUBST(SIGC_LIBS)
|
||
|
AC_SUBST(SIGC_MACROS)
|
||
|
])
|
||
|
|