summaryrefslogtreecommitdiff
blob: c17cc10cea9f055de33af5ba1a2cb2a3c3add066 (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
--- a/configure.in
+++ b/configure.in
@@ -11,18 +11,25 @@
 libetpan_major_required=0
 libetpan_minor_required=42
 
-debug=no
+AC_MSG_CHECKING(whether debug flag was used)
 AC_ARG_ENABLE(debug,   [  --enable-debug          setup flags (gcc) for debugging (default=no)],
-debug=yes
-CFLAGS="$CFLAGS -O2 -W -Wall -g"
-LDFLAGS="$LDFLAGS",)
+	[enable_debug=$enableval],[enable_debug="no"])
+AC_MSG_RESULT($enable_debug)
+if test "$enable_debug" = "yes"; then
+	CFLAGS="$CFLAGS -O2 -W -Wall -g"
+	LDFLAGS="$LDFLAGS"
+fi
+
 AC_ARG_ENABLE(optim,   [  --enable-optim          setup flags (gcc) for optimizations (default=no)],
-if test "x$enable_debug" != "xyes" ; then
-  CFLAGS="$CFLAGS -O3 -g0"
-  LDFLAGS="$LDFLAGS -s"
+	[enable_optim=$enableval],[enable_debug="no"])
+if test "$enable_debug" != "yes"; then 
+  if test "$enable_optim" = "yes"; then
+    CFLAGS="$CFLAGS -O3 -g0"
+    LDFLAGS="$LDFLAGS -s"
+  fi
 else
   AC_MSG_WARN([enable-optim and enable-debug are incompatible -- disabling optimizations])
-fi,)
+fi
 
 AC_CONFIG_HEADER(config.h)
 
@@ -67,10 +74,10 @@
   if test "x$checkpthread" = "xyes"; then
     AC_MSG_CHECKING([for pthread_create with -$flag])
     OLDFLAGS="$LDFLAGS"
-    LDFLAGS="-$flag $LDFLAGS"
+    LDFLAGS="$LDFLAGS -$flag"
     AC_TRY_LINK([], [pthread_create();], 
                     [pthflag=yes; checkpthread=no], 
-                    [pthflag=no; LDFLAGS="$OLDCFLAGS"])
+                    [pthflag=no; LDFLAGS="$OLDFLAGS"])
     AC_MSG_RESULT($pthflag)
   fi
 done
@@ -127,7 +134,7 @@
   AC_CHECK_HEADER(libetpan/libetpan.h, [libetpan=yes])
   if test "x$libetpan" = "xyes"; then
     AC_MSG_CHECKING([whether libetpan-config hints compiles and links fine])
-    LDFLAGS="$LDFLAGS `$libetpanconfig --libs 2>/dev/null`"
+    LIBS="$LIBS `$libetpanconfig --libs 2>/dev/null`"
     AC_TRY_LINK([], [db_mailstorage_init();], [libetpan=yes], [libetpan=no])
     AC_MSG_RESULT([$libetpan])
   fi