Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 592 lines (547 sloc) 14.822 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591
#######################################################################
#
# pgAdmin III - PostgreSQL Tools
# $Id$
# Copyright (C) 2002 - 2007, The pgAdmin Development Team
# This software is released under the Artistic Licence
#
# acinclude.m4 - Build system scripts.
#
#######################################################################

#################################
# Check there is a C++ compiler #
#################################

AC_DEFUN([CHECK_CPP_COMPILER],
[
if test "$ac_cv_prog_cxx_g" = no; then
AC_MSG_ERROR([could not find a suitable C++ compiler to build pgAdmin])
fi
])

#############################
# Override wxWidgets version #
#############################
AC_DEFUN([SET_WX_VERSION],
[
AC_ARG_WITH(wx-version, [ --with-wx-version=<version number> the wxWidgets version in major.minor format (default: 2.8)],
[
if test "$withval" = yes; then
AC_MSG_ERROR([you must specify a version number when using --with-wx-version=<version number>])
else
if test -z "$withval"; then
AC_MSG_ERROR([you must specify a version number when using --with-wx-version=<version number>])
else
WX_VERSION="$withval"
fi
fi
],
[
WX_VERSION="2.8"
])
])

####################
# Locate wxWidgets #
####################
AC_DEFUN([LOCATE_WXWIDGETS],
[
AC_ARG_WITH(wx, [ --with-wx=DIR root directory for wxWidgets installation],
[
if test "$withval" != no
then
WX_HOME="$withval"
if test ! -f "${WX_HOME}/bin/wx-config"
then
AC_MSG_ERROR([Could not find your wxWidgets installation in ${WX_HOME}])
fi

fi
WX_CONFIG=${WX_HOME}/bin/wx-config
],
[
WX_HOME=/usr/local/wx2
if test ! -f "${WX_HOME}/bin/wx-config"
then
WX_HOME=/usr/local
if test ! -f "${WX_HOME}/bin/wx-config"
then
WX_HOME=/usr
if test ! -f "${WX_HOME}/bin/wx-config"
then
AC_MSG_ERROR([Could not find your wxWidgets installation. You might need to use the --with-wx=DIR configure option])
fi
fi
fi
WX_CONFIG=${WX_HOME}/bin/wx-config
])
])

#####################
# Locate libxml #
#####################
AC_DEFUN([LOCATE_LIBXML2],
[
AC_ARG_WITH(libxml2, [ --with-libxml2=DIR root directory for libxml2 installation],
[
if test "$withval" != no
then
XML2_HOME="$withval"
if test ! -f "${XML2_HOME}/bin/xml2-config"
then
AC_MSG_ERROR([Could not find your libxml2 installation in ${XML2_HOME}])
fi
fi
XML2_CONFIG=${XML2_HOME}/bin/xml2-config
   ],
   [
XML2_HOME=/usr/local
if test ! -f "${XML2_HOME}/bin/xml2-config"
then

XML2_HOME=/usr
if test ! -f "${XML2_HOME}/bin/xml2-config"
then
XML2_HOME=/mingw
if test ! -f "${XML2_HOME}/bin/xml2-config"
then
AC_MSG_ERROR([Could not find your libxml2 installation. You might need to use the --with-libxml2=DIR configure option])
fi
fi
fi
XML2_CONFIG=${XML2_HOME}/bin/xml2-config
   ])
])

