1dnl -*- autoconf -*-
2
3dnl $Id$
4
5dnl not sure exactly what the minimum version is (but 2.13 wont work)
6AC_PREREQ(2.58)
7
8dnl Set the BOINC version here.  You can also use the set-version script.
9AC_INIT(BOINC, 7.8.6)
10AC_CONFIG_MACRO_DIR([m4])
11LIBBOINC_VERSION=`echo ${PACKAGE_VERSION} | sed 's/\./:/g'`
12AC_SUBST([LIBBOINC_VERSION])
13
14WRAPPER_RELEASE=26016
15AC_SUBST([WRAPPER_RELEASE])
16
17VBOXWRAPPER_RELEASE=26197
18AC_SUBST([VBOXWRAPPER_RELEASE])
19
20AC_CANONICAL_TARGET
21
22dnl generate .tar.gz, .tar.bz2, .zip
23dnl AM_INIT_AUTOMAKE(dist-bzip2 dist-zip)
24
25dnl subdir-objects is supposed to become the default soon, but specifying it
26dnl breaks depfile generation.  We'll worry about it when that happens.
27dnl AM_INIT_AUTOMAKE(dist-zip subdir-objects)
28
29AM_INIT_AUTOMAKE(dist-zip)
30
31m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
32
33AC_CONFIG_SRCDIR(lib/shmem.cpp)
34
35AC_REVISION([$Revision$])
36REV=`echo '$Revision$' | awk "{print $2}"`
37RDATE=`date '+%Y.%m.%d'`
38if test -d .svn ; then
39  REV=`svn info | grep Revision | awk '{print $2}'`
40  RDATE=`svn info | grep "Last Changed Date:" | awk '{print $4}' | sed 's/-/./g'`
41fi
42AC_SUBST(REV)
43AC_SUBST(RDATE)
44
45dnl Are we compiling for windows
46if echo $host_os | egrep '^mingw|^winnt' > /dev/null ; then
47  isWIN32=yes
48else
49  isWIN32=no
50fi
51
52dnl turn dependency tracking on by default
53if test x${enable_dependency_tracking} != xno ; then
54  enable_dependency_tracking=yes
55fi
56
57dnl Checks for programs.
58AC_PROG_CC
59AC_PROG_CXX
60dnl ------
61dnl Workaround for autoconf >= 2.65 backwards incompatibility
62m4_pattern_allow([AC_PROG_OBJCXX])
63m4_ifdef([AC_PROG_OBJCXX],[AC_PROG_OBJCXX],)
64dnl ------
65AC_PROG_F77
66AC_PROG_CPP
67AC_PROG_MAKE_SET
68SAH_LINKS
69AC_LANG_PUSH(C)
70AM_PROG_CC_C_O
71
72m4_divert_once([HELP_ENABLE],
73  AS_HELP_STRING([BOINC Default enable values], [--enable-server --enable-client --enable-libraries --enable-manager: builds server, client, and libraries]))
74
75AC_ARG_ENABLE(dynamic-client-linkage,
76    AS_HELP_STRING([--enable-dynamic-client-linkage],
77                   [dynamically link the client to the boinc libraries]),
78    [dynamic_client=${enableval}],
79    [dynamic_client=no])
80
81AC_ARG_ENABLE(server,
82    AS_HELP_STRING([--disable-server],
83                   [disable building the scheduling server]),
84    [enable_server=${enableval}],
85    [enable_server=yes])
86
87AC_ARG_ENABLE(fcgi,
88    AS_HELP_STRING([--disable-fcgi],
89                   [disable building fcgi libraries or server components]),
90    [enable_fcgi=${enableval}],
91    [enable_fcgi=${enable_server}])
92
93AC_ARG_ENABLE(client,
94    AS_HELP_STRING([--disable-client],
95                   [disable building the client]),
96    [enable_client=${enableval}],
97    [enable_client=yes])
98
99AC_ARG_ENABLE(manager,
100    AS_HELP_STRING([--disable-manager],
101                   [disable building the boinc manager gui]),
102    [enable_manager=${enableval}],
103    [enable_manager=yes])
104
105AC_ARG_ENABLE(libraries,
106    AS_HELP_STRING([--disable-libraries],
107                   [disable building the boinc client and server libraries]),
108    [enable_libraries=${enableval}],
109    [enable_libraries=yes])
110
111AC_ARG_ENABLE(install-headers,
112    AS_HELP_STRING([--disable-install-headers],
113                   [if building libraries do not install the boinc library
114                    header files]),
115    [enable_install_headers=${enableval}],
116    [enable_install_headers=yes])
117
118AC_ARG_ENABLE(boinczip,
119    AS_HELP_STRING([--enable-boinczip],
120                   [enable building the boinc zip library]),
121    [enable_boinczip=${enableval}],
122    [enable_boinczip=no])
123
124AC_ARG_ENABLE(apps,
125    AS_HELP_STRING([--enable-apps],
126                   [enable building the boinc example apps]),
127    [enable_apps=${enableval}],
128    [enable_apps=no])
129
130AC_ARG_ENABLE(pkg-libs,
131    AS_HELP_STRING([--enable-pkg-libs],
132                   [Builds and installs components that would be present in a
133		   boinc-libs package.  This is a synonym for --disable-server
134		   --disable-client --enable-libraries --disable-static
135		   --disable-install-headers --disable-manager --enable-boinczip]),
136    [
137     enable_libraries=yes
138     enable_server=no
139     enable_client=no
140     enable_manager=no
141     enable_install_headers=no
142     enable_static=no
143	 enable_boinczip=yes
144	 enable_apps=no
145    ],
146    [])
147
148AC_ARG_ENABLE(pkg-devel,
149    AS_HELP_STRING([--enable-pkg-devel],
150                   [Builds and installs components that would be present in a
151		   boinc-devel package.  This is a synonym for --disable-server
152		   --disable-client --enable-libraries --enable-install-headers
153		   --disable-manger --enable-boinczip]),
154    [
155     enable_libraries=yes
156     enable_server=no
157     enable_client=no
158     enable_manager=no
159     enable_install_headers=yes
160	 enable_boinczip=yes
161	 enable_apps=no
162    ],
163    [])
164
165AC_ARG_ENABLE(pkg-client,
166    AS_HELP_STRING([--enable-pkg-client],
167                   [Builds and installs components that would be present in a
168		   boinc-client package. This is a synonym for --disable-server
169		   --enable-client --disable-libraries --disable-manager
170    ]),
171    [
172     enable_libraries=no
173     enable_server=no
174     enable_client=yes
175     enable_manager=no
176     enable_install_headers=no
177	 enable_boinczip=no
178	 enable_apps=no
179    ],
180    [])
181
182AC_ARG_ENABLE(pkg-manager,
183    AS_HELP_STRING([--enable-pkg-manager],
184                   [Builds and installs components that would be present in a boinc-manager package. This is a synonym for --disable-server --disable-client --disable-libraries --enable-manager
185    ]),
186    [
187     enable_libraries=no
188     enable_server=no
189     enable_client=no
190     enable_manager=yes
191     enable_install_headers=no
192	 enable_boinczip=no
193	 enable_apps=no
194    ],
195    [])
196
197BOINC_SET_COMPILE_FLAGS
198
199configured_to_build=
200
201if test x$enable_client = xyes ; then
202  configured_to_build="client"
203  enable_xss="yes"
204fi
205if test x$enable_manager = xyes ; then
206  configured_to_build="${configured_to_build} manager"
207fi
208if test x$enable_libraries = xyes ; then
209  configured_to_build="${configured_to_build} libraries"
210fi
211if test x$enable_server = xyes ; then
212  configured_to_build="${configured_to_build} server"
213fi
214if test x$enable_apps = xyes ; then
215  configured_to_build="${configured_to_build} apps"
216fi
217
218if test -z "${configured_to_build}" ; then
219        AC_MSG_ERROR([
220================================================================================
221ERROR: I have been told to build nothing.
222
223    Please remove one of the --disable commands from your
224    configure command line.
225
226================================================================================
227        ])
228fi
229
230
231dnl ======================================================================
232dnl some vodoo required for building portable client-binary (client, clientgui)
233dnl ======================================================================
234AC_ARG_ENABLE([client-release],
235   AS_HELP_STRING([--enable-client-release],
236        [Attempt to build a portable "release-candidate": this links libstd++ and
237	other addon-libraries statically.
238	(On GNU/Linux you might need to use gcc-3.0 for this to produce a
239	binary that works for glibc <= 2.2 systems. => use CC=gcc-3.0 and CXX=g++-3.0)
240	(Default = no)]),
241    [
242       enable_client_release=yes
243       disable_static_linkage=no
244       enable_shared=no
245       AC_MSG_WARN([
246================================================================================
247WARNING:  You have requested a statically linked release build.
248
249    This option is not recommended for personal use or for building
250    an application for distribution via a package management system.
251    It probably wont work unless you have built your own static curl
252    and wxWidgets libraries that have minimal dependencies.  You may
253    also need to edit Makefiles manually in order for linking to work.
254
255    It is far better to use dynamic linkage, which can resolve most
256    library interdependencies at run time.
257
258    When the executable fails to link, and you can identify the missing
259    library, you can edit the Makefile to add it, or if there is a --with
260    option to configure, use it.
261
262    This is not easy.  It is not supported.  You have been warned.
263================================================================================
264    ])
265    echo Pausing 10 seconds...
266    sleep 10
267    ]
268    ,
269    [enable_client_release=no;disable_static_linkage=yes])
270
271
272if test "${enable_debug}" = yes ; then
273    build_state='Debug'
274else
275    build_state='Release'
276fi
277
278echo "--- Configuring BOINC AC_PACKAGE_VERSION (${build_state}) ---"
279echo "--- Build Components: (${configured_to_build}) ---"
280
281
282AC_COPYRIGHT([
283Berkeley Open Infrastructure for Network Computing
284http://boinc.berkeley.edu
285Copyright (C) 2005 University of California
286
287This is free software; you can redistribute it and/or
288modify it under the terms of the GNU Lesser General Public
289License as published by the Free Software Foundation;
290either version 2.1 of the License, or (at your option) any later version.
291
292This software is distributed in the hope that it will be useful,
293but WITHOUT ANY WARRANTY; without even the implied warranty of
294MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
295See the GNU Lesser General Public License for more details.
296
297To view the GNU Lesser General Public License visit
298http://www.gnu.org/copyleft/lesser.html
299or write to the Free Software Foundation, Inc.,
30051 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
301])
302
303AC_DEFUN([KC_STRIP_LEADING_ZEROS],[m4_bregexp([$*],[^0*\(..*\)],\1)])
304
305AC_DEFUN([BOINC_SET_VERSION],[dnl
306AC_SUBST([BOINC_MAJOR_VERSION],KC_STRIP_LEADING_ZEROS([$1]))
307AC_SUBST([BOINC_MINOR_VERSION],KC_STRIP_LEADING_ZEROS([$2]))
308AC_SUBST([BOINC_RELEASE],KC_STRIP_LEADING_ZEROS([$3]))
309AC_SUBST([BOINC_VERSION_STRING],AC_PACKAGE_VERSION)
310])
311
312BOINC_SET_VERSION(translit(AC_PACKAGE_VERSION, [.], [,]))
313
314dnl Version information moved to version.h so removed from config.h
315dnl AC_DEFINE_UNQUOTED([BOINC_VERSION_STRING], "$BOINC_VERSION_STRING", [String representation of BOINC version number])
316dnl AC_DEFINE_UNQUOTED([BOINC_MAJOR_VERSION], $BOINC_MAJOR_VERSION, [Major part of BOINC version number])
317dnl AC_DEFINE_UNQUOTED([BOINC_MINOR_VERSION], $BOINC_MINOR_VERSION, [Minor part of BOINC version number])
318dnl AC_DEFINE_UNQUOTED([BOINC_RELEASE], $BOINC_RELEASE, [Release part of BOINC version number])
319
320dnl Need to duplicate these AC_SUBST because some versions of autoconf wont
321dnl find AC_SUBST in a macro unless subsequently used in a DEFINE or SUBST
322dnl outside of a macro.  Dont ask me why.
323AC_SUBST([BOINC_VERSION_STRING])
324AC_SUBST([BOINC_MAJOR_VERSION])
325AC_SUBST([BOINC_MINOR_VERSION])
326
327AC_SUBST([TOP_BUILD_DIR], [`pwd`])
328
329## commented this out to turn all maintainer-mode features ON by default,
330## such as automatic reconfiguring on changes in Makefile.am's and configure.ac
331## AM_MAINTAINER_MODE
332
333
334dnl Check for docbook2x-man, which we use to create the manpages in
335dnl doc/manpages, and set the conditional HAVE_DOCBOOK2X_MAN to build
336dnl the manpages only if docbook2x-man is available.
337AC_PATH_PROG(DOCBOOK2X_MAN, docbook2x-man)
338AM_CONDITIONAL(HAVE_DOCBOOK2X_MAN, [test -n "${DOCBOOK2X_MAN}"])
339
340AC_SUBST([CLIENT_BIN_FILENAME],[boinc${EXEEXT}])
341AC_SUBST([CLIENT_CMD_BIN_FILENAME],[boinccmd${EXEEXT}])
342AC_SUBST([CLIENT_GUI_BIN_FILENAME],[boincmgr${EXEEXT}])
343
344dnl If we're running under cygwin, check whether we want to use X11 or WIN32
345dnl GUI
346BOINC_CHECK_CYGWIN
347
348dnl enable objective-C
349if test x$OBJC = x ; then
350  OBJC="$CC"
351fi
352if test x$OBJCXX = x ; then
353  OBJCXX="$CXX"
354fi
355_AM_DEPENDENCIES([OBJC])
356AC_SUBST(OBJC)
357AC_SUBST(OBJCXX)
358OBJCFLAGS="-ObjC"
359AC_SUBST(OBJCFLAGS)
360
361dnl LT_INIT
362AC_LIBTOOL_DLOPEN
363AC_LIBTOOL_WIN32_DLL
364AC_PROG_LIBTOOL
365AC_SUBST(PICFLAGS,${lt_prog_compiler_pic})
366
367SAH_OPTION_BITNESS
368
369dnl Determine the BOINC platform given the target arch-platform-os.
370BOINC_PLATFORM
371
372if ( test "${enable_client_release}" = yes ) && ( test "${enable_client}" != yes ); then
373   AC_MSG_WARN([--enable-client-release ignored.
374--------------------------------------------------
375The switch --enable-client-release is only useful for building the client and will be ignored
376--------------------------------------------------])
377fi
378
379
380
381dnl Find the extensions used on shared and static libraries on this system
382SAH_LIBEXT
383SAH_DLLEXT
384
385dnl THIS IS UNNECESSARY.  THE COMPILER SHOULD SET THESE
386dnl enable debug mode on all components using standard debug flags
387dnl if test "${enable_debug}" = yes; then
388    dnl CXXFLAGS="$CXXFLAGS -DDEBUG -D_DEBUG"
389    dnl CFLAGS="$CFLAGS -DDEBUG -D_DEBUG"
390dnl
391    dnl AC_SUBST(CXXFLAGS)
392    dnl AC_SUBST(CFLAGS)
393dnl fi
394
395if test "${enable_server}" = yes; then
396   AC_CHECK_MYSQL
397   if test "${no_mysql}" = yes; then
398      AC_MSG_WARN([ mysql not found.
399======================================================================
400WARNING: trying to build BOINC-server, but MYSQL was not be found.
401If you dont want to build the server you should use --disable-server.
402
403I am continuing now as if --disable-server had been specified.
404
405======================================================================
406])
407   enable_server=no
408   fi
409fi
410
411
412
413dnl Checks for libraries.
414
415dnl NOTE: Libraries subject to version changes, or those that might not be
416dnl installed everywhere should be linked statically when building portable
417dnl binaries.  Put libraries that should be linked statically on every platform
418dnl in the STATIC_LIB_LIST variable before calling SAH_CHECK_LIB.  (Note: Only
419dnl the '*' wildcard is supported).
420STATIC_LIB_LIST="stdc++* gcc gcc_s gcc_eh atk* gtk* gdk* gmodule* gthread* gobject* glib* pango* cairo* wx* tiff* jpeg* png* Xi glut socket z expat* krb5support freetype fontconfig* resolv* idn c_nonshared gpg* gss* gnutls sasl2 sqlite3"
421
422dnl We'll store these libs in a separate variable BOINC_EXTRA_LIBS for later
423dnl post-processing instead of the default-action, which would append
424dnl them to LIBS (note, we also dont define HAVE_LIBXXX, because
425dnl currently they arent used)
426
427dnl Special rules for specific targets go here:  It's easier to add static libs
428dnl than subtract them.  If you need to remove something from the list above,
429dnl please add it to the lists below...
430case ${target} in
431	*-linux*|*-k*bsd*-gnu)	STATIC_LIB_LIST="${STATIC_LIB_LIST} nsl"
432	;;
433	*-solaris*)	STATIC_LIB_LIST="${STATIC_LIB_LIST} X* ssl crypto"
434	;;
435esac
436
437if test "x${enable_fcgi}" = xyes ; then
438dnl m4/boinc_check_fcgi.m4
439BOINC_CHECK_FCGI
440fi
441dnl ---------- SSL (m4/check_ssl.m4)
442if [[ "x${enable_client}" = "xyes" -o "x${enable_server}" = "xyes" ]]
443then
444    CHECK_SSL
445fi
446
447dnl ---------- libcurl (m4/libcurl.m4) ------------------------------
448dnl curl is needed for client
449
450if [[ "x${enable_client}" = "xyes" ]]
451then
452LIBCURL_CHECK_CONFIG([yes], [7.17.1], [haveCurl=yes], [haveCurl=no])
453
454if test "${haveCurl}" != yes; then
455   AC_MSG_ERROR([
456================================================================================
457ERROR: could not find (recent enough) development-libs for libcurl.
458
459  If libcurl-dev is installed on your system, make sure that the script
460  'curl-config' is found in your PATH, and that
461  'curl-config --version' gives something recent enough (see above).
462
463  You can download libcurl from: http://curl.haxx.se/
464
465================================================================================
466   ])
467else
468   ## add libcurl et al. to the list of statically linked libs
469   STATIC_LIB_LIST="${STATIC_LIB_LIST} curl idn ssh2 crypto ssl krb5 k5crypto gssapi_krb5 com_err resolv lber ldap socket nsl z rt gcrypt gpg-error"
470   CPPFLAGS="${CPPFLAGS} ${LIBCURL_CPPFLAGS}"
471   CURL_LIB_PATHS=`echo $LIBCURL | sed 's/[^[a-zA-Z]]*-l[^ ]*//g'`
472
473   if test "${enable_debug}" = yes; then
474      echo "LIBCURL = ${LIBCURL}"
475      echo "LIBCURL_CPPFLAGS = ${LIBCURL_CPPFLAGS}"
476      echo "CURL_LIB_PATHS = ${CURL_LIB_PATHS}"
477      echo "LDFLAGS = ${LDFLAGS}"
478   fi
479   BOINC_EXTRA_LIBS="${BOINC_EXTRA_LIBS} ${LIBCURL}"
480fi
481fi
482
483if test "x${found_ssl}" = "xyes"; then
484   BOINC_EXTRA_LIBS="${BOINC_EXTRA_LIBS} ${SSL_LIBS}"
485fi
486
487dnl save the libs, since SAH_CHECK_LIB() will change them
488SAVELIBS_AAF="${LIBS}"
489SAH_CHECK_LIB([cygipc], [shmget],
490    [BOINC_EXTRA_LIBS="${BOINC_EXTRA_LIBS} ${sah_lib_last}"])
491SAH_CHECK_LIB([aio], [aio_fork],
492    [BOINC_EXTRA_LIBS="${BOINC_EXTRA_LIBS} ${sah_lib_last}"])
493SAH_CHECK_LIB([dl], [dlopen],
494    [BOINC_EXTRA_LIBS="${BOINC_EXTRA_LIBS} ${sah_lib_last}"])
495SAH_CHECK_LIB([nsl], [gethostbyname],
496    [BOINC_EXTRA_LIBS="${BOINC_EXTRA_LIBS} ${sah_lib_last}"])
497SAH_CHECK_LIB([freetype], [fopen],
498    [BOINC_EXTRA_LIBS="${BOINC_EXTRA_LIBS} ${sah_lib_last}"])
499SAH_CHECK_LIB([socket], [bind],
500    [BOINC_EXTRA_LIBS="${BOINC_EXTRA_LIBS} ${sah_lib_last}"])
501SAH_CHECK_LIB([z], [gzopen],
502    [BOINC_EXTRA_LIBS="${BOINC_EXTRA_LIBS} ${sah_lib_last}"])
503SAH_CHECK_LIB([cups], [md5_finish],
504    [BOINC_EXTRA_LIBS="${BOINC_EXTRA_LIBS} ${sah_lib_last}"])
505if test "${isWIN32}" = "yes" ; then
506   SAH_CHECK_LIB([wsock32], [fopen],
507       [BOINC_EXTRA_LIBS="${BOINC_EXTRA_LIBS} ${sah_lib_last}"])
508   SAH_CHECK_LIB([wsock], [fopen],
509       [BOINC_EXTRA_LIBS="${BOINC_EXTRA_LIBS} ${sah_lib_last}"])
510   SAH_CHECK_LIB([comctl32], [fopen],
511       [BOINC_EXTRA_LIBS="${BOINC_EXTRA_LIBS} ${sah_lib_last}"])
512   SAH_CHECK_LIB([winmm], [fopen],
513       [BOINC_EXTRA_LIBS="${BOINC_EXTRA_LIBS} ${sah_lib_last}"])
514   SAH_CHECK_LIB([msimg32], [fopen],
515       [BOINC_EXTRA_LIBS="${BOINC_EXTRA_LIBS} ${sah_lib_last}"])
516fi
517
518LIBS=${SAVELIBS_AAF}
519
520dnl check for pthread
521AX_PTHREAD(AC_DEFINE(HAVE_PTHREAD,1, [Have pthread]))
522dnl There are better ways to do this.
523dnl CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
524dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
525dnl LIBS="$PTHREAD_LIBS $LIBS"
526
527# find the install directories in case we need them.
528if test "x${prefix}" = "xNONE" -o -z "${prefix}" ; then
529  prefix="${ac_default_prefix}"
530fi
531if test "x${exec_prefix}" = "xNONE" -o -z "${exec_prefix}" ; then
532  exec_prefix="${prefix}"
533fi
534if test "x${bindir}" = "xNONE" -o -z "${bindir}" ; then
535  bindir="${exec_prefix}/bin"
536fi
537if test "x${libdir}" = "xNONE" -o -z "${libdir}" ; then
538  bindir="${exec_prefix}/lib"
539fi
540
541dnl if --sysconfdir was not specified, default ${sysconfdir} to '/etc/'.
542dnl this is done to preserve the behaviour of previous BOINC versions
543dnl which always installed to /etc/ in client/scripts/. Now we install
544dnl to ${sysconfdir}/.
545dnl the default value for ${sysconfdir} set by automake is '${prefix}/etc',
546dnl but we also test for an empty string
547if test "${sysconfdir}" = '${prefix}/etc' -o "x${sysconfdir}" = "x"; then
548  sysconfdir=/etc
549fi
550
551AC_DEFINE_UNQUOTED(BOINC_PREFIX,"`eval echo ${prefix}`",[Directory tree where BOINC will be installed])
552AC_DEFINE_UNQUOTED(BOINC_EXECPREFIX,"`eval echo ${bindir}`",[Directory where BOINC executables will be installed])
553AC_DEFINE_UNQUOTED(BOINC_LIBDIR,"`eval echo ${libdir}`",[Directory where BOINC libraries will be installed])
554
555dnl ---------- decide wether to build the graphical boinc-api libs or not
556dnl check for X11
557AC_PATH_X
558AC_PATH_XTRA
559
560dnl check for GL library
561AX_CHECK_GL
562AX_CHECK_GLU
563
564dnl check for glut and prerequesites to the glut-test: libXmu and libXi
565dnl or on windows libGDI32 and libWinMM
566AC_CHECK_LIB([Xmu], [fopen], [have_Xmu="yes"], [have_Xmu="no"])
567AC_CHECK_LIB([Xi], [fopen], [have_Xi="yes"], [have_Xi="no"])
568if test "${isWIN32}" = "yes" ; then
569  AC_CHECK_LIB([gdi32], [fopen])
570  AC_CHECK_LIB([winmm], [fopen])
571fi
572
573AX_CHECK_GLUT
574if test "X${no_x}" != "Xyes" -a "$no_glut" = yes; then
575   if test "$have_Xmu" = no; then
576   	AC_MSG_WARN([Test for glut-dev might have failed because of missing libXmu-dev!])
577   fi
578   if test "$have_Xi" = no; then
579   	AC_MSG_WARN([Test for glut-dev might have failed because of missing libXi-dev!])
580   fi
581fi
582
583if test "$no_gl" = yes -o "$no_glu" = yes -o "$no_glut" = yes; then
584   have_glut=no
585   AC_MSG_WARN([
586================================================================================
587WARNING: Development libraries and headers ("-dev") of {openGL, GLU, glut} needed!
588
589The GL, GLU and glut libraries are required in order to build the graphical parts
590of the BOINC application API library.
591
592==> only building non-graphical parts of the BOINC API Library for now.
593
594HINT: on MacOS X/Darwin you might consider running configure with the option
595      './configure --with-apple-opengl-framework'
596      in order to use the Mac-native openGL framework
597
598================================================================================
599       ])
600else
601   have_glut=yes
602   echo "DEBUG: GLUT_CFLAGS = $GLUT_CFLAGS" >&5
603   echo "DEBUG: GLUT_LIBS = $GLUT_LIBS" >&5
604
605   AC_CHECK_HEADERS([gl.h glu.h glut.h glaux.h GL/gl.h GL/glu.h GL/glut.h GL/glaux.h OpenGL/gl.h OpenGL/glu.h OpenGL/glut.h OpenGL/glaux.h GLUT/glut.h MesaGL/gl.h MesaGL/glu.h MesaGL/glut.h MesaGL/glaux.h libnotify/notify.h gtk/gtk.h locale.h xlocale.h])
606
607   AC_CHECK_LIB([jpeg], [jpeg_start_compress],[have_jpeg=1],[have_jpeg=0])
608   AC_CHECK_HEADER([jpeglib.h],[have_jpeg=1],[have_jpeg=0])
609
610   if test "$have_jpeg" != 1 ; then
611	AC_MSG_WARN([
612================================================================================
613WARNING: libjpeg.a/jpeglib.h not found.
614
615BOINC's openGL graphics-API needs libjpeg !
616see http://www.ijg.org/
617
618==> I will continue building the non-graphical parts of the BOINC API library.
619
620HINT: on MacOSX/Darwin these libs/includes are sometimes found in '/sw/' (if using fink)
621      or '/opt/local' (if using port).
622================================================================================
623	]);
624   fi
625fi
626
627AM_CONDITIONAL(BUILD_GRAPHICS_API, [ test "$have_glut" = yes -a "$have_jpeg" = 1])
628
629dnl check for X screen saver lib (X-based idle detection on Linux)
630if test "$enable_xss" == yes; then
631    AC_CHECK_LIB([Xss], [XScreenSaverAllocInfo], [have_Xss="yes"], [have_Xss="no"])
632    AC_CHECK_HEADER([X11/extensions/scrnsaver.h], [have_Xss="yes"], [have_Xss="no"])
633    if test "$have_Xss" == no; then
634        AC_MSG_WARN([libxss missing, disabling X ScreenSaver user idle detection])
635    fi
636fi
637
638dnl --------------------------------------------------------------------------------
639dnl put double-inclusion protection into config.h
640AH_TOP([
641/* double-inclusion protection for config.h */
642#ifndef BOINC_CONFIG_H
643#define BOINC_CONFIG_H
644
645/* Version defines are now in version.h */
646#include "version.h"
647
648])
649AH_BOTTOM([
650
651#if !HAVE_DECL__CONFIGTHREADLOCALE
652#define NO_PER_THREAD_LOCALE 1
653#undef HAVE__CONFIGTHREADLOCALE
654#else
655#undef NO_PER_THREAD_LOCALE
656#define HAVE__CONFIGTHREADLOCALE 1
657#endif
658
659#ifndef HAVE_RES_INIT
660#define res_init() (0)
661#endif
662
663#include "project_specific_defines.h"
664
665/* end double-inclusion protection for config.h */
666#endif /* #ifndef BOINC_CONFIG_H */
667])
668dnl ----------------------------------------------------------------------
669
670dnl Checks for header files.
671AC_HEADER_DIRENT
672AC_HEADER_STDC
673AC_HEADER_SYS_WAIT
674AC_HEADER_TIME
675AC_TYPE_SIGNAL
676if test "${isWIN32}" = "yes" ; then
677  AC_CHECK_HEADERS(winsock2.h winsock.h windows.h ws2tcpip.h winternl.h crtdbg.h)
678fi
679AC_CHECK_HEADERS(sys/types.h sys/un.h arpa/inet.h dirent.h grp.h fcntl.h inttypes.h stdint.h memory.h netdb.h netinet/in.h netinet/tcp.h netinet/ether.h net/if.h net/if_arp.h signal.h strings.h sys/auxv.h sys/file.h sys/fcntl.h sys/ipc.h sys/ioctl.h sys/msg.h sys/param.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/socket.h sys/stat.h sys/statvfs.h sys/statfs.h sys/systeminfo.h sys/time.h sys/types.h sys/utsname.h sys/vmmeter.h sys/wait.h unistd.h utmp.h errno.h procfs.h ieeefp.h setjmp.h float.h sal.h execinfo.h)
680
681save_cxxflags="${CXXFLAGS}"
682save_cppflags="${CPPFLAGS}"
683CXXFLAGS="${CXXFLAGS} -msse3"
684CPPFLAGS="${CPPFLAGS} -msse3"
685AC_CHECK_HEADERS([intrin.h x86intrin.h pmmintrin.h xmmintrin.h emmintrin.h])
686CXXFLAGS="${save_cxxflags} -mavx"
687CPPFLAGS="${save_cppflags} -mavx"
688AC_CHECK_HEADERS([immintrin.h avxintrin.h])
689
690AC_CHECK_DECLS([_xgetbv, xgetbv, __xgetbv, cpuid, _cpuid, __cpuid],
691    [],[],[[
692#if HAVE_INTRIN_H
693# include <intrin.h>
694#endif
695#if HAVE_IMMINTRIN_H
696# include <immintrin.h>
697#endif
698#if HAVE_AVXINTRIN_H
699# include <avxintrin.h>
700#endif
701#if HAVE_X86INTRIN_H
702# include <x86intrin.h>
703#endif
704#if HAVE_PMMINTRIN_H
705# include <pmmintrin.h>
706#endif
707#if HAVE_XMMINTRIN_H
708# include <xmmintrin.h>
709#endif
710#if HAVE_EMMINTRIN_H
711# include <emmintrin.h>
712#endif
713]])
714
715AC_MSG_CHECKING(if assembler supports xgetbv)
716AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[asm ("xgetbv");])],
717  AC_DEFINE([ASM_SUPPORTS_XGETBV],1,[Define to 1 if the xgetbv instruction can be used in inline assember])
718  AC_MSG_RESULT(yes),
719  AC_MSG_RESULT(no)
720)
721
722CXXFLAGS="${save_cxxflags}"
723CPPFLAGS="${save_cppflags}"
724
725if test "${isWIN32}" = "yes" ; then
726  AC_CHECK_HEADERS([winhttp.h ntapi.h ddk/ntapi.h dbghelp.h delayimp.h],[], [], [[
727  #if HAVE_WINDOWS_H
728  # include <windows.h>
729  #endif
730  ]])
731
732  AC_CHECK_HEADER(security.h, [
733  AC_DEFINE(HAVE_SECURITY_H,1,[Define to 1 if your compiler has the security.h header file])
734  AC_DEFINE(SECURITY_WIN32,1,[Define to 1 if your compiler has the security.h header file])
735  ], [], [[
736  #define SECURITY_WIN32 1
737  #if HAVE_WINDOWS_H
738  # include <windows.h>
739  #endif
740  ]])
741
742  AC_CHECK_TYPES([SYSTEM_PROCESSES, CLIENT_ID, VM_COUNTERS, SYSTEM_THREADS, THREAD_STATE, THREAD_WAIT_REASON],[],[],[[
743  #if HAVE_WINDOWS_H
744  #include <windows.h>
745  #endif
746  #ifdef HAVE_WINTERNL_H
747  #include <winternl.h>
748  #elif defined(HAVE_DDK_NTAPI_H)
749  #include <ddk/ntapi.h>
750  #elif defined(HAVE_NTAPI_H)
751  #include <ntapi.h>
752  #endif
753  ]])
754fi
755
756AC_CHECK_HEADER(nvapi.h, [
757  AC_DEFINE(HAVE_NVAPI_H,1,[Define to 1 if your compiler has the nvapi.h header file])
758  ],[],[[
759  #ifdef HAVE_WINDOWS_H
760  #include <windows.h>
761  #endif
762  #ifdef HAVE_SAL_H
763  #include "sal.h"
764  #endif
765  #ifndef __success
766  #define __success(x)
767  #endif
768  #ifndef __in
769  #define __in
770  #endif
771  #ifndef __out
772  #define __out
773  #endif
774  #ifndef __in_ecount
775  #define __in_ecount(x)
776  #endif
777  #ifndef __out_ecount
778  #define __out_ecount(x)
779  #endif
780  #ifndef __in_opt
781  #define __in_opt
782  #endif
783  #ifndef __out_opt
784  #define __out_opt
785  #endif
786  #ifndef __inout
787  #define __inout
788  #endif
789  #ifndef __inout_opt
790  #define __inout_opt
791  #endif
792  #ifndef __inout_ecount
793  #define __inout_ecount(x)
794  #endif
795  #ifndef __inout_ecount_full
796  #define __inout_ecount_full(x)
797  #endif
798  #ifndef __inout_ecount_part_opt
799  #define __inout_ecount_part_opt(x,y)
800  #endif
801  #ifndef __inout_ecount_full_opt
802  #define __inout_ecount_full_opt(x,y)
803  #endif
804  #ifndef __out_ecount_full_opt
805  #define __out_ecount_full_opt(x)
806  #endif
807]])
808
809
810AC_CHECK_TYPES([socklen_t],[],[],[[
811#if HAVE_WINDOWS_H
812#include <windows.h>
813#endif
814#ifdef HAVE_SYS_WINSOCK2_H
815#include <winsock2.h>
816#endif
817#ifdef HAVE_WS2TCPIP_H
818#include <ws2tcpip.h>
819#endif
820#ifdef HAVE_WINSOCK_H
821#include <winsock.h>
822#endif
823#ifdef HAVE_WINHTTP_H
824#include <winhttp.h>
825#endif
826#ifdef HAVE_STDINT_H
827#include <stdint.h>
828#endif
829#ifdef HAVE_SYS_TYPES_H
830#include <sys/types.h>
831#endif
832#ifdef HAVE_SYS_SOCKET_H
833#include <sys/socket.h>
834#endif
835#ifdef HAVE_NETINET_IN_H
836#include <netinet/in.h>
837#endif
838#ifdef HAVE_ARPA_INET_H
839#include <arpa/inet.h>
840#endif
841#ifdef HAVE_NET_IF_H
842#include <net/if.h>
843#endif
844]])
845
846AC_CHECK_HEADER(net/if.h, [], [], [[
847#if HAVE_SYS_SOCKET_H
848# include <sys/socket.h>
849#endif
850]])
851
852AC_CHECK_HEADER(net/if_arp.h, [], [], [[
853#if HAVE_SYS_SOCKET_H
854# include <sys/socket.h>
855#endif
856]])
857
858AC_CHECK_HEADERS(sys/sysctl.h sys/mount.h sys/swap.h sys/sensors.h, [], [], [[
859#ifdef HAVE_SYS_PARAM_H
860# include <sys/param.h>
861#endif
862]])
863
864AC_CHECK_HEADER(resolv.h, [], [], [[
865#ifdef HAVE_NETINET_IN_H
866# include <netinet/in.h>
867#endif
868]])
869
870AC_CHECK_HEADERS(netinet/if_ether.h,[],[],[[
871#ifdef HAVE_SYS_TYPES_H
872#include <sys/types.h>
873#endif
874#ifdef HAVE_SYS_SOCKET_H
875#include <sys/socket.h>
876#endif
877#ifdef HAVE_NETINET_IN_H
878#include <netinet/in.h>
879#endif
880#ifdef HAVE_ARPA_INET_H
881#include <arpa/inet.h>
882#endif
883#ifdef HAVE_NET_IF_H
884#include <net/if.h>
885#endif
886]])
887
888AC_CHECK_TYPES([struct lifconf, struct lifreq, struct ifconf, struct ifreq, struct ether_addr],[],[],[[
889#ifdef HAVE_SYS_TYPES_H
890#include <sys/types.h>
891#endif
892#ifdef HAVE_SYS_SOCKET_H
893#include <sys/socket.h>
894#endif
895#ifdef HAVE_NETINET_IN_H
896#include <netinet/in.h>
897#endif
898#ifdef HAVE_ARPA_INET_H
899#include <arpa/inet.h>
900#endif
901#ifdef HAVE_NET_IF_H
902#include <net/if.h>
903#endif
904#ifdef HAVE_NETINET_IF_ETHER_H
905#include <netinet/if_ether.h>
906#endif
907#ifdef HAVE_NETINET_ETHER_H
908#include <netinet/ether.h>
909#endif
910]])
911
912dnl Unfortunately on some 32 bit systems there is a problem with wx-widgets
913dnl configuring itself for largefile support.  On these systems largefile
914dnl support breaks C++ compiles by defining away many of the C standard library
915dnl routines that should reside in namespace std::.  In order to get around
916dnl problem first we have to check the largefile support macros.  Later we will
917dnl use the macro SAH_LARGEFILE_BREAKS_CXX to check for the breakage.  If
918dnl if breakage is found LARGEFILE_BREAKS_CXX is defined in config.h.  This
919dnl define is checked in std_fixes.h and the appropriate functions are defined
920dnl in order to solve the problem.
921AC_SYS_LARGEFILE
922
923AC_LANG_PUSH(C++)
924SAH_LARGEFILE_BREAKS_CXX
925SAH_HEADER_STDCXX
926SAH_CHECK_NAMESPACES
927AH_TEMPLATE([HAVE_STD_MIN],[Define to 1 if min is in namespace std::])
928AH_TEMPLATE([HAVE_STD_MAX],[Define to 1 if max is in namespace std::])
929AH_TEMPLATE([HAVE_STD_LOCALE],[Define to 1 if locale is in namespace std::])
930AH_TEMPLATE([HAVE_STD_TRANSFORM],[Define to 1 if transform is in namespace std:: ])
931SAH_FUNCS_IN_NAMESPACE([['min(0,0)'] ['max(0,0)'] ['transform((char *)0,(char *) 0,(char *)0,(int(*)(int))malloc)'] ['locale("")']],std)
932AC_LANG_POP
933
934dnl Checks for library functions.
935AC_PROG_GCC_TRADITIONAL
936AC_FUNC_VPRINTF
937AC_CHECK_FUNCS(ether_ntoa setpriority sched_setscheduler strlcpy strlcat strcasestr strcasecmp sigaction getutent setutent getisax strdup _strdup strdupa _strdupa daemon stat64 putenv setenv unsetenv res_init strtoull localtime localtime_r gmtime gmtime_r)
938
939AC_CHECK_DECLS([_fpreset, fpreset, _configthreadlocale],
940    [],[],[[
941#include <stdio.h>
942#if HAVE_SYS_TYPES_H
943# include <sys/types.h>
944#endif
945#if HAVE_SYS_STAT_H
946# include <sys/stat.h>
947#endif
948#if STDC_HEADERS
949# include <stdlib.h>
950# include <stddef.h>
951#else
952# if HAVE_STDLIB_H
953#  include <stdlib.h>
954# endif
955#endif
956#if HAVE_STRING_H
957# if !STDC_HEADERS && HAVE_MEMORY_H
958#  include <memory.h>
959# endif
960# include <string.h>
961#endif
962#if HAVE_STRINGS_H
963# include <strings.h>
964#endif
965#if HAVE_INTTYPES_H
966# include <inttypes.h>
967#endif
968#if HAVE_STDINT_H
969# include <stdint.h>
970#endif
971#if HAVE_UNISTD_H
972# include <unistd.h>
973#endif
974#ifdef HAVE_WINDOWS_H
975#include <windows.h>
976#endif
977#ifdef HAVE_FLOAT_H
978#include <float.h>
979#endif
980#ifdef HAVE_IEEEFP_H
981#include <ieeefp.h>
982#endif
983#ifdef HAVE_MATH_H
984#include <math.h>
985#endif
986#ifdef HAVE_LOCALE_H
987#include <locale.h>
988#endif
989#ifdef HAVE_XLOCALE_H
990#include <xlocale.h>
991#endif
992]])
993
994dnl Checks for typedefs, structures, and compiler characteristics.
995AC_C_CONST
996AC_TYPE_SIZE_T
997AC_STRUCT_TM
998AC_STRUCT_TIMEZONE
999
1000dnl utmp file location
1001for f in /etc/utmp /var/adm/utmp /var/run/utmp; do
1002    if test -f $f; then
1003        utmp_file=$f
1004    fi
1005done
1006if test -n "$utmp_file"; then
1007    AC_DEFINE_UNQUOTED(UTMP_LOCATION, "$utmp_file", utmp file location)
1008fi
1009
1010dnl Check for /proc/self/psinfo (Solaris)
1011if test -e "/proc/self/psinfo"; then
1012    AC_DEFINE(HAVE__PROC_SELF_PSINFO, 1, [Define to 1 if /proc/self/psinfo exists])
1013fi
1014
1015dnl Check for /proc/self/stat (Linux)
1016if test -e "/proc/self/stat"; then
1017    AC_DEFINE(HAVE__PROC_SELF_STAT, 1, [Define to 1 if /proc/self/stat exists])
1018fi
1019
1020dnl Check for /proc/self/exe (Linux)
1021if test -e "/proc/self/exe"; then
1022    AC_DEFINE(HAVE__PROC_SELF_EXE, 1, [Define to 1 if /proc/self/exe exists])
1023fi
1024
1025dnl Check for /proc/meminfo (Linux)
1026if test -e "/proc/meminfo"; then
1027    AC_DEFINE(HAVE__PROC_MEMINFO, 1, [Define to 1 if /proc/meminfo exists])
1028fi
1029
1030dnl ---------- wxWidgets --------------------------------------------------
1031if test "${enable_manager}" = yes ; then
1032  BOINC_OPTIONS_WXWIDGETS([3.0.0])
1033else
1034  AM_CONDITIONAL([GUI_GTK], false)
1035fi
1036
1037dnl ---------- libNotify --------------------------------------------------
1038if test "${enable_manager}" = yes ; then
1039  PKG_CHECK_MODULES(LIBNOTIFY, [libnotify])
1040fi
1041
1042dnl ---------- Sqlite3 ----------------------------------------------------
1043if test "${enable_manager}" = yes ; then
1044  AM_PATH_SQLITE3
1045fi
1046
1047dnl ---------- XCB --------------------------------------------------------
1048if test "${enable_manager}" = yes; then
1049    PKG_CHECK_MODULES(XCB,xcb,have_Xcb="yes",[echo "WARNING: Xcb not found, x11_screensaver will not be built"])
1050    PKG_CHECK_MODULES(XCBATOM,xcb-atom,have_Xcbatom="yes",[echo "WARNING: Xcb-atom not found, x11_screensaver will not be built"])
1051fi
1052AM_CONDITIONAL(BUILD_X11_SCREENSAVER, [ test "$have_Xcb" = yes -a "$have_Xcbatom" = yes ])
1053dnl -----------------------------------------------------------------------
1054
1055dnl Heres another way to set up host-specific stuff
1056AM_CONDITIONAL(OS_DARWIN, [echo $host_os | grep '^darwin' > /dev/null])
1057if echo $host_os | grep '^darwin' >/dev/null ; then
1058  if test `uname -r | sed 's/\.//g'` -lt 800 ; then
1059    AC_DEFINE_UNQUOTED(DARWIN_10_3, [1],[Define to 1 if compiling under OS X 10.3 or earlier])
1060  fi
1061fi
1062
1063AM_CONDITIONAL(OS_LINUX, [echo $host_os | grep '^linux' > /dev/null])
1064dnl In case anyone wants to try building the windows code using mingw!
1065AM_CONDITIONAL(OS_WIN32, [echo $host_os | egrep '^mingw|^winnt' > /dev/null])
1066AM_CONDITIONAL(OS_WIN32_MINGW, [echo $host_os | grep '^mingw' > /dev/null])
1067dnl or OS2
1068AM_CONDITIONAL(OS_OS2, [echo $host_os | grep '^os2' > /dev/null])
1069AM_CONDITIONAL(OS_ARM_LINUX, [echo $host_alias | grep '^arm-linux' > /dev/null])
1070
1071dnl Whether to build fcgi components
1072AM_CONDITIONAL(ENABLE_FCGI,[test "${enable_fcgi}" = yes])
1073
1074dnl tell automake about whether to build client and/or server
1075AM_CONDITIONAL(DYNAMIC_CLIENT, [test "${dynamic_client}" = yes])
1076AM_CONDITIONAL(ENABLE_SERVER, [test "${enable_server}" = yes])
1077AM_CONDITIONAL(ENABLE_CLIENT, [test "${enable_client}" = yes])
1078AM_CONDITIONAL(ENABLE_MANAGER, [ test "x${ac_cv_have_wxwidgets}" = xyes -a "${enable_manager}" = yes ])
1079AM_CONDITIONAL(ENABLE_LIBRARIES, [test "${enable_libraries}" = yes])
1080AM_CONDITIONAL(ENABLE_BOINCZIP, [test "${enable_boinczip}" = yes])
1081AM_CONDITIONAL(ENABLE_APPS, [test "${enable_apps}" = yes])
1082AM_CONDITIONAL(ENABLE_BOINCCRYPT, [test "x${enable_server}" = xyes  || test "x${enable_client}" = xyes ])
1083AM_CONDITIONAL(INSTALL_HEADERS, [test "${enable_install_headers}" = yes])
1084AM_CONDITIONAL(HAVE_CUDA_LIB, [test "${enable_client}" = yes -a -f ./coprocs/CUDA/posix/${boinc_platform}/libcudart.so])
1085
1086dnl ======================================================================
1087dnl some more vodoo required for building portable client-binary (client, clientgui)
1088dnl ======================================================================
1089
1090CLIENTLIBS=
1091
1092SAH_CHECK_LIB([m],[sin], [
1093    AC_DEFINE([HAVE_LIBM],[1],[Define to 1 if you have the math library])
1094    CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1095   echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1096if test "$enable_release_client" = yes -a "$disable_static_linkage" = no ; then
1097    SAH_CHECK_LIB([c],[atexit], [
1098        AC_DEFINE([HAVE_LIBC],[1],[Define to 1 if you have the c library])
1099        CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1100       echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1101fi
1102    SAH_CHECK_LIB([pthread],[pthread_join],[
1103        AC_DEFINE([HAVE_LIBPTHREAD],[1],[Define to 1 if you have the pthread library])
1104        CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1105       echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1106if test "$enable_release_client" = yes -a "$disable_static_linkage" = no ; then
1107if test x${ac_cv_cxx_compiler_gnu} != xno ; then
1108  SAH_CHECK_LIB([gcc_eh],[_Unwind_Resume],[
1109    AC_DEFINE([HAVE_LIBGCC_EH],[1],[Define to 1 if you have the gcc_eh library])
1110    CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1111   echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1112  SAH_CHECK_LIB([gcc],[sscanf], [
1113    AC_DEFINE([HAVE_LIBGCC],[1],[Define to 1 if you have the gcc library])
1114    CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1115   echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1116  SAH_CHECK_LIB([c_nonshared],[fopen],[
1117    AC_DEFINE([HAVE_LIBC_NONSHARED],[1],[Define to 1 if you have the c_nonshared library])
1118    CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1119   echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1120  SAH_CHECK_LIB([stdc++],[sscanf],[
1121    AC_DEFINE([HAVE_LIBSTDC__],[1],[Define to 1 if you have the stdc++ library])
1122    CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1123   echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1124fi
1125fi
1126SAH_CHECK_LIB([nvapi],[fopen],[
1127    AC_DEFINE([HAVE_LIBNVAPI],[1],[Define to 1 if you have the NVIDIA API library])
1128    CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1129   echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1130if test ${isWIN32} = "yes" ; then
1131  SAH_CHECK_LIB([gdi32],[fopen],[
1132      AC_DEFINE([HAVE_LIBWGDI32],[1],[Define to 1 if you have the gdi32 library])
1133      CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1134     echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1135     found_msvcrt=no
1136  SAH_CHECK_LIB([msvcr110],[fopen],[
1137      found_msvcrt=yes
1138      AC_DEFINE([HAVE_LIBMSVCR110],[1],[Define to 1 if you have the msvcr110 library])
1139      AC_DEFINE([HAVE_MSVCRT],[1],[Define to 1 if you have a visual c runtime library])
1140      CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1141     echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1142  if test $found_msvcrt = no ; then
1143    SAH_CHECK_LIB([msvcr100],[fopen],[
1144        found_msvcrt=yes
1145        AC_DEFINE([HAVE_LIBMSVCR100],[1],[Define to 1 if you have the msvcr100 library])
1146        AC_DEFINE([HAVE_MSVCRT],[1],[Define to 1 if you have a visual c runtime library])
1147        CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1148    echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1149  fi
1150  if test $found_msvcrt = no ; then
1151    SAH_CHECK_LIB([msvcr90d],[fopen],[
1152        found_msvcrt=yes
1153        AC_DEFINE([HAVE_LIBMSVCR90D],[1],[Define to 1 if you have the msvcr90d library])
1154        AC_DEFINE([HAVE_MSVCRT],[1],[Define to 1 if you have a visual c runtime library])
1155        CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1156    echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1157  fi
1158  if test $found_msvcrt = no ; then
1159    SAH_CHECK_LIB([msvcr90],[fopen],[
1160        found_msvcrt=yes
1161        AC_DEFINE([HAVE_LIBMSVCR90],[1],[Define to 1 if you have the msvcr90 library])
1162        AC_DEFINE([HAVE_MSVCRT],[1],[Define to 1 if you have a visual c runtime library])
1163        CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1164    echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1165  fi
1166  SAH_CHECK_LIB([wininet],[fopen],[
1167      AC_DEFINE([HAVE_LIBWININET],[1],[Define to 1 if you have the wininet library])
1168      CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1169     echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1170  SAH_CHECK_LIB([wsock32],[fopen],[
1171      AC_DEFINE([HAVE_LIBWSOCK32],[1],[Define to 1 if you have the wsock32 library])
1172      CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1173     echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1174  SAH_CHECK_LIB([userenv],[fopen],[
1175      AC_DEFINE([HAVE_LIBUSERENV],[1],[Define to 1 if you have the userenv library])
1176      CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1177     echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1178  SAH_CHECK_LIB([iphlpapi],[fopen],[
1179      AC_DEFINE([HAVE_LIBIPHLPAPI],[1],[Define to 1 if you have the iphlpapi library])
1180      CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1181     echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1182  SAH_CHECK_LIB([sensapi],[fopen],[
1183      AC_DEFINE([HAVE_LIBSENSAPI],[1],[Define to 1 if you have the sensapi library])
1184      CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1185     echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1186  SAH_CHECK_LIB([wtsapi32],[fopen],[
1187      AC_DEFINE([HAVE_LIBWTSAPI32],[1],[Define to 1 if you have the wtsapi32 library])
1188      CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1189     echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1190  SAH_CHECK_LIB([winhttp],[fopen],[
1191      AC_DEFINE([HAVE_LIBWINHTTP],[1],[Define to 1 if you have the WinHttp library])
1192      CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1193     echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1194  SAH_CHECK_LIB([secur32],[fopen],[
1195      AC_DEFINE([HAVE_LIBSECUR32],[1],[Define to 1 if you have the secur32 library])
1196      CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1197     echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1198fi
1199
1200svlibs=$LIBS
1201if test "${ac_cv_func_res_init}" != "yes" ; then
1202  AC_CHECK_LIB([resolv],[res_init],[
1203    ac_cv_func_res_init="yes"
1204    AC_CHECK_FUNCS([res_init])
1205  ])
1206fi
1207LIBS=$svlibs
1208
1209if (test "$enable_xss" == yes) && (test "$have_Xss" == yes); then
1210    SAH_CHECK_LIB([Xss],[XScreenSaverAllocInfo],[
1211        AC_DEFINE([HAVE_XSS],[1],[Define to 1 if you have xss library])
1212        CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1213    SAH_CHECK_LIB([X11],[XOpenDisplay],[
1214        AC_DEFINE([HAVE_X11],[1],[Define to 1 if you have X11 library])
1215        CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1216    echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1217fi
1218
1219SAH_CHECK_LIB([resolv],[res_query],[
1220    AC_DEFINE([HAVE_RESOLV],[1],[Define to 1 if you have the resolv library])
1221    CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
1222   echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1223
1224if ( test "${disable_static_linkage}" != yes ) && ( test "${enable_client_release}" = yes ); then
1225
1226   echo "----------"
1227   echo "NOTE: Building portable client binaries"
1228   echo "----------"
1229
1230if test x$ac_cv_cxx_compiler_gnu != xno ; then
1231SAH_CHECK_LDFLAG([-nodefaultlibs],[CLIENTLIBS="-nodefaultlibs ${CLIENTLIBS}"])
1232   echo DEBUG: CLIENTLIBS=${CLIENTLIBS} >&5
1233
1234SAH_CHECK_LDFLAG([-lSystemStubs],[LIBS="${LIBS} -lSystemStubs"])
1235   echo DEBUG: LIBS=${LIBS} >&5
1236fi
1237
1238fi
1239
1240AM_CONDITIONAL([ENABLE_CLIENT_RELEASE],[ ( test "${disable_static_linkage}" != yes ) && ( test "${enable_client_release}" = yes ) ])
1241AM_CONDITIONAL([BUILD_STATIC_LIBS],[test "x${enable_static}" != xno])
1242
1243AC_SUBST(CLIENTLIBS)
1244
1245## --------------------
1246## some more tweaking to turn non-standard libs into statically linked ones
1247
1248if test "${enable_debug}" = "yes" ; then
1249    CLIENTGUIFLAGS="${CLIENTGUIFLAGS} -D_DEBUG -DDEBUG"
1250else
1251    # disable wxWidgets debug support which is by default enabled since 2.9.1
1252    CLIENTGUIFLAGS="${CLIENTGUIFLAGS} -DNDEBUG"
1253fi
1254
1255CLIENTGUILIBS="${WX_LIBS} ${SQLITE3_LIBS}"
1256
1257if test "${enable_client_release}" = "yes" ; then
1258   if test "x${WX_LIBS_STATIC}" = "x" ; then
1259     WX_LIBS_STATIC="${WX_LIBS}"
1260   fi
1261   SAH_STATICIZE_LDFLAGS([${WX_LIBS_STATIC} ${SQLITE3_LIBS} ${GTK_LIBS}],[CLIENTGUILIBS])
1262   SAH_STATICIZE_LDFLAGS([${GLUT_LIBS}],[GLUT_LIBS])
1263   SAH_STATICIZE_LDFLAGS([${BOINC_EXTRA_LIBS}],[BOINC_EXTRA_LIBS])
1264
1265
1266
1267   ## NOTE: its *extremely* important to always compile with __NO_CTYPE
1268   ## defined, because this avoids GLIBC_2.3 symbols being pulled in via ctype.h-macros,
1269   CPPFLAGS="${CPPFLAGS} -D__NO_CTYPE"
1270fi
1271
1272AC_SUBST(BOINC_EXTRA_LIBS)
1273AC_SUBST(CLIENTGUIFLAGS)
1274AC_SUBST(CLIENTGUILIBS)
1275dnl ======================================================================
1276dnl Oh! the joys of standards!
1277AC_PATH_PROG(WHOAMI,[whoami logname],"not found")
1278if test "x${WHOAMI}" = "xnot found" ; then
1279  who am i 2>/dev/null && WHOAMI="who am i | awk '{print $1}'"
1280fi
1281if test "x${WHOAMI}" = "xnot found"  -a -x "/usr/ucb/ps" ; then
1282  WHOAMI="/usr/ucb/ps u $$ | tail -1 | awk '{print $1}'"
1283fi
1284if test  "x${WHOAMI}" = "xnot found" ; then
1285  WHOAMI="ps u $$ | tail -1 | awk '{print $1}'"
1286fi
1287
1288
1289dnl Some info about the person compiling used for making some packages.
1290LOGNAME=`${WHOAMI}`
1291FULLNAME=`grep ^${LOGNAME}: /etc/passwd | head -n 1 | awk -F: '{print $5}'`
1292if test -z "${FULLNAME}" ; then
1293  FULLNAME=`ypcat passwd 2>/dev/null | grep ^${LOGNAME}: | head -n 1 | awk -F: '{print $5}'`
1294fi
1295if test -z "${FULLNAME}" ; then
1296  FULLNAME=`nidump passwd / 2>/dev/null | grep ^${LOGNAME}: | head -n 1 | awk -F: '{print $5}'`
1297fi
1298if test -z "${FULLNAME}" ; then
1299  FULLNAME=$LOGNAME
1300fi
1301AC_SUBST(LOGNAME)
1302AC_SUBST(FULLNAME)
1303
1304AC_CONFIG_FILES([
1305                 version.h
1306                 api/Makefile
1307                 apps/Makefile
1308                 clientgui/Makefile
1309                 clientgui/res/Makefile
1310                 clientscr/Makefile
1311                 client/Makefile
1312                 client/win/boinc_path_config.py:py/boinc_path_config.py.in
1313                 client/scripts/Makefile
1314                 client/scripts/boinc-client
1315                 db/Makefile
1316                 doc/Makefile
1317                 doc/manpages/Makefile
1318                 html/Makefile
1319                 lib/Makefile
1320                 locale/Makefile
1321                 Makefile
1322                 py/Boinc/version.py
1323                 py/Makefile
1324                 py/boinc_path_config.py:py/boinc_path_config.py.in
1325                 py/setup.py
1326                 sched/boinc_path_config.py:py/boinc_path_config.py.in
1327                 sched/Makefile
1328                 packages/generic/sea/Makefile
1329                 packages/solaris/CSW/Makefile
1330                 packages/solaris/CSW/boincclient/Makefile
1331                 packages/solaris/CSW/boincclient/pkginfo
1332                 packages/solaris/CSW/boincclient/prototype
1333                 packages/solaris/CSW/boincdevel/Makefile
1334                 packages/solaris/CSW/boincdevel/pkginfo
1335                 packages/solaris/CSW/boincdevel/prototype
1336                 packages/solaris/CSW/boinclibs/Makefile
1337                 packages/solaris/CSW/boinclibs/pkginfo
1338                 packages/solaris/CSW/boinclibs/prototype
1339                 packages/solaris/CSW/boincmanager/Makefile
1340                 packages/solaris/CSW/boincmanager/pkginfo
1341                 packages/solaris/CSW/boincmanager/prototype
1342                 samples/Makefile
1343                 test/boinc_path_config.py:py/boinc_path_config.py.in
1344                 test/Makefile
1345                 test/version.inc
1346                 tools/boinc_path_config.py:py/boinc_path_config.py.in
1347                 tools/Makefile
1348                 vda/Makefile
1349                 zip/Makefile
1350                 zip/zip/Makefile
1351                 zip/unzip/Makefile
1352                 m4/Makefile
1353		])
1354
1355
1356dnl AC_CONFIG_HEADER([config.h])
1357AC_CONFIG_HEADERS([config.h])
1358
1359AC_OUTPUT
1360
1361echo "--- Configuring BOINC AC_PACKAGE_VERSION (${build_state}) ---"
1362echo "--- Build Components: (${configured_to_build}) ---"
1363