HPLIP 3.15.4: hp_ipp.c needs '#define _GNU_SOURCE'
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
HPLIP |
New
|
Undecided
|
Unassigned |
Bug Description
At least on openSUSE I need this patch to build HPLIP 3.15.4:
#######
--- protocol/
+++ protocol/hp_ipp.c 2015-05-19 13:12:47.000000000 +0200
@@ -18,6 +18,9 @@ Boston, MA 02110-1301, USA.
\*****
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
#include <cups/cups.h>
#include <cups/language.h>
#######
Without it there are various issues, primarily compiler warnings about strcasestr
that lead to SUSE build errors because strcasestr needs '#define _GNU_SOURCE'
in addition to '#include <string.h>' - see "man strcasestr":
#######
#define _GNU_SOURCE
#include <string.h>
char *strcasestr(const char *haystack, const char *needle);
#######
FYI:
There are some more missing '#include <...>'
because I get those compiler warnings:
prnt/cupsext/ cupsext. c:108:5: warning: stance'
implicit declaration of function '_releaseCupsIn
prnt/cupsext/ cupsext. c:390:5: warning:
implicit declaration of function 'addCupsPrinter'
prnt/cupsext/ cupsext. c:414:5: warning:
implicit declaration of function 'delCupsPrinter'
prnt/cupsext/ cupsext. c:440:5: warning: Printer'
implicit declaration of function 'setDefaultCups
prnt/cupsext/ cupsext. c:461:5: warning: nter'
implicit declaration of function 'controlCupsPri
io/hpmud/jd.c:77:7: warning:
implicit declaration of function 'strtol'
scan/sane/ hpaio.c: 336:5: warning:
implicit declaration of function 'InitDbus'
scan/sane/ bb_ledm. c:1008: 6: warning:
implicit declaration of function 'usleep'
scan/sane/ sclpml. c:435:13: warning:
implicit declaration of function 'gettimeofday'
scan/sane/ sclpml. c:1887: 5: warning:
implicit declaration of function 'strcasestr'
The follwing patch fixes them - except those in prnt/cupsext/ cupsext. c which
I leave for you HPLIP authors at upstream because I won't try to guess what
your preferred way is how to fix it (add them to protocol/hp_ipp.h or
protocol/hp_ipp_i.h or something else...?)
####### ####### ####### ####### ####### ####### ####### ####### ####### ####### ####### # hp_ipp. c.orig 2015-04-14 11:53:09.000000000 +0200
--- protocol/
+++ protocol/hp_ipp.c 2015-05-19 13:12:47.000000000 +0200
@@ -18,6 +18,9 @@ Boston, MA 02110-1301, USA.
\***** ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ***/
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
#include <cups/cups.h> sclpml. c.orig 2015-04-14 11:53:17.000000000 +0200
#include <cups/language.h>
--- scan/sane/
+++ scan/sane/sclpml.c 2015-05-19 13:45:44.000000000 +0200
@@ -25,11 +25,16 @@
\***** ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* **/
+#ifndef _GNU_SOURCE bb_ledm. c.orig 2015-05-19 13:47:53.000000000 +0200
+#define _GNU_SOURCE
+#endif
+
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
+#include <sys/time.h>
#include "sane.h"
#include "saneopts.h"
#include "common.h"
--- scan/sane/
+++ scan/sane/bb_ledm.c 2015-05-19 13:48:42.000000000 +0200
@@ -26,7 +26,7 @@
# include "http.h"
# include "xml.h"
# include <stdlib.h>
-
+# include <unistd.h>
# include <stdint.h>
# define _STRINGIZE(x) #x hpaio.c. orig 2015-04-14 11:53:17.000000000 +0200
--- scan/sane/
+++ scan/sane/hpaio.c 2015-05-19 13:51:21.000000000 +0200
@@ -43,6 +43,7 @@
#include "hpaio.h"
# include "ledm.h"
#include "sclpml.h"
+#include "io.h"
#define DEBUG_DECLARE_ONLY
#include "sanei_debug.h"
--- io/hpmud/jd.c.orig 2015-05-19 13:46:39.000000000 +0200
+++ io/hpmud/jd.c 2015-05-19 13:47:01.000000000 +0200
@@ -31,6 +31,7 @@
#endif
#include <signal.h>
+#include <stdlib.h>
#include "hpmud.h"
#include "hpmudi.h"
####### ####### ####### ####### ####### ####### ####### ####### ####### ####### ####### #