#########################
# Check libxml2 version #
#########################
AC_DEFUN([CHECK_LIBXML2],
[
AC_MSG_CHECKING(libxml2 version)
XML2_VERSION=`${XML2_CONFIG} --version`
changequote(<<. >>)dnl
XML2_MAJOR=`expr ${XML2_VERSION} : '\([0-9]*\)'`
XML2_MINOR=`expr ${XML2_VERSION} : '[0-9]*\.\([0-9]*\)'`
XML2_REVISION=`expr ${XML2_VERSION} : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
changequote([, ])dnl
if test "$XML2_MAJOR" -lt 2; then
AC_MSG_ERROR([libxml2 2.6.18 or newer is require to build pgAdmin])
fi
if test "$XML2_MAJOR" -eq 2 && test "$XML2_MINOR" -lt 6; then
AC_MSG_ERROR([libxml2 2.6.18 or newer is require to build pgAdmin])
fi
if test "$XML2_MAJOR" -eq 2 && test "$XML2_MINOR" -eq 6 && test "$XML2_REVISION" -lt 18; then
AC_MSG_ERROR([libxml2 2.6.18 or newer is require to build pgAdmin])
fi
AC_MSG_RESULT(ok)
])


#####################
# Locate libxslt #
#####################
AC_DEFUN([LOCATE_LIBXSLT],
[
AC_ARG_WITH(libxslt, [ --with-libxslt=DIR root directory for libxslt installation],
[
if test "$withval" != no
then
XSLT_HOME="$withval"
if test ! -f "${XSLT_HOME}/bin/xslt-config"
then
AC_MSG_ERROR([Could not find your libxslt installation in ${XSLT_HOME}])
fi
fi
XSLT_CONFIG=${XSLT_HOME}/bin/xslt-config
   ],
   [
XSLT_HOME=/usr/local
if test ! -f "${XSLT_HOME}/bin/xslt-config"
then

XSLT_HOME=/usr
if test ! -f "${XSLT_HOME}/bin/xslt-config"
then
XSLT_HOME=/mingw
if test ! -f "${XSLT_HOME}/bin/xslt-config"
then
AC_MSG_ERROR([Could not find your libxslt installation. You might need to use the --with-libxslt=DIR configure option])
fi
fi
fi
XSLT_CONFIG=${XSLT_HOME}/bin/xslt-config
   ])
])

#####################
# Locate PostgreSQL #
#####################
AC_DEFUN([LOCATE_POSTGRESQL],
[
AC_ARG_WITH(pgsql, [ --with-pgsql=DIR root directory for PostgreSQL installation],
[
if test "$withval" != no
then
PG_HOME="$withval"
if test ! -f "${PG_HOME}/bin/pg_config"
then
AC_MSG_ERROR([Could not find your PostgreSQL installation in ${PG_HOME}])
fi

fi
PG_CONFIG=${PG_HOME}/bin/pg_config
],
[
PG_HOME=/usr/local/pgsql
if test ! -f "${PG_HOME}/bin/pg_config"
then
PG_HOME=/usr/local
if test ! -f "${PG_HOME}/bin/pg_config"
then
PG_HOME=/usr
if test ! -f "${PG_HOME}/bin/pg_config"
then
AC_MSG_ERROR([Could not find your PostgreSQL installation. You might need to use the --with-pgsql=DIR configure option])
fi
fi
fi
PG_CONFIG=${PG_HOME}/bin/pg_config
])
])

###########################
# Debug build of pgAdmin3 #
###########################
AC_DEFUN([ENABLE_DEBUG],
[
AC_ARG_ENABLE(debug, [ --enable-debug build a debug version of pgAdmin3],
[
if test "$enableval" = yes
then
BUILD_DEBUG=yes
else
BUILD_DEBUG=no
fi
],
[
BUILD_DEBUG=no
])
])
AC_SUBST(BUILD_DEBUG)

############################
# Static build of pgAdmin3 #
############################
AC_DEFUN([ENABLE_STATIC],
[
AC_ARG_ENABLE(static, [ --enable-static build a statically linked version of pgAdmin3],
[
if test "$enableval" = yes
then
BUILD_STATIC=yes
WX_STATIC="--static=yes"
else
BUILD_STATIC=no
WX_STATIC="--static=no"
fi
],
[
BUILD_STATIC=no
WX_STATIC="--static=no"
])
])

############################
# Build an pgAdmin III.app #
############################
AC_DEFUN([ENABLE_APPBUNDLE],
[
AC_ARG_ENABLE(appbundle, [ --enable-appbundle Build a Mac OS X appbundle],
[
if test "$enableval" = yes
then
BUILD_APPBUNDLE=yes
prefix=$(pwd)/tmp
bundledir="$(pwd)/pgAdmin3.app"
bindir="$bundledir/Contents/MacOS"
datadir="$bundledir/Contents/SharedSupport"
AC_SUBST(bundledir)
else
BUILD_APPBUNDLE=no
fi
],
[
BUILD_APPBUNDLE=no
])
])

#################################################################################
# Check whether to skip installation of documentation provided with pgAdmin III #
#################################################################################
AC_DEFUN([DISABLE_DOCS],
[
AC_ARG_ENABLE(docs, [ --disable-docs disable installation of documentation],
[
if test "$enableval" = yes
then
INSTALL_DOCS=yes
else
INSTALL_DOCS=no
fi
],
[
INSTALL_DOCS=yes
])
])

#########################################
# Check for libpq libraries and headers #
#########################################
AC_DEFUN([SETUP_POSTGRESQL],
[
if test -n "${PG_HOME}"
then
PGSQL_OLD_LDFLAGS="$LDFLAGS"
PGSQL_OLD_CPPFLAGS="$CPPFLAGS"

# Solaris needs -lssl for this test
case "${host}" in
*solaris*)
LDFLAGS="$LDFLAGS -L${PG_HOME}/lib -lssl"
;;
*)
LDFLAGS="$LDFLAGS -L${PG_HOME}/lib"
;;
esac

AC_LANG_SAVE
AC_LANG_C
AC_CHECK_LIB(pq, PQexec, [PG_LIBPQ=yes], [PG_LIBPQ=no])

if test "$build_cpu-$build_vendor" = "powerpc-apple"
then
echo -n "checking if libpq links against libssl: "
if test "$(otool -L ${PG_HOME}/lib/libpq.?.dylib | grep -c libssl)" -gt 0
then
PG_SSL="yes"
else
PG_SSL="no"
fi
echo $PG_SSL
else
AC_CHECK_LIB(pq, SSL_connect, [PG_SSL=yes], [PG_SSL=no])
fi

if test "$build_cpu-$build_vendor" = "powerpc-apple"
then
echo -n "checking if libpq links against libkrb5: "
if test "$(otool -L ${PG_HOME}/lib/libpq.?.dylib | grep -c libkrb5)" -gt 0
then
PG_KRB5="yes"
else
PG_KRB5="no"
fi
echo $PG_KRB5
else
AC_CHECK_LIB(pq, krb5_free_principal, [PG_KRB5=yes], [PG_KRB5=no])
fi

AC_LANG_RESTORE

PG_INCLUDE=`${PG_CONFIG} --includedir`
CPPFLAGS="$CPPFLAGS -I${PG_INCLUDE}"

PG_LIB=`${PG_CONFIG} --libdir`

PG_VERSION=`${PG_CONFIG} --version`

if test "$build_os" = "mingw32"
then
CRYPTO_LIB=""
else
CRYPTO_LIB="-lcrypto"
fi

if test "$BUILD_STATIC" = "yes"
then
if test "$build_cpu-$build_vendor" = "powerpc-apple"
then
CRYPT_LIB=""
else
CRYPT_LIB="-lcrypt"
fi

if test "$PG_SSL" = "yes"
then
LIBS="${PG_LIB}/libpq.a $CRYPT_LIB $LIBS -lssl $CRYPTO_LIB"
else
LIBS="${PG_LIB}/libpq.a $CRYPT_LIB $LIBS $CRYPTO_LIB"
fi

if test "$PG_KRB5" = "yes"
then
LIBS="$LIBS -lkrb5"
fi
else
if test "$PG_SSL" = "yes"
then
LIBS="$LIBS -L${PG_LIB} -lpq"
else
LIBS="$LIBS -L${PG_LIB} $CRYPTO_LIB -lpq"
fi
fi

AC_LANG_SAVE
AC_LANG_C
AC_CHECK_HEADER(libpq-fe.h, [PG_LIBPQFE=yes], [PG_LIBPQFE=no])
AC_LANG_RESTORE

if test "$PG_LIBPQ" = "yes"
then
AC_MSG_CHECKING(PostgreSQL in ${PG_HOME})
AC_MSG_RESULT(ok)
else
AC_MSG_CHECKING(PostgreSQL in ${PG_HOME})
AC_MSG_RESULT(failed)
LDFLAGS="$PGSQL_OLD_LDFLAGS"
CPPFLAGS="$PGSQL_OLD_CPPFLAGS"
AC_MSG_ERROR([you must specify a valid PostgreSQL installation with --with-pgsql=DIR])
fi

if test "$PG_SSL" = "yes"
then
CPPFLAGS="$CPPFLAGS -DSSL"
fi
fi
])
AC_SUBST(PG_CONFIG)

################################################
# Check for wxWidgets libraries and headers #
################################################
AC_DEFUN([SETUP_WXWIDGETS],
[
if test -n "${WX_HOME}"
then
LDFLAGS="$LDFLAGS -L${WX_HOME}/lib"
WX_OLD_LDFLAGS="$LDFLAGS"
WX_OLD_CPPFLAGS="$CPPFLAGS"

if test "$BUILD_DEBUG" = yes
then
WX_NEW_CPPFLAGS=`${WX_CONFIG} --cppflags --unicode=yes --debug=yes --version=${WX_VERSION} 2> /dev/null`
CPPFLAGS="$CPPFLAGS $WX_NEW_CPPFLAGS -g -O0"

pgadmin3_LDADD=`${WX_CONFIG} ${WX_STATIC} --libs std,stc,ogl --unicode=yes --debug=yes --version=${WX_VERSION} 2> /dev/null`
pgagent_LDADD=`${WX_CONFIG} ${WX_STATIC} --libs base --unicode=yes --debug=yes --version=${WX_VERSION} 2> /dev/null`
else
WX_NEW_CPPFLAGS=`${WX_CONFIG} --cppflags --unicode=yes --debug=no --version=${WX_VERSION} 2> /dev/null`
CPPFLAGS="$CPPFLAGS $WX_NEW_CPPFLAGS -O2"

pgadmin3_LDADD=`${WX_CONFIG} ${WX_STATIC} --libs std,stc,ogl --unicode=yes --debug=no --version=${WX_VERSION} 2> /dev/null`
pgagent_LDADD=`${WX_CONFIG} ${WX_STATIC} --libs base --unicode=yes --debug=no --version=${WX_VERSION} 2> /dev/null`
fi

AC_MSG_CHECKING(wxWidgets in ${WX_HOME})
if test "$WX_NEW_CPPFLAGS" = "" -o "$pgadmin3_LDADD" = ""
then
AC_MSG_RESULT(failed)
AC_MSG_ERROR([Your wxWidgets installation cannot support pgAdmin in the selected configuration. This may be because it was configured without the --enable-unicode option, or the combination of dynamic/static linking and debug/non-debug libraries selected did not match any installed wxWidgets libraries.])
else
AC_MSG_RESULT(ok)
fi

case "${host}" in
*-apple-darwin*)
MAC_PPC=`${WX_CONFIG} --libs | grep -c "arch ppc"`
MAC_I386=`${WX_CONFIG} --libs | grep -c "arch i386"`
CPPFLAGS="$CPPFLAGS -no-cpp-precomp -fno-rtti"
                                LDFLAGS="$LDFLAGS -headerpad_max_install_names"
if test "$MAC_PPC" != "0"
then
CPPFLAGS="$CPPFLAGS -arch ppc"
fi
                                if test "$MAC_I386" != "0"
                                then
                                        CPPFLAGS="$CPPFLAGS -arch i386"
                                fi
;;
*solaris*)
LDFLAGS="$LDFLAGS -lnsl"
;;
*)
;;
esac
fi
])
AC_SUBST(WX_CONFIG)
AC_SUBST(pgadmin3_LDADD)
AC_SUBST(pgagent_LDADD)

#########################
# Setup libxml2 headers #
#########################
AC_DEFUN([SETUP_LIBXML2],
[
if test -n "${XML2_HOME}"
then
XML2_CFLAGS=`${XML2_CONFIG} --cflags`
XML2_LIBS=`${XML2_CONFIG} --libs`
AC_MSG_CHECKING(libxml2 in ${XML2_HOME})
if test "${XML2_CFLAGS}" = "" -o "${XML2_LIBS}" = ""
then
AC_MSG_RESULT(failed)
AC_MSG_ERROR([Your libxml2 installation does not appear to be complete])
else
AC_MSG_RESULT(ok)
CPPFLAGS="$CPPFLAGS $XML2_CFLAGS"
pgadmin3_LDADD="${pgadmin3_LDADD} $XML2_LIBS"
fi
fi
])
AC_SUBST(XML2_CONFIG)
AC_SUBST(pgagent_LDADD)

#########################
# Setup libxslt headers #
#########################
AC_DEFUN([SETUP_LIBXSLT],
[
if test -n "${XSLT_HOME}"
then
XSLT_CFLAGS=`${XSLT_CONFIG} --cflags`
XSLT_LIBS=`${XSLT_CONFIG} --libs`
AC_MSG_CHECKING(libxslt in ${XSLT_HOME})
if test "${XSLT_CFLAGS}" = "" -o "${XSLT_LIBS}" = ""
then
AC_MSG_RESULT(failed)
AC_MSG_ERROR([Your libxslt installation does not appear to be complete])
else
AC_MSG_RESULT(ok)
CPPFLAGS="$CPPFLAGS $XSLT_CFLAGS"
pgadmin3_LDADD="${pgadmin3_LDADD} $XSLT_LIBS"
fi
fi
])
AC_SUBST(XSLT_CONFIG)
AC_SUBST(pgagent_LDADD)

###########
# Cleanup #
###########
AC_DEFUN([CLEANUP],
[
# CFLAGS/CXXFLAGS may well contain unwanted settings, so clear them.
CFLAGS=""
CXXFLAGS=""
])

#########################
# Configuration summary #
#########################
AC_DEFUN([SUMMARY],
[
# Print a configuration summary
echo
echo "PostgreSQL directory: $PG_HOME"
echo "PostgreSQL pg_config binary: $PG_CONFIG"
echo "PostgreSQL version: $PG_VERSION"
        if test "$PG_SSL" = yes
        then
                echo "PostgreSQL SSL support: Present"
        else
                echo "PostgreSQL SSL support: Missing"
        fi
echo
echo "wxWidgets directory: $WX_HOME"
echo "wxWidgets wx-config binary: $WX_CONFIG"
echo "wxWidgets version: wxWidgets "`$WX_CONFIG --version --version=$WX_VERSION`
echo
if test "$BUILD_DEBUG" = yes
then
echo "Building a debug version of pgAdmin: Yes"
else
echo "Building a debug version of pgAdmin: No"
fi
if test "$BUILD_STATIC" = yes
then
echo "Statically linking pgAdmin: Yes"
else
echo "Statically linking pgAdmin: No"
fi
if test "$BUILD_APPBUNDLE" = yes
then
echo "Building a Mac OS X appbundle: Yes"
else
echo "Building a Mac OS X appbundle: No"
fi
if test "$INSTALL_DOCS" = yes
then
echo "Include documentation: Yes"
else
echo "Include documentation: No"
fi
echo

echo "pgAdmin configuration is now complete. You can now compile and"
echo "install pgAdmin using 'make; make install'."
echo
])
Something went wrong with that request. Please try again.