Debian Codegraph @

common/incdebug.m4

raw
1 dnl
2 dnl Common configure switches related to debugging
3 dnl
4 dnl Uses following functions:
5 dnl
6
7 dnl --------------- allow --enable-debug to compile in debug mode --------
8 AC_ARG_ENABLE(debug,
9 [ --enable-debug turn on debugging],
10 [with_debug=$enableval],
11 [with_debug=no],
12 )
13 DEBUG=""
14 DEBUGGING=""
15 cflags_g="`echo $CFLAGS | grep -c '\-g'`"
16 cflags_O="`echo $CFLAGS | grep -c '\-O'`"
17
18 if test "$with_debug" = yes; then
19 DEBUG="-DDEBUG"
20 DEBUGGING="-g"
21 if test "$cflags_g" = "0"; then
22 CFLAGS="${CFLAGS} -g"
23 fi
24 if test "$cflags_O" != "0"; then
25 CFLAGS="`echo ${CFLAGS} | sed -e s/-O.//`"
26 fi
27 else
28 DEBUG="-DNDEBUG"
29 if test "$cflags_O" = "0"; then
30 CFLAGS="${CFLAGS} -O"
31 fi
32 if test "$cflags_g" = "0"; then
33 CFLAGS="${CFLAGS} -g"
34 fi
35 fi
36 if test "$ac_cv_prog_CC" = "gcc" -o "$ac_cv_prog_CC" = "g++" -o "$ac_cv_prog_CC" = "clang"; then
37 if test "$with_debug" = yes; then
38 CFLAGS="${CFLAGS} -Wall"
39 else
40 CFLAGS="${CFLAGS} -O3 -Wall -fomit-frame-pointer -fno-strict-aliasing -Wno-char-subscripts"
41 fi
42 fi
43 if test "$on_qnx4" = yes; then
44 if test "$ac_cv_prog_CC" = "gcc"; then
45 QNX4_CFLAGS=""
46 else
47 if test "$SIMPLE_CFLAGS" = "yes"; then
48 QNX4_CFLAGS="-O"
49 else
50 QNX4_CFLAGS="-Wc,-r -b -j -Wc,-ei -N4096000 -mf -DNO_REGEX -DQNX -DQNX4 -D__QNX__ -DSTRINGS_ALIGNED -Q"
51 fi
52 fi
53 if test "$with_debug" = yes; then
54 CFLAGS="-g $QNX4_CFLAGS"
55 else
56 CFLAGS="-Otax $QNX4_CFLAGS"
57 fi
58 fi
59 if test "$on_beos" = yes; then
60 if test "$with_debug" = yes; then
61 CFLAGS="${CFLAGS} -Wall"
62 else
63 CFLAGS="${CFLAGS} -O2 -Wall"
64 fi
65 if test "$datadir" = "\${prefix}/share"; then
66 datadir="/boot/home/config/add-ons"
67 fi
68 fi
69 if test "$on_haiku" = yes; then
70 if test "$with_debug" = yes; then
71 CFLAGS="${CFLAGS} -Wall"
72 else
73 CFLAGS="${CFLAGS} -O2 -Wall"
74 fi
75 if test "$datadir" = "\${prefix}/share"; then
76 datadir="/boot/home/config/non-packaged/add-ons"
77 fi
78 fi
79 AC_SUBST(DEBUG)
80 AC_SUBST(DEBUGGING)
81
82 dnl --------------- allow --enable-purify to enable linking with Purify
83 AC_ARG_ENABLE(purify,
84 [ --enable-purify link with Purify (TM)],
85 [with_purify=$enableval],
86 [with_purify=no],
87 )
88 if test "$with_purify" = yes; then
89 PURIFY="purify"
90 else
91 PURIFY=""
92 fi
93 AC_SUBST(PURIFY)
94
95 dnl --------------- allow --enable-efence to enable linking with Electric Fence
96 AC_ARG_ENABLE(efence,
97 [ --enable-efence link with Electric Fence],
98 [with_efence=$enableval],
99 [with_efence=no],
100 )
101 if test "$with_efence" = yes; then
102 EFENCE="-lefence"
103 else
104 EFENCE=""
105 fi
106 AC_SUBST(EFENCE)
107
108 dnl --------------- enable --enable-hpux-portable to enable HP-UX binaries to run on all chipsets
109 AC_ARG_ENABLE(hpux_portable,
110 [ --enable-hpux-portable make HP-UX binaries portable],
111 [enable_hpux_portable=$enableval],
112 [enable_hpux_portable=no],
113 )
114
115 dnl --------------- allow --with-dlfcnincdir to enable compiling with dlfcn.h on platforms that don't provide dl*() functions natively
116 AC_ARG_WITH(dlfcnincdir,
117 [ --with-dlfcnincdir location of dlfcn.h],
118 [with_dlfcnincdir=$withval],
119 [with_dlfcnincdir=no],
120 )
121 if test "$with_dlfcnincdir" = no; then
122 DLFCNINCDIR=""
123 AC_CHECK_HEADERS( dlfcn.h )
124 if test "$ac_cv_header_dlfcn_h" = "yes" -o "$HAVE_DLFCN_H" = "1"; then
125 HAVE_DLFCN_H="1"
126 else
127 #
128 # Ignore the warning messages for specified platforms
129 #
130 case "$target" in
131 *beos*)
132 ;;
133 *qnx*)
134 ;;
135 *)
136 AC_MSG_WARN(Could not find dlfcn.h in the standard header locations.)
137 AC_MSG_WARN(If your platform does support dynamic loading ie you have dlfcn.h )
138 AC_MSG_WARN(then you may need to specify the location of dlfcn.h with the --with-dlfcnincdir switch)
139 AC_MSG_WARN(and the location of libdl.so with the --with-dlfcnlibdir switch.)
140 ;;
141 esac
142 fi
143 else
144 if test -f "$with_dlfcnincdir/dlfcn.h"; then
145 DLFCNINCDIR="-I$with_dlfcnincdir"
146 HAVE_DLFCN_H="1"
147 AC_DEFINE(HAVE_DLFCN_H)
148 else
149 AC_MSG_ERROR(dlfcn.h not found in \"$with_dlfcnincdir\" as specified in --with-dlfcnincdir switch; cannot continue)
150 fi
151 fi
152 AC_SUBST(DLFCNINCDIR)
153
154 MH_SHLPST
155 dnl --------------- allow --with-dlfcnlibdir to enable compiling with dlfcn.h on platforms that don't provide dl*() functions natively
156 AC_ARG_WITH(dlfcnlibdir,
157 [ --with-dlfcnlibdir location of libdl.a(AIX) libdl.dylib(MacOSX)],
158 [with_dlfcnlibdir=$withval],
159 [with_dlfcnlibdir=no],
160 )
161 if test "$with_dlfcnlibdir" = no; then
162 DLFCNLIBDIR=""
163 else
164 if test -f "$with_dlfcnlibdir/libdl$SHLPST"; then
165 DLFCNLIBDIR="-L$with_dlfcnlibdir -ldl"
166 else
167 AC_MSG_ERROR(libdl$SHLPST not found in \"$with_dlfcnlibdir\" as specified in --with-dlfcnlibdir switch; cannot continue)
168 fi
169 fi
170 AC_SUBST(DLFCNLIBDIR)