Possibly make compiling example programs easier from the outside - don't assume HAVE_CONFIG_H is defined but pick up values from the runtime version of that file. We also now run example programs as tests if they are built.

This commit is contained in:
R. Bernstein
2009-11-26 05:31:39 -05:00
parent 9bec7fc204
commit 35663d6266
42 changed files with 77 additions and 249 deletions

View File

@@ -1,6 +1,4 @@
# $Id: Makefile.am,v 1.13 2008/08/31 13:38:21 flameeyes Exp $
#
# Copyright (C) 2005, 2006, 2008 Rocky Bernstein <rocky@gnu.org>
# Copyright (C) 2005, 2006, 2008, 2009 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
@@ -67,3 +65,6 @@ mmc2_LDADD = $(LIBCDIOPP_LIBS) $(LIBCDIO_LIBS)
tracks_SOURCES = tracks.cpp
tracks_LDADD = $(LIBCDIOPP_LIBS) $(LIBCDIO_LIBS)
check_PROGRAMS = $(noinst_PROGRAMS)
TESTS = $(check_PROGRAMS)

View File

@@ -1,7 +1,7 @@
/*
$Id: cdtext.cpp,v 1.4 2008/03/24 15:30:57 karl Exp $
Copyright (C) 2005, 2008 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2005, 2008, 2009 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
@@ -22,6 +22,7 @@
See also corresponding C program of a similar name.
*/
#include <cdio++/cdio.hpp>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
@@ -34,7 +35,6 @@
#include <sys/types.h>
#endif
#include <cdio++/cdio.hpp>
/* Set up a CD-DA image to test on which is in the libcdio distribution. */
#define CDDA_IMAGE_PATH "../../../test/"

View File

@@ -1,7 +1,7 @@
/*
$Id: device.cpp,v 1.4 2008/03/24 15:30:57 karl Exp $
Copyright (C) 2005, 2008 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2005, 2008, 2009 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
@@ -21,9 +21,8 @@
CD-ROM drive is. See also corresponding C program of a similar
name. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <cdio++/cdio.hpp>
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
@@ -34,8 +33,6 @@
#include <sys/types.h>
#endif
#include <cdio++/cdio.hpp>
#define _(x) x
/* Prints out drive capabilities */

View File

@@ -1,7 +1,5 @@
/*
$Id: drives.cpp,v 1.6 2008/03/24 15:30:57 karl Exp $
Copyright (C) 2003, 2004, 2006, 2008 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2003, 2004, 2006, 2008, 2009 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
@@ -19,9 +17,10 @@
/* Simple program to show drivers installed and what the default
CD-ROM drive is and what CD drives are available. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <cdio++/cdio.hpp>
#include <cdio/cd_types.h>
#include <cdio/logging.h>
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
@@ -31,9 +30,6 @@
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <cdio++/cdio.hpp>
#include <cdio/cd_types.h>
#include <cdio/logging.h>
static void
log_handler (cdio_log_level_t level, const char message[])

View File

@@ -24,10 +24,6 @@
See also corresponding C program of a similar name.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <cdio++/cdio.hpp>
#include <stdio.h>

View File

@@ -1,7 +1,5 @@
/*
$Id: iso4.cpp,v 1.2 2008/03/24 15:30:57 karl Exp $
Copyright (C) 2006, 2008 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2006, 2008, 2009 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
@@ -34,9 +32,6 @@
#define ISO9660_IMAGE_PATH "../../../"
#define ISO9660_IMAGE ISO9660_IMAGE_PATH "test/isofs-m1.cue"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <sys/types.h>
#include <cdio++/iso9660.hpp>

View File

@@ -1,7 +1,5 @@
/*
$Id: isofile.cpp,v 1.2 2008/03/24 15:30:57 karl Exp $
Copyright (C) 2006, 2008 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2006, 2008, 2009 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
@@ -31,15 +29,10 @@
#define LOCAL_FILENAME "copying"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "portable.h"
#include <sys/types.h>
#include <cdio++/iso9660.hpp>
#include "portable.h"
#include <stdio.h>
#ifdef HAVE_ERRNO_H

View File

@@ -1,7 +1,5 @@
/*
$Id: isofile2.cpp,v 1.2 2008/03/24 15:30:57 karl Exp $
Copyright (C) 2006, 2008 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2006, 2008, 2009 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
@@ -37,14 +35,9 @@
#define ISO9660_FILENAME "COPYING"
#define LOCAL_FILENAME "copying"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "portable.h"
#include <cdio++/cdio.hpp>
#include <cdio++/iso9660.hpp>
#include "portable.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>

View File

@@ -34,9 +34,6 @@
#define ISO9660_IMAGE_PATH "../../../"
#define ISO9660_IMAGE ISO9660_IMAGE_PATH "test/copying.iso"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <sys/types.h>
#include <cdio++/iso9660.hpp>

View File

@@ -1,7 +1,5 @@
/*
$Id: mmc1.cpp,v 1.2 2008/03/24 15:30:57 karl Exp $
Copyright (C) 2005, 2008 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2005, 2008, 2009 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
@@ -22,9 +20,7 @@
This basically the libdio mmc_get_hwinfo() routine.
See also corresponding C and non OO C++ program.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <cdio++/cdio.hpp>
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -32,7 +28,6 @@
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <cdio++/cdio.hpp>
/* Set how long to wait for MMC commands to complete */
#define DEFAULT_TIMEOUT_MS 10000

View File

@@ -1,7 +1,5 @@
/*
$Id: mmc2.cpp,v 1.2 2008/03/24 15:30:57 karl Exp $
Copyright (C) 2005, 2008 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2005, 2008, 2009 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

View File

@@ -1,7 +1,5 @@
/*
$Id: tracks.cpp,v 1.2 2008/03/24 15:30:57 karl Exp $
Copyright (C) 2005, 2008 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2005, 2008, 2009 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
@@ -19,14 +17,11 @@
/* Simple program to list track numbers and logical sector numbers of
a Compact Disc using libcdio. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <cdio++/cdio.hpp>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <cdio++/cdio.hpp>
int
main(int argc, const char *argv[])
{