configure.ac 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065
  1. #############################################################################
  2. #
  3. # MODULE: Grass Compilation
  4. # AUTHOR(S): Original author unknown - probably CERL
  5. # Eric G. Miller - egm2 jps.net
  6. # Justin Hickey - Thailand - jhickey hpcc.nectec.or.th
  7. # Markus Neteler - Germany/Italy - neteler itc.it
  8. # Nicklas Larsson (update to autoconfig 2.69)
  9. # PURPOSE: This configure runs all the tests to determine what components
  10. # are installed on the current system. It also defines certain
  11. # configuration variables for compilation and installation.
  12. # COPYRIGHT: (C) 2000-2021 by the GRASS Development Team
  13. #
  14. # This program is free software under the GNU General
  15. # Public License (>=v2). Read the file COPYING that
  16. # comes with GRASS for details.
  17. #
  18. # MANUAL: http://www.gnu.org/software/autoconf/manual/autoconf.html
  19. # http://savannah.gnu.org/projects/autoconf/
  20. # Website for config.guess, config.sub:
  21. # wget http://git.savannah.gnu.org/cgit/config.git/plain/config.guess
  22. # wget http://git.savannah.gnu.org/cgit/config.git/plain/config.sub
  23. # Note: use autoconf-2.69
  24. #############################################################################
  25. define([AC_CACHE_LOAD], )
  26. define([AC_CACHE_SAVE], )
  27. define([AC_CACHE_VAL], [
  28. $2
  29. ])
  30. AC_INIT
  31. AC_CONFIG_SRCDIR([configure.ac])
  32. AC_PREREQ([2.69])
  33. AC_CONFIG_HEADER(include/grass/config.h)
  34. AC_CANONICAL_HOST
  35. AC_PROG_CC
  36. LOC_EXEEXT
  37. AC_SUBST(MINGW32)
  38. # Set WINDRES
  39. if test "$MINGW32" = yes ; then
  40. WINDRES=${WINDRES-windres}
  41. else
  42. WINDRES=
  43. fi
  44. AC_SUBST(WINDRES)
  45. # Check for custom PKG_CONFIG
  46. PKG_CONFIG=${PKG_CONFIG-pkg-config}
  47. # Check for full floating-point support, including Infinity and NaN
  48. IEEEFLAG=
  49. LOC_CHECK_FP_INF_NAN([],
  50. [],
  51. [ ac_save_cflags=${CFLAGS}
  52. CFLAGS=-mieee
  53. LOC_CHECK_FP_INF_NAN([ with -mieee],
  54. [IEEEFLAG="-mieee"],
  55. [AC_MSG_WARN([*** Incomplete floating-point support.])],
  56. [AC_MSG_ERROR([*** INTERNAL CONFIGURE ERROR])])
  57. CFLAGS=${ac_save_cflags}],
  58. [ LOC_CHECK_CC_MIEEE ])
  59. CFLAGS="$CFLAGS $IEEEFLAG"
  60. # Set BINDIR
  61. if test -n "${bindir}"; then
  62. BINDIR="${bindir}"
  63. else
  64. BINDIR=/usr/local/bin
  65. fi
  66. AC_SUBST(BINDIR)
  67. # Set SRCDIR and DSTDIR
  68. AC_PATH_PROG(pwd, pwd, pwd)
  69. if test "$MINGW32" = yes -a "$cross_compiling" != yes ; then
  70. winpwd="pwd -W"
  71. else
  72. winpwd="$pwd"
  73. fi
  74. AC_MSG_CHECKING(for source directory)
  75. if test -z "$srcdir" ; then
  76. SRCDIR=`$pwd`
  77. else
  78. SRCDIR=`(cd "$srcdir" ; $pwd)`
  79. fi
  80. AC_MSG_RESULT("$SRCDIR")
  81. AC_MSG_CHECKING(for build directory)
  82. DSTDIR=`$pwd`
  83. WINDSTDIR=`$winpwd`
  84. AC_MSG_RESULT("$DSTDIR")
  85. AC_SUBST(SRCDIR)
  86. AC_SUBST(DSTDIR)
  87. # Set ARCH
  88. ARCH=
  89. if test -z "${host}"; then
  90. ARCH="unknown"
  91. else
  92. ARCH="${host}"
  93. fi
  94. AC_SUBST(ARCH)
  95. # Set GISBASE and GRASS_BIN
  96. GISBASE="${WINDSTDIR}/dist.${ARCH}"
  97. GRASS_BIN="${DSTDIR}/bin.${ARCH}"
  98. AC_SUBST(GISBASE)
  99. AC_SUBST(GRASS_BIN)
  100. # Set GRASS_VERSION_*
  101. GRASS_VERSION_FILE=include/VERSION
  102. GRASS_VERSION_MAJOR=`sed -n 1p "${GRASS_VERSION_FILE}"`
  103. GRASS_VERSION_MINOR=`sed -n 2p "${GRASS_VERSION_FILE}"`
  104. GRASS_VERSION_RELEASE=`sed -n 3p "${GRASS_VERSION_FILE}"`
  105. GRASS_VERSION_DATE=`sed -n 4p "${GRASS_VERSION_FILE}"`
  106. GRASS_VERSION_NUMBER=`echo ${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}.${GRASS_VERSION_RELEASE}`
  107. NAME_VER=`echo ${GRASS_VERSION_NUMBER} | sed 's/\..*//'`
  108. changequote(,)
  109. LIB_VER=`echo ${GRASS_VERSION_NUMBER} | sed 's/^\([0-9.]*\).*$/\1/'`
  110. changequote([,])
  111. GRASS_VERSION_GIT="exported"
  112. # get git short hash + date of last change in GRASS headers
  113. # (and anything else in include)
  114. GRASS_HEADERS_GIT_HASH=`date -u +%FT%T%z | sed 's/\(..\)$/:\1/'`
  115. GRASS_HEADERS_GIT_DATE=`date -u +%FT%T%z | sed 's/\(..\)$/:\1/'`
  116. AC_PATH_PROG(GIT, git, no)
  117. if test "$GIT" != "no" ; then
  118. GRASS_VERSION_GIT=`$GIT rev-parse --short HEAD 2>/dev/null`
  119. if test -z "$GRASS_VERSION_GIT"; then
  120. GRASS_VERSION_GIT="exported"
  121. fi
  122. GRASS_HEADERS_GIT_HASH=`$GIT log -1 --pretty=format:"%h" -- "${SRCDIR}/include" 2>/dev/null`
  123. if test -z "$GRASS_HEADERS_GIT_HASH"; then
  124. GRASS_HEADERS_GIT_HASH=`date -u +%FT%T%z | sed 's/\(..\)$/:\1/'`
  125. fi
  126. GRASS_HEADERS_GIT_DATE=`date -d $($GIT log -1 --pretty=format:"%cI" -- "${SRCDIR}/include") -u +%FT%T%z | sed 's/\(..\)$/:\1/'` 2>/dev/null
  127. if test -z "$GRASS_HEADERS_GIT_DATE"; then
  128. GRASS_HEADERS_GIT_DATE=`date -u +%FT%T%z | sed 's/\(..\)$/:\1/'`
  129. fi
  130. fi
  131. AC_SUBST(GRASS_VERSION_FILE)
  132. AC_SUBST(GRASS_VERSION_MAJOR)
  133. AC_SUBST(GRASS_VERSION_MINOR)
  134. AC_SUBST(GRASS_VERSION_RELEASE)
  135. AC_SUBST(GRASS_VERSION_NUMBER)
  136. AC_SUBST(GRASS_VERSION_DATE)
  137. AC_SUBST(GRASS_VERSION_GIT)
  138. AC_SUBST(GRASS_HEADERS_GIT_HASH)
  139. AC_SUBST(GRASS_HEADERS_GIT_DATE)
  140. AC_SUBST(NAME_VER)
  141. AC_SUBST(LIB_VER)
  142. # Check for MacOSX App
  143. AC_ARG_ENABLE(macosx-app,
  144. [ --enable-macosx-app create a MacOSX application],,
  145. [enable_macosx_app=no])
  146. AC_MSG_CHECKING(for MacOSX App)
  147. case "$enable_macosx_app" in
  148. yes) MACOSX_APP=1 ;;
  149. no) MACOSX_APP= ;;
  150. *) AC_MSG_ERROR([*** You must answer yes or no.]) ;;
  151. esac
  152. AC_MSG_RESULT("$enable_macosx_app")
  153. AC_SUBST(MACOSX_APP)
  154. # Check for MacOSX archs
  155. AC_MSG_CHECKING(for MacOSX architectures)
  156. MACOSX_ARCHS=
  157. if test -z "$with_macosx_archs" ; then
  158. AC_MSG_RESULT(no)
  159. else
  160. for a in $with_macosx_archs
  161. do
  162. # check if valid arch?
  163. case "$a" in
  164. i386|ppc|x86_64|ppc64)
  165. MACOSX_ARCHS="$MACOSX_ARCHS -arch $a"
  166. ;;
  167. esac
  168. done
  169. AC_MSG_RESULT([$MACOSX_ARCHS])
  170. LDFLAGS="$LDFLAGS $MACOSX_ARCHS"
  171. CFLAGS="$CFLAGS $MACOSX_ARCHS"
  172. CXXFLAGS="$CXXFLAGS $MACOSX_ARCHS"
  173. fi
  174. AC_SUBST(MACOSX_ARCHS)
  175. # Done checking MacOSX archs
  176. # Check for MacOSX SDK
  177. AC_MSG_CHECKING(for MacOSX SDK)
  178. MACOSX_SDK=
  179. if test -z "$with_macosx_sdk" ; then
  180. AC_MSG_RESULT(no)
  181. else
  182. AC_CHECK_FILE($with_macosx_sdk/SDKSettings.plist, [
  183. MACOSX_SDK="-isysroot $with_macosx_sdk"],[
  184. AC_MSG_ERROR([*** specified SDK does not exist or is not a SDK])])
  185. LDFLAGS="$LDFLAGS $MACOSX_SDK"
  186. CFLAGS="$CFLAGS $MACOSX_SDK"
  187. CXXFLAGS="$CXXFLAGS $MACOSX_SDK"
  188. fi
  189. AC_SUBST(MACOSX_SDK)
  190. # Done checking MacOSX SDK
  191. # Set INST_DIR
  192. if test -n "$MACOSX_APP" ; then
  193. INSTDIR='${prefix}'"/GRASS-${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}.app/Contents/MacOS"
  194. else
  195. INSTDIR='${prefix}'"/grass${GRASS_VERSION_MAJOR}${GRASS_VERSION_MINOR}"
  196. fi
  197. AC_SUBST(INSTDIR)
  198. # Get flags for building shared libraries
  199. SC_ENABLE_SHARED
  200. ac_save_ldflags="$LDFLAGS"
  201. SC_CONFIG_CFLAGS
  202. LDFLAGS="${ac_save_ldflags} $LDFLAGS"
  203. # Enable options
  204. AC_ARG_ENABLE(w11,
  205. [ --enable-w11 use W11 library for Windows X11 emulation],,
  206. [enable_w11=no])
  207. # With options
  208. LOC_ARG_WITH(cxx, C++)
  209. #LOC_ARG_WITH(g77, GNU Fortran 77, no)
  210. AC_ARG_WITH(macosx-archs,
  211. [ --with-macosx-archs[=arch list]
  212. compile multiple architectures on MacOSX, ie.
  213. universal. Valid architectures are i386, ppc,
  214. x86_64 and ppc64. (default: no [native])],, with_macosx_archs="no")
  215. AC_ARG_WITH(macosx-sdk,
  216. [ --with-macosx-sdk[=path/sdk]
  217. compile with a system SDK on MacOSX. (default: no)],, with_macosx_sdk="no")
  218. LOC_ARG_WITH(tiff, TIFF)
  219. LOC_ARG_WITH(png, PNG)
  220. LOC_ARG_WITH(postgres, PostgreSQL, no)
  221. LOC_ARG_WITH(mysql, MySQL, no)
  222. LOC_ARG_WITH(sqlite, SQLite)
  223. LOC_ARG_WITH(opengl, OpenGL)
  224. LOC_ARG_WITH(odbc, ODBC, no)
  225. LOC_ARG_WITH(fftw, FFTW)
  226. LOC_ARG_WITH(blas, BLAS, no)
  227. LOC_ARG_WITH(lapack, LAPACK, no)
  228. LOC_ARG_WITH(cairo, Cairo)
  229. LOC_ARG_WITH(freetype, FreeType)
  230. LOC_ARG_WITH(nls, NLS, no)
  231. LOC_ARG_WITH(readline, Readline, no)
  232. LOC_ARG_WITH(opendwg, openDWG, no)
  233. LOC_ARG_WITH(regex, regex)
  234. LOC_ARG_WITH(pthread, POSIX threads, no)
  235. LOC_ARG_WITH(openmp, OpenMP, no)
  236. LOC_ARG_WITH(opencl, OpenCL, no)
  237. LOC_ARG_WITH(bzlib, BZIP2, no)
  238. LOC_ARG_WITH(zstd, Zstandard)
  239. AC_ARG_WITH(gdal,
  240. [ --with-gdal[=path/gdal-config]
  241. enable GDAL/OGR support (gdal-config with path,
  242. e.g. '--with-gdal=/usr/local/bin/gdal-config')])
  243. AC_ARG_WITH(liblas,
  244. [ --with-liblas[=path/liblas-config]
  245. enable libLAS support (liblas-config with path,
  246. e.g. '--with-liblas=/usr/local/bin/liblas-config',
  247. default: no)],, with_liblas="no")
  248. AC_ARG_WITH(pdal,
  249. [ --with-pdal[=path/pdal-config]
  250. enable PDAL support (pdal-config with path,
  251. e.g. '--with-pdal=/usr/local/bin/pdal-config',
  252. default: no)],, with_pdal="no")
  253. AC_ARG_WITH(wxwidgets,
  254. [ --with-wxwidgets[=path/wx-config]
  255. enable wxWidgets support (wx-config with path,
  256. e.g. '--with-wxwidgets=/usr/local/bin/wx-config',
  257. default: no)],, with_wxwidgets="no")
  258. AC_ARG_WITH(netcdf,
  259. [ --with-netcdf[=path/nc-config]
  260. enable NetCDF support (nc-config with path,
  261. e.g. '--with-nc=/usr/local/bin/nc-config',
  262. default: no)],, with_netcdf="no")
  263. # With includes and libs options
  264. AC_ARG_WITH(geos,
  265. [ --with-geos[=path/geos-config]
  266. enable GEOS support (geos-config with path,
  267. e.g. '--with-geos=/usr/local/bin/geos-config',
  268. default: no)],, with_geos="no")
  269. AC_ARG_WITH(includes,
  270. [ --with-includes=DIRS site include files are in DIRS])
  271. AC_ARG_WITH(libs,
  272. [ --with-libs=DIRS site library files are in DIRS])
  273. LOC_ARG_WITH_INC(zlib, zlib)
  274. LOC_ARG_WITH_LIB(zlib, zlib)
  275. LOC_ARG_WITH_INC(bzlib, BZIP2)
  276. LOC_ARG_WITH_LIB(bzlib, BZIP2)
  277. LOC_ARG_WITH_INC(zstd, ZSTD)
  278. LOC_ARG_WITH_LIB(zstd, ZSTD)
  279. LOC_ARG_WITH_INC(readline, Readline)
  280. LOC_ARG_WITH_LIB(readline, Readline)
  281. LOC_ARG_WITH_INC(tiff, TIFF)
  282. LOC_ARG_WITH_LIB(tiff, TIFF)
  283. LOC_ARG_WITH_INC(png, PNG)
  284. LOC_ARG_WITH_LIB(png, PNG)
  285. LOC_ARG_WITH_INC(postgres, PostgreSQL)
  286. LOC_ARG_WITH_LIB(postgres, PostgreSQL)
  287. LOC_ARG_WITH_INC(mysql, MySQL)
  288. LOC_ARG_WITH_LIB(mysql, MySQL)
  289. LOC_ARG_WITH_INC(sqlite, SQLite)
  290. LOC_ARG_WITH_LIB(sqlite, SQLite)
  291. LOC_ARG_WITH_INC(opengl, OpenGL)
  292. LOC_ARG_WITH_LIB(opengl, OpenGL)
  293. LOC_ARG_WITH_FRAMEWORK(opengl, OpenGL)
  294. LOC_ARG_WITH_INC(odbc, ODBC)
  295. LOC_ARG_WITH_LIB(odbc, ODBC)
  296. LOC_ARG_WITH_INC(fftw, FFTW)
  297. LOC_ARG_WITH_LIB(fftw, FFTW)
  298. LOC_ARG_WITH_INC(blas, BLAS)
  299. LOC_ARG_WITH_LIB(blas, BLAS)
  300. LOC_ARG_WITH_INC(lapack, LAPACK)
  301. LOC_ARG_WITH_LIB(lapack, LAPACK)
  302. LOC_ARG_WITH_INC(cairo, cairo)
  303. LOC_ARG_WITH_LIB(cairo, cairo)
  304. LOC_ARG_WITH_LDFLAGS(cairo, cairo)
  305. LOC_ARG_WITH_INC(freetype, FreeType)
  306. LOC_ARG_WITH_LIB(freetype, FreeType)
  307. LOC_ARG_WITH_INC(proj, External PROJ.4)
  308. LOC_ARG_WITH_LIB(proj, External PROJ.4)
  309. LOC_ARG_WITH_SHARE(proj, External PROJ.4)
  310. LOC_ARG_WITH_INC(opendwg, openDWG)
  311. LOC_ARG_WITH_LIB(opendwg, openDWG)
  312. LOC_ARG_WITH_INC(regex, regex)
  313. LOC_ARG_WITH_LIB(regex, regex)
  314. LOC_ARG_WITH_INC(pthread, POSIX threads)
  315. LOC_ARG_WITH_LIB(pthread, POSIX threads)
  316. LOC_ARG_WITH_INC(openmp, OpenMP)
  317. LOC_ARG_WITH_LIB(openmp, OpenMP)
  318. LOC_ARG_WITH_INC(opencl, OpenCL)
  319. LOC_ARG_WITH_LIB(opencl, OpenCL)
  320. #LOC_ARG_WITH_FRAMEWORK(opencl, OpenCL)
  321. # Put this early on so CPPFLAGS and LDFLAGS have any additional dirs
  322. # With includes option
  323. # Handle Fortran compiler choice
  324. #LOC_CHECK_USE(g77, GNU Fortran 77, USE_G77)
  325. # Done checking fortran
  326. AC_MSG_CHECKING(for additional include dirs)
  327. case "$with_includes" in
  328. y | ye | yes | n | no)
  329. AC_MSG_ERROR([*** You must supply a directory to list --with-includes.])
  330. ;;
  331. esac
  332. AC_MSG_RESULT($with_includes)
  333. if test -n "$with_includes"; then
  334. for dir in $with_includes; do
  335. if test -d "$dir"; then
  336. INCLUDE_DIRS="$INCLUDE_DIRS -I$dir"
  337. else
  338. AC_MSG_ERROR([*** Include directory $dir does not exist.])
  339. fi
  340. done
  341. CPPFLAGS="$CPPFLAGS $INCLUDE_DIRS"
  342. fi
  343. AC_SUBST(INCLUDE_DIRS)
  344. # With libs option
  345. AC_MSG_CHECKING(for additional library dirs)
  346. case "$with_libs" in
  347. y | ye | yes | n | no)
  348. AC_MSG_ERROR([*** You must supply a directory list to --with-libs.])
  349. ;;
  350. esac
  351. AC_MSG_RESULT($with_libs)
  352. if test -n "$with_libs"; then
  353. for dir in $with_libs; do
  354. if test -d "$dir"; then
  355. LIBRARY_DIRS="$LIBRARY_DIRS -L$dir"
  356. else
  357. AC_MSG_ERROR([*** Library directory $dir does not exist.])
  358. fi
  359. done
  360. LDFLAGS="$LDFLAGS $LIBRARY_DIRS"
  361. fi
  362. AC_SUBST(LIBRARY_DIRS)
  363. # Programs and standard headers, libraries, functions
  364. AC_PROG_INSTALL
  365. AC_PROG_LEX
  366. if test "$LEX" = "lex"; then
  367. AC_PATH_PROG(LEXPATH, lex, no)
  368. if test "$LEXPATH" = "no"; then
  369. AC_MSG_ERROR([*** Unable to locate lex.])
  370. fi
  371. fi
  372. AC_PROG_YACC
  373. if test "$YACC" = "yacc"; then
  374. AC_PATH_PROG(YACCPATH, yacc, no)
  375. if test "$YACCPATH" = "no"; then
  376. AC_MSG_ERROR([*** Unable to locate yacc.])
  377. fi
  378. fi
  379. AC_PROG_RANLIB
  380. AC_CHECK_PROGS(AR, ar)
  381. AC_CHECK_PROGS(ENV, env)
  382. AC_PATH_PROG(PERL, perl, no)
  383. AC_HEADER_STDC
  384. #AC_CHECK_HEADERS(curses.h limits.h termio.h termios.h unistd.h values.h)
  385. AC_CHECK_HEADERS(limits.h termio.h termios.h unistd.h values.h f2c.h g2c.h)
  386. AC_CHECK_HEADERS(sys/ioctl.h sys/mtio.h sys/resource.h sys/time.h)
  387. AC_CHECK_HEADERS(sys/timeb.h sys/types.h sys/utsname.h)
  388. AC_CHECK_HEADERS(libintl.h iconv.h)
  389. AC_CHECK_HEADERS(langinfo.h)
  390. AC_HEADER_TIME
  391. AC_TYPE_OFF_T
  392. AC_TYPE_UID_T
  393. AC_CANONICAL_HOST
  394. case $host_os in
  395. *cygwin* ) CYGWIN=yes;;
  396. * ) CYGWIN=no;;
  397. esac
  398. AC_CHECK_FUNCS(ftime gethostname gettimeofday lseek nice time uname)
  399. AC_CHECK_FUNCS(seteuid setpriority setreuid setruid)
  400. AC_CHECK_FUNCS(drand48)
  401. AC_CHECK_FUNCS(putenv setenv)
  402. AC_CHECK_FUNCS(nanosleep)
  403. if test "$cross_compiling" != "yes" ; then
  404. AC_FUNC_SETPGRP
  405. else
  406. CROSS_COMPILING=1
  407. AC_SUBST(CROSS_COMPILING)
  408. fi
  409. AC_MSG_CHECKING(for long long int)
  410. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long long int x;]])],[
  411. AC_MSG_RESULT(yes)
  412. AC_DEFINE(HAVE_LONG_LONG_INT, 1, [define if "long long int" is available])
  413. ],[
  414. AC_MSG_RESULT(no)
  415. ])
  416. AC_MSG_CHECKING(for int64_t)
  417. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], [[int64_t x;]])],[
  418. AC_MSG_RESULT(yes)
  419. AC_DEFINE(HAVE_INT64_T, 1, [define if "int64_t" is available])
  420. ],[
  421. AC_MSG_RESULT(no)
  422. ])
  423. AC_MSG_CHECKING(for W11)
  424. case "$enable_w11" in
  425. yes|no) AC_MSG_RESULT("$enable_w11") ;;
  426. *) AC_MSG_ERROR([*** You must answer yes or no.]) ;;
  427. esac
  428. USE_X11=
  429. USE_W11=
  430. XLIB=
  431. XTLIB=
  432. if test "$enable_w11" = "yes" ; then
  433. X_CFLAGS=-I${SRCDIR}/display/drivers/windows/libW11
  434. X_LIBS='-L$(LIBDIR)'
  435. AC_SUBST(X_CFLAGS)
  436. AC_SUBST(X_LIBS)
  437. USE_W11="1"
  438. USE_X11="1"
  439. XLIB=-lX11
  440. CFLAGS="$CFLAGS -D__W98__"
  441. else
  442. AC_PATH_XTRA
  443. if test "$no_x" != "yes"; then
  444. USE_X11="1"
  445. XLIB=-lX11
  446. XTLIB=-lXt
  447. fi
  448. fi
  449. AC_SUBST(XLIB)
  450. AC_SUBST(XTLIB)
  451. AC_SUBST(USE_X11)
  452. # Note that some systems (FreeBSD for example) need an extra library for
  453. # cuserid
  454. ac_save_libs="$LIBS"
  455. LIBS=""
  456. AC_SEARCH_LIBS(cuserid,[compat])
  457. DBMIEXTRALIB="$LIBS"
  458. LIBS="$ac_save_libs"
  459. AC_SUBST(DBMIEXTRALIB)
  460. AC_CHECK_FUNCS(asprintf)
  461. AC_SUBST(HAVE_ASPRINTF)
  462. # Test if mathlib needs -lm flag or is included with libc
  463. AC_CHECK_FUNC(atan, MATHLIB=, [
  464. AC_CHECK_LIB(m, atan, MATHLIB=-lm, [
  465. AC_MSG_ERROR([*** Failed check for math library.])
  466. ])])
  467. AC_SUBST(MATHLIB)
  468. AC_CHECK_FUNC(dlsym, DLLIB=, [
  469. AC_CHECK_LIB(dl, dlsym, DLLIB=-ldl, [
  470. DLLIB=
  471. ])])
  472. AC_SUBST(DLLIB)
  473. AC_CHECK_FUNC(iconv, ICONVLIB=, [
  474. AC_CHECK_LIB(iconv, iconv, ICONVLIB=-liconv, [
  475. AC_CHECK_LIB(giconv, iconv, ICONVLIB=-lgiconv, [
  476. AC_CHECK_FUNC(libiconv, ICONVLIB=, [
  477. AC_CHECK_LIB(iconv, libiconv, ICONVLIB=-liconv, [
  478. AC_CHECK_LIB(giconv, libiconv, ICONVLIB=-lgiconv, [
  479. AC_MSG_WARN([*** Unable to locate iconv() function.])
  480. ICONVLIB=
  481. ])])])])])])
  482. AC_SUBST(ICONVLIB)
  483. have_socket=1
  484. AC_CHECK_FUNC(socket, SOCKLIB=, [
  485. AC_CHECK_LIB(socket, socket, SOCKLIB=-lsocket, [
  486. have_socket=0
  487. AC_MSG_WARN([*** Unable to locate socket() function.])
  488. ])])
  489. AC_SUBST(SOCKLIB)
  490. if test "$have_socket" = 1 ; then
  491. HAVE_SOCKET=1
  492. AC_DEFINE(HAVE_SOCKET, 1, [define if socket() exists])
  493. else
  494. HAVE_SOCKET=
  495. fi
  496. AC_SUBST(HAVE_SOCKET)
  497. # Mandatory zlib dependency
  498. ZLIBLIBPATH=
  499. ZLIBINCPATH=
  500. ZLIB=
  501. # With zlib includes directory
  502. LOC_CHECK_INC_PATH(zlib,zlib,ZLIBINCPATH)
  503. LOC_CHECK_INCLUDES(zlib.h,zlib,$ZLIBINCPATH)
  504. # With zlib library directory
  505. LOC_CHECK_LIB_PATH(zlib,zlib,ZLIBLIBPATH)
  506. LOC_CHECK_LIBS(z,deflate,zlib,$ZLIBLIBPATH,ZLIB,,,)
  507. #
  508. AC_SUBST(ZLIBINCPATH)
  509. AC_SUBST(ZLIBLIBPATH)
  510. AC_SUBST(ZLIB)
  511. # Done checking zlib
  512. # bzip2 support
  513. BZIP2LIBPATH=
  514. BZIP2INCPATH=
  515. BZIP2LIB=
  516. LOC_CHECK_USE(bzlib,bzlib,USE_BZIP2)
  517. if test -n "$USE_BZIP2"; then
  518. # With bzip2 includes directory
  519. LOC_CHECK_INC_PATH(bzlib,bzlib,BZIP2INCPATH)
  520. LOC_CHECK_INCLUDES(bzlib.h,bzlib,$BZIP2INCPATH)
  521. # With bzip2 library directory
  522. LOC_CHECK_LIB_PATH(bzlib,bzlib,BZIP2LIBPATH)
  523. LOC_CHECK_LIBS(bz2,BZ2_bzBuffToBuffCompress,bzlib,$BZIP2LIBPATH,BZIP2LIB,,,)
  524. #
  525. fi # $USE_BZIP2
  526. AC_SUBST(BZIP2INCPATH)
  527. AC_SUBST(BZIP2LIBPATH)
  528. AC_SUBST(BZIP2LIB)
  529. # Done checking bzip2
  530. # zstd support
  531. ZSTDLIBPATH=
  532. ZSTDINCPATH=
  533. ZSTDLIB=
  534. LOC_CHECK_USE(zstd,zstd,USE_ZSTD)
  535. if test -n "$USE_ZSTD"; then
  536. # With zstd includes directory
  537. LOC_CHECK_INC_PATH(zstd,zstd,ZSTDINCPATH)
  538. LOC_CHECK_INCLUDES(zstd.h,zstd,$ZSTDINCPATH)
  539. # With zstd library directory
  540. LOC_CHECK_LIB_PATH(zstd,zstd,ZSTDLIBPATH)
  541. LOC_CHECK_LIBS(zstd,ZSTD_compress,zstd,$ZSTDLIBPATH,ZSTDLIB,,,)
  542. #
  543. fi # $USE_ZSTD
  544. AC_SUBST(ZSTDINCPATH)
  545. AC_SUBST(ZSTDLIBPATH)
  546. AC_SUBST(ZSTDLIB)
  547. # Done checking zstd
  548. # Mandatory PROJ dependency
  549. PROJINC=
  550. PROJLIB=
  551. PROJSHARE=
  552. PROJ4API=0
  553. PROJMAJOR=4
  554. # With PROJ includes directory
  555. LOC_CHECK_INC_PATH(proj,External PROJ,PROJINC)
  556. # PROJ version check: if proj.h exists, it must be proj 5+
  557. LOC_CHECK_INCLUDES(proj.h,External PROJ,$PROJINC,PROJ4API=1)
  558. if test $PROJ4API = 0 ; then
  559. LOC_CHECK_VERSION_INT(proj.h,PROJ_VERSION_MAJOR,External PROJ major,proj_ver_major,$PROJINC,0)
  560. LOC_CHECK_VERSION_INT(proj.h,PROJ_VERSION_MINOR,External PROJ minor,proj_ver_minor,$PROJINC,0)
  561. LOC_CHECK_VERSION_INT(proj.h,PROJ_VERSION_PATCH,External PROJ patch,proj_ver_patch,$PROJINC,0)
  562. AC_MSG_RESULT([found PROJ version "${proj_ver_major}.${proj_ver_minor}.${proj_ver_patch}"])
  563. PROJMAJOR=${proj_ver_major}
  564. # minimum required PROJ 5+ version to use the new PROJ API: 5.1.0
  565. if test ${proj_ver_major} = 5 && test `expr ${proj_ver_minor} \< 1` = 1 ; then
  566. AC_MSG_WARN([At least PROJ version "5.1.0" is required for the new API ])
  567. PROJ4API=1
  568. fi
  569. else
  570. LOC_CHECK_VERSION_INT(proj_api.h,PJ_VERSION,External PROJ.4,proj_ver,$PROJINC,0)
  571. if test `expr ${proj_ver} \>= 600` = 1 ; then
  572. PROJMAJOR=6
  573. elif test `expr ${proj_ver} \>= 500` = 1 ; then
  574. PROJMAJOR=5
  575. elif test `expr ${proj_ver} \>= 400` = 1 ; then
  576. PROJMAJOR=4
  577. fi
  578. AC_MSG_RESULT([found PROJ version "${proj_ver}"])
  579. fi
  580. if test $PROJ4API = 0 ; then
  581. AC_MSG_RESULT([using new PROJ version 5+ API])
  582. # With PROJ library directory
  583. LOC_CHECK_LIB_PATH(proj,External PROJ,PROJLIB)
  584. LOC_CHECK_LIBS(proj,proj_pj_info,External PROJ,$PROJLIB,PROJLIB,,,)
  585. else
  586. AC_MSG_RESULT([using old PROJ version 4 API])
  587. AC_DEFINE(USE_PROJ4API, 1, [define if using old PROJ version 4 API])
  588. LOC_CHECK_INCLUDES(proj_api.h,External PROJ,$PROJINC)
  589. # PROJ version check for v4.x
  590. if test "$cross_compiling" = yes; then
  591. AC_MSG_WARN([*** Cannot check PROJ.4 version (cross-compiling).])
  592. else
  593. LOC_CHECK_VERSION_INT(proj_api.h,PJ_VERSION,External PROJ.4,proj_ver,$PROJINC,0)
  594. if test `expr ${proj_ver} \< 446` = 1 ; then
  595. AC_MSG_ERROR([*** PROJ.4.4.6 or later is required.])
  596. fi
  597. fi
  598. # With PROJ library directory
  599. LOC_CHECK_LIB_PATH(proj,External PROJ.4,PROJLIB)
  600. LOC_CHECK_LIBS(proj,pj_get_def,External PROJ.4,$PROJLIB,PROJLIB,,,)
  601. fi
  602. # With PROJ share directory
  603. LOC_CHECK_SHARE_PATH(proj,External PROJ,PROJSHARE)
  604. if test -z "$PROJSHARE" ; then
  605. AC_MSG_WARN([*** External PROJ directory not specified; default will be used])
  606. PROJSHARE=/usr/share/proj
  607. fi
  608. # check if share/proj/epsg exists only for PROJ < 6
  609. if test `expr ${PROJMAJOR} \< 6` = 1 ; then
  610. # LOC_CHECK_SHARE does not work when cross compiling
  611. if test "$cross_compiling" = "yes" ; then
  612. AC_MSG_CHECKING([for epsg])
  613. AC_MSG_RESULT([unknown (cross-compiling)])
  614. else
  615. LOC_CHECK_SHARE(epsg,External PROJ,$PROJSHARE,[
  616. AC_MSG_WARN([*** Unable to locate PROJ data files.])
  617. ])
  618. fi
  619. fi
  620. AC_SUBST(PROJINC)
  621. AC_SUBST(PROJLIB)
  622. AC_SUBST(PROJSHARE)
  623. # Done checking PROJ
  624. # Enable regex option
  625. LOC_CHECK_USE(regex,regex,USE_REGEX)
  626. REGEXINCPATH=
  627. REGEXLIBPATH=
  628. REGEXLIB=
  629. if test -n "$USE_REGEX"; then
  630. # With regex includes directory
  631. LOC_CHECK_INC_PATH(regex,regex,REGEXINCPATH)
  632. LOC_CHECK_INCLUDES(regex.h,regex,$REGEXINCPATH)
  633. # With regex library directory
  634. LOC_CHECK_LIB_PATH(regex,regex,REGEXLIBPATH)
  635. LOC_CHECK_FUNC(regcomp,regex functions,REGEXLIB,,,,,[
  636. LOC_CHECK_LIBS(regex,regcomp,regex,$REGEXLIBPATH,REGEXLIB,,,)
  637. ])
  638. fi # $USE_REGEX
  639. AC_SUBST(REGEXINCPATH)
  640. AC_SUBST(REGEXLIBPATH)
  641. AC_SUBST(REGEXLIB)
  642. AC_SUBST(USE_REGEX)
  643. # Done checking regex
  644. # Enable Readline option
  645. LOC_CHECK_USE(readline,Readline,USE_READLINE)
  646. READLINEINCPATH=
  647. READLINELIBPATH=
  648. READLINELIB=
  649. HISTORYLIB=
  650. if test -n "$USE_READLINE"; then
  651. # With Readline includes directory
  652. LOC_CHECK_INC_PATH(readline,Readline,READLINEINCPATH)
  653. LOC_CHECK_INCLUDES(readline/readline.h,Readline,$READLINEINCPATH)
  654. LOC_CHECK_INCLUDES(readline/history.h,Readline,$READLINEINCPATH)
  655. # With Readline library directory
  656. LOC_CHECK_LIB_PATH(readline,Readline,READLINELIBPATH)
  657. LOC_CHECK_LIBS(readline,readline,Readline,$READLINELIBPATH,READLINELIB,,,)
  658. LOC_CHECK_LIBS(history,add_history,History,$READLINELIBPATH,HISTORYLIB,,,)
  659. fi # $USE_READLINE
  660. AC_SUBST(READLINEINCPATH)
  661. AC_SUBST(READLINELIBPATH)
  662. AC_SUBST(READLINELIB)
  663. AC_SUBST(HISTORYLIB)
  664. # Done checking Readline
  665. # GDAL option
  666. AC_MSG_CHECKING(whether to use GDAL)
  667. GDAL_LIBS=
  668. GDAL_CFLAGS=
  669. USE_GDAL=
  670. USE_OGR=
  671. if test "`basename xx/$with_gdal`" = "gdal-config" ; then
  672. GDAL_CONFIG="$with_gdal"
  673. fi
  674. if test "$with_gdal" = "no" ; then
  675. AC_MSG_RESULT(no)
  676. else
  677. AC_MSG_RESULT(yes)
  678. AC_PATH_PROG(GDAL_CONFIG, gdal-config, no)
  679. if test "$GDAL_CONFIG" = "no" ; then
  680. AC_MSG_ERROR([*** couldn't find gdal-config])
  681. fi
  682. if test "$GDAL_CONFIG" != "" ; then
  683. GDAL_LIBS=`"$GDAL_CONFIG" --libs`
  684. GDAL_DEP_LIBS=`"$GDAL_CONFIG" --dep-libs`
  685. GDAL_CFLAGS=`"$GDAL_CONFIG" --cflags`
  686. USE_GDAL=1
  687. if test `"$GDAL_CONFIG" --ogr-enabled` = "yes" ; then
  688. AC_DEFINE(HAVE_OGR, 1, [define if OGR is to be used])
  689. USE_OGR=1
  690. fi
  691. fi
  692. GDAL=
  693. ac_save_libs="$LIBS"
  694. ac_save_cflags="$CFLAGS"
  695. LIBS="$LIBS $GDAL_LIBS"
  696. CFLAGS="$CFLAGS $GDAL_CFLAGS"
  697. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gdal.h>]], [[GDALOpen("foo", GA_ReadOnly);]])],[],[
  698. LIBS="$LIBS $GDAL_DEP_LIBS"
  699. AC_TRY_LINK([#include <gdal.h>],[GDALOpen("foo", GA_ReadOnly);],GDAL_LIBS="$GDAL_LIBS $GDAL_DEP_LIBS",[
  700. AC_MSG_ERROR([*** Unable to locate GDAL library.])
  701. ])
  702. ])
  703. LIBS=${ac_save_libs}
  704. CFLAGS=${ac_save_cflags}
  705. AC_DEFINE(HAVE_GDAL, 1, [define if GDAL is to be used])
  706. fi
  707. AC_SUBST(GDAL_LIBS)
  708. AC_SUBST(GDAL_CFLAGS)
  709. AC_SUBST(USE_GDAL)
  710. AC_SUBST(USE_OGR)
  711. # libLAS option
  712. AC_MSG_CHECKING(whether to use libLAS)
  713. LIBLAS_LIBS=
  714. LIBLAS_CFLAGS=
  715. USE_LIBLAS=
  716. if test "`basename xx/$with_liblas`" = "liblas-config" ; then
  717. LIBLAS_CONFIG="$with_liblas"
  718. fi
  719. if test "$with_liblas" = "no" ; then
  720. AC_MSG_RESULT(no)
  721. else
  722. AC_MSG_RESULT(yes)
  723. AC_PATH_PROG(LIBLAS_CONFIG, liblas-config, no)
  724. if test "$LIBLAS_CONFIG" = "no" ; then
  725. AC_MSG_ERROR([*** couldn't find liblas-config])
  726. fi
  727. if test "$LIBLAS_CONFIG" != "" ; then
  728. LIBLAS_LIBS=`"$LIBLAS_CONFIG" --libs`
  729. LIBLAS_CFLAGS=`"$LIBLAS_CONFIG" --cflags`
  730. LIBLAS_INC=`"$LIBLAS_CONFIG" --includes`
  731. USE_LIBLAS=1
  732. fi
  733. LIBLAS=
  734. ac_save_libs="$LIBS"
  735. ac_save_cflags="$CFLAGS"
  736. ac_save_cppflags="$CPPFLAGS"
  737. LIBS="$LIBS $LIBLAS_LIBS"
  738. CFLAGS="$CFLAGS $LIBLAS_CFLAGS"
  739. CPPFLAGS="$CPPFLAGS $LIBLAS_INC"
  740. AC_CHECK_HEADERS(liblas/capi/liblas.h)
  741. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <liblas/capi/liblas.h>]], [[LASReader_Create("foo");]])],[],[
  742. AC_TRY_LINK([#include <liblas/capi/liblas.h>],[LASReader_Create("foo");],LAS_LIBS="$LAS_LIBS",[
  743. AC_MSG_ERROR([*** Unable to locate libLAS library.])
  744. ])
  745. ])
  746. LIBS=${ac_save_libs}
  747. CFLAGS=${ac_save_cflags}
  748. CPPFLAGS=${ac_save_cppflags}
  749. AC_DEFINE(HAVE_LIBLAS, 1, [define if liblas exists])
  750. fi
  751. AC_SUBST(LIBLAS_LIBS)
  752. AC_SUBST(LIBLAS_CFLAGS)
  753. AC_SUBST(LIBLAS_INC)
  754. AC_SUBST(USE_LIBLAS)
  755. # PDAL option
  756. AC_MSG_CHECKING(whether to use PDAL)
  757. AC_LANG_PUSH(C++)
  758. PDAL_LIBS=
  759. PDAL_CPPFLAGS=
  760. USE_PDAL=
  761. if test "`basename xx/$with_pdal`" = "pdal-config" ; then
  762. PDAL_CONFIG="$with_pdal"
  763. fi
  764. if test "$with_pdal" = "no" ; then
  765. AC_MSG_RESULT(no)
  766. else
  767. AC_MSG_RESULT(yes)
  768. AC_PATH_PROG(PDAL_CONFIG, pdal-config, no)
  769. if test "$PDAL_CONFIG" = "no" ; then
  770. AC_MSG_ERROR([*** could not find pdal-config])
  771. fi
  772. if test "$PDAL_CONFIG" != "" ; then
  773. PDAL_LIBS=`"$PDAL_CONFIG" --libs`
  774. PDAL_CPPFLAGS=`"$PDAL_CONFIG" --cxxflags`
  775. PDAL_INC=`"$PDAL_CONFIG" --includes`
  776. USE_PDAL=1
  777. fi
  778. PDAL=
  779. ac_save_libs="$LIBS"
  780. ac_save_cflags="$CFLAGS"
  781. ac_save_cppflags="$CPPFLAGS"
  782. LIBS="$LIBS $PDAL_LIBS"
  783. CFLAGS="$CFLAGS $PDAL_CFLAGS"
  784. CPPFLAGS="$CPPFLAGS $PDAL_CPPFLAGS $PDAL_INC"
  785. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pdal/PointTable.hpp>
  786. #include <pdal/Streamable.hpp>
  787. class St:public pdal::Streamable {};]], [[pdal::PointTable table;]])],[],[
  788. AC_TRY_LINK([#include <pdal/PointTable.hpp>
  789. #include <pdal/Streamable.hpp>
  790. class St:public pdal::Streamable {};],[pdal::PointTable table;],PDAL_LIBS="$PDAL_LIBS",[
  791. AC_MSG_ERROR([*** Unable to locate suitable (>=1.7.1) PDAL library.])
  792. ])
  793. ])
  794. LIBS=${ac_save_libs}
  795. CFLAGS=${ac_save_cflags}
  796. CPPFLAGS=${ac_save_cppflags}
  797. AC_DEFINE(HAVE_PDAL, 1, [define if PDAL exists])
  798. fi
  799. AC_SUBST(PDAL_LIBS)
  800. AC_SUBST(PDAL_CPPFLAGS)
  801. AC_SUBST(PDAL_INC)
  802. AC_SUBST(USE_PDAL)
  803. AC_LANG_POP(C++)
  804. # NetCDF option
  805. AC_MSG_CHECKING(whether to use NetCDF)
  806. NETCDF_LIBS=
  807. NETCDF_CFLAGS=
  808. USE_NETCDF=
  809. if test "`basename xx/$with_netcdf`" = "nc-config" ; then
  810. NETCDF_CONFIG="$with_netcdf"
  811. fi
  812. if test "$with_netcdf" = "no" ; then
  813. AC_MSG_RESULT(no)
  814. else
  815. AC_MSG_RESULT(yes)
  816. AC_PATH_PROG(NETCDF_CONFIG, nc-config, no)
  817. if test "$NETCDF_CONFIG" = "no" ; then
  818. AC_MSG_ERROR([*** couldn't find nc-config])
  819. fi
  820. if test "$NETCDF_CONFIG" != "" ; then
  821. NETCDF_LIBS=`"$NETCDF_CONFIG" --libs`
  822. NETCDF_CFLAGS=`"$NETCDF_CONFIG" --cflags`
  823. USE_NETCDF=1
  824. fi
  825. NETCDF=
  826. ac_save_libs="$LIBS"
  827. ac_save_cflags="$CFLAGS"
  828. LIBS="$LIBS $NETCDF_LIBS"
  829. CFLAGS="$CFLAGS $NETCDF_CFLAGS"
  830. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netcdf.h>]], [[nc_create("foo", NC_CLOBBER, NULL);]])],[],[
  831. AC_TRY_LINK([#include <netcdf.h>],[nc_create("foo", NC_CLOBBER, NULL);],NETCDF_LIBS="$NETCDF_LIBS",[
  832. AC_MSG_ERROR([*** Unable to locate NetCDF library.])
  833. ])
  834. ])
  835. LIBS=${ac_save_libs}
  836. CFLAGS=${ac_save_cflags}
  837. AC_DEFINE(HAVE_NETCDF, 1, [define if NetCDF exists])
  838. fi
  839. AC_SUBST(NETCDF_LIBS)
  840. AC_SUBST(NETCDF_CFLAGS)
  841. AC_SUBST(USE_NETCDF)
  842. # GEOS option
  843. AC_MSG_CHECKING(whether to use GEOS)
  844. GEOS_LIBS=
  845. GEOS_CFLAGS=
  846. USE_GEOS=
  847. # FIXME: "quote" $with_geos ?
  848. if test "`basename xx/$with_geos`" = "geos-config" ; then
  849. GEOS_CONFIG="$with_geos"
  850. fi
  851. if test "$with_geos" = "no" ; then
  852. AC_MSG_RESULT(no)
  853. else
  854. AC_MSG_RESULT(yes)
  855. AC_PATH_PROG(GEOS_CONFIG, geos-config, no)
  856. if test "$GEOS_CONFIG" = "no" ; then
  857. AC_MSG_ERROR([*** couldn't find geos-config])
  858. fi
  859. if test "$GEOS_CONFIG" != "" ; then
  860. GEOS_LIBS=`"$GEOS_CONFIG" --clibs`
  861. GEOS_CFLAGS=`"$GEOS_CONFIG" --cflags`
  862. USE_GEOS=1
  863. fi
  864. LOC_CHECK_INCLUDES(geos_c.h,GEOS,$GEOS_CFLAGS)
  865. ### geos 3.3.6 installs geos_c.lib, see http://osgeo-org.1560.n6.nabble.com/osgeo4w-329-update-geos-to-3-3-6-td5024605.html
  866. # if test "$MINGW32" = yes ; then
  867. # LOC_CHECK_LIBS(geos_c_i,initGEOS,GEOS,$GEOS_LIBS,GEOS_LIBS)
  868. # else
  869. LOC_CHECK_LIBS(geos_c,initGEOS,GEOS,$GEOS_LIBS,GEOS_LIBS)
  870. # fi
  871. AC_DEFINE(HAVE_GEOS, 1, [define if GEOS is to be used])
  872. fi
  873. AC_SUBST(GEOS_LIBS)
  874. AC_SUBST(GEOS_CFLAGS)
  875. AC_SUBST(USE_GEOS)
  876. # Enable TIFF option
  877. LOC_CHECK_USE(tiff,TIFF,USE_TIFF)
  878. TIFF_INCLUDE_DIRS=
  879. TIFF_LIBRARY_DIRS=
  880. TIFFLIB=
  881. if test -n "$USE_TIFF"; then
  882. # With TIFF includes directory
  883. LOC_CHECK_INC_PATH(tiff,TIFF,TIFF_INCLUDE_DIRS)
  884. LOC_CHECK_INCLUDES(tiffio.h,TIFF,$TIFF_INCLUDE_DIRS)
  885. # With TIFF library directory
  886. LOC_CHECK_LIB_PATH(tiff,TIFF,TIFF_LIBRARY_DIRS)
  887. LOC_CHECK_LIBS(tiff,TIFFOpen,TIFF,$TIFF_LIBRARY_DIRS,TIFFLIB,,,,-ljpeg,$ZLIB,$MATHLIB)
  888. fi # $USE_TIFF
  889. AC_SUBST(TIFF_INCLUDE_DIRS)
  890. AC_SUBST(TIFF_LIBRARY_DIRS)
  891. AC_SUBST(TIFFLIB)
  892. # Done checking TIFF
  893. # Enable PNG option
  894. LOC_CHECK_USE(png,PNG,USE_PNG)
  895. PNGINC=
  896. PNGLIB=
  897. if test -n "$USE_PNG"; then
  898. # With PNG includes directory
  899. LOC_CHECK_INC_PATH(png,PNG,PNGINC)
  900. LOC_CHECK_INCLUDES(png.h,PNG,$PNGINC)
  901. # With PNG library directory
  902. LOC_CHECK_LIB_PATH(png,PNG,PNGLIB)
  903. LOC_CHECK_LIBS(png,png_read_image,PNG,$PNGLIB,PNGLIB,,$ZLIB $MATHLIB,)
  904. fi # $USE_PNG
  905. AC_SUBST(PNGINC)
  906. AC_SUBST(PNGLIB)
  907. AC_SUBST(USE_PNG)
  908. # Done checking PNG
  909. # Enable PostgreSQL option
  910. LOC_CHECK_USE(postgres,PostgreSQL,USE_POSTGRES)
  911. if test -n "$USE_POSTGRES"; then
  912. AC_DEFINE(HAVE_POSTGRES, 1, [define if PostgreSQL is to be used])
  913. fi # $USE_POSTGRES
  914. PQINCPATH=
  915. PQLIBPATH=
  916. PQLIB=
  917. if test -n "$USE_POSTGRES"; then
  918. # With PostgreSQL includes directory
  919. LOC_CHECK_INC_PATH(postgres,PostgreSQL,PQINCPATH)
  920. LOC_CHECK_INCLUDES(libpq-fe.h,PostgreSQL,$PQINCPATH)
  921. fi # $USE_POSTGRES
  922. if test -n "$USE_POSTGRES"; then
  923. # With PostgreSQL library directory
  924. LOC_CHECK_LIB_PATH(postgres,PostgreSQL,PQLIBPATH)
  925. LOC_CHECK_LIBS(pq,PQsetdbLogin,PostgreSQL,$PQLIBPATH,PQLIB,,,,-lcrypt,-lssl -lcrypto)
  926. ac_save_ldflags="$LDFLAGS"
  927. LDFLAGS="$LDFLAGS $PQLIBPATH"
  928. AC_CHECK_LIB(pq,PQcmdTuples, [AC_DEFINE(HAVE_PQCMDTUPLES, 1, [define if PQcmdTuples in lpq])], [
  929. AC_CHECK_LIB(pq,PQcmdTuples, [AC_DEFINE(HAVE_PQCMDTUPLES, 1, [define if PQcmdTuples in lpq])], [
  930. ], -lcrypt)
  931. ])
  932. LDFLAGS="${ac_save_ldflags}"
  933. fi # $USE_POSTGRES
  934. AC_SUBST(USE_POSTGRES)
  935. AC_SUBST(PQINCPATH)
  936. AC_SUBST(PQLIBPATH)
  937. AC_SUBST(PQLIB)
  938. # Done checking PostgreSQL
  939. # Enable MySQL option
  940. LOC_CHECK_USE(mysql,MySQL,USE_MYSQL)
  941. MYSQLINCPATH=
  942. MYSQLLIBPATH=
  943. MYSQLLIB=
  944. if test -n "$USE_MYSQL"; then
  945. # With MySQL includes directory
  946. LOC_CHECK_INC_PATH(mysql,MySQL,MYSQLINCPATH)
  947. LOC_CHECK_INCLUDES(mysql.h,MySQL,$MYSQLINCPATH)
  948. fi # $USE_MYSQL
  949. if test -n "$USE_MYSQL"; then
  950. # With MySQL library directory
  951. LOC_CHECK_LIB_PATH(mysql,MySQL,MYSQLLIBPATH)
  952. LOC_CHECK_LIBS(mysqlclient,mysql_query,MySQL,$MYSQLLIBPATH,MYSQLLIB,,,,$ZLIB,$SOCKLIB,$MATHLIB)
  953. # Check for libmysqld (for embedded version of the driver)
  954. AC_PATH_PROG(MYSQLD_CONFIG, mysql_config, no)
  955. if test "$MYSQLD_CONFIG" = "no" ; then
  956. AC_MSG_ERROR([*** couldn't find mysql_config])
  957. fi
  958. if test "$MYSQLD_CONFIG" != "" ; then
  959. AC_LANG_PUSH([C++])
  960. ac_save_libs="$LIBS"
  961. MYSQLDLIB=`"$MYSQLD_CONFIG" --libmysqld-libs`
  962. LIBS="$MYSQLDLIB $LIBS"
  963. AC_CHECK_FUNC(mysql_server_init,,[MYSQLDLIB="";
  964. AC_MSG_WARN([libmysqld not found])] )
  965. LIBS=$ac_save_libs
  966. AC_LANG_POP([C++])
  967. fi
  968. fi # $USE_MYSQL
  969. AC_SUBST(USE_MYSQL)
  970. AC_SUBST(MYSQLINCPATH)
  971. AC_SUBST(MYSQLLIBPATH)
  972. AC_SUBST(MYSQLLIB)
  973. AC_SUBST(MYSQLDLIB)
  974. # Done checking MySQL
  975. # Enable SQLite option
  976. LOC_CHECK_USE(sqlite,SQLite,USE_SQLITE)
  977. SQLITEINCPATH=
  978. SQLITELIBPATH=
  979. SQLITELIB=
  980. if test -n "$USE_SQLITE"; then
  981. # With SQLite includes directory
  982. LOC_CHECK_INC_PATH(sqlite,SQLite,SQLITEINCPATH)
  983. LOC_CHECK_INCLUDES(sqlite3.h,SQLite,$SQLITEINCPATH)
  984. AC_DEFINE(HAVE_SQLITE, 1, [define if SQLite is to be used])
  985. fi # $USE_SQLITE
  986. if test -n "$USE_SQLITE"; then
  987. # With SQLite library directory
  988. LOC_CHECK_LIB_PATH(sqlite,SQLite,SQLITELIBPATH)
  989. LOC_CHECK_LIBS(sqlite3,sqlite3_open,SQLite,$SQLITELIBPATH,SQLITELIB,,,,$MATHLIB,$DLLIB)
  990. fi # $USE_SQLITE
  991. AC_SUBST(USE_SQLITE)
  992. AC_SUBST(SQLITEINCPATH)
  993. AC_SUBST(SQLITELIBPATH)
  994. AC_SUBST(SQLITELIB)
  995. # Done checking SQLite
  996. # Enable OpenGL option
  997. OPENGLINC=
  998. OPENGLLIB=
  999. OPENGLULIB=
  1000. USE_OPENGL=
  1001. OPENGL_X11=
  1002. OPENGL_AQUA=
  1003. OPENGL_WINDOWS=
  1004. AC_MSG_CHECKING(whether to use OpenGL)
  1005. AC_MSG_RESULT("$with_opengl")
  1006. case "$with_opengl" in
  1007. n|no)
  1008. OPENGL_TYPE=none
  1009. ;;
  1010. y|yes|x|x11|glx)
  1011. OPENGL_TYPE=X11
  1012. USE_OPENGL=1
  1013. OPENGL_X11=1
  1014. ;;
  1015. aqua|mac|osx|macosx|agl)
  1016. OPENGL_TYPE=Aqua
  1017. USE_OPENGL=1
  1018. OPENGL_AQUA=1
  1019. ;;
  1020. win|windows|mswin|wgl)
  1021. OPENGL_TYPE=Windows
  1022. USE_OPENGL=1
  1023. OPENGL_WINDOWS=1
  1024. ;;
  1025. *)
  1026. AC_MSG_ERROR([*** Valid arguments for --with-opengl= are yes,no,x11,aqua,windows.])
  1027. ;;
  1028. esac
  1029. if test -n "$USE_OPENGL" ; then
  1030. if test "$OPENGL_X11" = 1 ; then
  1031. # With OpenGL includes directory
  1032. LOC_CHECK_INC_PATH(opengl,OpenGL,OPENGLINC)
  1033. LOC_CHECK_INCLUDES(GL/gl.h GL/glu.h,OpenGL,$OPENGLINC $X_CFLAGS)
  1034. # With OpenGL library directory
  1035. LOC_CHECK_LIB_PATH(opengl,OpenGL,OPENGL_LIB_PATH)
  1036. LOC_CHECK_LIBS(GL,glBegin,OpenGL,$OPENGL_LIB_PATH,OPENGLLIB,$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $MATHLIB,,,-lpthread,-lXext)
  1037. LOC_CHECK_LIBS(GLU,gluBeginCurve,GLU,$OPENGL_LIB_PATH,OPENGLULIB,$OPENGLLIB $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $MATHLIB,,,-lstdc++)
  1038. OPENGLLIB="$OPENGL_LIB_PATH $OPENGLLIB"
  1039. OPENGLULIB="$OPENGL_LIB_PATH $OPENGLULIB"
  1040. LOC_CHECK_FUNC(glXCreatePbuffer,,,,,$OPENGLLIB,[AC_DEFINE(HAVE_PBUFFERS, 1, [define if glXCreatePbuffer exists])])
  1041. LOC_CHECK_FUNC(glXCreateGLXPixmap,,,,,$OPENGLLIB,[AC_DEFINE(HAVE_PIXMAPS, 1, [define if glXCreateGLXPixmap exists])])
  1042. AC_DEFINE(OPENGL_X11, 1, [define if OpenGL uses X11])
  1043. fi # $OPENGL_X11
  1044. if test "$OPENGL_AQUA" = 1 ; then
  1045. LOC_CHECK_FRAMEWORK_PATH(opengl,OpenGL,OPENGLPATH)
  1046. LOC_CHECK_INCLUDES(OpenGL/gl.h OpenGL/glu.h,OpenGL,$OPENGLPATH)
  1047. LOC_CHECK_FUNC(glBegin,OpenGL library,OPENGLLIB,-framework OpenGL -framework AGL -framework ApplicationServices,$OPENGLPATH)
  1048. LOC_CHECK_FUNC(gluBeginCurve,GLU library,OPENGLLIB,,$OPENGLPATH,$OPENGLLIB)
  1049. OPENGLINC="$OPENGLPATH"
  1050. OPENGLLIBPATH="$OPENGLPATH"
  1051. AC_DEFINE(OPENGL_AQUA, 1, [define if OpenGL uses Aqua (MacOS X)])
  1052. fi # $OPENGL_AQUA
  1053. if test "$OPENGL_WINDOWS" = 1 ; then
  1054. # With OpenGL includes directory
  1055. LOC_CHECK_INC_PATH(opengl,OpenGL,OPENGLINC)
  1056. LOC_CHECK_INCLUDES(GL/gl.h GL/glu.h,OpenGL,$OPENGLINC)
  1057. # With OpenGL library directory
  1058. LOC_CHECK_LIB_PATH(opengl,OpenGL,OPENGL_LIB_PATH)
  1059. ac_save_cflags="$CFLAGS"
  1060. CFLAGS="$CFLAGS $OPENGLINC"
  1061. LOC_CHECK_LINK(opengl32,[#include <GL/gl.h>],[glEnd();],OpenGL,$OPENGL_LIB_PATH,OPENGLLIB)
  1062. LOC_CHECK_LINK(glu32,[#include <GL/glu.h>],[gluNewQuadric();],GLU,$OPENGL_LIB_PATH,OPENGLULIB,$OPENGLLIB)
  1063. CFLAGS="${ac_save_cflags}"
  1064. OPENGLLIB="$OPENGL_LIB_PATH $OPENGLLIB"
  1065. OPENGLULIB="$OPENGL_LIB_PATH $OPENGLULIB"
  1066. AC_DEFINE(OPENGL_WINDOWS, 1, [define if OpenGL uses Windows])
  1067. fi # $OPENGL_WINDOWS
  1068. fi # $USE_OPENGL
  1069. AC_SUBST(USE_OPENGL)
  1070. AC_SUBST(OPENGL_X11)
  1071. AC_SUBST(OPENGL_AQUA)
  1072. AC_SUBST(OPENGL_WINDOWS)
  1073. AC_SUBST(OPENGLINC)
  1074. AC_SUBST(OPENGLLIB)
  1075. AC_SUBST(OPENGLULIB)
  1076. # Done checking OpenGL
  1077. # Enable ODBC option
  1078. LOC_CHECK_USE(odbc,ODBC,USE_ODBC)
  1079. ODBCINC=
  1080. ODBCLIB=
  1081. if test -n "$USE_ODBC"; then
  1082. # With ODBC includes directory
  1083. LOC_CHECK_INC_PATH(odbc,ODBC,ODBCINC)
  1084. AC_CHECK_HEADER([windows.h],
  1085. AC_DEFINE(HAVE_WINDOWS_H, 1, [Define to 1 if you have the <windows.h> header file.]))
  1086. ac_save_cppflags="$CPPFLAGS"
  1087. CPPFLAGS="$ODBCINC $CPPFLAGS"
  1088. AC_CHECK_HEADER([sql.h],
  1089. AC_DEFINE(HAVE_SQL_H, 1, [Define to 1 if you have the <sql.h> header file.]),
  1090. AC_MSG_ERROR([*** Unable to locate <sql.h>.]),[#if defined(HAVE_WINDOWS_H)
  1091. # include <windows.h>
  1092. #endif
  1093. ])
  1094. CPPFLAGS=$ac_save_cppflags
  1095. # With ODBC library directory
  1096. LOC_CHECK_LIB_PATH(odbc,ODBC,ODBCLIB)
  1097. LOC_CHECK_LIBS(odbc,SQLConnect,ODBC,$ODBCLIB,ODBCLIB,$ICONVLIB,,[
  1098. LOC_CHECK_LIBS(iodbc,SQLConnect,ODBC,$ODBCLIB,ODBCLIB,,,[
  1099. ac_save_cflags="$CFLAGS"
  1100. CFLAGS="$CFLAGS $ODBCINC"
  1101. LOC_CHECK_LINK(odbc32,[#include <windows.h>
  1102. #include <sql.h>],[SQLAllocEnv((SQLHENV *)0);],ODBC,$ODBCLIB,ODBCLIB)
  1103. CFLAGS="${ac_save_cflags}"
  1104. ])
  1105. ])
  1106. fi # $USE_ODBC
  1107. AC_SUBST(ODBCINC)
  1108. AC_SUBST(ODBCLIB)
  1109. # Done checking ODBC
  1110. # Enable FFTW option
  1111. LOC_CHECK_USE(fftw,FFTW,USE_FFTW)
  1112. FFTWINC=
  1113. FFTWLIB=
  1114. if test -n "$USE_FFTW"; then
  1115. # With FFTW includes directory
  1116. LOC_CHECK_INC_PATH(fftw,FFTW,FFTWINC)
  1117. LOC_CHECK_INCLUDES(fftw3.h,FFTW,$FFTWINC,[
  1118. LOC_CHECK_INCLUDES(fftw.h,FFTW,,[
  1119. LOC_CHECK_INCLUDES(dfftw.h,FFTW,,)
  1120. ])
  1121. ])
  1122. # With FFTW library directory
  1123. LOC_CHECK_LIB_PATH(fftw,FFTW,FFTWLIB)
  1124. LOC_CHECK_LIBS(fftw3, fftw_execute,FFTW,$FFTWLIB,FFTWLIB,,$MATHLIB,[
  1125. LOC_CHECK_LIBS(fftw, fftwnd_one,FFTW,$FFTWLIB,FFTWLIB,,$MATHLIB,[
  1126. LOC_CHECK_LIBS(dfftw,fftwnd_one,FFTW,$FFTWLIB,FFTWLIB,,$MATHLIB,)
  1127. ])
  1128. ])
  1129. fi # $USE_FFTW
  1130. AC_SUBST(FFTWINC)
  1131. AC_SUBST(FFTWLIB)
  1132. # Done checking FFTW
  1133. # Enable BLAS option
  1134. LOC_CHECK_USE(blas,BLAS,USE_BLAS)
  1135. BLASLIB=
  1136. BLASINC=
  1137. if test -n "$USE_BLAS"; then
  1138. # With BLAS includes directory
  1139. # BLAS doesn't have includes (FORTRAN library)
  1140. # With BLAS library directory
  1141. LOC_CHECK_INC_PATH(blas, BLAS, BLASINC)
  1142. LOC_CHECK_LIB_PATH(blas, BLAS, BLASLIB)
  1143. # See if cblas.h exists (CBLAS,ATLAS,others)
  1144. save_CPPFLAGS="$CPPFLAGS"
  1145. CPPFLAGS="$BLASINC $CPPFLAGS"
  1146. AC_CHECK_HEADERS(cblas.h)
  1147. CPPFLAGS="$save_CPPFLAGS"
  1148. LOC_CHECK_LIBS(blas,dnrm2_,BLAS,$BLASLIB,BLASLIB,$MATHLIB,,,-lg2c)
  1149. blas_ok=no
  1150. # Check for ATLAS
  1151. save_LDFLAGS="$LDFLAGS"
  1152. LDFLAGS="$BLASLIB $LDFLAGS"
  1153. AC_CHECK_LIB(atlas, ATL_xerbla,
  1154. [AC_CHECK_LIB(f77blas, sgemm_,
  1155. [AC_CHECK_LIB(cblas, cblas_dgemm,
  1156. [blas_ok=yes; BLASLIB="-lcblas -lf77blas -latlas"],
  1157. [],[-lf77blas -latlas])],
  1158. [],[-latlas])]
  1159. )
  1160. LDFLAGS="$save_LDFLAGS"
  1161. # Do we have ATLAS?
  1162. if test $blas_ok = yes; then
  1163. AC_DEFINE(HAVE_LIBATLAS, 1, [define if ATLAS exists])
  1164. fi
  1165. # BLAS in Apple vecLib framework? (Mac OS-X)
  1166. # not dependent on APP build
  1167. #if test -n "$MACOSX_APP"; then
  1168. if test $blas_ok = no; then
  1169. vlib_flags="-framework vecLib"
  1170. save_LIBS="$LIBS"
  1171. LIBS="$vlib_flags $LIBS"
  1172. AC_MSG_CHECKING([for sgemm in $vlib_flags])
  1173. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[sgemm]])],[blas_ok=yes; BLASLIB="$vlib_flags"],[BLASLIB=""])
  1174. AC_MSG_RESULT($blas_ok)
  1175. LIBS="$save_LIBS"
  1176. fi
  1177. #fi # $MACOSX_APP
  1178. # BLAS in PhiPACK libraries? (requires generic BLAS, too)
  1179. if test $blas_ok = no; then
  1180. AC_CHECK_LIB(blas, sgemm_,
  1181. [AC_CHECK_LIB(dgemm, dgemm_,
  1182. [AC_CHECK_LIB(sgemm, sgemm_,
  1183. [blas_ok=yes; BLASLIB="-lsgemm -ldgemm -lblas"],
  1184. [], [-lblas])],
  1185. [], [-lblas])]
  1186. )
  1187. fi
  1188. # BLAS in Sun Performance library?
  1189. if test $blas_ok = no; then
  1190. if test "x$GCC" != xyes; then # only works with Sun CC
  1191. AC_CHECK_LIB(sunmath, acosp,
  1192. [AC_CHECK_LIB(sunperf, sgemm_,
  1193. [blas_ok=yes; BLASLIB="-xlic_lib=sunperf -lsunmath"],
  1194. [], [-lsunmath])]
  1195. )
  1196. fi
  1197. fi
  1198. # Generic BLAS library
  1199. if test $blas_ok = no; then
  1200. AC_CHECK_LIB(blas, sgemm_, [blas_ok=yes; BLASLIB="-lblas"])
  1201. fi
  1202. if test $blas_ok = yes; then
  1203. AC_DEFINE(HAVE_LIBBLAS, 1, [define if BLAS exists])
  1204. fi
  1205. fi # $USE_BLAS
  1206. AC_SUBST(BLASLIB)
  1207. AC_SUBST(BLASINC)
  1208. # Done checking BLAS
  1209. # Enable LAPACK option
  1210. LOC_CHECK_USE(lapack,LAPACK,USE_LAPACK)
  1211. LAPACKLIB=
  1212. LAPACKINC=
  1213. # LAPACK is useless without BLAS
  1214. if test -n "$USE_BLAS"; then
  1215. if test -n "$USE_LAPACK"; then
  1216. # With LAPACK includes directory
  1217. # LAPACK doesn't have includes (FORTRAN library)
  1218. # With LAPACK library directory
  1219. lapack_ok=no
  1220. LOC_CHECK_INC_PATH(lapack, LAPACK, LAPACKINC)
  1221. LOC_CHECK_LIB_PATH(lapack, LAPACK, LAPACKLIB)
  1222. # See if clapack.h exists (ATLAS)
  1223. save_CPPFLAGS="$CPPFLAGS"
  1224. CPPFLAGS="$LAPACKINC $CPPFLAGS"
  1225. AC_CHECK_HEADERS(clapack.h)
  1226. CPPFLAGS="$save_CPPFLAGS"
  1227. # LAPACK linked to by default?
  1228. if test lapack_ok=no; then
  1229. save_LIBS="$LIBS"; LIBS="$LIBS $BLASLIB $MATHLIB $FLIBS"
  1230. save_LDFLAGS="$LDFLAGS"; LDFLAGS="$LAPACKLIB $LDFLAGS"
  1231. AC_CHECK_FUNC(dsegv_, [lapack_ok=yes])
  1232. LIBS="$save_LIBS"
  1233. LDFLAGS="$save_LDFLAGS"
  1234. fi
  1235. # Generic LAPACK library?
  1236. if test $lapack_ok = no; then
  1237. save_libs="$LIBS"; LIBS="$BLASLIB $MATHLIB $LIBS"
  1238. save_LDFLAGS="$LDFLAGS"; LDFLAGS="$LAPACKLIB $LDFLAGS"
  1239. AC_CHECK_LIB(lapack, desgv_,
  1240. [lapack_ok=yes; LAPACKLIB="-llapack"], [], [$FLIBS])
  1241. LIBS="$save_LIBS"
  1242. LDFLAGS="$save_LDFLAGS"
  1243. fi
  1244. if test $lapack_ok = no; then
  1245. LOC_CHECK_LIBS(lapack,dgesv_,LAPACK,$LAPACKLIB,LAPACKLIB,$BLASLIB $MATHLIB,,,-lg2c)
  1246. fi
  1247. AC_DEFINE(HAVE_LIBLAPACK, 1, [define if LAPACK exists])
  1248. fi # $USE_LAPACK
  1249. fi # $USE_BLAS
  1250. AC_SUBST(LAPACKLIB)
  1251. AC_SUBST(LAPACKINC)
  1252. # Done checking LAPACK
  1253. # Enable Cairo display driver option
  1254. LOC_CHECK_USE(cairo,Cairo,USE_CAIRO)
  1255. CAIROINC=
  1256. CAIROLIB=
  1257. if test -n "$USE_CAIRO"; then
  1258. cairo="cairo"
  1259. pkgs="cairo-ft cairo-fc cairo-pdf cairo-ps cairo-svg fontconfig"
  1260. if test -n "$USE_X11"; then
  1261. pkgs="$pkgs cairo-xlib cairo-xlib-xrender"
  1262. fi
  1263. for pkg in $pkgs ; do
  1264. if $PKG_CONFIG --exists $pkg ; then
  1265. cairo="$cairo $pkg"
  1266. fi
  1267. done
  1268. # With Cairo includes directory
  1269. #FIXME: somehow quote dirs with spaces in $cairo ?
  1270. CAIROINC=`$PKG_CONFIG --cflags $cairo`
  1271. LOC_CHECK_INC_PATH(cairo,cairo,CAIROINC)
  1272. LOC_CHECK_INCLUDES(cairo.h,Cairo,$CAIROINC)
  1273. # With Cairo library directory
  1274. CAIROLIB=`$PKG_CONFIG --libs $cairo`
  1275. LOC_CHECK_LIB_PATH(cairo,cairo,CAIROLIB)
  1276. LOC_CHECK_LDFLAGS(cairo,cairo,CAIROLIB)
  1277. LOC_CHECK_FUNC(cairo_create,,,,,$CAIROLIB,[:])
  1278. LOC_CHECK_FUNC(cairo_xlib_surface_create_with_xrender_format,,,,,$CAIROLIB,
  1279. [CAIRO_HAS_XRENDER=1],[CAIRO_HAS_XRENDER=])
  1280. AC_SUBST(CAIRO_HAS_XRENDER)
  1281. LOC_CHECK_FUNC(cairo_xlib_surface_get_xrender_format,,,,,$CAIROLIB,
  1282. [CAIRO_HAS_XRENDER_SURFACE=1],[CAIRO_HAS_XRENDER_SURFACE=])
  1283. AC_SUBST(CAIRO_HAS_XRENDER_SURFACE)
  1284. CAIROLIB="$CAIROLIB $CAIROLDFLAGS"
  1285. fi # $USE_CAIRO
  1286. AC_SUBST(CAIROINC)
  1287. AC_SUBST(CAIROLIB)
  1288. AC_SUBST(USE_CAIRO)
  1289. # Done checking Cairo
  1290. # Enable FreeType option
  1291. LOC_CHECK_USE(freetype,FreeType,USE_FREETYPE)
  1292. FTINC=
  1293. FTLIB=
  1294. if test -n "$USE_FREETYPE"; then
  1295. # With FreeType includes directory
  1296. FTINC=`$PKG_CONFIG --cflags freetype2`
  1297. LOC_CHECK_INC_PATH(freetype,FreeType,FTINC)
  1298. LOC_CHECK_INCLUDES(ft2build.h,FreeType,$FTINC)
  1299. # With FreeType library directory
  1300. FTLIB=`$PKG_CONFIG --libs freetype2`
  1301. LOC_CHECK_LIB_PATH(freetype,FreeType,FTLIB)
  1302. LOC_CHECK_LIBS(freetype,FT_Init_FreeType,FreeType,$FTLIB,FTLIB,,,)
  1303. fi # $USE_FREETYPE
  1304. AC_SUBST(FTINC)
  1305. AC_SUBST(FTLIB)
  1306. # Done checking FreeType
  1307. # Enable NLS option
  1308. LOC_CHECK_USE(nls,NLS,USE_NLS)
  1309. INTLLIB=
  1310. HAVE_NLS=
  1311. if test -n "${USE_NLS}" ; then
  1312. AC_DEFINE(USE_NLS, 1, [define if NLS requested])
  1313. AC_CHECK_FUNC(gettext, INTLLIB=, [
  1314. AC_CHECK_LIB(intl, gettext, INTLLIB=-lintl, [
  1315. AC_MSG_ERROR([*** Unable to locate gettext() function.])
  1316. ])])
  1317. HAVE_NLS=1
  1318. fi
  1319. AC_SUBST(INTLLIB)
  1320. AC_SUBST(HAVE_NLS)
  1321. # Enable C++ option
  1322. LOC_CHECK_USE(cxx,C++,USE_CXX)
  1323. if test -n "$USE_CXX"; then
  1324. AC_PROG_CXX
  1325. else
  1326. CXX=
  1327. CXXFLAGS=
  1328. AC_SUBST(CXX)
  1329. AC_SUBST(CXXFLAGS)
  1330. fi
  1331. # Done checking C++
  1332. # Enable openDWG option
  1333. LOC_CHECK_USE(opendwg,openDWG,USE_OPENDWG)
  1334. OPENDWGINCPATH=
  1335. OPENDWGLIBPATH=
  1336. OPENDWGLIB=
  1337. if test -n "${USE_OPENDWG}"; then
  1338. # With OPENDWG includes directory
  1339. LOC_CHECK_INC_PATH(opendwg,openDGW,OPENDWGINCPATH)
  1340. LOC_CHECK_INCLUDES(ad2.h,openDWG,$OPENDWGINCPATH)
  1341. # With OPENDWG library directory
  1342. LOC_CHECK_LIB_PATH(opendwg,openDWG,OPENDWGLIBPATH)
  1343. #search for ad2.a, ad3.a ... in openDWG toolkit directory:
  1344. #FIX ME how to program this test??
  1345. #LOC_CHECK_LIBS(ad?.a,adSeekLayer,openDWG,$OPENDWGLIBPATH,OPENDWGLIB,,)
  1346. #
  1347. #for now hack (but working):
  1348. TRUEOPENDWGLIBPATH=`echo "$OPENDWGLIBPATH" | cut -b3-`
  1349. adlib=`ls -1 "$TRUEOPENDWGLIBPATH"/ad?.a | tail -1`
  1350. OPENDWGLIB="$adlib"
  1351. fi # $USE_OPENDWG
  1352. AC_SUBST(OPENDWGINCPATH)
  1353. AC_SUBST(OPENDWGLIBPATH)
  1354. AC_SUBST(OPENDWGLIB)
  1355. AC_SUBST(USE_OPENDWG)
  1356. # Done checking OPENDWG
  1357. # Enable pthread option
  1358. LOC_CHECK_USE(pthread,POSIX threads,USE_PTHREAD)
  1359. PTHREADINCPATH=
  1360. PTHREADLIBPATH=
  1361. PTHREADLIB=
  1362. if test -n "$USE_PTHREAD"; then
  1363. # With pthread includes directory
  1364. LOC_CHECK_INC_PATH(pthread,POSIX threads,PTHREADINCPATH)
  1365. LOC_CHECK_INCLUDES(pthread.h,POSIX threads,$PTHREADINCPATH)
  1366. # With pthread library directory
  1367. LOC_CHECK_LIB_PATH(pthread,POSIX threads,PTHREADLIBPATH)
  1368. LOC_CHECK_FUNC(pthread_create,POSIX threads functions,PTHREADLIB,,,,,[
  1369. LOC_CHECK_LIBS(pthread,pthread_create,POSIX threads,$PTHREADLIBPATH,PTHREADLIB,,,)
  1370. ])
  1371. fi # $USE_PTHREAD
  1372. AC_SUBST(PTHREADINCPATH)
  1373. AC_SUBST(PTHREADLIBPATH)
  1374. AC_SUBST(PTHREADLIB)
  1375. AC_SUBST(USE_PTHREAD)
  1376. # Done checking pthread
  1377. # Enable OpenMP option
  1378. LOC_CHECK_USE(openmp,OpenMP,USE_OPENMP)
  1379. OMPINCPATH=
  1380. OMPLIBPATH=
  1381. OMPLIB=
  1382. OMPCFLAGS=
  1383. if test -n "$USE_OPENMP"; then
  1384. # With OpenMP includes directory
  1385. LOC_CHECK_INC_PATH(openmp,OpenMP,OMPINCPATH)
  1386. LOC_CHECK_INCLUDES(omp.h,OpenMP,$OMPINCPATH)
  1387. # With OpenMP library directory
  1388. # GCC et al.: -lgomp
  1389. # Solaris cc: -lmtsk
  1390. # AIX xlc: -lxlsmp
  1391. # SGI IRIX 6.5 MIPSpro C/C++: -lmp
  1392. LOC_CHECK_LIB_PATH(openmp,OpenMP,OMPLIBPATH)
  1393. LOC_CHECK_FUNC(GOMP_parallel_start,OpenMP functions,OMPLIB,,,,,[
  1394. LOC_CHECK_LIBS(gomp,GOMP_parallel_start,OpenMP,$OMPLIBPATH,OMPLIB,,,)
  1395. ])
  1396. # compiler dependent
  1397. #if test ${CC} = "gcc" ; then
  1398. if test x$GCC = xyes ; then
  1399. # GNU C compiler (>= 4.2.1)
  1400. OMPCFLAGS=-fopenmp
  1401. elif test ${CC} = "icc" ; then
  1402. # Intel compiler
  1403. OMPCFLAGS=-openmp
  1404. elif test ${CC} = "opencc" ; then
  1405. # AMD's x86 Open64 compiler
  1406. OMPCFLAGS=-mp
  1407. elif test ${CC} = "pgcc" ; then
  1408. # Portland Group's compiler
  1409. OMPCFLAGS=-mp
  1410. # ... anybody else?
  1411. fi
  1412. # try to build a test program with "$CC $OMPCLFAGS" to confirm it works
  1413. #...how?
  1414. #echo "int main() {return 0;}" > test.c
  1415. #$CC $OMPCLFAGS test.c -o test
  1416. fi # $USE_OPENMP
  1417. AC_SUBST(OMPINCPATH)
  1418. AC_SUBST(OMPLIBPATH)
  1419. AC_SUBST(OMPLIB)
  1420. AC_SUBST(OMPCFLAGS)
  1421. AC_SUBST(USE_OPENMP)
  1422. # Done checking OpenMP
  1423. # Enable OpenCL option
  1424. LOC_CHECK_USE(opencl,OpenCL,USE_OPENCL)
  1425. OCLINCPATH=
  1426. OCLLIBPATH=
  1427. OCLLIB=
  1428. if test -n "$USE_OPENCL"; then
  1429. # With OpenCL includes directory
  1430. LOC_CHECK_INC_PATH(opencl,OpenCL,OCLINCPATH)
  1431. if test -n "$MACOSX_APP" ; then
  1432. LOC_CHECK_INCLUDES(OpenCL/opencl.h,OpenCL,$OCLINCPATH)
  1433. # With OpenCL library directory
  1434. ### FIXME: ###
  1435. #LOC_CHECK_FRAMEWORK_PATH(opencl,OpenCL,OPENCLPATH)
  1436. # last term in following would become ',$OPENCLPATH)' if above is uncommented
  1437. LOC_CHECK_FUNC(clGetPlatformInfo,OpenCL library,OCLLIB,-framework OpenCL,)
  1438. else
  1439. LOC_CHECK_INCLUDES(CL/cl.h,OpenCL,$OCLINCPATH)
  1440. # With OpenCL library directory
  1441. LOC_CHECK_LIB_PATH(opencl,OpenCL,OCLLIBPATH)
  1442. LOC_CHECK_LIBS(OpenCL,clGetPlatformInfo,OpenCL,$OCLLIBPATH,OCLLIB,,,)
  1443. # expanded symbol check: yes? no?
  1444. #LOC_CHECK_FUNC(clGetPlatformInfo,OpenCL functions,OCLLIB,,,,,[
  1445. #LOC_CHECK_LIBS(OpenCL,clGetPlatformInfo,OpenCL,$OCLLIBPATH,OCLLIB,,,)
  1446. #])
  1447. fi
  1448. fi # $USE_OPENCL
  1449. AC_SUBST(OCLINCPATH)
  1450. AC_SUBST(OCLLIBPATH)
  1451. AC_SUBST(OCLLIB)
  1452. AC_SUBST(USE_OPENCL)
  1453. # Done checking OpenCL
  1454. # Enable LFS (from cdr-tools, tar, and autoconf 2.68)
  1455. dnl Check for large file support
  1456. dnl Do this last to make sure that no large file definition
  1457. dnl in confdefs.h will modify our results
  1458. AC_SYS_LARGEFILE
  1459. ac_save_cflags=${CFLAGS}
  1460. CFLAGS="$LFS_CFLAGS ${ac_save_cflags}"
  1461. dnl Warning do not run this test. it interferes with the test
  1462. dnl AC_CHECK_FUNCS(fseeko ftello) from above.
  1463. dnl The test AC_HAVE_LARGEFILES will check whether ftello/fseeko
  1464. dnl are available in Large File mode
  1465. AC_FUNC_FSEEKO
  1466. AC_HAVE_LARGEFILES
  1467. CFLAGS=${ac_save_cflags}
  1468. # Done large file support
  1469. USE_TERMIO=
  1470. AC_SUBST(USE_TERMIO)
  1471. STRIPFLAG=
  1472. AC_SUBST(STRIPFLAG)
  1473. GRASS_HOME="${DSTDIR}"
  1474. AC_SUBST(GRASS_HOME)
  1475. AC_CONFIG_FILES([include/Make/Platform.make include/Make/Doxyfile_arch_html include/Make/Doxyfile_arch_latex include/grass/version.h grass.pc])
  1476. AC_OUTPUT
  1477. LOC_MSG([Copying config.status to config.status.${ARCH}])
  1478. cp -f config.status config.status.${ARCH}
  1479. # Display configuration status
  1480. LOC_MSG()
  1481. LOC_MSG([GRASS is now configured for: ${host}])
  1482. LOC_MSG()
  1483. LOC_MSG([ Source directory: ${SRCDIR}])
  1484. LOC_MSG([ Build directory: ${DSTDIR}])
  1485. LOC_MSG([ Installation directory: ${INSTDIR}])
  1486. LOC_MSG([ Startup script in directory:${bindir}])
  1487. LOC_MSG([ C compiler: ${CC} ${CFLAGS}])
  1488. LOC_MSG([ C++ compiler: ${CXX} ${CXXFLAGS}])
  1489. LOC_MSG([ Building shared libraries: ${shared_ok}])
  1490. LOC_MSG([ OpenGL platform: ${OPENGL_TYPE}])
  1491. LOC_MSG()
  1492. LOC_MSG_USE(MacOSX application,MACOSX_APP)
  1493. LOC_MSG([ MacOSX architectures: ${MACOSX_ARCHS}])
  1494. LOC_MSG([ MacOSX SDK: ${MACOSX_SDK}])
  1495. LOC_MSG()
  1496. LOC_MSG_USE(BLAS support,USE_BLAS)
  1497. LOC_MSG_USE(BZIP2 support,USE_BZIP2)
  1498. LOC_MSG_USE(C++ support,USE_CXX)
  1499. LOC_MSG_USE(Cairo support,USE_CAIRO)
  1500. LOC_MSG_USE(DWG support,USE_OPENDWG)
  1501. LOC_MSG_USE(FFTW support,USE_FFTW)
  1502. LOC_MSG_USE(FreeType support,USE_FREETYPE)
  1503. LOC_MSG_USE(GDAL support,USE_GDAL)
  1504. LOC_MSG_USE(GEOS support,USE_GEOS)
  1505. LOC_MSG_USE(LAPACK support,USE_LAPACK)
  1506. LOC_MSG_USE(Large File support (LFS), USE_LARGEFILES)
  1507. LOC_MSG_USE(libLAS support,USE_LIBLAS)
  1508. LOC_MSG_USE(MySQL support,USE_MYSQL)
  1509. LOC_MSG_USE(NetCDF support,USE_NETCDF)
  1510. LOC_MSG_USE(NLS support,USE_NLS)
  1511. LOC_MSG_USE(ODBC support,USE_ODBC)
  1512. LOC_MSG_USE(OGR support,USE_OGR)
  1513. LOC_MSG_USE(OpenCL support,USE_OPENCL)
  1514. LOC_MSG_USE(OpenGL support,USE_OPENGL)
  1515. LOC_MSG_USE(OpenMP support,USE_OPENMP)
  1516. LOC_MSG_USE(PDAL support,USE_PDAL)
  1517. LOC_MSG_USE(PNG support,USE_PNG)
  1518. LOC_MSG_USE(POSIX thread support,USE_PTHREAD)
  1519. LOC_MSG_USE(PostgreSQL support,USE_POSTGRES)
  1520. LOC_MSG_USE(Readline support,USE_READLINE)
  1521. LOC_MSG_USE(Regex support,USE_REGEX)
  1522. LOC_MSG_USE(SQLite support,USE_SQLITE)
  1523. LOC_MSG_USE(TIFF support,USE_TIFF)
  1524. LOC_MSG_USE(X11 support,USE_X11)
  1525. LOC_MSG_USE(Zstandard support,USE_ZSTD)
  1526. LOC_MSG()
  1527. # remove when the new PROJ API is stable
  1528. if test $PROJ4API = 0 ; then
  1529. AC_MSG_RESULT([ using new PROJ 5+ API])
  1530. else
  1531. AC_MSG_RESULT([ using old PROJ 4 API])
  1532. fi
  1533. LOC_MSG()