| 1 |
# Autoconf macros for xdvik. |
| 2 |
# Copyright (C) 2002 - 2009 Paul Vojta <[email protected]> |
| 3 |
# Copyright (C) 2009 Peter Breitenlohner <[email protected]> |
| 4 |
# |
| 5 |
# This file is free software; the copyright holders |
| 6 |
# give unlimited permission to copy and/or distribute it, |
| 7 |
# with or without modifications, as long as this notice is preserved. |
| 8 |
|
| 9 |
# XDVI_LINKER_MULTIPLE_DEFNS |
| 10 |
# -------------------------- |
| 11 |
# Check if the --allow-multiple-definition linker flag is |
| 12 |
# available (assuming that we need to use it if it is). |
| 13 |
# If it isn't, check if the linker accepts multiple definitions, |
| 14 |
# and if it doesn't, don't define LD_ALLOWS_MULTIPLE_DEFINITIONS. |
| 15 |
|
| 16 |
AC_DEFUN([XDVI_LINKER_MULTIPLE_DEFNS], |
| 17 |
[AC_CACHE_CHECK( |
| 18 |
[if linker supports multiple definitions and for required flags], |
| 19 |
[xdvi_cv_linker_multiple_defns], |
| 20 |
[xdvi_ld_save_LDFLAGS=$LDFLAGS |
| 21 |
LDFLAGS="-Xlinker --allow-multiple-definition" |
| 22 |
AC_LINK_IFELSE( |
| 23 |
[AC_LANG_PROGRAM([[#include <stdio.h>]], [[void foo(void);]])], |
| 24 |
[xdvi_cv_linker_multiple_defns=$LDFLAGS], |
| 25 |
[xdvi_ld_save_LIBS=$LIBS |
| 26 |
xdvi_ld_save_CFLAGS=$CFLAGS |
| 27 |
xdvi_ld_save_CPPFLAGS=$CPPFLAGS |
| 28 |
|
| 29 |
LIBS="$X_PRE_LIBS -lXt -lX11 $X_EXTRA_LIBS $LIBS" |
| 30 |
CFLAGS="$X_CFLAGS $CFLAGS" |
| 31 |
CPPFLAGS="$X_CFLAGS $CPPFLAGS" |
| 32 |
LDFLAGS="$X_LIBS $xdvi_ld_save_LDFLAGS" |
| 33 |
|
| 34 |
AC_LINK_IFELSE( |
| 35 |
[AC_LANG_PROGRAM( |
| 36 |
[[#include <X11/Intrinsic.h> |
| 37 |
|
| 38 |
XtIntervalId XtAppAddTimeOut(XtAppContext app, |
| 39 |
unsigned long interval, |
| 40 |
XtTimerCallbackProc proc, |
| 41 |
XtPointer closure) |
| 42 |
{ |
| 43 |
(void)app; (void)interval; (void)proc; (void)closure; |
| 44 |
return (XtIntervalId)0; |
| 45 |
}]], |
| 46 |
[[XtIntervalId i = 0; XtRemoveTimeOut(i);]])], |
| 47 |
[xdvi_cv_linker_multiple_defns="none required"], |
| 48 |
[xdvi_cv_linker_multiple_defns=unsupported]) |
| 49 |
|
| 50 |
LIBS=$xdvi_ld_save_LIBS |
| 51 |
CFLAGS=$xdvi_ld_save_CFLAGS |
| 52 |
CPPFLAGS=$xdvi_ld_save_CPPFLAGS]) |
| 53 |
LDFLAGS=$xdvi_ld_save_LDFLAGS]) |
| 54 |
|
| 55 |
x_linker_options="" |
| 56 |
AS_CASE([$xdvi_cv_linker_multiple_defns], |
| 57 |
["none required"], [AC_DEFINE([LD_ALLOWS_MULTIPLE_DEFINITIONS], 1, |
| 58 |
[Define if your system allows multiple definitions of functions.])], |
| 59 |
[unsupported], [AC_MSG_WARN([Linker does not allow multiple definitions. |
| 60 |
***************************************************************** |
| 61 |
* Warning: Your linker does not allow multiple definitions. * |
| 62 |
* This does not make xdvik unusable, but it will cause problems * |
| 63 |
* with event handling: Some widgets, e.g. the print log window, * |
| 64 |
* tooltips, statusline messages and hyperlink location markers * |
| 65 |
* will not be updated until the mouse is moved. * |
| 66 |
*****************************************************************])], |
| 67 |
[x_linker_options=$xdvi_cv_linker_multiple_defns |
| 68 |
AC_DEFINE([LD_ALLOWS_MULTIPLE_DEFINITIONS], 1)]) |
| 69 |
AC_SUBST([x_linker_options]) |
| 70 |
]) # XDVI_LINKER_MULTIPLE_DEFNS |