summaryrefslogtreecommitdiff
path: root/sysutils/ups-nut-cgi/patches/patch-ad
blob: bdc5984ad8148c6d22c24119968792bcf5a25abb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
$NetBSD: patch-ad,v 1.7 2002/08/25 21:51:08 jlam Exp $

--- configure.in.orig	Tue Apr 16 23:34:38 2002
+++ configure.in
@@ -18,6 +18,7 @@ dnl | default values for things later on
 STATEPATH="/var/state/ups"
 MODELPATH="$prefix/bin"
 CGIPATH="$prefix/cgi-bin"
+GRAPHLIB_PATH="/usr/local"
 RUN_AS_USER="nobody"
 RUN_AS_GROUP="nogroup"
 PIDPATH="/var/run"
@@ -118,9 +119,43 @@ if ( test x"$ac_cv_func_connect" = x"no"
 	], [], [])
 fi
 
+AC_MSG_CHECKING(graphics library file path)
+AC_ARG_WITH(graphics,
+[ --with-graphics=PATH         Path for graphics library files],
+[       case "$withval" in
+	yes|no)
+		AC_MSG_RESULT(using default: $GRAPHLIB_PATH)
+		;;
+	*)
+		AC_MSG_RESULT($withval)
+		AC_DEFINE_UNQUOTED(GRAPHLIB_PATH, "$withval")
+		GRAPHLIB_PATH=$withval
+		;;
+	esac],
+	AC_MSG_RESULT(using default: $GRAPHLIB_PATH)
+)
+GRAPHICS_LIBS="-R$GRAPHLIB_PATH/lib -L$GRAPHLIB_PATH/lib"
+GRAPHICS_INCLUDES="-I$GRAPHLIB_PATH/include"
+CFLAGS_save=$CFLAGS
+CPPFLAGS_save=$CPPFLAGS
+CFLAGS="$CFLAGS_save $GRAPHICS_LIBS"
+CPPFLAGS="$CPPFLAGS_save $GRAPHICS_INCLUDES"
+
+dnl Include in case GD was compiled with internationalization support
+AC_CHECK_LIB(intl, gettext,
+[ LIBINTL="-lintl"],[ LIBINTL=""] )
+GRAPHICS_LIBS="$GRAPHICS_LIBS $LIBINTL"
+CFLAGS="$CFLAGS_save $GRAPHICS_LIBS"
+
 dnl Include in case GD was compiled with True Type support
 AC_CHECK_LIB(ttf, TT_New_Glyph,
 [ LIBTTF="-lttf"],[ LIBTTF=""] )
+GRAPHICS_LIBS="$GRAPHICS_LIBS $LIBTTF"
+CFLAGS="$CFLAGS_save $GRAPHICS_LIBS"
+
+dnl Include in case GD was compiled with jpeg support
+AC_CHECK_LIB(jpeg, jpeg_abort,
+[ LIBJPEG="-ljpeg"],[ LIBJPEG=""] )
 
 dnl Include in case GD was compiled with Xpm support
 AC_CHECK_LIB(X11, XBell,
@@ -129,13 +164,16 @@ AC_CHECK_LIB(X11, XBell,
 	       echo "Retrying with -L /usr/X11R6/lib"
                unset ac_cv_lib_X11_XBell
 		AC_CHECK_LIB(X11, XBell,
-                        [ LIBX="-lX11 -L/usr/X11R6/lib" ],
+                        [ LIBX="-R/usr/X11R6/lib -L/usr/X11R6/lib -lX11" ],
                         [ LIBX="" ],
-                        [ -lX11 -L/usr/X11R6/lib ],
+                        [ -L/usr/X11R6/lib -lX11 ],
                 )
         ],
 )
 
+GRAPHICS_LIBS="$GRAPHICS_LIBS $LIBJPEG"
+CFLAGS="$CFLAGS_save $GRAPHICS_LIBS"
+
 dnl   Skip this chunk if there's no LIBX to use
 
 if test "$LIBX" != "" 
@@ -143,69 +181,35 @@ then
 
 	dnl Include in case GD was compiled with Xpm support
 	AC_CHECK_LIB(Xpm, XpmReadFileToXpmImage,
-		[ LIBXPM="-lXpm"],
-		[ 
-			echo "Retrying with $LIBX"
-			unset ac_cv_lib_Xpm_XpmReadFileToXpmImage
-			AC_CHECK_LIB(Xpm, XpmReadFileToXpmImage,
-				[ LIBXPM="-lXpm $LIBX" ],
-				[ LIBXPM="" ],
-				[ -lXpm $LIBX ],
-			)
-		],
-		[ -lXpm ],
+		[ LIBXPM="-lXpm $LIBX"],
+		[ LIBXPM="" ],
+		[ -lXpm $LIBX ],
 	)
