summaryrefslogtreecommitdiff
path: root/net-irc/epic5/files/epic5-1.1.2-perl-automagic-as-needed.patch
blob: e211fa14b2755f08f30f50a1b9e7de84b69d3672 (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
From: Nathan Phillip Brink <binki@gentoo.org>
Subject: Fix perl being automagic and to be safe with
	LDFLAGS=-Wl,--as-needed.

--- a/configure.in
+++ b/configure.in
@@ -1033,37 +1033,38 @@
 dnl
 dnl Perl support?
 dnl
-AC_ARG_WITH(perl,
-[  --with-perl[=PATH_TO_PERL_EXE]       Compile with perl support.],
-[ 
-	perlexe=$withval
-],
-	perlexe=yes
-)
-
-if test "x$perlexe" = "xyes"; then
-	perlexe=perl
-fi
-
-if test "x$perlexe" = "xno"; then
+AC_ARG_WITH([perl], [AS_HELP_STRING([--with-perl=[PATH_TO_PERL_EXE]], [Compile with perl support.])],
+	[], [with_perl=maybe])
+AS_IF([test "x$with_perl" = "xno"],
+	[
 	AC_MSG_CHECKING(whether to support Perl)
 	AC_MSG_RESULT(no)
-else
-	AC_CHECK_PROG(PERLPROG, $perlexe, "yes", "no")
-	AC_MSG_CHECKING(whether to support Perl)
-	if test $PERLPROG != "yes" ; then 
+	],
+	[
+	with_perl_errormsg="You specified --with-perl=$with_perl but I could not find a working perl. Please run ./configure with --without-perl or specify a path to a working perl executable."
+	AS_IF([test "x$with_perl" = "xyes" -o "x$with_perl" = "xmaybe"],
+		[perlexe=perl],
+		[perlexe="$with_perl"])
+	dnl Allow a full path to be specified in --with-perl
+	AS_IF([test -x "$perlexe"],
+		[PERLPROG=yes],
+		[AC_CHECK_PROG(PERLPROG, $perlexe, "yes", "no")])
+	AC_MSG_CHECKING([whether to support Perl])
+	if test $PERLPROG != "yes" ; then
+		AS_IF([test "x$with_perl" != "xmaybe"],
+			[AC_MSG_ERROR([$with_perl_errormsg])])
 		AC_MSG_RESULT(no)
 	else
 		AC_MSG_RESULT(yes)
 		PERLCFLAGS=`$perlexe -MExtUtils::Embed -e ccopts`
-		PERLLDFLAGS=`$perlexe -MExtUtils::Embed -e ldopts`
+		PERLLIBS=`$perlexe -MExtUtils::Embed -e ldopts`
 
 		AC_MSG_CHECKING(whether embedded perl works the way I expect)
 		have_embedded_perl="no"
 		old_CFLAGS="$CFLAGS"
-		old_LDFLAGS="$LDFLAGS"
+		old_LIBS="$LIBS"
 		CFLAGS="$CFLAGS $PERLCFLAGS"
-		LDFLAGS="$LDFLAGS $PERLLDFLAGS"
+		LIBS="$LIBS $PERLLIBS"
 		AC_TRY_RUN([
 #include <EXTERN.h>
 #include <perl.h>
@@ -1101,20 +1102,22 @@
 have_embedded_perl="no",:)
 
 		CFLAGS="$old_CFLAGS"
-		LDFLAGS="$old_LDFLAGS"
+		LIBS="$old_LIBS"
 		if test $have_embedded_perl = "yes" ; then
 			AC_MSG_RESULT(yes)
 			AC_DEFINE(HAVE_PERL)
 			AC_DEFINE(PERLCFLAGS)
-			AC_DEFINE(PERLLDFLAGS)
+			AC_DEFINE(PERLLIBS)
 			PERLDOTOH="perl.o"
 		else
+			AS_IF([test "x$with_perl" != "xmaybe"],
+				[AC_MSG_ERROR([$with_perl_errormsg])])
 			PERLCFLAGS=""
-			PERLLDFLAGS=""
+			PERLLIBS=""
 			AC_MSG_RESULT(no, sorry)
 			PERLCFLAGS=""
-			PERLLDFLAGS=""
+			PERLLIBS=""
 		fi
 	fi
-fi
+	])
 
@@ -1392,7 +1395,7 @@
 AC_SUBST(TCLLIBS)
 AC_SUBST(PERLDOTOH)
 AC_SUBST(PERLCFLAGS)
-AC_SUBST(PERLLDFLAGS)
+AC_SUBST(PERLLIBS)
 AC_SUBST(WSERV_BIN)
 AC_SUBST(WSERV_INSTALL)
 AC_SUBST(bindir)

--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -38,7 +38,7 @@
 epic5: $(OBJECTS)
 	sh info.c.sh
 	$(CC) $(CFLAGS) $(INCLUDES) -c info.c
-	$(CC) $(CFLAGS) $(LDFLAGS) -o epic5 $(OBJECTS) info.o @PERLLDFLAGS@ @TCLLIBS@ @RUBYLIBS@ $(LIBS)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o epic5 $(OBJECTS) info.o @PERLLIBS@ @TCLLIBS@ @RUBYLIBS@ $(LIBS)
 	$(RM) info.c info.o
 clean::
 	$(RM) epic5 $(OBJECTS)