and now with the correct filenames
[asterisk/asterisk.git] / acinclude.m4
index 57037b3..9722710 100644 (file)
@@ -20,8 +20,7 @@ esac
 PBX_LIB$1=0
 
 if test "${USE_$1}" != "no"; then      
-   AC_CHECK_LIB([$1], [$2], AC_DEFINE_UNQUOTED([HAVE_$4], 1,
-   [Define to indicate the $5 library]), [], -L${$1_DIR}/lib $6)
+   AC_CHECK_LIB([$1], [$2], [:], [], -L${$1_DIR}/lib $6)
 
    if test "${ac_cv_lib_$1_$2}" = "yes"; then
       $1_LIB="-l$1 $6"
@@ -38,19 +37,27 @@ if test "${USE_$1}" != "no"; then
         fi
       fi
       if test "x${$4_HEADER_FOUND}" = "x0" ; then
-        echo " ***"
-        echo " *** It appears that you do not have the $5 development package installed."
-        echo " *** Please install it to include $5 support, or re-run configure"
-        echo " *** with the argument --without-$1"
-        exit 1
+         if test ! -z "${$1_MANDATORY}" ;
+         then
+            echo " ***"
+            echo " *** It appears that you do not have the $1 development package installed."
+            echo " *** Please install it to include $5 support, or re-run configure"
+            echo " *** without explicitly specifying --with-$1"
+            exit 1
+         fi
+         $1_LIB=""
+         $1_INCLUDE=""
+         PBX_LIB$1=0
+      else
+         PBX_LIB$1=1
+         AC_DEFINE_UNQUOTED([HAVE_$4], 1, [Define to indicate the $5 library])
       fi
-      PBX_LIB$1=1 
    elif test ! -z "${$1_MANDATORY}";
    then
       echo "***"
       echo "*** The $5 installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** including --without-$1"
+      echo "*** without explicity specifying --with-$1"
       exit 1
    fi
 fi
@@ -61,7 +68,7 @@ AC_SUBST([PBX_LIB$1])
 
 
 AC_DEFUN(
-[AST_CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make, GNU_MAKE,
+[AST_CHECK_GNU_MAKE], [AC_CACHE_CHECK(for GNU make, GNU_MAKE,
    GNU_MAKE='Not Found' ;
    for a in make gmake gnumake ; do
       if test -z "$a" ; then continue ; fi ;
@@ -76,4 +83,19 @@ if test  "x$GNU_MAKE" = "xNot Found"  ; then
    exit 1
 fi
 AC_SUBST([GNU_MAKE])
-] )
+])
+
+AC_DEFUN(
+[AST_C_ATTRIBUTE],
+[AC_CACHE_CHECK([for $1 attribute support],
+                [ac_cv_attribute_$1],
+                AC_COMPILE_IFELSE(
+                   AC_LANG_PROGRAM(
+                       [[static void foo(void) __attribute__ (($1));xyz]],
+                       []),
+                   have_attribute_$1=1, have_attribute_$1=0)
+               )
+ if test "$have_attribute_$1" = "1"; then
+    AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to indicate the compiler supports __attribute__ (($1))])
+ fi
+])