summarylogtreecommitdiffstats
path: root/fix-m4.patch
blob: 11e31b5744369aeedcea0f9b4cf702b2ddee601d (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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
diff --git a/aclocal.m4 b/aclocal.m4
index fd4119f..dbf33a6 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -31,48 +31,48 @@ AC_DEFUN([LC_SUBST],[
 
 #remove leading and trailing
 AC_DEFUN([LC_STRIP],[
-  @<:@@<:@ "$$1" =~ [$(echo "^@{:@.*[^[:space:]])[[:space:]]+$"]) @:>@@:>@ && $1=${BASH_REMATCH[[1]]}
-  @<:@@<:@ "$$1" =~ [$(echo "^[[:space:]]+([^[:space:]].*)$"]) @:>@@:>@ && $1=${BASH_REMATCH[[1]]}
+	@<:@@<:@ "$$1" =~ [$(echo "^@{:@.*[^[:space:]])[[:space:]]+$"]) @:>@@:>@ && $1=${BASH_REMATCH[[1]]}
+	@<:@@<:@ "$$1" =~ [$(echo "^[[:space:]]+([^[:space:]].*)$"]) @:>@@:>@ && $1=${BASH_REMATCH[[1]]}
 # transform \\ in \
-  $1=${$1//\/\//\/}
+	$1=${$1//\/\//\/}
 ]) 
 
 # remove unwanted space in well know flags
 AC_DEFUN([LC_NORMALIZE_FLAG], [
   LC_STRIP([$1])
-  if @<:@@<:@ "$$1" =~ [$(echo "^-(l|L|D)[[:space:]]+([^[:space:]].*)$"]) @:>@@:>@
-  then $1=-${BASH_REMATCH[[1]]}${BASH_REMATCH[[2]]}
-  fi
+	if @<:@@<:@ "$$1" =~ [$(echo "^-(l|L|D)[[:space:]]+([^[:space:]].*)$"]) @:>@@:>@
+	then $1=-${BASH_REMATCH[[1]]}${BASH_REMATCH[[2]]}
+	fi
 ])
 
 
 # append flag ($1) to ($2)
 # authorize some duplicate according to the pattern
 AC_DEFUN([LC_APPEND_FLAG],[
-  if @<:@@<:@ "$1" =~ $(echo "^[[:space:]]*-Wl,.+") @:>@@:>@
-  then $2="$$2 $1"
-  else AX_APPEND_FLAG([$1],[$2])
-  fi
+	if @<:@@<:@ "$1" =~ $(echo "^[[:space:]]*-Wl,.+") @:>@@:>@
+	then $2="$$2 $1"
+	else AX_APPEND_FLAG([$1],[$2])
+	fi
 ])
 
 #############################################################################
 # generic pop flag $2 from $1 line $3 line flag separator (right most element)
 AC_DEFUN([_LC_POP_FLAG],[
   LC_STRIP([$1])
-  $2=${$1@%:@@%:@*$3} # get flag
-  if test "$$2" = "$$1"
-  then $1=
-  else $2="$3$$2"; $1=${$1%$$2} # remove flag
-  fi
-  LC_NORMALIZE_FLAG([$2])
+	$2=${$1@%:@@%:@*$3} # get flag
+	if test "$$2" = "$$1"
+	then $1=
+	else $2="$3$$2"; $1=${$1%$$2} # remove flag
+	fi
+	LC_NORMALIZE_FLAG([$2])
 ])
 
 # generic get flag $2 from $1 line $3 line flag separator (left most element)
 AC_DEFUN([_LC_GET_FLAG],[
   LC_STRIP([$1])
-  $2=${$1%%$3*} # get flag
-  $1=${$1@%:@*$$2} # remove flag
-  LC_NORMALIZE_FLAG([$2])
+	$2=${$1%%$3*} # get flag
+	$1=${$1@%:@*$$2} # remove flag
+	LC_NORMALIZE_FLAG([$2])
 ])
 
 #get flag $2 from $1 line (GET:left most element POP:right most)
@@ -89,10 +89,10 @@ AC_DEFUN([LC_POP_FLAG_LIBS],[_LC_POP_FLAG([$1],[$2],[ ])])
 #############################################################################
 # wrapping AC_?_IFELSE for erro smg
 AC_DEFUN([LC_X_IFELSE],[
-  AC_MSG_CHECKING([$2] linking)
-  AC_$1_IFELSE([$3], [ AC_MSG_RESULT(yes) $4
-  ],[ AC_MSG_RESULT(no) $5
-  ])])
+	AC_MSG_CHECKING([$2] linking)
+	AC_$1_IFELSE([$3], [ AC_MSG_RESULT(yes) $4
+	],[ AC_MSG_RESULT(no) $5
+	])])
 AC_DEFUN([LC_RUN_IFELSE],[LC_X_IFELSE([RUN],[$1],[$2],[$3],[$4])])
 AC_DEFUN([LC_LINK_IFELSE],[LC_X_IFELSE([LINK],[$1],[$2],[$3],[$4])])
 AC_DEFUN([LC_COMPILE_IFELSE],[LC_X_IFELSE([COMPILE],[$1],[$2],[$3],[$4])])
@@ -105,12 +105,12 @@ AC_DEFUN([lc_lib_name],[m4_tolower($1)])
 AC_DEFUN([LC_SET_TRIVIAL_FLAGS],[
 if [[ "$2" ]]
 then
-  LC_SCATTER_FLAGS([-I$2/include -L$2/lib -l[]lc_lib_name([$1])],[$1])
+	LC_SCATTER_FLAGS([-I$2/include -L$2/lib -l[]lc_lib_name([$1])],[$1])
 else
-  LC_SCATTER_FLAGS([-l[]lc_lib_name([$1])],[$1])
+	LC_SCATTER_FLAGS([-l[]lc_lib_name([$1])],[$1])
 fi
 ])
-  
+	
 
 #############################################################################
 # We use function here to avoid 'm4 local variable' conflict for embedded calls
@@ -122,23 +122,23 @@ m4_define([f_lc_functions_list],[ f_lc_scatter_flags  ])
 # LC_APPEND_FLAG is used to avoid duplicate flag
 # $1 anonymous list $2 destination
 AC_DEFUN([LC_PREPEND_LIST],[
-  [$0]_list="$1"
+	[$0]_list="$1"
   #pop the old list
-  while @<:@ "$$2" @:>@
+	while @<:@ "$$2" @:>@
   do  LC_POP_FLAG_LIBS([$2],[[$0]_flag])
     LC_APPEND_FLAG([$[$0]_flag],[[$0]_nlist])
-  done
+	done
   # append new list
   while @<:@ "$[$0]_list" @:>@
-  do  LC_POP_FLAG_LIBS([[$0]_list],[[$0]_flag])
+  do	LC_POP_FLAG_LIBS([[$0]_list],[[$0]_flag])
     LC_APPEND_FLAG([$[$0]_flag],[[$0]_nlist])
-  done
+	done
   $2=
   while @<:@ "$[$0]_nlist" @:>@
-  do  LC_GET_FLAG_LIBS([[$0]_nlist],[[$0]_flag])
-      $2="$[$0]_flag $$2"
-  done
-  unset ${![$0]_*}
+  do	LC_GET_FLAG_LIBS([[$0]_nlist],[[$0]_flag])
+	    $2="$[$0]_flag $$2"
+	done
+	unset ${![$0]_*}
 ])
 
 #############################################################################
@@ -146,13 +146,13 @@ AC_DEFUN([LC_PREPEND_LIST],[
 # $1 list $2 destination
 AC_DEFUN([LC_MERGE_FLAGS],[
   [$0]_list="$1"
-  if @<:@@<:@ "$2" =~ $(echo "(^|_)LIBS") @:>@@:>@
-  then LC_PREPEND_LIST([$1],[$2])
-  else  while @<:@ "$[$0]_list" @:>@
-        do  LC_GET_FLAG([[$0]_list],[[$0]_flag])
+	if @<:@@<:@ "$2" =~ $(echo "(^|_)LIBS") @:>@@:>@
+	then LC_PREPEND_LIST([$1],[$2])
+	else  while @<:@ "$[$0]_list" @:>@
+        do	LC_GET_FLAG([[$0]_list],[[$0]_flag])
             LC_APPEND_FLAG([$[$0]_flag],[$2])
-        done
-  fi
+	      done
+	fi
   unset ${![$0]_*}
 ])
 
@@ -165,8 +165,8 @@ m4_define([all_flags],[superseded_flags, merged_flags])
 
 # generic transfert flag $1 within the superseded list $2 and the merged list $3
 AC_DEFUN([_LC_TRANSFERT_FLAGS],
-  [m4_foreach([_tmp1], [$2], [ if @<:@ "$$1_[]_tmp1" @:>@; then _tmp1=$$1_[]_tmp1;fi;])]
-  [m4_foreach([_tmp1], [$3], [LC_MERGE_FLAGS([$$1_[]_tmp1], [_tmp1])])]
+ 	[m4_foreach([_tmp1], [$2], [ if @<:@ "$$1_[]_tmp1" @:>@; then _tmp1=$$1_[]_tmp1;fi;])]
+ 	[m4_foreach([_tmp1], [$3], [LC_MERGE_FLAGS([$$1_[]_tmp1], [_tmp1])])]
 )
 
 # set compile flags from the LIBRARY ($1) flags into standard flags
@@ -199,23 +199,17 @@ AC_DEFUN([LC_COMBINE_FLAGS],[
 
 # supersede the $2 empty flags  by $1 flags 
 AC_DEFUN([LC_SET_EMPTY_FLAGS],[
-  m4_foreach([_tmp1], [all_flags], [$2_[]_tmp1=${$2_[]_tmp1:-${$1_[]_tmp1}};])])
+ 	m4_foreach([_tmp1], [all_flags], [$2_[]_tmp1=${$2_[]_tmp1:-${$1_[]_tmp1}};])])
 
 # raw copy flags from $1 to $2
  AC_DEFUN([LC_COPY_FLAGS],[
-    m4_foreach([_tmp1], [all_flags], [$2_[]_tmp1="${$1_[]_tmp1}";])])
+  	m4_foreach([_tmp1], [all_flags], [$2_[]_tmp1="${$1_[]_tmp1}";])])
 
 # Delete the LIBRARY ($1) flags
 AC_DEFUN([LC_CLEAR_FLAGS],[
   m4_ifblank([$1],[m4_define([_tmp2])],[m4_define([_tmp2],[_])])
   m4_foreach([_tmp1], [all_flags],[unset $1[]_tmp2[]_tmp1;])])
 
-# raw compare flags in $1 and $2
- AC_DEFUN([LC_EQ_FLAGS],[@<:@ dnl
-    m4_foreach([_tmp1], [all_flags], ["${$2_[]_tmp1}" == "${$1_[]_tmp1}" -a ])dnl
-    : @:>@
-    ])
-
 #############################################################################
 # build the lib name with a underscore if needed
 m4_define([lc_libname],[m4_ifblank([$1],[$2],[$1_$2])])
@@ -223,21 +217,21 @@ m4_define([lc_libname],[m4_ifblank([$1],[$2],[$1_$2])])
 #
 AC_DEFUN([LC_SCATTER_FLAGS],[
   [$0]_list="$1" 
-  
+	
   while test -n "$[$0]_list" ; 
-  do
-    LC_GET_FLAG([[$0]_list], [[$0]_flag])
-    LC_STRIP([$0]_flag)
-    case "$[$0]_flag" in
-      -l*@:}@ LC_APPEND_FLAG([$[$0]_flag],[lc_libname([$2],[LIBS])]);;
-      -L*|-framework*@:}@ LC_APPEND_FLAG([$[$0]_flag],[lc_libname([$2],[LDFLAGS])]);;
-      -I*|-U*|-D*@:}@ LC_APPEND_FLAG([$[$0]_flag],[lc_libname([$2],[CPPFLAGS])]);;
+	do
+	  LC_GET_FLAG([[$0]_list], [[$0]_flag])
+		LC_STRIP([$0]_flag)
+	  case "$[$0]_flag" in
+	    -l*@:}@ LC_APPEND_FLAG([$[$0]_flag],[lc_libname([$2],[LIBS])]);;
+	    -L*|-framework*@:}@ LC_APPEND_FLAG([$[$0]_flag],[lc_libname([$2],[LDFLAGS])]);;
+	    -I*|-U*|-D*@:}@ LC_APPEND_FLAG([$[$0]_flag],[lc_libname([$2],[CPPFLAGS])]);;
       -F*@:}@ LC_APPEND_FLAG([$[$0]_flag],[lc_libname([$2],[CPPFLAGS])]) LC_APPEND_FLAG([$[$0]_flag],[lc_libname([$2],[LDFLAGS])]);;
