diff --git a/libdirutils/Makefile.in b/libdirutils/Makefile.in index fe523f5..96d81fd 100644 --- a/libdirutils/Makefile.in +++ b/libdirutils/Makefile.in @@ -4,7 +4,7 @@ MANPAGE := libdirutils.3 OBJS := dirutils.o dirlist.o dirwalk.o HEADERS := kst LIBS := -TEST_LIBS := -L/usr/local/lib -lcunit +TEST_LIBS := -L/usr/local/lib OS_TEST_LIBS -lcunit PREFIX ?= $PREFIX MANDIR ?= $MANDIR diff --git a/libdirutils/config.sh b/libdirutils/config.sh index 0174c66..0f2c13b 100755 --- a/libdirutils/config.sh +++ b/libdirutils/config.sh @@ -13,6 +13,9 @@ OPSYS=$(uname -s) echo "Configuring for ${OPSYS}..." if [ "x${OPSYS}" = "xLinux" ]; then OS_CFLAGS="-D_DEFAULT_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE" +elif [ "x${OPSYS}" = "xDarwin" ]; then + OS_CFLAGS="-I/opt/homebrew/include" + OS_TEST_LIBS="-L/opt/homebrew/lib" else OS_CFLAGS="" fi @@ -43,7 +46,8 @@ echo "prefix: ${PREFIX}" echo "mandir: ${MANDIR}" echo "writing new Makefile" -cat Makefile.in | sed -e "s|OS_CFLAGS|${OS_CFLAGS}|" | \ +cat Makefile.in | sed -e "s|OS_CFLAGS|${OS_CFLAGS}|" | \ + sed -e "s|OS_TEST_LIBS|${OS_TEST_LIBS}|" | \ sed -e "s|\$PREFIX|${PREFIX}|" | \ sed -e "s|\$MANDIR|${MANDIR}|" > Makefile diff --git a/libdirutils/dirutils_test.c b/libdirutils/dirutils_test.c index 13eb48c..155ce88 100644 --- a/libdirutils/dirutils_test.c +++ b/libdirutils/dirutils_test.c @@ -46,6 +46,10 @@ test_exists(void) char testnot[] = "testdata/nosuchfile"; EXISTS_STATUS ftype; + + system("mkdir -p testdata/testdir"); + system("touch testdata/testfile"); + ftype = path_exists(testdir); CU_ASSERT(EXISTS_DIR == ftype); @@ -54,6 +58,9 @@ test_exists(void) ftype = path_exists(testnot); CU_ASSERT(EXISTS_NOENT == ftype); + + system("rm -r testdata/testdir"); + system("rm testdata/testfile"); } static void