Add an include to remove any C Preprocessor symbol libcdio's config.h creates. Programs using

libcdio can do this:

// for cdio:

// for your program
This commit is contained in:
R. Bernstein
2011-10-20 20:32:20 -04:00
parent f215cad224
commit 958476abf4
5 changed files with 170 additions and 4 deletions

View File

@@ -35,6 +35,7 @@ libcdioinclude_HEADERS = \
bytesex_asm.h \
cdio.h \
cdio_config.h \
cdio_unconfig.h \
cd_types.h \
device.h \
disc.h \

View File

@@ -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 <cdio.h>
#include <cdio_unconfig.h>
// for your program
#include <config.h>
*/
#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

3
test/.gitignore vendored
View File

@@ -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

View File

@@ -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)\"

46
test/testunconfig.c Normal file
View File

@@ -0,0 +1,46 @@
/*
Copyright (C) 2011 Rocky Bernstein <rocky@gnu.org>
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 <http://www.gnu.org/licenses/>.
*/
/*
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 <stdio.h>
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
}