-      -Wl,*@:}@ AC_MSG_WARN(Flag $[$0]_flag dropped for lib $2);;
-      -*@:}@ 
-        AX_CHECK_COMPILE_FLAG($[$0]_flag,[LC_APPEND_FLAG([$[$0]_flag],[lc_libname([$2],[CXXFLAGS])])],[AC_MSG_WARN(Flag $[$0]_flag dropped)],[],[]);;
-      *@:}@ AC_MSG_WARN(Flags $[$0]_flag NOT managed);;
-    esac
+	    -Wl,*@:}@ AC_MSG_WARN(Flag $[$0]_flag dropped for lib $2);;
+	    -*@:}@ 
+	      AX_CHECK_COMPILE_FLAG($[$0]_flag,[LC_APPEND_FLAG([$[$0]_flag],[lc_libname([$2],[CXXFLAGS])])],[AC_MSG_WARN(Flag $[$0]_flag dropped)],[],[]);;
+	    *@:}@ AC_MSG_WARN(Flags $[$0]_flag NOT managed);;
+	  esac
   done
   unset ${![$0]_*}
 ])
@@ -246,9 +240,9 @@ AC_DEFUN([LC_SCATTER_FLAGS],[
 
 # Dump flags
  AC_DEFUN([_LC_DUMP_FLAGS], [
-  m4_foreach([_tmp1], [[CFLAGS], [CXXFLAGS], [CPPFLAGS], [LIBS], [LDFLAGS]], 
-  [AC_MSG_NOTICE([$1[]_tmp1:$$1[]_tmp1])
-  ])
+ 	m4_foreach([_tmp1], [[CFLAGS], [CXXFLAGS], [CPPFLAGS], [LIBS], [LDFLAGS]], 
+ 	[AC_MSG_NOTICE([$1[]_tmp1:$$1[]_tmp1])
+ 	])
  ])
  
 AC_DEFUN([LC_DUMP_FLAGS], [m4_ifblank([$1],[_LC_DUMP_FLAGS],[_LC_DUMP_FLAGS([$1_])])])
@@ -256,13 +250,12 @@ AC_DEFUN([LC_DUMP_FLAGS], [m4_ifblank([$1],[_LC_DUMP_FLAGS],[_LC_DUMP_FLAGS([$1_
 # get arg value from a args list
 # $1 args list $2 arg $3 arg value
 AC_DEFUN([LC_GET_ARG_VALUE], [
-    if @<:@@<:@ "$$1" =~ $(echo "(^|[[[:space:]]]+)$2(=?|[[[:space:]]]*)(.*)$") @:>@@:>@
-    then $3=${BASH_REMATCH[[3]]%% -*}
-         $3=${$3%% }  # strip tailing blanks
-    else unset $3
-    fi
+		if @<:@@<:@ $$1 =~ $(echo "(^|[[:space:]]+)$2(=?|[[:space:]]*)(.*)$") @:>@@:>@
+		then $3=${BASH_REMATCH[[3]]%% -*}
+		else unset $3
+		fi
 ])
-  
+	
 # remove all  occurrence of arg from a args list
 # $1 args list to clean $2 arg to remove
 AC_DEFUN([STRIP_ARG], [
@@ -279,20 +272,20 @@ AC_DEFUN([STRIP_ARG], [
   $1=$(echo $$1)  # wipe extra blank if any
   unset ${![$0]_*}
 ])
-  
+	
 # remove multiple occurrences of arg from a args list
 # $1 args list to clean $2 args to remove
 AC_DEFUN([STRIP_ALL_ARGS], [
-  unset [$0]_list
-  for [$0]_arg in "$2"  
-  do  while @<:@@<:@ $$1 != $[$0]_list @:>@@:>@
-      do [$0]_list=$$1
-         STRIP_ARG([$1],[$[$0]_arg])
-      done
-  done
-  unset ${![$0]_*}
+	unset [$0]_list
+	for [$0]_arg in "$2"	
+	do  while @<:@@<:@ $$1 != $[$0]_list @:>@@:>@
+		  do [$0]_list=$$1
+		     STRIP_ARG([$1],[$[$0]_arg])
+	    done
+	done
+	unset ${![$0]_*}
 ])
-  
+	
    
 
 
diff --git a/misc/m4/dlopen.m4 b/misc/m4/dlopen.m4
index 5eab086..cf74379 100644
--- a/misc/m4/dlopen.m4
+++ b/misc/m4/dlopen.m4
@@ -1,18 +1,31 @@
-
-#--------------------------------------------------------------------
-# Checks for dlopen in standard or dl library
-# we are looking in sequence for dlopen or dld_link or shl_load in
-# standard libs or libdl or libdld
-#--------------------------------------------------------------------
-
-m4_define([dyn_link_ok],[AC_DEFINE(TM_DYNAMIC_LINKING, [$1], [Dynamic linking function name])])
-
 AC_DEFUN([LC_DLOPEN],[
-  AC_SEARCH_LIBS(dlopen, libdl libdld, [dyn_link_ok(dlopen)],[
-    AC_SEARCH_LIBS(dld_link, libdl libdld, [dyn_link_ok(dld_link)],[
-      AC_SEARCH_LIBS(shl_load, libdl libdld, [dyn_link_ok(shl_load)],[
-        echo configure: warning: dynamic linking using dlopen will not work
-      ])
-    ])
-  ])
-])
+  AC_CHECK_FUNC(dlopen)
+  if test "$ac_cv_func_dl" = "yes"; then
+    AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
+  else
+    AC_CHECK_LIB(dl,dlopen)
+    if test "$ac_cv_lib_dl_dlopen" = "yes"; then
+      AC_CHECK_FUNCS(dlopen)
+      CONFIG_BDL="-ldl"
+      AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
+    else
+      AC_CHECK_LIB(dld,dld_link)
+      if test "$ac_cv_lib_dld_dld_link" = "yes"; then
+        CONFIG_BDL="-ldl"
+        AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
+      else
+        AC_CHECK_FUNCS(shl_load)
+        if test "$ac_cv_func_shl_load" = "yes"; then
+          CONFIG_BDL="-ldl"
+          AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
+        else
+          AC_CHECK_FUNCS(dlopen)
+          if test "$ac_cv_func_dlopen" = "yes"; then
+            AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
+          fi
+        fi
+      fi
+    fi
+  fi
+  AC_SUBST(CONFIG_BDL)
+])
\ No newline at end of file
diff --git a/misc/m4/guile.m4 b/misc/m4/guile.m4
index c131416..53c8215 100644
--- a/misc/m4/guile.m4
+++ b/misc/m4/guile.m4
@@ -69,9 +69,11 @@ AC_DEFUN([LC_WITH_GUILE],[
   unset LC_WITH_GUILE_tmp1 LC_WITH_GUILE_tmp2
 
   GUILE_BIN="$GUILE_LIB"
+  GUILE_BIN_NODOT=${GILE_BIN//./}
   GUILE_CONFIG="$guile_config"
   GUILE_CFLAGS="$GUILE_CPPFLAGS"
   AC_SUBST(GUILE_BIN)
+  AC_SUBST(GUILE_BIN_NODOT)
   AC_SUBST(GUILE_CFLAGS)
 
   GUILE_EFFECTIVE_VERSION=`$GUILE_BIN -c '(display (version))'`
diff --git a/misc/m4/iconv.m4 b/misc/m4/iconv.m4
index 9062d20..2a4c78f 100644
--- a/misc/m4/iconv.m4
+++ b/misc/m4/iconv.m4
@@ -1,52 +1,67 @@
-#--------------------------------------------------------------------
-# Checks for iconv library
-#--------------------------------------------------------------------
-
 AC_DEFUN([LC_ICONV],[
-AC_ARG_WITH(iconv,
-AS_HELP_STRING([--with-iconv@<:@=DIR@:>@], [where to find iconv []]),
-	[], [unset withval;])
+  AC_ARG_WITH(iconv,
+  AS_HELP_STRING([--with-iconv@<:@=DIR@:>@], [where to find iconv [system]]))
+
+  # Check for iconv
+  # Modified from GNOME's libxml2 configure.in
+  AC_LANG_SAVE
+  AC_LANG_C  # compile C to avoid the 'const char**' problem
 
-if [[[ "$withval" != no ]]]
-then
-  i_failure=1
-  
-  [$0]_LIBPATHS="$LDFLAGS $withval -L/opt/local/lib -L/sw/lib"
-  
-  LC_GET_ARG_VALUE([$0]_LIBPATHS, [-L], [$0]_LIBPATH)
-  STRIP_ARG([[$0]_LIBPATHS], -L$[$0]_LIBPATH)
-  
-  while test -n "$[$0]_LIBPATH"
-  do
-    LC_CLEAR_FLAGS([ICONV]) # no external iconv definition allowed
-    LC_SET_TRIVIAL_FLAGS([ICONV],[${$0_LIBPATH]%/lib})
-    AX_SAVE_FLAGS	
-    LC_SET_FLAGS([ICONV])
-    AC_CHECK_HEADER(iconv.h, [
-      LC_LINK_IFELSE([iconv], [AC_LANG_PROGRAM([[@%:@include <iconv.h>]],
-        [[iconv_open("",""); ]])
-      ], [
-        AX_RESTORE_FLAGS
-        LC_COMBINE_FLAGS([ICONV],[iconv])
+  SAVE_CPPFLAGS="$CPPFLAGS"
+  SAVE_LDFLAGS="$LDFLAGS"
+  SAVE_LIBS="$LIBS"
+  if test "$with_iconv" = "no" ; then
+      AC_MSG_RESULT([disabling iconv support])
+  else
+      if test -n "$ICONV_CFLAGS" -a -n "$ICONV_LDFLAGS"; then
+         CPPFLAGS="$ICONV_CFLAGS" # for AC_TRY_LINK
+         LDFLAGS="$ICONV_LDFLAGS"
+      fi
+      if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
+         CPPFLAGS="-I$with_iconv/include" # for AC_TRY_LINK
+         LDFLAGS="-L$with_iconv/lib"
+         ICONV_CFLAGS="-I$with_iconv/include"
+         ICONV_LDFLAGS="-L$with_iconv/lib"
+      fi
+
+      AC_CHECK_HEADER(iconv.h,
+      AC_MSG_CHECKING(for iconv)
+      AC_TRY_LINK(
+  [
+  #include <stdlib.h>
+  #include <iconv.h>
+  ],[
+      iconv_t cd = iconv_open ("","");
+      iconv (cd, NULL, NULL, NULL, NULL);
+  ],[
+      AC_MSG_RESULT(yes)
+      AC_DEFINE(USE_ICONV, 1, [Use iconv library])
+  ],[
+      AC_MSG_RESULT(no)
+      AC_MSG_CHECKING(for iconv in -liconv)
+  #    LDFLAGS="${ICONV_LDFLAGS}"    # for AC_TRY_LINK
+      LIBS="-liconv"                # for AC_TRY_LINK
+      AC_TRY_LINK(
+  [
+  #include <stdlib.h>
+  #include <iconv.h>
+  ],[
+        iconv_t cd = iconv_open ("","");
+        iconv (cd, NULL, NULL, NULL, NULL);
+  ],[
+        AC_MSG_RESULT(yes)
         AC_DEFINE(USE_ICONV, 1, [Use iconv library])
-        unset i_failure
-        unset [$0]_LIBPATH
-      ], [
-        echo configure: warning, failed to link with iconv
-#       AC_MSG_ERROR([you may have several versions of iconv installed,
-#         use with-iconv=iconv_base_path (i.e /usr/local) to specify one location])
-    ])],[
-      LC_GET_ARG_VALUE([$0]_LIBPATHS, [-L], [$0]_LIBPATH)
-      STRIP_ARG([[$0]_LIBPATHS], -L$[$0]_LIBPATH)
-    ])
-  done
-  if [[ $i_failure ]]
-  then
-    echo configure: warning, iconv support does not seem to work
-    echo configure: warning, absence of iconv may crash HTML import among others
-#    AC_MSG_ERROR([absence of iconv may crash HTML import or prevent the build
-#      but it is possible to run configure --with-iconv=no])
+        ICONV_LDFLAGS="${ICONV_LDFLAGS/-liconv} -liconv"
+  ],[
+        AC_MSG_RESULT(no)
+        AC_MSG_WARN([absence of iconv may crash HTML import])
+    ])]))
   fi
-fi
-LC_SUBST([ICONV])
-])
+
+  CPPFLAGS="$SAVE_CPPFLAGS"
+  LDFLAGS="$SAVE_LDFLAGS"
+  LIBS="$SAVE_LIBS"
+  AC_LANG_RESTORE  # restore C++ language
+  AC_SUBST(ICONV_CFLAGS)
+  AC_SUBST(ICONV_LDFLAGS)
+])
\ No newline at end of file
diff --git a/plugins/r/src/tm_r.c b/plugins/r/src/tm_r.c
index 37ce819..b10cbee 100644
--- a/plugins/r/src/tm_r.c
+++ b/plugins/r/src/tm_r.c
@@ -14,7 +14,8 @@
 #include <sys/select.h>
 #if HAVE_PTY_H
 #include <pty.h>
-#else
+#endif
+#if HAVE_UTIL_H
 #include <util.h>
 #endif
 
diff --git a/src/System/config.h.cmake b/src/System/config.h.cmake
index 44b9a4a..2b34c1d 100644
--- a/src/System/config.h.cmake
+++ b/src/System/config.h.cmake
@@ -7,7 +7,7 @@
 #cmakedefine DOTS_OK 1
 
 /* Dynamic linking works */
-#cmakedefine TM_DYNAMIC_LINKING 1
+#cmakedefine DYNAMIC_LINKING 1
 
 /* Enable experimental style rewriting code */
 #cmakedefine EXPERIMENTAL 1
diff --git a/src/System/config.in b/src/System/config.in
index c501466..f20d0cc 100644
--- a/src/System/config.in
+++ b/src/System/config.in
@@ -6,6 +6,9 @@
 /* Defined if ...-style argument passing works */
 #undef DOTS_OK
 
+/* Dynamic linking works */
+#undef DYNAMIC_LINKING
+
 /* Enable experimental style rewriting code */
 #undef EXPERIMENTAL
 
@@ -33,6 +36,9 @@
 /* Guile library name */
 #undef GUILE_NUM
 
+/* Define to 1 if you have the `dlopen' function. */
+#undef HAVE_DLOPEN
+
 /* Define to 1 if the system has the type `FILE'. */
 #undef HAVE_FILE
 
@@ -45,12 +51,21 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `dl' library (-ldl). */
+#undef HAVE_LIBDL
+
+/* Define to 1 if you have the `dld' library (-ldld). */
+#undef HAVE_LIBDLD
+
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
 /* Define to 1 if you have the <pty.h> header file. */
 #undef HAVE_PTY_H
 
+/* Define to 1 if you have the `shl_load' function. */
+#undef HAVE_SHL_LOAD
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
@@ -132,9 +147,6 @@
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
-/* Dynamic linking function name */
-#undef TM_DYNAMIC_LINKING
-
 /* Use axel library */
 #undef USE_AXEL
 
diff --git a/src/System/tm_configure.in b/src/System/tm_configure.in
index 03c4ce7..cc90a73 100644
--- a/src/System/tm_configure.in
+++ b/src/System/tm_configure.in
@@ -19,7 +19,7 @@
 #define TEXMACS_SOURCES "@tmorig@"
 #define OS_@CONFIG_OS@
 #define GUILE_@CONFIG_GUILE_SERIAL@
-#define GUILE_BIN_@GUILE_BIN@
+#define GUILE_BIN_@GUILE_BIN_NODOT@
 #define WORD_LENGTH @CONFIG_WORD_LENGTH@
 #define WORD_LENGTH_INC @CONFIG_WORD_LENGTH_INC@
 #define WORD_MASK @CONFIG_WORD_MASK@
diff --git a/src/makefile.in b/src/makefile.in
index e53b6b1..e465a4e 100644
--- a/src/makefile.in
+++ b/src/makefile.in
@@ -41,7 +41,7 @@ CXXCAIRO = @CAIRO_CXX@
 CXXIMLIB2 = @IMLIB2_CXX@
 CXXSQLITE3 = @SQLITE3_CXX@
 CXXFREETYPE = @FREETYPE_CFLAGS@
-CXXICONV = @ICONV_CXX@
+CXXICONV = @ICONV_CFLAGS@
 CXXGUILE = @GUILE_CFLAGS@
 CXXSPARKLE = @SPARKLE_CXX@
 CXXPDF = @PDF_CFLAGS@
@@ -53,11 +53,13 @@ LDRT = @CONFIG_LDRT@
 LDSTATIC = @CONFIG_BSTATIC@
 LDSHARED = @CONFIG_BSHARED@
 LDPATH = @CONFIG_BPATH@
+LDDL = @CONFIG_BDL@
 LDX11 = @X11_LDFLAGS@
 LDCOCOA = @COCOA_LDFLAGS@
 LDQT = @QT_LIBS@
 LDGUI = $(LD@CONFIG_GUI@)
 LDFREETYPE = @FREETYPE_LDFLAGS@
+LDICONV = @ICONV_LDFLAGS@
 #LDGUILE = @GUILE_LDFLAGS@
 
 AR = ar