comparison configure.ac @ 2970:83c17a84bc27

Update the configure scripts with the latest autotools. configure.in is now configure.ac. AC_DEFINE() now requires additional parameters. Use AX_CXX_COMPILE_STDCXX to determine the C++11 options. AX_CXX_COMPILE_STDCXX requires the autoconf-archive package. autoreconf created a new install-sh script. Remove the old install.sh script, which is now ancient.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 20 Mar 2023 22:49:06 +0000
parents
children d84182f0054e
comparison
equal deleted inserted replaced
2969:8a2079224bc4 2970:83c17a84bc27
1 AC_INIT([dwindows],[3.3])
2 AC_CONFIG_HEADERS([dwconfig.h])
3
4 TARGET="dwindows"
5 TARGET2="dwcompat"
6 AC_SUBST(TARGET)
7 AC_SUBST(TARGET2)
8
9 AC_DEFUN([AC_DATAROOTDIR_CHECKED])
10
11 DW_DIR=gtk3
12 DW_SRC=dw.c
13 DW_DEFINE=__UNIX__
14 SHAREDFLAG=-shared
15 SOSUFFIX=so
16 LIBSUFFIX=a
17 LIBPREFIX=lib
18 INSTALL_TEST="installdwtest"
19 INCLUDES="-I."
20
21 AC_PROG_CC
22 AC_PROG_CXX
23 AX_CXX_COMPILE_STDCXX(11,,optional)
24
25 AC_CHECK_PROG(MAKE, gmake, gmake)
26 if test x"$MAKE" = x; then
27 AC_CHECK_PROG(MAKE, make, make)
28 fi
29 if test -d .svn; then
30 AC_CHECK_PROG(SVNVERSION, svnversion, svnversion)
31 fi
32 if test x"$SVNVERSION" = x; then
33 SVNVERSION=0
34 else
35 SVNVERSION="\` $SVNVERSION -n . | cut -d \":\" -f 1 | tr -d MS \`"
36 fi
37
38 AC_PROG_INSTALL
39
40 AC_SUBST(MAKE)
41
42 dnl Checks for system
43 AC_CANONICAL_TARGET
44
45 dnl ---------------------- check for '--with-dwcompat' switch -----------------
46 AC_ARG_WITH(dwcompat,
47 [ --with-dwcompat specify this to build the optional dwcompat library],
48 [with_dwcompat=$withval],
49 [with_dwcompat=no],
50 )
51
52 dnl ---------------------- check for '--with-gtk2' switch -----------------
53 AC_ARG_WITH(gtk2,
54 [ --with-gtk2 specify this to build with GTK+ 2.x if available],
55 [with_gtk2=$withval],
56 [with_gtk2=no],
57 )
58
59 dnl ---------------------- check for '--with-gtk4' switch -----------------
60 AC_ARG_WITH(gtk4,
61 [ --with-gtk4 specify this to build with GTK+ 4.x if available],
62 [with_gtk4=$withval],
63 [with_gtk4=no],
64 )
65
66 dnl ---------------------- check for '--with-deprecated' switch -----------------
67 AC_ARG_WITH(deprecated,
68 [ --with-deprecated specify this to build with deprecated functions],
69 [with_deprecated=$withval],
70 [with_deprecated=no],
71 )
72
73 dnl ---------------------- check for '--with-arch' switch -----------------
74 AC_ARG_WITH(arch,
75 [ --with-arch specify MacOS architecture: one of modern, classic, 32bit, intel, arm, powerpc],
76 [with_arch=$withval],
77 [with_arch=no],
78 )
79
80 dnl ---------------------- check for '--with-sdk' switch -----------------
81 AC_ARG_WITH(sdk,
82 [ --with-sdk specify this to build with an alternate MacOS SDK location],
83 [with_sdk=$withval],
84 [with_sdk=no],
85 )
86
87 dnl ---------------------- check for '--with-minver' switch -----------------
88 AC_ARG_WITH(minver,
89 [ --with-minver specify this to build with a minimum MacOS version],
90 [with_minver=$withval],
91 [with_minver=no],
92 )
93
94 AC_HEADER_DIRENT
95 AC_CHECK_HEADERS(unistd.h)
96 AC_CHECK_HEADERS(sys/stat.h)
97
98 AC_CHECK_FUNCS(pipe, AC_DEFINE(HAVE_PIPE,1,Determine whether we have the pipe function))
99 AC_CHECK_FUNCS(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF,1,Determine whether we have the vsnprintf function))
100
101 AC_CHECK_FUNCS(connect)
102 if test x"$ac_cv_func_connect" = x"no"; then
103 if test -z "$libsocket"; then
104 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket",)
105 fi
106
107 dnl this is for isc. need the nsl_s library as well.
108 if test -z "$libinet"; then
109 AC_CHECK_LIB(inet, socket, libnsl=1; LIBS="$LIBS -linet -lnsl_s",)
110 fi
111
112 if test -z "$libnsl"; then
113 AC_CHECK_LIB(nsl, gethostname, LIBS="$LIBS -lnsl",)
114 fi
115 fi
116
117 AC_CHECK_LIB(sun, getpwnam, LIBS="$LIBS -lsun",)
118 AC_CHECK_LIB(dgc, inet_addr, LIBS="$LIBS -ldgc",)
119 AC_CHECK_LIB(resolv, gethostbyname, LIBS="$LIBS -lresolv",)
120 AC_CHECK_LIB(m, atan2, LIBS="$LIBS -lm",)
121
122 build_gtk="yes"
123 check_pthreads="yes"
124 PLATLIBS=""
125 SONAME=""
126 PLATCCFLAGS="-g -O2 -fPIC -Wall"
127 ARFLAGS="cqs"
128 ARCH=""
129
130 case "$target" in
131 *cygwin*)
132 ;;
133 *mingw32)
134 AC_DEFINE(DW_USE_GTK,1,Uses GTK but not on X11 or Wayland)
135 ;;
136 *linux*)
137 SONAME="-Wl,-soname,lib$TARGET.so.\$(DW_MAJOR_VERSION)"
138 ;;
139 *apple-darwin*)
140 case "$with_arch" in
141 no)
142 ARCH=""
143 ;;
144 classic)
145 ARCH="-arch ppc -arch x86_64 -arch i386"
146 ;;
147 32bit)
148 ARCH="-arch ppc -arch i386"
149 ;;
150 intel)
151 ARCH="-arch i386 -arch x86_64"
152 ;;
153 powerpc)
154 ARCH="-arch ppc -arch ppc64"
155 ;;
156 arm)
157 ARCH="-arch arm64"
158 ;;
159 modern)
160 ARCH="-arch x86_64 -arch arm64"
161 ;;
162 *)
163 ARCH="-arch $with_arch"
164 ;;
165 esac
166 case "$with_sdk" in
167 no)
168 ;;
169 *)
170 CC="$CC -isysroot$with_sdk"
171 ;;
172 esac
173 case "$with_minver" in
174 no)
175 ;;
176 *)
177 CFLAGS="$CFLAGS -mmacosx-version-min=$with_minver"
178 LIBS="$LIBS -mmacosx-version-min=$with_minver"
179 ;;
180 esac
181 SHAREDFLAG="-dynamiclib -flat_namespace -undefined suppress -headerpad_max_install_names"
182 SOSUFFIX=dylib
183 DW_DIR=mac
184 DW_SRC=dw.m
185 DW_DEFINE=__MAC__
186 LIBS="$LIBS -framework Cocoa -framework WebKit"
187 save_libs="$LIBS"
188 LIBS="$LIBS -weak_framework UserNotifications"
189 INSTALL_TEST=""
190 AC_CHECK_FUNC(exit, , [LIBS="$save_libs"])
191 build_gtk="no"
192 ;;
193 *)
194 ;;
195 esac
196
197 dnl ---------------------- default targets to build -----------------
198 if test $with_dwcompat = yes; then
199 COMPAT_OBJECT="dwcompat.o"
200 INSTALL_COMPAT="installdwcompat"
201 SYSCONF_LINK_TARGET_SHARED2="lib$TARGET2.$SOSUFFIX.\$(DW_MAJOR_VERSION).\$(DW_MINOR_VERSION)"
202 else
203 COMPAT_OBJECT=""
204 INSTALL_COMPAT=""
205 SYSCONF_LINK_TARGET_SHARED2=""
206 fi
207 SYSCONF_LINK_TARGET_SHARED="lib$TARGET.$SOSUFFIX.\$(DW_MAJOR_VERSION).\$(DW_MINOR_VERSION)"
208 SYSCONF_LINK_TARGET_STATIC="lib$TARGET.a"
209
210 TARGETS="$SYSCONF_LINK_TARGET_SHARED $SYSCONF_LINK_TARGET_SHARED2"
211
212 if test $build_gtk = "yes"; then
213 AC_PATH_XTRA
214 LIBS="$LIBS $X_LIBS -lX11"
215 AC_CHECK_PROG(PKG_CFG, pkg-config, pkg-config)
216 if test x"$PKG_CFG" != x; then
217 # Figure out the best available GTK packages...
218 # Preference order GTK3>GTK4>GTK2, WebKit2>WebKit1.1>WebKit1.0>WebKit
219 GTK_LIBS=""
220 GTK_PACKAGES=""
221 WEBKIT_PKG=""
222 WEBKIT_ALT_PKG=""
223 if test $with_gtk4 = "yes"; then
224 # First try the X11 version so we can call Xlib directly
225 # to fill in the holes not available with Wayland
226 GTK_PACKAGES="gtk4-x11"
227 GTK_LIBS=`$PKG_CFG --silence-errors --libs $GTK_PACKAGES`
228 if test x"$GTK_LIBS" = x; then
229 GTK_PACKAGES="gtk4"
230 GTK_LIBS=`$PKG_CFG --silence-errors --libs $GTK_PACKAGES`
231 fi
232 if test x"$GTK_LIBS" != x; then
233 DW_DIR=gtk4
234 # WebKit2GTK built for GTK4 becomes 5.0
235 WEBKIT_PKG="webkit2gtk-5.0"
236 fi
237 else
238 # Put the GTK2 test here since --with-gtk2 is mutually
239 # exclusive with --with-gtk4
240 if test $with_gtk2 = "yes"; then
241 GTK_PACKAGES="gtk+-2.0 gthread-2.0"
242 GTK_LIBS=`$PKG_CFG --silence-errors --libs $GTK_PACKAGES`
243 if test x"$GTK_LIBS" != x; then
244 DW_DIR=gtk
245 WEBKIT_PKG="webkit-1.1"
246 WEBKIT_ALT_PKG="webkit-1.0"
247 fi
248 fi
249 fi
250 # We did not successfully find a GTK installation after
251 # handling --with-gtk2 and --with-gtk4 so try GTK3
252 if test x"$GTK_LIBS" = x; then
253 # GTK3 Defaults section
254 GTK_PACKAGES="gtk+-3.0"
255 GTK_LIBS=`$PKG_CFG --silence-errors --libs $GTK_PACKAGES`
256 WEBKIT_PKG="webkit2gtk-4.0"
257 WEBKIT_ALT_PKG="webkitgtk-3.0"
258 fi
259 echo "checking for GTK version: $DW_DIR"
260 # Test for the preferred WebKit package
261 WEBKIT_LIBS=`$PKG_CFG --silence-errors --libs $WEBKIT_PKG`
262 if test x"$WEBKIT_LIBS" = x; then
263 # Preferred package is not available, try the alternate if defined
264 if test x"$WEBKIT_ALT_PKG" != x; then
265 WEBKIT_LIBS=`$PKG_CFG --silence-errors --libs $WEBKIT_ALT_PKG`
266 if test x"$WEBKIT_LIBS" != x; then
267 WEBKIT_PKG=$WEBKIT_ALT_PKG
268 fi
269 fi
270 fi
271 echo "checking for WebKit package: $WEBKIT_PKG"
272 WEBKIT_CFLAGS=`$PKG_CFG --silence-errors --cflags $WEBKIT_PKG`
273 # If we got a WebKit package that might work...
274 # Add defintitions necessary for the correct code paths
275 if test x"$WEBKIT_LIBS" != x; then
276 if test "$WEBKIT_PKG" = "webkit-1.0"; then
277 AC_DEFINE(USE_WEBKIT10,1,Uses WebKit 1.0)
278 fi
279 if test "$WEBKIT_PKG" = "webkit-1.1"; then
280 AC_DEFINE(USE_WEBKIT11,1,Uses WebKit 1.1)
281 fi
282 if test "$WEBKIT_PKG" = "webkit2gtk-4.0"; then
283 AC_DEFINE(USE_WEBKIT2,1,Uses WebKit 2)
284 fi
285 fi
286 if test x"$RPATH" != x; then
287 RPATH="-Wl,-R$RPATH"
288 fi
289 fi
290
291 GTK_CFLAGS=`$PKG_CFG --cflags $GTK_PACKAGES`
292 GTK_LIBS=`$PKG_CFG --libs $GTK_PACKAGES`
293 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.32.0], [DW_GRESOURCE="enabled"], [CFLAGS="$CFLAGS -DDW_INCLUDE_DEPRECATED_RESOURCES=1"])
294 fi
295
296 if test $check_pthreads = "yes"; then
297 AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([pthread header not found. Dynamic Windows cannot build without it.]))
298 AC_CHECK_LIB(pthread,
299 pthread_attr_init,
300 PTHREAD_LIBS="-lpthread",
301 AC_CHECK_LIB(pthreads,
302 pthread_attr_init,
303 PTHREAD_LIBS="-lpthreads",
304 AC_CHECK_LIB(c_r,
305 pthread_attr_init,
306 PTHREAD_LIBS="-lc_r",
307 AC_CHECK_LIB(c,
308 pthread_attr_init,
309 PTHREAD_LIBS="-lc",
310 AC_MSG_ERROR(pthread library not found. dwindows cannot build without it.)
311 )
312 )
313 )
314 )
315 fi
316
317 CFLAGS="$CFLAGS $GTK_CFLAGS $GDK_IMLIB_FLAGS $WEBKIT_CFLAGS"
318
319 if test $with_deprecated = yes; then
320 CFLAGS="$CFLAGS -DDW_INCLUDE_DEPRECATED"
321 fi
322 if test x"$WEBKIT_LIBS" != x; then
323 WEBKIT_LIB=`$PKG_CFG --silence-errors --libs-only-l $WEBKIT_PKG | cut -b 3-`
324 AC_CHECK_LIB($WEBKIT_LIB,webkit_web_view_new,AC_DEFINE(USE_WEBKIT,1,Uses some flavor of WebKit),)
325 fi
326
327 LIBS="$RPATH $LIBS $GTK_LIBS $PTHREAD_LIBS $GDK_IMLIB_LIBS $WEBKIT_LIBS $PLATLIBS"
328
329 AC_CHECK_FUNCS(ubuntu_overlay_scrollbar_set_enabled, AC_DEFINE(HAVE_OVERLAY_SCROLLBARS,1,Define if we have Ubuntu overlay scrollbars))
330 AC_CHECK_FUNCS(ubuntu_gtk_set_use_overlay_scrollbar, AC_DEFINE(HAVE_OVERLAY_SCROLLBARS2,1,Define if we have Ubuntu overlay scrollbars))
331
332 RM="rm -f"
333 LN="ln -s"
334 CP="cp"
335 MV="mv"
336 MKDIR="mkdir"
337
338 AC_SUBST(SYSCONF_LINK_TARGET_SHARED)
339 AC_SUBST(SYSCONF_LINK_TARGET_SHARED2)
340 AC_SUBST(SYSCONF_LINK_TARGET_STATIC)
341
342 AC_SUBST(INCLUDES)
343 AC_SUBST(PLATCCFLAGS)
344 AC_SUBST(ARFLAGS)
345 AC_SUBST(RM)
346 AC_SUBST(LN)
347 AC_SUBST(CP)
348 AC_SUBST(MV)
349 AC_SUBST(MKDIR)
350 AC_SUBST(SHAREDFLAG)
351 AC_SUBST(SOSUFFIX)
352 AC_SUBST(LIBSUFFIX)
353 AC_SUBST(LIBPREFIX)
354 AC_SUBST(SONAME)
355 AC_SUBST(TARGETS)
356
357 AC_SUBST(DW_SRC)
358 AC_SUBST(DW_DIR)
359 AC_SUBST(DW_DEFINE)
360 AC_SUBST(DW_GRESOURCE)
361 AC_SUBST(BROWSER_OBJECT)
362 AC_SUBST(COMPAT_OBJECT)
363 AC_SUBST(INSTALL_COMPAT)
364 AC_SUBST(INSTALL_TEST)
365
366 AC_SUBST(ARCH)
367
368 AC_CONFIG_FILES([
369 Makefile
370 dwindows1.pc
371 dwindows-config1
372 org.dbsoft.dwindows.dwtest.desktop ])
373 AC_OUTPUT