From 5ca57319c7c29ff8891efe06605065776dedb62b Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Sat, 3 Sep 2011 01:27:40 +0000 Subject: * Add an install-conf target, so make install doesn't overwrite your config file. --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7fa6208..17b6668 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.31 2011/04/21 08:50:44 jmaggard Exp $ +# $Id$ # MiniDLNA project # http://sourceforge.net/projects/minidlna/ # (c) 2008-2009 Justin Maggard @@ -59,6 +59,8 @@ distclean: clean install: minidlna $(INSTALL) -d $(SBININSTALLDIR) $(INSTALL) minidlna $(SBININSTALLDIR) + +install-conf: $(INSTALL) -d $(ETCINSTALLDIR) $(INSTALL) --mode=0644 minidlna.conf $(ETCINSTALLDIR) -- cgit v1.2.3 From 167ea318885a8c1ec20fc0ea3ded6197ee49ed7e Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Sat, 3 Sep 2011 01:32:56 +0000 Subject: * Simplify daemonize ifdefs. --- daemonize.c | 18 +++++++++++------- daemonize.h | 2 -- minidlna.c | 7 ------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/daemonize.c b/daemonize.c index b1bfe9c..9a10276 100644 --- a/daemonize.c +++ b/daemonize.c @@ -41,12 +41,12 @@ #include "config.h" #include "log.h" -#ifndef USE_DAEMON - int daemonize(void) { - int pid, i; + int pid; +#ifndef USE_DAEMON + int i; switch(fork()) { @@ -72,16 +72,20 @@ daemonize(void) dup(i); /* stderr */ umask(027); - chdir("/"); /* chdir to /tmp ? */ - - return pid; + chdir("/"); + break; /* parent process */ default: exit(0); } -} +#else + if( daemon(0, 0) < 0 ) + perror("daemon()"); + pid = getpid(); #endif + return pid; +} int writepidfile(const char * fname, int pid) diff --git a/daemonize.h b/daemonize.h index ee763bd..7a05d6c 100644 --- a/daemonize.h +++ b/daemonize.h @@ -31,13 +31,11 @@ #include "config.h" -#ifndef USE_DAEMON /* daemonize() * "fork" to background, detach from terminal, etc... * returns: pid of the daemon, exits upon failure */ int daemonize(void); -#endif /* writepidfile() * write the pid to a file */ diff --git a/minidlna.c b/minidlna.c index 1ce0d52..4fa5f2e 100644 --- a/minidlna.c +++ b/minidlna.c @@ -789,14 +789,7 @@ init(int argc, char * * argv) } else { -#ifdef USE_DAEMON - if(daemon(0, 0)<0) { - perror("daemon()"); - } - pid = getpid(); -#else pid = daemonize(); -#endif #ifdef READYNAS log_init("/var/log/upnp-av.log", "general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn"); #else -- cgit v1.2.3 From 4ce6152fbcb6cd134b377f942117044c894f3ebc Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Sat, 3 Sep 2011 01:54:39 +0000 Subject: * Add a verbose logging parameter and playlist skipping, based on SF bug #3395238. --- minidlna.c | 18 ++++++++++++++---- playlist.c | 3 +++ scanner.c | 6 +++++- upnpglobalvars.c | 2 +- upnpglobalvars.h | 3 ++- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/minidlna.c b/minidlna.c index 4fa5f2e..f699f2d 100644 --- a/minidlna.c +++ b/minidlna.c @@ -340,6 +340,7 @@ init(int argc, char * * argv) int i; int pid; int debug_flag = 0; + int verbose_flag = 0; int options_flag = 0; struct sigaction sa; /*const char * logfilename = 0;*/ @@ -351,6 +352,7 @@ init(int argc, char * * argv) char * path; char real_path[PATH_MAX]; char ip_addr[INET_ADDRSTRLEN + 3] = {'\0'}; + char log_str[72] = "general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn"; /* first check if "-f" option is used */ for(i=2; i Date: Sun, 4 Sep 2011 04:07:36 +0000 Subject: * Fixup last checkin. --- playlist.c | 2 +- scanner.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/playlist.c b/playlist.c index 436290d..3feb694 100644 --- a/playlist.c +++ b/playlist.c @@ -147,7 +147,7 @@ fill_playlists() if( last_dir ) { fname = basename(plist.path); - detailID = sql_get_int_field(db, "SELECT ID from DETAILS where PATH = '%s/%s'", last_dir, fname); + detailID = sql_get_int_field(db, "SELECT ID from DETAILS where PATH = '%q/%q'", last_dir, fname); if( detailID <= 0 ) { sqlite3_free(last_dir); diff --git a/scanner.c b/scanner.c index ab0e01e..5b4581b 100644 --- a/scanner.c +++ b/scanner.c @@ -829,9 +829,13 @@ start_scanner() sql_exec(db, "create INDEX IDX_SEARCH_OPT ON OBJECTS(OBJECT_ID, CLASS, DETAIL_ID);"); if( GETFLAG(NO_PLAYLIST_MASK) ) + { DPRINTF(E_WARN, L_SCANNER, "Playlist creation disabled\n"); + } else + { fill_playlists(); + } DPRINTF(E_DEBUG, L_SCANNER, "Initial file scan completed\n", DB_VERSION); //JM: Set up a db version number, so we know if we need to rebuild due to a new structure. -- cgit v1.2.3 From b81ff08b0ce5b99768f04c17002005bad5e20c07 Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Fri, 16 Sep 2011 23:39:57 +0000 Subject: * Add support for other operating systems (kFreeBSD, FreeBSD, and OSX for now). * Switch to autoconf from genconfig.sh. --- AUTHORS | 1 + COPYING | 345 +++++++++++++++++++++++++++++ ChangeLog | 0 INSTALL | 375 +++++++++++++++++++++++++++++++- LICENCE | 345 ----------------------------- Makefile | 135 ------------ Makefile.am | 53 +++++ NEWS | 4 +- albumart.c | 1 + autogen.sh | 36 +++ config.h.in | 481 ++++++++++++++++++++++++++++++++++++++++ configure.ac | 556 +++++++++++++++++++++++++++++++++++++++++++++++ daemonize.c | 4 +- genconfig.sh | 215 ------------------ getifaddr.c | 205 +++++++++++++---- image_utils.c | 11 +- inotify.c | 6 +- inotify.h | 3 +- metadata.c | 103 ++++++--- minidlna.c | 14 +- options.c | 15 +- playlist.c | 6 +- scanner.c | 73 ++++--- sendfile.h | 53 +++++ tagutils/misc.c | 5 + tagutils/tagutils-asf.h | 4 + tagutils/tagutils-misc.c | 8 +- tagutils/tagutils-mp3.c | 9 +- tagutils/tagutils.c | 2 +- tagutils/tagutils.h | 1 + tivo_beacon.c | 3 +- tivo_commands.c | 1 + tivo_utils.c | 3 +- upnpdescgen.c | 2 +- upnpevents.c | 9 +- upnpglobalvars.c | 2 +- upnphttp.c | 22 +- upnphttp.h | 4 + upnpsoap.c | 2 +- utils.c | 7 +- uuid.c | 53 +++-- 41 files changed, 2298 insertions(+), 879 deletions(-) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog delete mode 100644 LICENCE delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 config.h.in create mode 100644 configure.ac delete mode 100755 genconfig.sh create mode 100644 sendfile.h diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..0d8f56f --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Justin Maggard diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..7df8a85 --- /dev/null +++ b/COPYING @@ -0,0 +1,345 @@ +MiniDLNA is distributed under version 2 of the General Public License (included +in its entirety, below). Version 2 is the only version of this license which +this version of MiniDLNA (or modified versions derived from this one) may be +distributed under. + +------------------------------------------------------------------------ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/INSTALL b/INSTALL index b3bbd16..2194fe0 100644 --- a/INSTALL +++ b/INSTALL @@ -1,19 +1,376 @@ -MiniDLNA project. -(c) 2009 Justin Maggard -Parts (c) 2006-2008 Thomas Bernard -Homepage : http://sourceforge.net/projects/minidlna/ +Installation Instructions +************************* -Prerequisites : +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006, 2007, 2008, 2009 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Prerequisites +================== - libexif - libjpeg - libid3tag - libFLAC - libvorbis -- sqlite3 +- libsqlite3 - libavformat (the ffmpeg libraries) -- libuuid -To Build and install : +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. Some packages provide this +`INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + + The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. + + 4. Type `make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the `make install' phase executed with root + privileges. + + 5. Optionally, type `make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior `make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type `make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide `make + distcheck', which can by used by developers to test that all other + targets like `make install' and `make uninstall' work correctly. + This target is generally not run by end users. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. This +is known as a "VPATH" build. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX', where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the +default for these options is expressed in terms of `${prefix}', so that +specifying just `--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to `configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +`make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, `make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +`${prefix}'. Any directories that were specified during `configure', +but not in terms of `${prefix}', must each be overridden at install +time for the entire installation to be relocated. The approach of +makefile variable overrides for each directory variable is required by +the GNU Coding Standards, and ideally causes no recompilation. +However, some platforms have known limitations with the semantics of +shared libraries that end up requiring recompilation when using this +method, particularly noticeable in packages that use GNU Libtool. + + The second method involves providing the `DESTDIR' variable. For +example, `make install DESTDIR=/alternate/directory' will prepend +`/alternate/directory' before all installation names. The approach of +`DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of `${prefix}' +at `configure' time. + +Optional Features +================= + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of `make' will be. For these packages, running `./configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with `make V=1'; while running `./configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with `make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put `/usr/ucb' early in your `PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in `/usr/bin'. So, if you need `/usr/ucb' +in your `PATH', put it _after_ `/usr/bin'. + + On Haiku, software installed for all users goes in `/boot/common', +not `/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. -- Just run make, and hope it works. :) diff --git a/LICENCE b/LICENCE deleted file mode 100644 index 7df8a85..0000000 --- a/LICENCE +++ /dev/null @@ -1,345 +0,0 @@ -MiniDLNA is distributed under version 2 of the General Public License (included -in its entirety, below). Version 2 is the only version of this license which -this version of MiniDLNA (or modified versions derived from this one) may be -distributed under. - ------------------------------------------------------------------------- - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - 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 2 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, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/Makefile b/Makefile deleted file mode 100644 index 17b6668..0000000 --- a/Makefile +++ /dev/null @@ -1,135 +0,0 @@ -# $Id$ -# MiniDLNA project -# http://sourceforge.net/projects/minidlna/ -# (c) 2008-2009 Justin Maggard -# for use with GNU Make -# To install use : -# $ DESTDIR=/dummyinstalldir make install -# or : -# $ INSTALLPREFIX=/usr/local make install -# or : -# $ make install -# -#CFLAGS = -Wall -O -D_GNU_SOURCE -g -DDEBUG -#CFLAGS = -Wall -g -Os -D_GNU_SOURCE -CFLAGS = -Wall -g -O3 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \ - -I/usr/include/ffmpeg \ - -I/usr/include/libavutil -I/usr/include/libavcodec -I/usr/include/libavformat \ - -I/usr/include/ffmpeg/libavutil -I/usr/include/ffmpeg/libavcodec -I/usr/include/ffmpeg/libavformat -#STATIC_LINKING: CFLAGS += -DSTATIC -#STATIC_LINKING: LDFLAGS = -static -CC = gcc -RM = rm -f -INSTALL = install - -INSTALLPREFIX ?= $(DESTDIR)/usr -SBININSTALLDIR = $(INSTALLPREFIX)/sbin -ETCINSTALLDIR = $(DESTDIR)/etc - -BASEOBJS = minidlna.o upnphttp.o upnpdescgen.o upnpsoap.o \ - upnpreplyparse.o minixml.o \ - getifaddr.o daemonize.o upnpglobalvars.o \ - options.o minissdp.o uuid.o upnpevents.o \ - sql.o utils.o metadata.o scanner.o inotify.o \ - tivo_utils.o tivo_beacon.o tivo_commands.o \ - tagutils/textutils.o tagutils/misc.o tagutils/tagutils.o \ - playlist.o image_utils.o albumart.o log.o - -ALLOBJS = $(BASEOBJS) $(LNXOBJS) - -LIBS = -lpthread -lexif -ljpeg -lsqlite3 -lavformat -lavutil -lavcodec -lid3tag -lFLAC -logg -lvorbis -#STATIC_LINKING: LIBS = -lvorbis -logg -lm -lsqlite3 -lpthread -lexif -ljpeg -lFLAC -lm -lid3tag -lz -lavformat -lavutil -lavcodec -lm - -TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o - -EXECUTABLES = minidlna testupnpdescgen - -.PHONY: all clean distclean install depend - -all: $(EXECUTABLES) - -clean: - $(RM) $(ALLOBJS) - $(RM) $(EXECUTABLES) - $(RM) testupnpdescgen.o - -distclean: clean - $(RM) config.h - -install: minidlna - $(INSTALL) -d $(SBININSTALLDIR) - $(INSTALL) minidlna $(SBININSTALLDIR) - -install-conf: - $(INSTALL) -d $(ETCINSTALLDIR) - $(INSTALL) --mode=0644 minidlna.conf $(ETCINSTALLDIR) - -minidlna: $(BASEOBJS) $(LNXOBJS) $(LIBS) - @echo Linking $@ - @$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(BASEOBJS) $(LNXOBJS) $(LIBS) - - -testupnpdescgen: $(TESTUPNPDESCGENOBJS) - @echo Linking $@ - @$(CC) $(CFLAGS) -o $@ $(TESTUPNPDESCGENOBJS) - -config.h: genconfig.sh - ./genconfig.sh - -depend: config.h - makedepend -f$(MAKEFILE_LIST) -Y \ - $(ALLOBJS:.o=.c) $(TESTUPNPDESCGENOBJS:.o=.c) 2>/dev/null - -# DO NOT DELETE - -minidlna.o: config.h upnpglobalvars.h minidlnatypes.h -minidlna.o: upnphttp.h upnpdescgen.h minidlnapath.h getifaddr.h upnpsoap.h -minidlna.o: options.h minissdp.h daemonize.h upnpevents.h log.h -upnphttp.o: config.h upnphttp.h upnpdescgen.h minidlnapath.h upnpsoap.h -upnphttp.o: upnpevents.h image_utils.h sql.h log.h icons.c -upnpdescgen.o: config.h upnpdescgen.h minidlnapath.h upnpglobalvars.h -upnpdescgen.o: minidlnatypes.h upnpdescstrings.h log.h -upnpsoap.o: config.h upnpglobalvars.h minidlnatypes.h log.h utils.h sql.h -upnpsoap.o: upnphttp.h upnpsoap.h upnpreplyparse.h getifaddr.h log.h -upnpreplyparse.o: upnpreplyparse.h minixml.h log.h -minixml.o: minixml.h -getifaddr.o: getifaddr.h log.h -daemonize.o: daemonize.h config.h log.h -upnpglobalvars.o: config.h upnpglobalvars.h -upnpglobalvars.o: minidlnatypes.h -options.o: options.h config.h upnpglobalvars.h -options.o: minidlnatypes.h -minissdp.o: config.h upnpdescstrings.h minidlnapath.h upnphttp.h -minissdp.o: upnpglobalvars.h minidlnatypes.h minissdp.h log.h -upnpevents.o: config.h upnpevents.h minidlnapath.h upnpglobalvars.h -upnpevents.o: minidlnatypes.h upnpdescgen.h log.h uuid.h -uuid.o: uuid.h -testupnpdescgen.o: config.h upnpdescgen.h -upnpdescgen.o: config.h upnpdescgen.h minidlnapath.h upnpglobalvars.h -upnpdescgen.o: minidlnatypes.h upnpdescstrings.h -scanner.o: upnpglobalvars.h metadata.h utils.h sql.h scanner.h log.h playlist.h -metadata.o: upnpglobalvars.h metadata.h albumart.h utils.h sql.h log.h -albumart.o: upnpglobalvars.h albumart.h utils.h image_utils.h sql.h log.h -tagutils/misc.o: tagutils/misc.h -tagutils/textutils.o: tagutils/misc.h tagutils/textutils.h log.h -tagutils/tagutils.o: tagutils/tagutils-asf.c tagutils/tagutils-flc.c tagutils/tagutils-plist.c tagutils/tagutils-misc.c -tagutils/tagutils.o: tagutils/tagutils-aac.c tagutils/tagutils-asf.h tagutils/tagutils-flc.h tagutils/tagutils-mp3.c tagutils/tagutils-wav.c -tagutils/tagutils.o: tagutils/tagutils-ogg.c tagutils/tagutils-aac.h tagutils/tagutils.h tagutils/tagutils-mp3.h tagutils/tagutils-ogg.h log.h -playlist.o: playlist.h -inotify.o: inotify.h playlist.h -image_utils.o: image_utils.h -tivo_utils.o: config.h tivo_utils.h -tivo_beacon.o: config.h tivo_beacon.h tivo_utils.h -tivo_commands.o: config.h tivo_commands.h tivo_utils.h utils.h -utils.o: utils.h -sql.o: sql.h -log.o: log.h - -.SUFFIXES: .c .o - -.c.o: - @echo Compiling $*.c - @$(CC) $(CFLAGS) -o $@ -c $< && exit 0;\ - echo "The following command failed:" 1>&2;\ - echo "$(CC) $(CFLAGS) -o $@ -c $<";\ - $(CC) $(CFLAGS) -o $@ -c $< &>/dev/null diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..f35e9e2 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,53 @@ +AM_CFLAGS = -Wall -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 @STATIC_CFLAGS@ + +SUBDIRS=po + +bin_PROGRAMS = minidlna testupnpdescgen +minidlna_SOURCES = minidlna.c upnphttp.c upnpdescgen.c upnpsoap.c \ + upnpreplyparse.c minixml.c \ + getifaddr.c daemonize.c upnpglobalvars.c \ + options.c minissdp.c uuid.c upnpevents.c \ + sql.c utils.c metadata.c scanner.c inotify.c \ + tivo_utils.c tivo_beacon.c tivo_commands.c \ + tagutils/textutils.c tagutils/misc.c tagutils/tagutils.c \ + playlist.c image_utils.c albumart.c log.c + + +#if NEED_VORBIS +vorbisflag = -lvorbis +#endif + +#if NEED_OGG +flacoggflag = -logg +#endif + +minidlna_LDADD = \ + @LIBJPEG_LIBS@ \ + @LIBID3TAG_LIBS@ \ + @LIBSQLITE3_LIBS@ \ + @LIBAVFORMAT_LIBS@ \ + @LIBAVUTIL_LIBS@ \ + @LIBAVCODEC_LIBS@ \ + @LIBEXIF_LIBS@ \ + @LIBDL_LIBS@ \ + @LIBRT_LIBS@ \ + -lpthread -lFLAC $(flacoggflag) $(vorbisflag) + +minidlna_LDFLAGS = @STATIC_LDFLAGS@ + +testupnpdescgen_SOURCES = testupnpdescgen.c upnpdescgen.c +testupnpdescgen_LDADD = \ + @LIBJPEG_LIBS@ \ + @LIBID3TAG_LIBS@ \ + @LIBSQLITE3_LIBS@ \ + @LIBAVFORMAT_LIBS@ \ + @LIBAVUTIL_LIBS@ \ + @LIBAVCODEC_LIBS@ \ + @LIBEXIF_LIBS@ \ + @LIBDL_LIBS@ \ + -lpthread -lFLAC $(flacoggflag) $(vorbisflag) + + +ACLOCAL_AMFLAGS = -I m4 + +EXTRA_DIST = m4/ChangeLog diff --git a/NEWS b/NEWS index 5521433..0555979 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ -1.0.23 - Released 00-Month-0000 +1.1.0 - Released 00-Month-0000 -------------------------------- +- Add support for other operating systems. +- Switch to autoconf from our little genconfig.sh. - Enable the subtitle menu on some Samsung TV's. 1.0.22 - Released 24-Aug-2011 diff --git a/albumart.c b/albumart.c index f184377..189cdd5 100644 --- a/albumart.c +++ b/albumart.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..f005a50 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +package="minidlna" + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +cd "$srcdir" +DIE=0 + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have autoconf installed to compile $package." + echo "Download the appropriate package for your system," + echo "or get the source from one of the GNU ftp sites" + echo "listed in http://www.gnu.org/order/ftp.html" + DIE=1 +} + +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have automake installed to compile $package." + echo "Download the appropriate package for your system," + echo "or get the source from one of the GNU ftp sites" + echo "listed in http://www.gnu.org/order/ftp.html" + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +echo "Generating configuration files for $package, please wait...." + +autoreconf -vfi + diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..ae27a84 --- /dev/null +++ b/config.h.in @@ -0,0 +1,481 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* DB path */ +#undef DEFAULT_DB_PATH + +/* Log path */ +#undef DEFAULT_LOG_PATH + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#undef ENABLE_NLS + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_AVCODEC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_AVFORMAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_AVUTIL_H + +/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +#undef HAVE_CFLOCALECOPYCURRENT + +/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +#undef HAVE_CFPREFERENCESCOPYAPPVALUE + +/* Whether the __NR_clock_gettime syscall is defined */ +#undef HAVE_CLOCK_GETTIME_SYSCALL + +/* Whether darwin sendfile() API is available */ +#undef HAVE_DARWIN_SENDFILE_API + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +#undef HAVE_DCGETTEXT + +/* Define to 1 if you have the header file. */ +#undef HAVE_ENDIAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FFMPEG_AVCODEC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FFMPEG_AVUTIL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FFMPEG_LIBAVCODEC_AVCODEC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FFMPEG_LIBAVFORMAT_AVFORMAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FFMPEG_LIBAVFORMAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FFMPEG_LIBAVUTIL_AVUTIL_H + +/* Have flac */ +#undef HAVE_FLAC + +/* Define to 1 if you have the header file. */ +#undef HAVE_FLAC_ALL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FLAC_METADATA_H + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Whether freebsd sendfile() API is available */ +#undef HAVE_FREEBSD_SENDFILE_API + +/* Define to 1 if you have the `gethostname' function. */ +#undef HAVE_GETHOSTNAME + +/* Define to 1 if you have the `getifaddrs' function. */ +#undef HAVE_GETIFADDRS + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#undef HAVE_GETTEXT + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define if you have the iconv() function. */ +#undef HAVE_ICONV + +/* Define to 1 if you have the header file. */ +#undef HAVE_ID3TAG_H + +/* Define to 1 if you have the `inet_ntoa' function. */ +#undef HAVE_INET_NTOA + +/* Define to enable inotify */ +#undef HAVE_INOTIFY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_JPEGLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBAVCODEC_AVCODEC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBAVFORMAT_AVFORMAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBAVUTIL_AVUTIL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBAV_AVCODEC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBAV_AVUTIL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBAV_LIBAVCODEC_AVCODEC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBAV_LIBAVFORMAT_AVFORMAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBAV_LIBAVFORMAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBAV_LIBAVUTIL_AVUTIL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBEXIF_EXIF_LOADER_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBINTL_H + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#undef HAVE_LIBPTHREAD + +/* Whether linux sendfile() API is available */ +#undef HAVE_LINUX_SENDFILE_API + +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MACHINE_ENDIAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MACH_MACH_TIME_H + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have the `mkdir' function. */ +#undef HAVE_MKDIR + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OGG_OGG_H + +/* Define to 1 if you have the `realpath' function. */ +#undef HAVE_REALPATH + +/* Define to 1 if you have the `select' function. */ +#undef HAVE_SELECT + +/* Define to 1 if you have the `sendfile' function. */ +#undef HAVE_SENDFILE + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if you have the `socket' function. */ +#undef HAVE_SOCKET + +/* Define to 1 if you have the header file. */ +#undef HAVE_SQLITE3_H + +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strncasecmp' function. */ +#undef HAVE_STRNCASECMP + +/* Define to 1 if you have the `strpbrk' function. */ +#undef HAVE_STRPBRK + +/* Define to 1 if you have the `strrchr' function. */ +#undef HAVE_STRRCHR + +/* Define to 1 if you have the `strstr' function. */ +#undef HAVE_STRSTR + +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL + +/* Define to 1 if you have the `strtoul' function. */ +#undef HAVE_STRTOUL + +/* Define to 1 if `st_blocks' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BLOCKS + +/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use + `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ +#undef HAVE_ST_BLOCKS + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYSCALL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_FILE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSCALL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + +/* Define to 1 if you have the header file. */ +#undef HAVE_VFORK_H + +/* lacking vorbisfile */ +#undef HAVE_VORBISFILE + +/* Define to 1 if you have the header file. */ +#undef HAVE_VORBIS_CODEC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_VORBIS_VORBISFILE_H + +/* Define to 1 if `fork' works. */ +#undef HAVE_WORKING_FORK + +/* Define to 1 if `vfork' works. */ +#undef HAVE_WORKING_VFORK + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +/* Define as const if the declaration of iconv() needs const. */ +#undef ICONV_CONST + +/* Define to enable logging */ +#undef LOG_PERROR + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +#undef LSTAT_FOLLOWS_SLASHED_SYMLINK + +/* Define to 1 if you want to enable NETGEAR support */ +#undef NETGEAR + +/* OS Name */ +#undef OS_NAME + +/* OS URL */ +#undef OS_URL + +/* OS Version */ +#undef OS_VERSION + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you want to enable NETGEAR support */ +#undef PNPX + +/* Define to 1 if you want to enable NETGEAR support */ +#undef READYNAS + +/* scandir needs const char cast */ +#undef SCANDIR_CONST + +/* we are on solaris */ +#undef SOLARIS + +/* Define to enable Solaris Kernel Stats */ +#undef SOLARIS_KSTATS + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if you want to enable TiVo support */ +#undef TIVO_SUPPORT + +/* use the system's builtin daemon() */ +#undef USE_DAEMON + +/* Define to enable IPF */ +#undef USE_IPF + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* Version number of package */ +#undef VERSION + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT32_T + +/* Define for Solaris 2.5.1 so the uint64_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT64_T + +/* Define for Solaris 2.5.1 so the uint8_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT8_T + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef int32_t + +/* Define to `int' if does not define. */ +#undef mode_t + +/* Define to `long int' if does not define. */ +#undef off_t + +/* Define to `int' if does not define. */ +#undef pid_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* Define to `int' if does not define. */ +#undef ssize_t + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef uint32_t + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#undef uint64_t + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +#undef uint8_t + +/* Define as `fork' if `vfork' does not work. */ +#undef vfork diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..82fc71d --- /dev/null +++ b/configure.ac @@ -0,0 +1,556 @@ +AC_INIT(MiniDLNA,1.1.0,,minidlna) +#LT_INIT + +AC_CANONICAL_TARGET +AM_INIT_AUTOMAKE(minidlna,1.1.0) +AC_CONFIG_HEADERS([config.h]) +AC_USE_SYSTEM_EXTENSIONS + +#MiniDLNA + +AM_ICONV +AM_GNU_GETTEXT([external]) +AM_GNU_GETTEXT_VERSION(0.14.4) + +# Checks for programs. +# AC_PROG_CXX +AC_PROG_AWK +AC_PROG_CC +# AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET + + +################################################################################################################ +# Checks for typedefs, structures, and compiler characteristics. +AC_C_INLINE +AC_TYPE_INT32_T +AC_TYPE_MODE_T +AC_TYPE_OFF_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T +AC_STRUCT_ST_BLOCKS +AC_HEADER_STDBOOL +AC_TYPE_UINT32_T +AC_TYPE_UINT64_T +AC_TYPE_UINT8_T +AC_C_BIGENDIAN + +# Checks for library functions. +AC_FUNC_FORK +AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK +AC_CHECK_FUNCS([gethostname getifaddrs gettimeofday inet_ntoa memmove memset mkdir realpath select sendfile setlocale socket strcasecmp strchr strdup strerror strncasecmp strpbrk strrchr strstr strtol strtoul]) + +################################################################################################################ +# Special include directories +case $host in + *-*-darwin*) + DARWIN_OS=1 + SEARCH_DIR="/opt/local" + ;; + *-*-solaris*) + AC_DEFINE([SOLARIS], [1], [we are on solaris]) + ;; + *-*-cygwin*) + CYGWIN_OS=1 + ;; + *-*-freebsd*) + FREEBSD_OS=1 + ;; + *-*-openbsd*) + OPENBSD_OS=1 + ;; +esac + +AC_CHECK_HEADERS(syscall.h sys/syscall.h mach/mach_time.h) +AC_MSG_CHECKING([for __NR_clock_gettime syscall]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [ + #include + ], + [ + #ifndef __NR_clock_gettime + #error + #endif + ] + )], + [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_CLOCK_GETTIME_SYSCALL], [1], [Whether the __NR_clock_gettime syscall is defined]) + ], + [ + AC_MSG_RESULT([no]) + AC_CHECK_LIB([rt], [clock_gettime], [LIBRT_LIBS="-lrt"],) + AC_SUBST(LIBRT_LIBS) + ]) + +################################################################################################################ +### Library checks +#AM_NLS +AC_CHECK_LIB([dl], [dlopen], [LIBDL_LIBS="-ldl"],) +AC_SUBST(LIBDL_LIBS) + +CPPFLAGS_SAVE="$CPPFLAGS" +for dir in "" /usr/local $SEARCH_DIR; do + if test -n "$dir"; then + CPPFLAGS="$CPPFLAGS -I$dir/include" + fi + AC_CHECK_HEADERS([libavutil/avutil.h ffmpeg/libavutil/avutil.h libav/libavutil/avutil.h avutil.h ffmpeg/avutil.h libav/avutil.h], [break], [continue], []) + if test -n "$dir"; then + if test x"$ac_cv_header_avutil_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include" + elif test x"$ac_cv_header_libavutil_avutil_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include/libavutil" + elif test x"$ac_cv_header_ffmpeg_avutil_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include/ffmpeg" + elif test x"$ac_cv_header_ffmpeg_libavutil_avutil_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include/ffmpeg/libavutil" + elif test x"$ac_cv_header_libav_avutil_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include/libav" + elif test x"$ac_cv_header_libav_libavutil_avutil_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include/libav/libavutil" + else + unset ac_cv_header_avutil_h + unset ac_cv_header_libavutil_avutil_h + unset ac_cv_header_ffmpeg_avutil_h + unset ac_cv_header_ffmpeg_libavutil_avutil_h + unset ac_cv_header_libav_avutil_h + unset ac_cv_header_libav_libavutil_avutil_h + CPPFLAGS="$CPPFLAGS_SAVE" + continue + fi + fi + HAVE_LIBAVUTIL=1 + break +done +if test -z "$HAVE_LIBAVUTIL"; then + AC_MSG_ERROR([libavutil headers not found or not usable]) +fi + +CPPFLAGS_SAVE="$CPPFLAGS" +for dir in "" /usr/local $SEARCH_DIR; do + if test -n "$dir"; then + CPPFLAGS="$CPPFLAGS -I$dir/include" + fi + AC_CHECK_HEADERS([libavcodec/avcodec.h ffmpeg/libavcodec/avcodec.h libav/libavcodec/avcodec.h avcodec.h ffmpeg/avcodec.h libav/avcodec.h], [break], [continue], []) + if test -n "$dir"; then + if test x"$ac_cv_header_avcodec_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include" + elif test x"$ac_cv_header_libavcodec_avcodec_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include/libavcodec" + elif test x"$ac_cv_header_ffmpeg_avcodec_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include/ffmpeg" + elif test x"$ac_cv_header_ffmpeg_libavcodec_avcodec_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include/ffmpeg/libavcodec" + elif test x"$ac_cv_header_libav_avcodec_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include/libav" + elif test x"$ac_cv_header_libav_libavcodec_avcodec_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include/libav/libavcodec" + else + unset ac_cv_header_avcodec_h + unset ac_cv_header_libavcodec_avcodec_h + unset ac_cv_header_ffmpeg_avcodec_h + unset ac_cv_header_ffmpeg_libavcodec_avcodec_h + unset ac_cv_header_libav_avcodec_h + unset ac_cv_header_libav_libavcodec_avcodec_h + CPPFLAGS="$CPPFLAGS_SAVE" + continue + fi + fi + HAVE_LIBAVCODEC=1 + break +done +if test -z "$HAVE_LIBAVCODEC"; then + AC_MSG_ERROR([libavcodec headers not found or not usable]) +fi + +CPPFLAGS_SAVE="$CPPFLAGS" +for dir in "" /usr/local $SEARCH_DIR; do + if test -n "$dir"; then + CPPFLAGS="$CPPFLAGS -I$dir/include" + fi + AC_CHECK_HEADERS([libavformat/avformat.h ffmpeg/libavformat/avformat.h libav/libavformat/avformat.h avformat.h ffmpeg/avformat.h libav/avformat.h], [break], [continue], []) + if test -n "$dir"; then + if test x"$ac_cv_header_avformat_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include" + elif test x"$ac_cv_header_libavformat_avformat_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include/libavformat" + elif test x"$ac_cv_header_ffmpeg_avformat_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include/ffmpeg" + elif test x"$ac_cv_header_ffmpeg_libavformat_avformat_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include/ffmpeg/libavformat" + elif test x"$ac_cv_header_libav_avformat_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include/libav" + elif test x"$ac_cv_header_libav_libavformat_avformat_h" = xyes; then + CPPFLAGS="$CPPFLAGS_SAVE -I$dir/include/libav/libavformat" + else + unset ac_cv_header_avformat_h + unset ac_cv_header_libavformat_avformat_h + unset ac_cv_header_ffmpeg_avformat_h + unset ac_cv_header_ffmpeg_libavformat_avformat_h + unset ac_cv_header_libav_avformat_h + unset ac_cv_header_libav_libavformat_avformat_h + CPPFLAGS="$CPPFLAGS_SAVE" + continue + fi + fi + HAVE_LIBAVFORMAT=1 + break +done +if test -z "$HAVE_LIBAVFORMAT"; then + AC_MSG_ERROR([libavformat headers not found or not usable]) +fi + +CPPFLAGS_SAVE="$CPPFLAGS" +for dir in "" /usr/local $SEARCH_DIR; do + if test -n "$dir"; then + CPPFLAGS="$CPPFLAGS -I$dir/include" + fi + AC_CHECK_HEADERS([jpeglib.h sqlite3.h libexif/exif-loader.h id3tag.h ogg/ogg.h vorbis/codec.h FLAC/metadata.h],,[unset $as_ac_Header; break],) + if test x"$ac_cv_header_jpeglib_h" != x"yes"; then + CPPFLAGS="$CPPFLAGS_SAVE" + continue + elif test x"$ac_cv_header_sqlite3_h" != x"yes"; then + CPPFLAGS="$CPPFLAGS_SAVE" + continue + elif test x"$ac_cv_header_libexif_exif_loader_h" != x"yes"; then + CPPFLAGS="$CPPFLAGS_SAVE" + continue + elif test x"$ac_cv_header_id3tag_h" != x"yes"; then + CPPFLAGS="$CPPFLAGS_SAVE" + continue + elif test x"$ac_cv_header_ogg_ogg_h" != x"yes"; then + CPPFLAGS="$CPPFLAGS_SAVE" + continue + elif test x"$ac_cv_header_vorbis_codec_h" != x"yes"; then + CPPFLAGS="$CPPFLAGS_SAVE" + continue + elif test x"$ac_cv_header_FLAC_metadata_h" != x"yes"; then + CPPFLAGS="$CPPFLAGS_SAVE" + continue + else + break; + fi +done +test x"$ac_cv_header_jpeglib_h" != x"yes" && AC_MSG_ERROR([libjpeg headers not found or not usable]) +test x"$ac_cv_header_sqlite3_h" != x"yes" && AC_MSG_ERROR([libsqlite3 headers not found or not usable]) +test x"$ac_cv_header_libexif_exif_loader_h" != x"yes" && AC_MSG_ERROR([libexif headers not found or not usable]) +test x"$ac_cv_header_id3tag_h" != x"yes" && AC_MSG_ERROR([libid3tag headers not found or not usable]) +test x"$ac_cv_header_ogg_ogg_h" != x"yes" && AC_MSG_ERROR([libogg headers not found or not usable]) +test x"$ac_cv_header_vorbis_codec_h" != x"yes" && AC_MSG_ERROR([libvorbis headers not found or not usable]) +test x"$ac_cv_header_FLAC_metadata_h" != x"yes" && AC_MSG_ERROR([libFLAC headers not found or not usable]) + +CFLAGS_SAVE="$CFLAGS" +CFLAGS="$CFLAGS -Wall -Werror" +AC_MSG_CHECKING([if we should use the daemon() libc function]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [ + #include + ], + [ + (void)daemon(0, 0); + ] + )], + [ + AC_DEFINE([USE_DAEMON], [1], + [use the system's builtin daemon()]) + AC_MSG_RESULT([yes]) + ], + [ + AC_MSG_RESULT([no]) + ]) + +AC_MSG_CHECKING([if scandir declaration requires const char cast]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [ + #include + #include + #include + ], + [ + int filter(struct dirent *d); + struct dirent **ptr = NULL; + char *name = NULL; + (void)scandir(name, &ptr, filter, alphasort); + ] + )], + [ + AC_MSG_RESULT([no]) + ], + [ + AC_DEFINE([SCANDIR_CONST], [1], + [scandir needs const char cast]) + + AC_MSG_RESULT([yes]) + ]) + +AC_MSG_CHECKING([for linux sendfile support]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [ + #include + #include + ], + [ + int tofd = 0, fromfd = 0; + off_t offset; + size_t total = 0; + ssize_t nwritten = sendfile(tofd, fromfd, &offset, total); + return nwritten; + ] + )], + [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_LINUX_SENDFILE_API], [1], [Whether linux sendfile() API is available]) + ], + [ + AC_MSG_RESULT([no]) + ]) + +AC_MSG_CHECKING([for darwin sendfile support]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [ + #include + #include + #include + #include + ], + [ + int fd = 0, s = 0; + off_t offset = 0, len; + struct sf_hdtr *hdtr = NULL; + int flags = 0; + int ret; + ret = sendfile(fd, s, offset, &len, hdtr, flags); + return ret; + ] + )], + [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_DARWIN_SENDFILE_API], [1], [Whether darwin sendfile() API is available]) + ], + [ + AC_MSG_RESULT([no]) + ]) + +AC_MSG_CHECKING([for freebsd sendfile support]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [ + #include + #include + #include + #include + ], + [ + int fromfd=0, tofd=0, ret, total=0; + off_t offset=0, nwritten; + struct sf_hdtr hdr; + struct iovec hdtrl; + hdr.headers = &hdtrl; + hdr.hdr_cnt = 1; + hdr.trailers = NULL; + hdr.trl_cnt = 0; + hdtrl.iov_base = NULL; + hdtrl.iov_len = 0; + ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0); + ] + )], + [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_FREEBSD_SENDFILE_API], [1], [Whether freebsd sendfile() API is available]) + ], + [ + AC_MSG_RESULT([no]) + ]) +CFLAGS="$CFLAGS_SAVE" + +LDFLAGS_SAVE="$LDFLAGS" +for dir in "" /usr/local $SEARCH_DIR; do + if test -n "$dir"; then + LDFLAGS="$LDFLAGS -L$dir/lib" + fi + AC_CHECK_LIB([jpeg], [jpeg_set_defaults], [LIBJPEG_LIBS="-ljpeg"], [unset ac_cv_lib_jpeg_jpeg_set_defaults; LDFLAGS="$LDFLAGS_SAVE"; continue]) + break +done +test x"$ac_cv_lib_jpeg_jpeg_set_defaults" = x"yes" || AC_MSG_ERROR([Could not find libjpeg]) +AC_SUBST(LIBJPEG_LIBS) + +LDFLAGS_SAVE="$LDFLAGS" +for dir in "" /usr/local $SEARCH_DIR; do + if test -n "$dir"; then + LDFLAGS="$LDFLAGS -L$dir/lib" + fi + AC_CHECK_LIB([exif], [exif_data_new_from_file], [LIBEXIF_LIBS="-lexif"], [unset ac_cv_lib_exif_exif_data_new_from_file; LDFLAGS="$LDFLAGS_SAVE"; continue]) + break +done +test x"$ac_cv_lib_jpeg_jpeg_set_defaults" = x"yes" || AC_MSG_ERROR([Could not find libexif]) +AC_SUBST(LIBEXIF_LIBS) + +LDFLAGS_SAVE="$LDFLAGS" +for dir in "" /usr/local $SEARCH_DIR; do + if test -n "$dir"; then + LDFLAGS="$LDFLAGS -L$dir/lib" + fi + AC_CHECK_LIB([id3tag], [id3_file_open], [LIBID3TAG_LIBS="-lid3tag"], [unset ac_cv_lib_id3tag_id3_file_open; LDFLAGS="$LDFLAGS_SAVE"; continue]) + break +done +test x"$ac_cv_lib_id3tag_id3_file_open" = x"yes" || AC_MSG_ERROR([Could not find libid3tag]) +AC_SUBST(LIBID3TAG_LIBS) + +LDFLAGS_SAVE="$LDFLAGS" +for dir in "" /usr/local $SEARCH_DIR; do + if test -n "$dir"; then + LDFLAGS="$LDFLAGS -L$dir/lib" + fi + AC_CHECK_LIB([sqlite3], [sqlite3_open], [LIBSQLITE3_LIBS="-lsqlite3"], [unset ac_cv_lib_sqlite3_sqlite3_open; LDFLAGS="$LDFLAGS_SAVE"; continue]) + break +done +test x"$ac_cv_lib_sqlite3_sqlite3_open" = x"yes" || AC_MSG_ERROR([Could not find libsqlite3]) +AC_SUBST(LIBSQLITE3_LIBS) + +LDFLAGS_SAVE="$LDFLAGS" +for dir in "" /usr/local $SEARCH_DIR; do + if test -n "$dir"; then + LDFLAGS="$LDFLAGS -L$dir/lib" + fi + AC_CHECK_LIB([avformat], [av_open_input_file], [LIBAVFORMAT_LIBS="-lavformat"], [unset ac_cv_lib_avformat_av_open_input_file; LDFLAGS="$LDFLAGS_SAVE"; continue]) + AC_SUBST(LIBJPEG_LIBS) + break +done +test x"$ac_cv_lib_avformat_av_open_input_file" = x"yes" || AC_MSG_ERROR([Could not find libavformat - part of ffmpeg]) +AC_SUBST(LIBAVFORMAT_LIBS) + +AC_CHECK_LIB(avutil ,[av_rescale_q], [LIBAVUTIL_LIBS="-lavutil"], [AC_MSG_ERROR([Could not find libavutil - part of ffmpeg])]) +AC_SUBST(LIBAVUTIL_LIBS) + +AC_CHECK_LIB(avcodec ,[avcodec_init], [LIBAVCODEC_LIBS="-lavcodec"], [AC_MSG_ERROR([Could not find libavcodec - part of ffmpeg])]) +AC_SUBST(LIBAVCODEC_LIBS) + +AC_CHECK_LIB(pthread, pthread_create) + +# test if we have vorbisfile +# prior versions had ov_open_callbacks in libvorbis, test that, too. +AC_CHECK_LIB(vorbisfile, ov_open_callbacks, + [AC_CHECK_HEADERS([vorbis/vorbisfile.h], + AM_CONDITIONAL(HAVE_VORBISFILE, true) + AC_DEFINE(HAVE_VORBISFILE,1,[Have vorbisfile]), + AM_CONDITIONAL(HAVE_VORBISFILE, false) + AC_DEFINE(HAVE_VORBISFILE,0,[lacking vorbisfile]))], + AM_CONDITIONAL(HAVE_VORBISFILE, false), + -lvorbis -logg) +AC_CHECK_LIB(FLAC, FLAC__stream_decoder_init_stream, + [AC_CHECK_HEADERS([FLAC/all.h], + AM_CONDITIONAL(HAVE_FLAC, true) + AC_DEFINE(HAVE_FLAC,1,[Have flac]), + AM_CONDITIONAL(HAVE_FLAC, false))], + AM_CONDITIONAL(HAVE_FLAC, false), + -logg) +# test without -logg to see whether we really need it (libflac can be without) +AC_CHECK_LIB(FLAC, FLAC__stream_decoder_init_ogg_stream, + AM_CONDITIONAL(HAVE_FLAC, true) + AC_DEFINE(HAVE_FLAC,1,[Have flac]) + AM_CONDITIONAL(NEED_OGG, false), + [AM_CONDITIONAL(NEED_OGG, true)]) +AC_CHECK_LIB(vorbisfile, vorbis_comment_query, + AM_CONDITIONAL(NEED_VORBIS, false), + AM_CONDITIONAL(NEED_VORBIS, true), + -logg) + +################################################################################################################ +### Header checks + +#AC_HEADER_CHECK(libintl.h, AC_DEFINE([ENABLE_NLS], [1], [Define to use NLS])) +AC_HEADER_CHECK(inotify.h, AC_DEFINE([HAVE_INOTIFY_H], [1], [Define to enable inotify])) + +# Checks for header files. (From autoscan) +AC_CHECK_HEADERS([arpa/inet.h endian.h machine/endian.h fcntl.h libintl.h locale.h netdb.h netinet/in.h stddef.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h]) + +################################################################################################################ +### Build Options + +AC_ARG_WITH(logpath, + AS_HELP_STRING([--with-log-path],[Log path]), + [with_logpath="$withval"],[with_logpath="/var/log"]) +AC_DEFINE_UNQUOTED([DEFAULT_LOG_PATH],"${with_logpath}",[Log path]) + + +AC_ARG_WITH(dbpath, + AS_HELP_STRING([--with-db-path],[DB path]), + [with_dbpath="$withval"],[with_dbpath="/var/cache/minidlna"]) +AC_DEFINE_UNQUOTED([DEFAULT_DB_PATH],"${with_dbpath}",[DB path]) + +AC_ARG_WITH(osname, + AS_HELP_STRING([--with-os-name],[OS Name]), + [with_osname="$withval"],[with_osname="$(uname -s)"]) +AC_DEFINE_UNQUOTED([OS_NAME],"${with_osname}",[OS Name]) + +AC_ARG_WITH(osver, + AS_HELP_STRING([--with-os-version],[OS Version]), + [with_osver="$withval"],[with_osver="$(uname -r)"]) +AC_DEFINE_UNQUOTED([OS_VERSION],"${with_osver}",[OS Version]) + +AC_ARG_WITH(osurl, + AS_HELP_STRING([--with-os-url],[OS URL]), + [with_osurl="$withval"],[with_osurl="http://www.netgear.com"]) +AC_DEFINE_UNQUOTED([OS_URL],"${with_osurl}",[OS URL]) + +AC_ARG_WITH(tivo, + AS_HELP_STRING([--with-tivo],[TiVo Support]), + [with_tivo="$withval"],[with_tivo="yes"]) +if test "$with_tivo" = "yes"; then + AC_DEFINE([TIVO_SUPPORT],[1],[Define to 1 if you want to enable TiVo support]) +fi + +AC_ARG_WITH(netgear, + AS_HELP_STRING([--with-netgear],[NETGEAR ReadyNAS Support]), + [with_netgear="$withval"],[with_netgear="no"]) +if test "$with_netgear" = "yes"; then + AC_DEFINE([NETGEAR],[1],[Define to 1 if you want to enable NETGEAR support]) + AC_DEFINE([READYNAS],[1],[Define to 1 if you want to enable NETGEAR support]) + AC_DEFINE([PNPX],[5],[Define to 1 if you want to enable NETGEAR support]) + AC_DEFINE_UNQUOTED([OS_URL],"http://www.readynas.com/",[OS URL]) +fi + +AC_ARG_WITH(staticbin, + AS_HELP_STRING([--with-staticbin],[Build statically linked binaries]), + [with_staticbin="$withval"],[with_staticbin="no"]) +if test "$with_staticbin" = "yes"; then + STATIC_CFLAGS="-DSTATIC" + AC_SUBST(STATIC_CFLAGS) + STATIC_LDFLAGS="-Wl,-Bstatic" + AC_SUBST(STATIC_LDFLAGS) +fi + +case "$target_os" in + darwin*) + ;; + freebsd*) + VER=`grep '#define __FreeBSD_version' /usr/include/sys/param.h | awk '{print $3}'` + OS_URL=http://www.freebsd.org/ + ;; + solaris*) + AC_DEFINE([USE_IPF], [1], [Define to enable IPF]) + AC_DEFINE([LOG_PERROR], [0], [Define to enable logging]) + AC_DEFINE([SOLARIS_KSTATS], [1], [Define to enable Solaris Kernel Stats]) + ;; + kfreebsd*) + OS_URL=http://www.debian.org/ + ;; + linux*) + ;; + *) + echo "Unknown OS : $target_os" + ;; +esac + + +AC_OUTPUT([ po/Makefile.in +Makefile +]) diff --git a/daemonize.c b/daemonize.c index 9a10276..944f8f1 100644 --- a/daemonize.c +++ b/daemonize.c @@ -94,7 +94,7 @@ writepidfile(const char * fname, int pid) int pidstringlen; int pidfile; - if(!fname || (strlen(fname) == 0)) + if(!fname || *fname == '\0') return -1; if( (pidfile = open(fname, O_WRONLY|O_CREAT, 0644)) < 0) @@ -129,7 +129,7 @@ checkforrunning(const char * fname) int pidfile; pid_t pid; - if(!fname || (strlen(fname) == 0)) + if(!fname || *fname == '\0') return -1; if( (pidfile = open(fname, O_RDONLY)) < 0) diff --git a/genconfig.sh b/genconfig.sh deleted file mode 100755 index ea933fd..0000000 --- a/genconfig.sh +++ /dev/null @@ -1,215 +0,0 @@ -#! /bin/sh -# $Id$ -# MiniDLNA project -# http://sourceforge.net/projects/minidlna/ -# -# MiniDLNA media server -# Copyright (C) 2008-2009 Justin Maggard -# -# This file is part of MiniDLNA. -# -# MiniDLNA is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# MiniDLNA 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 MiniDLNA. If not, see . - -RM="rm -f" -CONFIGFILE="config.h" -CONFIGMACRO="__CONFIG_H__" - -# Database path -DB_PATH="/tmp/minidlna" -# Log path -LOG_PATH="${DB_PATH}" - -# detecting the OS name and version -OS_NAME=`uname -s` -OS_VERSION=`uname -r` -TIVO="/*#define TIVO_SUPPORT*/" -NETGEAR="/*#define NETGEAR*/" -READYNAS="/*#define READYNAS*/" -PNPX="#define PNPX 0" - -${RM} ${CONFIGFILE} - -# Detect if there are missing headers -# NOTE: This check only works with a normal distro -[ ! -e "/usr/include/sqlite3.h" ] && MISSING="libsqlite3 $MISSING" -[ ! -e "/usr/include/jpeglib.h" ] && MISSING="libjpeg $MISSING" -[ ! -e "/usr/include/libexif/exif-loader.h" ] && MISSING="libexif $MISSING" -[ ! -e "/usr/include/id3tag.h" ] && MISSING="libid3tag $MISSING" -[ ! -e "/usr/include/ogg/ogg.h" ] && MISSING="libogg $MISSING" -[ ! -e "/usr/include/vorbis/codec.h" ] && MISSING="libvorbis $MISSING" -[ ! -e "/usr/include/FLAC/metadata.h" ] && MISSING="libflac $MISSING" -[ ! -e "/usr/include/ffmpeg/avutil.h" -a \ - ! -e "/usr/include/libavutil/avutil.h" -a \ - ! -e "/usr/include/ffmpeg/libavutil/avutil.h" ] && MISSING="libavutil $MISSING" -[ ! -e "/usr/include/ffmpeg/avformat.h" -a \ - ! -e "/usr/include/libavformat/avformat.h" -a \ - ! -e "/usr/include/ffmpeg/libavformat/avformat.h" ] && MISSING="libavformat $MISSING" -[ ! -e "/usr/include/ffmpeg/avcodec.h" -a \ - ! -e "/usr/include/libavcodec/avcodec.h" -a \ - ! -e "/usr/include/ffmpeg/libavcodec/avcodec.h" ] && MISSING="libavcodec $MISSING" -if [ -n "$MISSING" ]; then - echo -e "\nERROR! Cannot continue." - echo -e "The following required libraries are either missing, or are missing development headers:\n" - echo -e "$MISSING\n" - exit 1 -fi - -echo "/* MiniDLNA Project" >> ${CONFIGFILE} -echo " * http://sourceforge.net/projects/minidlna/" >> ${CONFIGFILE} -echo " * (c) 2008-2009 Justin Maggard" >> ${CONFIGFILE} -echo " * generated by $0 on `date` */" >> ${CONFIGFILE} -echo "#ifndef $CONFIGMACRO" >> ${CONFIGFILE} -echo "#define $CONFIGMACRO" >> ${CONFIGFILE} -echo "" >> ${CONFIGFILE} - -# OS Specific stuff -case $OS_NAME in - OpenBSD) - MAJORVER=`echo $OS_VERSION | cut -d. -f1` - MINORVER=`echo $OS_VERSION | cut -d. -f2` - #echo "OpenBSD majorversion=$MAJORVER minorversion=$MINORVER" - # rtableid was introduced in OpenBSD 4.0 - if [ $MAJORVER -ge 4 ]; then - echo "#define PFRULE_HAS_RTABLEID" >> ${CONFIGFILE} - fi - # from the 3.8 version, packets and bytes counters are double : in/out - if [ \( $MAJORVER -ge 4 \) -o \( $MAJORVER -eq 3 -a $MINORVER -ge 8 \) ]; then - echo "#define PFRULE_INOUT_COUNTS" >> ${CONFIGFILE} - fi - OS_URL=http://www.openbsd.org/ - ;; - FreeBSD) - VER=`grep '#define __FreeBSD_version' /usr/include/sys/param.h | awk '{print $3}'` - if [ $VER -ge 700049 ]; then - echo "#define PFRULE_INOUT_COUNTS" >> ${CONFIGFILE} - fi - OS_URL=http://www.freebsd.org/ - ;; - pfSense) - # we need to detect if PFRULE_INOUT_COUNTS macro is needed - OS_URL=http://www.pfsense.com/ - ;; - NetBSD) - OS_URL=http://www.netbsd.org/ - ;; - SunOS) - echo "#define USE_IPF 1" >> ${CONFIGFILE} - echo "#define LOG_PERROR 0" >> ${CONFIGFILE} - echo "#define SOLARIS_KSTATS 1" >> ${CONFIGFILE} - echo "typedef uint64_t u_int64_t;" >> ${CONFIGFILE} - echo "typedef uint32_t u_int32_t;" >> ${CONFIGFILE} - echo "typedef uint16_t u_int16_t;" >> ${CONFIGFILE} - echo "typedef uint8_t u_int8_t;" >> ${CONFIGFILE} - OS_URL=http://www.sun.com/solaris/ - ;; - Linux) - OS_URL=http://www.kernel.org/ - KERNVERA=`echo $OS_VERSION | awk -F. '{print $1}'` - KERNVERB=`echo $OS_VERSION | awk -F. '{print $2}'` - KERNVERC=`echo $OS_VERSION | awk -F. '{print $3}'` - KERNVERD=`echo $OS_VERSION | awk -F. '{print $4}'` - #echo "$KERNVERA.$KERNVERB.$KERNVERC.$KERNVERD" - # NETGEAR ReadyNAS special case - if [ -f /etc/raidiator_version ]; then - OS_NAME=$(awk -F'!!|=' '{ print $1 }' /etc/raidiator_version) - OS_VERSION=$(awk -F'!!|[=,.]' '{ print $3"."$4 }' /etc/raidiator_version) - OS_URL="http://www.readynas.com/" - LOG_PATH="/var/log" - DB_PATH="/var/cache/minidlna" - TIVO="#define TIVO_SUPPORT" - NETGEAR="#define NETGEAR" - READYNAS="#define READYNAS" - PNPX="#define PNPX 5" - # Debian GNU/Linux special case - elif [ -f /etc/debian_version ]; then - OS_NAME=Debian - OS_VERSION=`cat /etc/debian_version` - OS_URL=http://www.debian.org/ - LOG_PATH="/var/log" - # use lsb_release (Linux Standard Base) when available - LSB_RELEASE=`which lsb_release 2>/dev/null` - if [ 0 -eq $? ]; then - OS_NAME=`${LSB_RELEASE} -i -s` - OS_VERSION=`${LSB_RELEASE} -r -s` - fi - else - # use lsb_release (Linux Standard Base) when available - LSB_RELEASE=`which lsb_release 2>/dev/null` - if [ 0 -eq $? ]; then - OS_NAME=`${LSB_RELEASE} -i -s` - OS_VERSION=`${LSB_RELEASE} -r -s` - fi - fi - ;; - *) - echo "Unknown OS : $OS_NAME" - exit 1 - ;; -esac - -echo "#define OS_NAME \"$OS_NAME\"" >> ${CONFIGFILE} -echo "#define OS_VERSION \"$OS_NAME/$OS_VERSION\"" >> ${CONFIGFILE} -echo "#define OS_URL \"${OS_URL}\"" >> ${CONFIGFILE} -echo "" >> ${CONFIGFILE} - -echo "/* full path of the file database */" >> ${CONFIGFILE} -echo "#define DEFAULT_DB_PATH \"${DB_PATH}\"" >> ${CONFIGFILE} -echo "" >> ${CONFIGFILE} - -echo "/* full path of the log directory */" >> ${CONFIGFILE} -echo "#define DEFAULT_LOG_PATH \"${LOG_PATH}\"" >> ${CONFIGFILE} -echo "" >> ${CONFIGFILE} - -echo "/* Comment the following line to use home made daemonize() func instead" >> ${CONFIGFILE} -echo " * of BSD daemon() */" >> ${CONFIGFILE} -echo "#define USE_DAEMON" >> ${CONFIGFILE} -echo "" >> ${CONFIGFILE} - -echo "/* Enable if the system inotify.h exists. Otherwise our own inotify.h will be used. */" >> ${CONFIGFILE} -if [ -f /usr/include/sys/inotify.h ]; then -echo "#define HAVE_INOTIFY_H" >> ${CONFIGFILE} -else -echo "/*#define HAVE_INOTIFY_H*/" >> ${CONFIGFILE} -fi -echo "" >> ${CONFIGFILE} - -echo "/* Enable if the system iconv.h exists. ID3 tag reading in various character sets will not work properly otherwise. */" >> ${CONFIGFILE} -if [ -f /usr/include/iconv.h ]; then -echo "#define HAVE_ICONV_H" >> ${CONFIGFILE} -else -echo -e "\nWARNING!! Iconv support not found. ID3 tag reading may not work." -echo "/*#define HAVE_ICONV_H*/" >> ${CONFIGFILE} -fi -echo "" >> ${CONFIGFILE} - -echo "/* Enable if the system libintl.h exists for NLS support. */" >> ${CONFIGFILE} -if [ -f /usr/include/libintl.h ]; then -echo "#define ENABLE_NLS" >> ${CONFIGFILE} -else -echo "/*#define ENABLE_NLS*/" >> ${CONFIGFILE} -fi -echo "" >> ${CONFIGFILE} - -echo "/* Enable NETGEAR-specific tweaks. */" >> ${CONFIGFILE} -echo "${NETGEAR}" >> ${CONFIGFILE} -echo "/* Enable ReadyNAS-specific tweaks. */" >> ${CONFIGFILE} -echo "${READYNAS}" >> ${CONFIGFILE} -echo "/* Compile in TiVo support. */" >> ${CONFIGFILE} -echo "${TIVO}" >> ${CONFIGFILE} -echo "/* Enable PnPX support. */" >> ${CONFIGFILE} -echo "${PNPX}" >> ${CONFIGFILE} -echo "" >> ${CONFIGFILE} - -echo "#endif" >> ${CONFIGFILE} - -exit 0 diff --git a/getifaddr.c b/getifaddr.c index f0cbdfc..4aeb92b 100644 --- a/getifaddr.c +++ b/getifaddr.c @@ -1,4 +1,4 @@ -/* $Id: getifaddr.c,v 1.14 2011/05/02 23:50:52 jmaggard Exp $ */ +/* $Id$ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * @@ -43,19 +43,82 @@ #include #endif +#include "config.h" +#if HAVE_GETIFADDRS +#include +#ifdef __linux__ +#ifndef AF_LINK +#define AF_LINK AF_INET +#endif +#else +#include +#endif +#endif #include "getifaddr.h" #include "log.h" +static uint32_t +get_netmask(struct sockaddr_in *netmask) +{ + uint32_t mask; + int i; + + if (!netmask) + return 0; + mask = ntohl(netmask->sin_addr.s_addr); + for (i = 0; i < 32; i++) + { + if ((mask >> i) & 1) + break; + } + mask = 32 - i; + + return mask; +} + int getifaddr(const char * ifname, char * buf, int len) { /* SIOCGIFADDR struct ifreq * */ + uint32_t mask = 0; + int i; +#if HAVE_GETIFADDRS + struct ifaddrs *ifap, *p; + struct sockaddr_in *addr_in; + + if( getifaddrs(&ifap) != 0 ) + { + DPRINTF(E_ERROR, L_GENERAL, "getifaddrs(): %s\n", strerror(errno)); + return -1; + } + for( p = ifap; p != NULL; p = p->ifa_next ) + { + if( p->ifa_addr->sa_family == AF_INET ) + { + if( strcmp(p->ifa_name, ifname) != 0 ) + continue; + addr_in = (struct sockaddr_in *)p->ifa_addr; + if(!inet_ntop(AF_INET, &addr_in->sin_addr, buf, len)) + { + DPRINTF(E_ERROR, L_GENERAL, "inet_ntop(): %s\n", strerror(errno)); + break; + } + addr_in = (struct sockaddr_in *)p->ifa_netmask; + mask = get_netmask(addr_in); + break; + } + } + freeifaddrs(ifap); + if( !p ) + { + DPRINTF(E_ERROR, L_GENERAL, "Network interface %s not found\n", ifname); + return -1; + } +#else int s; struct ifreq ifr; int ifrlen; struct sockaddr_in * addr; - uint32_t mask; - int i; ifrlen = sizeof(ifr); s = socket(PF_INET, SOCK_DGRAM, 0); @@ -81,22 +144,17 @@ getifaddr(const char * ifname, char * buf, int len) if(ioctl(s, SIOCGIFNETMASK, &ifr, &ifrlen) == 0) { addr = (struct sockaddr_in *)&ifr.ifr_netmask; - mask = ntohl(addr->sin_addr.s_addr); - for (i = 0; i < 32; i++) - { - if ((mask >> i) & 1) - break; - } - mask = 32 - i; - if (mask) - { - i = strlen(buf); - snprintf(buf+i, len-i, "/%u", mask); - } + mask = get_netmask(addr); } else DPRINTF(E_ERROR, L_GENERAL, "ioctl(s, SIOCGIFNETMASK, ...): %s\n", strerror(errno)); close(s); +#endif + if (mask) + { + i = strlen(buf); + snprintf(buf+i, len-i, "/%u", mask); + } return 0; } @@ -104,12 +162,42 @@ int getsysaddr(char * buf, int len) { int i; + uint32_t mask = 0; + int ret = -1; +#if HAVE_GETIFADDRS + struct ifaddrs *ifap, *p; + struct sockaddr_in *addr_in; + uint8_t a; + + if( getifaddrs(&ifap) != 0 ) + { + DPRINTF(E_ERROR, L_GENERAL, "getifaddrs(): %s\n", strerror(errno)); + return -1; + } + for( p = ifap; p != NULL; p = p->ifa_next ) + { + if (p->ifa_addr->sa_family == AF_INET) + { + addr_in = (struct sockaddr_in *)p->ifa_addr; + a = (htonl(addr_in->sin_addr.s_addr) >> 0x18) & 0xFF; + if( a == 127 ) + continue; + if(!inet_ntop(AF_INET, &addr_in->sin_addr, buf, len)) + { + DPRINTF(E_ERROR, L_GENERAL, "inet_ntop(): %s\n", strerror(errno)); + break; + } + addr_in = (struct sockaddr_in *)p->ifa_netmask; + mask = get_netmask(addr_in); + ret = 0; + break; + } + } + freeifaddrs(ifap); +#else int s = socket(PF_INET, SOCK_STREAM, 0); struct sockaddr_in addr; struct ifreq ifr; - uint32_t mask; - int ret = -1; - for (i=1; i > 0; i++) { ifr.ifr_ifindex = i; @@ -128,24 +216,19 @@ getsysaddr(char * buf, int len) close(s); break; } - ret = 0; - memcpy(&addr, &ifr.ifr_netmask, sizeof(addr)); - mask = ntohl(addr.sin_addr.s_addr); - for (i = 0; i < 32; i++) - { - if ((mask >> i) & 1) - break; - } - mask = 32 - i; - if (mask) - { - i = strlen(buf); - snprintf(buf+i, len-i, "/%u", mask); - } + mask = get_netmask(&addr); + ret = 0; break; } close(s); +#endif + + if (mask) + { + i = strlen(buf); + snprintf(buf+i, len-i, "/%u", mask); + } return(ret); } @@ -153,11 +236,55 @@ getsysaddr(char * buf, int len) int getsyshwaddr(char * buf, int len) { - struct if_nameindex *ifaces, *if_idx; unsigned char mac[6]; + int ret = -1; +#if HAVE_GETIFADDRS + struct ifaddrs *ifap, *p; + struct sockaddr_in *addr_in; + uint8_t a; + + if( getifaddrs(&ifap) != 0 ) + { + DPRINTF(E_ERROR, L_GENERAL, "getifaddrs(): %s\n", strerror(errno)); + return -1; + } + for( p = ifap; p != NULL; p = p->ifa_next ) + { + if (p->ifa_addr->sa_family == AF_LINK) + { + addr_in = (struct sockaddr_in *)p->ifa_addr; + a = (htonl(addr_in->sin_addr.s_addr) >> 0x18) & 0xFF; + if( a == 127 ) + continue; +#ifdef __linux__ + struct ifreq ifr; + int fd; + fd = socket(AF_INET, SOCK_DGRAM, 0); + if( fd < 0 ) + continue; + strncpy(ifr.ifr_name, p->ifa_name, IFNAMSIZ); + if( ioctl(fd, SIOCGIFHWADDR, &ifr) < 0 ) + { + close(fd); + continue; + } + memcpy(mac, ifr.ifr_hwaddr.sa_data, 6); +#else + struct sockaddr_dl *sdl; + sdl = (struct sockaddr_dl*)p->ifa_addr; + memcpy(mac, LLADDR(sdl), sdl->sdl_alen); +#endif + if( MACADDR_IS_ZERO(mac) ) + continue; + ret = 0; + break; + } + } + freeifaddrs(ifap); +#else + struct if_nameindex *ifaces, *if_idx; struct ifreq ifr; int fd; - int ret = -1; memset(&mac, '\0', sizeof(mac)); /* Get the spatially unique node identifier */ @@ -180,25 +307,21 @@ getsyshwaddr(char * buf, int len) continue; if( MACADDR_IS_ZERO(ifr.ifr_hwaddr.sa_data) ) continue; + memcpy(mac, ifr.ifr_hwaddr.sa_data, 6); ret = 0; break; } if_freenameindex(ifaces); close(fd); - +#endif if(ret == 0) { if(len > 12) - { - memmove(mac, ifr.ifr_hwaddr.sa_data, 6); sprintf(buf, "%02x%02x%02x%02x%02x%02x", mac[0]&0xFF, mac[1]&0xFF, mac[2]&0xFF, mac[3]&0xFF, mac[4]&0xFF, mac[5]&0xFF); - } else if(len == 6) - { - memmove(buf, ifr.ifr_hwaddr.sa_data, 6); - } + memmove(buf, mac, 6); } return ret; } diff --git a/image_utils.c b/image_utils.c index c6b9abd..2135e3d 100644 --- a/image_utils.c +++ b/image_utils.c @@ -26,6 +26,7 @@ * The resize functions come from the resize_image project, at http://www.golac.fr/Image-Resizer */ +#include "config.h" #include #include #include @@ -33,7 +34,11 @@ #include #include #include +#ifdef HAVE_MACHINE_ENDIAN_H +#include +#else #include +#endif #include "upnpreplyparse.h" #include "image_utils.h" @@ -380,8 +385,7 @@ image_get_jpeg_date_xmp(const char * path, char ** date) } } fclose(img); - if( data ) - free(data); + free(data); return ret; } @@ -463,8 +467,7 @@ image_new_from_jpeg(const char * path, int is_file, const char * buf, int size, fclose(file); if( vimage ) { - if( vimage->buf ) - free(vimage->buf); + free(vimage->buf); free(vimage); } return NULL; diff --git a/inotify.c b/inotify.c index 13074fc..6ed4da5 100644 --- a/inotify.c +++ b/inotify.c @@ -16,6 +16,8 @@ * along with MiniDLNA. If not, see . */ #include "config.h" + +#ifdef HAVE_INOTIFY #include #include #include @@ -216,8 +218,7 @@ inotify_remove_watches(int fd) { last_w = w; inotify_rm_watch(fd, w->wd); - if( w->path ) - free(w->path); + free(w->path); rm_watches++; w = w->next; free(last_w); @@ -729,3 +730,4 @@ quitting: return 0; } +#endif diff --git a/inotify.h b/inotify.h index 91db6f6..0f378c2 100644 --- a/inotify.h +++ b/inotify.h @@ -1,6 +1,7 @@ - +#ifdef HAVE_INOTIFY int inotify_remove_file(const char * path); void * start_inotify(); +#endif diff --git a/metadata.c b/metadata.c index 0f698d0..248868a 100644 --- a/metadata.c +++ b/metadata.c @@ -19,21 +19,61 @@ #include #include #include -#include - +#include #include -#include #include +#include +#include #include +#include "config.h" #include #include "image_utils.h" +#include "tagutils/tagutils.h" #include #include + +#if HAVE_FFMPEG_LIBAVUTIL_AVUTIL_H +#include +#elif HAVE_LIBAV_LIBAVUTIL_AVUTIL_H +#include +#elif HAVE_LIBAVUTIL_AVUTIL_H +#include +#elif HAVE_FFMPEG_AVUTIL_H +#include +#elif HAVE_LIBAV_AVUTIL_H +#include +#elif HAVE_AVUTIL_H #include +#endif + +#if HAVE_FFMPEG_LIBAVCODEC_AVCODEC_H +#include +#elif HAVE_LIBAV_LIBAVCODEC_AVCODEC_H +#include +#elif HAVE_LIBAVCODEC_AVCODEC_H +#include +#elif HAVE_FFMPEG_AVCODEC_H +#include +#elif HAVE_LIBAV_AVCODEC_H +#include +#elif HAVE_AVCODEC_H #include +#endif + +#if HAVE_FFMPEG_LIBAVFORMAT_AVFORMAT_H +#include +#elif HAVE_LIBAV_LIBAVFORMAT_AVFORMAT_H +#include +#elif HAVE_LIBAVFORMAT_AVFORMAT_H +#include +#elif HAVE_FFMPEG_AVFORMAT_H +#include +#elif HAVE_LIBAV_LIBAVFORMAT_H +#include +#elif HAVE_AVFORMAT_H #include -#include "tagutils/tagutils.h" +#endif #include "upnpglobalvars.h" #include "upnpreplyparse.h" @@ -150,7 +190,7 @@ is_tivo_file(const char * path) void check_for_captions(const char * path, sqlite_int64 detailID) { - char *file = malloc(PATH_MAX); + char *file = malloc(MAXPATHLEN); char *id = NULL; sprintf(file, "%s", path); @@ -655,10 +695,11 @@ GetVideoMetadata(const char * path, char * name) enum audio_profiles audio_profile = PROFILE_AUDIO_UNKNOWN; char fourcc[4]; sqlite_int64 album_art = 0; - char nfo[PATH_MAX], *ext; + char nfo[MAXPATHLEN], *ext; struct song_metadata video; metadata_t m; uint32_t free_flags = 0xFFFFFFFF; + char *path_cpy, *basepath; memset(&m, '\0', sizeof(m)); memset(&video, '\0', sizeof(video)); @@ -698,12 +739,15 @@ GetVideoMetadata(const char * path, char * name) continue; } } - /* This must not be a video file. */ + path_cpy = strdup(path); + basepath = basename(path_cpy); if( !vc ) { + /* This must not be a video file. */ av_close_input_file(ctx); if( !is_audio(path) ) - DPRINTF(E_DEBUG, L_METADATA, "File %s does not contain a video stream.\n", basename(path)); + DPRINTF(E_DEBUG, L_METADATA, "File %s does not contain a video stream.\n", basepath); + free(path_cpy); return 0; } @@ -819,7 +863,7 @@ GetVideoMetadata(const char * path, char * name) int off; int duration, hours, min, sec, ms; ts_timestamp_t ts_timestamp = NONE; - DPRINTF(E_DEBUG, L_METADATA, "Container: '%s' [%s]\n", ctx->iformat->name, basename(path)); + DPRINTF(E_DEBUG, L_METADATA, "Container: '%s' [%s]\n", ctx->iformat->name, basepath); asprintf(&m.resolution, "%dx%d", vc->width, vc->height); if( ctx->bit_rate > 8 ) asprintf(&m.bitrate, "%u", ctx->bit_rate / 8); @@ -880,7 +924,7 @@ GetVideoMetadata(const char * path, char * name) int raw_packet_size; int dlna_ts_present = dlna_timestamp_is_present(path, &raw_packet_size); DPRINTF(E_DEBUG, L_METADATA, "Stream %d of %s is %s MPEG2 TS packet size %d\n", - video_stream, basename(path), m.resolution, raw_packet_size); + video_stream, basepath, m.resolution, raw_packet_size); off += sprintf(m.dlna_pn+off, "TS_"); if( (vc->width >= 1280) && (vc->height >= 720) ) @@ -906,7 +950,7 @@ GetVideoMetadata(const char * path, char * name) else if( raw_packet_size != MPEG_TS_PACKET_LENGTH ) { DPRINTF(E_DEBUG, L_METADATA, "Unsupported DLNA TS packet size [%d] (%s)\n", - raw_packet_size, basename(path)); + raw_packet_size, basepath); free(m.dlna_pn); m.dlna_pn = NULL; } @@ -928,7 +972,7 @@ GetVideoMetadata(const char * path, char * name) else if( strcmp(ctx->iformat->name, "mpeg") == 0 ) { DPRINTF(E_DEBUG, L_METADATA, "Stream %d of %s is %s MPEG2 PS\n", - video_stream, basename(path), m.resolution); + video_stream, basepath, m.resolution); off += sprintf(m.dlna_pn+off, "PS_"); if( (vc->height == 576) || (vc->height == 288) ) @@ -940,7 +984,7 @@ GetVideoMetadata(const char * path, char * name) else { DPRINTF(E_DEBUG, L_METADATA, "Stream %d of %s [%s] is %s non-DLNA MPEG2\n", - video_stream, basename(path), ctx->iformat->name, m.resolution); + video_stream, basepath, ctx->iformat->name, m.resolution); free(m.dlna_pn); m.dlna_pn = NULL; } @@ -1019,7 +1063,7 @@ GetVideoMetadata(const char * path, char * name) vc->profile != FF_PROFILE_H264_MAIN ) { DPRINTF(E_DEBUG, L_METADATA, "Unknown AVC profile %d; assuming MP. [%s]\n", - vc->profile, basename(path)); + vc->profile, basepath); } if( vc->width <= 720 && vc->height <= 576 && @@ -1036,7 +1080,7 @@ GetVideoMetadata(const char * path, char * name) else { DPRINTF(E_DEBUG, L_METADATA, "Unsupported h.264 video profile! [%s, %dx%d, %dbps : %s]\n", - m.dlna_pn, vc->width, vc->height, vc->bit_rate, basename(path)); + m.dlna_pn, vc->width, vc->height, vc->bit_rate, basepath); free(m.dlna_pn); m.dlna_pn = NULL; } @@ -1053,7 +1097,7 @@ GetVideoMetadata(const char * path, char * name) else { DPRINTF(E_DEBUG, L_METADATA, "Unsupported h.264 HP video profile! [%dbps, %d audio : %s]\n", - vc->bit_rate, audio_profile, basename(path)); + vc->bit_rate, audio_profile, basepath); free(m.dlna_pn); m.dlna_pn = NULL; } @@ -1077,7 +1121,7 @@ GetVideoMetadata(const char * path, char * name) break; default: DPRINTF(E_DEBUG, L_METADATA, "No DLNA profile found for %s file [%s]\n", - m.dlna_pn, basename(path)); + m.dlna_pn, basepath); free(m.dlna_pn); m.dlna_pn = NULL; break; @@ -1095,7 +1139,7 @@ GetVideoMetadata(const char * path, char * name) else if( raw_packet_size != MPEG_TS_PACKET_LENGTH ) { DPRINTF(E_DEBUG, L_METADATA, "Unsupported DLNA TS packet size [%d] (%s)\n", - raw_packet_size, basename(path)); + raw_packet_size, basepath); free(m.dlna_pn); m.dlna_pn = NULL; } @@ -1223,7 +1267,7 @@ GetVideoMetadata(const char * path, char * name) if( strlen(m.dlna_pn) <= 11 ) { DPRINTF(E_DEBUG, L_METADATA, "No DLNA profile found for %s file %s\n", - m.dlna_pn, basename(path)); + m.dlna_pn, basepath); free(m.dlna_pn); m.dlna_pn = NULL; } @@ -1239,7 +1283,7 @@ GetVideoMetadata(const char * path, char * name) break; default: DPRINTF(E_DEBUG, L_METADATA, "AVC profile [%d] not recognized for file %s\n", - vc->profile, basename(path)); + vc->profile, basepath); free(m.dlna_pn); m.dlna_pn = NULL; break; @@ -1252,7 +1296,7 @@ GetVideoMetadata(const char * path, char * name) } if( m.dlna_pn ) sprintf(m.dlna_pn+off, ";%s", dlna_no_conv); - DPRINTF(E_DEBUG, L_METADATA, "Stream %d of %s is h.264\n", video_stream, basename(path)); + DPRINTF(E_DEBUG, L_METADATA, "Stream %d of %s is h.264\n", video_stream, basepath); break; case CODEC_ID_MPEG4: fourcc[0] = vc->codec_tag & 0xff; @@ -1260,7 +1304,7 @@ GetVideoMetadata(const char * path, char * name) fourcc[2] = vc->codec_tag>>16 & 0xff; fourcc[3] = vc->codec_tag>>24 & 0xff; DPRINTF(E_DEBUG, L_METADATA, "Stream %d of %s is MPEG4 [%c%c%c%c/0x%X]\n", - video_stream, basename(path), + video_stream, basepath, isprint(fourcc[0]) ? fourcc[0] : '_', isprint(fourcc[1]) ? fourcc[1] : '_', isprint(fourcc[2]) ? fourcc[2] : '_', @@ -1285,7 +1329,7 @@ GetVideoMetadata(const char * path, char * name) break; default: DPRINTF(E_DEBUG, L_METADATA, "No DLNA profile found for MPEG4-P2 3GP/0x%X file %s\n", - ac->codec_id, basename(path)); + ac->codec_id, basepath); free(m.dlna_pn); m.dlna_pn = NULL; break; @@ -1336,7 +1380,7 @@ GetVideoMetadata(const char * path, char * name) } m.dlna_pn = malloc(64); off = sprintf(m.dlna_pn, "WMV"); - DPRINTF(E_DEBUG, L_METADATA, "Stream %d of %s is VC1\n", video_stream, basename(path)); + DPRINTF(E_DEBUG, L_METADATA, "Stream %d of %s is VC1\n", video_stream, basepath); asprintf(&m.mime, "video/x-ms-wmv"); if( (vc->width <= 176) && (vc->height <= 144) && @@ -1353,7 +1397,7 @@ GetVideoMetadata(const char * path, char * name) break; default: DPRINTF(E_DEBUG, L_METADATA, "No DLNA profile found for WMVSPLL/0x%X file %s\n", - audio_profile, basename(path)); + audio_profile, basepath); free(m.dlna_pn); m.dlna_pn = NULL; break; @@ -1375,7 +1419,7 @@ GetVideoMetadata(const char * path, char * name) break; default: DPRINTF(E_DEBUG, L_METADATA, "No DLNA profile found for WMVSPML/0x%X file %s\n", - audio_profile, basename(path)); + audio_profile, basepath); free(m.dlna_pn); m.dlna_pn = NULL; break; @@ -1399,7 +1443,7 @@ GetVideoMetadata(const char * path, char * name) break; default: DPRINTF(E_DEBUG, L_METADATA, "No DLNA profile found for WMVMED/0x%X file %s\n", - audio_profile, basename(path)); + audio_profile, basepath); free(m.dlna_pn); m.dlna_pn = NULL; break; @@ -1420,7 +1464,7 @@ GetVideoMetadata(const char * path, char * name) break; default: DPRINTF(E_DEBUG, L_METADATA, "No DLNA profile found for WMVHIGH/0x%X file %s\n", - audio_profile, basename(path)); + audio_profile, basepath); free(m.dlna_pn); m.dlna_pn = NULL; break; @@ -1433,7 +1477,7 @@ GetVideoMetadata(const char * path, char * name) asprintf(&m.mime, "video/x-msvideo"); default: DPRINTF(E_DEBUG, L_METADATA, "Stream %d of %s is %s [type %d]\n", - video_stream, basename(path), m.resolution, vc->codec_id); + video_stream, basepath, m.resolution, vc->codec_id); break; } } @@ -1551,6 +1595,7 @@ video_no_dlna: check_for_captions(path, ret); } free_metadata(&m, free_flags); + free(path_cpy); return ret; } diff --git a/minidlna.c b/minidlna.c index f699f2d..58ee34c 100644 --- a/minidlna.c +++ b/minidlna.c @@ -53,14 +53,15 @@ #include #include #include +#include +#include +#include +#include #include #include #include -#include -#include #include #include -#include #include #include #include @@ -836,7 +837,7 @@ init(int argc, char * * argv) } /* set signal handler */ - signal(SIGCLD, SIG_IGN); + signal(SIGCHLD, SIG_IGN); memset(&sa, 0, sizeof(struct sigaction)); sa.sa_handler = sigterm; if (sigaction(SIGTERM, &sa, NULL)) @@ -922,7 +923,7 @@ main(int argc, char * * argv) { if( i < 0 ) { - DPRINTF(E_WARN, L_GENERAL, "Creating new database...\n"); + DPRINTF(E_WARN, L_GENERAL, "Creating new database at %s/files.db\n", db_path); } else { @@ -970,12 +971,13 @@ main(int argc, char * * argv) start_scanner(); #endif } +#ifdef HAVE_INOTIFY if( sqlite3_threadsafe() && sqlite3_libversion_number() >= 3005001 && GETFLAG(INOTIFY_MASK) && pthread_create(&inotify_thread, NULL, start_inotify, NULL) ) { DPRINTF(E_FATAL, L_GENERAL, "ERROR: pthread_create() failed for start_inotify.\n"); } - +#endif sudp = OpenAndConfSSDPReceiveSocket(n_lan_addr, lan_addr); if(sudp < 0) { diff --git a/options.c b/options.c index 11fa680..d36f948 100644 --- a/options.c +++ b/options.c @@ -76,7 +76,7 @@ readoptionsfile(const char * fname) int i; enum upnpconfigoptions id; - if(!fname || (strlen(fname) == 0)) + if(!fname || *fname == '\0') return -1; memset(buffer, 0, sizeof(buffer)); @@ -155,8 +155,17 @@ readoptionsfile(const char * fname) } else { - num_options += 1; - ary_options = (struct option *) realloc(ary_options, num_options * sizeof(struct option)); + num_options++; + t = realloc(ary_options, num_options * sizeof(struct option)); + if(!t) + { + fprintf(stderr, "memory allocation error: %s=%s\n", + name, value); + num_options--; + continue; + } + else + ary_options = (struct option *)t; ary_options[num_options-1].id = id; strncpy(ary_options[num_options-1].value, value, MAX_OPTION_VALUE_LEN); diff --git a/playlist.c b/playlist.c index 3feb694..47a06c3 100644 --- a/playlist.c +++ b/playlist.c @@ -102,10 +102,7 @@ fill_playlists() if( sql_get_table(db, sql_buf, &result, &rows, NULL) != SQLITE_OK ) return -1; if( !rows ) - { - sqlite3_free_table(result); - return 0; - } + goto done; rows++; for( i=3; i #include #include +#include #include #include #include @@ -43,6 +44,12 @@ #include "albumart.h" #include "log.h" +#if SCANDIR_CONST +typedef const struct dirent scan_filter; +#else +typedef struct dirent scan_filter; +#endif + int valid_cache = 0; struct virtual_item @@ -112,7 +119,7 @@ insert_container(const char * item, const char * rootParent, const char * refID, ret = sql_exec(db, "INSERT into OBJECTS" " (OBJECT_ID, PARENT_ID, REF_ID, DETAIL_ID, CLASS, NAME) " "VALUES" - " ('%s$%"PRIX64"', '%s', %Q, %"PRId64", 'container.%s', '%q')", + " ('%s$%llX', '%s', %Q, %lld, 'container.%s', '%q')", rootParent, *parentID, rootParent, refID, detailID, class, item); } sqlite3_free(result); @@ -138,7 +145,7 @@ insert_containers(const char * name, const char *path, const char * refID, const static struct virtual_item last_camdate; static sqlite_int64 last_all_objectID = 0; - asprintf(&sql, "SELECT DATE, CREATOR from DETAILS where ID = %"PRId64, detailID); + asprintf(&sql, "SELECT DATE, CREATOR from DETAILS where ID = %lld", detailID); ret = sql_get_table(db, sql, &result, &row, &cols); free(sql); if( ret == SQLITE_OK ) @@ -164,7 +171,7 @@ insert_containers(const char * name, const char *path, const char * refID, const else { insert_container(date_taken, IMAGE_DATE_ID, NULL, "album.photoAlbum", NULL, NULL, NULL, &objectID, &parentID); - sprintf(last_date.parentID, IMAGE_DATE_ID"$%"PRIX64, parentID); + sprintf(last_date.parentID, IMAGE_DATE_ID"$%llX", parentID); last_date.objectID = objectID; strcpy(last_date.name, date_taken); //DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached date item: %s/%s/%X\n", last_date.name, last_date.parentID, last_date.objectID); @@ -172,7 +179,7 @@ insert_containers(const char * name, const char *path, const char * refID, const sql_exec(db, "INSERT into OBJECTS" " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " "VALUES" - " ('%s$%"PRIX64"', '%s', '%s', '%s', %"PRId64", %Q)", + " ('%s$%llX', '%s', '%s', '%s', %lld, %Q)", last_date.parentID, last_date.objectID, last_date.parentID, refID, class, detailID, name); if( cam ) @@ -187,7 +194,7 @@ insert_containers(const char * name, const char *path, const char * refID, const if( !valid_cache || strcmp(camera, last_cam.name) != 0 ) { insert_container(camera, IMAGE_CAMERA_ID, NULL, "storageFolder", NULL, NULL, NULL, &objectID, &parentID); - sprintf(last_cam.parentID, IMAGE_CAMERA_ID"$%"PRIX64, parentID); + sprintf(last_cam.parentID, IMAGE_CAMERA_ID"$%llX", parentID); strncpy(last_cam.name, camera, 255); last_camdate.name[0] = '\0'; } @@ -199,7 +206,7 @@ insert_containers(const char * name, const char *path, const char * refID, const else { insert_container(date_taken, last_cam.parentID, NULL, "album.photoAlbum", NULL, NULL, NULL, &objectID, &parentID); - sprintf(last_camdate.parentID, "%s$%"PRIX64, last_cam.parentID, parentID); + sprintf(last_camdate.parentID, "%s$%llX", last_cam.parentID, parentID); last_camdate.objectID = objectID; strcpy(last_camdate.name, date_taken); //DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached camdate item: %s/%s/%s/%X\n", camera, last_camdate.name, last_camdate.parentID, last_camdate.objectID); @@ -207,7 +214,7 @@ insert_containers(const char * name, const char *path, const char * refID, const sql_exec(db, "INSERT into OBJECTS" " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " "VALUES" - " ('%s$%"PRIX64"', '%s', '%s', '%s', %"PRId64", %Q)", + " ('%s$%llX', '%s', '%s', '%s', %lld, %Q)", last_camdate.parentID, last_camdate.objectID, last_camdate.parentID, refID, class, detailID, name); /* All Images */ if( !last_all_objectID ) @@ -217,12 +224,12 @@ insert_containers(const char * name, const char *path, const char * refID, const sql_exec(db, "INSERT into OBJECTS" " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " "VALUES" - " ('"IMAGE_ALL_ID"$%"PRIX64"', '"IMAGE_ALL_ID"', '%s', '%s', %"PRId64", %Q)", + " ('"IMAGE_ALL_ID"$%llX', '"IMAGE_ALL_ID"', '%s', '%s', %lld, %Q)", last_all_objectID++, refID, class, detailID, name); } else if( strstr(class, "audioItem") ) { - asprintf(&sql, "SELECT ALBUM, ARTIST, GENRE, ALBUM_ART from DETAILS where ID = %"PRId64, detailID); + asprintf(&sql, "SELECT ALBUM, ARTIST, GENRE, ALBUM_ART from DETAILS where ID = %lld", detailID); ret = sql_get_table(db, sql, &result, &row, &cols); free(sql); if( ret != SQLITE_OK ) @@ -261,7 +268,7 @@ insert_containers(const char * name, const char *path, const char * refID, const sql_exec(db, "INSERT into OBJECTS" " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " "VALUES" - " ('%s$%"PRIX64"', '%s', '%s', '%s', %"PRId64", %Q)", + " ('%s$%llX', '%s', '%s', '%s', %lld, %Q)", last_album.parentID, last_album.objectID, last_album.parentID, refID, class, detailID, name); } if( artist ) @@ -269,12 +276,12 @@ insert_containers(const char * name, const char *path, const char * refID, const if( !valid_cache || strcmp(artist, last_artist.name) != 0 ) { insert_container(artist, MUSIC_ARTIST_ID, NULL, "person.musicArtist", NULL, genre, NULL, &objectID, &parentID); - sprintf(last_artist.parentID, MUSIC_ARTIST_ID"$%"PRIX64, parentID); + sprintf(last_artist.parentID, MUSIC_ARTIST_ID"$%llX", parentID); strcpy(last_artist.name, artist); last_artistAlbum.name[0] = '\0'; /* Add this file to the "- All Albums -" container as well */ insert_container(_("- All Albums -"), last_artist.parentID, NULL, "album", artist, genre, NULL, &objectID, &parentID); - sprintf(last_artistAlbumAll.parentID, "%s$%"PRIX64, last_artist.parentID, parentID); + sprintf(last_artistAlbumAll.parentID, "%s$%llX", last_artist.parentID, parentID); last_artistAlbumAll.objectID = objectID; } else @@ -290,7 +297,7 @@ insert_containers(const char * name, const char *path, const char * refID, const { insert_container(album?album:_("Unknown Album"), last_artist.parentID, album?last_album.parentID:NULL, "album.musicAlbum", artist, genre, album_art, &objectID, &parentID); - sprintf(last_artistAlbum.parentID, "%s$%"PRIX64, last_artist.parentID, parentID); + sprintf(last_artistAlbum.parentID, "%s$%llX", last_artist.parentID, parentID); last_artistAlbum.objectID = objectID; strcpy(last_artistAlbum.name, album?album:_("Unknown Album")); //DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached artist/album item: %s/%s/%X\n", last_artist.name, last_artist.parentID, last_artist.objectID); @@ -298,12 +305,12 @@ insert_containers(const char * name, const char *path, const char * refID, const sql_exec(db, "INSERT into OBJECTS" " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " "VALUES" - " ('%s$%"PRIX64"', '%s', '%s', '%s', %"PRId64", %Q)", + " ('%s$%llX', '%s', '%s', '%s', %lld, %Q)", last_artistAlbum.parentID, last_artistAlbum.objectID, last_artistAlbum.parentID, refID, class, detailID, name); sql_exec(db, "INSERT into OBJECTS" " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " "VALUES" - " ('%s$%"PRIX64"', '%s', '%s', '%s', %"PRId64", %Q)", + " ('%s$%llX', '%s', '%s', '%s', %lld, %Q)", last_artistAlbumAll.parentID, last_artistAlbumAll.objectID, last_artistAlbumAll.parentID, refID, class, detailID, name); } if( genre ) @@ -311,12 +318,12 @@ insert_containers(const char * name, const char *path, const char * refID, const if( !valid_cache || strcmp(genre, last_genre.name) != 0 ) { insert_container(genre, MUSIC_GENRE_ID, NULL, "genre.musicGenre", NULL, NULL, NULL, &objectID, &parentID); - sprintf(last_genre.parentID, MUSIC_GENRE_ID"$%"PRIX64, parentID); + sprintf(last_genre.parentID, MUSIC_GENRE_ID"$%llX", parentID); strcpy(last_genre.name, genre); last_genreArtist.name[0] = '\0'; /* Add this file to the "- All Artists -" container as well */ insert_container(_("- All Artists -"), last_genre.parentID, NULL, "person", NULL, genre, NULL, &objectID, &parentID); - sprintf(last_genreArtistAll.parentID, "%s$%"PRIX64, last_genre.parentID, parentID); + sprintf(last_genreArtistAll.parentID, "%s$%llX", last_genre.parentID, parentID); last_genreArtistAll.objectID = objectID; } else @@ -331,7 +338,7 @@ insert_containers(const char * name, const char *path, const char * refID, const { insert_container(artist?artist:_("Unknown Artist"), last_genre.parentID, artist?last_artist.parentID:NULL, "person.musicArtist", NULL, genre, NULL, &objectID, &parentID); - sprintf(last_genreArtist.parentID, "%s$%"PRIX64, last_genre.parentID, parentID); + sprintf(last_genreArtist.parentID, "%s$%llX", last_genre.parentID, parentID); last_genreArtist.objectID = objectID; strcpy(last_genreArtist.name, artist?artist:_("Unknown Artist")); //DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached genre/artist item: %s/%s/%X\n", last_genreArtist.name, last_genreArtist.parentID, last_genreArtist.objectID); @@ -339,12 +346,12 @@ insert_containers(const char * name, const char *path, const char * refID, const sql_exec(db, "INSERT into OBJECTS" " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " "VALUES" - " ('%s$%"PRIX64"', '%s', '%s', '%s', %"PRId64", %Q)", + " ('%s$%llX', '%s', '%s', '%s', %lld, %Q)", last_genreArtist.parentID, last_genreArtist.objectID, last_genreArtist.parentID, refID, class, detailID, name); sql_exec(db, "INSERT into OBJECTS" " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " "VALUES" - " ('%s$%"PRIX64"', '%s', '%s', '%s', %"PRId64", %Q)", + " ('%s$%llX', '%s', '%s', '%s', %lld, %Q)", last_genreArtistAll.parentID, last_genreArtistAll.objectID, last_genreArtistAll.parentID, refID, class, detailID, name); } /* All Music */ @@ -355,7 +362,7 @@ insert_containers(const char * name, const char *path, const char * refID, const sql_exec(db, "INSERT into OBJECTS" " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " "VALUES" - " ('"MUSIC_ALL_ID"$%"PRIX64"', '"MUSIC_ALL_ID"', '%s', '%s', %"PRId64", %Q)", + " ('"MUSIC_ALL_ID"$%llX', '"MUSIC_ALL_ID"', '%s', '%s', %lld, %Q)", last_all_objectID++, refID, class, detailID, name); } else if( strstr(class, "videoItem") ) @@ -370,7 +377,7 @@ insert_containers(const char * name, const char *path, const char * refID, const sql_exec(db, "INSERT into OBJECTS" " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " "VALUES" - " ('"VIDEO_ALL_ID"$%"PRIX64"', '"VIDEO_ALL_ID"', '%s', '%s', %"PRId64", %Q)", + " ('"VIDEO_ALL_ID"$%llX', '"VIDEO_ALL_ID"', '%s', '%s', %lld, %Q)", last_all_objectID++, refID, class, detailID, name); return; } @@ -423,7 +430,7 @@ insert_directory(const char * name, const char * path, const char * base, const sql_exec(db, "INSERT into OBJECTS" " (OBJECT_ID, PARENT_ID, REF_ID, DETAIL_ID, CLASS, NAME) " "VALUES" - " ('%s', '%s', %Q, %"PRId64", '%s', '%q')", + " ('%s', '%s', %Q, %lld, '%s', '%q')", id_buf, parent_buf, refID, detailID, class, strrchr(dir, '/')+1); if( (p = strrchr(id_buf, '$')) ) *p = '\0'; @@ -444,10 +451,9 @@ insert_directory(const char * name, const char * path, const char * base, const sql_exec(db, "INSERT into OBJECTS" " (OBJECT_ID, PARENT_ID, REF_ID, DETAIL_ID, CLASS, NAME) " "VALUES" - " ('%s%s$%X', '%s%s', %Q, %"PRId64", '%s', '%q')", + " ('%s%s$%X', '%s%s', %Q, %lld, '%s', '%q')", base, parentID, objectID, base, parentID, refID, detailID, class, name); - if( refID ) - free(refID); + free(refID); return -1; } @@ -492,8 +498,7 @@ insert_file(char * name, const char * path, const char * parentID, int object) strcpy(class, "item.audioItem.musicTrack"); detailID = GetAudioMetadata(path, name); } - if( orig_name ) - free(orig_name); + free(orig_name); if( !detailID ) { DPRINTF(E_WARN, L_SCANNER, "Unsuccessful getting details for %s!\n", path); @@ -505,7 +510,7 @@ insert_file(char * name, const char * path, const char * parentID, int object) sql_exec(db, "INSERT into OBJECTS" " (OBJECT_ID, PARENT_ID, CLASS, DETAIL_ID, NAME) " "VALUES" - " ('%s', '%s%s', '%s', %"PRId64", '%q')", + " ('%s', '%s%s', '%s', %lld, '%q')", objectID, BROWSEDIR_ID, parentID, class, detailID, name); if( *parentID ) @@ -524,7 +529,7 @@ insert_file(char * name, const char * path, const char * parentID, int object) sql_exec(db, "INSERT into OBJECTS" " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " "VALUES" - " ('%s%s$%X', '%s%s', '%s', '%s', %"PRId64", '%q')", + " ('%s%s$%X', '%s%s', '%s', '%s', %lld, '%q')", base, parentID, object, base, parentID, objectID, class, detailID, name); insert_containers(name, path, objectID, class, detailID); @@ -655,7 +660,7 @@ sql_failed: } int -filter_audio(const struct dirent *d) +filter_audio(scan_filter *d) { return ( (*d->d_name != '.') && ((d->d_type == DT_DIR) || @@ -669,7 +674,7 @@ filter_audio(const struct dirent *d) } int -filter_video(const struct dirent *d) +filter_video(scan_filter *d) { return ( (*d->d_name != '.') && ((d->d_type == DT_DIR) || @@ -681,7 +686,7 @@ filter_video(const struct dirent *d) } int -filter_images(const struct dirent *d) +filter_images(scan_filter *d) { return ( (*d->d_name != '.') && ((d->d_type == DT_DIR) || @@ -693,7 +698,7 @@ filter_images(const struct dirent *d) } int -filter_media(const struct dirent *d) +filter_media(scan_filter *d) { return ( (*d->d_name != '.') && ((d->d_type == DT_DIR) || diff --git a/sendfile.h b/sendfile.h new file mode 100644 index 0000000..32bde69 --- /dev/null +++ b/sendfile.h @@ -0,0 +1,53 @@ +#if defined(HAVE_LINUX_SENDFILE_API) + +#include + +int sys_sendfile(int sock, int sendfd, off_t *offset, off_t len) +{ + return sendfile(sock, sendfd, offset, len); +} + +#elif defined(HAVE_DARWIN_SENDFILE_API) + +#include +#include +#include + +int sys_sendfile(int sock, int sendfd, off_t *offset, off_t len) +{ + int ret; + + ret = sendfile(sendfd, sock, *offset, &len, NULL, 0); + *offset += len; + + return ret; +} + +#elif defined(HAVE_FREEBSD_SENDFILE_API) + +#include +#include +#include + +int sys_sendfile(int sock, int sendfd, off_t *offset, off_t len) +{ + int ret; + size_t nbytes = len; + + ret = sendfile(sendfd, sock, *offset, nbytes, NULL, &len, SF_MNOWAIT); + *offset += len; + + return ret; +} + +#else + +#include + +int sys_sendfile(int sock, int sendfd, off_t *offset, off_t len) +{ + errno = EINVAL; + return -1; +} + +#endif diff --git a/tagutils/misc.c b/tagutils/misc.c index 08e00ae..f439b8c 100644 --- a/tagutils/misc.c +++ b/tagutils/misc.c @@ -19,9 +19,14 @@ * along with this program. If not, see . */ +#include "config.h" #include #include +#ifdef HAVE_MACHINE_ENDIAN_H +#include +#else #include +#endif #include "misc.h" diff --git a/tagutils/tagutils-asf.h b/tagutils/tagutils-asf.h index 5fd2942..91fcaa2 100644 --- a/tagutils/tagutils-asf.h +++ b/tagutils/tagutils-asf.h @@ -23,7 +23,11 @@ #define __PACKED__ __attribute__((packed)) +#ifdef HAVE_MACHINE_ENDIAN_H +#include +#else #include +#endif typedef struct _GUID { __u32 l; diff --git a/tagutils/tagutils-misc.c b/tagutils/tagutils-misc.c index 9934e7a..eef242b 100644 --- a/tagutils/tagutils-misc.c +++ b/tagutils/tagutils-misc.c @@ -33,10 +33,10 @@ typedef enum { static iconv_result do_iconv(const char* to_ces, const char* from_ces, - char *inbuf, size_t inbytesleft, + ICONV_CONST char *inbuf, size_t inbytesleft, char *outbuf_orig, size_t outbytesleft_orig) { -#ifdef HAVE_ICONV_H +#ifdef HAVE_ICONV size_t rc; iconv_result ret = ICONV_OK; @@ -65,9 +65,9 @@ do_iconv(const char* to_ces, const char* from_ces, iconv_close(cd); return ret; -#else // HAVE_ICONV_H +#else // HAVE_ICONV return ICONV_FATAL; -#endif // HAVE_ICONV_H +#endif // HAVE_ICONV } #define N_LANG_ALT 8 diff --git a/tagutils/tagutils-mp3.c b/tagutils/tagutils-mp3.c index 643b349..6998147 100644 --- a/tagutils/tagutils-mp3.c +++ b/tagutils/tagutils-mp3.c @@ -232,8 +232,7 @@ _get_mp3tags(char *file, struct song_metadata *psong) if((utf8_text) && (strncasecmp((char*)utf8_text, "iTun", 4) != 0)) { // read comment - if(utf8_text) - free(utf8_text); + free(utf8_text); native_text = id3_field_getfullstring(&pid3frame->fields[3]); if(native_text) @@ -241,16 +240,14 @@ _get_mp3tags(char *file, struct song_metadata *psong) utf8_text = (unsigned char*)id3_ucs4_utf8duplicate(native_text); if(utf8_text) { - if (psong->comment) - free(psong->comment); + free(psong->comment); psong->comment = (char*)utf8_text; } } } else { - if(utf8_text) - free(utf8_text); + free(utf8_text); } } } diff --git a/tagutils/tagutils.c b/tagutils/tagutils.c index 7e147e7..9813bfc 100644 --- a/tagutils/tagutils.c +++ b/tagutils/tagutils.c @@ -37,7 +37,7 @@ #include #include "../config.h" -#ifdef HAVE_ICONV_H +#ifdef HAVE_ICONV #include #endif diff --git a/tagutils/tagutils.h b/tagutils/tagutils.h index 0d5f362..0c884be 100644 --- a/tagutils/tagutils.h +++ b/tagutils/tagutils.h @@ -30,6 +30,7 @@ #include #include #include +#include #define ROLE_NOUSE 0 #define ROLE_START 1 diff --git a/tivo_beacon.c b/tivo_beacon.c index 80632d8..5aa04e5 100644 --- a/tivo_beacon.c +++ b/tivo_beacon.c @@ -274,8 +274,9 @@ rcvBeaconMessage(char * beacon) if( strcasecmp(method, "broadcast") == 0 ) { - DPRINTF(E_DEBUG, L_TIVO, "Received new beacon: machine(%s) platform(%s) services(%s)\n", + DPRINTF(E_DEBUG, L_TIVO, "Received new beacon: machine(%s/%s) platform(%s) services(%s)\n", machine ? machine : "-", + identity ? identity : "-", platform ? platform : "-", services ? services : "-" ); return 1; diff --git a/tivo_commands.c b/tivo_commands.c index f60aa88..95cb9f4 100644 --- a/tivo_commands.c +++ b/tivo_commands.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "tivo_utils.h" #include "upnpglobalvars.h" diff --git a/tivo_utils.c b/tivo_utils.c index 2ae6247..aed424a 100644 --- a/tivo_utils.c +++ b/tivo_utils.c @@ -74,8 +74,7 @@ decodeString(char * string, int inplace) } if( inplace ) { - if( ns ) - free(ns); + free(ns); return string; } else diff --git a/upnpdescgen.c b/upnpdescgen.c index 8126d92..c9a40f6 100644 --- a/upnpdescgen.c +++ b/upnpdescgen.c @@ -584,7 +584,7 @@ static char * genXML(char * str, int * len, int * tmplen, const struct XMLElt * p) { - u_int16_t i, j, k; + uint16_t i, j, k; int top; const char * eltname, *s; char c; diff --git a/upnpevents.c b/upnpevents.c index e9f8e08..895819d 100644 --- a/upnpevents.c +++ b/upnpevents.c @@ -340,10 +340,7 @@ static void upnp_event_prepare(struct upnp_event_notify * obj) obj->sub->uuid, obj->sub->seq, l, xml); obj->buffersize = obj->tosend; - if(xml) { - free(xml); - xml = NULL; - } + free(xml); DPRINTF(E_DEBUG, L_HTTP, "Sending UPnP Event response:\n%s\n", obj->buffer); obj->state = ESending; } @@ -468,9 +465,7 @@ void upnpevents_processfds(fd_set *readset, fd_set *writeset) free(obj->sub); } #endif - if(obj->buffer) { - free(obj->buffer); - } + free(obj->buffer); LIST_REMOVE(obj, entries); free(obj); } diff --git a/upnpglobalvars.c b/upnpglobalvars.c index bd6e122..1c20572 100644 --- a/upnpglobalvars.c +++ b/upnpglobalvars.c @@ -48,7 +48,7 @@ */ #include #include -#include +#include #include "config.h" #include "upnpglobalvars.h" diff --git a/upnphttp.c b/upnphttp.c index 19d4bc0..aee1333 100644 --- a/upnphttp.c +++ b/upnphttp.c @@ -54,6 +54,12 @@ #include #include #include +#include +#include +#include +#include +#include + #include "config.h" #include "upnphttp.h" #include "upnpdescgen.h" @@ -61,13 +67,6 @@ #include "upnpsoap.h" #include "upnpevents.h" -#include -#include -#include -#include -#include -#include - #include "upnpglobalvars.h" #include "utils.h" #include "getifaddr.h" @@ -79,6 +78,9 @@ #include "tivo_utils.h" #include "tivo_commands.h" #endif + +#include "sendfile.h" + //#define MAX_BUFFER_SIZE 4194304 // 4MB -- Too much? #define MAX_BUFFER_SIZE 2147483647 // 2GB -- Too much? #define MIN_BUFFER_SIZE 65536 @@ -1172,14 +1174,17 @@ send_file(struct upnphttp * h, int sendfd, off_t offset, off_t end_offset) off_t send_size; off_t ret; char *buf = NULL; +#if HAVE_SENDFILE int try_sendfile = 1; +#endif while( offset < end_offset ) { +#if HAVE_SENDFILE if( try_sendfile ) { send_size = ( ((end_offset - offset) < MAX_BUFFER_SIZE) ? (end_offset - offset + 1) : MAX_BUFFER_SIZE); - ret = sendfile(h->socket, sendfd, &offset, send_size); + ret = sys_sendfile(h->socket, sendfd, &offset, send_size); if( ret == -1 ) { DPRINTF(E_DEBUG, L_HTTP, "sendfile error :: error no. %d [%s]\n", errno, strerror(errno)); @@ -1195,6 +1200,7 @@ send_file(struct upnphttp * h, int sendfd, off_t offset, off_t end_offset) continue; } } +#endif /* Fall back to regular I/O */ if( !buf ) buf = malloc(MIN_BUFFER_SIZE); diff --git a/upnphttp.h b/upnphttp.h index b58ecae..9fcfc27 100644 --- a/upnphttp.h +++ b/upnphttp.h @@ -119,6 +119,10 @@ struct upnphttp { #define FLAG_FREE_OBJECT_ID 0x00000001 #define FLAG_ROOT_CONTAINER 0x00000002 +#ifndef MSG_MORE +#define MSG_MORE 0 +#endif + /* New_upnphttp() */ struct upnphttp * New_upnphttp(int); diff --git a/upnpsoap.c b/upnpsoap.c index 2b2e8af..9141da1 100644 --- a/upnpsoap.c +++ b/upnpsoap.c @@ -353,7 +353,7 @@ static u_int32_t set_filter_flags(char * filter, struct upnphttp *h) { char *item, *saveptr = NULL; - u_int32_t flags = 0; + uint32_t flags = 0; if( !filter || (strlen(filter) <= 1) ) return 0xFFFFFFFF; diff --git a/utils.c b/utils.c index 22fe37a..2757bf2 100644 --- a/utils.c +++ b/utils.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -193,6 +193,11 @@ make_dir(char * path, mode_t mode) do { c = '\0'; + /* Before we do anything, skip leading /'s, so we don't bother + * trying to create /. */ + while (*s == '/') + ++s; + /* Bypass leading non-'/'s and then subsequent '/'s. */ while (*s) { if (*s == '/') { diff --git a/uuid.c b/uuid.c index bdb4abc..bdda7a6 100644 --- a/uuid.c +++ b/uuid.c @@ -28,22 +28,27 @@ #include #include #include -#include #include -#include #include #include #include +#if HAVE_MACH_MACH_TIME_H +#include +#elif HAVE_CLOCK_GETTIME_SYSCALL +#include +#endif #include "getifaddr.h" #include "log.h" #define ETH_ALEN 6 +#ifndef NSEC_PER_SEC #define NSEC_PER_SEC 1000000000L +#endif #define NSEC_PER_MSEC 1000000L -static u_int32_t clock_seq; -static const u_int32_t clock_seq_max = 0x3fff; /* 14 bits */ +static uint32_t clock_seq; +static const uint32_t clock_seq_max = 0x3fff; /* 14 bits */ static int clock_seq_initialized; unsigned long long @@ -51,7 +56,17 @@ monotonic_us(void) { struct timespec ts; +#if defined(HAVE_LIBRT) + clock_gettime(CLOCK_MONOTONIC, &ts); +#elif HAVE_CLOCK_GETTIME_SYSCALL syscall(__NR_clock_gettime, CLOCK_MONOTONIC, &ts); +#elif HAVE_MACH_MACH_TIME_H + return mach_absolute_time(); +#else + struct timeval tv; + gettimeofday(&tv, 0); + TIMEVAL_TO_TIMESPEC(&tv, &ts); +#endif return ts.tv_sec * 1000000ULL + ts.tv_nsec / 1000; } @@ -120,12 +135,12 @@ init_clockseq(void) int generate_uuid(unsigned char uuid_out[16]) { - static u_int64_t last_time_all; + static uint64_t last_time_all; static unsigned int clock_seq_started; static char last_node[6] = { 0, 0, 0, 0, 0, 0 }; struct timespec ts; - u_int64_t time_all; + uint64_t time_all; int inc_clock_seq = 0; unsigned char mac[6]; @@ -162,8 +177,16 @@ generate_uuid(unsigned char uuid_out[16]) * nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of * Gregorian reform to the Christian calendar). */ +#if HAVE_LIBRT + clock_gettime(CLOCK_REALTIME, &ts); +#elif HAVE_CLOCK_GETTIME_SYSCALL syscall(__NR_clock_gettime, CLOCK_REALTIME, &ts); - time_all = ((u_int64_t)ts.tv_sec) * (NSEC_PER_SEC / 100); +#else + struct timeval tv; + gettimeofday(&tv, 0); + TIMEVAL_TO_TIMESPEC(&tv, &ts); +#endif + time_all = ((uint64_t)ts.tv_sec) * (NSEC_PER_SEC / 100); time_all += ts.tv_nsec / 100; /* add offset from Gregorian Calendar to Jan 1 1970 */ @@ -192,14 +215,14 @@ generate_uuid(unsigned char uuid_out[16]) last_time_all = time_all; /* Fill in timestamp and clock_seq values */ - uuid_out[3] = (u_int8_t)time_all; - uuid_out[2] = (u_int8_t)(time_all >> 8); - uuid_out[1] = (u_int8_t)(time_all >> 16); - uuid_out[0] = (u_int8_t)(time_all >> 24); - uuid_out[5] = (u_int8_t)(time_all >> 32); - uuid_out[4] = (u_int8_t)(time_all >> 40); - uuid_out[7] = (u_int8_t)(time_all >> 48); - uuid_out[6] = (u_int8_t)(time_all >> 56); + uuid_out[3] = (uint8_t)time_all; + uuid_out[2] = (uint8_t)(time_all >> 8); + uuid_out[1] = (uint8_t)(time_all >> 16); + uuid_out[0] = (uint8_t)(time_all >> 24); + uuid_out[5] = (uint8_t)(time_all >> 32); + uuid_out[4] = (uint8_t)(time_all >> 40); + uuid_out[7] = (uint8_t)(time_all >> 48); + uuid_out[6] = (uint8_t)(time_all >> 56); uuid_out[8] = clock_seq >> 8; uuid_out[9] = clock_seq & 0xff; -- cgit v1.2.3 From 949a855125f01c25fe880eaf2df18729d681596d Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Wed, 21 Sep 2011 21:55:56 +0000 Subject: * Fix up inotify autoconf support. --- INSTALL | 376 ---------------------------------------------- README | 11 ++ config.h.in | 481 ----------------------------------------------------------- configure.ac | 26 +++- inotify.c | 2 +- 5 files changed, 32 insertions(+), 864 deletions(-) delete mode 100644 INSTALL delete mode 100644 config.h.in diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 2194fe0..0000000 --- a/INSTALL +++ /dev/null @@ -1,376 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, -2006, 2007, 2008, 2009 Free Software Foundation, Inc. - - Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. This file is offered as-is, -without warranty of any kind. - -Prerequisites -================== - -- libexif -- libjpeg -- libid3tag -- libFLAC -- libvorbis -- libsqlite3 -- libavformat (the ffmpeg libraries) - -Basic Installation -================== - - Briefly, the shell commands `./configure; make; make install' should -configure, build, and install this package. The following -more-detailed instructions are generic; see the `README' file for -instructions specific to this package. Some packages provide this -`INSTALL' file but do not implement all of the features documented -below. The lack of an optional feature in a given package is not -necessarily a bug. More recommendations for GNU packages can be found -in *note Makefile Conventions: (standards)Makefile Conventions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. Caching is -disabled by default to prevent problems with accidental use of stale -cache files. - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You need `configure.ac' if -you want to change it or regenerate `configure' using a newer version -of `autoconf'. - - The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. - - Running `configure' might take a while. While running, it prints - some messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package, generally using the just-built uninstalled binaries. - - 4. Type `make install' to install the programs and any data files and - documentation. When installing into a prefix owned by root, it is - recommended that the package be configured and built as a regular - user, and only the `make install' phase executed with root - privileges. - - 5. Optionally, type `make installcheck' to repeat any self-tests, but - this time using the binaries in their final installed location. - This target does not install anything. Running this target as a - regular user, particularly if the prior `make install' required - root privileges, verifies that the installation completed - correctly. - - 6. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - - 7. Often, you can also type `make uninstall' to remove the installed - files again. In practice, not all packages have tested that - uninstallation works correctly, even though it is required by the - GNU Coding Standards. - - 8. Some packages, particularly those that use Automake, provide `make - distcheck', which can by used by developers to test that all other - targets like `make install' and `make uninstall' work correctly. - This target is generally not run by end users. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. Run `./configure --help' -for details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c99 CFLAGS=-g LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. This -is known as a "VPATH" build. - - With a non-GNU `make', it is safer to compile the package for one -architecture at a time in the source code directory. After you have -installed the package for one architecture, use `make distclean' before -reconfiguring for another architecture. - - On MacOS X 10.5 and later systems, you can create libraries and -executables that work on multiple system types--known as "fat" or -"universal" binaries--by specifying multiple `-arch' options to the -compiler but only a single `-arch' option to the preprocessor. Like -this: - - ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CPP="gcc -E" CXXCPP="g++ -E" - - This is not guaranteed to produce working output in all cases, you -may have to build one architecture at a time and combine the results -using the `lipo' tool if you have problems. - -Installation Names -================== - - By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX', where PREFIX must be an -absolute file name. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. In general, the -default for these options is expressed in terms of `${prefix}', so that -specifying just `--prefix' will affect all of the other directory -specifications that were not explicitly provided. - - The most portable way to affect installation locations is to pass the -correct locations to `configure'; however, many packages provide one or -both of the following shortcuts of passing variable assignments to the -`make install' command line to change installation locations without -having to reconfigure or recompile. - - The first method involves providing an override variable for each -affected directory. For example, `make install -prefix=/alternate/directory' will choose an alternate location for all -directory configuration variables that were expressed in terms of -`${prefix}'. Any directories that were specified during `configure', -but not in terms of `${prefix}', must each be overridden at install -time for the entire installation to be relocated. The approach of -makefile variable overrides for each directory variable is required by -the GNU Coding Standards, and ideally causes no recompilation. -However, some platforms have known limitations with the semantics of -shared libraries that end up requiring recompilation when using this -method, particularly noticeable in packages that use GNU Libtool. - - The second method involves providing the `DESTDIR' variable. For -example, `make install DESTDIR=/alternate/directory' will prepend -`/alternate/directory' before all installation names. The approach of -`DESTDIR' overrides is not required by the GNU Coding Standards, and -does not work on platforms that have drive letters. On the other hand, -it does better at avoiding recompilation issues, and works well even -when some directory options were not specified in terms of `${prefix}' -at `configure' time. - -Optional Features -================= - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - - Some packages offer the ability to configure how verbose the -execution of `make' will be. For these packages, running `./configure ---enable-silent-rules' sets the default to minimal output, which can be -overridden with `make V=1'; while running `./configure ---disable-silent-rules' sets the default to verbose, which can be -overridden with `make V=0'. - -Particular systems -================== - - On HP-UX, the default C compiler is not ANSI C compatible. If GNU -CC is not installed, it is recommended to use the following options in -order to use an ANSI C compiler: - - ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" - -and if that doesn't work, install pre-built binaries of GCC for HP-UX. - - On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot -parse its `' header file. The option `-nodtk' can be used as -a workaround. If GNU CC is not installed, it is therefore recommended -to try - - ./configure CC="cc" - -and if that doesn't work, try - - ./configure CC="cc -nodtk" - - On Solaris, don't put `/usr/ucb' early in your `PATH'. This -directory contains several dysfunctional programs; working variants of -these programs are available in `/usr/bin'. So, if you need `/usr/ucb' -in your `PATH', put it _after_ `/usr/bin'. - - On Haiku, software installed for all users goes in `/boot/common', -not `/usr/local'. It is recommended to use the following options: - - ./configure --prefix=/boot/common - -Specifying the System Type -========================== - - There may be some features `configure' cannot figure out -automatically, but needs to determine by the type of machine the package -will run on. Usually, assuming the package is built to be run on the -_same_ architectures, `configure' can figure that out, but if it prints -a message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS - KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - - Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). - -Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf bug. Until the bug is fixed you can use this workaround: - - CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash - -`configure' Invocation -====================== - - `configure' recognizes the following options to control how it -operates. - -`--help' -`-h' - Print a summary of all of the options to `configure', and exit. - -`--help=short' -`--help=recursive' - Print a summary of the options unique to this package's - `configure', and exit. The `short' variant lists options used - only in the top level, while the `recursive' variant lists options - also present in any nested packages. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--prefix=DIR' - Use DIR as the installation prefix. *note Installation Names:: - for more details, including other options available for fine-tuning - the installation locations. - -`--no-create' -`-n' - Run the configure checks, but stop before creating any output - files. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/README b/README index 8caead1..31c7ca3 100644 --- a/README +++ b/README @@ -21,5 +21,16 @@ and http://www.dlna.org/ for mode details on DLNA. See the INSTALL file for instructions on compiling, installing, and configuring minidlna. +Prerequisites +================== + +- libexif +- libjpeg +- libid3tag +- libFLAC +- libvorbis +- libsqlite3 +- libavformat (the ffmpeg libraries) + Justin Maggard diff --git a/config.h.in b/config.h.in deleted file mode 100644 index ae27a84..0000000 --- a/config.h.in +++ /dev/null @@ -1,481 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - -/* DB path */ -#undef DEFAULT_DB_PATH - -/* Log path */ -#undef DEFAULT_LOG_PATH - -/* Define to 1 if translation of program messages to the user's native - language is requested. */ -#undef ENABLE_NLS - -/* Define to 1 if you have the header file. */ -#undef HAVE_ARPA_INET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_AVCODEC_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_AVFORMAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_AVUTIL_H - -/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the - CoreFoundation framework. */ -#undef HAVE_CFLOCALECOPYCURRENT - -/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in - the CoreFoundation framework. */ -#undef HAVE_CFPREFERENCESCOPYAPPVALUE - -/* Whether the __NR_clock_gettime syscall is defined */ -#undef HAVE_CLOCK_GETTIME_SYSCALL - -/* Whether darwin sendfile() API is available */ -#undef HAVE_DARWIN_SENDFILE_API - -/* Define if the GNU dcgettext() function is already present or preinstalled. - */ -#undef HAVE_DCGETTEXT - -/* Define to 1 if you have the header file. */ -#undef HAVE_ENDIAN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FFMPEG_AVCODEC_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FFMPEG_AVUTIL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FFMPEG_LIBAVCODEC_AVCODEC_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FFMPEG_LIBAVFORMAT_AVFORMAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FFMPEG_LIBAVFORMAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FFMPEG_LIBAVUTIL_AVUTIL_H - -/* Have flac */ -#undef HAVE_FLAC - -/* Define to 1 if you have the header file. */ -#undef HAVE_FLAC_ALL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FLAC_METADATA_H - -/* Define to 1 if you have the `fork' function. */ -#undef HAVE_FORK - -/* Whether freebsd sendfile() API is available */ -#undef HAVE_FREEBSD_SENDFILE_API - -/* Define to 1 if you have the `gethostname' function. */ -#undef HAVE_GETHOSTNAME - -/* Define to 1 if you have the `getifaddrs' function. */ -#undef HAVE_GETIFADDRS - -/* Define if the GNU gettext() function is already present or preinstalled. */ -#undef HAVE_GETTEXT - -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define if you have the iconv() function. */ -#undef HAVE_ICONV - -/* Define to 1 if you have the header file. */ -#undef HAVE_ID3TAG_H - -/* Define to 1 if you have the `inet_ntoa' function. */ -#undef HAVE_INET_NTOA - -/* Define to enable inotify */ -#undef HAVE_INOTIFY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_JPEGLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBAVCODEC_AVCODEC_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBAVFORMAT_AVFORMAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBAVUTIL_AVUTIL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBAV_AVCODEC_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBAV_AVUTIL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBAV_LIBAVCODEC_AVCODEC_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBAV_LIBAVFORMAT_AVFORMAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBAV_LIBAVFORMAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBAV_LIBAVUTIL_AVUTIL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBEXIF_EXIF_LOADER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBINTL_H - -/* Define to 1 if you have the `pthread' library (-lpthread). */ -#undef HAVE_LIBPTHREAD - -/* Whether linux sendfile() API is available */ -#undef HAVE_LINUX_SENDFILE_API - -/* Define to 1 if you have the header file. */ -#undef HAVE_LOCALE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MACHINE_ENDIAN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MACH_MACH_TIME_H - -/* Define to 1 if you have the `memmove' function. */ -#undef HAVE_MEMMOVE - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `memset' function. */ -#undef HAVE_MEMSET - -/* Define to 1 if you have the `mkdir' function. */ -#undef HAVE_MKDIR - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETDB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_OGG_OGG_H - -/* Define to 1 if you have the `realpath' function. */ -#undef HAVE_REALPATH - -/* Define to 1 if you have the `select' function. */ -#undef HAVE_SELECT - -/* Define to 1 if you have the `sendfile' function. */ -#undef HAVE_SENDFILE - -/* Define to 1 if you have the `setlocale' function. */ -#undef HAVE_SETLOCALE - -/* Define to 1 if you have the `socket' function. */ -#undef HAVE_SOCKET - -/* Define to 1 if you have the header file. */ -#undef HAVE_SQLITE3_H - -/* Define to 1 if stdbool.h conforms to C99. */ -#undef HAVE_STDBOOL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDDEF_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strcasecmp' function. */ -#undef HAVE_STRCASECMP - -/* Define to 1 if you have the `strchr' function. */ -#undef HAVE_STRCHR - -/* Define to 1 if you have the `strdup' function. */ -#undef HAVE_STRDUP - -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strncasecmp' function. */ -#undef HAVE_STRNCASECMP - -/* Define to 1 if you have the `strpbrk' function. */ -#undef HAVE_STRPBRK - -/* Define to 1 if you have the `strrchr' function. */ -#undef HAVE_STRRCHR - -/* Define to 1 if you have the `strstr' function. */ -#undef HAVE_STRSTR - -/* Define to 1 if you have the `strtol' function. */ -#undef HAVE_STRTOL - -/* Define to 1 if you have the `strtoul' function. */ -#undef HAVE_STRTOUL - -/* Define to 1 if `st_blocks' is a member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_BLOCKS - -/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use - `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ -#undef HAVE_ST_BLOCKS - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYSCALL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_FILE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_IOCTL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SYSCALL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `vfork' function. */ -#undef HAVE_VFORK - -/* Define to 1 if you have the header file. */ -#undef HAVE_VFORK_H - -/* lacking vorbisfile */ -#undef HAVE_VORBISFILE - -/* Define to 1 if you have the header file. */ -#undef HAVE_VORBIS_CODEC_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_VORBIS_VORBISFILE_H - -/* Define to 1 if `fork' works. */ -#undef HAVE_WORKING_FORK - -/* Define to 1 if `vfork' works. */ -#undef HAVE_WORKING_VFORK - -/* Define to 1 if the system has the type `_Bool'. */ -#undef HAVE__BOOL - -/* Define as const if the declaration of iconv() needs const. */ -#undef ICONV_CONST - -/* Define to enable logging */ -#undef LOG_PERROR - -/* Define to 1 if `lstat' dereferences a symlink specified with a trailing - slash. */ -#undef LSTAT_FOLLOWS_SLASHED_SYMLINK - -/* Define to 1 if you want to enable NETGEAR support */ -#undef NETGEAR - -/* OS Name */ -#undef OS_NAME - -/* OS URL */ -#undef OS_URL - -/* OS Version */ -#undef OS_VERSION - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you want to enable NETGEAR support */ -#undef PNPX - -/* Define to 1 if you want to enable NETGEAR support */ -#undef READYNAS - -/* scandir needs const char cast */ -#undef SCANDIR_CONST - -/* we are on solaris */ -#undef SOLARIS - -/* Define to enable Solaris Kernel Stats */ -#undef SOLARIS_KSTATS - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define to 1 if you want to enable TiVo support */ -#undef TIVO_SUPPORT - -/* use the system's builtin daemon() */ -#undef USE_DAEMON - -/* Define to enable IPF */ -#undef USE_IPF - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif - - -/* Version number of package */ -#undef VERSION - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif - -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE - -/* Define for Solaris 2.5.1 so the uint32_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -#undef _UINT32_T - -/* Define for Solaris 2.5.1 so the uint64_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -#undef _UINT64_T - -/* Define for Solaris 2.5.1 so the uint8_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -#undef _UINT8_T - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Define to the type of a signed integer type of width exactly 32 bits if - such a type exists and the standard includes do not define it. */ -#undef int32_t - -/* Define to `int' if does not define. */ -#undef mode_t - -/* Define to `long int' if does not define. */ -#undef off_t - -/* Define to `int' if does not define. */ -#undef pid_t - -/* Define to `unsigned int' if does not define. */ -#undef size_t - -/* Define to `int' if does not define. */ -#undef ssize_t - -/* Define to the type of an unsigned integer type of width exactly 32 bits if - such a type exists and the standard includes do not define it. */ -#undef uint32_t - -/* Define to the type of an unsigned integer type of width exactly 64 bits if - such a type exists and the standard includes do not define it. */ -#undef uint64_t - -/* Define to the type of an unsigned integer type of width exactly 8 bits if - such a type exists and the standard includes do not define it. */ -#undef uint8_t - -/* Define as `fork' if `vfork' does not work. */ -#undef vfork diff --git a/configure.ac b/configure.ac index 82fc71d..045b020 100644 --- a/configure.ac +++ b/configure.ac @@ -89,7 +89,6 @@ AC_COMPILE_IFELSE( ################################################################################################################ ### Library checks -#AM_NLS AC_CHECK_LIB([dl], [dlopen], [LIBDL_LIBS="-ldl"],) AC_SUBST(LIBDL_LIBS) @@ -466,11 +465,26 @@ AC_CHECK_LIB(vorbisfile, vorbis_comment_query, ################################################################################################################ ### Header checks -#AC_HEADER_CHECK(libintl.h, AC_DEFINE([ENABLE_NLS], [1], [Define to use NLS])) -AC_HEADER_CHECK(inotify.h, AC_DEFINE([HAVE_INOTIFY_H], [1], [Define to enable inotify])) - -# Checks for header files. (From autoscan) -AC_CHECK_HEADERS([arpa/inet.h endian.h machine/endian.h fcntl.h libintl.h locale.h netdb.h netinet/in.h stddef.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h]) +AC_CHECK_HEADERS([arpa/inet.h asm/unistd.h endian.h machine/endian.h fcntl.h libintl.h locale.h netdb.h netinet/in.h stddef.h stdlib.h string.h sys/file.h sys/inotify.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h]) + +AC_CHECK_FUNCS(inotify_init, AC_DEFINE(HAVE_INOTIFY,1,[Whether kernel has inotify support]), [ + AC_MSG_CHECKING([for __NR_inotify_init syscall]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [ + #include + ], + [ + #ifndef __NR_inotify_init + #error + #endif + ] + )], + [ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_INOTIFY,1,[Whether kernel has inotify support]) + ]) +]) ################################################################################################################ ### Build Options diff --git a/inotify.c b/inotify.c index 6ed4da5..37f431a 100644 --- a/inotify.c +++ b/inotify.c @@ -31,7 +31,7 @@ #include #include #include -#ifdef HAVE_INOTIFY_H +#ifdef HAVE_SYS_INOTIFY_H #include #else #include "linux/inotify.h" -- cgit v1.2.3