##################################################################### # Standard routine for finding $$package # # source: $$filename ##################################################################### if test x$enabled_$$package_esc = xyes then if test x$found_$$package_esc = xno then found=1 for file in $$headers{$$package} do AC_CHECK_HEADER($subdir$file,[filefound=1],[filefound=0]) AC_MSG_CHECKING([$file for $$package in standard locations]) if test $filefound = 1 then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) found=0 fi done if test $found = 0 then if test x$$header_dir{$$package} != x then found=1 for file in $$headers{$$package} do AC_CHECK_HEADER($$header_dir{$$package}/$file,[filefound=1],[filefound=0]) AC_MSG_CHECKING([$file for $$package in directory $$header_dir{$$package} in standard locations]) if test $filefound = 1 then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) found=0 fi done if test $found = 1 then include_dirs_$$package_esc="$$header_dir{$$package}" echo $include_dirs_$$package_esc fi fi fi AC_MSG_CHECKING([[$$package header(s) found in standard locations]]) if test $found = 1 then AC_MSG_RESULT([yes]) if test x"$$libs{$$package}" != x then LIBS= old_CXXFLAGS=$CXXFLAGS old_LDFLAGS=$LDFLAGS for tmp in $include_dirs_$$package_esc do CXXFLAGS="$CXXFLAGS -I$tmp" done for tmp in $lib_dirs_$$package_esc do LDFLAGS="$LDFLAGS -L$tmp" done AC_MSG_CHECKING([libraries needed for $$package]) AC_COMPILE_IFELSE( [ AC_LANG_SOURCE( [[ $$source{$$package} ]] )],[ links_ok=0 tmp_libs="" sep="" for tmp in $$libs{$$package} do LDFLAGS="$LDFLAGS -l$tmp" tmp_libs="$tmp_libs$sep$tmp" sep=" " AC_LINK_IFELSE( [ AC_LANG_SOURCE( [[ $$source{$$package}; ]]) ],[ links_ok=yes ],[ ] ) if test x$links_ok = xyes; then break 2 fi done if test x$links_ok = xyes; then libs_$$package_esc=$tmp_libs found_$$package_esc=yes AC_MSG_RESULT([$libs_$$package_esc]) else # trying alternative libs LDFLAGS=$old_LDFLAGS tmp_libs="" sep="" for tmp in $$alt_libs{$$package} do LDFLAGS="$LDFLAGS -l$tmp" tmp_libs="$tmp_libs$sep$tmp" sep=" " AC_LINK_IFELSE( [ AC_LANG_SOURCE( [[ $$source{$$package}; ]]) ],[ links_ok=yes ],[ ] ) if test x$links_ok = xyes; then break 2 fi done if test x$links_ok = xyes; then libs_$$package_esc=$tmp_libs found_$$package_esc=yes AC_MSG_RESULT([$libs_$$package_esc]) else AC_MSG_RESULT([linking failed]) fi fi ],[ AC_MSG_RESULT([compilation failed]) ]) CXXFLAGS=$old_CXXFLAGS LDFLAGS=$old_LDFLAGS else # no libs to checks found_$$package_esc=yes fi else AC_MSG_RESULT([no]) found_$$package_esc=no fi fi fi