MySQL++

Check-in [f2533e5ac5]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:If the C API library is in one of the linker's default paths and the first directory the mysql_loc macro searched for the library doesn't exist, it would use that in the -L flag since the link succeeded with that first try. Some linkers (e.g. current macOS) then complain about a bogus -L flag, even though the link succeeds. We now skip the test for directories that don't exist, so that we exit that loop in such cases with one of the bog standard directories like /usr/lib, which exists everywhere.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:f2533e5ac5509a15437e7f3f66df04ae2135053cd849d181138d85ae2180b544
User & Date: tangent 2017-11-23 00:45:18
Context
2017-11-23
00:51
Removed the redundant library removal bit on config/mysql_loc.m4. If triggered, it causes bare -L flags to be put into Makefile.in, which isn't likely to work out well. I don't recall this being *required* anywhere; it looks like overzealous cleanup. check-in: a8184428f3 user: tangent tags: trunk
00:45
If the C API library is in one of the linker's default paths and the first directory the mysql_loc macro searched for the library doesn't exist, it would use that in the -L flag since the link succeeded with that first try. Some linkers (e.g. current macOS) then complain about a bogus -L flag, even though the link succeeds. We now skip the test for directories that don't exist, so that we exit that loop in such cases with one of the bog standard directories like /usr/lib, which exists everywhere. check-in: f2533e5ac5 user: tangent tags: trunk
00:34
No longer #including mysql_version.h ahead of mysql.h in lib/common.h. It causes a warning in newer C API libraries, and we didn't really need to do it anyway. check-in: 80288634c8 user: tangent tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to config/mysql_loc.m4.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
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
...
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
dnl
dnl		--with-mysql: Give prefix for both library and headers, and try
dnl			to guess subdirectory names for each by tacking common
dnl         suffixes on like /lib and /include.
dnl		--with-mysql-lib: Same as --with-mysql, but for library only.
dnl		--with-mysql-include: Same as --with-mysql, but for headers only.
dnl
dnl @version 1.5, 2016/12/31
dnl @author Warren Young <mysqlpp@etr-usa.com>
AC_DEFUN([MYSQL_C_API_LOCATION],
[
	#
	# Set up configure script macros
	#
	AC_ARG_WITH(mysql,
................................................................................
	save_CPPFLAGS=$CPPFLAGS
	save_LIBS=$LIBS
	save_LDFLAGS=$LDFLAGS
	CPPFLAGS="$CPPFLAGS -I$MYSQL_C_INC_DIR"
	MYSQL_C_LIB_DIR=
	for m in $MYSQL_lib_check
	do


		LDFLAGS="$save_LDFLAGS -L$m"
		LIBS="$save_LIBS -l$MYSQL_C_LIB_NAME"
		AC_TRY_LINK(
			[ #include <mysql.h> ],
			[ mysql_store_result(0); ],
			[ AC_MSG_RESULT([$m])
			  MYSQL_C_LIB_DIR=$m
			  break
			],
			[ LIBS="$save_LIBS -l$MYSQL_C_LIB_NAME -lz"
			  AC_TRY_LINK(
				  [ #include <mysql.h> ],
				  [ mysql_store_result(0); ],
				  [ AC_MSG_RESULT([$m])
				    MYSQLPP_EXTRA_LIBS="$MYSQLPP_EXTRA_LIBS -lz"
			  		MYSQL_C_LIB_DIR=$m
					break
				  ],
				  [ ]
			  )
			])

	done
	CPPFLAGS=$save_CPPFLAGS
	LIBS=$save_LIBS
	LDFLAGS=$save_LDFLAGS

	if test -z "$MYSQL_C_LIB_DIR"
	then
................................................................................
	fi

	case "$MYSQL_C_LIB_DIR" in
		/* ) ;;
		* )  AC_MSG_ERROR([The MySQL library directory ($MYSQL_C_LIB_DIR) must be an absolute path.]) ;;
	esac

	if [	"$MYSQL_C_LIB_DIR" = "/usr/lib" -o \
			"$MYSQL_C_LIB_DIR" = "/usr/lib64" ]
	then
		# Remove redundant lib paths
		MYSQL_C_LIB_DIR=
	fi

	AC_SUBST(MYSQL_C_INC_DIR)
	AC_SUBST(MYSQL_C_LIB_DIR)
	AC_SUBST(MYSQL_C_LIB_NAME)
]) dnl MYSQL_C_API_LOCATION








|







 







>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>







 







|
|










6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
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
...
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
dnl
dnl		--with-mysql: Give prefix for both library and headers, and try
dnl			to guess subdirectory names for each by tacking common
dnl         suffixes on like /lib and /include.
dnl		--with-mysql-lib: Same as --with-mysql, but for library only.
dnl		--with-mysql-include: Same as --with-mysql, but for headers only.
dnl
dnl @version 1.6, 2017/11/23
dnl @author Warren Young <mysqlpp@etr-usa.com>
AC_DEFUN([MYSQL_C_API_LOCATION],
[
	#
	# Set up configure script macros
	#
	AC_ARG_WITH(mysql,
................................................................................
	save_CPPFLAGS=$CPPFLAGS
	save_LIBS=$LIBS
	save_LDFLAGS=$LDFLAGS
	CPPFLAGS="$CPPFLAGS -I$MYSQL_C_INC_DIR"
	MYSQL_C_LIB_DIR=
	for m in $MYSQL_lib_check
	do
        if test -d $m
        then
            LDFLAGS="$save_LDFLAGS -L$m"
            LIBS="$save_LIBS -l$MYSQL_C_LIB_NAME"
            AC_TRY_LINK(
                [ #include <mysql.h> ],
                [ mysql_store_result(0); ],
                [ AC_MSG_RESULT([$m])
                  MYSQL_C_LIB_DIR=$m
                  break
                ],
                [ LIBS="$save_LIBS -l$MYSQL_C_LIB_NAME -lz"
                  AC_TRY_LINK(
                      [ #include <mysql.h> ],
                      [ mysql_store_result(0); ],
                      [ AC_MSG_RESULT([$m])
                        MYSQLPP_EXTRA_LIBS="$MYSQLPP_EXTRA_LIBS -lz"
                        MYSQL_C_LIB_DIR=$m
                        break
                      ],
                      [ ]
                  )
                ])
        fi
	done
	CPPFLAGS=$save_CPPFLAGS
	LIBS=$save_LIBS
	LDFLAGS=$save_LDFLAGS

	if test -z "$MYSQL_C_LIB_DIR"
	then
................................................................................
	fi

	case "$MYSQL_C_LIB_DIR" in
		/* ) ;;
		* )  AC_MSG_ERROR([The MySQL library directory ($MYSQL_C_LIB_DIR) must be an absolute path.]) ;;
	esac

	if  test "$MYSQL_C_LIB_DIR" = "/usr/lib" || \
		test "$MYSQL_C_LIB_DIR" = "/usr/lib64"
	then
		# Remove redundant lib paths
		MYSQL_C_LIB_DIR=
	fi

	AC_SUBST(MYSQL_C_INC_DIR)
	AC_SUBST(MYSQL_C_LIB_DIR)
	AC_SUBST(MYSQL_C_LIB_NAME)
]) dnl MYSQL_C_API_LOCATION