comparison m4/acinclude.m4 @ 23006:06c248729e6f

allow OCTAVE_CHECK_LIB to stop with an error if a library is required * acinclude.m4 (OCTAVE_CHECK_LIB): New argument to indicate that a library is required. If the argument is provided, display different messages and fail if the library is not found.
author John W. Eaton <jwe@octave.org>
date Fri, 06 Jan 2017 11:50:56 -0500
parents 21707d6a02c7
children ee9aa83dce51
comparison
equal deleted inserted replaced
23005:8e9dd0d6e337 23006:06c248729e6f
649 fi 649 fi
650 ]) 650 ])
651 dnl 651 dnl
652 dnl Usage: 652 dnl Usage:
653 dnl OCTAVE_CHECK_LIB(LIBRARY, DOC-NAME, WARN-MSG, HEADER, FUNC, 653 dnl OCTAVE_CHECK_LIB(LIBRARY, DOC-NAME, WARN-MSG, HEADER, FUNC,
654 dnl LANG, DOC-STRING, EXTRA-CHECK, PKG-CONFIG-NAME) 654 dnl LANG, DOC-STRING, EXTRA-CHECK, PKG-CONFIG-NAME,
655 dnl REQUIRED)
655 dnl 656 dnl
656 AC_DEFUN([OCTAVE_CHECK_LIB], [ 657 AC_DEFUN([OCTAVE_CHECK_LIB], [
657 AC_ARG_WITH([$1-includedir], 658 AC_ARG_WITH([$1-includedir],
658 [AS_HELP_STRING([--with-$1-includedir=DIR], 659 [AS_HELP_STRING([--with-$1-includedir=DIR],
659 [look for $2 include files in DIR])], 660 [look for $2 include files in DIR])],
665 [look for $2 libraries in DIR])], 666 [look for $2 libraries in DIR])],
666 [m4_toupper([$1])_LDFLAGS="-L$withval"]) 667 [m4_toupper([$1])_LDFLAGS="-L$withval"])
667 AC_SUBST(m4_toupper([$1])_LDFLAGS) 668 AC_SUBST(m4_toupper([$1])_LDFLAGS)
668 669
669 AC_ARG_WITH([$1], 670 AC_ARG_WITH([$1],
670 [m4_ifblank([$7], 671 [ifelse([$#], 10,
671 [AS_HELP_STRING([--without-$1], [don't use $2 library])], 672 [m4_ifblank([$7],
672 [AS_HELP_STRING([--without-$1], [$7])])], 673 [AS_HELP_STRING([--with-$1=<lib>], [use $2 library <lib>])],
674 [AS_HELP_STRING([--with-$1], [$7])])],
675 [m4_ifblank([$7],
676 [AS_HELP_STRING([--without-$1], [don't use $2 library])],
677 [AS_HELP_STRING([--without-$1], [$7])])])],
673 with_$1=$withval, with_$1=yes) 678 with_$1=$withval, with_$1=yes)
674 679
675 ac_octave_$1_pkg_check=no 680 ac_octave_$1_pkg_check=no
676 m4_toupper([$1])_LIBS= 681 m4_toupper([$1])_LIBS=
677 warn_$1="$3" 682 warn_$1="$3"
678 case $with_$1 in 683 case $with_$1 in
679 no) 684 no)
680 warn_$1="--without-$1 specified. Functions or features that depend on $2 will be disabled." 685 ifelse([$#], 10,
681 m4_toupper([$1])_LIBS= 686 [AC_MSG_ERROR([--without-$1 specified but $2 is required.])],
687 [warn_$1="--without-$1 specified. Functions or features that depend on $2 will be disabled."
688 m4_toupper([$1])_LIBS=])
682 ;; 689 ;;
683 yes | "") 690 yes | "")
684 ac_octave_$1_pkg_check=yes 691 ac_octave_$1_pkg_check=yes
685 m4_toupper([$1])_LIBS="-l$1" 692 m4_toupper([$1])_LIBS="-l$1"
686 ;; 693 ;;
734 LIBS="$ac_octave_save_LIBS" 741 LIBS="$ac_octave_save_LIBS"
735 else 742 else
736 octave_cv_lib_$1=no 743 octave_cv_lib_$1=no
737 fi 744 fi
738 745
746 ifelse([$#], 10, [
747 if test $octave_cv_lib_$1 = no; then
748 AC_MSG_ERROR([to build Octave, you must have the $2 library and header files installed])
749 fi])
739 AC_SUBST(m4_toupper([$1])_LIBS) 750 AC_SUBST(m4_toupper([$1])_LIBS)
740 if test -n "$warn_$1"; then 751 if test -n "$warn_$1"; then
741 OCTAVE_CONFIGURE_WARNING([warn_$1]) 752 OCTAVE_CONFIGURE_WARNING([warn_$1])
742 m4_toupper([$1])_LIBS= 753 m4_toupper([$1])_LIBS=
743 fi 754 fi