diff --git a/include/cdio/Makefile.am b/include/cdio/Makefile.am index c7cf1655..90133e57 100644 --- a/include/cdio/Makefile.am +++ b/include/cdio/Makefile.am @@ -35,6 +35,7 @@ libcdioinclude_HEADERS = \ bytesex_asm.h \ cdio.h \ cdio_config.h \ + cdio_unconfig.h \ cd_types.h \ device.h \ disc.h \ diff --git a/include/cdio/cdio_unconfig.h b/include/cdio/cdio_unconfig.h new file mode 100644 index 00000000..8f7d944c --- /dev/null +++ b/include/cdio/cdio_unconfig.h @@ -0,0 +1,116 @@ +/* You can include this to remove any C preprocessor symbols created in cdio_config.h. + For example, if your project has your own config.h which sets symbols do this: + + // for cdio: + #include + #include + // for your program + #include +*/ +#undef EMPTY_ARRAY_SIZE +#undef HAVE_BZERO +#undef HAVE_CDDB +#undef HAVE_CHDIR +#undef HAVE_CURSES_H +#undef HAVE_DAYLIGHT +#undef HAVE_DLFCN_H +#undef HAVE_DRAND48 +#undef HAVE_ERRNO_H +#undef HAVE_FCNTL_H +#undef HAVE_FTRUNCATE +#undef HAVE_GETEUID +#undef HAVE_GETGID +#undef HAVE_GETOPT_H +#undef HAVE_GETPWUID +#undef HAVE_GETTIMEOFDAY +#undef HAVE_GETUID +#undef HAVE_GLOB_H +#undef HAVE_GMTIME_R +#undef HAVE_ICONV +#undef HAVE_INTTYPES_H +#undef HAVE_ISOC99_PRAGMA +#undef HAVE_JOLIET +#undef HAVE_KEYPAD +#undef HAVE_LANGINFO_CODESET +#undef HAVE_LIMITS_H +#undef HAVE_LINUX_CDROM +#undef HAVE_LINUX_CDROM_H +#undef HAVE_LINUX_MAJOR_H +#undef HAVE_LINUX_VERSION_H +#undef HAVE_LOCALTIME_R +#undef HAVE_LSTAT +#undef HAVE_MEMCPY +#undef HAVE_MEMORY_H +#undef HAVE_MEMSET +#undef HAVE_NCURSES_H +#undef HAVE_PWD_H +#undef HAVE_RAND +#undef HAVE_READLINK +#undef HAVE_REALPATH +#undef HAVE_ROCK +#undef HAVE_SETEGID +#undef HAVE_SETENV +#undef HAVE_SETEUID +#undef HAVE_SLEEP +#undef HAVE_SNPRINTF +#undef HAVE_SOLARIS_CDROM +#undef HAVE_STDARG_H +#undef HAVE_STDBOOL_H +#undef HAVE_STDINT_H +#undef HAVE_STDIO_H +#undef HAVE_STDLIB_H +#undef HAVE_STRINGS_H +#undef HAVE_STRING_H +#undef HAVE_STRUCT_TIMESPEC +#undef HAVE_SYS_CDIO_H +#undef HAVE_SYS_PARAM_H +#undef HAVE_SYS_STAT_H +#undef HAVE_SYS_TIMEB_H +#undef HAVE_SYS_TIME_H +#undef HAVE_SYS_TYPES_H +#undef HAVE_SYS_UTSNAME_H +#undef HAVE_S_ISLNK +#undef HAVE_S_ISSOCK +#undef HAVE_TIMEGM +#undef HAVE_TIMEZONE_VAR +#undef HAVE_TM_GMTOFF +#undef HAVE_TZNAME +#undef HAVE_TZSET +#undef HAVE_UNISTD_H +#undef HAVE_UNSETENV +#undef HAVE_USLEEP +#undef HAVE_VCDINFO +#undef HAVE_VSNPRINTF +#undef HAVE_WIN32_CDROM +#undef HAVE_WINDOWS_H +#undef ICONV_CONST +#undef LIBCDIO_CONFIG_H +#undef LIBCDIO_SOURCE_PATH +#undef LT_OBJDIR +#undef MINGW32 +#undef NEED_TIMEZONEVAR +#undef NO_MINUS_C_MINUS_O +#undef PACKAGE +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_URL +#undef PACKAGE_VERSION +#undef STDC_HEADERS +#undef _ALL_SOURCE +#undef _GNU_SOURCE +#undef _POSIX_PTHREAD_SEMANTICS +#undef _TANDEM_SOURCE +#undef __EXTENSIONS__ +#undef VERSION +#undef AC_APPLE_UNIVERSAL_BUILD +#undef __BIG_ENDIAN__ +#undef WORDS_BIGENDIAN +#undef _FILE_OFFSET_BITS +#undef _LARGEFILE_SOURCE +#undef _LARGE_FILES +#undef _MINIX +#undef _POSIX_1_SOURCE +#undef _POSIX_SOURCE +#undef const diff --git a/test/.gitignore b/test/.gitignore index 889fc09d..0f1af53f 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -6,12 +6,12 @@ /.libs /Makefile /Makefile.in -/cdda.bin /cdda-1.raw /cdda-2.raw /cdda-good.raw /cdda-jitter.raw /cdda-underrun.raw +/cdda.bin /check_common_fn /check_cue.sh /check_iso.sh @@ -40,3 +40,4 @@ /testpregap.c /testsolaris /testtoc +/testunconfig diff --git a/test/Makefile.am b/test/Makefile.am index 6149d2e9..b7596ba1 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -30,7 +30,7 @@ endif hack = check_sizeof testassert testgetdevices testischar \ testisocd testisocd2 testiso9660 test_lib_driver_util \ - $(testparanoia) testpregap + $(testparanoia) testpregap testunconfig EXTRA_PROGRAMS = testdefault DATA_DIR = @abs_top_srcdir@/test/data @@ -45,8 +45,10 @@ testgetdevices_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) testischar_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV) testiso9660_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV) -testisocd_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV) -testisocd2_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV) +testisocd_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV) +testisocd2_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV) + +testunconfig_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) test_lib_driver_util_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) test_lib_driver_util_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\" diff --git a/test/testunconfig.c b/test/testunconfig.c new file mode 100644 index 00000000..86b96289 --- /dev/null +++ b/test/testunconfig.c @@ -0,0 +1,46 @@ +/* + Copyright (C) 2011 Rocky Bernstein + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/* + Regression test config.h and cdio_unconfig + and cdio_free_device_list() +*/ +#include "config.h" +#define __CDIO_CONFIG_H__ 1 + +#include "cdio/cdio_config.h" /* should do nothing */ +#include "cdio/cdio.h" + +#include + +int +main(int argc, const char *argv[]) +{ + +#ifndef PACKAGE + printf("config.h should have set PACKAGE preprocessor symbol\n"); +#endif + +#include "cdio/cdio_unconfig.h" + +#ifdef PACKAGE + printf("cdio_unconfig should have removed PACKAGE preprocessor symbol\n"); + return 2; +#else + return 0; +#endif +}