From: Arran Cudbard-Bell Date: Tue, 26 Feb 2013 05:55:45 +0000 (-0500) Subject: Fix redis configure script X-Git-Tag: debian/3.0.0git+dfsg+moonshot3-2~94 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=freeradius.git;a=commitdiff_plain;h=e912ca07afb6cc5302d887a3105eb19864cf8b2a Fix redis configure script --- diff --git a/src/modules/rlm_redis/configure b/src/modules/rlm_redis/configure index 21ed8f1..2278aab 100755 --- a/src/modules/rlm_redis/configure +++ b/src/modules/rlm_redis/configure @@ -2636,99 +2636,73 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu - smart_try_dir="$redis_lib_dir" + smart_try_dir="${redis_include_dir}" -sm_lib_safe=`echo "hiredis" | sed 'y%./+-%__p_%'` -sm_func_safe=`echo "redisConnect" | sed 'y%./+-%__p_%'` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for redisConnect in -lhiredis" >&5 -$as_echo_n "checking for redisConnect in -lhiredis... " >&6; } +ac_safe=`echo "hiredis/hiredis.h" | sed 'y%./+-%__pm%'` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hiredis/hiredis.h" >&5 +$as_echo_n "checking for hiredis/hiredis.h... " >&6; } -old_LIBS="$LIBS" -smart_lib= -smart_lib_dir= +old_CFLAGS="$CFLAGS" +smart_include= +smart_include_dir= if test "x$smart_try_dir" != "x"; then for try in $smart_try_dir; do - LIBS="-L$try -lhiredis $old_LIBS" + CFLAGS="$old_CFLAGS -I$try" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern char redisConnect(); + + #include int main () { - redisConnect() + int a = 1; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - smart_lib="-L$try -lhiredis" +if ac_fn_c_try_compile "$LINENO"; then : + smart_include="-I$try" +else + smart_include= fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "x$smart_lib" != "x"; then +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "x$smart_include" != "x"; then break; fi done - LIBS="$old_LIBS" + CFLAGS="$old_CFLAGS" fi -if test "x$smart_lib" = "x"; then - LIBS="-lhiredis $old_LIBS" +if test "x$smart_include" = "x"; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern char redisConnect(); + + #include int main () { - redisConnect() + int a = 1; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - smart_lib="-lhiredis" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$old_LIBS" +if ac_fn_c_try_compile "$LINENO"; then : + smart_include=" " +else + smart_include= fi - -if test "x$smart_lib" = "x"; then - - -if test "x$LOCATE" != "x"; then - DIRS= - file=libhiredis${libltdl_cv_shlibext} - - for x in `${LOCATE} $file 2>/dev/null`; do - base=`echo $x | sed "s%/${file}%%"` - if test "x$x" = "x$base"; then - continue; - fi - - dir=`${DIRNAME} $x 2>/dev/null` - exclude=`echo ${dir} | ${GREP} /home` - if test "x$exclude" != "x"; then - continue - fi - - already=`echo \$smart_lib_dir ${DIRS} | ${GREP} ${dir}` - if test "x$already" = "x"; then - DIRS="$DIRS $dir" - fi - done +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -eval "smart_lib_dir=\"\$smart_lib_dir $DIRS\"" - +if test "x$smart_include" = "x"; then if test "x$LOCATE" != "x"; then DIRS= - file=libhiredis.a + file=hiredis/hiredis.h for x in `${LOCATE} $file 2>/dev/null`; do base=`echo $x | sed "s%/${file}%%"` @@ -2742,126 +2716,126 @@ if test "x$LOCATE" != "x"; then continue fi - already=`echo \$smart_lib_dir ${DIRS} | ${GREP} ${dir}` + already=`echo \$smart_include_dir ${DIRS} | ${GREP} ${dir}` if test "x$already" = "x"; then DIRS="$DIRS $dir" fi done fi -eval "smart_lib_dir=\"\$smart_lib_dir $DIRS\"" +eval "smart_include_dir=\"\$smart_include_dir $DIRS\"" - for try in $smart_lib_dir /usr/local/lib /opt/lib; do - LIBS="-L$try -lhiredis $old_LIBS" + for try in $smart_include_dir /usr/local/include /opt/include; do + CFLAGS="$old_CFLAGS -I$try" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern char redisConnect(); + + #include int main () { - redisConnect() + int a = 1; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - smart_lib="-L$try -lhiredis" +if ac_fn_c_try_compile "$LINENO"; then : + smart_include="-I$try" +else + smart_include= fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "x$smart_lib" != "x"; then +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "x$smart_include" != "x"; then break; fi done - LIBS="$old_LIBS" + CFLAGS="$old_CFLAGS" fi -if test "x$smart_lib" != "x"; then +if test "x$smart_include" != "x"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - eval "ac_cv_lib_${sm_lib_safe}_${sm_func_safe}=yes" - LIBS="$smart_lib $old_LIBS" - SMART_LIBS="$smart_lib $SMART_LIBS" + eval "ac_cv_header_$ac_safe=yes" + CFLAGS="$old_CFLAGS $smart_include" + SMART_CFLAGS="$SMART_CFLAGS $smart_include" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_cv_lib_hiredis_redisConnect" != "xyes" - then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: hiredis libraries not found. Use --with-redis-lib-dir=." >&5 -$as_echo "$as_me: WARNING: hiredis libraries not found. Use --with-redis-lib-dir=." >&2;} - fail="$fail libhiredis" + if test "x$ac_cv_header_hiredis_hiredis_h" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: hiredis headers not found. Use --with-redis-include-dir=." >&5 +$as_echo "$as_me: WARNING: hiredis headers not found. Use --with-redis-include-dir=." >&2;} + fail="$fail hiredis.h" fi - smart_try_dir="$redis_include_dir" + smart_try_dir="$redis_lib_dir" -ac_safe=`echo "hiredis.h" | sed 'y%./+-%__pm%'` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hiredis.h" >&5 -$as_echo_n "checking for hiredis.h... " >&6; } +sm_lib_safe=`echo "hiredis" | sed 'y%./+-%__p_%'` +sm_func_safe=`echo "redisConnect" | sed 'y%./+-%__p_%'` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for redisConnect in -lhiredis" >&5 +$as_echo_n "checking for redisConnect in -lhiredis... " >&6; } -old_CFLAGS="$CFLAGS" -smart_include= -smart_include_dir= +old_LIBS="$LIBS" +smart_lib= +smart_lib_dir= if test "x$smart_try_dir" != "x"; then for try in $smart_try_dir; do - CFLAGS="$old_CFLAGS -I$try" + LIBS="-L$try -lhiredis $old_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - - #include +extern char redisConnect(); int main () { - int a = 1; + redisConnect() ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - smart_include="-I$try" -else - smart_include= +if ac_fn_c_try_link "$LINENO"; then : + smart_lib="-L$try -lhiredis" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "x$smart_include" != "x"; then +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "x$smart_lib" != "x"; then break; fi done - CFLAGS="$old_CFLAGS" + LIBS="$old_LIBS" fi -if test "x$smart_include" = "x"; then +if test "x$smart_lib" = "x"; then + LIBS="-lhiredis $old_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - - #include +extern char redisConnect(); int main () { - int a = 1; + redisConnect() ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - smart_include=" " -else - smart_include= +if ac_fn_c_try_link "$LINENO"; then : + smart_lib="-lhiredis" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$old_LIBS" fi -if test "x$smart_include" = "x"; then +if test "x$smart_lib" = "x"; then if test "x$LOCATE" != "x"; then DIRS= - file=hiredis.h + file=libhiredis${libltdl_cv_shlibext} for x in `${LOCATE} $file 2>/dev/null`; do base=`echo $x | sed "s%/${file}%%"` @@ -2875,58 +2849,84 @@ if test "x$LOCATE" != "x"; then continue fi - already=`echo \$smart_include_dir ${DIRS} | ${GREP} ${dir}` + already=`echo \$smart_lib_dir ${DIRS} | ${GREP} ${dir}` if test "x$already" = "x"; then DIRS="$DIRS $dir" fi done fi -eval "smart_include_dir=\"\$smart_include_dir $DIRS\"" +eval "smart_lib_dir=\"\$smart_lib_dir $DIRS\"" - for try in $smart_include_dir /usr/local/include /opt/include; do - CFLAGS="$old_CFLAGS -I$try" + +if test "x$LOCATE" != "x"; then + DIRS= + file=libhiredis.a + + for x in `${LOCATE} $file 2>/dev/null`; do + base=`echo $x | sed "s%/${file}%%"` + if test "x$x" = "x$base"; then + continue; + fi + + dir=`${DIRNAME} $x 2>/dev/null` + exclude=`echo ${dir} | ${GREP} /home` + if test "x$exclude" != "x"; then + continue + fi + + already=`echo \$smart_lib_dir ${DIRS} | ${GREP} ${dir}` + if test "x$already" = "x"; then + DIRS="$DIRS $dir" + fi + done +fi + +eval "smart_lib_dir=\"\$smart_lib_dir $DIRS\"" + + + for try in $smart_lib_dir /usr/local/lib /opt/lib; do + LIBS="-L$try -lhiredis $old_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - - #include +extern char redisConnect(); int main () { - int a = 1; + redisConnect() ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - smart_include="-I$try" -else - smart_include= +if ac_fn_c_try_link "$LINENO"; then : + smart_lib="-L$try -lhiredis" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "x$smart_include" != "x"; then +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "x$smart_lib" != "x"; then break; fi done - CFLAGS="$old_CFLAGS" + LIBS="$old_LIBS" fi -if test "x$smart_include" != "x"; then +if test "x$smart_lib" != "x"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - eval "ac_cv_header_$ac_safe=yes" - CFLAGS="$old_CFLAGS $smart_include" - SMART_CFLAGS="$SMART_CFLAGS $smart_include" + eval "ac_cv_lib_${sm_lib_safe}_${sm_func_safe}=yes" + LIBS="$smart_lib $old_LIBS" + SMART_LIBS="$smart_lib $SMART_LIBS" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_cv_header_hiredis_h" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: hiredis headers not found. Use --with-redis-include-dir=." >&5 -$as_echo "$as_me: WARNING: hiredis headers not found. Use --with-redis-include-dir=." >&2;} - fail="$fail hiredis.h" + if test "x$ac_cv_lib_hiredis_redisConnect" != "xyes" + then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: hiredis libraries not found. Use --with-redis-lib-dir=." >&5 +$as_echo "$as_me: WARNING: hiredis libraries not found. Use --with-redis-lib-dir=." >&2;} + fail="$fail libhiredis" fi targetname=rlm_redis diff --git a/src/modules/rlm_redis/configure.in b/src/modules/rlm_redis/configure.in index c513d97..18fb504 100644 --- a/src/modules/rlm_redis/configure.in +++ b/src/modules/rlm_redis/configure.in @@ -67,6 +67,17 @@ if test x$with_[]modname != xno; then AC_PROG_CC dnl ############################################################ + dnl # Check for header files + dnl ############################################################ + + smart_try_dir="${redis_include_dir}" + FR_SMART_CHECK_INCLUDE([hiredis/hiredis.h]) + if test "x$ac_cv_header_hiredis_hiredis_h" != "xyes"; then + AC_MSG_WARN([hiredis headers not found. Use --with-redis-include-dir=.]) + fail="$fail hiredis.h" + fi + + dnl ############################################################ dnl # Check for libraries dnl ############################################################ @@ -78,17 +89,6 @@ if test x$with_[]modname != xno; then fail="$fail libhiredis" fi - dnl ############################################################ - dnl # Check for header files - dnl ############################################################ - - smart_try_dir="$redis_include_dir" - FR_SMART_CHECK_INCLUDE(hiredis.h) - if test "x$ac_cv_header_hiredis_h" != "xyes"; then - AC_MSG_WARN([hiredis headers not found. Use --with-redis-include-dir=.]) - fail="$fail hiredis.h" - fi - targetname=modname else targetname= diff --git a/src/modules/rlm_rediswho/configure b/src/modules/rlm_rediswho/configure index ee8894a..905f92e 100755 --- a/src/modules/rlm_rediswho/configure +++ b/src/modules/rlm_rediswho/configure @@ -2636,99 +2636,73 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu - smart_try_dir="$redis_lib_dir" + smart_try_dir="${redis_include_dir}" -sm_lib_safe=`echo "hiredis" | sed 'y%./+-%__p_%'` -sm_func_safe=`echo "redisConnect" | sed 'y%./+-%__p_%'` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for redisConnect in -lhiredis" >&5 -$as_echo_n "checking for redisConnect in -lhiredis... " >&6; } +ac_safe=`echo "hiredis/hiredis.h" | sed 'y%./+-%__pm%'` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hiredis/hiredis.h" >&5 +$as_echo_n "checking for hiredis/hiredis.h... " >&6; } -old_LIBS="$LIBS" -smart_lib= -smart_lib_dir= +old_CFLAGS="$CFLAGS" +smart_include= +smart_include_dir= if test "x$smart_try_dir" != "x"; then for try in $smart_try_dir; do - LIBS="-L$try -lhiredis $old_LIBS" + CFLAGS="$old_CFLAGS -I$try" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern char redisConnect(); + + #include int main () { - redisConnect() + int a = 1; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - smart_lib="-L$try -lhiredis" +if ac_fn_c_try_compile "$LINENO"; then : + smart_include="-I$try" +else + smart_include= fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "x$smart_lib" != "x"; then +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "x$smart_include" != "x"; then break; fi done - LIBS="$old_LIBS" + CFLAGS="$old_CFLAGS" fi -if test "x$smart_lib" = "x"; then - LIBS="-lhiredis $old_LIBS" +if test "x$smart_include" = "x"; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern char redisConnect(); + + #include int main () { - redisConnect() + int a = 1; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - smart_lib="-lhiredis" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$old_LIBS" +if ac_fn_c_try_compile "$LINENO"; then : + smart_include=" " +else + smart_include= fi - -if test "x$smart_lib" = "x"; then - - -if test "x$LOCATE" != "x"; then - DIRS= - file=libhiredis${libltdl_cv_shlibext} - - for x in `${LOCATE} $file 2>/dev/null`; do - base=`echo $x | sed "s%/${file}%%"` - if test "x$x" = "x$base"; then - continue; - fi - - dir=`${DIRNAME} $x 2>/dev/null` - exclude=`echo ${dir} | ${GREP} /home` - if test "x$exclude" != "x"; then - continue - fi - - already=`echo \$smart_lib_dir ${DIRS} | ${GREP} ${dir}` - if test "x$already" = "x"; then - DIRS="$DIRS $dir" - fi - done +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -eval "smart_lib_dir=\"\$smart_lib_dir $DIRS\"" - +if test "x$smart_include" = "x"; then if test "x$LOCATE" != "x"; then DIRS= - file=libhiredis.a + file=hiredis/hiredis.h for x in `${LOCATE} $file 2>/dev/null`; do base=`echo $x | sed "s%/${file}%%"` @@ -2742,126 +2716,126 @@ if test "x$LOCATE" != "x"; then continue fi - already=`echo \$smart_lib_dir ${DIRS} | ${GREP} ${dir}` + already=`echo \$smart_include_dir ${DIRS} | ${GREP} ${dir}` if test "x$already" = "x"; then DIRS="$DIRS $dir" fi done fi -eval "smart_lib_dir=\"\$smart_lib_dir $DIRS\"" +eval "smart_include_dir=\"\$smart_include_dir $DIRS\"" - for try in $smart_lib_dir /usr/local/lib /opt/lib; do - LIBS="-L$try -lhiredis $old_LIBS" + for try in $smart_include_dir /usr/local/include /opt/include; do + CFLAGS="$old_CFLAGS -I$try" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern char redisConnect(); + + #include int main () { - redisConnect() + int a = 1; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - smart_lib="-L$try -lhiredis" +if ac_fn_c_try_compile "$LINENO"; then : + smart_include="-I$try" +else + smart_include= fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "x$smart_lib" != "x"; then +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "x$smart_include" != "x"; then break; fi done - LIBS="$old_LIBS" + CFLAGS="$old_CFLAGS" fi -if test "x$smart_lib" != "x"; then +if test "x$smart_include" != "x"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - eval "ac_cv_lib_${sm_lib_safe}_${sm_func_safe}=yes" - LIBS="$smart_lib $old_LIBS" - SMART_LIBS="$smart_lib $SMART_LIBS" + eval "ac_cv_header_$ac_safe=yes" + CFLAGS="$old_CFLAGS $smart_include" + SMART_CFLAGS="$SMART_CFLAGS $smart_include" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_cv_lib_hiredis_redisConnect" != "xyes" - then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: hiredis libraries not found. Use --with-redis-lib-dir=." >&5 -$as_echo "$as_me: WARNING: hiredis libraries not found. Use --with-redis-lib-dir=." >&2;} - fail="$fail libhiredis" + if test "x$ac_cv_header_hiredis_hiredis_h" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: hiredis headers not found. Use --with-redis-include-dir=." >&5 +$as_echo "$as_me: WARNING: hiredis headers not found. Use --with-redis-include-dir=." >&2;} + fail="$fail hiredis.h" fi - smart_try_dir="$redis_include_dir" + smart_try_dir="$redis_lib_dir" -ac_safe=`echo "hiredis.h" | sed 'y%./+-%__pm%'` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hiredis.h" >&5 -$as_echo_n "checking for hiredis.h... " >&6; } +sm_lib_safe=`echo "hiredis" | sed 'y%./+-%__p_%'` +sm_func_safe=`echo "redisConnect" | sed 'y%./+-%__p_%'` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for redisConnect in -lhiredis" >&5 +$as_echo_n "checking for redisConnect in -lhiredis... " >&6; } -old_CFLAGS="$CFLAGS" -smart_include= -smart_include_dir= +old_LIBS="$LIBS" +smart_lib= +smart_lib_dir= if test "x$smart_try_dir" != "x"; then for try in $smart_try_dir; do - CFLAGS="$old_CFLAGS -I$try" + LIBS="-L$try -lhiredis $old_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - - #include +extern char redisConnect(); int main () { - int a = 1; + redisConnect() ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - smart_include="-I$try" -else - smart_include= +if ac_fn_c_try_link "$LINENO"; then : + smart_lib="-L$try -lhiredis" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "x$smart_include" != "x"; then +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "x$smart_lib" != "x"; then break; fi done - CFLAGS="$old_CFLAGS" + LIBS="$old_LIBS" fi -if test "x$smart_include" = "x"; then +if test "x$smart_lib" = "x"; then + LIBS="-lhiredis $old_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - - #include +extern char redisConnect(); int main () { - int a = 1; + redisConnect() ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - smart_include=" " -else - smart_include= +if ac_fn_c_try_link "$LINENO"; then : + smart_lib="-lhiredis" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$old_LIBS" fi -if test "x$smart_include" = "x"; then +if test "x$smart_lib" = "x"; then if test "x$LOCATE" != "x"; then DIRS= - file=hiredis.h + file=libhiredis${libltdl_cv_shlibext} for x in `${LOCATE} $file 2>/dev/null`; do base=`echo $x | sed "s%/${file}%%"` @@ -2875,58 +2849,84 @@ if test "x$LOCATE" != "x"; then continue fi - already=`echo \$smart_include_dir ${DIRS} | ${GREP} ${dir}` + already=`echo \$smart_lib_dir ${DIRS} | ${GREP} ${dir}` if test "x$already" = "x"; then DIRS="$DIRS $dir" fi done fi -eval "smart_include_dir=\"\$smart_include_dir $DIRS\"" +eval "smart_lib_dir=\"\$smart_lib_dir $DIRS\"" - for try in $smart_include_dir /usr/local/include /opt/include; do - CFLAGS="$old_CFLAGS -I$try" + +if test "x$LOCATE" != "x"; then + DIRS= + file=libhiredis.a + + for x in `${LOCATE} $file 2>/dev/null`; do + base=`echo $x | sed "s%/${file}%%"` + if test "x$x" = "x$base"; then + continue; + fi + + dir=`${DIRNAME} $x 2>/dev/null` + exclude=`echo ${dir} | ${GREP} /home` + if test "x$exclude" != "x"; then + continue + fi + + already=`echo \$smart_lib_dir ${DIRS} | ${GREP} ${dir}` + if test "x$already" = "x"; then + DIRS="$DIRS $dir" + fi + done +fi + +eval "smart_lib_dir=\"\$smart_lib_dir $DIRS\"" + + + for try in $smart_lib_dir /usr/local/lib /opt/lib; do + LIBS="-L$try -lhiredis $old_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - - #include +extern char redisConnect(); int main () { - int a = 1; + redisConnect() ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - smart_include="-I$try" -else - smart_include= +if ac_fn_c_try_link "$LINENO"; then : + smart_lib="-L$try -lhiredis" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "x$smart_include" != "x"; then +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "x$smart_lib" != "x"; then break; fi done - CFLAGS="$old_CFLAGS" + LIBS="$old_LIBS" fi -if test "x$smart_include" != "x"; then +if test "x$smart_lib" != "x"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - eval "ac_cv_header_$ac_safe=yes" - CFLAGS="$old_CFLAGS $smart_include" - SMART_CFLAGS="$SMART_CFLAGS $smart_include" + eval "ac_cv_lib_${sm_lib_safe}_${sm_func_safe}=yes" + LIBS="$smart_lib $old_LIBS" + SMART_LIBS="$smart_lib $SMART_LIBS" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_cv_header_hiredis_h" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: hiredis headers not found. Use --with-redis-include-dir=." >&5 -$as_echo "$as_me: WARNING: hiredis headers not found. Use --with-redis-include-dir=." >&2;} - fail="$fail hiredis.h" + if test "x$ac_cv_lib_hiredis_redisConnect" != "xyes" + then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: hiredis libraries not found. Use --with-redis-lib-dir=." >&5 +$as_echo "$as_me: WARNING: hiredis libraries not found. Use --with-redis-lib-dir=." >&2;} + fail="$fail libhiredis" fi targetname=rlm_rediswho diff --git a/src/modules/rlm_rediswho/configure.in b/src/modules/rlm_rediswho/configure.in index 0e7fd8a..1f64c81 100644 --- a/src/modules/rlm_rediswho/configure.in +++ b/src/modules/rlm_rediswho/configure.in @@ -67,6 +67,17 @@ if test x$with_[]modname != xno; then AC_PROG_CC dnl ############################################################ + dnl # Check for header files + dnl ############################################################ + + smart_try_dir="${redis_include_dir}" + FR_SMART_CHECK_INCLUDE([hiredis/hiredis.h]) + if test "x$ac_cv_header_hiredis_hiredis_h" != "xyes"; then + AC_MSG_WARN([hiredis headers not found. Use --with-redis-include-dir=.]) + fail="$fail hiredis.h" + fi + + dnl ############################################################ dnl # Check for libraries dnl ############################################################ @@ -78,17 +89,6 @@ if test x$with_[]modname != xno; then fail="$fail libhiredis" fi - dnl ############################################################ - dnl # Check for header files - dnl ############################################################ - - smart_try_dir="$redis_include_dir" - FR_SMART_CHECK_INCLUDE(hiredis.h) - if test "x$ac_cv_header_hiredis_h" != "xyes"; then - AC_MSG_WARN([hiredis headers not found. Use --with-redis-include-dir=.]) - fail="$fail hiredis.h" - fi - targetname=modname else targetname=