diff --git a/configure b/configure index bf739178a..5be40d06b 100755 --- a/configure +++ b/configure @@ -231,7 +231,7 @@ int main() EOF if runcmd $CC -o testconf testconf.c then - CFLAGS="$CFLAGS -DHAVE_LIBGEN" + CFLAGS="$CFLAGS -DHAVE_DIRNAME -DHAVE_BASENAME" fi rm -f testconf* } diff --git a/configure.ac b/configure.ac index 6a711fad1..ecd4ac2ad 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ AC_PROG_CC AC_PROG_CXX AC_HEADER_STDC AC_HEADER_TIME -AC_CHECK_FUNCS([lrintf strlcpy strlcat daemon]) +AC_CHECK_FUNCS([lrintf strlcpy strlcat daemon dirname basename]) AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_RANLIB @@ -33,7 +33,6 @@ ALL_LINGUAS="bg es fi fr it pl ro ru sv" AM_GLIB_GNU_GETTEXT transmissionlocaledir='${prefix}/${DATADIRNAME}/locale' -AC_CHECK_LIB([gen],[basename]) AC_CHECK_LIB([crypto],[CRYPTO_new_ex_data]) AC_CHECK_LIB([ssl],[SSL_library_init]) AC_SEARCH_LIBS([socket], [socket net]) diff --git a/libtransmission/basename.c b/libtransmission/basename.c index 21d4bceb7..c092dd342 100644 --- a/libtransmission/basename.c +++ b/libtransmission/basename.c @@ -17,7 +17,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifndef HAVE_LIBGEN +#ifndef HAVE_BASENAME #include #include @@ -64,4 +64,4 @@ basename(const char *path) return (bname); } -#endif /* HAVE_LIBGEN */ +#endif /* HAVE_BASENAME */ diff --git a/libtransmission/dirname.c b/libtransmission/dirname.c index 42a566b08..687ea8723 100644 --- a/libtransmission/dirname.c +++ b/libtransmission/dirname.c @@ -17,7 +17,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifndef HAVE_LIBGEN +#ifndef HAVE_DIRNAME #include #include @@ -68,4 +68,4 @@ dirname(const char *path) return (dname); } -#endif /* HAVE_LIBGEN */ +#endif /* HAVE_DIRNAME */ diff --git a/libtransmission/trcompat.h b/libtransmission/trcompat.h index ddcd4c9f8..b932fcafe 100644 --- a/libtransmission/trcompat.h +++ b/libtransmission/trcompat.h @@ -42,13 +42,14 @@ int asprintf( char **, const char *, ... ); int vasprintf( char **, const char *, va_list ); #endif -#ifdef HAVE_LIBGEN -# include -#else -char * -dirname(const char *path); -char * -basename(const char *path); +#if defined(HAVE_DIRNAME) || defined(HAVE_BASENAME) + #include +#endif +#ifndef HAVE_DIRNAME + char* dirname(const char *path); +#endif +#ifndef HAVE_BASENAME + char* basename(const char *path); #endif #endif /* TRCOMPAT_H */