Fixes for Mingw+MSYS and DLL support from Carlo Bramini

* configure.ac: Added AC_LIBTOOL_WIN32_DLL for enabling the creation of shared libraries.
* configure.ac: Added -I$(top_srcdir)/include to LIBCDIO_CFLAGS, it allows to build outside the source tree.
* configure.ac: Added LT_NO_UNDEFINED for adding '-no-undefined' switch to libtool when building win32 shared libraries.
* configure.ac: Check for Windows.h presence if under Mingw (included for using Sleep() function).
* configure.ac: Check for more missing functions: setenv(), unsetenv(), sleep(), gmtime_r(), localtime_r().

* example/cdchange.c: If sleep() function does not exist, it tries to emulate it with a similar code (require inclusion of Windows.h)

* src/cddb.c:
* lib/cdda_interface/scsi_interface.c: Compilation fails because u_int32_t is undefined. It has been changed to uint32_t to be compliant to all other parts of the libraries.
* lib/cdda_interface/Makefile.am:
* lib/iso9660/Makefile.am:
* lib/cdio++/Makefile.am:
* lib/paranoia/Makefile.am:
* lib/udf/Makefile.am:
* lib/driver/Makefile.am: added LT_NO_UNDEFINED to libtool flags.
* lib/iso9660/iso9660.c: Added replacements for setenv(), unsetenv(), gmtime_r\
(), localtime_r().
This commit is contained in:
rocky
2008-06-25 08:01:53 +00:00
parent 9c32ef00a0
commit 82c7c09a97
12 changed files with 98 additions and 24 deletions

3
THANKS
View File

@@ -1,6 +1,9 @@
Burkhard Plaum <plaum@ipf.uni-stuttgart.de> Burkhard Plaum <plaum@ipf.uni-stuttgart.de>
some GNU/Linux and CD-Text patches some GNU/Linux and CD-Text patches
Carlo Bramini
fixes for Mingw+MSYS and DLL support
Diego 'Flameeyes' Petten<65> Diego 'Flameeyes' Petten<65>
patches to FreeBSD and making Gentoo-friendly patches to FreeBSD and making Gentoo-friendly

View File

