dnl
dnl Check for a library in the system or local 
dnl arguments: 1: the librabry name without lib 2: the path to start searching
dnl for the local lib


AC_DEFUN(AC_CHECK_LIB_TWICE,

     testfun=main
     ac_lib_var=`echo $1['_']$testfun | sed 'y%./+-%__p_%'`

     AC_CHECK_LIB($1,$testfun,gem_system_lib=yes)

     if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = no" && \
              test "${gem_system_lib-no}" != "yes"; then
        AC_MSG_CHECKING("alternate -l$1 in $2")
        AC_CACHE_VAL(
            gem_c