+
+	GRAPHICS_LIBS="$GRAPHICS_LIBS $LIBXPM"
+	CFLAGS="$CFLAGS_save $GRAPHICS_LIBS"
 fi
 
 AC_CHECK_LIB(gd, gdImagePng,
 [
-	GFXLIBS="-lgd -lpng -lz"
+	LIBGD="$GRAPHICS_LIBS -lgd -lpng -lz"
 ],
 [
-	echo "Trying again - using -L/usr/local/lib -I/usr/local/include..."
-	unset ac_cv_lib_gd_gdImagePng
-	CPPFLAGS="$CPPFLAGS -L/usr/local/lib -I/usr/local/include"
-	AC_CHECK_LIB(gd, gdImagePng,
-	[
-		GFXLIBS="-lgd -lpng -lz -L/usr/local/lib -I/usr/local/include"
-	],,
-	[-lm -lpng -lz])
+	AC_MSG_RESULT(
+** You will not be able to build the CGI programs without gd.
+**
+** To get it, visit http://www.boutell.com/gd/
+	)
 ],
-[-lm -lpng -lz],
+[$GRAPHICS_LIBS -lm -lpng -lz],
 )
 
-dnl  Don't run the ttf/xpm tests against gd unless
-dnl  we actually have something to test!
-dnl 
-if test "$LIBTTF" != "" 
-then
-
-	if test "$GFXLIBS" = "" ; then
-	        echo "Trying again - using $LIBTTF"
-	        unset ac_cv_lib_gd_gdImagePng
-	        AC_CHECK_LIB(gd, gdImagePng,
-	        [
-	                GFXLIBS="-lgd -lpng -lz $LIBTTF"
-	        ],,
-	        [-lm -lpng -lz $LIBTTF])
-	fi
-
-	if test "$GFXLIBS" = "" ; then
-	        echo "Trying again - using $LIBTTF $LIBXPM"
-	        unset ac_cv_lib_gd_gdImagePng
-	        AC_CHECK_LIB(gd, gdImagePng,
-	        [
-			GFXLIBS="-lgd -lpng -lz $LIBTTF $LIBXPM"
-	        ],,
-        [-lm -lpng -lz $LIBTTF $LIBXPM])
-	fi
-fi
-
-test "$GFXLIBS" = ""  && echo "** You will not be able to build the CGI programs without gd."
-test "$GFXLIBS" = ""  && echo "** "
-test "$GFXLIBS" = ""  && echo "** To get it, visit http://www.boutell.com/gd/"
+GRAPHICS_LIBS="$LIBGD"
+CFLAGS="$CFLAGS_save $GRAPHICS_LIBS"
 
 AC_CHECK_HEADERS(gd.h gd/gd.h sys/modem.h stdarg.h varargs.h sys/shm.h)
+CFLAGS=$CFLAGS_save
+CPPFLAGS=$CPPFLAGS_save
 
 AC_HEADER_TIME
 AC_CHECK_HEADERS(sys/time.h)
@@ -218,7 +222,7 @@ if test -n "$LD_LIBRARY_PATH"; then
    for lib in `echo $LD_LIBRARY_PATH | $AWK -F: '{ for (i = NF; i > 0; --i) print $i }' | sort | uniq`; do
       if test -f ${lib}/libpng.so; then
          AC_CHECK_LIB(png, png_info_init,
-	 [ GFXLIBS="-R${lib} $GFXLIBS"
+	 [ GRAPHICS_LIBS="-R${lib} $GRAPHICS_LIBS"
 	 ],
 	 [],
 	 [-lm -R${lib}],)
@@ -550,7 +554,8 @@ AC_SUBST(DRIVER_INSTALL_TARGET)
 AC_SUBST(LIBOBJ)
 AC_SUBST(BUILDOBJ)
 AC_SUBST(NETLIBS)
-AC_SUBST(GFXLIBS)
+AC_SUBST(GRAPHICS_LIBS)
+AC_SUBST(GRAPHICS_INCLUDES)
 AC_SUBST(SERLIBS)
 AC_SUBST(STATEPATH)
 AC_SUBST(MODELPATH)