@@ -20,7 +20,7 @@ define(RELEASE_NUM, 81)
define(CDIO_VERSION_STR, 0.$1cvs) define(CDIO_VERSION_STR, 0.$1cvs)
AC_PREREQ(2.52) AC_PREREQ(2.52)
AC_REVISION([$Id: configure.ac,v 1.230 2008/06/19 13:41:40 flameeyes Exp $])dnl AC_REVISION([$Id: configure.ac,v 1.231 2008/06/25 08:01:53 rocky Exp $])dnl
AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM)) AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM))
AC_CONFIG_SRCDIR(src/cd-info.c) AC_CONFIG_SRCDIR(src/cd-info.c)
@@ -355,6 +355,9 @@ else
fi fi
dnl dnl
dnl Enable the creation of shared libraries under Win32.
AC_LIBTOOL_WIN32_DLL
dnl AM_PROG_LIBTOOL tests whether we have GNU ld dnl AM_PROG_LIBTOOL tests whether we have GNU ld
dnl this must come before checking --with-versioned-libs dnl this must come before checking --with-versioned-libs
dnl which requires GNU ld. dnl which requires GNU ld.
@@ -406,7 +409,7 @@ AM_CONDITIONAL(DISABLE_CPP, test "x$disable_cpp" = "xyes")
dnl Checks for header files. dnl Checks for header files.
LIBCDIO_CDDA_LIBS='$(top_builddir)/lib/cdda_interface/libcdio_cdda.la' LIBCDIO_CDDA_LIBS='$(top_builddir)/lib/cdda_interface/libcdio_cdda.la'
LIBCDIO_CFLAGS='-I$(top_srcdir)/lib/driver -I$(top_srcdir)/include/' LIBCDIO_CFLAGS='-I$(top_srcdir)/lib/driver -I$(top_builddir)/include -I$(top_srcdir)/include/'
LIBCDIO_LIBS='$(top_builddir)/lib/driver/libcdio.la' LIBCDIO_LIBS='$(top_builddir)/lib/driver/libcdio.la'
LIBCDIO_DEPS="$LIBCDIO_LIBS" LIBCDIO_DEPS="$LIBCDIO_LIBS"
LIBCDIOPP_LIBS='$(top_builddir)/lib/cdio++/libcdio++.la' LIBCDIOPP_LIBS='$(top_builddir)/lib/cdio++/libcdio++.la'
@@ -427,6 +430,9 @@ AC_SUBST(LIBCDIO_PARANOIA_LIBS)
AC_SUBST(LIBISO9660_LIBS) AC_SUBST(LIBISO9660_LIBS)
AC_SUBST(LIBUDF_LIBS) AC_SUBST(LIBUDF_LIBS)
dnl Libtool flag for strict linkage
LT_NO_UNDEFINED=
case $host_os in case $host_os in
aix*) aix*)
## Don't use AIX driver until starts to really work ## Don't use AIX driver until starts to really work
@@ -502,11 +508,13 @@ int has_timeout=sizeof(test.timeout);],
defined as a variable. In cygwin it is a function too]) defined as a variable. In cygwin it is a function too])
;; ;;
mingw*) mingw*)
AC_CHECK_HEADERS(windows.h)
AC_DEFINE([MINGW32], [1], AC_DEFINE([MINGW32], [1],
[Define 1 if you are compiling using MinGW]) [Define 1 if you are compiling using MinGW])
AC_DEFINE([HAVE_WIN32_CDROM], [1], AC_DEFINE([HAVE_WIN32_CDROM], [1],
[Define 1 if you have MinGW CD-ROM support]) [Define 1 if you have MinGW CD-ROM support])
LIBS="$LIBS -lwinmm -mwindows" LIBS="$LIBS -lwinmm -mwindows"
LT_NO_UNDEFINED="-no-undefined"
cd_drivers="${cd_drivers}, MinGW " cd_drivers="${cd_drivers}, MinGW "
;; ;;
freebsd4.*|freebsd5.*|freebsd6*|freebsd7*|dragonfly*|kfreebsd*) freebsd4.*|freebsd5.*|freebsd6*|freebsd7*|dragonfly*|kfreebsd*)
@@ -527,6 +535,8 @@ int has_timeout=sizeof(test.timeout);],
;; ;;
esac esac
AC_SUBST(LT_NO_UNDEFINED)
AC_MSG_CHECKING(extern long timezone variable) AC_MSG_CHECKING(extern long timezone variable)
AC_LINK_IFELSE([ AC_LINK_IFELSE([
#ifdef NEED_TIMEZONEVAR #ifdef NEED_TIMEZONEVAR
@@ -561,7 +571,8 @@ AC_SUBST(LIBCDIO_SOURCE_PATH)
AC_CHECK_FUNCS( [bzero drand48 ftruncate geteuid getgid \ AC_CHECK_FUNCS( [bzero drand48 ftruncate geteuid getgid \
getuid getpwuid gettimeofday lstat memcpy memset \ getuid getpwuid gettimeofday lstat memcpy memset \
rand seteuid setegid snprintf tzset vsnprintf readlink] ) rand seteuid setegid snprintf setenv unsetenv tzset \
sleep vsnprintf readlink gmtime_r localtime_r] )
# check for timegm() support # check for timegm() support
AC_CHECK_FUNC(timegm, AC_DEFINE(HAVE_TIMEGM,1, AC_CHECK_FUNC(timegm, AC_DEFINE(HAVE_TIMEGM,1,

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cdchange.c,v 1.8 2008/03/24 15:30:55 karl Exp $ $Id: cdchange.c,v 1.9 2008/06/25 08:01:53 rocky Exp $
Copyright (C) 2005, 2006, 2007, 2008 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2005, 2006, 2007, 2008 Rocky Bernstein <rocky@gnu.org>
@@ -39,6 +39,22 @@
# include <errno.h> # include <errno.h>
#endif #endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#ifndef HAVE_SLEEP
static void
sleep(unsigned int ms)
{
#if defined(_WIN32)
Sleep(ms);
#else
#error sleep() unimplemented
#endif
}
#endif
#include <cdio/cdio.h> #include <cdio/cdio.h>
int int
main(int argc, const char *argv[]) main(int argc, const char *argv[])

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.am,v 1.14 2008/06/13 19:26:22 flameeyes Exp $ # $Id: Makefile.am,v 1.15 2008/06/25 08:01:53 rocky Exp $
# #
# Copyright (C) 2004, 2005, 2006, 2007, 2008 Rocky Bernstein <rocky@gnu.org> # Copyright (C) 2004, 2005, 2006, 2007, 2008 Rocky Bernstein <rocky@gnu.org>
# #
@@ -57,7 +57,7 @@ libcdio_cdda_sources = common_interface.c cddap_interface.c interface.c \
lib_LTLIBRARIES = libcdio_cdda.la lib_LTLIBRARIES = libcdio_cdda.la
libcdio_cdda_la_SOURCES = $(libcdio_cdda_sources) libcdio_cdda_la_SOURCES = $(libcdio_cdda_sources)
libcdio_cdda_la_ldflags = -version-info $(libcdio_cdda_la_CURRENT):$(libcdio_cdda_la_REVISION):$(libcdio_cdda_la_AGE) libcdio_cdda_la_ldflags = -version-info $(libcdio_cdda_la_CURRENT):$(libcdio_cdda_la_REVISION):$(libcdio_cdda_la_AGE) @LT_NO_UNDEFINED@
INCLUDES = $(LIBCDIO_CFLAGS) INCLUDES = $(LIBCDIO_CFLAGS)

View File

@@ -1,5 +1,5 @@
/* /*
$Id: scsi_interface.c,v 1.4 2008/06/13 19:26:23 flameeyes Exp $ $Id: scsi_interface.c,v 1.5 2008/06/25 08:01:53 rocky Exp $
Copyright (C) 2004, 2008 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2004, 2008 Rocky Bernstein <rocky@gnu.org>
Original interface.c Copyright (C) 1994-1997 Original interface.c Copyright (C) 1994-1997
@@ -575,7 +575,7 @@ scsi_read_toc (cdrom_drive_t *d)
static int static int
scsi_read_toc2 (cdrom_drive_t *d) scsi_read_toc2 (cdrom_drive_t *d)
{ {
u_int32_t foo,bar; uint32_t foo,bar;
int i; int i;
track_t i_tracks; track_t i_tracks;

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.am,v 1.8 2008/03/20 19:02:38 karl Exp $ # $Id: Makefile.am,v 1.9 2008/06/25 08:01:54 rocky Exp $
# #
# Copyright (C) 2005, 2006, 2007, 2008 Rocky Bernstein <rocky@gnu.org> # Copyright (C) 2005, 2006, 2007, 2008 Rocky Bernstein <rocky@gnu.org>
# #
@@ -50,7 +50,7 @@ libcdiopp_la_AGE = 0
libcdiopp_sources = cdio.cpp devices.cpp libcdiopp_sources = cdio.cpp devices.cpp
libcdio___la_SOURCES = $(libcdiopp_sources) libcdio___la_SOURCES = $(libcdiopp_sources)
libcdio___la_ldflags = -version-info $(libcdiopp_la_CURRENT):$(libcdiopp_la_REVISION):$(libcdiopp_la_AGE) libcdio___la_ldflags = -version-info $(libcdiopp_la_CURRENT):$(libcdiopp_la_REVISION):$(libcdiopp_la_AGE) @LT_NO_UNDEFINED@
libiso9660pp_la_CURRENT = 0 libiso9660pp_la_CURRENT = 0
libiso9660pp_la_REVISION = 0 libiso9660pp_la_REVISION = 0
@@ -59,6 +59,6 @@ libiso9660pp_la_AGE = 0
libiso9660pp_sources = iso9660.cpp libiso9660pp_sources = iso9660.cpp
libiso9660___la_SOURCES = $(libiso9660pp_sources) libiso9660___la_SOURCES = $(libiso9660pp_sources)
libiso9660___la_ldflags = -version-info $(libiso9660pp_la_CURRENT):$(libiso9660pp_la_REVISION):$(libiso9660pp_la_AGE) libiso9660___la_ldflags = -version-info $(libiso9660pp_la_CURRENT):$(libiso9660pp_la_REVISION):$(libiso9660pp_la_AGE) @LT_NO_UNDEFINED@
INCLUDES = -I$(top_srcdir)/include/ INCLUDES = -I$(top_srcdir)/include/ -I$(top_builddir)/include

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.am,v 1.16 2008/03/20 19:02:38 karl Exp $ # $Id: Makefile.am,v 1.17 2008/06/25 08:01:54 rocky Exp $
# #
# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
# Rocky Bernstein <rocky@gnu.org> # Rocky Bernstein <rocky@gnu.org>
@@ -66,7 +66,7 @@ libiso9660_la_SOURCES = \
xa.c xa.c
libiso9660_la_LIBADD = @LIBCDIO_LIBS@ libiso9660_la_LIBADD = @LIBCDIO_LIBS@
libiso9660_la_ldflags = -version-info $(libiso9660_la_CURRENT):$(libiso9660_la_REVISION):$(libiso9660_la_AGE) libiso9660_la_ldflags = -version-info $(libiso9660_la_CURRENT):$(libiso9660_la_REVISION):$(libiso9660_la_AGE) @LT_NO_UNDEFINED@
libiso9660_la_dependencies = libcdio.la libiso9660_la_dependencies = libcdio.la
INCLUDES = $(LIBCDIO_CFLAGS) INCLUDES = $(LIBCDIO_CFLAGS)

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso9660.c,v 1.40 2008/06/03 08:40:15 rocky Exp $ $Id: iso9660.c,v 1.41 2008/06/25 08:01:54 rocky Exp $
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
Rocky Bernstein <rocky@gnu.org> Rocky Bernstein <rocky@gnu.org>
@@ -57,6 +57,22 @@ const char ISO_STANDARD_ID[] = {'C', 'D', '0', '0', '1'};
#include <errno.h> #include <errno.h>
#endif #endif
#ifndef HAVE_SETENV
static int
setenv(const char *envname, const char *envval, int overwrite)
{
return -1;
}
#endif
#ifndef HAVE_UNSETENV
static int
unsetenv(const char *envname)
{
return -1;
}
#endif
#ifndef HAVE_TIMEGM #ifndef HAVE_TIMEGM
static time_t static time_t
timegm(struct tm *tm) timegm(struct tm *tm)
@@ -77,7 +93,35 @@ timegm(struct tm *tm)
} }
#endif #endif
static const char _rcsid[] = "$Id: iso9660.c,v 1.40 2008/06/03 08:40:15 rocky Exp $"; #ifndef HAVE_GMTIME_R
static struct tm *
gmtime_r(const time_t *timer, struct tm *result)
{
struct tm *tmp = gmtime(timer);
if (tmp) {
*result = *tmp;
return result;
}
return tmp;
}
#endif
#ifndef HAVE_LOCALTIME_R
static struct tm *
localtime_r(const time_t *timer, struct tm *result)
{
struct tm *tmp = localtime(timer);
if (tmp) {
*result = *tmp;
return result;
}
return tmp;
}
#endif
static const char _rcsid[] = "$Id: iso9660.c,v 1.41 2008/06/25 08:01:54 rocky Exp $";
/* Variables to hold debugger-helping enumerations */ /* Variables to hold debugger-helping enumerations */
enum iso_enum1_s iso_enums1; enum iso_enum1_s iso_enums1;

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.am,v 1.8 2008/03/20 19:02:38 karl Exp $ # $Id: Makefile.am,v 1.9 2008/06/25 08:01:54 rocky Exp $
# #
# Copyright (C) 2004, 2006, 2008 Rocky Bernstein <rocky@gnu.org> # Copyright (C) 2004, 2006, 2008 Rocky Bernstein <rocky@gnu.org>
# #
@@ -56,7 +56,7 @@ libcdio_paranoia_sources = gap.c isort.c overlap.c overlap.h \
lib_LTLIBRARIES = libcdio_paranoia.la lib_LTLIBRARIES = libcdio_paranoia.la
libcdio_paranoia_la_SOURCES = $(libcdio_paranoia_sources) libcdio_paranoia_la_SOURCES = $(libcdio_paranoia_sources)
libcdio_paranoia_la_ldflags = -version-info $(libcdio_paranoia_la_CURRENT):$(libcdio_paranoia_la_REVISION):$(libcdio_paranoia_la_AGE) libcdio_paranoia_la_ldflags = -version-info $(libcdio_paranoia_la_CURRENT):$(libcdio_paranoia_la_REVISION):$(libcdio_paranoia_la_AGE) @LT_NO_UNDEFINED@
INCLUDES = $(LIBCDIO_CFLAGS) INCLUDES = $(LIBCDIO_CFLAGS)

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.am,v 1.8 2008/03/20 19:02:38 karl Exp $ # $Id: Makefile.am,v 1.9 2008/06/25 08:01:54 rocky Exp $
# #
# Copyright (C) 2003, 2004, 2006, 2008 Rocky Bernstein <rocky@gnu.org> # Copyright (C) 2003, 2004, 2006, 2008 Rocky Bernstein <rocky@gnu.org>
# #
@@ -53,6 +53,6 @@ lib_LTLIBRARIES = libudf.la
libudf_la_SOURCES = udf.c udf_file.c udf_fs.c udf_time.c filemode.c libudf_la_SOURCES = udf.c udf_file.c udf_fs.c udf_time.c filemode.c
libudf_la_LIBADD = @LIBCDIO_LIBS@ libudf_la_LIBADD = @LIBCDIO_LIBS@ @LT_NO_UNDEFINED@
INCLUDES = $(LIBCDIO_CFLAGS) INCLUDES = $(LIBCDIO_CFLAGS)

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cddb.c,v 1.7 2008/04/14 17:30:27 karl Exp $ $Id: cddb.c,v 1.8 2008/06/25 08:01:54 rocky Exp $
Copyright (C) 2005, 2008 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2005, 2008 Rocky Bernstein <rocky@gnu.org>
@@ -47,7 +47,7 @@ cddb_dec_digit_sum(int n)
the total length of the disk, and the total length of the disk, and
the number of tracks. the number of tracks.
*/ */
u_int32_t uint32_t
cddb_discid(CdIo_t *p_cdio, track_t i_tracks) cddb_discid(CdIo_t *p_cdio, track_t i_tracks)
{ {
int i,t,n=0; int i,t,n=0;

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cddb.h,v 1.5 2008/04/14 17:30:27 karl Exp $ $Id: cddb.h,v 1.6 2008/06/25 08:01:54 rocky Exp $
Copyright (C) 2005, 2007, 2008 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2005, 2007, 2008 Rocky Bernstein <rocky@gnu.org>
@@ -37,7 +37,7 @@ cddb_opts_t cddb_opts;
the total length of the disk, and the total length of the disk, and
the number of tracks. the number of tracks.
*/ */
u_int32_t cddb_discid(CdIo_t *p_cdio, track_t i_tracks); uint32_t cddb_discid(CdIo_t *p_cdio, track_t i_tracks);
#ifdef HAVE_CDDB #ifdef HAVE_CDDB
#include <cddb/cddb.h> #include <cddb/cddb.h>