summaryrefslogtreecommitdiff
path: root/mol-configure.patch
blob: f0e6d9f65143c780df2dfb4ea5bb5c04d438a7c8 (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
diff -Naur mol-rsync.orig/configure.in mol-rsync/configure.in
--- mol-rsync.orig/configure.in	Sun Jan 26 21:13:05 2003
+++ mol-rsync/configure.in	Wed Jan 29 23:29:00 2003
@@ -257,15 +257,10 @@
 AC_ARG_ENABLE(debugger, [  --disable-debugger      do not build the MOL debugger], [] [] )
 
 test "$enable_debugger" != "no" && { 
-    AC_CHECK_HEADER(ncurses.h,
-	[NCURSES_LDFLAGS=-lncurses],
-	if test -f /sw/include/ncurses.h ; then
-	    NCURSES_INCLUDE=-I/sw/include/
-	    NCURSES_LDFLAGS='-L/sw/lib/ -lncurses'
- 	else
-	    enable_debugger=no
-	fi
-    )
+    AC_CHECK_NCURSES
+
+    NCURSES_INCLUDE=$CURSES_INCLUDE
+    NCURSES_LDFLAGS=$CURSES_LIBS
 }
 AM_CONDITIONAL(MOL_DEBUGGER, test "$enable_debugger" != no)
 
diff -Naur mol-rsync.orig/curses.m4 mol-rsync/curses.m4
--- mol-rsync.orig/curses.m4	Thu Jan  1 01:00:00 1970
+++ mol-rsync/curses.m4	Sun Dec 22 14:05:55 2002
@@ -0,0 +1,66 @@
+dnl Rewritten from scratch. --wojtekka
+dnl $Id$
+
+AC_DEFUN(AC_CHECK_NCURSES,[
+  AC_SUBST(CURSES_LIBS)
+  AC_SUBST(CURSES_INCLUDES)
+
+  AC_ARG_WITH(ncurses,
+    [[  --with-ncurses[=dir]    Compile with ncurses/locate base dir]],
+      if test "x$withval" = "xno" ; then
+        without_ncurses=yes
+      elif test "x$withval" != "xyes" ; then
+        with_arg=$withval/include:-L$withval/lib
+      fi)
+
+  if test "x$without_ncurses" != "xyes" ; then
+    AC_MSG_CHECKING(for ncurses.h)
+
+    for i in $with_arg \
+    		/usr/include: \
+		/usr/local/include:"-L/usr/local/lib -L/usr/local/lib/ncurses" \
+		/usr/pkg/include:-L/usr/pkg/lib \
+		/usr/contrib/include:-L/usr/contrib/lib \
+		/usr/freeware/include:-L/usr/freeware/lib32 \
+    		/sw/include:-L/sw/lib \
+    		/cw/include:-L/cw/lib; do
+	
+      incl=`echo "$i" | sed 's/:.*//'`
+      lib=`echo "$i" | sed 's/.*://'`
+		
+      if test -f $incl/ncurses/ncurses.h; then
+        include=$incl/ncurses
+      elif test -f $incl/ncurses.h; then
+        include=$incl
+      fi
+
+      if test "x$include" != "x"; then
+        AC_MSG_RESULT($include/ncurses.h)
+	CURSES_LIBS="$lib"
+	CURSES_INCLUDES=""
+	if test "$include" != "/usr/include"; then
+	  CURSES_INCLUDES="-I$include"
+	fi
+	if test "$incl" != "/usr/include"; then
+	  CURSES_INCLUDES="$CURSES_INCLUDES -I$incl"
+	fi
+	have_ncurses=yes
+	ldflags_old="$LDFLAGS"
+	LDFLAGS="$CURSES_LIBS"
+	AC_DEFINE(HAVE_NCURSES, 1, [define if You want ncurses])
+	AC_CHECK_LIB(ncurses, initscr,
+	  [CURSES_LIBS="$CURSES_LIBS -lncurses"],
+	  [AC_CHECK_LIB(curses, initscr,
+	    [CURSES_LIBS="$CURSES_LIBS -lcurses"])])
+	LDFLAGS="$ldflags_old"
+	break
+      fi
+    done
+  fi
+
+  if test "x$have_ncurses" != "xyes"; then
+    AC_MSG_RESULT(not found)
+  fi
+])
+
+